|
|
@ -80,6 +80,7 @@ define([
|
|
|
|
var faCollapseAll = 'fa-minus-square-o';
|
|
|
|
var faCollapseAll = 'fa-minus-square-o';
|
|
|
|
var faShared = 'fa-shhare-alt';
|
|
|
|
var faShared = 'fa-shhare-alt';
|
|
|
|
var faReadOnly = 'fa-eye';
|
|
|
|
var faReadOnly = 'fa-eye';
|
|
|
|
|
|
|
|
var faPreview = 'fa-eye';
|
|
|
|
var faOpenInCode = 'cptools-code';
|
|
|
|
var faOpenInCode = 'cptools-code';
|
|
|
|
var faRename = 'fa-pencil';
|
|
|
|
var faRename = 'fa-pencil';
|
|
|
|
var faColor = 'cptools-palette';
|
|
|
|
var faColor = 'cptools-palette';
|
|
|
@ -317,6 +318,10 @@ define([
|
|
|
|
'style': 'display:block;position:static;margin-bottom:5px;'
|
|
|
|
'style': 'display:block;position:static;margin-bottom:5px;'
|
|
|
|
}, [
|
|
|
|
}, [
|
|
|
|
h('span.cp-app-drive-context-noAction.dropdown-item.disabled', Messages.fc_noAction || "No action possible"),
|
|
|
|
h('span.cp-app-drive-context-noAction.dropdown-item.disabled', Messages.fc_noAction || "No action possible"),
|
|
|
|
|
|
|
|
h('li', h('a.cp-app-drive-context-preview.dropdown-item', {
|
|
|
|
|
|
|
|
'tabindex': '-1',
|
|
|
|
|
|
|
|
'data-icon': faPreview,
|
|
|
|
|
|
|
|
}, 'PREVIEW')), // XXX
|
|
|
|
h('li', h('a.cp-app-drive-context-open.dropdown-item', {
|
|
|
|
h('li', h('a.cp-app-drive-context-open.dropdown-item', {
|
|
|
|
'tabindex': '-1',
|
|
|
|
'tabindex': '-1',
|
|
|
|
'data-icon': faFolderOpen,
|
|
|
|
'data-icon': faFolderOpen,
|
|
|
@ -1042,12 +1047,23 @@ define([
|
|
|
|
return ret;
|
|
|
|
return ret;
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
var openFile = function (el, isRo) {
|
|
|
|
var openFile = function (el, isRo, app) {
|
|
|
|
var data = manager.getFileData(el);
|
|
|
|
var data = manager.getFileData(el);
|
|
|
|
if (!data || (!data.href && !data.roHref)) {
|
|
|
|
if (!data || (!data.href && !data.roHref)) {
|
|
|
|
return void logError("Missing data for the file", el, data);
|
|
|
|
return void logError("Missing data for the file", el, data);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
var href = isRo ? data.roHref : (data.href || data.roHref);
|
|
|
|
var href = isRo ? data.roHref : (data.href || data.roHref);
|
|
|
|
|
|
|
|
var parsed = Hash.parsePadUrl(href);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (parsed.hashData && parsed.hashData.type === 'file' && !app) {
|
|
|
|
|
|
|
|
common.getMediaTagPreview({
|
|
|
|
|
|
|
|
href: data.href,
|
|
|
|
|
|
|
|
password: data.password
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
var priv = metadataMgr.getPrivateData();
|
|
|
|
var priv = metadataMgr.getPrivateData();
|
|
|
|
var useUnsafe = Util.find(priv, ['settings', 'security', 'unsafeLinks']);
|
|
|
|
var useUnsafe = Util.find(priv, ['settings', 'security', 'unsafeLinks']);
|
|
|
|
if (useUnsafe !== false) { // true of undefined: use unsafe links
|
|
|
|
if (useUnsafe !== false) { // true of undefined: use unsafe links
|
|
|
@ -1055,7 +1071,6 @@ define([
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// Get hidden hash
|
|
|
|
// Get hidden hash
|
|
|
|
var parsed = Hash.parsePadUrl(href);
|
|
|
|
|
|
|
|
var secret = Hash.getSecrets(parsed.type, parsed.hash, data.password);
|
|
|
|
var secret = Hash.getSecrets(parsed.type, parsed.hash, data.password);
|
|
|
|
var opts = {};
|
|
|
|
var opts = {};
|
|
|
|
if (isRo) { opts.view = true; }
|
|
|
|
if (isRo) { opts.view = true; }
|
|
|
@ -1175,6 +1190,7 @@ define([
|
|
|
|
if (!$element.is('.cp-border-color-file')) {
|
|
|
|
if (!$element.is('.cp-border-color-file')) {
|
|
|
|
//hide.push('download');
|
|
|
|
//hide.push('download');
|
|
|
|
hide.push('openincode');
|
|
|
|
hide.push('openincode');
|
|
|
|
|
|
|
|
hide.push('preview');
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if ($element.is('.cp-border-color-sheet')) {
|
|
|
|
if ($element.is('.cp-border-color-sheet')) {
|
|
|
|
hide.push('download');
|
|
|
|
hide.push('download');
|
|
|
@ -1192,6 +1208,9 @@ define([
|
|
|
|
if (!metadata || !Util.isPlainTextFile(metadata.fileType, metadata.title)) {
|
|
|
|
if (!metadata || !Util.isPlainTextFile(metadata.fileType, metadata.title)) {
|
|
|
|
hide.push('openincode');
|
|
|
|
hide.push('openincode');
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if (metadata.channel && metadata.channel.length < 48) {
|
|
|
|
|
|
|
|
hide.push('preview');
|
|
|
|
|
|
|
|
}
|
|
|
|
if (!metadata.channel || metadata.channel.length > 32 || metadata.rtChannel) {
|
|
|
|
if (!metadata.channel || metadata.channel.length > 32 || metadata.rtChannel) {
|
|
|
|
hide.push('makeacopy'); // Not for blobs
|
|
|
|
hide.push('makeacopy'); // Not for blobs
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -1260,6 +1279,7 @@ define([
|
|
|
|
hide.push('savelocal');
|
|
|
|
hide.push('savelocal');
|
|
|
|
hide.push('openincode'); // can't because of race condition
|
|
|
|
hide.push('openincode'); // can't because of race condition
|
|
|
|
hide.push('makeacopy');
|
|
|
|
hide.push('makeacopy');
|
|
|
|
|
|
|
|
hide.push('preview');
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (containsFolder && paths.length > 1) {
|
|
|
|
if (containsFolder && paths.length > 1) {
|
|
|
|
// Cannot open multiple folders
|
|
|
|
// Cannot open multiple folders
|
|
|
@ -1276,12 +1296,12 @@ define([
|
|
|
|
show = ['newfolder', 'newsharedfolder', 'uploadfiles', 'uploadfolder', 'newdoc'];
|
|
|
|
show = ['newfolder', 'newsharedfolder', 'uploadfiles', 'uploadfolder', 'newdoc'];
|
|
|
|
break;
|
|
|
|
break;
|
|
|
|
case 'tree':
|
|
|
|
case 'tree':
|
|
|
|
show = ['open', 'openro', 'openincode', 'expandall', 'collapseall',
|
|
|
|
show = ['open', 'openro', 'preview', 'openincode', 'expandall', 'collapseall',
|
|
|
|
'color', 'download', 'share', 'savelocal', 'rename', 'delete', 'makeacopy',
|
|
|
|
'color', 'download', 'share', 'savelocal', 'rename', 'delete', 'makeacopy',
|
|
|
|
'deleteowned', 'removesf', 'access', 'properties', 'hashtag'];
|
|
|
|
'deleteowned', 'removesf', 'access', 'properties', 'hashtag'];
|
|
|
|
break;
|
|
|
|
break;
|
|
|
|
case 'default':
|
|
|
|
case 'default':
|
|
|
|
show = ['open', 'openro', 'share', 'openparent', 'delete', 'deleteowned', 'properties', 'access', 'hashtag', 'makeacopy'];
|
|
|
|
show = ['open', 'openro', 'preview', 'share', 'openparent', 'delete', 'deleteowned', 'properties', 'access', 'hashtag', 'makeacopy'];
|
|
|
|
break;
|
|
|
|
break;
|
|
|
|
case 'trashtree': {
|
|
|
|
case 'trashtree': {
|
|
|
|
show = ['empty'];
|
|
|
|
show = ['empty'];
|
|
|
@ -3980,11 +4000,15 @@ define([
|
|
|
|
else if ($this.hasClass('cp-app-drive-context-deleteowned')) {
|
|
|
|
else if ($this.hasClass('cp-app-drive-context-deleteowned')) {
|
|
|
|
deleteOwnedPaths(paths);
|
|
|
|
deleteOwnedPaths(paths);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
else if ($this.hasClass('cp-app-drive-context-preview')) {
|
|
|
|
|
|
|
|
if (paths.length !== 1) { return; }
|
|
|
|
|
|
|
|
el = manager.find(paths[0].path);
|
|
|
|
|
|
|
|
openFile(el);
|
|
|
|
|
|
|
|
}
|
|
|
|
else if ($this.hasClass('cp-app-drive-context-open')) {
|
|
|
|
else if ($this.hasClass('cp-app-drive-context-open')) {
|
|
|
|
paths.forEach(function (p) {
|
|
|
|
paths.forEach(function (p) {
|
|
|
|
var $element = p.element;
|
|
|
|
var el = manager.find(p.path);
|
|
|
|
$element.click();
|
|
|
|
openFile(el, false, true);
|
|
|
|
$element.dblclick();
|
|
|
|
|
|
|
|
});
|
|
|
|
});
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else if ($this.hasClass('cp-app-drive-context-openro')) {
|
|
|
|
else if ($this.hasClass('cp-app-drive-context-openro')) {
|
|
|
@ -3999,7 +4023,7 @@ define([
|
|
|
|
} else {
|
|
|
|
} else {
|
|
|
|
if (!el || manager.isFolder(el)) { return; }
|
|
|
|
if (!el || manager.isFolder(el)) { return; }
|
|
|
|
}
|
|
|
|
}
|
|
|
|
openFile(el, true);
|
|
|
|
openFile(el, true, true);
|
|
|
|
});
|
|
|
|
});
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else if ($this.hasClass('cp-app-drive-context-makeacopy')) {
|
|
|
|
else if ($this.hasClass('cp-app-drive-context-makeacopy')) {
|
|
|
|