author | Michael Krelin <hacker@klever.net> | 2006-09-26 19:21:57 (UTC) |
---|---|---|
committer | Michael Krelin <hacker@klever.net> | 2006-09-26 19:21:57 (UTC) |
commit | c5ea6ff7abd6e376ae151c9724d24f6fe156766e (patch) (side-by-side diff) | |
tree | 0df2e4ecf02f89c4b85d1950b5c6f4fd2f67f9bd /content/photoset-props.js | |
parent | 5207247fdc837ae9de1d81db903f6cd92532595e (diff) | |
download | fireflix-c5ea6ff7abd6e376ae151c9724d24f6fe156766e.zip fireflix-c5ea6ff7abd6e376ae151c9724d24f6fe156766e.tar.gz fireflix-c5ea6ff7abd6e376ae151c9724d24f6fe156766e.tar.bz2 |
Initial import into public repository0.0
git-svn-id: http://svn.klever.net/kin/fireflix/trunk@159 fe716a7a-6dde-0310-88d9-d003556173a8
-rw-r--r-- | content/photoset-props.js | 81 |
1 files changed, 81 insertions, 0 deletions
diff --git a/content/photoset-props.js b/content/photoset-props.js new file mode 100644 index 0000000..43dc1b9 --- a/dev/null +++ b/content/photoset-props.js @@ -0,0 +1,81 @@ + +var psetprops = { + fireflix: null, + photoset: null, + pripic: null, + + settitle: null, setdesc: null, + primarypic: null, + photos: new Array(), + init: function() { + this.fireflix = window.arguments[0]; + this.photoset = window.arguments[1]; + this.settitle = document.getElementById('set_title'); + this.settitle.value = this.photoset.title; + this.setdesc = document.getElementById('set_desc'); + this.setdesc.value = this.photoset.description; + this.primarypic = document.getElementById('primary_picture'); + this.primarypic.src = + this.fireflix.flickr.get_image_url( this.photoset, 't' ); + this.primarypic.hidden = false; + this.picslist = document.getElementById('primary_picture_list'); + + var _this = this; + this.fireflix.flickr.api_call( + { + method: 'flickr.photosets.getPhotos', + auth_token: 'default', + photoset_id: this.photoset.id + }, function(xr) { + var x = xr.responseXML; + var xp = x.evaluate( + '/rsp/photoset/photo', x, null, + XPathResult.ORDERED_NODE_ITERATOR_TYPE, null ); + _this.picslist.removeAllItems(); _this.photos= new Array(); + var n; while(n=xp.iterateNext()) { + _this.photos.push( + { + id: n.getAttribute('id'), + secret: n.getAttribute('secret'), + server: n.getAttribute('server') + } + ); + var ni = _this.picslist.appendItem( + n.getAttribute('title'), _this.photos.length-1 + ); + ni.setAttribute('command','cmd_select_picture'); + if(n.getAttribute('isprimary')==1) { + _this.picslist.selectedItem = ni; + _this.pripic = _this.photos[_this.photos.length-1]; + } + } + _this.picslist.hidden = false; + }, function() { } + ); + }, + on_select_picture: function(ev) { + var epic = ev.explicitOriginalTarget; + this.picslist.selectedItem = epic; + var pic = this.photos[this.picslist.selectedItem.value]; + this.pripic = pic; + this.primarypic.src = + this.fireflix.flickr.get_photo_url( + pic.server, + pic.id, + pic.secret, + 't' + ); + }, + on_accept: function() { + this.photoset.title = + document.getElementById('set_title').value; + this.photoset.description = + document.getElementById('set_desc').value; + this.photoset.server = this.pripic.server; + this.photoset.primary = this.pripic.id; + this.photoset.secret = this.pripic.secret; + this.photoset.dirty = true; + return; + } +}; + |