From 4cb37be5d310701fbfa306e942c7ae010c326a4b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andreas=20St=C3=B6ckel?= Date: Thu, 2 Jun 2011 14:49:56 +0000 Subject: [PATCH] Implemented usage of global action manager and object manager for nextmatch widget --- etemplate/inc/class.nextmatch_widget.inc.php | 33 +++++++++++++------- etemplate/js/nextmatch_action.js | 20 ++++++------ 2 files changed, 32 insertions(+), 21 deletions(-) diff --git a/etemplate/inc/class.nextmatch_widget.inc.php b/etemplate/inc/class.nextmatch_widget.inc.php index 9791af5eea..e23d22f021 100644 --- a/etemplate/inc/class.nextmatch_widget.inc.php +++ b/etemplate/inc/class.nextmatch_widget.inc.php @@ -843,7 +843,7 @@ class nextmatch_widget * * @param array $actions=null * @param array $action_links=null - * @param string $template_name='' name of the template, used as default for app name of images + * @param string $template_name='' name of the template, used as default for app name of images - e.g. infolog.index.rows * @param string $prefix='egw_' JS action objects generated for this widget are prefixed with given prefix */ public static function init_egw_actions(array $actions=null, $action_links=null, $template_name='', $prefix='egw_') @@ -863,29 +863,38 @@ class nextmatch_widget if (!is_array($action_links)) $action_links = array(); + $app = $GLOBALS['egw_info']['flags']['currentapp']; + + $enc_actions = self::egw_actions($actions, $template_name, '', $action_links); + return ' '; diff --git a/etemplate/js/nextmatch_action.js b/etemplate/js/nextmatch_action.js index 97d5a7da1e..8b7af67aba 100644 --- a/etemplate/js/nextmatch_action.js +++ b/etemplate/js/nextmatch_action.js @@ -105,7 +105,9 @@ function nm_action(_action, _senders) } //console.log(_action); console.log(_senders); - var select_all = egw_actionManager.getActionById("select_all"); + var mgr = _action.getManager(); + + var select_all = mgr.getActionById("select_all"); var confirm_msg = (_senders.length > 1 || select_all && select_all.checked) && typeof _action.data.confirm_multiple != 'undefined' ? _action.data.confirm_multiple : _action.data.confirm; @@ -157,24 +159,24 @@ function nm_action(_action, _senders) { if (!confirm((confirm_msg ? confirm_msg : _action.caption)+"\n\n"+select_all.hint)) return; } - var checkboxes = egw_actionManager.getActionsByAttr("checkbox", true); - var checkboxes_elem = document.getElementById(egw_actionManager.etemplate_var_prefix+'[nm][checkboxes]'); + var checkboxes = mgr.getActionsByAttr("checkbox", true); + var checkboxes_elem = document.getElementById(mgr.etemplate_var_prefix+'[nm][checkboxes]'); if (checkboxes && checkboxes_elem) for (var i in checkboxes) checkboxes_elem.value += checkboxes[i].id + ":" + (checkboxes[i].checked ? "1" : "0") + ";"; - document.getElementById(egw_actionManager.etemplate_var_prefix+'[nm][nm_action]').value = _action.id; - document.getElementById(egw_actionManager.etemplate_var_prefix+'[nm][selected]').value = ids; + document.getElementById(mgr.etemplate_var_prefix+'[nm][nm_action]').value = _action.id; + document.getElementById(mgr.etemplate_var_prefix+'[nm][selected]').value = ids; if (typeof _action.data.button != 'undefined') { - submitit(egw_actionManager.etemplate_form.context, egw_actionManager.etemplate_var_prefix+'[nm][rows]['+_action.data.button+']['+ids+']'); + submitit(mgr.etemplate_form.context, mgr.etemplate_var_prefix+'[nm][rows]['+_action.data.button+']['+ids+']'); } else { - egw_actionManager.etemplate_form.submit(); + mgr.etemplate_form.submit(); } // Clear action in case there's another one - document.getElementById(egw_actionManager.etemplate_var_prefix+'[nm][nm_action]').value = null; + document.getElementById(mgr.etemplate_var_prefix+'[nm][nm_action]').value = null; break; } @@ -242,7 +244,7 @@ var nm_popup_action, nm_popup_senders; */ function nm_open_popup(_action, _senders) { - var popup = document.getElementById(egw_actionManager.etemplate_var_prefix + '[' + _action.id + '_popup]'); + var popup = document.getElementById(_action.getManager().etemplate_var_prefix + '[' + _action.id + '_popup]'); if (popup) { nm_popup_action = _action;