From f4fe5cf8b64f18b994bf09c82306104390c56185 Mon Sep 17 00:00:00 2001 From: Nathan Gray Date: Wed, 20 Mar 2013 23:09:04 +0000 Subject: [PATCH] Add ability to specify which actions are available for the no results placeholder --- .../inc/class.etemplate_widget_nextmatch.inc.php | 3 ++- etemplate/js/et2_extension_nextmatch_controller.js | 12 +++++++++++- 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/etemplate/inc/class.etemplate_widget_nextmatch.inc.php b/etemplate/inc/class.etemplate_widget_nextmatch.inc.php index 6ea1149744..d550b09b36 100644 --- a/etemplate/inc/class.etemplate_widget_nextmatch.inc.php +++ b/etemplate/inc/class.etemplate_widget_nextmatch.inc.php @@ -73,6 +73,7 @@ * 'favorites' => // I boolean|array True to enable favorites, or an array of additional, app specific settings to include * in the saved filters (eg: pm_id) * 'placeholder' => // I String Optional text to display in the empty row placeholder. If not provided, it's "No matches found." + * 'placeholder_actions' => // I String Optional list of actions allowed on the placeholder. If not provided, it's ["add"]. */ class etemplate_widget_nextmatch extends etemplate_widget { @@ -354,7 +355,7 @@ class etemplate_widget_nextmatch extends etemplate_widget } }*/ } - foreach($result as $name => $value) if ($name != 'readonlys') error_log(__METHOD__."() result['$name']=".array2string($name == 'data' ? array_keys($value) : $value)); + //foreach($result as $name => $value) if ($name != 'readonlys') error_log(__METHOD__."() result['$name']=".array2string($name == 'data' ? array_keys($value) : $value)); egw_json_response::get()->data($result); } diff --git a/etemplate/js/et2_extension_nextmatch_controller.js b/etemplate/js/et2_extension_nextmatch_controller.js index 1dcbc3fe92..0db8b92d34 100644 --- a/etemplate/js/et2_extension_nextmatch_controller.js +++ b/etemplate/js/et2_extension_nextmatch_controller.js @@ -210,7 +210,17 @@ var et2_nextmatch_controller = et2_dataview_controller.extend( } // No UID, so return a filtered list of actions that doesn't need a UID - var links = ["add"]; + var links = []; + try { + links = this._widget.options.settings.placeholder_actions; + } catch (e) { + } + // Default + if(typeof links == "undefined") + { + links = ["add"]; + } + return links; },