|
|
@ -89,7 +89,10 @@ define([
|
|
|
|
var faShared = 'fa-shhare-alt';
|
|
|
|
var faShared = 'fa-shhare-alt';
|
|
|
|
var faReadOnly = 'fa-eye';
|
|
|
|
var faReadOnly = 'fa-eye';
|
|
|
|
var faPreview = 'fa-eye';
|
|
|
|
var faPreview = 'fa-eye';
|
|
|
|
var faOpenInCode = 'cptools-code';
|
|
|
|
var faOpenInCode = AppConfig.applicationsIcon.code;
|
|
|
|
|
|
|
|
var faOpenInSheet = AppConfig.applicationsIcon.sheet;
|
|
|
|
|
|
|
|
var faOpenInDoc = AppConfig.applicationsIcon.doc;
|
|
|
|
|
|
|
|
var faOpenInPresentation = AppConfig.applicationsIcon.presentation;
|
|
|
|
var faRename = 'fa-pencil';
|
|
|
|
var faRename = 'fa-pencil';
|
|
|
|
var faColor = 'cptools-palette';
|
|
|
|
var faColor = 'cptools-palette';
|
|
|
|
var faTrash = 'fa-trash';
|
|
|
|
var faTrash = 'fa-trash';
|
|
|
@ -332,6 +335,9 @@ define([
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Messages.fc_openInSheet = "Edit in Sheet"; // XXX
|
|
|
|
|
|
|
|
Messages.fc_openInDoc = "Edit in Document"; // XXX
|
|
|
|
|
|
|
|
Messages.fc_openInPresentation = "Edit in Presentation"; // XXX
|
|
|
|
var createContextMenu = function () {
|
|
|
|
var createContextMenu = function () {
|
|
|
|
var menu = h('div.cp-contextmenu.dropdown.cp-unselectable', [
|
|
|
|
var menu = h('div.cp-contextmenu.dropdown.cp-unselectable', [
|
|
|
|
h('ul.dropdown-menu', {
|
|
|
|
h('ul.dropdown-menu', {
|
|
|
@ -356,6 +362,18 @@ define([
|
|
|
|
'tabindex': '-1',
|
|
|
|
'tabindex': '-1',
|
|
|
|
'data-icon': faOpenInCode,
|
|
|
|
'data-icon': faOpenInCode,
|
|
|
|
}, Messages.fc_openInCode)),
|
|
|
|
}, Messages.fc_openInCode)),
|
|
|
|
|
|
|
|
h('li', h('a.cp-app-drive-context-openinsheet.dropdown-item', {
|
|
|
|
|
|
|
|
'tabindex': '-1',
|
|
|
|
|
|
|
|
'data-icon': faOpenInSheet,
|
|
|
|
|
|
|
|
}, Messages.fc_openInSheet)),
|
|
|
|
|
|
|
|
h('li', h('a.cp-app-drive-context-openindoc.dropdown-item', {
|
|
|
|
|
|
|
|
'tabindex': '-1',
|
|
|
|
|
|
|
|
'data-icon': faOpenInDoc,
|
|
|
|
|
|
|
|
}, Messages.fc_openInDoc)),
|
|
|
|
|
|
|
|
h('li', h('a.cp-app-drive-context-openinpresentation.dropdown-item', {
|
|
|
|
|
|
|
|
'tabindex': '-1',
|
|
|
|
|
|
|
|
'data-icon': faOpenInPresentation,
|
|
|
|
|
|
|
|
}, Messages.fc_openInPresentation)),
|
|
|
|
h('li', h('a.cp-app-drive-context-savelocal.dropdown-item', {
|
|
|
|
h('li', h('a.cp-app-drive-context-savelocal.dropdown-item', {
|
|
|
|
'tabindex': '-1',
|
|
|
|
'tabindex': '-1',
|
|
|
|
'data-icon': 'fa-cloud-upload',
|
|
|
|
'data-icon': 'fa-cloud-upload',
|
|
|
@ -1293,6 +1311,18 @@ 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 || !Util.isSpreadsheet(metadata.fileType, metadata.title)
|
|
|
|
|
|
|
|
|| !priv.supportsWasm) {
|
|
|
|
|
|
|
|
hide.push('openinsheet');
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
if (!metadata || !Util.isOfficeDoc(metadata.fileType, metadata.title)
|
|
|
|
|
|
|
|
|| !priv.supportsWasm) {
|
|
|
|
|
|
|
|
hide.push('openindoc');
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
if (!metadata || !Util.isPresentation(metadata.fileType, metadata.title)
|
|
|
|
|
|
|
|
|| !priv.supportsWasm) {
|
|
|
|
|
|
|
|
hide.push('openinpresentation');
|
|
|
|
|
|
|
|
}
|
|
|
|
if (metadata.channel && metadata.channel.length < 48) {
|
|
|
|
if (metadata.channel && metadata.channel.length < 48) {
|
|
|
|
hide.push('preview');
|
|
|
|
hide.push('preview');
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -1309,6 +1339,9 @@ define([
|
|
|
|
containsFolder = true;
|
|
|
|
containsFolder = true;
|
|
|
|
hide.push('openro');
|
|
|
|
hide.push('openro');
|
|
|
|
hide.push('openincode');
|
|
|
|
hide.push('openincode');
|
|
|
|
|
|
|
|
hide.push('openinsheet');
|
|
|
|
|
|
|
|
hide.push('openindoc');
|
|
|
|
|
|
|
|
hide.push('openinpresentation');
|
|
|
|
hide.push('hashtag');
|
|
|
|
hide.push('hashtag');
|
|
|
|
//hide.push('delete');
|
|
|
|
//hide.push('delete');
|
|
|
|
hide.push('makeacopy');
|
|
|
|
hide.push('makeacopy');
|
|
|
@ -1324,6 +1357,9 @@ define([
|
|
|
|
hide.push('savelocal');
|
|
|
|
hide.push('savelocal');
|
|
|
|
hide.push('openro');
|
|
|
|
hide.push('openro');
|
|
|
|
hide.push('openincode');
|
|
|
|
hide.push('openincode');
|
|
|
|
|
|
|
|
hide.push('openinsheet');
|
|
|
|
|
|
|
|
hide.push('openindoc');
|
|
|
|
|
|
|
|
hide.push('openinpresentation');
|
|
|
|
hide.push('properties', 'access');
|
|
|
|
hide.push('properties', 'access');
|
|
|
|
hide.push('hashtag');
|
|
|
|
hide.push('hashtag');
|
|
|
|
hide.push('makeacopy');
|
|
|
|
hide.push('makeacopy');
|
|
|
@ -1355,7 +1391,8 @@ define([
|
|
|
|
hide.push('download');
|
|
|
|
hide.push('download');
|
|
|
|
hide.push('share');
|
|
|
|
hide.push('share');
|
|
|
|
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('openinsheet'); // can't because of race condition
|
|
|
|
hide.push('makeacopy');
|
|
|
|
hide.push('makeacopy');
|
|
|
|
hide.push('preview');
|
|
|
|
hide.push('preview');
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -1380,11 +1417,12 @@ define([
|
|
|
|
break;
|
|
|
|
break;
|
|
|
|
case 'tree':
|
|
|
|
case 'tree':
|
|
|
|
show = ['open', 'openro', 'preview', 'openincode', 'expandall', 'collapseall',
|
|
|
|
show = ['open', 'openro', 'preview', 'openincode', 'expandall', 'collapseall',
|
|
|
|
'color', 'download', 'share', 'savelocal', 'rename', 'delete', 'makeacopy',
|
|
|
|
'color', 'download', 'share', 'savelocal', 'rename', 'delete',
|
|
|
|
|
|
|
|
'makeacopy', 'openinsheet', 'openindoc', 'openinpresentation',
|
|
|
|
'deleteowned', 'removesf', 'access', 'properties', 'hashtag'];
|
|
|
|
'deleteowned', 'removesf', 'access', 'properties', 'hashtag'];
|
|
|
|
break;
|
|
|
|
break;
|
|
|
|
case 'default':
|
|
|
|
case 'default':
|
|
|
|
show = ['open', 'openro', 'preview', 'openincode', 'share', 'download', 'openparent', 'delete', 'deleteowned', 'properties', 'access', 'hashtag', 'makeacopy', 'savelocal', 'rename'];
|
|
|
|
show = ['open', 'openro', 'preview', 'openincode', 'openinsheet', 'openindoc', 'openinpresentation', 'share', 'download', 'openparent', 'delete', 'deleteowned', 'properties', 'access', 'hashtag', 'makeacopy', 'savelocal', 'rename'];
|
|
|
|
break;
|
|
|
|
break;
|
|
|
|
case 'trashtree': {
|
|
|
|
case 'trashtree': {
|
|
|
|
show = ['empty'];
|
|
|
|
show = ['empty'];
|
|
|
@ -4349,6 +4387,21 @@ define([
|
|
|
|
});
|
|
|
|
});
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var openInApp = function (paths, app) {
|
|
|
|
|
|
|
|
var p = paths[0];
|
|
|
|
|
|
|
|
var el = manager.find(p.path);
|
|
|
|
|
|
|
|
var path = currentPath;
|
|
|
|
|
|
|
|
if (path[0] !== ROOT) { path = [ROOT]; }
|
|
|
|
|
|
|
|
var _metadata = manager.getFileData(el);
|
|
|
|
|
|
|
|
var _simpleData = {
|
|
|
|
|
|
|
|
title: _metadata.filename || _metadata.title,
|
|
|
|
|
|
|
|
href: _metadata.href || _metadata.roHref,
|
|
|
|
|
|
|
|
fileType: _metadata.fileType,
|
|
|
|
|
|
|
|
password: _metadata.password,
|
|
|
|
|
|
|
|
channel: _metadata.channel,
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
openIn(app, path, APP.team, _simpleData);
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
$contextMenu.on("click", "a", function(e) {
|
|
|
|
$contextMenu.on("click", "a", function(e) {
|
|
|
|
e.stopPropagation();
|
|
|
|
e.stopPropagation();
|
|
|
@ -4436,20 +4489,19 @@ define([
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else if ($this.hasClass('cp-app-drive-context-openincode')) {
|
|
|
|
else if ($this.hasClass('cp-app-drive-context-openincode')) {
|
|
|
|
if (paths.length !== 1) { return; }
|
|
|
|
if (paths.length !== 1) { return; }
|
|
|
|
var p = paths[0];
|
|
|
|
openInApp(paths, 'code');
|
|
|
|
el = manager.find(p.path);
|
|
|
|
}
|
|
|
|
(function () {
|
|
|
|
else if ($this.hasClass('cp-app-drive-context-openinsheet')) {
|
|
|
|
var path = currentPath;
|
|
|
|
if (paths.length !== 1) { return; }
|
|
|
|
if (path[0] !== ROOT) { path = [ROOT]; }
|
|
|
|
openInApp(paths, 'sheet');
|
|
|
|
var _metadata = manager.getFileData(el);
|
|
|
|
}
|
|
|
|
var _simpleData = {
|
|
|
|
else if ($this.hasClass('cp-app-drive-context-openindoc')) {
|
|
|
|
title: _metadata.filename || _metadata.title,
|
|
|
|
if (paths.length !== 1) { return; }
|
|
|
|
href: _metadata.href || _metadata.roHref,
|
|
|
|
openInApp(paths, 'doc');
|
|
|
|
password: _metadata.password,
|
|
|
|
}
|
|
|
|
channel: _metadata.channel,
|
|
|
|
else if ($this.hasClass('cp-app-drive-context-openinpresentation')) {
|
|
|
|
};
|
|
|
|
if (paths.length !== 1) { return; }
|
|
|
|
openIn('code', path, APP.team, _simpleData);
|
|
|
|
openInApp(paths, 'presentation');
|
|
|
|
})();
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else if ($this.hasClass('cp-app-drive-context-expandall') ||
|
|
|
|
else if ($this.hasClass('cp-app-drive-context-expandall') ||
|
|
|
|
$this.hasClass('cp-app-drive-context-collapseall')) {
|
|
|
|
$this.hasClass('cp-app-drive-context-collapseall')) {
|
|
|
|