summaryrefslogtreecommitdiffabout
authorMichael Krelin <hacker@klever.net>2006-11-16 21:54:55 (UTC)
committer Michael Krelin <hacker@klever.net>2006-11-16 21:54:55 (UTC)
commit8db8cc953a91ccba910228bdaf2563ffd92f3d61 (patch) (unidiff)
treecce7bfe83b5273f309f8b3a47ae0373bc029910d
parent26b7e66a091703dab249ca11f00a1cb49987c393 (diff)
downloadfireflix-8db8cc953a91ccba910228bdaf2563ffd92f3d61.zip
fireflix-8db8cc953a91ccba910228bdaf2563ffd92f3d61.tar.gz
fireflix-8db8cc953a91ccba910228bdaf2563ffd92f3d61.tar.bz2
open flickr page on enter or dblclicking photo in set browser
git-svn-id: http://svn.klever.net/kin/fireflix/trunk@226 fe716a7a-6dde-0310-88d9-d003556173a8
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--content/fireflix-panel.xul9
-rw-r--r--content/fireflix.js8
2 files changed, 13 insertions, 4 deletions
diff --git a/content/fireflix-panel.xul b/content/fireflix-panel.xul
index 2356c82..b2ca7dc 100644
--- a/content/fireflix-panel.xul
+++ b/content/fireflix-panel.xul
@@ -59,236 +59,237 @@
59 </commandset> 59 </commandset>
60 60
61 <commandset id="cmdset_sets"> 61 <commandset id="cmdset_sets">
62 <command id="cmd_refresh_sets" label="&panel.sets.cmd_refresh_sets;" 62 <command id="cmd_refresh_sets" label="&panel.sets.cmd_refresh_sets;"
63 oncommand="fireflix.on_refresh_sets()" /> 63 oncommand="fireflix.on_refresh_sets()" />
64 <command id="cmd_set_props" label="&panel.sets.cmd_properties;" 64 <command id="cmd_set_props" label="&panel.sets.cmd_properties;"
65 oncommand="fireflix.on_set_props()" disabled="true" /> 65 oncommand="fireflix.on_set_props()" disabled="true" />
66 </commandset> 66 </commandset>
67 67
68 <popupset> 68 <popupset>
69 <popup id="sets_menu"> 69 <popup id="sets_menu">
70 <menuitem command="cmd_set_props"/> 70 <menuitem command="cmd_set_props"/>
71 <menuitem command="cmd_refresh_sets"/> 71 <menuitem command="cmd_refresh_sets"/>
72 <menuseparator/> 72 <menuseparator/>
73 <menu label="&panel.sets.generate_html;" id="sets_html_menu"/> 73 <menu label="&panel.sets.generate_html;" id="sets_html_menu"/>
74 </popup> 74 </popup>
75 </popupset> 75 </popupset>
76 76
77 <commandset id="cmdset_uploads"> 77 <commandset id="cmdset_uploads">
78 <command id="cmd_uploads_clear" label="&panel.uploads.clear.label;" 78 <command id="cmd_uploads_clear" label="&panel.uploads.clear.label;"
79 oncommand="fireflix.uploads.on_clear()" /> 79 oncommand="fireflix.uploads.on_clear()" />
80 <command id="cmd_uploads_upload" label="&panel.uploads.upload.label;" 80 <command id="cmd_uploads_upload" label="&panel.uploads.upload.label;"
81 oncommand="fireflix.uploads.on_upload()" /> 81 oncommand="fireflix.uploads.on_upload()" />
82 <command id="cmd_uploads_remove" label="&panel.uploads.remove.label;" 82 <command id="cmd_uploads_remove" label="&panel.uploads.remove.label;"
83 oncommand="fireflix.uploads.on_remove()" /> 83 oncommand="fireflix.uploads.on_remove()" />
84 <command id="cmd_uploads_add" label="&panel.uploads.add.label;" 84 <command id="cmd_uploads_add" label="&panel.uploads.add.label;"
85 oncommand="fireflix.uploads.on_add()" /> 85 oncommand="fireflix.uploads.on_add()" />
86 </commandset> 86 </commandset>
87 87
88 <popupset> 88 <popupset>
89 <popup id="uploads_menu"> 89 <popup id="uploads_menu">
90 <menuitem command="cmd_uploads_add"/> 90 <menuitem command="cmd_uploads_add"/>
91 <menuitem command="cmd_uploads_clear"/> 91 <menuitem command="cmd_uploads_clear"/>
92 <menuitem command="cmd_uploads_remove"/> 92 <menuitem command="cmd_uploads_remove"/>
93 <menuseparator/> 93 <menuseparator/>
94 <menuitem command="cmd_uploads_upload"/> 94 <menuitem command="cmd_uploads_upload"/>
95 <menuseparator/> 95 <menuseparator/>
96 <menu label="&panel.uploads.generate_html;" id="uploads_html_menu"/> 96 <menu label="&panel.uploads.generate_html;" id="uploads_html_menu"/>
97 </popup> 97 </popup>
98 </popupset> 98 </popupset>
99 99
100 <vbox class="wholething" flex="1"> 100 <vbox class="wholething" flex="1">
101 101
102 <groupbox context="auth_menu"> 102 <groupbox context="auth_menu">
103 <caption label="&panel.auth_info;"/> 103 <caption label="&panel.auth_info;"/>
104 <hbox> 104 <hbox>
105 <vbox pack="center" flex="1"> 105 <vbox pack="center" flex="1">
106 <label id="auth_info" value="&panel.no_auth_info;" disabled="true" crop="end"/> 106 <label id="auth_info" value="&panel.no_auth_info;" disabled="true" crop="end"/>
107 </vbox> 107 </vbox>
108 <button class="lean" id="b_auth" command="cmd_auth_auth"/> 108 <button class="lean" id="b_auth" command="cmd_auth_auth"/>
109 <button class="lean" id="b_auth_done" command="cmd_auth_done" hidden="true"/> 109 <button class="lean" id="b_auth_done" command="cmd_auth_done" hidden="true"/>
110 <button class="lean" command="cmd_auth_open_flickr" 110 <button class="lean" command="cmd_auth_open_flickr"
111 tooltiptext="&panel.auth.flickr.tip;"/> 111 tooltiptext="&panel.auth.flickr.tip;"/>
112 <button class="lean" command="cmd_help"/> 112 <button class="lean" command="cmd_help"/>
113 </hbox> 113 </hbox>
114 </groupbox> 114 </groupbox>
115 115
116 <tabbox flex="1" id="fireflix_tabs"> 116 <tabbox flex="1" id="fireflix_tabs">
117 117
118 <tabs> 118 <tabs>
119 <tab label="&panel.tabs.search;"/> 119 <tab label="&panel.tabs.search;"/>
120 <tab label="&panel.tabs.sets;"/> 120 <tab label="&panel.tabs.sets;"/>
121 <tab label="&panel.tabs.tags;" hidden="true"/> <!-- TODO: --> 121 <tab label="&panel.tabs.tags;" hidden="true"/> <!-- TODO: -->
122 <tab id="tab_upload" label="&panel.tabs.upload;"/> 122 <tab id="tab_upload" label="&panel.tabs.upload;"/>
123 </tabs> 123 </tabs>
124 124
125 <tabpanels flex="1"> 125 <tabpanels flex="1">
126 126
127 <tabpanel id="tabpanel_search" flex="1"> 127 <tabpanel id="tabpanel_search" flex="1">
128 <vbox flex="1"> 128 <vbox flex="1">
129 <groupbox class="search_params" orient="vertical" onkeypress="if(event.keyCode==event.DOM_VK_RETURN) fireflix.foundphotos.search_photos()"> 129 <groupbox class="search_params" orient="vertical" onkeypress="if(event.keyCode==event.DOM_VK_RETURN) fireflix.foundphotos.search_photos()">
130 <hbox> 130 <hbox>
131 <vbox pack="center"> 131 <vbox pack="center">
132 <label control="search_for" value="&panel.search.search_for.label;" accesskey="s"/> 132 <label control="search_for" value="&panel.search.search_for.label;" accesskey="s"/>
133 </vbox> 133 </vbox>
134 <textbox id="search_for" flex="1"/> 134 <textbox id="search_for" flex="1"/>
135 </hbox> 135 </hbox>
136 <hbox> 136 <hbox>
137 <checkbox id="search_tags" label="&panel.search.mode.tagsonly.label;" 137 <checkbox id="search_tags" label="&panel.search.mode.tagsonly.label;"
138 tooltiptext="&panel.search.mode.tagsonly.tip;" checked="false" 138 tooltiptext="&panel.search.mode.tagsonly.tip;" checked="false"
139 accesskey="t" /> 139 accesskey="t" />
140 <checkbox id="search_mine" label="&panel.search.mode.mine.label;" checked="true" accesskey="m"/> 140 <checkbox id="search_mine" label="&panel.search.mode.mine.label;" checked="true" accesskey="m"/>
141 <spacer flex="1"/> 141 <spacer flex="1"/>
142 <button class="lean" command="cmd_search"/> 142 <button class="lean" command="cmd_search"/>
143 </hbox> 143 </hbox>
144 </groupbox> 144 </groupbox>
145 <hbox> 145 <hbox>
146 <button class="lean" command="cmd_search_prev_page"/> 146 <button class="lean" command="cmd_search_prev_page"/>
147 <spacer flex="1"/> 147 <spacer flex="1"/>
148 <label id="search_page" hidden="true"/> 148 <label id="search_page" hidden="true"/>
149 <spacer flex="1"/> 149 <spacer flex="1"/>
150 <button class="lean" command="cmd_search_next_page"/> 150 <button class="lean" command="cmd_search_next_page"/>
151 </hbox> 151 </hbox>
152 <tree id="searchresults" rows="2" flex="1" 152 <tree id="searchresults" rows="2" flex="1"
153 onselect="fireflix.foundphotos.on_select()" 153 onselect="fireflix.foundphotos.on_select()"
154 ondblclick="fireflix.foundphotos.on_cmd_open(event)" 154 ondblclick="fireflix.foundphotos.on_cmd_open(event)"
155 onkeypress="if(event.keyCode==event.DOM_VK_RETURN) 155 onkeypress="if(event.keyCode==event.DOM_VK_RETURN) fireflix.foundphotos.on_cmd_open(event)">
156 fireflix.foundphotos.on_cmd_open(event)">
157 <treecols> 156 <treecols>
158 <treecol id="sr_title" label="&panel.search.col.title.label;" flex="2" crop="end" align="start" /> 157 <treecol id="sr_title" label="&panel.search.col.title.label;" flex="2" crop="end" align="start" />
159 </treecols> 158 </treecols>
160 <treechildren/> 159 <treechildren/>
161 </tree> 160 </tree>
162 <groupbox id="searchresult_props" orient="horizontal" hidden="true"> 161 <groupbox id="searchresult_props" orient="horizontal" hidden="true">
163 <vbox width="100" pack="center"> 162 <vbox width="100" pack="center">
164 <hbox pack="center"> 163 <hbox pack="center">
165 <image id="search_photo" 164 <image id="search_photo"
166 ondblclick="fireflix.foundphotos.on_cmd_open(event)"/> 165 ondblclick="fireflix.foundphotos.on_cmd_open(event)"/>
167 </hbox> 166 </hbox>
168 </vbox> 167 </vbox>
169 <vbox flex="1"> 168 <vbox flex="1">
170 <label id="searchresult_title" crop="end"/> 169 <label id="searchresult_title" crop="end"/>
171 <hbox flex="1" pack="center"> 170 <hbox flex="1" pack="center">
172 <div flex="1" id="searchresult_description" xmlns="http://www.w3.org/1999/xhtml"/> 171 <div flex="1" id="searchresult_description" xmlns="http://www.w3.org/1999/xhtml"/>
173 </hbox> 172 </hbox>
174 <hbox pack="end"> 173 <hbox pack="end">
175 <button command="cmd_search_open"/> 174 <button command="cmd_search_open"/>
176 </hbox> 175 </hbox>
177 </vbox> 176 </vbox>
178 </groupbox> 177 </groupbox>
179 </vbox> 178 </vbox>
180 </tabpanel> 179 </tabpanel>
181 180
182 <tabpanel id="tabpanel_sets" flex="1" 181 <tabpanel id="tabpanel_sets" flex="1"
183 onkeypress="if(event.keyCode==event.DOM_VK_RETURN) 182 onkeypress="if(event.keyCode==event.DOM_VK_RETURN)
184 document.getElementById('setphotos').focus()"> 183 document.getElementById('setphotos').focus()">
185 <vbox flex="1"> 184 <vbox flex="1">
186 <tree id="setslist" rows="2" onselect="fireflix.photosets.on_select()" 185 <tree id="setslist" rows="2" onselect="fireflix.photosets.on_select()"
187 flex="1" context="sets_menu" 186 flex="1" context="sets_menu"
188 > 187 >
189 <treecols> 188 <treecols>
190 <treecol id="sl_name" label="&panel.sets.name.label;" flex="4" crop="end" align="start" tooltiptext="&panel.sets.name.tip;"/> 189 <treecol id="sl_name" label="&panel.sets.name.label;" flex="4" crop="end" align="start" tooltiptext="&panel.sets.name.tip;"/>
191 <splitter class="tree-splitter" /> 190 <splitter class="tree-splitter" />
192 <treecol id="sl_photos" label="&panel.sets.photos.label;" flex="1" align="end" tooltiptext="&panel.sets.photos.tip;" /> 191 <treecol id="sl_photos" label="&panel.sets.photos.label;" flex="1" align="end" tooltiptext="&panel.sets.photos.tip;" />
193 </treecols> 192 </treecols>
194 <treechildren/> 193 <treechildren/>
195 </tree> 194 </tree>
196 <hbox> 195 <hbox>
197 <button command="cmd_refresh_sets" /> 196 <button command="cmd_refresh_sets" />
198 <button command="cmd_set_props" /> 197 <button command="cmd_set_props" />
199 </hbox> 198 </hbox>
200 <tree id="setphotos" rows="2" onselect="fireflix.photoset.on_select()" 199 <tree id="setphotos" rows="2" onselect="fireflix.photoset.on_select()"
201 flex="1"> 200 flex="1" ondblclick="fireflix.photoset.on_cmd_open(event)"
201 onkeypress="if(event.keyCode==event.DOM_VK_RETURN) fireflix.photoset.on_cmd_open(event)">
202 <treecols> 202 <treecols>
203 <treecol id="sp_title" label="&panel.setphotos.title.label;" flex="1" crop="end" align="start" tooltiptext="&panel.setphotos.title.tip;" /> 203 <treecol id="sp_title" label="&panel.setphotos.title.label;" flex="1" crop="end" align="start" tooltiptext="&panel.setphotos.title.tip;" />
204 <splitter class="tree-splitter" /> 204 <splitter class="tree-splitter" />
205 <treecol id="sp_taken" label="&panel.setphotos.taken.label;" crop="end" align="start" tooltiptext="&panel.setphotos.taken.tip;" hidden="true" /> 205 <treecol id="sp_taken" label="&panel.setphotos.taken.label;" crop="end" align="start" tooltiptext="&panel.setphotos.taken.tip;" hidden="true" />
206 <treecol id="sp_upload" label="&panel.setphotos.upload.label;" crop="end" align="start" tooltiptext="&panel.setphotos.upload.tip;" hidden="true" /> 206 <treecol id="sp_upload" label="&panel.setphotos.upload.label;" crop="end" align="start" tooltiptext="&panel.setphotos.upload.tip;" hidden="true" />
207 </treecols> 207 </treecols>
208 <treechildren/> 208 <treechildren/>
209 </tree> 209 </tree>
210 <groupbox id="set_photo_props" orient="horizontal"> 210 <groupbox id="set_photo_props" orient="horizontal">
211 <vbox width="100" pack="center"> 211 <vbox width="100" pack="center">
212 <hbox pack="center"> 212 <hbox pack="center">
213 <image id="set_photo" hidden="true"/> 213 <image id="set_photo" hidden="true"
214 ondblclick="fireflix.photoset.on_cmd_open(event)" />
214 </hbox> 215 </hbox>
215 </vbox> 216 </vbox>
216 <spacer flex="1"/> 217 <spacer flex="1"/>
217 </groupbox> 218 </groupbox>
218 </vbox> 219 </vbox>
219 </tabpanel> 220 </tabpanel>
220 221
221 <tabpanel id="tabpanel_tags"> 222 <tabpanel id="tabpanel_tags">
222 <listbox id="tagslist" rows="8" flex="1"> 223 <listbox id="tagslist" rows="8" flex="1">
223 <listhead> 224 <listhead>
224 <listheader label="&panel.tagslist.tag.label;"/> 225 <listheader label="&panel.tagslist.tag.label;"/>
225 </listhead> 226 </listhead>
226 <listcols> 227 <listcols>
227 <listcol flex="1"/> 228 <listcol flex="1"/>
228 </listcols> 229 </listcols>
229 </listbox> 230 </listbox>
230 </tabpanel> 231 </tabpanel>
231 232
232 <tabpanel id="tabpanel_upload"> 233 <tabpanel id="tabpanel_upload">
233 <vbox flex="1"> 234 <vbox flex="1">
234 <tree id="uploadlist" rows="2" flex="1" 235 <tree id="uploadlist" rows="2" flex="1"
235 onselect="fireflix.uploads.selectionChanged()" 236 onselect="fireflix.uploads.selectionChanged()"
236 context="uploads_menu"> 237 context="uploads_menu">
237 <treecols> 238 <treecols>
238 <treecol id="up_file" label="&panel.uploadlist.file.label;" flex="4" crop="start" align="start"/> 239 <treecol id="up_file" label="&panel.uploadlist.file.label;" flex="4" crop="start" align="start"/>
239 <splitter class="tree-splitter" /> 240 <splitter class="tree-splitter" />
240 <treecol id="up_title" label="&panel.uploadlist.title.label;" flex="5" crop="end" align="start" /> 241 <treecol id="up_title" label="&panel.uploadlist.title.label;" flex="5" crop="end" align="start" />
241 <splitter class="tree-splitter" /> 242 <splitter class="tree-splitter" />
242 <treecol id="up_status" label="&panel.uploadlist.status.label;" flex="1" crop="end" align="start" /> 243 <treecol id="up_status" label="&panel.uploadlist.status.label;" flex="1" crop="end" align="start" />
243 </treecols> 244 </treecols>
244 <treechildren/> 245 <treechildren/>
245 </tree> 246 </tree>
246 <progressmeter id="upload_progress" mode="undetermined" hidden="true" /> 247 <progressmeter id="upload_progress" mode="undetermined" hidden="true" />
247 <groupbox id="upload_file_props" orient="horizontal" hidden="true"> 248 <groupbox id="upload_file_props" orient="horizontal" hidden="true">
248 <image id="upload_file_preview" width="100" height="100" /> 249 <image id="upload_file_preview" width="100" height="100" />
249 <grid flex="1"> 250 <grid flex="1">
250 <columns> 251 <columns>
251 <column/> 252 <column/>
252 <column flex="1"/> 253 <column flex="1"/>
253 </columns> 254 </columns>
254 <rows> 255 <rows>
255 <row> 256 <row>
256 <label control="upload_filename" 257 <label control="upload_filename"
257 value="&panel.upload_props.filename.label;" /> 258 value="&panel.upload_props.filename.label;" />
258 <textbox id="upload_filename" 259 <textbox id="upload_filename"
259 oninput="fireflix.uploads.propsToSel('filename')"/> 260 oninput="fireflix.uploads.propsToSel('filename')"/>
260 </row> 261 </row>
261 <row> 262 <row>
262 <label control="upload_title" value="&panel.upload_props.title.label;" /> 263 <label control="upload_title" value="&panel.upload_props.title.label;" />
263 <textbox id="upload_title" 264 <textbox id="upload_title"
264 oninput="fireflix.uploads.propsToSel('title')"/> 265 oninput="fireflix.uploads.propsToSel('title')"/>
265 </row> 266 </row>
266 <row> 267 <row>
267 <label control="uplod_tags" value="&panel.upload_props.tags.label;" /> 268 <label control="uplod_tags" value="&panel.upload_props.tags.label;" />
268 <textbox id="upload_tags" 269 <textbox id="upload_tags"
269 oninput="fireflix.uploads.propsToSel('tags')"/> 270 oninput="fireflix.uploads.propsToSel('tags')"/>
270 </row> 271 </row>
271 <!-- TODO: description, public, friend, family --> 272 <!-- TODO: description, public, friend, family -->
272 </rows> 273 </rows>
273 </grid> 274 </grid>
274 </groupbox> 275 </groupbox>
275 <hbox> 276 <hbox>
276 <button class="lean" command="cmd_uploads_add" /> 277 <button class="lean" command="cmd_uploads_add" />
277 <spacer flex="1"/> 278 <spacer flex="1"/>
278 <button class="lean" command="cmd_uploads_remove" /> 279 <button class="lean" command="cmd_uploads_remove" />
279 <spacer flex="1"/> 280 <spacer flex="1"/>
280 <button class="lean" command="cmd_uploads_clear" /> 281 <button class="lean" command="cmd_uploads_clear" />
281 </hbox> 282 </hbox>
282 <hbox pack="center"> 283 <hbox pack="center">
283 <button command="cmd_uploads_upload" flex="1"/> 284 <button command="cmd_uploads_upload" flex="1"/>
284 </hbox> 285 </hbox>
285 </vbox> 286 </vbox>
286 </tabpanel> 287 </tabpanel>
287 288
288 </tabpanels> 289 </tabpanels>
289 290
290 </tabbox> 291 </tabbox>
291 292
292 </vbox> 293 </vbox>
293 294
294</page> 295</page>
diff --git a/content/fireflix.js b/content/fireflix.js
index 0f51397..2ee408f 100644
--- a/content/fireflix.js
+++ b/content/fireflix.js
@@ -68,192 +68,200 @@ var fireflix = {
68 _this.flickr.save_token(); 68 _this.flickr.save_token();
69 _this.refresh_stuff(); 69 _this.refresh_stuff();
70 _this.set_auth_state(_this.flickr.token,false); 70 _this.set_auth_state(_this.flickr.token,false);
71 _this.auth_info.value = 71 _this.auth_info.value =
72 _this.flickr.user.fullname+' ['+_this.flickr.user.username+']'; 72 _this.flickr.user.fullname+' ['+_this.flickr.user.username+']';
73 }, function(x,s,c,m) { 73 }, function(x,s,c,m) {
74 _this.set_auth_state(_this.flickr.token,false); /* XXX: no reset token? */ 74 _this.set_auth_state(_this.flickr.token,false); /* XXX: no reset token? */
75 _this.flickr_failure(x,s,c,m); 75 _this.flickr_failure(x,s,c,m);
76 } 76 }
77 ); 77 );
78 }, 78 },
79 on_cmd_auth_unauth: function() { 79 on_cmd_auth_unauth: function() {
80 this.flickr.reset_token(); 80 this.flickr.reset_token();
81 this.set_auth_state(false,false); 81 this.set_auth_state(false,false);
82 }, 82 },
83 83
84 refresh_sets: function() { this.photosets.refresh_sets(); }, 84 refresh_sets: function() { this.photosets.refresh_sets(); },
85 refresh_stuff: function() { 85 refresh_stuff: function() {
86 this.refresh_sets(); 86 this.refresh_sets();
87 this.refresh_user_tags(); 87 this.refresh_user_tags();
88 }, 88 },
89 89
90 /* photoset treeview */ 90 /* photoset treeview */
91 photoset: { 91 photoset: {
92 photos: new Array(), 92 photos: new Array(),
93 fireflix: null, 93 fireflix: null,
94 init: function(f) { 94 init: function(f) {
95 this.fireflix = f; 95 this.fireflix = f;
96 pull_elements(this,document,[ 'set_photo' ]); 96 pull_elements(this,document,[ 'set_photo' ]);
97 document.getElementById('setphotos').view = this; 97 document.getElementById('setphotos').view = this;
98 }, 98 },
99 rowCount: 0, 99 rowCount: 0,
100 getCellText: function(r,c) { 100 getCellText: function(r,c) {
101 var p = this.photos[r]; 101 var p = this.photos[r];
102 if(c.id=='sp_title') return p.title; 102 if(c.id=='sp_title') return p.title;
103 if(c.id=='sp_taken') return p.datetaken; 103 if(c.id=='sp_taken') return p.datetaken;
104 if(c.id=='sp_upload') { 104 if(c.id=='sp_upload') {
105 var du = new Date(p.dateupload*1000); 105 var du = new Date(p.dateupload*1000);
106 var rv = du.getFullYear()+'-'+(du.getMonth()+1)+'-'+du.getDate() 106 var rv = du.getFullYear()+'-'+(du.getMonth()+1)+'-'+du.getDate()
107 +' '+ 107 +' '+
108 du.getHours()+':'+du.getMinutes()+':'+du.getSeconds(); 108 du.getHours()+':'+du.getMinutes()+':'+du.getSeconds();
109 return rv.replace(/(\D)(\d)(\D)/,'$10$2$3'); 109 return rv.replace(/(\D)(\d)(\D)/,'$10$2$3');
110 } 110 }
111 return c.id; 111 return c.id;
112 }, 112 },
113 setTree: function(t) { this.tree = t }, 113 setTree: function(t) { this.tree = t },
114 isContainer: function(r) { return false; }, 114 isContainer: function(r) { return false; },
115 isSeparator: function(r) { return false; }, 115 isSeparator: function(r) { return false; },
116 isSorted: function(r) { return false; }, 116 isSorted: function(r) { return false; },
117 getLevel: function(r) { return 0; }, 117 getLevel: function(r) { return 0; },
118 getImageSrc: function(r,c) { return null }, 118 getImageSrc: function(r,c) { return null },
119 getRowProperties: function(r,p) {}, 119 getRowProperties: function(r,p) {},
120 getCellProperties: function(cid,cel,p) {}, 120 getCellProperties: function(cid,cel,p) {},
121 getColumnProperties: function(cid,cel,p) { }, 121 getColumnProperties: function(cid,cel,p) { },
122 cycleHeader: function(cid,e) { }, 122 cycleHeader: function(cid,e) { },
123 getParentIndex: function(r) { return -1; }, 123 getParentIndex: function(r) { return -1; },
124 drop: function(r,o) { }, 124 drop: function(r,o) { },
125 canDropBeforeAfter: function(r,b) { return false }, 125 canDropBeforeAfter: function(r,b) { return false },
126 126
127 importXPR: function(xp) { 127 importXPR: function(xp) {
128 this.tree.beginUpdateBatch(); 128 this.tree.beginUpdateBatch();
129 this.photos = new Array(); 129 this.photos = new Array();
130 var n; while(n=xp.iterateNext()) { 130 var n; while(n=xp.iterateNext()) {
131 this.photos.push(new Photo(n)); 131 this.photos.push(new Photo(n));
132 } 132 }
133 this.rowCount = this.photos.length; 133 this.rowCount = this.photos.length;
134 this.tree.endUpdateBatch(); 134 this.tree.endUpdateBatch();
135 }, 135 },
136 load_photos: function(psid) { 136 load_photos: function(psid) {
137 var _this = this; 137 var _this = this;
138 this.fireflix.flickr.api_call( 138 this.fireflix.flickr.api_call(
139 { 139 {
140 method: 'flickr.photosets.getPhotos', 140 method: 'flickr.photosets.getPhotos',
141 auth_token: 'default', 141 auth_token: 'default',
142 photoset_id: psid, 142 photoset_id: psid,
143 extras: 'license,date_upload,date_taken,owner_name,icon_server,original_format,last_update' 143 extras: 'license,date_upload,date_taken,owner_name,icon_server,original_format,last_update'
144 }, function(xr) { 144 }, function(xr) {
145 var x = xr.responseXML; 145 var x = xr.responseXML;
146 var xp = x.evaluate( 146 var xp = x.evaluate(
147 '/rsp/photoset/photo', x, null, 147 '/rsp/photoset/photo', x, null,
148 XPathResult.ORDERED_NODE_ITERATOR_TYPE, null ); 148 XPathResult.ORDERED_NODE_ITERATOR_TYPE, null );
149 _this.importXPR(xp); 149 _this.importXPR(xp);
150 }, function(x,s,c,m) { 150 }, function(x,s,c,m) {
151 _this.fireflix.flickr_failure(x,s,c,m); 151 _this.fireflix.flickr_failure(x,s,c,m);
152 } 152 }
153 ); 153 );
154 }, 154 },
155 on_select: function() { 155 on_select: function() {
156 if(this.selection.count==1) { 156 if(this.selection.count==1) {
157 var p = this.photos[this.selection.currentIndex]; 157 var p = this.photos[this.selection.currentIndex];
158 this.set_photo.src = 158 this.set_photo.src =
159 this.fireflix.flickr.get_photo_url(p.server,p.id,p.secret,'t'); 159 this.fireflix.flickr.get_photo_url(p.server,p.id,p.secret,'t');
160 this.set_photo.hidden = false; 160 this.set_photo.hidden = false;
161 }else{ 161 }else{
162 this.set_photo.hidden = true; 162 this.set_photo.hidden = true;
163 } 163 }
164 },
165 on_cmd_open: function(ev) {
166 if(this.selection.currentIndex<0)
167 return;
168 var p = this.photos[this.selection.currentIndex];
169 if(!p.id)
170 return;
171 this.fireflix.openTab(this.fireflix.flickr.make_photo_url(p,'p'));
164 } 172 }
165 }, 173 },
166 174
167 /* photosets treeview */ 175 /* photosets treeview */
168 photosets: { 176 photosets: {
169 sets: new Array(), 177 sets: new Array(),
170 fireflix: null, 178 fireflix: null,
171 init: function(f) { 179 init: function(f) {
172 this.fireflix = f; 180 this.fireflix = f;
173 document.getElementById('setslist').view = this; 181 document.getElementById('setslist').view = this;
174 }, 182 },
175 rowCount: 0, 183 rowCount: 0,
176 getCellText: function(r,c) { 184 getCellText: function(r,c) {
177 var s = this.sets[r]; 185 var s = this.sets[r];
178 if(c.id=='sl_name') return s.title; 186 if(c.id=='sl_name') return s.title;
179 if(c.id=='sl_photos') return s.photos; 187 if(c.id=='sl_photos') return s.photos;
180 return c.id; 188 return c.id;
181 }, 189 },
182 setTree: function(t) { this.tree = t }, 190 setTree: function(t) { this.tree = t },
183 isContainer: function(r) { return false; }, 191 isContainer: function(r) { return false; },
184 isSeparator: function(r) { return false; }, 192 isSeparator: function(r) { return false; },
185 isSorted: function() { return false; }, 193 isSorted: function() { return false; },
186 getLevel: function(r) { return 0; }, 194 getLevel: function(r) { return 0; },
187 getImageSrc: function(r,c) { return null }, 195 getImageSrc: function(r,c) { return null },
188 getRowProperties: function(r,p) {}, 196 getRowProperties: function(r,p) {},
189 getCellProperties: function(cid,cel,p) { }, 197 getCellProperties: function(cid,cel,p) { },
190 getColumnProperties: function(cid,cel,p) { }, 198 getColumnProperties: function(cid,cel,p) { },
191 cycleHeader: function(cid,e) { }, 199 cycleHeader: function(cid,e) { },
192 getParentIndex: function(r) { return -1; }, 200 getParentIndex: function(r) { return -1; },
193 drop: function(r,o) { }, 201 drop: function(r,o) { },
194 canDropBeforeAfter: function(r,b) { return false }, 202 canDropBeforeAfter: function(r,b) { return false },
195 203
196 importXPR: function(xp) { 204 importXPR: function(xp) {
197 this.tree.beginUpdateBatch(); 205 this.tree.beginUpdateBatch();
198 this.sets = new Array(); 206 this.sets = new Array();
199 var n; while(n=xp.iterateNext()) { 207 var n; while(n=xp.iterateNext()) {
200 this.sets.push(new Photoset(n)); 208 this.sets.push(new Photoset(n));
201 } 209 }
202 this.rowCount = this.sets.length; 210 this.rowCount = this.sets.length;
203 this.tree.endUpdateBatch(); 211 this.tree.endUpdateBatch();
204 }, 212 },
205 refresh_sets: function() { 213 refresh_sets: function() {
206 var _this = this; 214 var _this = this;
207 this.fireflix.flickr.api_call( 215 this.fireflix.flickr.api_call(
208 { 216 {
209 method: 'flickr.photosets.getList', 217 method: 'flickr.photosets.getList',
210 auth_token: 'default' 218 auth_token: 'default'
211 }, function(xr) { 219 }, function(xr) {
212 var x = xr.responseXML; 220 var x = xr.responseXML;
213 var xp = x.evaluate( 221 var xp = x.evaluate(
214 '/rsp/photosets/photoset', x, null, 222 '/rsp/photosets/photoset', x, null,
215 XPathResult.ORDERED_NODE_ITERATOR_TYPE, null ); 223 XPathResult.ORDERED_NODE_ITERATOR_TYPE, null );
216 _this.importXPR(xp); 224 _this.importXPR(xp);
217 }, function(x,s,c,m) { 225 }, function(x,s,c,m) {
218 _this.fireflix.flickr_failure(x,s,c,m); 226 _this.fireflix.flickr_failure(x,s,c,m);
219 } 227 }
220 ); 228 );
221 }, 229 },
222 on_select: function() { 230 on_select: function() {
223 if(this.selection.count==1) { 231 if(this.selection.count==1) {
224 this.fireflix.cmd_set_props.setAttribute('disabled','false'); 232 this.fireflix.cmd_set_props.setAttribute('disabled','false');
225 var s = this.sets[this.selection.currentIndex]; 233 var s = this.sets[this.selection.currentIndex];
226 this.fireflix.photoset.load_photos(s.id); 234 this.fireflix.photoset.load_photos(s.id);
227 }else{ 235 }else{
228 this.fireflix.cmd_set_props.setAttribute('disabled','true'); 236 this.fireflix.cmd_set_props.setAttribute('disabled','true');
229 } 237 }
230 } 238 }
231 }, 239 },
232 240
233 refresh_user_tags: function() { 241 refresh_user_tags: function() {
234 var lb = document.getElementById('tagslist'); 242 var lb = document.getElementById('tagslist');
235 var _this = this; 243 var _this = this;
236 this.flickr.api_call( 244 this.flickr.api_call(
237 { 245 {
238 method: 'flickr.tags.getListUser', 246 method: 'flickr.tags.getListUser',
239 auth_token: 'default', 247 auth_token: 'default',
240 }, function(xr) { 248 }, function(xr) {
241 var x = xr.responseXML; 249 var x = xr.responseXML;
242 var xp = x.evaluate( 250 var xp = x.evaluate(
243 '/rsp/who/tags/tag', x, null, 251 '/rsp/who/tags/tag', x, null,
244 XPathResult.ORDERED_NODE_ITERATOR_TYPE, null ); 252 XPathResult.ORDERED_NODE_ITERATOR_TYPE, null );
245 // TODO: clear list 253 // TODO: clear list
246 var n; while(n=xp.iterateNext()) { 254 var n; while(n=xp.iterateNext()) {
247 lb.appendItem(n.firstChild.nodeValue); 255 lb.appendItem(n.firstChild.nodeValue);
248 } 256 }
249 }, function(x,s,c,m) { 257 }, function(x,s,c,m) {
250 _this.flickr_failure(x,s,c,m); 258 _this.flickr_failure(x,s,c,m);
251 } 259 }
252 ); 260 );
253 }, 261 },
254 262
255 uploadObserver: { 263 uploadObserver: {
256 fireflix: null, 264 fireflix: null,
257 init: function(f) { 265 init: function(f) {
258 this.fireflix = f; 266 this.fireflix = f;
259 }, 267 },