X-Git-Url: https://delta.frontaccounting.com/gitweb/?a=blobdiff_plain;f=includes%2Fui%2Fui_input.inc;h=1b73f1a40397d848dca2c422dbc123c4637e6a96;hb=05ba2d82d4230a8ea991920515cdc2377fcacfd0;hp=df269cd65f0950f75ba02129d74e33f72b5e6a49;hpb=a1ebafd269c3ecd43f19d104a696485a212fa066;p=fa-stable.git diff --git a/includes/ui/ui_input.inc b/includes/ui/ui_input.inc index df269cd6..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) @@ -172,7 +177,7 @@ function submit_center_last($name, $value, $title=false, $async=false, $icon=fal 'both' - use both Ctrl-Enter and Escape hotkeys 'cancel' - apply to 'RESET' button */ -function submit_add_or_update($add=true, $title=false, $async=false) +function submit_add_or_update($add=true, $title=false, $async=false, $clone=false) { $cancel = $async; @@ -187,33 +192,27 @@ function submit_add_or_update($add=true, $title=false, $async=false) if ($add) submit('ADD_ITEM', _("Add new"), true, $title, $async); else { - submit('UPDATE_ITEM', _("Update"), true, $title, $async); - submit('RESET', _("Cancel"), true, $title, $cancel); + 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 "