[cmd:help] add a tab "Integrations" to listing external services

rel. #2568
This commit is contained in:
nao-pon
2018-07-12 00:53:33 +09:00
parent 1bc8806d7d
commit a53b54403a
13 changed files with 194 additions and 20 deletions
+14
View File
@@ -574,6 +574,20 @@ div.elfinder-cwd-wrapper-list tr.ui-state-default td span.ui-icon {
top: 45px;
}
ul.elfinder-help-integrations ul {
margin-bottom: 1em;
padding: 0;
margin: 0 1em 1em;
}
ul.elfinder-help-integrations a {
text-decoration: none;
}
ul.elfinder-help-integrations a:hover {
text-decoration: underline;
}
.elfinder-help-debug {
height: 100%;
padding: 0;
+3
View File
@@ -823,6 +823,9 @@ elFinder.prototype.commands.edit = function() {
if (!allowAll && editor.mimes && editor.mimes[0] === '*') {
allowAll = true;
}
if (editor.info && editor.info.integrate) {
fm.trigger('helpIntegration', Object.assign({cmd: 'edit'}, editor.info.integrate));
}
}
});
+66 -2
View File
@@ -93,6 +93,11 @@
html.push('</div>');
// end help
},
useInteg = false,
integrations = function() {
useInteg = true;
html.push('<div id="'+fm.namespace+'-help-integrations" class="ui-tabs-panel ui-widget-content ui-corner-bottom"/>');
},
useDebug = false,
debug = function() {
useDebug = true;
@@ -163,7 +168,7 @@
}
},
content = '',
opened, tabDebug, debugDIV, debugUL;
opened, tabInteg, integDIV, tabDebug, debugDIV, debugUL;
this.alwaysEnabled = true;
this.updateOnSelect = false;
@@ -175,7 +180,7 @@
}];
fm.bind('load', function() {
var parts = self.options.view || ['about', 'shortcuts', 'help', 'debug'],
var parts = self.options.view || ['about', 'shortcuts', 'help', 'integrations', 'debug'],
i, helpSource, tabBase, tabNav, tabs, delta;
// remove 'preference' tab, it moved to command 'preference'
@@ -202,6 +207,7 @@
helpSource = fm.baseUrl+'js/i18n/help/%s.html.js';
help();
}
$.inArray('integrations', parts) !== -1 && integrations();
$.inArray('debug', parts) !== -1 && debug();
html.push('</div>');
@@ -226,6 +232,62 @@
})
.filter(':first').trigger('click');
if (useInteg) {
tabInteg = content.find('.elfinder-help-tab-integrations').hide();
integDIV = content.find('#'+fm.namespace+'-help-integrations').hide().append($('<div class="elfinder-help-integrations-desc"/>').html(fm.i18n('integrationWith')));
fm.bind('helpIntegration', function(e) {
var ul = integDIV.children('ul:first'),
data, elm, cmdUL, cmdCls;
if (e.data) {
if ($.isPlainObject(e.data)) {
data = Object.assign({
link: '',
title: '',
banner: ''
}, e.data);
if (data.title || data.link) {
if (!data.title) {
data.title = data.link;
}
if (data.link) {
elm = $('<a/>').attr('href', data.link).attr('target', '_blank').text(data.title);
} else {
elm = $('<span/>').text(data.title);
}
if (data.banner) {
elm = $('<span/>').append($('<img/>').attr(data.banner), elm);
}
}
} else {
elm = $(e.data);
elm.filter('a').each(function() {
var tgt = $(this);
if (!tgt.attr('target')) {
tgt.attr('target', '_blank');;
}
});
}
if (elm) {
tabInteg.show();
if (!ul.length) {
ul = $('<ul class="elfinder-help-integrations"/>').appendTo(integDIV);
}
if (data && data.cmd) {
cmdCls = 'elfinder-help-integration-' + data.cmd;
cmdUL = ul.find('ul.' + cmdCls);
if (!cmdUL.length) {
cmdUL = $('<ul class="'+cmdCls+'"/>');
ul.append($('<li/>').append($('<span/>').html(fm.i18n('cmd'+data.cmd))).append(cmdUL));
}
elm = cmdUL.append($('<li/>').append(elm));
} else {
ul.append($('<li/>').append(elm));
}
}
}
});
}
// debug
if (useDebug) {
tabDebug = content.find('.elfinder-help-tab-debug').hide();
@@ -298,6 +360,8 @@
}
self.state = 0;
fm.trigger('helpBuilded', self.dialog);
}).one('open', function() {
var debug = false;
fm.one('backenddebug', function() {
+12 -1
View File
@@ -16,7 +16,18 @@ elFinder.prototype.commands.netmount = function() {
this.handlers = {
load : function() {
this.drivers = this.fm.netDrivers;
var fm = self.fm;
self.drivers = fm.netDrivers;
if (self.drivers.length) {
requestAnimationFrame(function() {
$.each(self.drivers, function() {
var d = self.options[this];
if (d && d.integrateInfo) {
fm.trigger('helpIntegration', Object.assign({cmd: 'netmount'}, d.integrateInfo));
}
});
});
}
}
};
+11
View File
@@ -705,6 +705,17 @@
return state == docked;
};
/**
* Adds an integration into help dialog.
*
* @param Object opts options
*/
this.addIntegration = function(opts) {
requestAnimationFrame(function() {
fm.trigger('helpIntegration', Object.assign({cmd: 'quicklook'}, opts));
});
};
/**
* Init command.
* Add default plugins and init other plugins
+22 -1
View File
@@ -1261,6 +1261,13 @@ elFinder.prototype.commands.quicklook.plugins = [
win = ql.window,
node;
if (ql.options.sharecadMimes.length) {
ql.addIntegration({
title: 'sharecad.org CAD-Files and 3D-Models viewer',
link: 'https://sharecad.org/DWGOnlinePlugin'
});
}
preview.on(ql.evUpdate, function(e) {
var file = e.file;
if (mimes[file.mime.toLowerCase()]) {
@@ -1354,7 +1361,21 @@ elFinder.prototype.commands.quicklook.plugins = [
other: 10485760 // 10MB
},
node;
if (ql.options.googleDocsMimes.length) {
ql.addIntegration({
title: 'Google Docs Viewer',
link: 'https://docs.google.com/'
});
}
if (ql.options.officeOnlineMimes.length) {
ql.addIntegration({
title: 'MS Online Doc Viewer',
link: 'https://products.office.com/office-online/view-office-documents-online'
});
}
preview.on(ql.evUpdate, function(e) {
var file = e.file,
type;
+2 -1
View File
@@ -8660,7 +8660,8 @@ elFinder.prototype = {
fail: function(fm, err){
$(this.inputs.host[0]).removeData('inrequest');
this.protocol.trigger('change', 'reset');
}
},
integrateInfo: opts.integrate
};
},
+1 -1
View File
@@ -550,7 +550,7 @@ elFinder.prototype._options = {
},
help : {
// Tabs to show
view : ['about', 'shortcuts', 'help', 'debug'],
view : ['about', 'shortcuts', 'help', 'integrations', 'debug'],
// HTML source URL of the heip tab
helpSource : ''
},
+27 -4
View File
@@ -18,8 +18,31 @@ elFinder.prototype._options.commandsOptions.netmount = {
locale : $('<input type="text" placeholder="Optional" class="elfinder-input-optional"/>')
}
},
dropbox2: elFinder.prototype.makeNetmountOptionOauth('dropbox2', 'Dropbox', 'Dropbox', {noOffline : true, root : '/', pathI18n : 'path'}),
googledrive: elFinder.prototype.makeNetmountOptionOauth('googledrive', 'Google Drive', 'Google'),
onedrive: elFinder.prototype.makeNetmountOptionOauth('onedrive', 'One Drive', 'OneDrive'),
box: elFinder.prototype.makeNetmountOptionOauth('box', 'Box', 'Box', {noOffline : true})
dropbox2: elFinder.prototype.makeNetmountOptionOauth('dropbox2', 'Dropbox', 'Dropbox', {noOffline : true,
root : '/',
pathI18n : 'path',
integrate : {
title: 'Dropbox.com',
link: 'https://www.dropbox.com'
}
}),
googledrive: elFinder.prototype.makeNetmountOptionOauth('googledrive', 'Google Drive', 'Google', {
integrate : {
title: 'Google Drive',
link: 'https://www.google.com/drive/'
}
}),
onedrive: elFinder.prototype.makeNetmountOptionOauth('onedrive', 'One Drive', 'OneDrive', {
integrate : {
title: 'Microsoft OneDrive',
link: 'https://onedrive.live.com'
}
}),
box: elFinder.prototype.makeNetmountOptionOauth('box', 'Box', 'Box', {
noOffline : true,
integrate : {
title: 'Box.com',
link: 'https://www.box.com'
}
})
};
+25 -5
View File
@@ -219,7 +219,11 @@
iconImg : 'img/edit_pixlreditor.png',
urlAsContent: true,
schemeContent: true,
single: true
single: true,
integrate: {
title: 'PIXLR EDITOR',
link: 'https://pixlr.com/editor/'
}
},
// MIME types to accept
mimes : ['image/jpeg', 'image/png'],
@@ -252,7 +256,11 @@
iconImg : 'img/edit_pixlrexpress.png',
urlAsContent: true,
schemeContent: true,
single: true
single: true,
integrate: {
title: 'PIXLR EXPRESS',
link: 'https://pixlr.com/express/'
}
},
// MIME types to accept
mimes : ['image/jpeg'],
@@ -284,7 +292,11 @@
name : 'Creative Cloud',
iconImg : 'img/edit_creativecloud.png',
schemeContent: true,
single: true
single: true,
integrate: {
title: 'Adobe Creative Cloud',
link: 'https://www.adobe.io/apis/creativecloud.html'
}
},
mimes : ['image/jpeg', 'image/png'],
// HTML of this editor
@@ -1342,7 +1354,11 @@
cmdCheck : 'ZohoOffice',
preventGet: true,
hideButtons: true,
syncInterval : 15000
syncInterval : 15000,
integrate: {
title: 'Zoho Office API',
link: 'https://www.zoho.com/officeapi/'
}
},
mimes : [
'application/msword',
@@ -1543,7 +1559,11 @@
preventGet: true,
hideButtons: true,
single: true,
converter: true
converter: true,
integrate: {
title: 'ONLINE-CONVERT.COM',
link: 'https://online-convert.com'
}
},
mimes : ['*'],
html : '<iframe style="width:100%;max-height:100%;border:none;"></iframe>',
+3 -1
View File
@@ -471,7 +471,9 @@
'editorMaximized' : 'Open the maximized editor window', // from v2.1.40 added 30.6.2018
'editorConvNoApi' : 'Because conversion by API is not currently available, please convert on the website.', //from v2.1.40 added 8.7.2018
'editorConvNeedUpload' : 'After conversion, you must be upload with the item URL or a downloaded file to save the converted file.', //from v2.1.40 added 8.7.2018
'convertOn' : 'Convert on the site of $1', // from v2.1.40 added 8.10.2018
'convertOn' : 'Convert on the site of $1', // from v2.1.40 added 10.7.2018
'integrations' : 'Integrations', // from v2.1.40 added 11.7.2018
'integrationWith' : 'This elFinder integrates the following external services. Please check the terms of use, privacy policy, etc. before using it.', // from v2.1.40 added 11.7.2018
/********************************** mimetypes **********************************/
'kindUnknown' : 'Unknown',
+4 -2
View File
@@ -2,7 +2,7 @@
* English translation
* @author Troex Nevelin <troex@fury.scancode.ru>
* @author Naoki Sawada <hypweb+elfinder@gmail.com>
* @version 2018-07-10
* @version 2018-07-11
*/
// elfinder.en.js is integrated into elfinder.(full|min).js by jake build
if (typeof elFinder === 'function' && elFinder.prototype.i18) {
@@ -458,7 +458,9 @@ if (typeof elFinder === 'function' && elFinder.prototype.i18) {
'editorMaximized' : 'Open the maximized editor window', // from v2.1.40 added 30.6.2018
'editorConvNoApi' : 'Because conversion by API is not currently available, please convert on the website.', //from v2.1.40 added 8.7.2018
'editorConvNeedUpload' : 'After conversion, you must be upload with the item URL or a downloaded file to save the converted file.', //from v2.1.40 added 8.7.2018
'convertOn' : 'Convert on the site of $1', // from v2.1.40 added 8.10.2018
'convertOn' : 'Convert on the site of $1', // from v2.1.40 added 10.7.2018
'integrations' : 'Integrations', // from v2.1.40 added 11.7.2018
'integrationWith' : 'This elFinder integrates the following external services. Please check the terms of use, privacy policy, etc. before using it.', // from v2.1.40 added 11.7.2018
/********************************** mimetypes **********************************/
'kindUnknown' : 'Unknown',
+4 -2
View File
@@ -2,7 +2,7 @@
* Japanese translation
* @author Tomoaki Yoshida <info@yoshida-studio.jp>
* @author Naoki Sawada <hypweb+elfinder@gmail.com>
* @version 2018-07-10
* @version 2018-07-11
*/
(function(root, factory) {
if (typeof define === 'function' && define.amd) {
@@ -465,7 +465,9 @@
'editorMaximized' : 'エディターウィンドウを最大化して開く', // from v2.1.40 added 30.6.2018
'editorConvNoApi' : '現在 API による変換は利用できないので、Web サイトで変換を行ってください。', //from v2.1.40 added 8.7.2018
'editorConvNeedUpload' : '変換後に変換されたファイルを保存するには、アイテムの URL またはダウンロードしたファイルをアップロードする必要があります。', // from v2.1.40 added 8.7.2018
'convertOn' : '$1 のサイト上で変換する', // from v2.1.40 added 8.10.2018
'convertOn' : '$1 のサイト上で変換する', // from v2.1.40 added 10.7.2018
'integrations' : '統合', // from v2.1.40 added 11.7.2018
'integrationWith' : 'この elFinder は次の外部サービスを統合しています。それらの利用規約、プライバシーポリシーなどをご確認の上、ご利用ください。', // from v2.1.40 added 11.7.2018
/********************************** mimetypes **********************************/
'kindUnknown' : '不明',