From a1ebafd269c3ecd43f19d104a696485a212fa066 Mon Sep 17 00:00:00 2001 From: Janusz Dobrowolski Date: Wed, 18 Mar 2009 21:05:50 +0000 Subject: [PATCH] Additional option for submit_add_or_update helpers. --- includes/ui/ui_input.inc | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/includes/ui/ui_input.inc b/includes/ui/ui_input.inc index 434117e6..df269cd6 100644 --- a/includes/ui/ui_input.inc +++ b/includes/ui/ui_input.inc @@ -167,14 +167,28 @@ function submit_center_last($name, $value, $title=false, $async=false, $icon=fal submit($name, $value, true, $title, $async, $icon); echo ""; } - +/* + For following controls: + 'both' - use both Ctrl-Enter and Escape hotkeys + 'cancel' - apply to 'RESET' button +*/ function submit_add_or_update($add=true, $title=false, $async=false) { + $cancel = $async; + + if ($async === 'both') { + $async = 'default'; $cancel = 'cancel'; + } + else if ($async === 'default') + $cancel = true; + else if ($async === 'cancel') + $async = true; + if ($add) submit('ADD_ITEM', _("Add new"), true, $title, $async); else { submit('UPDATE_ITEM', _("Update"), true, $title, $async); - submit('RESET', _("Cancel"), true, $title, $async); + submit('RESET', _("Cancel"), true, $title, $cancel); } } -- 2.30.2