X-Git-Url: https://delta.frontaccounting.com/gitweb/?a=blobdiff_plain;f=includes%2Fui%2Fui_input.inc;h=1b73f1a40397d848dca2c422dbc123c4637e6a96;hb=af78fbb535a6fedbc2eb70a26ddc39739be2b986;hp=434117e652553e16ffeabdbc06b5cebe0af80837;hpb=061f4eff6493a6cca071338156225401ae849d72;p=fa-stable.git diff --git a/includes/ui/ui_input.inc b/includes/ui/ui_input.inc index 434117e6..1b73f1a4 100644 --- a/includes/ui/ui_input.inc +++ b/includes/ui/ui_input.inc @@ -47,11 +47,12 @@ function simple_page_mode($numeric_id = true) $default = $numeric_id ? -1 : ''; $selected_id = get_post('selected_id', $default); - foreach (array('ADD_ITEM', 'UPDATE_ITEM', 'RESET') as $m) { + foreach (array('ADD_ITEM', 'UPDATE_ITEM', 'RESET', 'CLONE') as $m) { if (isset($_POST[$m])) { $Ajax->activate('_page_body'); - if ($m == 'RESET') + if ($m == 'RESET' || $m == 'CLONE') $selected_id = $default; + unset($_POST['_focus']); $Mode = $m; return; } } @@ -108,6 +109,7 @@ function hidden($name, $value=null, $echo=true) true - standard button; optional icon 'process' - displays progress bar during call; optional icon 'default' - default form submit on Ctrl-Enter press; dflt ICON_OK icon + 'selector' - ditto with closing current popup editor window 'cancel' - cancel form entry on Escape press; dflt ICON_CANCEL */ function submit($name, $value, $echo=true, $title=false, $atype=false, $icon=false) @@ -119,6 +121,10 @@ function submit($name, $value, $echo=true, $title=false, $atype=false, $icon=fal switch($atype) { case 'process': $aspect = " aspect='process'"; break; + case 'selector': + $aspect = " aspect='selector' rel = '$value'"; + $value = _("Select"); + if ($icon===false) $icon=ICON_SUBMIT; break; case 'default': $aspect = " aspect='default'"; if ($icon===false) $icon=ICON_SUBMIT; break; @@ -130,7 +136,6 @@ function submit($name, $value, $echo=true, $title=false, $atype=false, $icon=fal " aspect='fallback'" : " style='display:none;'"; break; } - default_focus($name); $submit_str = "\n"; if ($echo) @@ -167,39 +172,47 @@ function submit_center_last($name, $value, $title=false, $async=false, $icon=fal submit($name, $value, true, $title, $async, $icon); echo ""; } - -function submit_add_or_update($add=true, $title=false, $async=false) +/* + 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, $clone=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('UPDATE_ITEM', _("Update"), true, _('Submit changes'), $async); + if ($clone) submit('CLONE', _("Clone"), true, + _('Edit new record with current data'), $async); + submit('RESET', _("Cancel"), true, _('Cancel edition'), $cancel); } } -function submit_add_or_update_center($add=true, $title=false, $async=false) +function submit_add_or_update_center($add=true, $title=false, $async=false, $clone=false) { echo "