summaryrefslogtreecommitdiffabout
path: root/content/fireflix.js
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) (side-by-side diff)
tree06e7afff01a0c1df631c7f635618403d7989572a /content/fireflix.js
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 (limited to 'content/fireflix.js') (more/less context) (show whitespace changes)
-rw-r--r--content/fireflix.js25
1 files changed, 18 insertions, 7 deletions
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();
},