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) (side-by-side diff) | |
tree | 35ed9652b8efc157f2898a612da94bb735fe2d39 /content | |
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 | 9 | ||||
-rw-r--r-- | content/fireflix.js | 53 |
2 files changed, 45 insertions, 17 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 @@ -245,57 +245,64 @@ <tree id="uploadlist" rows="2" flex="1" onselect="fireflix.uploads.selectionChanged()" context="uploads_menu"> <treecols> <treecol id="up_file" label="&panel.uploadlist.file.label;" flex="4" crop="start" align="start"/> <splitter class="tree-splitter" /> <treecol id="up_title" label="&panel.uploadlist.title.label;" flex="5" crop="end" align="start" /> <splitter class="tree-splitter" /> <treecol id="up_status" label="&panel.uploadlist.status.label;" flex="1" crop="end" align="start" /> </treecols> <treechildren/> </tree> <progressmeter id="upload_progress" mode="undetermined" hidden="true" /> <groupbox id="upload_file_props" orient="vertical" hidden="true"> <hbox> <image id="upload_file_preview" width="100" height="100" /> - <grid flex="1"> + <vbox flex="1"> + <grid> <columns> <column/> <column flex="1"/> </columns> <rows> <row> <label control="upload_filename" value="&panel.upload_props.filename.label;" /> <textbox id="upload_filename" oninput="fireflix.uploads.propsToSel('filename')"/> </row> <row> <label control="upload_title" value="&panel.upload_props.title.label;" /> <textbox id="upload_title" oninput="fireflix.uploads.propsToSel('title')"/> </row> <row> <label control="upload_tags" value="&panel.upload_props.tags.label;" /> <textbox id="upload_tags" oninput="fireflix.uploads.propsToSel('tags')"/> </row> <!-- TODO: description, public, friend, family --> </rows> </grid> + <hbox> + <checkbox id="upload_is_public" label="&panel.upload_props.is_public;"/> + <checkbox id="upload_is_friends" label="&panel.upload_props.is_friend;"/> + <checkbox id="upload_is_family" label="&panel.upload_props.is_family;"/> + </hbox> + </vbox> </hbox> <description id="upload_failure" hidden="true"/> </groupbox> <hbox> <button class="lean" command="cmd_uploads_add" /> <spacer flex="1"/> <button class="lean" command="cmd_uploads_remove" /> <spacer flex="1"/> <button class="lean" command="cmd_uploads_clear" /> </hbox> <hbox pack="center"> <button command="cmd_uploads_upload" flex="1"/> </hbox> </vbox> </tabpanel> diff --git a/content/fireflix.js b/content/fireflix.js index 7291b68..78e56c2 100644 --- a/content/fireflix.js +++ b/content/fireflix.js @@ -319,35 +319,48 @@ var fireflix = { var us = decodeURIComponent(ul).split(/[\r\n]/); for(var ui in us) if(/\S/.test(us[ui])) this.fireflix.uploads.add(us[ui]); document.getElementById('fireflix_tabs').selectedTab = document.getElementById('tab_upload'); } }, uploads: { fireflix: null, init: function(f) { this.fireflix=f; pull_elements(this,document,[ 'upload_filename','upload_title','upload_file_preview', 'upload_file_props','upload_progress','upload_tags', - 'cmd_uploads_upload', 'upload_failure' + 'cmd_uploads_upload', 'upload_failure', 'upload_is_public', + 'upload_is_friends', 'upload_is_family' ]); document.getElementById('uploadlist').view = this; + this.upload_is_public.addEventListener( + 'CheckboxStateChange', { that: this, + handleEvent: function(ev) { this.that.propsToSel('is_public'); } + }, false ); + this.upload_is_friends.addEventListener( + 'CheckboxStateChange', { that: this, + handleEvent: function(ev) { this.that.propsToSel('is_friends'); } + }, false ); + this.upload_is_family.addEventListener( + 'CheckboxStateChange', { that: this, + handleEvent: function(ev) { this.that.propsToSel('is_family'); } + }, false ); }, files: new Array(), rowCount: 0, getCellText: function(r,c) { var f = this.files[r]; if(c.id=='up_file') return f.file; if(c.id=='up_title') return f.title; if(c.id=='up_status') return f.state; return c.id; }, setTree: function(t) { this.tree = t }, isContainer: function(r) { return false; }, isSeparator: function(r) { return false; }, isSorted: function(r) { return false; }, getLevel: function(r) { return 0; }, getImageSrc: function(r,c) { return null }, @@ -372,49 +385,54 @@ var fireflix = { f = f.substr(5); while(f.substr(0,2)=='//') { // XXX: not very performant, is it? ;-) f = f.substr(1); } } var t = f; var ls = t.lastIndexOf('/'); if(ls>0) t = t.substr(ls+1); ls = t.lastIndexOf('\\'); if(ls>0) t = t.substr(ls+1); var ld = t.lastIndexOf('.'); if(ld>0) t = t.substr(0,ld); this.files.push( { file: f, title: t, tags: '', + is_public: true, is_friend: false, is_family: false, state: 'pending' } ); this.rowCount = this.files.length; this.tree.rowCountChanged(this.rowCount-1,1); }, upload_worker: function() { for(var f in this.files) { if(this.files[f].state=='pending') { var ff = this.files[f]; this.on_file_upload(ff); ff.state='uploading'; this.tree.invalidate(); var _this = this; this.fireflix.flickr.upload_file( - ff.file, { title: ff.title, tags: ff.tags }, - function(x,p) { + ff.file, { + title: ff.title, tags: ff.tags, + is_public: ff.is_public?'1':'0', + is_friend: ff.is_friend?'1':'0', + is_family: ff.is_family?'1':'0' + }, function(x,p) { ff.photoid = p; _this.batch_ids.push(p); ff.state='completed'; _this.tree.invalidate(); window.setTimeout(_this.upload_to,0,_this); }, function(x,s,c,m) { ff.state='failed'; ff.flickr_errcode = c; ff.flickr_errmsg = m; _this.tree.invalidate(); window.setTimeout(_this.upload_to,0,_this); } ); return; } } @@ -478,54 +496,57 @@ var fireflix = { this.rowCount = 0; this.files = new Array(); this.tree.endUpdateBatch(); this.selToProps(); }, selectionChanged: function() { this.selToProps(); }, disableProps: function() { this.upload_filename.value=''; this.upload_filename.disabled = true; this.upload_title.value=''; this.upload_title.disabled = true; this.upload_file_preview.src = null; this.upload_tags.value=''; this.upload_tags.disabled = true; + this.upload_is_public.disabled = true; + this.upload_is_friends.disabled = true; + this.upload_is_family.disabled = true; /* this.upload_file_props.hidden = true; */ }, selToProps: function() { if(!this.selection.count) { this.disableProps(); this.upload_file_props.hidden = true; }else if(this.selection.count==1) { var f=this.files[this.selection.currentIndex]; if(f==null) { this.disableProps(); this.upload_file_props.hidden = true; }else{ var inactives = f.state!='pending'; - this.upload_filename.value = f.file; - this.upload_filename.disabled = inactives; - this.upload_title.value = f.title; - this.upload_title.disabled = inactives; + this.upload_filename.value = f.file; this.upload_filename.disabled = inactives; + this.upload_title.value = f.title; this.upload_title.disabled = inactives; this.upload_file_preview.src = 'file:///'+f.file; - this.upload_tags.value = f.tags; - this.upload_tags.disabled = inactives; + this.upload_tags.value = f.tags; this.upload_tags.disabled = inactives; + this.upload_is_public.checked = f.is_public; this.upload_is_public.disabled = inactives; + this.upload_is_friends.checked = f.is_friend; this.upload_is_friends.disabled = inactives; + this.upload_is_family.checked = f.is_family; this.upload_is_family.disabled = inactives; if(f.state=='failed') { - this.upload_failure.textContent=f.flickr_errcode+': '+f.flickr_errmsg; + this.upload_failure.textContent=((f.flickr_errcode<0)?'':f.flickr_errcode+': ')+f.flickr_errmsg; this.upload_failure.hidden = false; }else{ this.upload_failure.hidden = true; } this.upload_file_props.hidden = false; } }else{ var ftitle = null; var onetitle = true; var ftags = null; var onetag = true; var fs = 0; for(var ff in this.files) { if(this.selection.isSelected(ff) && this.files[ff].state=='pending' ) { ++fs; if(ftitle==null) { ftitle = this.files[ff].title; }else if(ftitle!=this.files[ff].title) { @@ -546,38 +567,38 @@ var fireflix = { this.upload_title.disabled = false; if(onetag) this.upload_tags.value = ftags; this.upload_tags.disabled = false; this.upload_file_preview.src = null; this.upload_failure.hidden = true; this.upload_file_props.hidden = false; }else this.disableProps(); this.upload_file_props.hidden = true; } }, propsToSel: function(prop) { if(this.selection.count<=0) return; for(var ff in this.files) { if(this.selection.isSelected(ff) && this.files[ff].state=='pending') { - if(prop=='filename') - this.files[ff].file = this.upload_filename.value; - if(prop=='title') - this.files[ff].title = this.upload_title.value; - if(prop=='tags') - this.files[ff].tags = this.upload_tags.value; + if(prop=='filename') this.files[ff].file = this.upload_filename.value; + if(prop=='title') this.files[ff].title = this.upload_title.value; + if(prop=='tags') this.files[ff].tags = this.upload_tags.value; + if(prop=='is_public') this.files[ff].is_public = this.upload_is_public.checked; + if(prop=='is_friends') this.files[ff].is_friend = this.upload_is_friends.checked; + if(prop=='is_family') this.files[ff].is_family = this.upload_is_family.checked; this.tree.invalidateRow(ff); } } }, on_upload: function() { this.selToProps(); this.batch_ids = new Array(); this.upload_progress.value=0; this.upload_progress.setAttribute('hidden','false'); this.upload_worker(); }, on_clear: function() { this.clear_list(); }, on_remove: function() { |