summaryrefslogtreecommitdiffabout
authorMichael Krelin <hacker@klever.net>2006-11-12 22:14:50 (UTC)
committer Michael Krelin <hacker@klever.net>2006-11-12 22:14:50 (UTC)
commit790a0930a6d9eb52020193b8f5aabf5da1075ba3 (patch) (unidiff)
tree85860b287ce2d3b105229baa781fa67075e7cf95
parentafcae0d9514f35c96484e6db1eb21e76821b5654 (diff)
downloadfireflix-790a0930a6d9eb52020193b8f5aabf5da1075ba3.zip
fireflix-790a0930a6d9eb52020193b8f5aabf5da1075ba3.tar.gz
fireflix-790a0930a6d9eb52020193b8f5aabf5da1075ba3.tar.bz2
remove unneeded dumps
git-svn-id: http://svn.klever.net/kin/fireflix/trunk@216 fe716a7a-6dde-0310-88d9-d003556173a8
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--content/fireflix.js2
1 files changed, 0 insertions, 2 deletions
diff --git a/content/fireflix.js b/content/fireflix.js
index a4f13b6..0f51397 100644
--- a/content/fireflix.js
+++ b/content/fireflix.js
@@ -193,409 +193,407 @@ var fireflix = {
193 drop: function(r,o) { }, 193 drop: function(r,o) { },
194 canDropBeforeAfter: function(r,b) { return false }, 194 canDropBeforeAfter: function(r,b) { return false },
195 195
196 importXPR: function(xp) { 196 importXPR: function(xp) {
197 this.tree.beginUpdateBatch(); 197 this.tree.beginUpdateBatch();
198 this.sets = new Array(); 198 this.sets = new Array();
199 var n; while(n=xp.iterateNext()) { 199 var n; while(n=xp.iterateNext()) {
200 this.sets.push(new Photoset(n)); 200 this.sets.push(new Photoset(n));
201 } 201 }
202 this.rowCount = this.sets.length; 202 this.rowCount = this.sets.length;
203 this.tree.endUpdateBatch(); 203 this.tree.endUpdateBatch();
204 }, 204 },
205 refresh_sets: function() { 205 refresh_sets: function() {
206 var _this = this; 206 var _this = this;
207 this.fireflix.flickr.api_call( 207 this.fireflix.flickr.api_call(
208 { 208 {
209 method: 'flickr.photosets.getList', 209 method: 'flickr.photosets.getList',
210 auth_token: 'default' 210 auth_token: 'default'
211 }, function(xr) { 211 }, function(xr) {
212 var x = xr.responseXML; 212 var x = xr.responseXML;
213 var xp = x.evaluate( 213 var xp = x.evaluate(
214 '/rsp/photosets/photoset', x, null, 214 '/rsp/photosets/photoset', x, null,
215 XPathResult.ORDERED_NODE_ITERATOR_TYPE, null ); 215 XPathResult.ORDERED_NODE_ITERATOR_TYPE, null );
216 _this.importXPR(xp); 216 _this.importXPR(xp);
217 }, function(x,s,c,m) { 217 }, function(x,s,c,m) {
218 _this.fireflix.flickr_failure(x,s,c,m); 218 _this.fireflix.flickr_failure(x,s,c,m);
219 } 219 }
220 ); 220 );
221 }, 221 },
222 on_select: function() { 222 on_select: function() {
223 if(this.selection.count==1) { 223 if(this.selection.count==1) {
224 this.fireflix.cmd_set_props.setAttribute('disabled','false'); 224 this.fireflix.cmd_set_props.setAttribute('disabled','false');
225 var s = this.sets[this.selection.currentIndex]; 225 var s = this.sets[this.selection.currentIndex];
226 this.fireflix.photoset.load_photos(s.id); 226 this.fireflix.photoset.load_photos(s.id);
227 }else{ 227 }else{
228 this.fireflix.cmd_set_props.setAttribute('disabled','true'); 228 this.fireflix.cmd_set_props.setAttribute('disabled','true');
229 } 229 }
230 } 230 }
231 }, 231 },
232 232
233 refresh_user_tags: function() { 233 refresh_user_tags: function() {
234 var lb = document.getElementById('tagslist'); 234 var lb = document.getElementById('tagslist');
235 var _this = this; 235 var _this = this;
236 this.flickr.api_call( 236 this.flickr.api_call(
237 { 237 {
238 method: 'flickr.tags.getListUser', 238 method: 'flickr.tags.getListUser',
239 auth_token: 'default', 239 auth_token: 'default',
240 }, function(xr) { 240 }, function(xr) {
241 var x = xr.responseXML; 241 var x = xr.responseXML;
242 var xp = x.evaluate( 242 var xp = x.evaluate(
243 '/rsp/who/tags/tag', x, null, 243 '/rsp/who/tags/tag', x, null,
244 XPathResult.ORDERED_NODE_ITERATOR_TYPE, null ); 244 XPathResult.ORDERED_NODE_ITERATOR_TYPE, null );
245 // TODO: clear list 245 // TODO: clear list
246 var n; while(n=xp.iterateNext()) { 246 var n; while(n=xp.iterateNext()) {
247 lb.appendItem(n.firstChild.nodeValue); 247 lb.appendItem(n.firstChild.nodeValue);
248 } 248 }
249 }, function(x,s,c,m) { 249 }, function(x,s,c,m) {
250 _this.flickr_failure(x,s,c,m); 250 _this.flickr_failure(x,s,c,m);
251 } 251 }
252 ); 252 );
253 }, 253 },
254 254
255 uploadObserver: { 255 uploadObserver: {
256 fireflix: null, 256 fireflix: null,
257 init: function(f) { 257 init: function(f) {
258 this.fireflix = f; 258 this.fireflix = f;
259 }, 259 },
260 getSupportedFlavours: function() { 260 getSupportedFlavours: function() {
261 var rv = new FlavourSet(); 261 var rv = new FlavourSet();
262 rv.appendFlavour('application/x-moz-file','nsIFile'); 262 rv.appendFlavour('application/x-moz-file','nsIFile');
263 rv.appendFlavour('application/x-moz-url'); 263 rv.appendFlavour('application/x-moz-url');
264 rv.appendFlavour('text/uri-list'); 264 rv.appendFlavour('text/uri-list');
265 rv.appendFlavour('text/unicode'); 265 rv.appendFlavour('text/unicode');
266 return rv; 266 return rv;
267 }, 267 },
268 canHandleMultipleItems: true, 268 canHandleMultipleItems: true,
269 onDragOver: function(ev,fl,sess) { 269 onDragOver: function(ev,fl,sess) {
270 return true; 270 return true;
271 }, 271 },
272 onDrop: function(ev,dd,s) { 272 onDrop: function(ev,dd,s) {
273 var ldf = null; 273 var ldf = null;
274 for(var i in dd.dataList) { 274 for(var i in dd.dataList) {
275 var di = dd.dataList[i]; 275 var di = dd.dataList[i];
276 var dif = di.first; 276 var dif = di.first;
277 if( 277 if(
278 ldf==null 278 ldf==null
279 || ldf.flavour.contentType!=dif.flavour.contentType 279 || ldf.flavour.contentType!=dif.flavour.contentType
280 || ldf.contentLength!=dif.contentLength 280 || ldf.contentLength!=dif.contentLength
281 || ldf.data!=dif.data ) 281 || ldf.data!=dif.data )
282 this.drop_item(ev,di,s); 282 this.drop_item(ev,di,s);
283 ldf = dif; 283 ldf = dif;
284 } 284 }
285 }, 285 },
286 drop_item: function(ev,di,s) { 286 drop_item: function(ev,di,s) {
287 var d = di.first; 287 var d = di.first;
288 switch(d.flavour.contentType) { 288 switch(d.flavour.contentType) {
289 case 'text/unicode': 289 case 'text/unicode':
290 this.drop_urilist(ev,d.data,s); 290 this.drop_urilist(ev,d.data,s);
291 break; 291 break;
292 case 'application/x-moz-file': 292 case 'application/x-moz-file':
293 this.fireflix.uploads.add(d.data.path); 293 this.fireflix.uploads.add(d.data.path);
294 document.getElementById('fireflix_tabs').selectedTab 294 document.getElementById('fireflix_tabs').selectedTab
295 = document.getElementById('tab_upload'); 295 = document.getElementById('tab_upload');
296 break; 296 break;
297 case 'text/uri-list': 297 case 'text/uri-list':
298 // is it ascii or could it be utf8? 298 // is it ascii or could it be utf8?
299 this.drop_urilist(ev,splitascii(d.data),s); 299 this.drop_urilist(ev,splitascii(d.data),s);
300 break; 300 break;
301 default: alert(d.flavour.contentType+':'+d.data); break; 301 default: alert(d.flavour.contentType+':'+d.data); break;
302 }; 302 };
303 }, 303 },
304 drop_urilist: function(ev,ul,s) { 304 drop_urilist: function(ev,ul,s) {
305 // TODO: check for being a file? 305 // TODO: check for being a file?
306 var us = decodeURIComponent(ul).split(/[\r\n]/); 306 var us = decodeURIComponent(ul).split(/[\r\n]/);
307 for(var ui in us) 307 for(var ui in us)
308 if(/\S/.test(us[ui])) 308 if(/\S/.test(us[ui]))
309 this.fireflix.uploads.add(us[ui]); 309 this.fireflix.uploads.add(us[ui]);
310 document.getElementById('fireflix_tabs').selectedTab 310 document.getElementById('fireflix_tabs').selectedTab
311 = document.getElementById('tab_upload'); 311 = document.getElementById('tab_upload');
312 } 312 }
313 }, 313 },
314 314
315 uploads: { 315 uploads: {
316 fireflix: null, 316 fireflix: null,
317 init: function(f) { 317 init: function(f) {
318 this.fireflix=f; 318 this.fireflix=f;
319 pull_elements(this,document,[ 319 pull_elements(this,document,[
320 'upload_filename','upload_title','upload_file_preview', 320 'upload_filename','upload_title','upload_file_preview',
321 'upload_file_props','upload_progress','upload_tags', 321 'upload_file_props','upload_progress','upload_tags',
322 'cmd_uploads_upload' 322 'cmd_uploads_upload'
323 ]); 323 ]);
324 document.getElementById('uploadlist').view = this; 324 document.getElementById('uploadlist').view = this;
325 }, 325 },
326 files: new Array(), 326 files: new Array(),
327 rowCount: 0, 327 rowCount: 0,
328 getCellText: function(r,c) { 328 getCellText: function(r,c) {
329 var f = this.files[r]; 329 var f = this.files[r];
330 if(c.id=='up_file') return f.file; 330 if(c.id=='up_file') return f.file;
331 if(c.id=='up_title') return f.title; 331 if(c.id=='up_title') return f.title;
332 if(c.id=='up_status') return f.state; 332 if(c.id=='up_status') return f.state;
333 return c.id; 333 return c.id;
334 }, 334 },
335 setTree: function(t) { this.tree = t }, 335 setTree: function(t) { this.tree = t },
336 isContainer: function(r) { return false; }, 336 isContainer: function(r) { return false; },
337 isSeparator: function(r) { return false; }, 337 isSeparator: function(r) { return false; },
338 isSorted: function(r) { return false; }, 338 isSorted: function(r) { return false; },
339 getLevel: function(r) { return 0; }, 339 getLevel: function(r) { return 0; },
340 getImageSrc: function(r,c) { return null }, 340 getImageSrc: function(r,c) { return null },
341 getRowProperties: function(r,p) { 341 getRowProperties: function(r,p) {
342 try { 342 try {
343 if(!Components) return; 343 if(!Components) return;
344 }catch(e) { return } 344 }catch(e) { return }
345 var f = this.files[r]; 345 var f = this.files[r];
346 var as = Components.classes['@mozilla.org/atom-service;1']. 346 var as = Components.classes['@mozilla.org/atom-service;1'].
347 getService(Components.interfaces.nsIAtomService); 347 getService(Components.interfaces.nsIAtomService);
348 p.AppendElement(as.getAtom(f.state)); 348 p.AppendElement(as.getAtom(f.state));
349 }, 349 },
350 getCellProperties: function(r,c,p) { this.getRowProperties(r,p); }, 350 getCellProperties: function(r,c,p) { this.getRowProperties(r,p); },
351 getColumnProperties: function(c,p) { }, 351 getColumnProperties: function(c,p) { },
352 cycleHeader: function(cid,e) { }, 352 cycleHeader: function(cid,e) { },
353 getParentIndex: function(r) { return -1; }, 353 getParentIndex: function(r) { return -1; },
354 drop: function(r,o) { }, 354 drop: function(r,o) { },
355 canDropBeforeAfter: function(r,b) { return false }, 355 canDropBeforeAfter: function(r,b) { return false },
356 356
357 add: function(f) { 357 add: function(f) {
358 if(f.indexOf('file:/')==0) { 358 if(f.indexOf('file:/')==0) {
359 f = f.substr(5); 359 f = f.substr(5);
360 while(f.substr(0,2)=='//') { // XXX: not very performant, is it? ;-) 360 while(f.substr(0,2)=='//') { // XXX: not very performant, is it? ;-)
361 f = f.substr(1); 361 f = f.substr(1);
362 } 362 }
363 } 363 }
364 var t = f; 364 var t = f;
365 var ls = t.lastIndexOf('/'); 365 var ls = t.lastIndexOf('/');
366 if(ls>0) t = t.substr(ls+1); 366 if(ls>0) t = t.substr(ls+1);
367 ls = t.lastIndexOf('\\'); 367 ls = t.lastIndexOf('\\');
368 if(ls>0) t = t.substr(ls+1); 368 if(ls>0) t = t.substr(ls+1);
369 var ld = t.lastIndexOf('.'); 369 var ld = t.lastIndexOf('.');
370 if(ld>0) t = t.substr(0,ld); 370 if(ld>0) t = t.substr(0,ld);
371 this.files.push( { 371 this.files.push( {
372 file: f, 372 file: f,
373 title: t, 373 title: t,
374 tags: '', 374 tags: '',
375 state: 'pending' 375 state: 'pending'
376 } ); 376 } );
377 this.rowCount = this.files.length; 377 this.rowCount = this.files.length;
378 this.tree.rowCountChanged(this.rowCount-1,1); 378 this.tree.rowCountChanged(this.rowCount-1,1);
379 }, 379 },
380 380
381 upload_worker: function() { 381 upload_worker: function() {
382 for(var f in this.files) { 382 for(var f in this.files) {
383 if(this.files[f].state=='pending') { 383 if(this.files[f].state=='pending') {
384 var ff = this.files[f]; 384 var ff = this.files[f];
385 dump('upload '+ff.file+'\n');
386 this.on_file_upload(ff); 385 this.on_file_upload(ff);
387 ff.state='uploading'; 386 ff.state='uploading';
388 this.tree.invalidate(); 387 this.tree.invalidate();
389 var _this = this; 388 var _this = this;
390 this.fireflix.flickr.upload_file( 389 this.fireflix.flickr.upload_file(
391 ff.file, { title: ff.title, tags: ff.tags }, 390 ff.file, { title: ff.title, tags: ff.tags },
392 function(x,p) { 391 function(x,p) {
393 ff.photoid = p; 392 ff.photoid = p;
394 _this.batch_ids.push(p); 393 _this.batch_ids.push(p);
395 ff.state='completed'; 394 ff.state='completed';
396 _this.tree.invalidate(); 395 _this.tree.invalidate();
397 window.setTimeout(_this.upload_to,0,_this); 396 window.setTimeout(_this.upload_to,0,_this);
398 }, function(x,s,c,m) { 397 }, function(x,s,c,m) {
399 ff.state='failed'; 398 ff.state='failed';
400 ff.flickr_errcode = c; 399 ff.flickr_errcode = c;
401 ff.flickr_errmsg = m; 400 ff.flickr_errmsg = m;
402 _this.tree.invalidate(); 401 _this.tree.invalidate();
403 window.setTimeout(_this.upload_to,0,_this); 402 window.setTimeout(_this.upload_to,0,_this);
404 } 403 }
405 ); 404 );
406 return; 405 return;
407 } 406 }
408 } 407 }
409 dump('uploading done\n');
410 this.on_finish_upload(); 408 this.on_finish_upload();
411 }, 409 },
412 upload_to: function(_this) { _this.upload_worker(); }, 410 upload_to: function(_this) { _this.upload_worker(); },
413 on_file_upload: function(f) { 411 on_file_upload: function(f) {
414 this.cmd_uploads_upload.setAttribute('disabled','true'); 412 this.cmd_uploads_upload.setAttribute('disabled','true');
415 for(var fi in this.files) { 413 for(var fi in this.files) {
416 if(this.files[fi].file==f.file) { 414 if(this.files[fi].file==f.file) {
417 this.tree.ensureRowIsVisible(fi); 415 this.tree.ensureRowIsVisible(fi);
418 this.selection.rangedSelect(fi,fi,false); 416 this.selection.rangedSelect(fi,fi,false);
419 this.selection.currentIndex = fi; 417 this.selection.currentIndex = fi;
420 this.selToProps(); 418 this.selToProps();
421 break; 419 break;
422 } 420 }
423 } 421 }
424 }, 422 },
425 on_finish_upload: function() { 423 on_finish_upload: function() {
426 if(this.batch_ids.length) { 424 if(this.batch_ids.length) {
427 var psn = prompt(this.fireflix.loc_strings.getString('postUploadPhotoset')); 425 var psn = prompt(this.fireflix.loc_strings.getString('postUploadPhotoset'));
428 if(psn!=null) { 426 if(psn!=null) {
429 var pids = this.batch_ids.join(','); 427 var pids = this.batch_ids.join(',');
430 var ppid = this.batch_ids[0]; 428 var ppid = this.batch_ids[0];
431 var _this = this; 429 var _this = this;
432 this.fireflix.flickr.api_call( 430 this.fireflix.flickr.api_call(
433 { 431 {
434 method: 'flickr.photosets.create', 432 method: 'flickr.photosets.create',
435 auth_token: 'default', 433 auth_token: 'default',
436 title: psn, 434 title: psn,
437 primary_photo_id: ppid 435 primary_photo_id: ppid
438 }, function(x) { 436 }, function(x) {
439 var npid = 437 var npid =
440 x.responseXML.getElementsByTagName('photoset').item(0).getAttribute('id'); 438 x.responseXML.getElementsByTagName('photoset').item(0).getAttribute('id');
441 _this.fireflix.flickr.api_call( 439 _this.fireflix.flickr.api_call(
442 { 440 {
443 method: 'flickr.photosets.editPhotos', 441 method: 'flickr.photosets.editPhotos',
444 auth_token: 'default', 442 auth_token: 'default',
445 photoset_id: npid, 443 photoset_id: npid,
446 primary_photo_id: ppid, 444 primary_photo_id: ppid,
447 photo_ids: pids 445 photo_ids: pids
448 }, function(x) { 446 }, function(x) {
449 _this.fireflix.refresh_sets(); 447 _this.fireflix.refresh_sets();
450 }, function(x,s,c,m) { 448 }, function(x,s,c,m) {
451 _this.fireflix.flickr_failure(x,s,c,m); 449 _this.fireflix.flickr_failure(x,s,c,m);
452 } 450 }
453 ); 451 );
454 }, function(x,s,c,m) { 452 }, function(x,s,c,m) {
455 _this.fireflix.flickr_failure(x,s,c,m); 453 _this.fireflix.flickr_failure(x,s,c,m);
456 } 454 }
457 ); 455 );
458 } 456 }
459 } 457 }
460 this.selection.clearSelection(); 458 this.selection.clearSelection();
461 this.cmd_uploads_upload.setAttribute('disabled','false'); 459 this.cmd_uploads_upload.setAttribute('disabled','false');
462 this.upload_progress.setAttribute('hidden','true'); 460 this.upload_progress.setAttribute('hidden','true');
463 }, 461 },
464 462
465 clear_list: function() { 463 clear_list: function() {
466 this.tree.beginUpdateBatch(); 464 this.tree.beginUpdateBatch();
467 this.rowCount = 0; 465 this.rowCount = 0;
468 this.files = new Array(); 466 this.files = new Array();
469 this.tree.endUpdateBatch(); 467 this.tree.endUpdateBatch();
470 this.selToProps(); 468 this.selToProps();
471 }, 469 },
472 selectionChanged: function() { 470 selectionChanged: function() {
473 this.selToProps(); 471 this.selToProps();
474 }, 472 },
475 disableProps: function() { 473 disableProps: function() {
476 this.upload_filename.value=''; 474 this.upload_filename.value='';
477 this.upload_filename.disabled = true; 475 this.upload_filename.disabled = true;
478 this.upload_title.value=''; 476 this.upload_title.value='';
479 this.upload_title.disabled = true; 477 this.upload_title.disabled = true;
480 this.upload_file_preview.src = null; 478 this.upload_file_preview.src = null;
481 this.upload_file_props.hidden = true; 479 this.upload_file_props.hidden = true;
482 this.upload_tags.value=''; 480 this.upload_tags.value='';
483 this.upload_tags.disabled = true; 481 this.upload_tags.disabled = true;
484 }, 482 },
485 selToProps: function() { 483 selToProps: function() {
486 if(!this.selection.count) { 484 if(!this.selection.count) {
487 this.disableProps(); 485 this.disableProps();
488 }else if(this.selection.count==1) { 486 }else if(this.selection.count==1) {
489 var f=this.files[this.selection.currentIndex]; 487 var f=this.files[this.selection.currentIndex];
490 if(f==null || f.state!='pending') { 488 if(f==null || f.state!='pending') {
491 this.disableProps(); 489 this.disableProps();
492 }else{ 490 }else{
493 this.upload_filename.value = f.file; 491 this.upload_filename.value = f.file;
494 this.upload_filename.disabled = false; 492 this.upload_filename.disabled = false;
495 this.upload_title.value = f.title; 493 this.upload_title.value = f.title;
496 this.upload_title.disabled = false; 494 this.upload_title.disabled = false;
497 this.upload_file_preview.src = 'file:///'+f.file; 495 this.upload_file_preview.src = 'file:///'+f.file;
498 this.upload_file_props.hidden = false; 496 this.upload_file_props.hidden = false;
499 this.upload_tags.value = f.tags; 497 this.upload_tags.value = f.tags;
500 this.upload_tags.disabled = false; 498 this.upload_tags.disabled = false;
501 } 499 }
502 }else{ 500 }else{
503 var ftitle = null; var onetitle = true; 501 var ftitle = null; var onetitle = true;
504 var ftags = null; var onetag = true; 502 var ftags = null; var onetag = true;
505 var fs = 0; 503 var fs = 0;
506 for(var ff in this.files) { 504 for(var ff in this.files) {
507 if(this.selection.isSelected(ff) && this.files[ff].state=='pending' ) { 505 if(this.selection.isSelected(ff) && this.files[ff].state=='pending' ) {
508 ++fs; 506 ++fs;
509 if(ftitle==null) { 507 if(ftitle==null) {
510 ftitle = this.files[ff].title; 508 ftitle = this.files[ff].title;
511 }else if(ftitle!=this.files[ff].title) { 509 }else if(ftitle!=this.files[ff].title) {
512 onetitle = false; 510 onetitle = false;
513 } 511 }
514 if(ftags==null) { 512 if(ftags==null) {
515 ftags = this.files[ff].tags; 513 ftags = this.files[ff].tags;
516 }else if(ftags!=this.files[ff].tags) { 514 }else if(ftags!=this.files[ff].tags) {
517 onetag = false; 515 onetag = false;
518 } 516 }
519 } 517 }
520 } 518 }
521 if(fs) { 519 if(fs) {
522 this.upload_filename.value=''; 520 this.upload_filename.value='';
523 this.upload_filename.disabled = true; 521 this.upload_filename.disabled = true;
524 if(onetitle) 522 if(onetitle)
525 this.upload_title.value = ftitle; 523 this.upload_title.value = ftitle;
526 this.upload_title.disabled = false; 524 this.upload_title.disabled = false;
527 if(onetag) 525 if(onetag)
528 this.upload_tags.value = ftags; 526 this.upload_tags.value = ftags;
529 this.upload_tags.disabled = false; 527 this.upload_tags.disabled = false;
530 this.upload_file_preview.src = null; 528 this.upload_file_preview.src = null;
531 this.upload_file_props.hidden = false; 529 this.upload_file_props.hidden = false;
532 }else 530 }else
533 this.disableProps(); 531 this.disableProps();
534 } 532 }
535 }, 533 },
536 propsToSel: function(prop) { 534 propsToSel: function(prop) {
537 if(this.selection.count<=0) return; 535 if(this.selection.count<=0) return;
538 for(var ff in this.files) { 536 for(var ff in this.files) {
539 if(this.selection.isSelected(ff) && this.files[ff].state=='pending') { 537 if(this.selection.isSelected(ff) && this.files[ff].state=='pending') {
540 if(prop=='filename') 538 if(prop=='filename')
541 this.files[ff].file = this.upload_filename.value; 539 this.files[ff].file = this.upload_filename.value;
542 if(prop=='title') 540 if(prop=='title')
543 this.files[ff].title = this.upload_title.value; 541 this.files[ff].title = this.upload_title.value;
544 if(prop=='tags') 542 if(prop=='tags')
545 this.files[ff].tags = this.upload_tags.value; 543 this.files[ff].tags = this.upload_tags.value;
546 this.tree.invalidateRow(ff); 544 this.tree.invalidateRow(ff);
547 } 545 }
548 } 546 }
549 }, 547 },
550 548
551 on_upload: function() { 549 on_upload: function() {
552 this.selToProps(); 550 this.selToProps();
553 this.batch_ids = new Array(); 551 this.batch_ids = new Array();
554 this.upload_progress.value=0; 552 this.upload_progress.value=0;
555 this.upload_progress.setAttribute('hidden','false'); 553 this.upload_progress.setAttribute('hidden','false');
556 this.upload_worker(); 554 this.upload_worker();
557 }, 555 },
558 on_clear: function() { 556 on_clear: function() {
559 this.clear_list(); 557 this.clear_list();
560 }, 558 },
561 on_remove: function() { 559 on_remove: function() {
562 if(this.selection.count) { 560 if(this.selection.count) {
563 this.tree.beginUpdateBatch(); 561 this.tree.beginUpdateBatch();
564 for(var i=this.files.length-1;i>=0;--i) { 562 for(var i=this.files.length-1;i>=0;--i) {
565 if(this.selection.isSelected(i)) { 563 if(this.selection.isSelected(i)) {
566 this.files.splice(i,1); 564 this.files.splice(i,1);
567 this.rowCount--; 565 this.rowCount--;
568 } 566 }
569 } 567 }
570 this.tree.endUpdateBatch(); 568 this.tree.endUpdateBatch();
571 this.selection.clearSelection(); 569 this.selection.clearSelection();
572 } 570 }
573 }, 571 },
574 on_add: function() { 572 on_add: function() {
575 var ifp = Components.interfaces.nsIFilePicker; 573 var ifp = Components.interfaces.nsIFilePicker;
576 var fp = Components.classes["@mozilla.org/filepicker;1"].createInstance(ifp); 574 var fp = Components.classes["@mozilla.org/filepicker;1"].createInstance(ifp);
577 fp.init(window, "Select a File", ifp.modeOpenMultiple); 575 fp.init(window, "Select a File", ifp.modeOpenMultiple);
578 fp.appendFilters(ifp.filterImages); 576 fp.appendFilters(ifp.filterImages);
579 var rv = fp.show(); 577 var rv = fp.show();
580 if(rv==ifp.returnOK) { 578 if(rv==ifp.returnOK) {
581 var ff = fp.files; 579 var ff = fp.files;
582 while(ff.hasMoreElements()) { 580 while(ff.hasMoreElements()) {
583 var f = ff.getNext(); 581 var f = ff.getNext();
584 f.QueryInterface(Components.interfaces.nsIFile); 582 f.QueryInterface(Components.interfaces.nsIFile);
585 this.add(f.path); 583 this.add(f.path);
586 } 584 }
587 } 585 }
588 } 586 }
589 }, 587 },
590 588
591 on_set_props: function() { 589 on_set_props: function() {
592 var pset = this.photosets.sets[this.photosets.selection.currentIndex]; 590 var pset = this.photosets.sets[this.photosets.selection.currentIndex];
593 window.openDialog( 591 window.openDialog(
594 "chrome://fireflix/content/photoset-props.xul", 592 "chrome://fireflix/content/photoset-props.xul",
595 null, "dependent,modal,dialog,chrome", this, 593 null, "dependent,modal,dialog,chrome", this,
596 pset ); 594 pset );
597 if(pset.dirty) { 595 if(pset.dirty) {
598 var _this = this; 596 var _this = this;
599 this.flickr.api_call( 597 this.flickr.api_call(
600 { 598 {
601 method: 'flickr.photosets.editMeta', 599 method: 'flickr.photosets.editMeta',