From fd36f854a3b75484000c2aae7940eb6a0e5ab30d Mon Sep 17 00:00:00 2001 From: Hadi Nategh Date: Tue, 27 Nov 2018 15:22:50 +0100 Subject: [PATCH] W.I.P. of disableIfNoEPL attribute: - Implement the same attribute for sidebox menu - Fix if hideOnDisabled is enabled it will ignore the disableIfNoEPL and it will not show the menu at all - Adopt addressbook Mail VCard menu --- addressbook/inc/class.addressbook_ui.inc.php | 5 +++-- api/js/framework/fw_base.js | 4 +++- api/src/Etemplate/Widget/Nextmatch.php | 3 ++- api/src/Framework/Ajax.php | 6 +++++- api/templates/default/etemplate2.css | 5 ++++- .../inc/class.filemanager_hooks.inc.php | 18 ++++++++---------- 6 files changed, 25 insertions(+), 16 deletions(-) diff --git a/addressbook/inc/class.addressbook_ui.inc.php b/addressbook/inc/class.addressbook_ui.inc.php index 1871f397e3..c86fc7aaee 100644 --- a/addressbook/inc/class.addressbook_ui.inc.php +++ b/addressbook/inc/class.addressbook_ui.inc.php @@ -759,7 +759,7 @@ class addressbook_ui extends addressbook_bo $this->prefs['document_dir'], $group, 'Insert in document', 'document_', $this->prefs['default_document'], $this->config['contact_export_limit'] ); - if (isset($GLOBALS['egw_info']['apps']['stylite']) && ($GLOBALS['egw_info']['user']['apps']['felamimail']||$GLOBALS['egw_info']['user']['apps']['mail'])) + if ($GLOBALS['egw_info']['user']['apps']['felamimail']||$GLOBALS['egw_info']['user']['apps']['mail']) { $actions['mail'] = array( 'caption' => lang('Mail VCard'), @@ -768,7 +768,8 @@ class addressbook_ui extends addressbook_bo 'onExecute' => 'javaScript:app.addressbook.adb_mail_vcard', 'enableClass' => 'contact_contact', 'hideOnDisabled' => true, - 'hideOnMobile' => true + 'hideOnMobile' => true, + 'disableIfNoEPL' => true ); } ++$group; diff --git a/api/js/framework/fw_base.js b/api/js/framework/fw_base.js index 269ae88181..65c879f26a 100644 --- a/api/js/framework/fw_base.js +++ b/api/js/framework/fw_base.js @@ -268,7 +268,9 @@ var fw_base = (function(){ "use strict"; return Class.extend( if (_data[i].entries[j].icon_or_star) { - catContent += '
'; + var disableIfNoEPL = _data[i].entries[j].disableIfNoEPL ? ' disableIfNoEPL" title="'+egw.lang("This feature is only available in EPL version.") : ""; + catContent += '
'; } if (_data[i].entries[j].item_link == '') { diff --git a/api/src/Etemplate/Widget/Nextmatch.php b/api/src/Etemplate/Widget/Nextmatch.php index 814a37d538..39f72ab92b 100644 --- a/api/src/Etemplate/Widget/Nextmatch.php +++ b/api/src/Etemplate/Widget/Nextmatch.php @@ -824,7 +824,8 @@ class Nextmatch extends Etemplate\Widget } if (!empty($action['disableIfNoEPL']) && $action['disableIfNoEPL'] && !$GLOBALS['egw_info']['apps']['stylite']) { - $action['enabled'] = false; + $action['enabled'] = + $action['hideOnDisabled'] = false; $action['hint'] = Lang("This feature is only available in EPL version."); } else if(!empty($action['disableIfNoEPL'])) diff --git a/api/src/Framework/Ajax.php b/api/src/Framework/Ajax.php index efa7efd64d..3858fd24ac 100755 --- a/api/src/Framework/Ajax.php +++ b/api/src/Framework/Ajax.php @@ -258,7 +258,7 @@ abstract class Ajax extends Api\Framework 'location' => 'framework_header', 'popup' => !$do_framework, )); - + $this->tpl->set_var($this->_get_header($extra)); $content = $this->tpl->fp('out','head').$content; @@ -635,6 +635,10 @@ abstract class Ajax extends Api\Framework $var['target'] = $item_link['target']; } } + if ($item_link['disableIfNoEPL'] && !$GLOBALS['egw_info']['apps']['stylite']) + { + $var['disableIfNoEPL'] = true; + } } else { diff --git a/api/templates/default/etemplate2.css b/api/templates/default/etemplate2.css index 8aa5aef42b..35a92f1d6a 100644 --- a/api/templates/default/etemplate2.css +++ b/api/templates/default/etemplate2.css @@ -2989,5 +2989,8 @@ tr.disableIfNoEPL { margin-right: 1px; border-radius: 1px; } - +.egw_fw_ui_sidemenu_listitem.disableIfNoEPL > * { + opacity: 0.5; + pointer-events: none; +} .inactive_blur > * {opacity: 0.4; filter:blur(2px); pointer-events: none;} \ No newline at end of file diff --git a/filemanager/inc/class.filemanager_hooks.inc.php b/filemanager/inc/class.filemanager_hooks.inc.php index 3e2f001066..3557495930 100644 --- a/filemanager/inc/class.filemanager_hooks.inc.php +++ b/filemanager/inc/class.filemanager_hooks.inc.php @@ -41,16 +41,14 @@ class filemanager_hooks { $title = $GLOBALS['egw_info']['apps'][self::$appname]['title'] . ' '. lang('Menu'); $file = array(); - if($GLOBALS['egw_info']['apps']['stylite']) - { - // add "file a file" (upload) dialog - $file[] = array( - 'text' => 'File a file', - 'link' => "javascript:app.filemanager.fileafile()", - 'app' => 'api', - 'icon' => 'upload', - ); - } + // add "file a file" (upload) dialog + $file[] = array( + 'text' => 'File a file', + 'link' => "javascript:app.filemanager.fileafile()", + 'app' => 'api', + 'icon' => 'upload', + 'disableIfNoEPL' => true + ); // add selection for available views, if we have more then one if (count(filemanager_ui::init_views()) > 1) {