X-Git-Url: https://delta.frontaccounting.com/gitweb/?a=blobdiff_plain;f=includes%2Fui%2Fui_input.inc;h=59a3676ef5664ed7ccc7bd004411ac37c2c824aa;hb=2bcdab793e406bb5a44d2c4e079ec7cc2a1aa857;hp=de9c11531be3627497f88f81a3ae2d6db0f89c11;hpb=17b390efcf904072b02ec866b2a427490471a260;p=fa-stable.git diff --git a/includes/ui/ui_input.inc b/includes/ui/ui_input.inc index de9c1153..59a3676e 100644 --- a/includes/ui/ui_input.inc +++ b/includes/ui/ui_input.inc @@ -37,6 +37,14 @@ function find_submit($prefix, $numeric=true) } return $numeric ? -1 : null; } +/* + Helper function. + Returns true if input $name with $submit_on_change option set is subject to update. +*/ +function input_changed($name) +{ + return isset($_POST['_'.$name.'_changed']); +} //------------------------------------------------------------------------------ // @@ -85,7 +93,12 @@ function input_num($postname=null, $dflt=0) } //--------------------------------------------------------------------------------- -$hidden_fields = array(); // store for hiddn fields attached just before form end (for proper html validation) +// +// Thanks to hidden fields buffering hidden() helper can be used in arbitrary places and +// proper html structure is still preserved. Buffered hidden fields are output on the nearest +// table or form closing tag (see output_hidden()). +// +$hidden_fields = array(); function hidden($name, $value=null, $echo=true) { @@ -146,6 +159,7 @@ function submit($name, $value, $echo=true, $title=false, $atype=false, $icon=fal if ($icon===false) $icon=ICON_ESCAPE; break; case 'nonajax': + case 'download': $atype = false; } } @@ -189,6 +203,7 @@ function submit_center_last($name, $value, $title=false, $async=false, $icon=fal /* For following controls: 'both' - use both Ctrl-Enter and Escape hotkeys + 'upgrade' - use Ctrl-Enter with progress ajax indicator and Escape hotkeys. Nonajax request for OK option is performed. 'cancel' - apply to 'RESET' button */ function submit_add_or_update($add=true, $title=false, $async=false, $clone=false) @@ -197,10 +212,13 @@ function submit_add_or_update($add=true, $title=false, $async=false, $clone=fals if ($async === 'both') { $async = 'default'; $cancel = 'cancel'; - } - else if ($async === 'default') + } + elseif ($async === 'upgrade') { + $async = 'default nonajax process'; $cancel = 'cancel'; + } + elseif ($async === 'default') $cancel = true; - else if ($async === 'cancel') + elseif ($async === 'cancel') $async = true; if ($add) @@ -270,7 +288,7 @@ function set_icon($icon, $title=false) global $path_to_root; if (basename($icon) === $icon) // standard icons does not contain path separator $icon = "$path_to_root/themes/".user_theme()."/images/$icon"; - return "\n"; + return "\n"; } function button($name, $value, $title=false, $icon=false, $aspect='') @@ -287,7 +305,7 @@ function button($name, $value, $title=false, $icon=false, $aspect='') if ($value == _("Delete")) // Helper during implementation $icon = ICON_DELETE; return "