diff --git a/addressbook/inc/class.addressbook_ui.inc.php b/addressbook/inc/class.addressbook_ui.inc.php
index 80c380a2a7..4fe28184c9 100644
--- a/addressbook/inc/class.addressbook_ui.inc.php
+++ b/addressbook/inc/class.addressbook_ui.inc.php
@@ -1999,6 +1999,9 @@ class addressbook_ui extends addressbook_bo
$GLOBALS['egw_info']['flags']['currentid'] = $content['id'];
// Load JS for infolog actions
egw_framework::validate_file('.','index','infolog');
+ // Load egw_action stuff for infolog, required before etemplate::exec() because it loads stuff into HTML header
+ nextmatch_widget::init_egw_actions();
+
$this->tmpl->exec('addressbook.addressbook_ui.view',$content,$sel_options,$readonlys,array('id' => $content['id']));
$GLOBALS['egw']->hooks->process(array(
diff --git a/etemplate/inc/class.etemplate.inc.php b/etemplate/inc/class.etemplate.inc.php
index fefb1423ea..c6f7fa6475 100644
--- a/etemplate/inc/class.etemplate.inc.php
+++ b/etemplate/inc/class.etemplate.inc.php
@@ -953,52 +953,10 @@ class etemplate extends boetemplate
$html = html::div($html,$div_style);
}
+ // initialise egw_actions for nextmatch widget, if egwGridView_grid CSS class set
if ($options[3] == 'egwGridView_grid')
{
- // Load some JS files needed for the egw_action framework
- egw_framework::includeCSS('/phpgwapi/js/egw_action/test/skins/dhtmlxmenu_egw.css');
-
- egw_framework::validate_file('dhtmlxtree','dhtmlxMenu/codebase/dhtmlxcommon');
- egw_framework::validate_file('dhtmlxtree','dhtmlxMenu/codebase/dhtmlxmenu');
- egw_framework::validate_file('dhtmlxtree','dhtmlxMenu/codebase/ext/dhtmlxmenu_ext');
- egw_framework::validate_file('egw_action','egw_action');
- egw_framework::validate_file('egw_action','egw_action_common');
- egw_framework::validate_file('egw_action','egw_action_popup');
- egw_framework::validate_file('egw_action','egw_menu');
- egw_framework::validate_file('egw_action','egw_menu_dhtmlx');
- egw_framework::validate_file('.', 'nextmatch_action', 'etemplate');
-
- // JS action objects generated for this widget are prefixed with the
- // prefix given here
- $prefix = "egw_";
-
- $action_links = array();
-
- $html .= '
-';
+ $html .= nextmatch_widget::init_egw_actions($content['_actions'], $content['action_links'], $this->name);
}
return "\n\n\n$html\n\n";
diff --git a/etemplate/inc/class.nextmatch_widget.inc.php b/etemplate/inc/class.nextmatch_widget.inc.php
index 925c63c5b6..863733d2b5 100644
--- a/etemplate/inc/class.nextmatch_widget.inc.php
+++ b/etemplate/inc/class.nextmatch_widget.inc.php
@@ -60,9 +60,10 @@
* 'actions' => // I array with actions, see nextmatch_widget::egw_actions
* 'action_links' => // I array with enabled actions or ones which should be checked if they are enabled
* optional, default id of all first level actions plus the ones with enabled='javaScript:...'
+ * 'action' => // O string selected action
* 'selected' => // O array with selected id's
- * 'checkboxes' => // 0 array with checkbox id as key and boolean checked value
- * 'select_all' => // 0 boolean value of select_all checkbox, reference to above value for key 'select_all'
+ * 'checkboxes' => // O array with checkbox id as key and boolean checked value
+ * 'select_all' => // O boolean value of select_all checkbox, reference to above value for key 'select_all'
* );
*/
class nextmatch_widget
@@ -804,6 +805,62 @@ class nextmatch_widget
return $cat_actions;
}
+ /**
+ * Return HTML to initialise actions, if called without arguments only CSS and JS get loaded
+ *
+ * Gets called from etemplate::show_grid() and addressbook_ui::view (without arguments).
+ *
+ * @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 $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_')
+ {
+ // Load some JS files needed for the egw_action framework
+ egw_framework::includeCSS('/phpgwapi/js/egw_action/test/skins/dhtmlxmenu_egw.css');
+
+ egw_framework::validate_file('dhtmlxtree','dhtmlxMenu/codebase/dhtmlxcommon');
+ egw_framework::validate_file('dhtmlxtree','dhtmlxMenu/codebase/dhtmlxmenu');
+ egw_framework::validate_file('dhtmlxtree','dhtmlxMenu/codebase/ext/dhtmlxmenu_ext');
+ egw_framework::validate_file('egw_action','egw_action');
+ egw_framework::validate_file('egw_action','egw_action_common');
+ egw_framework::validate_file('egw_action','egw_action_popup');
+ egw_framework::validate_file('egw_action','egw_menu');
+ egw_framework::validate_file('egw_action','egw_menu_dhtmlx');
+ egw_framework::validate_file('.', 'nextmatch_action', 'etemplate');
+
+ if ($actions)
+ {
+ if (!is_array($action_links)) $action_links = array();
+
+ return '
+';
+ }
+ }
+
/**
* Calling our callback
*