1
HTML & templates / Re: Move file Drop down menu
« on: March 25, 2011, 11:15:35 PM »
Here's how I ended up doing it. Not very pretty but it works.
Code: [Select]
function moveClicked() {
;
var a = getSelection();
if (a.size() < 1)
return alert("You must select atleast 1 file/folder.");
d$= '%'+'folder%../music';
ezprompt("{.!Are you sure you want to move files?.}", {'type':'hidden', 'default': d$,}, function(s){
$.post("?mode=section&id=ajax.move", {"dst":s, files:selectedFilesAsStr()}, function(res){
var a = res.split(";");
if (a.length < 2)
return alert($.trim(res));
var failed = 0;
var ok = 0;
var msg = "";
for (var i=0; i<a.length-1; i++) {
var s = $.trim(a[i]);
if (!s.length) {
ok++;
continue;
}
failed++;
msg += s+"\n";
}
if (failed)
msg = "{.!ERROR.}\n"+msg;
msg = (ok ? ok+" {.!Files moved..}\n" : "{.!Files not moved..}\n")+msg;
alert(msg);
if (ok) location = location; // reload
});
});
}//moveClicked