I'm having an issue with folder icons .... disregard... it's because i had not linked the resources to the correct place... PEBKAC error ... :(
Printable View
I'm having an issue with folder icons .... disregard... it's because i had not linked the resources to the correct place... PEBKAC error ... :(
Thanks juandj, you've replied exactly what I would do... :)
saki,
firstly, thank you for a useful ux
secondly, some notices regarding FileTreePanel.js misbehavior when faulty response is received on certain ajax call (method cmdCallback). This usualy happens when filetree.php contains errors and cannot return correct json response - for example "Warning: Invalid argument supplied for foreach() in /opt/filetree/filetree.php on line 99 null".
1: aditional check is required for line 603 to avoid browser complain:
2.: shouldn't "undo" work as well instead of only showing error message? For example unsuccessful rename attempt should be reverted to original node's name:PHP Code:- if(true === o.success) {
+if(o && true === o.success) {
lines 628<->665 should be alternatively performed after line 673.
most likely all of above are allready corrected in your current development branch - please ignore my post in such case.
Re 1) PHP, or any other backend, must always return valid JSON, not its own error messages.
Re 2) I'm not quite sure what's happening in your case but still I think that javascript client cannot handle/display php errors.
you have misunderstood me (:|
1.
here's how it looks when I try to delete a node and ajax request fails (it might be may reasons - web server failure, php/perl script failure etc...).
http://www.netzond.com/images/scr/saki/delete_fails.png
you're expecting a valid ajax response, but it can fail - you have even noted that:
everything's fine excep the fact that object "o" doesn't exist and browser returns JS error.PHP Code:// process Ajax failure
else {
this.showError(response.responseText);
2. after any kind of failure (it doesn't matter if json returns error, or ajax response fails at all) - any operations performed should be "undone" - renamed back, moved back, undeleted.
I've tried to rename node here, and request has failed. "Alcatel-blah" should become "Alcatel" - but it did not because options.params.cmd isn't processed
http://www.netzond.com/images/scr/saki/rename_fails.png
I imagine the code part should look like the following:
got my point?PHP Code:,cmdCallback:function(options, success, response) {
var i, o, node;
var showMsg = true;
// process Ajax success
if(true === success) {
// try to decode JSON response
try {
o = Ext.decode(response.responseText);
}
catch(ex) {
this.showError(response.responseText);
}
// process command success
if(o && true === o.success) {
switch(options.params.cmd) {
case 'delete':
if(true !== this.eventsSuspended) {
this.fireEvent('delete', this, this.getPath(options.node));
}
options.node.parentNode.removeChild(options.node);
break;
case 'newdir':
if(true !== this.eventsSuspended) {
this.fireEvent('newdir', this, options.node);
}
break;
case 'rename':
this.updateCls(options.node, options.params.oldname);
if(true !== this.eventsSuspended) {
this.fireEvent('rename', this, options.node, options.params.newname, options.params.oldname);
}
break;
}
} // eo process command success
// process command failure
else {
this.undoTasks(options);
// show default message box with server error
this.showError(o ? o.error : response.responseText);
} // eo process command failure
} // eo process Ajax success
// process Ajax failure
else {
this.undoTasks(options);
this.showError(response.responseText);
}
} // eo function cmdCallback
,undoTasks:function(options) {
switch(options.params.cmd) {
case 'rename':
// handle drag & drop rename error
if(options.oldParent) {
options.oldParent.appendChild(options.node);
}
// handle simple rename error
else {
options.node.setText(options.oldName);
}
// signal failure to onNodeDrop
if(options.e) {
options.e.failure = true;
}
if(true !== this.eventsSuspended) {
this.fireEvent('renamefailure', this, options.node, options.params.newname, options.params.oldname);
}
break;
case 'newdir':
if(false !== this.eventsSuspended) {
this.fireEvent('newdirfailure', this, options.params.dir);
}
options.node.parentNode.removeChild(options.node);
break;
case 'delete':
if(true !== this.eventsSuspended) {
this.fireEvent('deletefailure', this, options.node);
}
options.node.parentNode.reload.defer(1, options.node.parentNode);
break;
//default:
//this.root.reload();
//break;
}
}
ps: i would have preffered to inform you on this subject in private message istead of messing here, but this forums doesn't seems to support PM :-|
It could provide an example filetree.php and progress.php?
thank you very much
And the example of the testing site of this error:
"Cannot Decode JSON Object"
I am watching the images tab (under the net tab) in firebug, and I see every icon from the upload panel get loaded successfully. Now when I click the button to initiate the transfer, I never see a request to the 'working icon' image.
Could it be something in the filetree (not fileuploader) extension that would affect the upload panel working icon?
I was under the impression that if I only want to use the the file uploader , I just need to include those files...
Take a look at http://filetree.extjs.eu/source.php?...s/filetree.css . You need to include this file as it contains css also for UploadPanel. All ux-up-* classes.