Edit File by line
/home/barbar84/www/wp-conte.../plugins/file-man.../applicat.../library/js/commands
File: rm.js
/**
[0] Fix | Delete
* @class elFinder command "rm"
[1] Fix | Delete
* Delete files
[2] Fix | Delete
*
[3] Fix | Delete
* @author Dmitry (dio) Levashov
[4] Fix | Delete
* @author Naoki Sawada
[5] Fix | Delete
**/
[6] Fix | Delete
elFinder.prototype.commands.rm = function() {
[7] Fix | Delete
"use strict";
[8] Fix | Delete
var self = this,
[9] Fix | Delete
fm = this.fm,
[10] Fix | Delete
tpl = '<div class="ui-helper-clearfix elfinder-rm-title"><span class="elfinder-cwd-icon {class} ui-corner-all"></span>{title}<div class="elfinder-rm-desc">{desc}</div></div>',
[11] Fix | Delete
confirm = function(dfrd, targets, files, tHash, addTexts) {
[12] Fix | Delete
var cnt = targets.length,
[13] Fix | Delete
cwd = fm.cwd().hash,
[14] Fix | Delete
descs = [],
[15] Fix | Delete
spinner = fm.i18n('calc') + '<span class="elfinder-spinner"></span>',
[16] Fix | Delete
dialog, text, tmb, size, f, fname;
[17] Fix | Delete
[18] Fix | Delete
if (cnt > 1) {
[19] Fix | Delete
size = 0;
[20] Fix | Delete
$.each(files, function(h, f) {
[21] Fix | Delete
if (f.size && f.size != 'unknown' && f.mime !== 'directory') {
[22] Fix | Delete
var s = parseInt(f.size);
[23] Fix | Delete
if (s >= 0 && size >= 0) {
[24] Fix | Delete
size += s;
[25] Fix | Delete
}
[26] Fix | Delete
} else {
[27] Fix | Delete
size = 'unknown';
[28] Fix | Delete
return false;
[29] Fix | Delete
}
[30] Fix | Delete
});
[31] Fix | Delete
getSize = (size === 'unknown');
[32] Fix | Delete
descs.push(fm.i18n('size')+': '+(getSize? spinner : fm.formatSize(size)));
[33] Fix | Delete
text = [$(tpl.replace('{class}', 'elfinder-cwd-icon-group').replace('{title}', '<strong>' + fm.i18n('items')+ ': ' + cnt + '</strong>').replace('{desc}', descs.join('<br>')))];
[34] Fix | Delete
} else {
[35] Fix | Delete
f = files[0];
[36] Fix | Delete
tmb = fm.tmb(f);
[37] Fix | Delete
getSize = (f.mime === 'directory');
[38] Fix | Delete
descs.push(fm.i18n('size')+': '+(getSize? spinner : fm.formatSize(f.size)));
[39] Fix | Delete
descs.push(fm.i18n('modify')+': '+fm.formatDate(f));
[40] Fix | Delete
fname = fm.escape(f.i18 || f.name).replace(/([_.])/g, '&#8203;$1');
[41] Fix | Delete
text = [$(tpl.replace('{class}', fm.mime2class(f.mime)).replace('{title}', '<strong>' + fname + '</strong>').replace('{desc}', descs.join('<br>')))];
[42] Fix | Delete
}
[43] Fix | Delete
[44] Fix | Delete
if (addTexts) {
[45] Fix | Delete
text = text.concat(addTexts);
[46] Fix | Delete
}
[47] Fix | Delete
[48] Fix | Delete
text.push(tHash? 'confirmTrash' : 'confirmRm');
[49] Fix | Delete
[50] Fix | Delete
dialog = fm.confirm({
[51] Fix | Delete
title : self.title,
[52] Fix | Delete
text : text,
[53] Fix | Delete
accept : {
[54] Fix | Delete
label : 'btnRm',
[55] Fix | Delete
callback : function() {
[56] Fix | Delete
if (tHash) {
[57] Fix | Delete
self.toTrash(dfrd, targets, tHash);
[58] Fix | Delete
} else {
[59] Fix | Delete
remove(dfrd, targets);
[60] Fix | Delete
}
[61] Fix | Delete
}
[62] Fix | Delete
},
[63] Fix | Delete
cancel : {
[64] Fix | Delete
label : 'btnCancel',
[65] Fix | Delete
callback : function() {
[66] Fix | Delete
fm.unlockfiles({files : targets});
[67] Fix | Delete
if (targets.length === 1 && fm.file(targets[0]).phash !== cwd) {
[68] Fix | Delete
fm.select({selected : targets});
[69] Fix | Delete
} else {
[70] Fix | Delete
fm.selectfiles({files : targets});
[71] Fix | Delete
}
[72] Fix | Delete
dfrd.reject();
[73] Fix | Delete
}
[74] Fix | Delete
}
[75] Fix | Delete
});
[76] Fix | Delete
// load thumbnail
[77] Fix | Delete
if (tmb) {
[78] Fix | Delete
$('<img/>')
[79] Fix | Delete
.on('load', function() { dialog.find('.elfinder-cwd-icon').addClass(tmb.className).css('background-image', "url('"+tmb.url+"')"); })
[80] Fix | Delete
.attr('src', tmb.url);
[81] Fix | Delete
}
[82] Fix | Delete
[83] Fix | Delete
if (getSize) {
[84] Fix | Delete
getSize = fm.getSize($.map(files, function(f) { return f.mime === 'directory'? f.hash : null; })).done(function(data) {
[85] Fix | Delete
dialog.find('span.elfinder-spinner').parent().html(fm.i18n('size')+': '+data.formated);
[86] Fix | Delete
}).fail(function() {
[87] Fix | Delete
dialog.find('span.elfinder-spinner').parent().html(fm.i18n('size')+': '+fm.i18n('unknown'));
[88] Fix | Delete
}).always(function() {
[89] Fix | Delete
getSize = false;
[90] Fix | Delete
});
[91] Fix | Delete
}
[92] Fix | Delete
},
[93] Fix | Delete
toTrash = function(dfrd, targets, tHash) {
[94] Fix | Delete
var dsts = {},
[95] Fix | Delete
itemCnt = targets.length,
[96] Fix | Delete
maxCnt = self.options.toTrashMaxItems,
[97] Fix | Delete
checkDirs = [],
[98] Fix | Delete
reqDfd = $.Deferred(),
[99] Fix | Delete
req, dirs, cnt;
[100] Fix | Delete
[101] Fix | Delete
if (itemCnt > maxCnt) {
[102] Fix | Delete
self.confirm(dfrd, targets, self.files(targets), null, [fm.i18n('tooManyToTrash')]);
[103] Fix | Delete
return;
[104] Fix | Delete
}
[105] Fix | Delete
[106] Fix | Delete
// Directory preparation preparation and directory enumeration
[107] Fix | Delete
$.each(targets, function(i, h) {
[108] Fix | Delete
var file = fm.file(h),
[109] Fix | Delete
path = fm.path(h).replace(/\\/g, '/'),
[110] Fix | Delete
m = path.match(/^[^\/]+?(\/(?:[^\/]+?\/)*)[^\/]+?$/);
[111] Fix | Delete
[112] Fix | Delete
if (file) {
[113] Fix | Delete
if (m) {
[114] Fix | Delete
m[1] = m[1].replace(/(^\/.*?)\/?$/, '$1');
[115] Fix | Delete
if (! dsts[m[1]]) {
[116] Fix | Delete
dsts[m[1]] = [];
[117] Fix | Delete
}
[118] Fix | Delete
dsts[m[1]].push(h);
[119] Fix | Delete
}
[120] Fix | Delete
if (file.mime === 'directory') {
[121] Fix | Delete
checkDirs.push(h);
[122] Fix | Delete
}
[123] Fix | Delete
}
[124] Fix | Delete
});
[125] Fix | Delete
[126] Fix | Delete
// Check directory information
[127] Fix | Delete
if (checkDirs.length) {
[128] Fix | Delete
req = fm.request({
[129] Fix | Delete
data : {cmd : 'size', targets : checkDirs},
[130] Fix | Delete
notify : {type: 'readdir', cnt: 1, hideCnt: true},
[131] Fix | Delete
preventDefault : true
[132] Fix | Delete
}).done(function(data) {
[133] Fix | Delete
var cnt = 0;
[134] Fix | Delete
data.fileCnt && (cnt += parseInt(data.fileCnt));
[135] Fix | Delete
data.dirCnt && (cnt += parseInt(data.dirCnt));
[136] Fix | Delete
reqDfd[cnt > maxCnt ? 'reject' : 'resolve']();
[137] Fix | Delete
}).fail(function() {
[138] Fix | Delete
reqDfd.reject();
[139] Fix | Delete
});
[140] Fix | Delete
setTimeout(function() {
[141] Fix | Delete
var xhr = (req && req.xhr)? req.xhr : null;
[142] Fix | Delete
if (xhr && xhr.state() == 'pending') {
[143] Fix | Delete
req.syncOnFail(false);
[144] Fix | Delete
req.reject();
[145] Fix | Delete
reqDfd.reject();
[146] Fix | Delete
}
[147] Fix | Delete
}, self.options.infoCheckWait * 1000);
[148] Fix | Delete
} else {
[149] Fix | Delete
reqDfd.resolve();
[150] Fix | Delete
}
[151] Fix | Delete
[152] Fix | Delete
// Directory creation and paste command execution
[153] Fix | Delete
reqDfd.done(function() {
[154] Fix | Delete
dirs = Object.keys(dsts);
[155] Fix | Delete
cnt = dirs.length;
[156] Fix | Delete
if (cnt) {
[157] Fix | Delete
fm.request({
[158] Fix | Delete
data : {cmd : 'mkdir', target : tHash, dirs : dirs},
[159] Fix | Delete
notify : {type : 'chkdir', cnt : cnt},
[160] Fix | Delete
preventFail : true
[161] Fix | Delete
})
[162] Fix | Delete
.fail(function(error) {
[163] Fix | Delete
dfrd.reject(error);
[164] Fix | Delete
fm.unlockfiles({files : targets});
[165] Fix | Delete
})
[166] Fix | Delete
.done(function(data) {
[167] Fix | Delete
var margeRes = function(data, phash, reqData) {
[168] Fix | Delete
var undo, prevUndo, redo, prevRedo;
[169] Fix | Delete
$.each(data, function(k, v) {
[170] Fix | Delete
if (Array.isArray(v)) {
[171] Fix | Delete
if (res[k]) {
[172] Fix | Delete
res[k] = res[k].concat(v);
[173] Fix | Delete
} else {
[174] Fix | Delete
res[k] = v;
[175] Fix | Delete
}
[176] Fix | Delete
}
[177] Fix | Delete
});
[178] Fix | Delete
if (data.sync) {
[179] Fix | Delete
res.sync = 1;
[180] Fix | Delete
}
[181] Fix | Delete
if (data.added && data.added.length) {
[182] Fix | Delete
undo = function() {
[183] Fix | Delete
var targets = [],
[184] Fix | Delete
dirs = $.map(data.added, function(f) { return f.mime === 'directory'? f.hash : null; });
[185] Fix | Delete
$.each(data.added, function(i, f) {
[186] Fix | Delete
if ($.inArray(f.phash, dirs) === -1) {
[187] Fix | Delete
targets.push(f.hash);
[188] Fix | Delete
}
[189] Fix | Delete
});
[190] Fix | Delete
return fm.exec('restore', targets, {noToast: true});
[191] Fix | Delete
};
[192] Fix | Delete
redo = function() {
[193] Fix | Delete
return fm.request({
[194] Fix | Delete
data : reqData,
[195] Fix | Delete
notify : {type : 'redo', cnt : targets.length}
[196] Fix | Delete
});
[197] Fix | Delete
};
[198] Fix | Delete
if (res.undo) {
[199] Fix | Delete
prevUndo = res.undo;
[200] Fix | Delete
res.undo = function() {
[201] Fix | Delete
undo();
[202] Fix | Delete
prevUndo();
[203] Fix | Delete
};
[204] Fix | Delete
} else {
[205] Fix | Delete
res.undo = undo;
[206] Fix | Delete
}
[207] Fix | Delete
if (res.redo) {
[208] Fix | Delete
prevRedo = res.redo;
[209] Fix | Delete
res.redo = function() {
[210] Fix | Delete
redo();
[211] Fix | Delete
prevRedo();
[212] Fix | Delete
};
[213] Fix | Delete
} else {
[214] Fix | Delete
res.redo = redo;
[215] Fix | Delete
}
[216] Fix | Delete
}
[217] Fix | Delete
},
[218] Fix | Delete
err = ['errTrash'],
[219] Fix | Delete
res = {},
[220] Fix | Delete
hasNtf = function() {
[221] Fix | Delete
return fm.ui.notify.children('.elfinder-notify-trash').length;
[222] Fix | Delete
},
[223] Fix | Delete
hashes, tm, prg, prgSt;
[224] Fix | Delete
[225] Fix | Delete
if (hashes = data.hashes) {
[226] Fix | Delete
prg = 1 / cnt * 100;
[227] Fix | Delete
prgSt = cnt === 1? 100 : 5;
[228] Fix | Delete
tm = setTimeout(function() {
[229] Fix | Delete
fm.notify({type : 'trash', cnt : 1, hideCnt : true, progress : prgSt});
[230] Fix | Delete
}, fm.notifyDelay);
[231] Fix | Delete
$.each(dsts, function(dir, files) {
[232] Fix | Delete
var phash = fm.file(files[0]).phash,
[233] Fix | Delete
reqData;
[234] Fix | Delete
if (hashes[dir]) {
[235] Fix | Delete
reqData = {cmd : 'paste', dst : hashes[dir], targets : files, cut : 1};
[236] Fix | Delete
fm.request({
[237] Fix | Delete
data : reqData,
[238] Fix | Delete
preventDefault : true
[239] Fix | Delete
})
[240] Fix | Delete
.fail(function(error) {
[241] Fix | Delete
if (error) {
[242] Fix | Delete
err = err.concat(error);
[243] Fix | Delete
}
[244] Fix | Delete
})
[245] Fix | Delete
.done(function(data) {
[246] Fix | Delete
data = fm.normalize(data);
[247] Fix | Delete
fm.updateCache(data);
[248] Fix | Delete
margeRes(data, phash, reqData);
[249] Fix | Delete
if (data.warning) {
[250] Fix | Delete
err = err.concat(data.warning);
[251] Fix | Delete
delete data.warning;
[252] Fix | Delete
}
[253] Fix | Delete
// fire some event to update cache/ui
[254] Fix | Delete
data.removed && data.removed.length && fm.remove(data);
[255] Fix | Delete
data.added && data.added.length && fm.add(data);
[256] Fix | Delete
data.changed && data.changed.length && fm.change(data);
[257] Fix | Delete
// fire event with command name
[258] Fix | Delete
fm.trigger('paste', data);
[259] Fix | Delete
// fire event with command name + 'done'
[260] Fix | Delete
fm.trigger('pastedone');
[261] Fix | Delete
// force update content
[262] Fix | Delete
data.sync && fm.sync();
[263] Fix | Delete
})
[264] Fix | Delete
.always(function() {
[265] Fix | Delete
var hashes = [], addTexts, end = 2;
[266] Fix | Delete
if (hasNtf()) {
[267] Fix | Delete
fm.notify({type : 'trash', cnt : 0, hideCnt : true, progress : prg});
[268] Fix | Delete
} else {
[269] Fix | Delete
prgSt+= prg;
[270] Fix | Delete
}
[271] Fix | Delete
if (--cnt < 1) {
[272] Fix | Delete
tm && clearTimeout(tm);
[273] Fix | Delete
hasNtf() && fm.notify({type : 'trash', cnt : -1});
[274] Fix | Delete
fm.unlockfiles({files : targets});
[275] Fix | Delete
if (Object.keys(res).length) {
[276] Fix | Delete
if (err.length > 1) {
[277] Fix | Delete
if (res.removed || res.removed.length) {
[278] Fix | Delete
hashes = $.grep(targets, function(h) {
[279] Fix | Delete
return $.inArray(h, res.removed) === -1? true : false;
[280] Fix | Delete
});
[281] Fix | Delete
}
[282] Fix | Delete
if (hashes.length) {
[283] Fix | Delete
if (err.length > end) {
[284] Fix | Delete
end = (fm.messages[err[end-1]] || '').indexOf('$') === -1? end : end + 1;
[285] Fix | Delete
}
[286] Fix | Delete
dfrd.reject();
[287] Fix | Delete
fm.exec('rm', hashes, { addTexts: err.slice(0, end), forceRm: true });
[288] Fix | Delete
} else {
[289] Fix | Delete
fm.error(err);
[290] Fix | Delete
}
[291] Fix | Delete
}
[292] Fix | Delete
res._noSound = true;
[293] Fix | Delete
if (res.undo && res.redo) {
[294] Fix | Delete
res.undo = {
[295] Fix | Delete
cmd : 'trash',
[296] Fix | Delete
callback : res.undo,
[297] Fix | Delete
};
[298] Fix | Delete
res.redo = {
[299] Fix | Delete
cmd : 'trash',
[300] Fix | Delete
callback : res.redo
[301] Fix | Delete
};
[302] Fix | Delete
}
[303] Fix | Delete
dfrd.resolve(res);
[304] Fix | Delete
} else {
[305] Fix | Delete
dfrd.reject(err);
[306] Fix | Delete
}
[307] Fix | Delete
}
[308] Fix | Delete
});
[309] Fix | Delete
}
[310] Fix | Delete
});
[311] Fix | Delete
} else {
[312] Fix | Delete
dfrd.reject('errFolderNotFound');
[313] Fix | Delete
fm.unlockfiles({files : targets});
[314] Fix | Delete
}
[315] Fix | Delete
});
[316] Fix | Delete
} else {
[317] Fix | Delete
dfrd.reject(['error', 'The folder hierarchy to be deleting can not be determined.']);
[318] Fix | Delete
fm.unlockfiles({files : targets});
[319] Fix | Delete
}
[320] Fix | Delete
}).fail(function() {
[321] Fix | Delete
self.confirm(dfrd, targets, self.files(targets), null, [fm.i18n('tooManyToTrash')]);
[322] Fix | Delete
});
[323] Fix | Delete
},
[324] Fix | Delete
remove = function(dfrd, targets, quiet) {
[325] Fix | Delete
var notify = quiet? {} : {type : 'rm', cnt : targets.length};
[326] Fix | Delete
fm.request({
[327] Fix | Delete
data : {cmd : 'rm', targets : targets},
[328] Fix | Delete
notify : notify,
[329] Fix | Delete
preventFail : true
[330] Fix | Delete
})
[331] Fix | Delete
.fail(function(error) {
[332] Fix | Delete
dfrd.reject(error);
[333] Fix | Delete
})
[334] Fix | Delete
.done(function(data) {
[335] Fix | Delete
if (data.error || data.warning) {
[336] Fix | Delete
data.sync = true;
[337] Fix | Delete
}
[338] Fix | Delete
dfrd.resolve(data);
[339] Fix | Delete
})
[340] Fix | Delete
.always(function() {
[341] Fix | Delete
fm.unlockfiles({files : targets});
[342] Fix | Delete
});
[343] Fix | Delete
},
[344] Fix | Delete
getTHash = function(targets) {
[345] Fix | Delete
var thash = null,
[346] Fix | Delete
root1st;
[347] Fix | Delete
[348] Fix | Delete
if (targets && targets.length) {
[349] Fix | Delete
if (targets.length > 1 && fm.searchStatus.state === 2) {
[350] Fix | Delete
root1st = fm.file(fm.root(targets[0])).volumeid;
[351] Fix | Delete
if (!$.grep(targets, function(h) { return h.indexOf(root1st) !== 0? true : false ; }).length) {
[352] Fix | Delete
thash = fm.option('trashHash', targets[0]);
[353] Fix | Delete
}
[354] Fix | Delete
} else {
[355] Fix | Delete
thash = fm.option('trashHash', targets[0]);
[356] Fix | Delete
}
[357] Fix | Delete
}
[358] Fix | Delete
return thash;
[359] Fix | Delete
},
[360] Fix | Delete
getSize = false;
[361] Fix | Delete
[362] Fix | Delete
// for to be able to overwrite
[363] Fix | Delete
this.confirm = confirm;
[364] Fix | Delete
this.toTrash = toTrash;
[365] Fix | Delete
this.remove = remove;
[366] Fix | Delete
[367] Fix | Delete
this.syncTitleOnChange = true;
[368] Fix | Delete
this.updateOnSelect = false;
[369] Fix | Delete
this.shortcuts = [{
[370] Fix | Delete
pattern : 'delete ctrl+backspace shift+delete'
[371] Fix | Delete
}];
[372] Fix | Delete
this.value = 'rm';
[373] Fix | Delete
[374] Fix | Delete
this.init = function() {
[375] Fix | Delete
var update = function(origin) {
[376] Fix | Delete
var targets;
[377] Fix | Delete
delete self.extra;
[378] Fix | Delete
self.title = fm.i18n('cmd' + self.value);
[379] Fix | Delete
self.className = self.value;
[380] Fix | Delete
self.button && self.button.children('span.elfinder-button-icon')[self.value === 'trash'? 'addClass' : 'removeClass']('elfinder-button-icon-trash');
[381] Fix | Delete
if (origin && origin !== 'cwd' && (self.state > -1 || origin === 'navbar')) {
[382] Fix | Delete
if (self.value === 'trash') {
[383] Fix | Delete
self.extra = {
[384] Fix | Delete
icon: 'rm',
[385] Fix | Delete
node: $('<span></span>')
[386] Fix | Delete
.attr({title: fm.i18n('cmdrm')})
[387] Fix | Delete
.on('ready', function(e, data) {
[388] Fix | Delete
targets = data.targets;
[389] Fix | Delete
})
[390] Fix | Delete
.on('click touchstart', function(e){
[391] Fix | Delete
if (e.type === 'touchstart' && e.originalEvent.touches.length > 1) {
[392] Fix | Delete
return;
[393] Fix | Delete
}
[394] Fix | Delete
e.stopPropagation();
[395] Fix | Delete
e.preventDefault();
[396] Fix | Delete
fm.getUI().trigger('click'); // to close the context menu immediately
[397] Fix | Delete
fm.exec('rm', targets, {_userAction: true, forceRm : true});
[398] Fix | Delete
})
[399] Fix | Delete
};
[400] Fix | Delete
}
[401] Fix | Delete
}
[402] Fix | Delete
};
[403] Fix | Delete
// re-assign for extended command
[404] Fix | Delete
self = this;
[405] Fix | Delete
fm = this.fm;
[406] Fix | Delete
// bind function of change
[407] Fix | Delete
self.change(function() {
[408] Fix | Delete
update();
[409] Fix | Delete
});
[410] Fix | Delete
fm.bind('contextmenucreate', function(e) {
[411] Fix | Delete
update(e.data.type);
[412] Fix | Delete
});
[413] Fix | Delete
};
[414] Fix | Delete
[415] Fix | Delete
this.getstate = function(select) {
[416] Fix | Delete
var sel = this.hashes(select),
[417] Fix | Delete
filter = function(files) {
[418] Fix | Delete
var fres = true;
[419] Fix | Delete
return $.grep(files, function(h) {
[420] Fix | Delete
var f;
[421] Fix | Delete
fres = fres && (f = fm.file(h)) && ! f.locked && ! fm.isRoot(f)? true : false;
[422] Fix | Delete
return fres;
[423] Fix | Delete
});
[424] Fix | Delete
};
[425] Fix | Delete
[426] Fix | Delete
return sel.length && filter(sel).length == sel.length ? 0 : -1;
[427] Fix | Delete
};
[428] Fix | Delete
[429] Fix | Delete
this.exec = function(hashes, cOpts) {
[430] Fix | Delete
var opts = cOpts || {},
[431] Fix | Delete
dfrd = $.Deferred()
[432] Fix | Delete
.always(function() {
[433] Fix | Delete
if (getSize && getSize.state && getSize.state() === 'pending') {
[434] Fix | Delete
getSize.reject();
[435] Fix | Delete
}
[436] Fix | Delete
})
[437] Fix | Delete
.fail(function(error) {
[438] Fix | Delete
error && fm.error(error);
[439] Fix | Delete
}).done(function(data) {
[440] Fix | Delete
!opts.quiet && !data._noSound && data.removed && data.removed.length && fm.trigger('playsound', {soundFile : 'rm.wav'});
[441] Fix | Delete
}),
[442] Fix | Delete
files = self.files(hashes),
[443] Fix | Delete
cnt = files.length,
[444] Fix | Delete
tHash = null,
[445] Fix | Delete
addTexts = opts.addTexts? opts.addTexts : null,
[446] Fix | Delete
forceRm = opts.forceRm,
[447] Fix | Delete
quiet = opts.quiet,
[448] Fix | Delete
targets;
[449] Fix | Delete
[450] Fix | Delete
if (! cnt) {
[451] Fix | Delete
return dfrd.reject();
[452] Fix | Delete
}
[453] Fix | Delete
[454] Fix | Delete
$.each(files, function(i, file) {
[455] Fix | Delete
if (fm.isRoot(file)) {
[456] Fix | Delete
return !dfrd.reject(['errRm', file.name, 'errPerm']);
[457] Fix | Delete
}
[458] Fix | Delete
if (file.locked) {
[459] Fix | Delete
return !dfrd.reject(['errLocked', file.name]);
[460] Fix | Delete
}
[461] Fix | Delete
});
[462] Fix | Delete
[463] Fix | Delete
if (dfrd.state() === 'pending') {
[464] Fix | Delete
targets = self.hashes(hashes);
[465] Fix | Delete
cnt = files.length;
[466] Fix | Delete
[467] Fix | Delete
if (forceRm || (self.event && self.event.originalEvent && self.event.originalEvent.shiftKey)) {
[468] Fix | Delete
tHash = '';
[469] Fix | Delete
self.title = fm.i18n('cmdrm');
[470] Fix | Delete
}
[471] Fix | Delete
[472] Fix | Delete
if (tHash === null) {
[473] Fix | Delete
tHash = getTHash(targets);
[474] Fix | Delete
}
[475] Fix | Delete
[476] Fix | Delete
fm.lockfiles({files : targets});
[477] Fix | Delete
[478] Fix | Delete
if (tHash && self.options.quickTrash) {
[479] Fix | Delete
self.toTrash(dfrd, targets, tHash);
[480] Fix | Delete
} else {
[481] Fix | Delete
if (quiet) {
[482] Fix | Delete
remove(dfrd, targets, quiet);
[483] Fix | Delete
} else {
[484] Fix | Delete
self.confirm(dfrd, targets, files, tHash, addTexts);
[485] Fix | Delete
}
[486] Fix | Delete
}
[487] Fix | Delete
}
[488] Fix | Delete
[489] Fix | Delete
return dfrd;
[490] Fix | Delete
};
[491] Fix | Delete
[492] Fix | Delete
fm.bind('select contextmenucreate closecontextmenu', function(e) {
[493] Fix | Delete
var targets = (e.data? (e.data.selected || e.data.targets) : null) || fm.selected();
[494] Fix | Delete
if (targets && targets.length) {
[495] Fix | Delete
self.update(void(0), (targets? getTHash(targets) : fm.option('trashHash'))? 'trash' : 'rm');
[496] Fix | Delete
}
[497] Fix | Delete
});
[498] Fix | Delete
[499] Fix | Delete
12
It is recommended that you Edit text format, this type of Fix handles quite a lot in one request
Function