summaryrefslogtreecommitdiffabout
authorMichael Krelin <hacker@klever.net>2006-12-18 13:22:11 (UTC)
committer Michael Krelin <hacker@klever.net>2006-12-18 13:22:11 (UTC)
commit676ead33f615fbc2affb3cb979d1316f0676daef (patch) (unidiff)
tree06e7afff01a0c1df631c7f635618403d7989572a
parentb609e9157c1587b11f177edfa7fe65f6851e9706 (diff)
downloadfireflix-676ead33f615fbc2affb3cb979d1316f0676daef.zip
fireflix-676ead33f615fbc2affb3cb979d1316f0676daef.tar.gz
fireflix-676ead33f615fbc2affb3cb979d1316f0676daef.tar.bz2
make file properties visible but readonly for non-pending downloads.
And while we're at it show failure reason for failed uploads. git-svn-id: http://svn.klever.net/kin/fireflix/trunk@238 fe716a7a-6dde-0310-88d9-d003556173a8
Diffstat (more/less context) (show whitespace changes)
-rw-r--r--content/fireflix-panel.xul7
-rw-r--r--content/fireflix.css8
-rw-r--r--content/fireflix.js25
3 files changed, 31 insertions, 9 deletions
diff --git a/content/fireflix-panel.xul b/content/fireflix-panel.xul
index 0e511c5..aa3dbd6 100644
--- a/content/fireflix-panel.xul
+++ b/content/fireflix-panel.xul
@@ -210,96 +210,99 @@
210 flex="1" ondblclick="fireflix.photoset.on_cmd_open(event)" 210 flex="1" ondblclick="fireflix.photoset.on_cmd_open(event)"
211 onkeypress="if(event.keyCode==event.DOM_VK_RETURN) fireflix.photoset.on_cmd_open(event)" context="setphotos_menu"> 211 onkeypress="if(event.keyCode==event.DOM_VK_RETURN) fireflix.photoset.on_cmd_open(event)" context="setphotos_menu">
212 <treecols> 212 <treecols>
213 <treecol id="sp_title" label="&panel.setphotos.title.label;" flex="1" crop="end" align="start" tooltiptext="&panel.setphotos.title.tip;" /> 213 <treecol id="sp_title" label="&panel.setphotos.title.label;" flex="1" crop="end" align="start" tooltiptext="&panel.setphotos.title.tip;" />
214 <splitter class="tree-splitter" /> 214 <splitter class="tree-splitter" />
215 <treecol id="sp_taken" label="&panel.setphotos.taken.label;" crop="end" align="start" tooltiptext="&panel.setphotos.taken.tip;" hidden="true" /> 215 <treecol id="sp_taken" label="&panel.setphotos.taken.label;" crop="end" align="start" tooltiptext="&panel.setphotos.taken.tip;" hidden="true" />
216 <treecol id="sp_upload" label="&panel.setphotos.upload.label;" crop="end" align="start" tooltiptext="&panel.setphotos.upload.tip;" hidden="true" /> 216 <treecol id="sp_upload" label="&panel.setphotos.upload.label;" crop="end" align="start" tooltiptext="&panel.setphotos.upload.tip;" hidden="true" />
217 </treecols> 217 </treecols>
218 <treechildren/> 218 <treechildren/>
219 </tree> 219 </tree>
220 <groupbox id="set_photo_props" orient="horizontal" hidden="true"> 220 <groupbox id="set_photo_props" orient="horizontal" hidden="true">
221 <vbox width="100" pack="center"> 221 <vbox width="100" pack="center">
222 <hbox pack="center"> 222 <hbox pack="center">
223 <image id="set_photo" 223 <image id="set_photo"
224 ondblclick="fireflix.photoset.on_cmd_open(event)" /> 224 ondblclick="fireflix.photoset.on_cmd_open(event)" />
225 </hbox> 225 </hbox>
226 </vbox> 226 </vbox>
227 <spacer flex="1"/> 227 <spacer flex="1"/>
228 </groupbox> 228 </groupbox>
229 </vbox> 229 </vbox>
230 </tabpanel> 230 </tabpanel>
231 231
232 <tabpanel id="tabpanel_tags"> 232 <tabpanel id="tabpanel_tags">
233 <listbox id="tagslist" rows="8" flex="1"> 233 <listbox id="tagslist" rows="8" flex="1">
234 <listhead> 234 <listhead>
235 <listheader label="&panel.tagslist.tag.label;"/> 235 <listheader label="&panel.tagslist.tag.label;"/>
236 </listhead> 236 </listhead>
237 <listcols> 237 <listcols>
238 <listcol flex="1"/> 238 <listcol flex="1"/>
239 </listcols> 239 </listcols>
240 </listbox> 240 </listbox>
241 </tabpanel> 241 </tabpanel>
242 242
243 <tabpanel id="tabpanel_upload"> 243 <tabpanel id="tabpanel_upload">
244 <vbox flex="1"> 244 <vbox flex="1">
245 <tree id="uploadlist" rows="2" flex="1" 245 <tree id="uploadlist" rows="2" flex="1"
246 onselect="fireflix.uploads.selectionChanged()" 246 onselect="fireflix.uploads.selectionChanged()"
247 context="uploads_menu"> 247 context="uploads_menu">
248 <treecols> 248 <treecols>
249 <treecol id="up_file" label="&panel.uploadlist.file.label;" flex="4" crop="start" align="start"/> 249 <treecol id="up_file" label="&panel.uploadlist.file.label;" flex="4" crop="start" align="start"/>
250 <splitter class="tree-splitter" /> 250 <splitter class="tree-splitter" />
251 <treecol id="up_title" label="&panel.uploadlist.title.label;" flex="5" crop="end" align="start" /> 251 <treecol id="up_title" label="&panel.uploadlist.title.label;" flex="5" crop="end" align="start" />
252 <splitter class="tree-splitter" /> 252 <splitter class="tree-splitter" />
253 <treecol id="up_status" label="&panel.uploadlist.status.label;" flex="1" crop="end" align="start" /> 253 <treecol id="up_status" label="&panel.uploadlist.status.label;" flex="1" crop="end" align="start" />
254 </treecols> 254 </treecols>
255 <treechildren/> 255 <treechildren/>
256 </tree> 256 </tree>
257 <progressmeter id="upload_progress" mode="undetermined" hidden="true" /> 257 <progressmeter id="upload_progress" mode="undetermined" hidden="true" />
258 <groupbox id="upload_file_props" orient="horizontal" hidden="true"> 258 <groupbox id="upload_file_props" orient="vertical" hidden="true">
259 <hbox>
259 <image id="upload_file_preview" width="100" height="100" /> 260 <image id="upload_file_preview" width="100" height="100" />
260 <grid flex="1"> 261 <grid flex="1">
261 <columns> 262 <columns>
262 <column/> 263 <column/>
263 <column flex="1"/> 264 <column flex="1"/>
264 </columns> 265 </columns>
265 <rows> 266 <rows>
266 <row> 267 <row>
267 <label control="upload_filename" 268 <label control="upload_filename"
268 value="&panel.upload_props.filename.label;" /> 269 value="&panel.upload_props.filename.label;" />
269 <textbox id="upload_filename" 270 <textbox id="upload_filename"
270 oninput="fireflix.uploads.propsToSel('filename')"/> 271 oninput="fireflix.uploads.propsToSel('filename')"/>
271 </row> 272 </row>
272 <row> 273 <row>
273 <label control="upload_title" value="&panel.upload_props.title.label;" /> 274 <label control="upload_title" value="&panel.upload_props.title.label;" />
274 <textbox id="upload_title" 275 <textbox id="upload_title"
275 oninput="fireflix.uploads.propsToSel('title')"/> 276 oninput="fireflix.uploads.propsToSel('title')"/>
276 </row> 277 </row>
277 <row> 278 <row>
278 <label control="uplod_tags" value="&panel.upload_props.tags.label;" /> 279 <label control="upload_tags" value="&panel.upload_props.tags.label;" />
279 <textbox id="upload_tags" 280 <textbox id="upload_tags"
280 oninput="fireflix.uploads.propsToSel('tags')"/> 281 oninput="fireflix.uploads.propsToSel('tags')"/>
281 </row> 282 </row>
282 <!-- TODO: description, public, friend, family --> 283 <!-- TODO: description, public, friend, family -->
283 </rows> 284 </rows>
284 </grid> 285 </grid>
286 </hbox>
287 <description id="upload_failure" hidden="true"/>
285 </groupbox> 288 </groupbox>
286 <hbox> 289 <hbox>
287 <button class="lean" command="cmd_uploads_add" /> 290 <button class="lean" command="cmd_uploads_add" />
288 <spacer flex="1"/> 291 <spacer flex="1"/>
289 <button class="lean" command="cmd_uploads_remove" /> 292 <button class="lean" command="cmd_uploads_remove" />
290 <spacer flex="1"/> 293 <spacer flex="1"/>
291 <button class="lean" command="cmd_uploads_clear" /> 294 <button class="lean" command="cmd_uploads_clear" />
292 </hbox> 295 </hbox>
293 <hbox pack="center"> 296 <hbox pack="center">
294 <button command="cmd_uploads_upload" flex="1"/> 297 <button command="cmd_uploads_upload" flex="1"/>
295 </hbox> 298 </hbox>
296 </vbox> 299 </vbox>
297 </tabpanel> 300 </tabpanel>
298 301
299 </tabpanels> 302 </tabpanels>
300 303
301 </tabbox> 304 </tabbox>
302 305
303 </vbox> 306 </vbox>
304 307
305</page> 308</page>
diff --git a/content/fireflix.css b/content/fireflix.css
index ab90c11..06ae28a 100644
--- a/content/fireflix.css
+++ b/content/fireflix.css
@@ -1,93 +1,101 @@
1html#help, 1html#help,
2.generated.wholething, .about.wholething /* XXX:, 2.generated.wholething, .about.wholething /* XXX:,
3tabbox, tabpanels, tabpanel */ { 3tabbox, tabpanels, tabpanel */ {
4 background: url("background.jpeg"); 4 background: url("background.jpeg");
5} 5}
6tabpanels { 6tabpanels {
7 padding: 0px; 7 padding: 0px;
8} 8}
9 9
10tree { 10tree {
11 margin-top: 2px; 11 margin-top: 2px;
12 color: #2d354a; 12 color: #2d354a;
13 font-size: 90%; 13 font-size: 90%;
14} 14}
15tree treechildren { /* for windows */ 15tree treechildren { /* for windows */
16 background: #c5ffc5; 16 background: #c5ffc5;
17} 17}
18 18
19tree#uploadlist treechildren::-moz-tree-cell-text(pending) { 19tree#uploadlist treechildren::-moz-tree-cell-text(pending) {
20} 20}
21tree#uploadlist treechildren::-moz-tree-cell-text(completed) { 21tree#uploadlist treechildren::-moz-tree-cell-text(completed) {
22 color: black; 22 color: black;
23} 23}
24tree#uploadlist treechildren::-moz-tree-row(failed) { 24tree#uploadlist treechildren::-moz-tree-row(failed) {
25 background: yellow; 25 background: yellow;
26} 26}
27tree#uploadlist treechildren::-moz-tree-cell-text(failed) { 27tree#uploadlist treechildren::-moz-tree-cell-text(failed) {
28 color: red; 28 color: red;
29} 29}
30tree#uploadlist treechildren::-moz-tree-cell-text(uploading) { 30tree#uploadlist treechildren::-moz-tree-cell-text(uploading) {
31 font-weight: bold; 31 font-weight: bold;
32} 32}
33 33
34groupbox#searchresult_props, 34groupbox#searchresult_props,
35groupbox.search_params, 35groupbox.search_params,
36groupbox#upload_file_props, 36groupbox#upload_file_props,
37groupbox#set_props, 37groupbox#set_props,
38groupbox#set_photo_props { 38groupbox#set_photo_props {
39 background: white; 39 background: white;
40} 40}
41 41
42groupbox#upload_file_props label { 42groupbox#upload_file_props label {
43 text-align: right; 43 text-align: right;
44} 44}
45 45
46description#upload_failure {
47 border-top: solid 1px red;
48 margin: 0px; padding: 2px;
49 text-align: left;
50 font-size: 85%;
51 line-height: 105%;
52}
53
46image#search_photo, image#set_photo, image#set_primary { 54image#search_photo, image#set_photo, image#set_primary {
47 border: black 1px solid; 55 border: black 1px solid;
48} 56}
49 57
50.about .insides { 58.about .insides {
51 margin: 1ex; 59 margin: 1ex;
52} 60}
53.about .text { 61.about .text {
54 border: yellow solid 1px; 62 border: yellow solid 1px;
55 background: green; 63 background: green;
56} 64}
57.about .title { 65.about .title {
58 font-size: 300%; 66 font-size: 300%;
59 font-weight: bold; 67 font-weight: bold;
60 color: yellow; 68 color: yellow;
61} 69}
62.about .link { 70.about .link {
63 text-decoration: underline; 71 text-decoration: underline;
64 color: white; 72 color: white;
65 cursor: pointer; 73 cursor: pointer;
66} 74}
67 75
68menuitem.menuhead { 76menuitem.menuhead {
69 background: gray; 77 background: gray;
70 color: black; 78 color: black;
71 font-weight: bold; 79 font-weight: bold;
72} 80}
73 81
74div#searchresult_description { 82div#searchresult_description {
75 min-height: 5em; max-height: 8em; 83 min-height: 5em; max-height: 8em;
76 overflow: auto; 84 overflow: auto;
77 font-size: 90%; 85 font-size: 90%;
78 margin: 0.1ex 0.5ex; 86 margin: 0.1ex 0.5ex;
79} 87}
80 88
81#copying div { 89#copying div {
82 margin: 1ex 1em; 90 margin: 1ex 1em;
83 font-family: courier, monospace; 91 font-family: courier, monospace;
84 font-size: 9pt; 92 font-size: 9pt;
85 padding: 2px; 93 padding: 2px;
86 border: dotted 1px gray; 94 border: dotted 1px gray;
87 background: white; 95 background: white;
88} 96}
89 97
90label#search_page { 98label#search_page {
91 font-weight: bold; 99 font-weight: bold;
92 background: white; color: #404040; 100 background: white; color: #404040;
93 border-color: #c0c0c0 #404040 #404040 #c0c0c0; 101 border-color: #c0c0c0 #404040 #404040 #c0c0c0;
diff --git a/content/fireflix.js b/content/fireflix.js
index 995ec5c..7291b68 100644
--- a/content/fireflix.js
+++ b/content/fireflix.js
@@ -287,97 +287,97 @@ var fireflix = {
287 for(var i in dd.dataList) { 287 for(var i in dd.dataList) {
288 var di = dd.dataList[i]; 288 var di = dd.dataList[i];
289 var dif = di.first; 289 var dif = di.first;
290 if( 290 if(
291 ldf==null 291 ldf==null
292 || ldf.flavour.contentType!=dif.flavour.contentType 292 || ldf.flavour.contentType!=dif.flavour.contentType
293 || ldf.contentLength!=dif.contentLength 293 || ldf.contentLength!=dif.contentLength
294 || ldf.data!=dif.data ) 294 || ldf.data!=dif.data )
295 this.drop_item(ev,di,s); 295 this.drop_item(ev,di,s);
296 ldf = dif; 296 ldf = dif;
297 } 297 }
298 }, 298 },
299 drop_item: function(ev,di,s) { 299 drop_item: function(ev,di,s) {
300 var d = di.first; 300 var d = di.first;
301 switch(d.flavour.contentType) { 301 switch(d.flavour.contentType) {
302 case 'text/unicode': 302 case 'text/unicode':
303 this.drop_urilist(ev,d.data,s); 303 this.drop_urilist(ev,d.data,s);
304 break; 304 break;
305 case 'application/x-moz-file': 305 case 'application/x-moz-file':
306 this.fireflix.uploads.add(d.data.path); 306 this.fireflix.uploads.add(d.data.path);
307 document.getElementById('fireflix_tabs').selectedTab 307 document.getElementById('fireflix_tabs').selectedTab
308 = document.getElementById('tab_upload'); 308 = document.getElementById('tab_upload');
309 break; 309 break;
310 case 'text/uri-list': 310 case 'text/uri-list':
311 // is it ascii or could it be utf8? 311 // is it ascii or could it be utf8?
312 this.drop_urilist(ev,splitascii(d.data),s); 312 this.drop_urilist(ev,splitascii(d.data),s);
313 break; 313 break;
314 default: alert(d.flavour.contentType+':'+d.data); break; 314 default: alert(d.flavour.contentType+':'+d.data); break;
315 }; 315 };
316 }, 316 },
317 drop_urilist: function(ev,ul,s) { 317 drop_urilist: function(ev,ul,s) {
318 // TODO: check for being a file? 318 // TODO: check for being a file?
319 var us = decodeURIComponent(ul).split(/[\r\n]/); 319 var us = decodeURIComponent(ul).split(/[\r\n]/);
320 for(var ui in us) 320 for(var ui in us)
321 if(/\S/.test(us[ui])) 321 if(/\S/.test(us[ui]))
322 this.fireflix.uploads.add(us[ui]); 322 this.fireflix.uploads.add(us[ui]);
323 document.getElementById('fireflix_tabs').selectedTab 323 document.getElementById('fireflix_tabs').selectedTab
324 = document.getElementById('tab_upload'); 324 = document.getElementById('tab_upload');
325 } 325 }
326 }, 326 },
327 327
328 uploads: { 328 uploads: {
329 fireflix: null, 329 fireflix: null,
330 init: function(f) { 330 init: function(f) {
331 this.fireflix=f; 331 this.fireflix=f;
332 pull_elements(this,document,[ 332 pull_elements(this,document,[
333 'upload_filename','upload_title','upload_file_preview', 333 'upload_filename','upload_title','upload_file_preview',
334 'upload_file_props','upload_progress','upload_tags', 334 'upload_file_props','upload_progress','upload_tags',
335 'cmd_uploads_upload' 335 'cmd_uploads_upload', 'upload_failure'
336 ]); 336 ]);
337 document.getElementById('uploadlist').view = this; 337 document.getElementById('uploadlist').view = this;
338 }, 338 },
339 files: new Array(), 339 files: new Array(),
340 rowCount: 0, 340 rowCount: 0,
341 getCellText: function(r,c) { 341 getCellText: function(r,c) {
342 var f = this.files[r]; 342 var f = this.files[r];
343 if(c.id=='up_file') return f.file; 343 if(c.id=='up_file') return f.file;
344 if(c.id=='up_title') return f.title; 344 if(c.id=='up_title') return f.title;
345 if(c.id=='up_status') return f.state; 345 if(c.id=='up_status') return f.state;
346 return c.id; 346 return c.id;
347 }, 347 },
348 setTree: function(t) { this.tree = t }, 348 setTree: function(t) { this.tree = t },
349 isContainer: function(r) { return false; }, 349 isContainer: function(r) { return false; },
350 isSeparator: function(r) { return false; }, 350 isSeparator: function(r) { return false; },
351 isSorted: function(r) { return false; }, 351 isSorted: function(r) { return false; },
352 getLevel: function(r) { return 0; }, 352 getLevel: function(r) { return 0; },
353 getImageSrc: function(r,c) { return null }, 353 getImageSrc: function(r,c) { return null },
354 getRowProperties: function(r,p) { 354 getRowProperties: function(r,p) {
355 try { 355 try {
356 if(!Components) return; 356 if(!Components) return;
357 }catch(e) { return } 357 }catch(e) { return }
358 var f = this.files[r]; 358 var f = this.files[r];
359 var as = Components.classes['@mozilla.org/atom-service;1']. 359 var as = Components.classes['@mozilla.org/atom-service;1'].
360 getService(Components.interfaces.nsIAtomService); 360 getService(Components.interfaces.nsIAtomService);
361 p.AppendElement(as.getAtom(f.state)); 361 p.AppendElement(as.getAtom(f.state));
362 }, 362 },
363 getCellProperties: function(r,c,p) { this.getRowProperties(r,p); }, 363 getCellProperties: function(r,c,p) { this.getRowProperties(r,p); },
364 getColumnProperties: function(c,p) { }, 364 getColumnProperties: function(c,p) { },
365 cycleHeader: function(cid,e) { }, 365 cycleHeader: function(cid,e) { },
366 getParentIndex: function(r) { return -1; }, 366 getParentIndex: function(r) { return -1; },
367 drop: function(r,o) { }, 367 drop: function(r,o) { },
368 canDropBeforeAfter: function(r,b) { return false }, 368 canDropBeforeAfter: function(r,b) { return false },
369 369
370 add: function(f) { 370 add: function(f) {
371 if(f.indexOf('file:/')==0) { 371 if(f.indexOf('file:/')==0) {
372 f = f.substr(5); 372 f = f.substr(5);
373 while(f.substr(0,2)=='//') { // XXX: not very performant, is it? ;-) 373 while(f.substr(0,2)=='//') { // XXX: not very performant, is it? ;-)
374 f = f.substr(1); 374 f = f.substr(1);
375 } 375 }
376 } 376 }
377 var t = f; 377 var t = f;
378 var ls = t.lastIndexOf('/'); 378 var ls = t.lastIndexOf('/');
379 if(ls>0) t = t.substr(ls+1); 379 if(ls>0) t = t.substr(ls+1);
380 ls = t.lastIndexOf('\\'); 380 ls = t.lastIndexOf('\\');
381 if(ls>0) t = t.substr(ls+1); 381 if(ls>0) t = t.substr(ls+1);
382 var ld = t.lastIndexOf('.'); 382 var ld = t.lastIndexOf('.');
383 if(ld>0) t = t.substr(0,ld); 383 if(ld>0) t = t.substr(0,ld);
@@ -444,149 +444,160 @@ var fireflix = {
444 { 444 {
445 method: 'flickr.photosets.create', 445 method: 'flickr.photosets.create',
446 auth_token: 'default', 446 auth_token: 'default',
447 title: psn, 447 title: psn,
448 primary_photo_id: ppid 448 primary_photo_id: ppid
449 }, function(x) { 449 }, function(x) {
450 var npid = 450 var npid =
451 x.responseXML.getElementsByTagName('photoset').item(0).getAttribute('id'); 451 x.responseXML.getElementsByTagName('photoset').item(0).getAttribute('id');
452 _this.fireflix.flickr.api_call( 452 _this.fireflix.flickr.api_call(
453 { 453 {
454 method: 'flickr.photosets.editPhotos', 454 method: 'flickr.photosets.editPhotos',
455 auth_token: 'default', 455 auth_token: 'default',
456 photoset_id: npid, 456 photoset_id: npid,
457 primary_photo_id: ppid, 457 primary_photo_id: ppid,
458 photo_ids: pids 458 photo_ids: pids
459 }, function(x) { 459 }, function(x) {
460 _this.fireflix.refresh_sets(); 460 _this.fireflix.refresh_sets();
461 }, function(x,s,c,m) { 461 }, function(x,s,c,m) {
462 _this.fireflix.flickr_failure(x,s,c,m); 462 _this.fireflix.flickr_failure(x,s,c,m);
463 } 463 }
464 ); 464 );
465 }, function(x,s,c,m) { 465 }, function(x,s,c,m) {
466 _this.fireflix.flickr_failure(x,s,c,m); 466 _this.fireflix.flickr_failure(x,s,c,m);
467 } 467 }
468 ); 468 );
469 } 469 }
470 } 470 }
471 this.selection.clearSelection(); 471 this.selection.clearSelection();
472 this.cmd_uploads_upload.setAttribute('disabled','false'); 472 this.cmd_uploads_upload.setAttribute('disabled','false');
473 this.upload_progress.setAttribute('hidden','true'); 473 this.upload_progress.setAttribute('hidden','true');
474 }, 474 },
475 475
476 clear_list: function() { 476 clear_list: function() {
477 this.tree.beginUpdateBatch(); 477 this.tree.beginUpdateBatch();
478 this.rowCount = 0; 478 this.rowCount = 0;
479 this.files = new Array(); 479 this.files = new Array();
480 this.tree.endUpdateBatch(); 480 this.tree.endUpdateBatch();
481 this.selToProps(); 481 this.selToProps();
482 }, 482 },
483 selectionChanged: function() { 483 selectionChanged: function() {
484 this.selToProps(); 484 this.selToProps();
485 }, 485 },
486 disableProps: function() { 486 disableProps: function() {
487 this.upload_filename.value=''; 487 this.upload_filename.value='';
488 this.upload_filename.disabled = true; 488 this.upload_filename.disabled = true;
489 this.upload_title.value=''; 489 this.upload_title.value='';
490 this.upload_title.disabled = true; 490 this.upload_title.disabled = true;
491 this.upload_file_preview.src = null; 491 this.upload_file_preview.src = null;
492 this.upload_file_props.hidden = true;
493 this.upload_tags.value=''; 492 this.upload_tags.value='';
494 this.upload_tags.disabled = true; 493 this.upload_tags.disabled = true;
494 /* this.upload_file_props.hidden = true; */
495 }, 495 },
496 selToProps: function() { 496 selToProps: function() {
497 if(!this.selection.count) { 497 if(!this.selection.count) {
498 this.disableProps(); 498 this.disableProps();
499 this.upload_file_props.hidden = true;
499 }else if(this.selection.count==1) { 500 }else if(this.selection.count==1) {
500 var f=this.files[this.selection.currentIndex]; 501 var f=this.files[this.selection.currentIndex];
501 if(f==null || f.state!='pending') { 502 if(f==null) {
502 this.disableProps(); 503 this.disableProps();
504 this.upload_file_props.hidden = true;
503 }else{ 505 }else{
506 var inactives = f.state!='pending';
504 this.upload_filename.value = f.file; 507 this.upload_filename.value = f.file;
505 this.upload_filename.disabled = false; 508 this.upload_filename.disabled = inactives;
506 this.upload_title.value = f.title; 509 this.upload_title.value = f.title;
507 this.upload_title.disabled = false; 510 this.upload_title.disabled = inactives;
508 this.upload_file_preview.src = 'file:///'+f.file; 511 this.upload_file_preview.src = 'file:///'+f.file;
509 this.upload_file_props.hidden = false;
510 this.upload_tags.value = f.tags; 512 this.upload_tags.value = f.tags;
511 this.upload_tags.disabled = false; 513 this.upload_tags.disabled = inactives;
514 if(f.state=='failed') {
515 this.upload_failure.textContent=f.flickr_errcode+': '+f.flickr_errmsg;
516 this.upload_failure.hidden = false;
517 }else{
518 this.upload_failure.hidden = true;
519 }
520 this.upload_file_props.hidden = false;
512 } 521 }
513 }else{ 522 }else{
514 var ftitle = null; var onetitle = true; 523 var ftitle = null; var onetitle = true;
515 var ftags = null; var onetag = true; 524 var ftags = null; var onetag = true;
516 var fs = 0; 525 var fs = 0;
517 for(var ff in this.files) { 526 for(var ff in this.files) {
518 if(this.selection.isSelected(ff) && this.files[ff].state=='pending' ) { 527 if(this.selection.isSelected(ff) && this.files[ff].state=='pending' ) {
519 ++fs; 528 ++fs;
520 if(ftitle==null) { 529 if(ftitle==null) {
521 ftitle = this.files[ff].title; 530 ftitle = this.files[ff].title;
522 }else if(ftitle!=this.files[ff].title) { 531 }else if(ftitle!=this.files[ff].title) {
523 onetitle = false; 532 onetitle = false;
524 } 533 }
525 if(ftags==null) { 534 if(ftags==null) {
526 ftags = this.files[ff].tags; 535 ftags = this.files[ff].tags;
527 }else if(ftags!=this.files[ff].tags) { 536 }else if(ftags!=this.files[ff].tags) {
528 onetag = false; 537 onetag = false;
529 } 538 }
530 } 539 }
531 } 540 }
532 if(fs) { 541 if(fs) {
533 this.upload_filename.value=''; 542 this.upload_filename.value='';
534 this.upload_filename.disabled = true; 543 this.upload_filename.disabled = true;
535 if(onetitle) 544 if(onetitle)
536 this.upload_title.value = ftitle; 545 this.upload_title.value = ftitle;
537 this.upload_title.disabled = false; 546 this.upload_title.disabled = false;
538 if(onetag) 547 if(onetag)
539 this.upload_tags.value = ftags; 548 this.upload_tags.value = ftags;
540 this.upload_tags.disabled = false; 549 this.upload_tags.disabled = false;
541 this.upload_file_preview.src = null; 550 this.upload_file_preview.src = null;
551 this.upload_failure.hidden = true;
542 this.upload_file_props.hidden = false; 552 this.upload_file_props.hidden = false;
543 }else 553 }else
544 this.disableProps(); 554 this.disableProps();
555 this.upload_file_props.hidden = true;
545 } 556 }
546 }, 557 },
547 propsToSel: function(prop) { 558 propsToSel: function(prop) {
548 if(this.selection.count<=0) return; 559 if(this.selection.count<=0) return;
549 for(var ff in this.files) { 560 for(var ff in this.files) {
550 if(this.selection.isSelected(ff) && this.files[ff].state=='pending') { 561 if(this.selection.isSelected(ff) && this.files[ff].state=='pending') {
551 if(prop=='filename') 562 if(prop=='filename')
552 this.files[ff].file = this.upload_filename.value; 563 this.files[ff].file = this.upload_filename.value;
553 if(prop=='title') 564 if(prop=='title')
554 this.files[ff].title = this.upload_title.value; 565 this.files[ff].title = this.upload_title.value;
555 if(prop=='tags') 566 if(prop=='tags')
556 this.files[ff].tags = this.upload_tags.value; 567 this.files[ff].tags = this.upload_tags.value;
557 this.tree.invalidateRow(ff); 568 this.tree.invalidateRow(ff);
558 } 569 }
559 } 570 }
560 }, 571 },
561 572
562 on_upload: function() { 573 on_upload: function() {
563 this.selToProps(); 574 this.selToProps();
564 this.batch_ids = new Array(); 575 this.batch_ids = new Array();
565 this.upload_progress.value=0; 576 this.upload_progress.value=0;
566 this.upload_progress.setAttribute('hidden','false'); 577 this.upload_progress.setAttribute('hidden','false');
567 this.upload_worker(); 578 this.upload_worker();
568 }, 579 },
569 on_clear: function() { 580 on_clear: function() {
570 this.clear_list(); 581 this.clear_list();
571 }, 582 },
572 on_remove: function() { 583 on_remove: function() {
573 if(this.selection.count) { 584 if(this.selection.count) {
574 this.tree.beginUpdateBatch(); 585 this.tree.beginUpdateBatch();
575 for(var i=this.files.length-1;i>=0;--i) { 586 for(var i=this.files.length-1;i>=0;--i) {
576 if(this.selection.isSelected(i)) { 587 if(this.selection.isSelected(i)) {
577 this.files.splice(i,1); 588 this.files.splice(i,1);
578 this.rowCount--; 589 this.rowCount--;
579 } 590 }
580 } 591 }
581 this.tree.endUpdateBatch(); 592 this.tree.endUpdateBatch();
582 this.selection.clearSelection(); 593 this.selection.clearSelection();
583 } 594 }
584 }, 595 },
585 on_add: function() { 596 on_add: function() {
586 var ifp = Components.interfaces.nsIFilePicker; 597 var ifp = Components.interfaces.nsIFilePicker;
587 var fp = Components.classes["@mozilla.org/filepicker;1"].createInstance(ifp); 598 var fp = Components.classes["@mozilla.org/filepicker;1"].createInstance(ifp);
588 fp.init(window, "Select a File", ifp.modeOpenMultiple); 599 fp.init(window, "Select a File", ifp.modeOpenMultiple);
589 fp.appendFilters(ifp.filterImages); 600 fp.appendFilters(ifp.filterImages);
590 var rv = fp.show(); 601 var rv = fp.show();
591 if(rv==ifp.returnOK) { 602 if(rv==ifp.returnOK) {
592 var ff = fp.files; 603 var ff = fp.files;