Fixed Bug in includes\ui\ui_input.inc
[fa-stable.git] / includes / ui / ui_input.inc
index f5f87cff9b336c392cdad88c5986af077fb4ab9d..448bd8f408eb264a1cbfdb60829a8e8451efdaca 100644 (file)
@@ -287,7 +287,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 "<img src='$icon' width='12' height='12' border='0'".($title ? " title='$title'" : "")." >\n";   
+       return "<img src='$icon' style='vertical-align:middle;width:12px;height:12px;border:0;'".($title ? " title='$title'" : "")." >\n";      
 }
 
 function button($name, $value, $title=false, $icon=false,  $aspect='')
@@ -347,9 +347,7 @@ function select_button_cell($name, $value, $title=false)
 
 function check_value($name)
 {
-       if (!isset($_POST[$name]) || $_POST[$name]=='')
-               return 0;
-       return 1;
+    return (empty($_POST[$name]) ? 0 : 1);
 }
 
 function checkbox($label, $name, $value=null, $submit_on_change=false, $title=false)
@@ -728,7 +726,7 @@ function ref_cells($label, $name, $title=null, $init=null, $params=null, $submit
                if (empty($_POST[$name.'_list'])) // restore refline id
                        $_POST[$name.'_list'] = $Refs->reflines->find_refline_id(empty($_POST[$name]) ? $init : $_POST[$name], $type);
 
-               if (empty($_POST[$name]) || ($_SERVER['REQUEST_METHOD'] == 'GET')) // initialization
+               if (empty($_POST[$name])) // initialization
                {
                        if (isset($init))
                        {
@@ -740,7 +738,7 @@ function ref_cells($label, $name, $title=null, $init=null, $params=null, $submit
                }
 
                if (check_ui_refresh($name)) { // call context changed
-                       $_POST[$name] = $Refs->normalize($init, $type, $context, $_POST[$name.'_list']);
+                       $_POST[$name] = $Refs->normalize($_POST[$name], $type, $context, $_POST[$name.'_list']);
                        $Ajax->addUpdate(true, $name, $_POST[$name]);
                }
 
@@ -1012,3 +1010,12 @@ function bank_balance_row($bank_acc, $parms='')
                ."</a>", $parms);
 }
 
+function ahref($label, $href, $target="", $onclick="") {
+  echo "<a href='$href' target='$target' onclick='$onclick'>$label</a>";
+}
+
+function ahref_cell($label, $href, $target="", $onclick="") {
+  echo "<td align='center'>&nbsp;&nbsp;";
+  ahref($label, $href, $target, $onclick);
+  echo "&nbsp;&nbsp;</td>";
+}