-rw-r--r-- | content/fireflix-panel.xul | 7 | ||||
-rw-r--r-- | content/fireflix.css | 8 | ||||
-rw-r--r-- | content/fireflix.js | 25 |
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 @@ -234,72 +234,75 @@ <listhead> <listheader label="&panel.tagslist.tag.label;"/> </listhead> <listcols> <listcol flex="1"/> </listcols> </listbox> </tabpanel> <tabpanel id="tabpanel_upload"> <vbox flex="1"> <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="horizontal" hidden="true"> + <groupbox id="upload_file_props" orient="vertical" hidden="true"> + <hbox> <image id="upload_file_preview" width="100" height="100" /> <grid flex="1"> <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="uplod_tags" value="&panel.upload_props.tags.label;" /> + <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> + <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> </tabpanels> </tabbox> </vbox> </page> diff --git a/content/fireflix.css b/content/fireflix.css index ab90c11..06ae28a 100644 --- a/content/fireflix.css +++ b/content/fireflix.css @@ -22,48 +22,56 @@ tree#uploadlist treechildren::-moz-tree-cell-text(completed) { color: black; } tree#uploadlist treechildren::-moz-tree-row(failed) { background: yellow; } tree#uploadlist treechildren::-moz-tree-cell-text(failed) { color: red; } tree#uploadlist treechildren::-moz-tree-cell-text(uploading) { font-weight: bold; } groupbox#searchresult_props, groupbox.search_params, groupbox#upload_file_props, groupbox#set_props, groupbox#set_photo_props { background: white; } groupbox#upload_file_props label { text-align: right; } +description#upload_failure { + border-top: solid 1px red; + margin: 0px; padding: 2px; + text-align: left; + font-size: 85%; + line-height: 105%; +} + image#search_photo, image#set_photo, image#set_primary { border: black 1px solid; } .about .insides { margin: 1ex; } .about .text { border: yellow solid 1px; background: green; } .about .title { font-size: 300%; font-weight: bold; color: yellow; } .about .link { text-decoration: underline; color: white; cursor: pointer; } menuitem.menuhead { background: gray; diff --git a/content/fireflix.js b/content/fireflix.js index 995ec5c..7291b68 100644 --- a/content/fireflix.js +++ b/content/fireflix.js @@ -311,49 +311,49 @@ var fireflix = { // is it ascii or could it be utf8? this.drop_urilist(ev,splitascii(d.data),s); break; default: alert(d.flavour.contentType+':'+d.data); break; }; }, drop_urilist: function(ev,ul,s) { // TODO: check for being a file? 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' + 'cmd_uploads_upload', 'upload_failure' ]); document.getElementById('uploadlist').view = this; }, 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 }, getRowProperties: function(r,p) { try { if(!Components) return; }catch(e) { return } var f = this.files[r]; var as = Components.classes['@mozilla.org/atom-service;1']. @@ -468,101 +468,112 @@ var fireflix = { ); } } this.selection.clearSelection(); this.cmd_uploads_upload.setAttribute('disabled','false'); this.upload_progress.setAttribute('hidden','true'); }, clear_list: function() { this.tree.beginUpdateBatch(); 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_file_props.hidden = true; this.upload_tags.value=''; this.upload_tags.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 || f.state!='pending') { + 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 = false; + this.upload_filename.disabled = inactives; this.upload_title.value = f.title; - this.upload_title.disabled = false; + this.upload_title.disabled = inactives; this.upload_file_preview.src = 'file:///'+f.file; - this.upload_file_props.hidden = false; this.upload_tags.value = f.tags; - this.upload_tags.disabled = false; + this.upload_tags.disabled = inactives; + if(f.state=='failed') { + this.upload_failure.textContent=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) { onetitle = false; } if(ftags==null) { ftags = this.files[ff].tags; }else if(ftags!=this.files[ff].tags) { onetag = false; } } } if(fs) { this.upload_filename.value=''; this.upload_filename.disabled = true; if(onetitle) this.upload_title.value = ftitle; 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; 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(); }, |