Edit File by line
/home/barbar84/www/wp-conte.../plugins/file-man.../applicat.../library/js/commands
File: duplicate.js
/**
[0] Fix | Delete
* @class elFinder command "duplicate"
[1] Fix | Delete
* Create file/folder copy with suffix "copy Number"
[2] Fix | Delete
*
[3] Fix | Delete
* @type elFinder.command
[4] Fix | Delete
* @author Dmitry (dio) Levashov
[5] Fix | Delete
*/
[6] Fix | Delete
elFinder.prototype.commands.duplicate = function() {
[7] Fix | Delete
"use strict";
[8] Fix | Delete
var fm = this.fm;
[9] Fix | Delete
[10] Fix | Delete
this.getstate = function(select) {
[11] Fix | Delete
var sel = this.files(select),
[12] Fix | Delete
cnt = sel.length,
[13] Fix | Delete
filter = function(files) {
[14] Fix | Delete
var fres = true;
[15] Fix | Delete
return $.grep(files, function(f) {
[16] Fix | Delete
fres = fres && f.read && f.phash === fm.cwd().hash && ! fm.isRoot(f)? true : false;
[17] Fix | Delete
return fres;
[18] Fix | Delete
});
[19] Fix | Delete
};
[20] Fix | Delete
[21] Fix | Delete
return cnt && fm.cwd().write && filter(sel).length == cnt ? 0 : -1;
[22] Fix | Delete
};
[23] Fix | Delete
[24] Fix | Delete
this.exec = function(hashes) {
[25] Fix | Delete
var fm = this.fm,
[26] Fix | Delete
files = this.files(hashes),
[27] Fix | Delete
cnt = files.length,
[28] Fix | Delete
dfrd = $.Deferred()
[29] Fix | Delete
.fail(function(error) {
[30] Fix | Delete
error && fm.error(error);
[31] Fix | Delete
}),
[32] Fix | Delete
args = [];
[33] Fix | Delete
[34] Fix | Delete
if (! cnt) {
[35] Fix | Delete
return dfrd.reject();
[36] Fix | Delete
}
[37] Fix | Delete
[38] Fix | Delete
$.each(files, function(i, file) {
[39] Fix | Delete
if (!file.read || !fm.file(file.phash).write) {
[40] Fix | Delete
return !dfrd.reject(['errCopy', file.name, 'errPerm']);
[41] Fix | Delete
}
[42] Fix | Delete
});
[43] Fix | Delete
[44] Fix | Delete
if (dfrd.state() == 'rejected') {
[45] Fix | Delete
return dfrd;
[46] Fix | Delete
}
[47] Fix | Delete
[48] Fix | Delete
return fm.request({
[49] Fix | Delete
data : {cmd : 'duplicate', targets : this.hashes(hashes)},
[50] Fix | Delete
notify : {type : 'copy', cnt : cnt},
[51] Fix | Delete
navigate : {
[52] Fix | Delete
toast : {
[53] Fix | Delete
inbuffer : {msg: fm.i18n(['complete', fm.i18n('cmdduplicate')])}
[54] Fix | Delete
}
[55] Fix | Delete
}
[56] Fix | Delete
});
[57] Fix | Delete
[58] Fix | Delete
};
[59] Fix | Delete
[60] Fix | Delete
};
[61] Fix | Delete
[62] Fix | Delete
It is recommended that you Edit text format, this type of Fix handles quite a lot in one request
Function