Inserted Copyright Notice and fixed graphic items
[fa-stable.git] / includes / ui / ui_input.inc
index 230dd495b325439db6a65c82a1372d6c2cb50230..59064f82de031820d3c698b0995031687840cfad 100644 (file)
@@ -1,4 +1,14 @@
 <?php
+/**********************************************************************
+    Copyright (C) FrontAccounting, LLC.
+       Released under the terms of the GNU Affero General Public License,
+       AGPL, as published by the Free Software Foundation, either version 
+       3 of the License, or (at your option) any later version.
+    This program is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  
+    See the License here <http://www.gnu.org/licenses/agpl-3.0.html>.
+***********************************************************************/
 
 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]);
@@ -101,13 +111,13 @@ function submit($name, $value, $echo=true, $title=false, $async=false, $icon=fal
        default_focus($name);
        $submit_str = "<button class=\""
            .($async ? 'ajaxsubmit' : 'inputsubmit')
-               ."\""
-               .($async === null ? (in_ajax() ? " style='display:none;'" : ' aspect="fallback"' ): 
+               ."\" type=\"submit\""
+               .($async === null ? (fallback_mode() ? ' aspect="fallback"' : " style='display:none;'" ): 
                        ($async === 'process' ? 'aspect="process"' : '') )
            ." name=\"$name\"  id=\"$name\" value=\"$value\""
            .($title ? " title='$title'" : '')
            ."><span>$value</span>"
-               .($icon ? "<img src='$path_to_root/themes/default/images/$icon'>" : '')
+               .($icon ? "<img src='$path_to_root/themes/".user_theme()."/images/$icon'>" : '')
                ."</button>\n";
        if ($echo)
                echo $submit_str;
@@ -194,7 +204,7 @@ function submit_return($name, $value, $title=false, $async=false)
        }
 }
 //---------------------------------------------------------------------------------
-
+/*
 function button($name, $value, $onclick, $title=false)
 {
        default_focus($name);
@@ -209,7 +219,7 @@ function button_cell($name, $value, $onclick, $title=false)
        button($name, $value, $onclick, $title);
        echo "</td>\n";
 }
-
+*/
 //-----------------------------------------------------------------------------------
 
 function check_value($name)
@@ -294,7 +304,7 @@ function percent_cell($label, $bold=false, $id=null)
 // 2008-06-15. Changed
 function qty_cell($label, $bold=false, $dec=null, $id=null)
 {
-       if ($dec == null)
+       if (!isset($dec))
                $dec = get_qty_dec();
        if ($bold)
                label_cell("<b>".number_format2($label, $dec)."</b>", "nowrap align=right", $id);
@@ -488,9 +498,10 @@ function amount_cells_ex($label, $name, $size, $max=null, $init=null, $params=nu
 
        echo "<input class='amount' type=\"text\" name=\"$name\" size=\"$size\" maxlength=\"$max\" dec=\"$dec\" value=\"" . $_POST[$name]. "\">";
 
-       if ($post_label)
-               echo " " . $post_label;
-
+       if ($post_label) {
+               echo "<span id='_{$name}_label'> $post_label</span>";
+               $Ajax->addUpdate($name, '_'.$name.'_label', $post_label);
+       }
        echo "</td>\n";
        $Ajax->addUpdate($name, $name, $_POST[$name]);
        $Ajax->addAssign($name, $name, 'dec', $dec);