author | Michael Krelin <hacker@klever.net> | 2006-12-18 18:33:08 (UTC) |
---|---|---|
committer | Michael Krelin <hacker@klever.net> | 2006-12-18 18:33:08 (UTC) |
commit | 1838bc18394967371d7a1c00516db5e290f80ea3 (patch) (unidiff) | |
tree | 35ed9652b8efc157f2898a612da94bb735fe2d39 | |
parent | 4bf5c81652cc684a5d5ba3fb4910697b8daaca22 (diff) | |
download | fireflix-1838bc18394967371d7a1c00516db5e290f80ea3.zip fireflix-1838bc18394967371d7a1c00516db5e290f80ea3.tar.gz fireflix-1838bc18394967371d7a1c00516db5e290f80ea3.tar.bz2 |
Setting photo privacy before uploading
git-svn-id: http://svn.klever.net/kin/fireflix/trunk@240 fe716a7a-6dde-0310-88d9-d003556173a8
-rw-r--r-- | content/fireflix-panel.xul | 57 | ||||
-rw-r--r-- | content/fireflix.js | 53 | ||||
-rw-r--r-- | locale/en-US/fireflix.dtd | 3 |
3 files changed, 72 insertions, 41 deletions
diff --git a/content/fireflix-panel.xul b/content/fireflix-panel.xul index aa3dbd6..405804c 100644 --- a/content/fireflix-panel.xul +++ b/content/fireflix-panel.xul | |||
@@ -255,37 +255,44 @@ | |||
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="vertical" hidden="true"> | 258 | <groupbox id="upload_file_props" orient="vertical" hidden="true"> |
259 | <hbox> | 259 | <hbox> |
260 | <image id="upload_file_preview" width="100" height="100" /> | 260 | <image id="upload_file_preview" width="100" height="100" /> |
261 | <grid flex="1"> | 261 | <vbox flex="1"> |
262 | <columns> | 262 | <grid> |
263 | <column/> | 263 | <columns> |
264 | <column flex="1"/> | 264 | <column/> |
265 | </columns> | 265 | <column flex="1"/> |
266 | <rows> | 266 | </columns> |
267 | <row> | 267 | <rows> |
268 | <label control="upload_filename" | 268 | <row> |
269 | value="&panel.upload_props.filename.label;" /> | 269 | <label control="upload_filename" |
270 | <textbox id="upload_filename" | 270 | value="&panel.upload_props.filename.label;" /> |
271 | oninput="fireflix.uploads.propsToSel('filename')"/> | 271 | <textbox id="upload_filename" |
272 | </row> | 272 | oninput="fireflix.uploads.propsToSel('filename')"/> |
273 | <row> | 273 | </row> |
274 | <label control="upload_title" value="&panel.upload_props.title.label;" /> | 274 | <row> |
275 | <textbox id="upload_title" | 275 | <label control="upload_title" value="&panel.upload_props.title.label;" /> |
276 | oninput="fireflix.uploads.propsToSel('title')"/> | 276 | <textbox id="upload_title" |
277 | </row> | 277 | oninput="fireflix.uploads.propsToSel('title')"/> |
278 | <row> | 278 | </row> |
279 | <label control="upload_tags" value="&panel.upload_props.tags.label;" /> | 279 | <row> |
280 | <textbox id="upload_tags" | 280 | <label control="upload_tags" value="&panel.upload_props.tags.label;" /> |
281 | oninput="fireflix.uploads.propsToSel('tags')"/> | 281 | <textbox id="upload_tags" |
282 | </row> | 282 | oninput="fireflix.uploads.propsToSel('tags')"/> |
283 | <!-- TODO: description, public, friend, family --> | 283 | </row> |
284 | </rows> | 284 | <!-- TODO: description, public, friend, family --> |
285 | </grid> | 285 | </rows> |
286 | </grid> | ||
287 | <hbox> | ||
288 | <checkbox id="upload_is_public" label="&panel.upload_props.is_public;"/> | ||
289 | <checkbox id="upload_is_friends" label="&panel.upload_props.is_friend;"/> | ||
290 | <checkbox id="upload_is_family" label="&panel.upload_props.is_family;"/> | ||
291 | </hbox> | ||
292 | </vbox> | ||
286 | </hbox> | 293 | </hbox> |
287 | <description id="upload_failure" hidden="true"/> | 294 | <description id="upload_failure" hidden="true"/> |
288 | </groupbox> | 295 | </groupbox> |
289 | <hbox> | 296 | <hbox> |
290 | <button class="lean" command="cmd_uploads_add" /> | 297 | <button class="lean" command="cmd_uploads_add" /> |
291 | <spacer flex="1"/> | 298 | <spacer flex="1"/> |
diff --git a/content/fireflix.js b/content/fireflix.js index 7291b68..78e56c2 100644 --- a/content/fireflix.js +++ b/content/fireflix.js | |||
@@ -329,15 +329,28 @@ var fireflix = { | |||
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', 'upload_failure' | 335 | 'cmd_uploads_upload', 'upload_failure', 'upload_is_public', |
336 | 'upload_is_friends', 'upload_is_family' | ||
336 | ]); | 337 | ]); |
337 | document.getElementById('uploadlist').view = this; | 338 | document.getElementById('uploadlist').view = this; |
339 | this.upload_is_public.addEventListener( | ||
340 | 'CheckboxStateChange', { that: this, | ||
341 | handleEvent: function(ev) { this.that.propsToSel('is_public'); } | ||
342 | }, false ); | ||
343 | this.upload_is_friends.addEventListener( | ||
344 | 'CheckboxStateChange', { that: this, | ||
345 | handleEvent: function(ev) { this.that.propsToSel('is_friends'); } | ||
346 | }, false ); | ||
347 | this.upload_is_family.addEventListener( | ||
348 | 'CheckboxStateChange', { that: this, | ||
349 | handleEvent: function(ev) { this.that.propsToSel('is_family'); } | ||
350 | }, false ); | ||
338 | }, | 351 | }, |
339 | files: new Array(), | 352 | files: new Array(), |
340 | rowCount: 0, | 353 | rowCount: 0, |
341 | getCellText: function(r,c) { | 354 | getCellText: function(r,c) { |
342 | var f = this.files[r]; | 355 | var f = this.files[r]; |
343 | if(c.id=='up_file') return f.file; | 356 | if(c.id=='up_file') return f.file; |
@@ -382,12 +395,13 @@ var fireflix = { | |||
382 | var ld = t.lastIndexOf('.'); | 395 | var ld = t.lastIndexOf('.'); |
383 | if(ld>0) t = t.substr(0,ld); | 396 | if(ld>0) t = t.substr(0,ld); |
384 | this.files.push( { | 397 | this.files.push( { |
385 | file: f, | 398 | file: f, |
386 | title: t, | 399 | title: t, |
387 | tags: '', | 400 | tags: '', |
401 | is_public: true, is_friend: false, is_family: false, | ||
388 | state: 'pending' | 402 | state: 'pending' |
389 | } ); | 403 | } ); |
390 | this.rowCount = this.files.length; | 404 | this.rowCount = this.files.length; |
391 | this.tree.rowCountChanged(this.rowCount-1,1); | 405 | this.tree.rowCountChanged(this.rowCount-1,1); |
392 | }, | 406 | }, |
393 | 407 | ||
@@ -397,14 +411,18 @@ var fireflix = { | |||
397 | var ff = this.files[f]; | 411 | var ff = this.files[f]; |
398 | this.on_file_upload(ff); | 412 | this.on_file_upload(ff); |
399 | ff.state='uploading'; | 413 | ff.state='uploading'; |
400 | this.tree.invalidate(); | 414 | this.tree.invalidate(); |
401 | var _this = this; | 415 | var _this = this; |
402 | this.fireflix.flickr.upload_file( | 416 | this.fireflix.flickr.upload_file( |
403 | ff.file, { title: ff.title, tags: ff.tags }, | 417 | ff.file, { |
404 | function(x,p) { | 418 | title: ff.title, tags: ff.tags, |
419 | is_public: ff.is_public?'1':'0', | ||
420 | is_friend: ff.is_friend?'1':'0', | ||
421 | is_family: ff.is_family?'1':'0' | ||
422 | }, function(x,p) { | ||
405 | ff.photoid = p; | 423 | ff.photoid = p; |
406 | _this.batch_ids.push(p); | 424 | _this.batch_ids.push(p); |
407 | ff.state='completed'; | 425 | ff.state='completed'; |
408 | _this.tree.invalidate(); | 426 | _this.tree.invalidate(); |
409 | window.setTimeout(_this.upload_to,0,_this); | 427 | window.setTimeout(_this.upload_to,0,_this); |
410 | }, function(x,s,c,m) { | 428 | }, function(x,s,c,m) { |
@@ -488,12 +506,15 @@ var fireflix = { | |||
488 | this.upload_filename.disabled = true; | 506 | this.upload_filename.disabled = true; |
489 | this.upload_title.value=''; | 507 | this.upload_title.value=''; |
490 | this.upload_title.disabled = true; | 508 | this.upload_title.disabled = true; |
491 | this.upload_file_preview.src = null; | 509 | this.upload_file_preview.src = null; |
492 | this.upload_tags.value=''; | 510 | this.upload_tags.value=''; |
493 | this.upload_tags.disabled = true; | 511 | this.upload_tags.disabled = true; |
512 | this.upload_is_public.disabled = true; | ||
513 | this.upload_is_friends.disabled = true; | ||
514 | this.upload_is_family.disabled = true; | ||
494 | /* this.upload_file_props.hidden = true; */ | 515 | /* this.upload_file_props.hidden = true; */ |
495 | }, | 516 | }, |
496 | selToProps: function() { | 517 | selToProps: function() { |
497 | if(!this.selection.count) { | 518 | if(!this.selection.count) { |
498 | this.disableProps(); | 519 | this.disableProps(); |
499 | this.upload_file_props.hidden = true; | 520 | this.upload_file_props.hidden = true; |
@@ -501,21 +522,21 @@ var fireflix = { | |||
501 | var f=this.files[this.selection.currentIndex]; | 522 | var f=this.files[this.selection.currentIndex]; |
502 | if(f==null) { | 523 | if(f==null) { |
503 | this.disableProps(); | 524 | this.disableProps(); |
504 | this.upload_file_props.hidden = true; | 525 | this.upload_file_props.hidden = true; |
505 | }else{ | 526 | }else{ |
506 | var inactives = f.state!='pending'; | 527 | var inactives = f.state!='pending'; |
507 | this.upload_filename.value = f.file; | 528 | this.upload_filename.value = f.file; this.upload_filename.disabled = inactives; |
508 | this.upload_filename.disabled = inactives; | 529 | this.upload_title.value = f.title; this.upload_title.disabled = inactives; |
509 | this.upload_title.value = f.title; | ||
510 | this.upload_title.disabled = inactives; | ||
511 | this.upload_file_preview.src = 'file:///'+f.file; | 530 | this.upload_file_preview.src = 'file:///'+f.file; |
512 | this.upload_tags.value = f.tags; | 531 | this.upload_tags.value = f.tags; this.upload_tags.disabled = inactives; |
513 | this.upload_tags.disabled = inactives; | 532 | this.upload_is_public.checked = f.is_public; this.upload_is_public.disabled = inactives; |
533 | this.upload_is_friends.checked = f.is_friend; this.upload_is_friends.disabled = inactives; | ||
534 | this.upload_is_family.checked = f.is_family; this.upload_is_family.disabled = inactives; | ||
514 | if(f.state=='failed') { | 535 | if(f.state=='failed') { |
515 | this.upload_failure.textContent=f.flickr_errcode+': '+f.flickr_errmsg; | 536 | this.upload_failure.textContent=((f.flickr_errcode<0)?'':f.flickr_errcode+': ')+f.flickr_errmsg; |
516 | this.upload_failure.hidden = false; | 537 | this.upload_failure.hidden = false; |
517 | }else{ | 538 | }else{ |
518 | this.upload_failure.hidden = true; | 539 | this.upload_failure.hidden = true; |
519 | } | 540 | } |
520 | this.upload_file_props.hidden = false; | 541 | this.upload_file_props.hidden = false; |
521 | } | 542 | } |
@@ -556,18 +577,18 @@ var fireflix = { | |||
556 | } | 577 | } |
557 | }, | 578 | }, |
558 | propsToSel: function(prop) { | 579 | propsToSel: function(prop) { |
559 | if(this.selection.count<=0) return; | 580 | if(this.selection.count<=0) return; |
560 | for(var ff in this.files) { | 581 | for(var ff in this.files) { |
561 | if(this.selection.isSelected(ff) && this.files[ff].state=='pending') { | 582 | if(this.selection.isSelected(ff) && this.files[ff].state=='pending') { |
562 | if(prop=='filename') | 583 | if(prop=='filename') this.files[ff].file = this.upload_filename.value; |
563 | this.files[ff].file = this.upload_filename.value; | 584 | if(prop=='title') this.files[ff].title = this.upload_title.value; |
564 | if(prop=='title') | 585 | if(prop=='tags') this.files[ff].tags = this.upload_tags.value; |
565 | this.files[ff].title = this.upload_title.value; | 586 | if(prop=='is_public') this.files[ff].is_public = this.upload_is_public.checked; |
566 | if(prop=='tags') | 587 | if(prop=='is_friends') this.files[ff].is_friend = this.upload_is_friends.checked; |
567 | this.files[ff].tags = this.upload_tags.value; | 588 | if(prop=='is_family') this.files[ff].is_family = this.upload_is_family.checked; |
568 | this.tree.invalidateRow(ff); | 589 | this.tree.invalidateRow(ff); |
569 | } | 590 | } |
570 | } | 591 | } |
571 | }, | 592 | }, |
572 | 593 | ||
573 | on_upload: function() { | 594 | on_upload: function() { |
diff --git a/locale/en-US/fireflix.dtd b/locale/en-US/fireflix.dtd index 3380078..d975031 100644 --- a/locale/en-US/fireflix.dtd +++ b/locale/en-US/fireflix.dtd | |||
@@ -66,12 +66,15 @@ | |||
66 | <!ENTITY panel.uploadlist.title.label "Title"> | 66 | <!ENTITY panel.uploadlist.title.label "Title"> |
67 | <!ENTITY panel.uploadlist.status.label "Status"> | 67 | <!ENTITY panel.uploadlist.status.label "Status"> |
68 | 68 | ||
69 | <!ENTITY panel.upload_props.filename.label "File:"> | 69 | <!ENTITY panel.upload_props.filename.label "File:"> |
70 | <!ENTITY panel.upload_props.title.label "Title:"> | 70 | <!ENTITY panel.upload_props.title.label "Title:"> |
71 | <!ENTITY panel.upload_props.tags.label "Tags:"> | 71 | <!ENTITY panel.upload_props.tags.label "Tags:"> |
72 | <!ENTITY panel.upload_props.is_public "Public"> | ||
73 | <!ENTITY panel.upload_props.is_friend "Friends"> | ||
74 | <!ENTITY panel.upload_props.is_family "Family"> | ||
72 | 75 | ||
73 | <!ENTITY panel.uploads.upload.label "Upload"> | 76 | <!ENTITY panel.uploads.upload.label "Upload"> |
74 | <!ENTITY panel.uploads.clear.label "Clear"> | 77 | <!ENTITY panel.uploads.clear.label "Clear"> |
75 | <!ENTITY panel.uploads.remove.label "Remove"> | 78 | <!ENTITY panel.uploads.remove.label "Remove"> |
76 | <!ENTITY panel.uploads.add.label "Add"> | 79 | <!ENTITY panel.uploads.add.label "Add"> |
77 | <!ENTITY panel.uploads.generate_html "Generate HTML"> | 80 | <!ENTITY panel.uploads.generate_html "Generate HTML"> |