mirror of
https://github.com/EGroupware/egroupware.git
synced 2024-12-26 16:48:49 +01:00
enable/disable edit and delete action, based on ACL rights, set as css classes to each row
This commit is contained in:
parent
f2b739e332
commit
bb0e8617b2
@ -520,12 +520,15 @@ class nextmatch_widget
|
||||
* - string 'iconUrl' full url of icon, better use 'icon'
|
||||
* - boolean|string 'allowOnMultiple' should action be shown if multiple lines are marked, or string 'only', default true!
|
||||
* - boolean|string 'enabled' is action available, or string with javascript function to call, default true!
|
||||
* - string 'disableClass' class name to use with enabled='javaScript:nm_not_disableClass'
|
||||
* (add that css class in get_rows(), if row lacks rights for an action)
|
||||
* - boolena 'hideOnDisabled' hide disabled actions, default false
|
||||
* - string 'type' type of action, default 'popup' for contenxt menus, 'drag' or 'drop'
|
||||
* - boolean 'default' is that action the default action, default false
|
||||
* - array 'children' array with actions of submenu
|
||||
* - int 'group' to group items, default all actions are in one group
|
||||
* - string 'onExecute' javascript to run, default 'javascript:nm_action' which runs action specified in nm_action attribute:
|
||||
* - string 'onExecute' javascript to run, default 'javaScript:nm_action',
|
||||
* which runs action specified in nm_action attribute:
|
||||
* - string 'nm_action'
|
||||
* + 'alert' debug action, shows alert with action caption, id and id's of selected rows
|
||||
* + 'submit' default action, sets nm[action], nm[selected] and nm[select_all]
|
||||
|
@ -171,3 +171,16 @@ function nm_select_all(_action, _senders)
|
||||
{
|
||||
document.getElementById('exec[nm][select_all]').value = _action.checked ? _action.hint : false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Callback to check if none of _senders rows has disableClass set
|
||||
*
|
||||
* @param _action egwAction object, we use _action.data.disableClass to check
|
||||
* @param _senders array of egwActionObject objects
|
||||
* @param _target egwActionObject object, get's called for every object in _senders
|
||||
* @returns boolean true if none has disableClass, false otherwise
|
||||
*/
|
||||
function nm_not_disableClass(_action, _senders, _target)
|
||||
{
|
||||
return !$(_target.iface.getDOMNode()).hasClass(_action.data.disableClass);
|
||||
}
|
||||
|
@ -693,10 +693,12 @@ class timesheet_ui extends timesheet_bo
|
||||
if (!$this->check_acl(EGW_ACL_EDIT,$row))
|
||||
{
|
||||
$readonlys["edit[$row[ts_id]]"] = true;
|
||||
$row['class'] .= ' rowNoEdit';
|
||||
}
|
||||
if (!$this->check_acl(EGW_ACL_DELETE,$row))
|
||||
{
|
||||
$readonlys["delete[$row[ts_id]]"] = true;
|
||||
$row['class'] .= ' rowNoDelete';
|
||||
}
|
||||
if ($query['col_filter']['ts_project'] || !$query['filter2'])
|
||||
{
|
||||
@ -880,6 +882,8 @@ class timesheet_ui extends timesheet_bo
|
||||
'url' => 'menuaction=timesheet.timesheet_ui.edit&ts_id=$id',
|
||||
'popup' => egw_link::get_registry('timesheet', 'add_popup'),
|
||||
'group' => $group,
|
||||
'enabled' => 'javaScript:nm_not_disableClass',
|
||||
'disableClass' => 'rowNoEdit',
|
||||
),
|
||||
'add' => array(
|
||||
'caption' => 'Add',
|
||||
@ -920,6 +924,8 @@ class timesheet_ui extends timesheet_bo
|
||||
'confirm' => 'Delete this entry',
|
||||
'confirm_multiple' => 'Delete these entries',
|
||||
'group' => ++$group,
|
||||
'enabled' => 'javaScript:nm_not_disableClass',
|
||||
'disableClass' => 'rowNoDelete',
|
||||
),
|
||||
);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user