Skip to content

Commit

Permalink
fix old protocol suport
Browse files Browse the repository at this point in the history
  • Loading branch information
dio-el-claire committed Jul 9, 2011
1 parent 9d43cb0 commit a0c0f5c
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 28 deletions.
4 changes: 2 additions & 2 deletions elfinder.src.html
Expand Up @@ -121,8 +121,8 @@




$('#finder').elfinder({ $('#finder').elfinder({
url : 'php/connector.php', url : 'php-old/connector.php',
// transport : new elFinderSupportVer1(), transport : new elFinderSupportVer1(),
getFileCallback : function(files, fm) { getFileCallback : function(files, fm) {
console.log(files); console.log(files);
}, },
Expand Down
49 changes: 24 additions & 25 deletions js/proxy/elFinderSupportVer1.js
Expand Up @@ -16,17 +16,16 @@ window.elFinderSupportVer1 = function() {
this.init = function(fm) { this.init = function(fm) {
this.fm = fm; this.fm = fm;
this.fm.parseUploadData = function(text) { this.fm.parseUploadData = function(text) {
var errors = self.fm.errors(), var data;
data;


if (!$.trim(text)) { if (!$.trim(text)) {
return {error : [errors.response, errors.empty]}; return {error : ['errResponse', 'errDataEmpty']};
} }


try { try {
data = $.parseJSON(text); data = $.parseJSON(text);
} catch (e) { } catch (e) {
return {error : [errors.response, errors.json]} return {error : ['errResponse', 'errDataNotJSON']}
} }


return self.normalize('upload', data); return self.normalize('upload', data);
Expand Down Expand Up @@ -133,20 +132,20 @@ window.elFinderSupportVer1 = function() {
} }


// fix old connectors errors messages as possible // fix old connectors errors messages as possible
this.errors = { // this.errors = {
'Unknown command' : 'Unknown command.', // 'Unknown command' : 'Unknown command.',
'Invalid backend configuration' : 'Invalid backend configuration.', // 'Invalid backend configuration' : 'Invalid backend configuration.',
'Access denied' : 'Access denied.', // 'Access denied' : 'Access denied.',
'PHP JSON module not installed' : 'PHP JSON module not installed.', // 'PHP JSON module not installed' : 'PHP JSON module not installed.',
'File not found' : 'File not found.', // 'File not found' : 'File not found.',
'Invalid name' : 'Invalid file name.', // 'Invalid name' : 'Invalid file name.',
'File or folder with the same name already exists' : 'File named "$1" already exists in this location.', // 'File or folder with the same name already exists' : 'File named "$1" already exists in this location.',
'Not allowed file type' : 'Not allowed file type.', // 'Not allowed file type' : 'Not allowed file type.',
'File exceeds the maximum allowed filesize' : 'File exceeds maximum allowed size.', // 'File exceeds the maximum allowed filesize' : 'File exceeds maximum allowed size.',
'Unable to copy into itself' : 'Unable to copy "$1" into itself.', // 'Unable to copy into itself' : 'Unable to copy "$1" into itself.',
'Unable to create archive' : 'Unable to create archive.', // 'Unable to create archive' : 'Unable to create archive.',
'Unable to extract files from archive' : 'Unable to extract files from "$1".' // 'Unable to extract files from archive' : 'Unable to extract files from "$1".'
} // }


this.normalize = function(cmd, data) { this.normalize = function(cmd, data) {
var self = this, var self = this,
Expand All @@ -158,13 +157,13 @@ window.elFinderSupportVer1 = function() {
return data; return data;
} }


if (data.error) { // if (data.error) {
$.each(data.error, function(i, msg) { // $.each(data.error, function(i, msg) {
if (self.errors[msg]) { // if (self.errors[msg]) {
data.error[i] = self.errors[msg]; // data.error[i] = self.errors[msg];
} // }
}); // });
} // }


if (cmd == 'upload' && data.error) { if (cmd == 'upload' && data.error) {
data.warning = $.extend({}, data.error); data.warning = $.extend({}, data.error);
Expand Down
1 change: 0 additions & 1 deletion php/elFinder.class.php
Expand Up @@ -36,7 +36,6 @@ class elFinder {
'tree' => array('target' => true), 'tree' => array('target' => true),
'parents' => array('target' => true), 'parents' => array('target' => true),
'tmb' => array('targets' => true), 'tmb' => array('targets' => true),
'sync' => array('target' => true, 'tree' => false, 'mimes' => false),
'file' => array('target' => true, 'download' => false), 'file' => array('target' => true, 'download' => false),
'size' => array('targets' => true), 'size' => array('targets' => true),
'mkdir' => array('target' => true, 'name' => true), 'mkdir' => array('target' => true, 'name' => true),
Expand Down

0 comments on commit a0c0f5c

Please sign in to comment.