Skip to content

Commit

Permalink
[ui:tree] fix #1617 other volumes cmds doesn't work when it disabled …
Browse files Browse the repository at this point in the history
…in cwd
  • Loading branch information
nao-pon committed Aug 24, 2016
1 parent bb04b84 commit f4611b9
Show file tree
Hide file tree
Showing 7 changed files with 22 additions and 27 deletions.
2 changes: 1 addition & 1 deletion js/commands/archive.js
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ elFinder.prototype.commands.archive = function() {
error && fm.error(error);
});

if (!(this.enabled() && cnt && mimes.length && $.inArray(mime, mimes) !== -1)) {
if (! (cnt && mimes.length && $.inArray(mime, mimes) !== -1)) {
return dfrd.reject();
}

Expand Down
2 changes: 1 addition & 1 deletion js/commands/duplicate.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ elFinder.prototype.commands.duplicate = function() {
}),
args = [];

if (!cnt || this.getstate(hashes) === -1) {
if (! cnt) {
return dfrd.reject();
}

Expand Down
4 changes: 0 additions & 4 deletions js/commands/getfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -69,10 +69,6 @@
req = [],
i, file, dim;

if (this.getstate(hashes) == -1) {
return dfrd.reject();
}

for (i = 0; i < cnt; i++) {
file = files[i];
if (file.mime == 'directory' && !opts.folders) {
Expand Down
2 changes: 1 addition & 1 deletion js/commands/rename.js
Original file line number Diff line number Diff line change
Expand Up @@ -210,7 +210,7 @@ elFinder.prototype.commands.rename = function() {
node.empty().append(input.val(file.name));
}

if (cnt > 1 || this.getstate([file.hash]) < 0) {
if (cnt > 1) {
return dfrd.reject();
}

Expand Down
2 changes: 1 addition & 1 deletion js/commands/rm.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ elFinder.prototype.commands.rm = function() {
tpl = '<div class="ui-helper-clearfix elfinder-rm-title"><span class="elfinder-cwd-icon {class} ui-corner-all"/>{title}<div class="elfinder-rm-desc">{desc}</div></div>',
targets, text, f, fname, size, tmb, descs, dialog;

if (!cnt || this._disabled) {
if (! cnt) {
return dfrd.reject();
}

Expand Down
4 changes: 0 additions & 4 deletions js/commands/upload.js
Original file line number Diff line number Diff line change
Expand Up @@ -137,10 +137,6 @@ elFinder.prototype.commands.upload = function() {
dfrd = $.Deferred(),
dialog, input, button, dropbox, pastebox, dropUpload, paste, dirs, spinner;

if (this.getstate(check) < 0) {
return dfrd.reject();
}

dropUpload = function(e) {
e.stopPropagation();
e.preventDefault();
Expand Down
33 changes: 18 additions & 15 deletions js/ui/contextmenu.js
Original file line number Diff line number Diff line change
Expand Up @@ -142,23 +142,25 @@ $.fn.elfindercontextmenu = function(fm) {
},

close = function() {
menu.removeAttr('style').hide().empty().removeData('submenuKeep');
try {
if (! menu.draggable('instance')) {
menu.draggable(dragOpt);
if (menu.is(':visible') || menu.children().length) {
menu.removeAttr('style').hide().empty().removeData('submenuKeep');
try {
if (! menu.draggable('instance')) {
menu.draggable(dragOpt);
}
} catch(e) {
if (! menu.hasClass('ui-draggable')) {
menu.draggable(dragOpt);
}
}
} catch(e) {
if (! menu.hasClass('ui-draggable')) {
menu.draggable(dragOpt);
if (menu.data('prevNode')) {
menu.data('prevNode').after(menu);
menu.removeData('prevNode');
}
fm.trigger('closecontextmenu');
if (fm.UA.iOS) {
$('div.elfinder div.overflow-scrolling-touch').css('-webkit-overflow-scrolling', 'touch');
}
}
if (menu.data('prevNode')) {
menu.data('prevNode').after(menu);
menu.removeData('prevNode');
}
fm.trigger('closecontextmenu');
if (fm.UA.iOS) {
$('div.elfinder div.overflow-scrolling-touch').css('-webkit-overflow-scrolling', 'touch');
}
},

Expand Down Expand Up @@ -280,6 +282,7 @@ $.fn.elfindercontextmenu = function(fm) {
if ($.isPlainObject(opts)) {
opts._currentType = type;
}
close();
cmd.exec(targets, opts);
}
})
Expand Down

0 comments on commit f4611b9

Please sign in to comment.