From 0de6ab1b352222dd846847128c6082f34a43d532 Mon Sep 17 00:00:00 2001 From: Ralf Becker Date: Mon, 26 Aug 2013 08:24:50 +0000 Subject: [PATCH] fix not working timesheet status and category actions: "disableClass", "enableClass" and "enableId" are now handled by action system itself, one should not set an explicit "enabled" attribute anymore --- etemplate/inc/class.nextmatch_widget.inc.php | 17 ++--------------- phpgwapi/js/egw_action/egw_action.js | 4 ++-- timesheet/inc/class.timesheet_ui.inc.php | 3 +-- 3 files changed, 5 insertions(+), 19 deletions(-) diff --git a/etemplate/inc/class.nextmatch_widget.inc.php b/etemplate/inc/class.nextmatch_widget.inc.php index b8e54d4578..b4f7577aba 100644 --- a/etemplate/inc/class.nextmatch_widget.inc.php +++ b/etemplate/inc/class.nextmatch_widget.inc.php @@ -576,9 +576,9 @@ 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' + * - string 'disableClass' class name to disable an action * (add that css class in get_rows(), if row lacks rights for an action) - * - boolena 'hideOnDisabled' hide disabled actions, default false + * - boolean '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 @@ -669,19 +669,6 @@ class nextmatch_widget } $action['id'] = $prefix.$id; - // set certain enable functions - foreach(array( - 'enableClass' => 'javaScript:nm_enableClass', - 'disableClass' => 'javaScript:nm_not_disableClass', - 'enableId' => 'javaScript:nm_enableId', - ) as $attr => $check) - { - if (isset($action[$attr]) && !isset($action['enabled'])) - { - $action['enabled'] = $check; - } - } - // add all first level popup actions plus ones with enabled = 'javaScript:...' to action_links if ((!isset($action['type']) || in_array($action['type'],array('popup','drag'))) && // popup is the default ($first_level || substr($action['enabled'],0,11) == 'javaScript:')) diff --git a/phpgwapi/js/egw_action/egw_action.js b/phpgwapi/js/egw_action/egw_action.js index e9c296e2b5..ce3db18aca 100644 --- a/phpgwapi/js/egw_action/egw_action.js +++ b/phpgwapi/js/egw_action/egw_action.js @@ -370,8 +370,8 @@ egwAction.prototype.updateActions = function(_actions, _app) if (typeof elem.confirm != "undefined") elem.confirm = egw.lang(elem.confirm); if (typeof elem.confirm_multiple != "undefined") elem.confirm_multiple = egw.lang(elem.confirm_multiple); - // set certain enabled functions - if (typeof elem.enabled == "undefined") + // set certain enabled functions (if enabled is on it's default of true) + if (elem.enabled === true) { if (typeof elem.enableClass != "undefined") { diff --git a/timesheet/inc/class.timesheet_ui.inc.php b/timesheet/inc/class.timesheet_ui.inc.php index 9f59611c86..2f5464da55 100644 --- a/timesheet/inc/class.timesheet_ui.inc.php +++ b/timesheet/inc/class.timesheet_ui.inc.php @@ -957,7 +957,7 @@ class timesheet_ui extends timesheet_bo 'hint' => 'Apply the action on the whole query, NOT only the shown timesheets!!!', 'group' => ++$group, ), - 'cat' => nextmatch_widget::category_action( + 'cat' => etemplate_widget_nextmatch::category_action( 'timesheet',++$group,'Change category','cat_' ), 'status' => array( @@ -1013,7 +1013,6 @@ class timesheet_ui extends timesheet_bo { if ($actions[$action]['enabled']) { - $actions[$action]['enabled'] = 'javaScript:nm_not_disableClass'; // required! $actions[$action]['disableClass'] = 'rowNoEdit'; } }