diff --git a/css/commands.css b/css/commands.css index 561fceffd..fd947956e 100644 --- a/css/commands.css +++ b/css/commands.css @@ -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; diff --git a/js/commands/edit.js b/js/commands/edit.js index 8a3caec04..443e63c57 100644 --- a/js/commands/edit.js +++ b/js/commands/edit.js @@ -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)); + } } }); diff --git a/js/commands/help.js b/js/commands/help.js index be4f80b2b..9218a0c6e 100644 --- a/js/commands/help.js +++ b/js/commands/help.js @@ -93,6 +93,11 @@ html.push(''); // end help }, + useInteg = false, + integrations = function() { + useInteg = true; + html.push('
'); + }, 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('
'); @@ -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($('
').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 = $('').attr('href', data.link).attr('target', '_blank').text(data.title); + } else { + elm = $('').text(data.title); + } + if (data.banner) { + elm = $('').append($('').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 = $('
    ').appendTo(integDIV); + } + if (data && data.cmd) { + cmdCls = 'elfinder-help-integration-' + data.cmd; + cmdUL = ul.find('ul.' + cmdCls); + if (!cmdUL.length) { + cmdUL = $('
      '); + ul.append($('
    • ').append($('').html(fm.i18n('cmd'+data.cmd))).append(cmdUL)); + } + elm = cmdUL.append($('
    • ').append(elm)); + } else { + ul.append($('
    • ').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() { diff --git a/js/commands/netmount.js b/js/commands/netmount.js index b5903de4a..de4ec3665 100644 --- a/js/commands/netmount.js +++ b/js/commands/netmount.js @@ -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)); + } + }); + }); + } } }; diff --git a/js/commands/quicklook.js b/js/commands/quicklook.js index 804764750..a4f1bc564 100644 --- a/js/commands/quicklook.js +++ b/js/commands/quicklook.js @@ -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 diff --git a/js/commands/quicklook.plugins.js b/js/commands/quicklook.plugins.js index 296a77946..7c6ba2aa6 100644 --- a/js/commands/quicklook.plugins.js +++ b/js/commands/quicklook.plugins.js @@ -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; diff --git a/js/elFinder.js b/js/elFinder.js index a5560c01b..e30c83d1c 100644 --- a/js/elFinder.js +++ b/js/elFinder.js @@ -8660,7 +8660,8 @@ elFinder.prototype = { fail: function(fm, err){ $(this.inputs.host[0]).removeData('inrequest'); this.protocol.trigger('change', 'reset'); - } + }, + integrateInfo: opts.integrate }; }, diff --git a/js/elFinder.options.js b/js/elFinder.options.js index 585d090f3..8b9c4aecc 100644 --- a/js/elFinder.options.js +++ b/js/elFinder.options.js @@ -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 : '' }, diff --git a/js/elFinder.options.netmount.js b/js/elFinder.options.netmount.js index b8884be9e..06f232a27 100644 --- a/js/elFinder.options.netmount.js +++ b/js/elFinder.options.netmount.js @@ -18,8 +18,31 @@ elFinder.prototype._options.commandsOptions.netmount = { locale : $('') } }, - 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' + } + }) }; diff --git a/js/extras/editors.default.js b/js/extras/editors.default.js index 132483e30..368f03457 100644 --- a/js/extras/editors.default.js +++ b/js/extras/editors.default.js @@ -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 : '', diff --git a/js/i18n/elfinder.LANG.js b/js/i18n/elfinder.LANG.js index 84b1890f0..909eb8648 100644 --- a/js/i18n/elfinder.LANG.js +++ b/js/i18n/elfinder.LANG.js @@ -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', diff --git a/js/i18n/elfinder.en.js b/js/i18n/elfinder.en.js index ad8ff8bca..c9b5bc25b 100644 --- a/js/i18n/elfinder.en.js +++ b/js/i18n/elfinder.en.js @@ -2,7 +2,7 @@ * English translation * @author Troex Nevelin * @author Naoki Sawada - * @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', diff --git a/js/i18n/elfinder.ja.js b/js/i18n/elfinder.ja.js index d81fc8e94..7685f327d 100644 --- a/js/i18n/elfinder.ja.js +++ b/js/i18n/elfinder.ja.js @@ -2,7 +2,7 @@ * Japanese translation * @author Tomoaki Yoshida * @author Naoki Sawada - * @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' : '不明',