Added max parameter to textarea*() helpers, added constraints on all memo/comments...
[fa-stable.git] / includes / ui / ui_input.inc
index 448bd8f408eb264a1cbfdb60829a8e8451efdaca..0b59aaaac15cce9fefa937f56d37de597de0cc0a 100644 (file)
@@ -159,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;
                        }
                }
@@ -304,7 +305,7 @@ function button($name, $value, $title=false, $icon=false,  $aspect='')
                if ($value == _("Delete")) // Helper during implementation
                        $icon = ICON_DELETE;
                return "<button type='submit' class='editbutton' name='"
-                       .htmlentities(strtr($name, array('.'=>'=2E', '='=>'=3D',// ' '=>'=20','['=>'=5B'
+                       .html_specials_encode(strtr($name, array('.'=>'=2E', '='=>'=3D',// ' '=>'=20','['=>'=5B'
                        )))
                        ."' value='1'" . ($title ? " title='$title'":" title='$value'")
                        . ($aspect ? " aspect='$aspect'" : '')
@@ -347,7 +348,13 @@ function select_button_cell($name, $value, $title=false)
 
 function check_value($name)
 {
-    return (empty($_POST[$name]) ? 0 : 1);
+       if (is_array($name)) {
+               $ret = array();
+               foreach($name as $key)
+                       $ret[$key] = check_value($key);
+               return $ret;
+       } else
+               return (empty($_POST[$name]) ? 0 : 1);
 }
 
 function checkbox($label, $name, $value=null, $submit_on_change=false, $title=false)
@@ -757,7 +764,7 @@ function ref_cells($label, $name, $title=null, $init=null, $params=null, $submit
 
                label_cell($list."<input name='".$name."' "
                        .(check_edit_access($name) ? '' : 'disabled ')
-                       ."value='".@$_POST[$name]."' size=10 maxlength=35>");
+                       ."value='".@$_POST[$name]."' size=16 maxlength=35>");
        }
        else // just wildcard ref field (e.g. for global inquires)
        {
@@ -904,7 +911,7 @@ function small_qty_cells($label, $name, $init=null, $params=null, $post_label=nu
 
 //-----------------------------------------------------------------------------------
 
-function textarea_cells($label, $name, $value, $cols, $rows, $title = null, $params="")
+function textarea_cells($label, $name, $value, $cols, $rows, $max=255, $title = null, $params="")
 {
        global $Ajax;
 
@@ -915,14 +922,15 @@ function textarea_cells($label, $name, $value, $cols, $rows, $title = null, $par
                $value = (!isset($_POST[$name]) ? "" : $_POST[$name]);
        echo "<td><textarea name='$name' cols='$cols' rows='$rows'"
        .($title ? " title='$title'" : '')
+       .($max ? " maxlength=$max" : '')
        .">$value</textarea></td>\n";
        $Ajax->addUpdate($name, $name, $value);
 }
 
-function textarea_row($label, $name, $value, $cols, $rows, $title=null, $params="")
+function textarea_row($label, $name, $value, $cols, $rows, $max=255, $title=null, $params="")
 {
        echo "<tr><td class='label'>$label</td>";
-       textarea_cells(null, $name, $value, $cols, $rows, $title, $params);
+       textarea_cells(null, $name, $value, $cols, $rows, $max, $title, $params);
        echo "</tr>\n";
 }