X-Git-Url: https://delta.frontaccounting.com/gitweb/?a=blobdiff_plain;f=includes%2Fui%2Fui_input.inc;h=434117e652553e16ffeabdbc06b5cebe0af80837;hb=02e49d757dc1f8a46258df7c77714d2b75554a83;hp=3c2151bc34a531eded03040b72e95b7576123300;hpb=f12dbe7523bb1abc6cd69b009ef8f0be838f5348;p=fa-stable.git diff --git a/includes/ui/ui_input.inc b/includes/ui/ui_input.inc index 3c2151bc..434117e6 100644 --- a/includes/ui/ui_input.inc +++ b/includes/ui/ui_input.inc @@ -1,9 +1,14 @@ . +***********************************************************************/ // // Sets local POST value and adds Value to ajax posting if needed // @@ -71,7 +76,7 @@ function simple_page_mode($numeric_id = true) // function input_num($postname=null, $dflt=null) { - if (!isset($_POST[$postname])) + if (!isset($_POST[$postname]) || $_POST[$postname] == "") return $dflt; return user_numeric($_POST[$postname]); @@ -93,51 +98,73 @@ function hidden($name, $value=null, $echo=true) else return $ret; } - -//--------------------------------------------------------------------------------- -// Submit button. -// $async parameter can have 3 values: -// null - fallback button not visible in js enabled mode -// false - normal submit via form action -// true - when js is on submition via ajax call -// 'process' - ditto with processing indicator in msgbox -// -function submit($name, $value, $echo=true, $title=false, $async=false) -{ +/* + Universal submit form button. + $atype - type of submit: + Normal submit: + false - normal button; optional icon + null - button visible only in fallback mode; optional icon + Ajax submit: + 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 + 'cancel' - cancel form entry on Escape press; dflt ICON_CANCEL +*/ +function submit($name, $value, $echo=true, $title=false, $atype=false, $icon=false) +{ + global $path_to_root; + + $aspect=''; + if (!is_bool($atype)) // necessary: switch uses '==' + switch($atype) { + case 'process': + $aspect = " aspect='process'"; break; + case 'default': + $aspect = " aspect='default'"; + if ($icon===false) $icon=ICON_SUBMIT; break; + case 'cancel': + $aspect = " aspect='cancel'"; + if ($icon===false) $icon=ICON_ESCAPE; break; + case null: + $aspect = fallback_mode() ? + " aspect='fallback'" : " style='display:none;'"; break; + } default_focus($name); - $submit_str = "\n"; + .">" + .($icon ? "" : '') + ."$value" + ."\n"; if ($echo) echo $submit_str; else return $submit_str; } -function submit_center($name, $value, $echo=true, $title=false, $async=false) +function submit_center($name, $value, $echo=true, $title=false, $async=false, $icon=false) { echo "
"; - submit($name, $value, $echo, $title, $async); + submit($name, $value, $echo, $title, $async, $icon); echo "
"; } -function submit_center_first($name, $value, $title=false, $async=false) +function submit_center_first($name, $value, $title=false, $async=false, $icon=false) { echo "
"; - submit($name, $value, true, $title, $async); + submit($name, $value, true, $title, $async, $icon); echo " "; } -function submit_center_last($name, $value, $title=false, $async=false) +function submit_center_last($name, $value, $title=false, $async=false, $icon=false) { echo " "; - submit($name, $value, true, $title, $async); + submit($name, $value, true, $title, $async, $icon); echo "
"; } @@ -198,23 +225,49 @@ function submit_return($name, $value, $title=false, $async=false) submit($name, $value, true, $title, $async); } } -//--------------------------------------------------------------------------------- +//----------------------------------------------------------------------------------- -function button($name, $value, $onclick, $title=false) +function set_icon($icon, $title=false) { - default_focus($name); - echo "\n"; + global $path_to_root; + return "\n"; +} + +function button($name, $value, $title=false, $icon=false) +{ + // php silently changes dots,spaces,'[' and characters 128-159 + // to underscore in POST names, to maintain compatibility with register_globals + if (user_graphic_links() && $icon) + { + if ($value == _("Delete")) // Helper during implementation + $icon = ICON_DELETE; + return "