X-Git-Url: https://delta.frontaccounting.com/gitweb/?a=blobdiff_plain;f=includes%2Fui%2Fui_input.inc;h=f5a127c0ecb7746401a57e16916f55be03f86cb2;hb=86e4d1627183fb4d97fe145a5dd33b43b03284ee;hp=f1fb3691c1d6d45914a4b602ac49e6e0f0001e99;hpb=c09be0dad6b05131e240349a375af7a4b7bf3444;p=fa-stable.git diff --git a/includes/ui/ui_input.inc b/includes/ui/ui_input.inc index f1fb3691..f5a127c0 100644 --- a/includes/ui/ui_input.inc +++ b/includes/ui/ui_input.inc @@ -1,4 +1,14 @@ . +***********************************************************************/ function get_post($name, $dflt='') { @@ -71,7 +81,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 +103,52 @@ 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) +/* + Various types of submit button selected by $type: + null - button visible only in fallback mode + false - normal submit button + true - ajax driven submit + 'process' - ajax button with long timeout +*/ +function submit($name, $value, $echo=true, $title=false, $type=false, $icon=false) { + global $path_to_root; default_focus($name); - $submit_str = "\n"; + .">$value" + .($icon ? "" : '') + ."\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 "
"; } @@ -191,23 +202,61 @@ function submit_row($name, $value, $right=true, $extra="", $title=false, $async= submit_cells($name, $value, $extra, $title, $async); echo "\n"; } -//--------------------------------------------------------------------------------- -function button($name, $value, $onclick, $title=false) +function submit_return($name, $value, $title=false, $async=false) { - default_focus($name); - echo "\n"; + if (count($_SESSION['Context'])) { + submit($name, $value, true, $title, $async); + } +} + +function submit_js_confirm($name, $msg) { + add_js_source( + "_validate.$name=function(){ return confirm('$msg');};"); +}; +//----------------------------------------------------------------------------------- + +function set_icon($icon, $title=false) +{ + global $path_to_root; + return "\n"; } -function button_cell($name, $value, $onclick, $title=false) +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 "