Introduce new action attribute to disable EPL actions via action system

This commit is contained in:
Hadi Nategh 2018-11-27 11:50:23 +01:00
parent 377766293f
commit f3ebfacc57
4 changed files with 51 additions and 1 deletions

View File

@ -198,6 +198,7 @@ function egwAction(_parent, _id, _caption, _iconUrl, _onExecute, _allowOnMultipl
this.set_onExecute(_onExecute);
}
this.hideOnMobile = false;
this.disableIfNoEPL = false;
}
/**
@ -680,6 +681,11 @@ egwAction.prototype.set_hideOnMobile = function(_value)
this.hideOnMobile = _value;
};
egwAction.prototype.set_disableIfNoEPL = function(_value)
{
this.disableIfNoEPL = _value;
};
egwAction.prototype.set_data = function(_value)
{
this.data = _value;

View File

@ -95,6 +95,15 @@ function egwMenuImpl(_structure)
//Translate the given structure to the dhtmlx object structure
this._translateStructure(_structure, this.dhtmlxmenu.topId, 0);
// Add disableIfNoEPL class to the relevant action's DOM
for(var i in this.dhtmlxmenu.idPull)
{
if (this.dhtmlxmenu.userData[i+'_egw_menu'] && this.dhtmlxmenu.userData[i+'_egw_menu']['data']['disableIfNoEPL'])
{
this.dhtmlxmenu.idPull[i].className += ' disableIfNoEPL';
}
}
}
egwMenuImpl.prototype._translateStructure = function(_structure, _parentId, _idCnt)

View File

@ -822,6 +822,15 @@ class Nextmatch extends Etemplate\Widget
{
continue; // no need to send this action to client, specially document actions can be huge
}
if (!empty($action['disableIfNoEPL']) && $action['disableIfNoEPL'] && !$GLOBALS['egw_info']['apps']['stylite'])
{
$action['enabled'] = false;
$action['hint'] = Lang("This feature is only available in EPL version.");
}
else if(!empty($action['disableIfNoEPL']))
{
unset($action['disableIfNoEPL']);
}
// in case it's only selectbox id => label pairs
if (!is_array($action)) $action = array('caption' => $action);
if ($default_attrs) $action += $default_attrs;

View File

@ -2964,4 +2964,30 @@ div.eml div.emlDelete:hover, div.eml div.emlEdit:hover {
margin-left: 0;
}
#api\.vfsSelectUI_app {width:177px}
#api\.vfsSelectUI_name {padding-right: 4px;}
#api\.vfsSelectUI_name {padding-right: 4px;}
tr.disableIfNoEPL {
box-shadow: inset 1px 1px 1px 1px #b9b9b9bf;
}
.disableIfNoEPL td {
opacity: 0.6;
}
.disableIfNoEPL:after {
content: 'EPL ONLY';
color: #ffffff;
position: absolute;
opacity: 0.5;
height: 10px;
background: rgb(6, 32, 56);
font-weight: bold;
padding: 2px;
line-height: 8px;
font-size: 7pt;
text-align: center;
right: 0;
margin-top: 2px;
margin-right: 1px;
border-radius: 1px;
}
.inactive_blur > * {opacity: 0.4; filter:blur(2px); pointer-events: none;}