-rw-r--r-- | NEWS | 1 | ||||
-rw-r--r-- | NEWS.xml | 1 | ||||
-rw-r--r-- | content/fireflix-panel.xul | 1 | ||||
-rw-r--r-- | content/fireflix.js | 12 | ||||
-rw-r--r-- | content/flickr.js | 4 |
5 files changed, 15 insertions, 4 deletions
@@ -1,20 +1,21 @@ 0.0.5 () - Added toolbar button - Enter or double click on photo in set now opens photo in flickr + - Double click on photoset opens photoset in flickr 0.0.4 (November 13th, 2006) - Added button to remove linebreaks from generated HTML - Added the word 'sidebar' to the extension name so that you don't have to look hard for it - UI polishing, including making it more boring - code cosmetics 0.0.3 (November 6th, 2006) - Firefox 2.0 compatibility 0.0.2 (October 17th, 2006) - Added brief help file - Fixed HTML generation code - Fixed a mistyped flickr url so that the 'Flickr' button works now 0.0.1 (October 3rd, 2006) - Added ability to paginate through search results - Fixed packaging bug that omitted packaging license dialog - A lot of code cleanup and UI polishing 0.0 (September 26th, 2006) - Initial release @@ -1,29 +1,30 @@ <?xml version="1.0" encoding="us-ascii"?> <news> <version version="0.0.5"> <ni>Added toolbar button</ni> <ni>Enter or double click on photo in set now opens photo in flickr</ni> + <ni>Double click on photoset opens photoset in flickr</ni> </version> <version version="0.0.4" date="November 13th, 2006"> <ni>Added button to remove linebreaks from generated HTML</ni> <ni>Added the word 'sidebar' to the extension name so that you don't have to look hard for it</ni> <ni>UI polishing, including making it more boring</ni> <ni>code cosmetics</ni> </version> <version version="0.0.3" date="November 6th, 2006"> <ni>Firefox 2.0 compatibility</ni> </version> <version version="0.0.2" date="October 17th, 2006"> <ni>Added brief help file</ni> <ni>Fixed HTML generation code</ni> <ni>Fixed a mistyped flickr url so that the 'Flickr' button works now</ni> </version> <version version="0.0.1" date="October 3rd, 2006"> <ni>Added ability to paginate through search results</ni> <ni>Fixed packaging bug that omitted packaging license dialog</ni> <ni>A lot of code cleanup and UI polishing</ni> </version> <version version="0.0" date="September 26th, 2006"> <ni>Initial release</ni> </version> </news> diff --git a/content/fireflix-panel.xul b/content/fireflix-panel.xul index b2ca7dc..af92d22 100644 --- a/content/fireflix-panel.xul +++ b/content/fireflix-panel.xul @@ -155,64 +155,65 @@ onkeypress="if(event.keyCode==event.DOM_VK_RETURN) fireflix.foundphotos.on_cmd_open(event)"> <treecols> <treecol id="sr_title" label="&panel.search.col.title.label;" flex="2" crop="end" align="start" /> </treecols> <treechildren/> </tree> <groupbox id="searchresult_props" orient="horizontal" hidden="true"> <vbox width="100" pack="center"> <hbox pack="center"> <image id="search_photo" ondblclick="fireflix.foundphotos.on_cmd_open(event)"/> </hbox> </vbox> <vbox flex="1"> <label id="searchresult_title" crop="end"/> <hbox flex="1" pack="center"> <div flex="1" id="searchresult_description" xmlns="http://www.w3.org/1999/xhtml"/> </hbox> <hbox pack="end"> <button command="cmd_search_open"/> </hbox> </vbox> </groupbox> </vbox> </tabpanel> <tabpanel id="tabpanel_sets" flex="1" onkeypress="if(event.keyCode==event.DOM_VK_RETURN) document.getElementById('setphotos').focus()"> <vbox flex="1"> <tree id="setslist" rows="2" onselect="fireflix.photosets.on_select()" flex="1" context="sets_menu" + ondblclick="fireflix.photosets.on_cmd_open_in_flickr(event)" > <treecols> <treecol id="sl_name" label="&panel.sets.name.label;" flex="4" crop="end" align="start" tooltiptext="&panel.sets.name.tip;"/> <splitter class="tree-splitter" /> <treecol id="sl_photos" label="&panel.sets.photos.label;" flex="1" align="end" tooltiptext="&panel.sets.photos.tip;" /> </treecols> <treechildren/> </tree> <hbox> <button command="cmd_refresh_sets" /> <button command="cmd_set_props" /> </hbox> <tree id="setphotos" rows="2" onselect="fireflix.photoset.on_select()" flex="1" ondblclick="fireflix.photoset.on_cmd_open(event)" onkeypress="if(event.keyCode==event.DOM_VK_RETURN) fireflix.photoset.on_cmd_open(event)"> <treecols> <treecol id="sp_title" label="&panel.setphotos.title.label;" flex="1" crop="end" align="start" tooltiptext="&panel.setphotos.title.tip;" /> <splitter class="tree-splitter" /> <treecol id="sp_taken" label="&panel.setphotos.taken.label;" crop="end" align="start" tooltiptext="&panel.setphotos.taken.tip;" hidden="true" /> <treecol id="sp_upload" label="&panel.setphotos.upload.label;" crop="end" align="start" tooltiptext="&panel.setphotos.upload.tip;" hidden="true" /> </treecols> <treechildren/> </tree> <groupbox id="set_photo_props" orient="horizontal"> <vbox width="100" pack="center"> <hbox pack="center"> <image id="set_photo" hidden="true" ondblclick="fireflix.photoset.on_cmd_open(event)" /> </hbox> </vbox> <spacer flex="1"/> </groupbox> diff --git a/content/fireflix.js b/content/fireflix.js index 24894df..48053c5 100644 --- a/content/fireflix.js +++ b/content/fireflix.js @@ -135,69 +135,67 @@ var fireflix = { this.selection.clearSelection(); }, load_photos: function(psid) { var _this = this; this.fireflix.flickr.api_call( { method: 'flickr.photosets.getPhotos', auth_token: 'default', photoset_id: psid, extras: 'license,date_upload,date_taken,owner_name,icon_server,original_format,last_update' }, function(xr) { var x = xr.responseXML; var xp = x.evaluate( '/rsp/photoset/photo', x, null, XPathResult.ORDERED_NODE_ITERATOR_TYPE, null ); _this.importXPR(xp); }, function(x,s,c,m) { _this.fireflix.flickr_failure(x,s,c,m); } ); }, on_select: function() { if(this.selection.count==1) { var p = this.photos[this.selection.currentIndex]; this.set_photo.src = this.fireflix.flickr.get_photo_url(p.server,p.id,p.secret,'t'); this.set_photo.hidden = false; }else{ this.set_photo.hidden = true; } }, on_cmd_open: function(ev) { - if(this.selection.currentIndex<0) - return; + if(this.selection.currentIndex<0) return; var p = this.photos[this.selection.currentIndex]; - if(!p.id) - return; + if(!p.id) return; this.fireflix.openTab(this.fireflix.flickr.make_photo_url(p,'p')); } }, /* photosets treeview */ photosets: { sets: new Array(), fireflix: null, init: function(f) { this.fireflix = f; document.getElementById('setslist').view = this; }, rowCount: 0, getCellText: function(r,c) { var s = this.sets[r]; if(c.id=='sl_name') return s.title; if(c.id=='sl_photos') return s.photos; return c.id; }, setTree: function(t) { this.tree = t }, isContainer: function(r) { return false; }, isSeparator: function(r) { return false; }, isSorted: function() { return false; }, getLevel: function(r) { return 0; }, getImageSrc: function(r,c) { return null }, getRowProperties: function(r,p) {}, getCellProperties: function(cid,cel,p) { }, getColumnProperties: function(cid,cel,p) { }, cycleHeader: function(cid,e) { }, getParentIndex: function(r) { return -1; }, drop: function(r,o) { }, canDropBeforeAfter: function(r,b) { return false }, @@ -207,64 +205,70 @@ var fireflix = { this.sets = new Array(); var n; while(n=xp.iterateNext()) { this.sets.push(new Photoset(n)); } this.rowCount = this.sets.length; this.tree.endUpdateBatch(); }, refresh_sets: function() { var _this = this; this.fireflix.flickr.api_call( { method: 'flickr.photosets.getList', auth_token: 'default' }, function(xr) { var x = xr.responseXML; var xp = x.evaluate( '/rsp/photosets/photoset', x, null, XPathResult.ORDERED_NODE_ITERATOR_TYPE, null ); _this.importXPR(xp); }, function(x,s,c,m) { _this.fireflix.flickr_failure(x,s,c,m); } ); }, on_select: function() { if(this.selection.count==1) { this.fireflix.cmd_set_props.setAttribute('disabled','false'); var s = this.sets[this.selection.currentIndex]; this.fireflix.photoset.load_photos(s.id); }else{ this.fireflix.cmd_set_props.setAttribute('disabled','true'); } + }, + on_cmd_open_in_flickr: function(ev) { + if(this.selection.currentIndex<0) return; + var p = this.sets[this.selection.currentIndex]; + if(!p.id) return; + this.fireflix.openTab(this.fireflix.flickr.make_photoset_url(p)); } }, refresh_user_tags: function() { var lb = document.getElementById('tagslist'); var _this = this; this.flickr.api_call( { method: 'flickr.tags.getListUser', auth_token: 'default', }, function(xr) { var x = xr.responseXML; var xp = x.evaluate( '/rsp/who/tags/tag', x, null, XPathResult.ORDERED_NODE_ITERATOR_TYPE, null ); // TODO: clear list var n; while(n=xp.iterateNext()) { lb.appendItem(n.firstChild.nodeValue); } }, function(x,s,c,m) { _this.flickr_failure(x,s,c,m); } ); }, uploadObserver: { fireflix: null, init: function(f) { this.fireflix = f; }, getSupportedFlavours: function() { var rv = new FlavourSet(); diff --git a/content/flickr.js b/content/flickr.js index 75d1a72..b8360c1 100644 --- a/content/flickr.js +++ b/content/flickr.js @@ -242,64 +242,68 @@ Flickr.prototype = { get_photo_url: function(ser,id,sec,sfx,ext) { var rv = this.photo_url + ser + '/' + id + '_' + sec; if(sfx && sfx!='_') rv += '_'+sfx; rv += ext?'.'+ext:'.jpg'; return rv; }, get_image_url: function(o,sfx) { return this.get_photo_url( o.server, (o instanceof Photoset)? o.primary : o.id, o.secret, sfx, (sfx=='o')?o.originalformat:null ); }, get_photo_page_url: function(p) { if(p instanceof Photo) { // TODO: track photoset and user owner id from there? // The approach below is sheerly wrong. var o = this.user.nsid; if(p.owner && p.owner.nsid) o = p.owner.nsid; var rv = this.photos_url + o +'/' + p.id; return rv; }else // TODO: take owner into account? return this.photos_url + this.user.nsid + '/' + p; }, make_photo_url: function(p,sfx) { if(sfx=='p') return this.get_photo_page_url(p); else return this.get_image_url(p,sfx); }, + make_photoset_url: function(ps) { + // TODO: allow for using someone else's photoset? + return this.photos_url+this.user.nsid+'/sets/'+ps.id; + }, upload_file: function(f,fa,on_success,on_failure) { try { var fi = Components.classes["@mozilla.org/file/local;1"] .createInstance(Components.interfaces.nsILocalFile); fi.initWithPath( f ); var st = Components.classes["@mozilla.org/network/file-input-stream;1"] .createInstance(Components.interfaces.nsIFileInputStream); st.init(fi,0x01,00004,null); var bis = Components.classes["@mozilla.org/binaryinputstream;1"] .createInstance(Components.interfaces.nsIBinaryInputStream); bis.setInputStream(st); // allocate and initialize temp storage string var pbs = Components.classes["@mozilla.org/storagestream;1"] .createInstance(Components.interfaces.nsIStorageStream); pbs.init(1024,10000000,null); // create output stream var pbos = pbs.getOutputStream(0); // and a binaryoutputstream interface var pbbos = Components.classes["@mozilla.org/binaryoutputstream;1"] .createInstance(Components.interfaces.nsIBinaryOutputStream); pbbos.setOutputStream(pbos); /* create POST body */ var boundarytoken = 'kadaroloongazaduviaxamma'; var boundary = '--'+boundarytoken; var b = ''; var parms = { api_key: this.api_key, auth_token: this.token }; for(var p in fa) parms[p] = fa[p]; var pns = new Array(); |