summaryrefslogtreecommitdiffabout
authorMichael Krelin <hacker@klever.net>2011-08-28 16:22:04 (UTC)
committer Michael Krelin <hacker@klever.net>2011-08-28 16:22:04 (UTC)
commite58247a43552504e34ae31a5262a8a9dd338243c (patch) (side-by-side diff)
tree010174a32497fa0e085de0902799197f703e678a
parentaa13caca14bac3ed268ac6fb62f0270e40b24e48 (diff)
downloadfireflix-e58247a43552504e34ae31a5262a8a9dd338243c.zip
fireflix-e58247a43552504e34ae31a5262a8a9dd338243c.tar.gz
fireflix-e58247a43552504e34ae31a5262a8a9dd338243c.tar.bz2
more json calls
Signed-off-by: Michael Krelin <hacker@klever.net>
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--content/fireflix.js19
1 files changed, 9 insertions, 10 deletions
diff --git a/content/fireflix.js b/content/fireflix.js
index 283e930..d70ab4d 100644
--- a/content/fireflix.js
+++ b/content/fireflix.js
@@ -400,121 +400,120 @@ var fireflix = {
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,
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;
}
}
this.on_finish_upload();
},
upload_to: function(_this) { _this.upload_worker(); },
on_file_upload: function(f) {
this.cmd_uploads_upload.setAttribute('disabled','true');
for(var fi in this.files) {
if(this.files[fi].file==f.file) {
this.tree.ensureRowIsVisible(fi);
this.selection.rangedSelect(fi,fi,false);
this.selection.currentIndex = fi;
this.selToProps();
break;
}
}
},
on_finish_upload: function() {
if(this.batch_ids.length) {
var psn = prompt(this.fireflix.loc_strings.getString('postUploadPhotoset'));
if(psn!=null) {
var pids = this.batch_ids.join(',');
var ppid = this.batch_ids[0];
- var _this = this;
- this.fireflix.flickr.api_call(
+ var that = this;
+ this.fireflix.flickr.api_call_json(
{
method: 'flickr.photosets.create',
auth_token: 'default',
title: psn,
primary_photo_id: ppid
- }, function(x) {
- var npid =
- x.responseXML.getElementsByTagName('photoset').item(0).getAttribute('id');
- _this.fireflix.flickr.api_call(
+ }, function(x,j) {
+ var npid = j.photoset.id;
+ that.fireflix.flickr.api_call_json(
{
method: 'flickr.photosets.editPhotos',
auth_token: 'default',
photoset_id: npid,
primary_photo_id: ppid,
photo_ids: pids
- }, function(x) {
- _this.fireflix.refresh_sets();
+ }, function(x,j) {
+ that.fireflix.refresh_sets();
}, function(x,s,c,m) {
- _this.fireflix.flickr_failure(x,s,c,m);
+ that.fireflix.flickr_failure(x,s,c,m);
}
);
}, function(x,s,c,m) {
- _this.fireflix.flickr_failure(x,s,c,m);
+ that.fireflix.flickr_failure(x,s,c,m);
}
);
}
}
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_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_file_preview.src = 'file:///'+f.file;
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;