Merged changes form main trunk since 2.1RC
[fa-stable.git] / includes / ui / ui_input.inc
1 <?php
2 /**********************************************************************
3     Copyright (C) FrontAccounting, LLC.
4         Released under the terms of the GNU General Public License, GPL, 
5         as published by the Free Software Foundation, either version 3 
6         of the License, or (at your option) any later version.
7     This program is distributed in the hope that it will be useful,
8     but WITHOUT ANY WARRANTY; without even the implied warranty of
9     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  
10     See the License here <http://www.gnu.org/licenses/gpl-3.0.html>.
11 ***********************************************************************/
12 //
13 // Sets local POST value and adds Value to ajax posting if needed
14 //
15 /*function set_post($name, $value, $ajax_trigger=true) {
16     global $Ajax;
17
18     $_POST[$name] = $value;
19     if ($ajax_trigger) $Ajax->activate($name);
20 }
21 */
22 //------------------------------------------------------------------------------
23 //    Seek for _POST variable with $prefix.
24 //    If var is found returns variable name with prefix stripped,
25 //    and null or -1 otherwise.
26 //
27 function find_submit($prefix, $numeric=true)
28 {
29
30     foreach($_POST as $postkey=>$postval )
31     {
32                 if (strpos($postkey, $prefix) === 0)
33                 {
34                         $id = substr($postkey, strlen($prefix));
35                         return $numeric ? (int)$id : $id;
36                 }
37     }
38     return $numeric ? -1 : null;
39 }
40 //------------------------------------------------------------------------------
41 //
42 // Helper function for simple db table editor pages
43 //
44 function simple_page_mode($numeric_id = true)
45 {
46         global $Ajax, $Mode, $selected_id;
47
48         $default = $numeric_id ? -1 : '';
49         $selected_id = get_post('selected_id', $default);
50         foreach (array('ADD_ITEM', 'UPDATE_ITEM', 'RESET') as $m) {
51                 if (isset($_POST[$m])) {
52                         $Ajax->activate('_page_body');
53                         if ($m == 'RESET') 
54                                 $selected_id = $default;
55                         $Mode = $m; return;
56                 }
57         }
58         foreach (array('Edit', 'Delete') as $m) {
59                 foreach ($_POST as $p => $pvar) {
60                         if (strpos($p, $m) === 0) {
61 //                              $selected_id = strtr(substr($p, strlen($m)), array('%2E'=>'.'));
62                                 unset($_POST['_focus']); // focus on first form entry
63                                 $selected_id = quoted_printable_decode(substr($p, strlen($m)));
64                                 $Ajax->activate('_page_body');
65                                 $Mode = $m;
66                                 return;
67                         }
68                 }
69         }
70         $Mode = '';
71 }
72
73 //------------------------------------------------------------------------------
74 //
75 //      Read numeric value from user formatted input
76 //
77 function input_num($postname=null, $dflt=null)
78 {
79         if (!isset($_POST[$postname]) || $_POST[$postname] == "")
80                 return $dflt;
81
82     return user_numeric($_POST[$postname]);
83 }
84
85 //---------------------------------------------------------------------------------
86
87 function hidden($name, $value=null, $echo=true)
88 {
89         global $Ajax;
90         
91         if ($value === null) 
92                 $value = get_post($name);
93         
94         $ret = "<input type=\"hidden\" name=\"$name\" value=\"$value\">";
95         $Ajax->addUpdate($name, $name, $value);
96         if ($echo)
97                 echo $ret."\n";
98         else
99                 return $ret;
100 }
101 /*
102         Universal submit form button.
103         $atype - type of submit:
104          Normal submit:
105                 false - normal button; optional icon
106                 null  - button visible only in fallback mode; optional icon
107          Ajax submit:
108                 true      - standard button; optional icon
109                 'process' - displays progress bar during call; optional icon
110                 'default' - default form submit on Ctrl-Enter press; dflt ICON_OK icon
111                 'cancel'  - cancel form entry on Escape press; dflt ICON_CANCEL
112 */
113 function submit($name, $value, $echo=true, $title=false, $atype=false, $icon=false)
114 {
115         global $path_to_root;
116
117         $aspect='';
118         if (!is_bool($atype)) // necessary: switch uses '=='
119           switch($atype) {
120                 case 'process':
121                         $aspect = " aspect='process'"; break;
122                 case 'default':
123                         $aspect = " aspect='default'"; 
124                         if ($icon===false) $icon=ICON_SUBMIT; break;
125                 case 'cancel':
126                         $aspect = " aspect='cancel'"; 
127                         if ($icon===false) $icon=ICON_ESCAPE; break;
128                 case null: 
129                         $aspect = fallback_mode() ? 
130                                 " aspect='fallback'" : " style='display:none;'"; break;
131          }
132
133         default_focus($name);
134         $submit_str = "<button class=\""
135             .($atype ? 'ajaxsubmit' : 'inputsubmit')
136                 ."\" type=\"submit\""
137                 .$aspect
138             ." name=\"$name\"  id=\"$name\" value=\"$value\""
139             .($title ? " title='$title'" : '')
140             .">"
141                 .($icon ? "<img src='$path_to_root/themes/".user_theme()."/images/$icon'>" : '')
142                 ."<span>$value</span>"
143                 ."</button>\n";
144         if ($echo)
145                 echo $submit_str;
146         else
147                 return $submit_str;
148 }
149
150 function submit_center($name, $value, $echo=true, $title=false, $async=false, $icon=false)
151 {
152         echo "<center>";
153         submit($name, $value, $echo, $title, $async, $icon);
154         echo "</center>";
155 }
156
157 function submit_center_first($name, $value, $title=false, $async=false, $icon=false)
158 {
159         echo "<center>";
160         submit($name, $value, true, $title, $async, $icon);
161         echo "&nbsp;";
162 }
163
164 function submit_center_last($name, $value, $title=false, $async=false, $icon=false)
165 {
166         echo "&nbsp;";
167         submit($name, $value, true, $title, $async, $icon);
168         echo "</center>";
169 }
170 /*
171         For following controls:
172         'both' - use both Ctrl-Enter and Escape hotkeys 
173         'cancel' - apply to 'RESET' button
174 */
175 function submit_add_or_update($add=true, $title=false, $async=false)
176 {
177         $cancel = $async;
178
179         if ($async === 'both') {
180                 $async = 'default'; $cancel = 'cancel';
181         } 
182         else if ($async === 'default')
183                 $cancel = true;
184         else if ($async === 'cancel')
185                 $async = true;
186         
187         if ($add)
188                 submit('ADD_ITEM', _("Add new"), true, $title, $async);
189         else {
190                 submit('UPDATE_ITEM', _("Update"), true, $title, $async);
191                 submit('RESET', _("Cancel"), true, $title, $cancel);
192         }
193 }
194
195 function submit_add_or_update_center($add=true, $title=false, $async=false)
196 {
197         echo "<center>";
198         submit_add_or_update($add, $title, $async);
199         echo "</center>";
200 }
201
202 /*
203 function submit_add_or_update_row($add=true)
204 {
205         echo "<tr><td colspan=99 align=center>";
206         submit_add_or_update($add);
207         echo "</td></tr>\n";
208 }
209 */
210 function submit_add_or_update_row($add=true, $right=true, $extra="", $title=false, $async=false)
211 {
212         echo "<tr>";
213         if ($right)
214                 echo "<td>&nbsp;</td>\n";
215         echo "<td $extra>";
216         submit_add_or_update($add, $title, $async);
217         echo "</td></tr>\n";
218 }
219
220 function submit_cells($name, $value, $extra="", $title=false, $async=false)
221 {
222         echo "<td $extra>";
223         submit($name, $value, true, $title, $async);
224         echo "</td>\n";
225 }
226
227 function submit_row($name, $value, $right=true, $extra="", $title=false, $async=false)
228 {
229         echo "<tr>";
230         if ($right)
231                 echo "<td>&nbsp;</td>\n";
232         submit_cells($name, $value, $extra, $title, $async);
233         echo "</tr>\n";
234 }
235
236 function submit_return($name, $value, $title=false, $async=false)
237 {
238         if (count($_SESSION['Context'])) {
239                 submit($name, $value, true, $title, $async);
240         }
241 }
242 //-----------------------------------------------------------------------------------
243
244 function set_icon($icon, $title=false)
245 {
246         global $path_to_root;
247         return "<img src='$path_to_root/themes/".user_theme()."/images/$icon' width='14' height='14' border='0'".($title ? " title='$title'" : "")." />\n";     
248 }
249
250 function button($name, $value, $title=false, $icon=false)
251 {
252         // php silently changes dots,spaces,'[' and characters 128-159
253         // to underscore in POST names, to maintain compatibility with register_globals
254         if (user_graphic_links() && $icon)
255         {
256                 if ($value == _("Delete")) // Helper during implementation
257                         $icon = ICON_DELETE;
258                 return "<button type='submit' class='editbutton' name='".
259                         htmlentities(strtr($name, array('.'=>'=2E',' '=>'=20','='=>'=3D','['=>'=5B'))).
260                         "' value='1'" . ($title ? " title='$title'":" title='$value'")." />".set_icon($icon)."\n";
261         }
262         else
263                 return "<input type='submit' class='editbutton' name='"
264                         .htmlentities(strtr($name, array('.'=>'=2E',' '=>'=20','='=>'=3D','['=>'=5B')))
265                         ."' value='$value'"
266                         .($title ? " title='$title'":'')." />\n";
267 }
268
269 function button_cell($name, $value, $title=false, $icon=false)
270 {
271         echo "<td>";
272         echo button($name, $value, $title, $icon);
273         echo "</td>";
274 }
275
276 function delete_button_cell($name, $value, $title=false)
277 {
278         button_cell($name, $value, $title, ICON_DELETE);
279 }
280
281 function edit_button_cell($name, $value, $title=false)
282 {
283         button_cell($name, $value, $title, ICON_EDIT);
284 }
285 //-----------------------------------------------------------------------------------
286
287 function check_value($name)
288 {
289         if (!isset($_POST[$name]))
290                 return 0;
291         return 1;
292 }
293
294 function checkbox($label, $name, $value=null, $submit_on_change=false, $title=false)
295 {
296         global $Ajax;
297
298         $str = '';      
299         default_focus($name);
300         if ($label)
301                 $str .= $label . "  ";
302         if ($submit_on_change !== false) {
303                 if ($submit_on_change === true)
304                         $submit_on_change = 
305                                 "JsHttpRequest.request(\"_{$name}_update\", this.form);";
306         }
307         if ($value === null)
308                 $value = get_post($name,0);
309
310         $str .= "<input"
311             .($value == 1 ? ' checked':'')
312             ." type='checkbox' name='$name' value='1'"
313             .($submit_on_change ? " onclick='$submit_on_change'" : '')
314             .($title ? " title='$title'" : '')
315             ." >\n";
316
317         $Ajax->addUpdate($name, $name, $value);
318         return $str;
319 }
320
321 function check($label, $name, $value=null, $submit_on_change=false, $title=false)
322 {
323         echo checkbox($label, $name, $value, $submit_on_change, $title);
324 }
325
326 function check_cells($label, $name, $value, $submit_on_change=false, $title=false)
327 {
328         if ($label != null)
329                 echo "<td>$label</td>\n";
330         echo "<td>";
331         echo check(null, $name, $value, $submit_on_change, $title);
332         echo "</td>";
333 }
334
335 function check_row($label, $name, $value, $submit_on_change=false, $title=false)
336 {
337         echo "<tr>";
338         echo check_cells($label, $name, $value, $submit_on_change, $title);
339         echo "</tr>\n";
340 }
341
342 //-----------------------------------------------------------------------------------
343
344 function labelheader_cell($label, $params="")
345 {
346         echo "<td class='tableheader' $params>$label</td>\n";
347 }
348
349 function label_cell($label, $params="", $id=null)
350 {
351     global $Ajax;
352
353         if(isset($id))
354         {
355             $params .= " id='$id'";
356             $Ajax->addUpdate($id, $id, $label);
357         }
358         echo "<td $params>$label</td>\n";
359
360         return $label;
361 }
362
363 function email_cell($label, $params="", $id=null)
364 {
365         label_cell("<a href='mailto:$label'>$label</a>", $params, $id);
366 }
367
368 function amount_cell($label, $bold=false, $params="", $id=null)
369 {
370         if ($bold)
371                 label_cell("<b>".price_format($label)."</b>", "nowrap align=right ".$params, $id);
372         else
373                 label_cell(price_format($label), "nowrap align=right ".$params, $id);
374 }
375
376 function percent_cell($label, $bold=false, $id=null)
377 {
378         if ($bold)
379                 label_cell("<b>".percent_format($label)."</b>", "nowrap align=right", $id);
380         else
381                 label_cell(percent_format($label), "nowrap align=right", $id);
382 }
383 // 2008-06-15. Changed
384 function qty_cell($label, $bold=false, $dec=null, $id=null)
385 {
386         if (!isset($dec))
387                 $dec = get_qty_dec();
388         if ($bold)
389                 label_cell("<b>".number_format2($label, $dec)."</b>", "nowrap align=right", $id);
390         else
391                 label_cell(number_format2($label, $dec), "nowrap align=right", $id);
392 }
393
394 function label_cells($label, $value, $params="", $params2="", $id='')
395 {
396         if ($label != null)
397                 echo "<td $params>$label</td>\n";
398         label_cell($value, $params2, $id);
399 }
400
401 function label_row($label, $value, $params="", $params2="", $leftfill=0, $id='')
402 {
403         echo "<tr>";
404         label_cells($label, $value, $params, $params2, $id);
405         if ($leftfill!=0)
406                 echo "<td colspan=$leftfill></td>";
407         echo "</tr>\n";
408 }
409
410 //-----------------------------------------------------------------------------------
411
412 function text_cells($label, $name, $value=null, $size="", $max="", $title=false, 
413         $labparams="", $post_label="", $inparams="")
414 {
415         global $Ajax;
416
417         default_focus($name);
418         if ($label != null)
419                 label_cell($label, $labparams);
420         echo "<td>";
421
422         if ($value === null)
423                 $value = get_post($name);
424         echo "<input $inparams type=\"text\" name=\"$name\" size=\"$size\" maxlength=\"$max\" value=\"$value\""
425             .($title ? " title='$title'" : '')
426             .">";
427
428         if ($post_label != "")
429                 echo " " . $post_label;
430
431         echo "</td>\n";
432         $Ajax->addUpdate($name, $name, $value);
433 }
434
435 function text_cells_ex($label, $name, $size, $max=null, $init=null, $title=null,
436         $labparams=null, $post_label=null, $submit_on_change=false)
437 {
438         global $Ajax;
439
440         default_focus($name);
441         if (!isset($_POST[$name]) || $_POST[$name] == "")
442         {
443                 if ($init)
444                         $_POST[$name] = $init;
445                 else
446                         $_POST[$name] = "";
447         }
448         if ($label != null)
449                 label_cell($label, $labparams);
450
451         if (!isset($max))
452                 $max = $size;
453
454         echo "<td>";
455         $class = $submit_on_change ? 'class="searchbox"' : '';
456         echo "<input $class type=\"text\" name=\"$name\" size=\"$size\" maxlength=\"$max\" value=\"" . $_POST[$name]. "\""
457          .($title ? " title='$title'": '')." >";
458
459         if ($post_label)
460                 echo " " . $post_label;
461
462         echo "</td>\n";
463         $Ajax->addUpdate($name, $name, $_POST[$name]);
464 }
465
466 function text_row($label, $name, $value, $size, $max, $title=null, $params="", $post_label="")
467 {
468         echo "<tr>";
469
470         text_cells($label, $name, $value, $size, $max, $title, $params, $post_label);
471
472         echo "</tr>\n";
473 }
474
475 //-----------------------------------------------------------------------------------
476
477 function text_row_ex($label, $name, $size, $max=null, $title=null, $value=null, $params=null, $post_label=null)
478 {
479         echo "<tr>";
480
481         text_cells_ex($label, $name, $size, $max, $value, $title, $params, $post_label);
482
483         echo "</tr>\n";
484 }
485
486 //-----------------------------------------------------------------------------------
487 function email_row($label, $name, $value, $size, $max, $title=null, $params="", $post_label="")
488 {
489         if (get_post($name)) 
490                 $label = "<a href='Mailto:".$_POST[$name]."'>$label</a>";
491         text_row($label, $name, $value, $size, $max, $title, $params, $post_label);
492 }
493
494 function email_row_ex($label, $name, $size, $max=null, $title=null, $value=null, $params=null, $post_label=null)
495 {
496         if (get_post($name)) 
497                 $label = "<a href='Mailto:".$_POST[$name]."'>$label</a>";
498         text_row_ex($label, $name, $size, $max, $title, $value, $params, $post_label);
499 }
500
501 function link_row($label, $name, $value, $size, $max, $title=null, $params="", $post_label="")
502 {
503         $val = get_post($name);
504         if ($val) {
505                 if (strpos($val,'http://')===false)
506                         $val = 'http://'.$val;
507                 $label = "<a href='$val' target='_blank'>$label</a>";
508         }
509         text_row($label, $name, $value, $size, $max, $title, $params, $post_label);
510 }
511
512 function link_row_ex($label, $name, $size, $max=null, $title=null, $value=null, $params=null, $post_label=null)
513 {
514         $val = get_post($name);
515         if ($val) {
516                 if (strpos($val,'http://')===false)
517                         $val = 'http://'.$val;
518                 $label = "<a href='$val' target='_blank'>$label</a>";
519         }
520         text_row_ex($label, $name, $size, $max, $title, $value, $params, $post_label);
521 }
522
523 //-----------------------------------------------------------------------------------
524 //
525 //      Since FA 2.2  $init parameter is superseded by $check. 
526 //  When $check!=null current date is displayed in red when set to other 
527 //      than current date.
528 //      
529 function date_cells($label, $name, $title = null, $check=null, $inc_days=0, 
530         $inc_months=0, $inc_years=0, $params=null, $submit_on_change=false)
531 {
532         global $use_date_picker, $path_to_root, $Ajax;
533
534         if (!isset($_POST[$name]) || $_POST[$name] == "")
535         {
536                 if ($inc_years == 1001)
537                         $_POST[$name] = null;
538                 else
539                 {
540                         $dd = Today();
541                         if ($inc_days != 0)
542                                 $dd = add_days($dd, $inc_days);
543                         if ($inc_months != 0)
544                                 $dd = add_months($dd, $inc_months);
545                         if ($inc_years != 0)
546                                 $dd = add_years($dd, $inc_years);
547                         $_POST[$name] = $dd;
548                 }
549         }
550         if ($use_date_picker)
551                 $post_label = "<a tabindex='-1' href=\"javascript:date_picker(document.getElementsByName('$name')[0]);\">"
552                 . "     <img src='$path_to_root/themes/default/images/cal.gif' width='16' height='16' border='0' alt='"._('Click Here to Pick up the date')."'></a>\n";
553         else
554                 $post_label = "";
555
556         if ($label != null)
557                 label_cell($label, $params);
558
559         echo "<td>";
560         
561         $class = $submit_on_change ? 'class="searchbox"' : '';
562
563         $aspect = $check ? 'aspect="cdate"' : '';
564         if ($check && (get_post($name) != Today()))
565                 $aspect .= ' style="color:#FF0000"';
566
567         echo "<input type=\"text\" name=\"$name\" $class $aspect size=\"9\" maxlength=\"12\" value=\"" 
568          . $_POST[$name]. "\""
569          .($title ? " title='$title'": '')." > $post_label";
570         echo "</td>\n";
571         $Ajax->addUpdate($name, $name, $_POST[$name]);
572 }
573
574 function date_row($label, $name, $title=null, $check=null, $inc_days=0, $inc_months=0, 
575         $inc_years=0, $params=null, $submit_on_change=false)
576 {
577         echo "<tr>";
578         date_cells($label, $name, $title, $check, $inc_days, $inc_months, 
579                 $inc_years, $params, $submit_on_change);
580         echo "</tr>\n";
581 }
582
583 //-----------------------------------------------------------------------------------
584
585 function ref_cells($label, $name, $title=null, $init=null, $params=null, $submit_on_change=false)
586 {
587         text_cells_ex($label, $name, 16, 18, $init, $title, $params, null, $submit_on_change);
588 }
589
590 //-----------------------------------------------------------------------------------
591
592 function ref_row($label, $name, $title=null, $init=null, $submit_on_change=false)
593 {
594         echo "<tr>";
595         ref_cells($label, $name, $title, $init, null, $submit_on_change);
596         echo "</tr>\n";
597 }
598
599 //-----------------------------------------------------------------------------------
600
601 function percent_row($label, $name, $init=null)
602 {
603
604         if (!isset($_POST[$name]) || $_POST[$name]=="")
605         {
606                 $_POST[$name] = $init == null ? '' : $init;
607         }
608
609         small_amount_row($label, $name, $_POST[$name], null, "%", user_percent_dec());
610 }
611
612 function amount_cells_ex($label, $name, $size, $max=null, $init=null, $params=null, $post_label=null, $dec=null)
613 {
614         global $Ajax;
615
616         if (!isset($dec))
617                 $dec = user_price_dec();
618         if (!isset($_POST[$name]) || $_POST[$name] == "")
619         {
620                 if ($init !== null)
621                         $_POST[$name] = $init;
622                 else
623                         $_POST[$name] = '';
624         }
625         if ($label != null)
626                 label_cell($label, $params);
627
628         if (!isset($max))
629                 $max = $size;
630
631         if ($label != null)
632                 echo "<td>";
633         else
634                 echo "<td align='right'>";
635
636         echo "<input class='amount' type=\"text\" name=\"$name\" size=\"$size\" maxlength=\"$max\" dec=\"$dec\" value=\"" . $_POST[$name]. "\">";
637
638         if ($post_label) {
639                 echo "<span id='_{$name}_label'> $post_label</span>";
640                 $Ajax->addUpdate($name, '_'.$name.'_label', $post_label);
641         }
642         echo "</td>\n";
643         $Ajax->addUpdate($name, $name, $_POST[$name]);
644         $Ajax->addAssign($name, $name, 'dec', $dec);
645 }
646
647
648 //-----------------------------------------------------------------------------------
649
650 function amount_cells($label, $name, $init=null, $params=null, $post_label=null, $dec=null)
651 {
652         amount_cells_ex($label, $name, 15, 15, $init, $params, $post_label, $dec);
653 }
654
655 function amount_row($label, $name, $init=null, $params=null, $post_label=null, $dec=null)
656 {
657         echo "<tr>";
658         amount_cells($label, $name, $init, $params, $post_label, $dec);
659         echo "</tr>\n";
660 }
661
662 function small_amount_row($label, $name, $init=null, $params=null, $post_label=null, $dec=null)
663 {
664         echo "<tr>";
665         small_amount_cells($label, $name, $init, $params, $post_label, $dec);
666         echo "</tr>\n";
667 }
668
669 //-----------------------------------------------------------------------------------
670
671 function qty_cells($label, $name, $init=null, $params=null, $post_label=null, $dec=null)
672 {
673         if (!isset($dec))
674                 $dec = user_qty_dec();
675
676         amount_cells_ex($label, $name, 15, 15, $init, $params, $post_label, $dec);
677 }
678
679 function qty_row($label, $name, $init=null, $params=null, $post_label=null, $dec=null)
680 {
681         if (!isset($dec))
682                 $dec = user_qty_dec();
683
684         echo "<tr>";
685         amount_cells($label, $name, $init, $params, $post_label, $dec);
686         echo "</tr>\n";
687 }
688
689 function small_qty_row($label, $name, $init=null, $params=null, $post_label=null, $dec=null)
690 {
691         if (!isset($dec))
692                 $dec = user_qty_dec();
693
694         echo "<tr>";
695         small_amount_cells($label, $name, $init, $params, $post_label, $dec);
696         echo "</tr>\n";
697 }
698
699 //-----------------------------------------------------------------------------------
700
701 function small_amount_cells($label, $name, $init=null, $params=null, $post_label=null, $dec=null)
702 {
703         amount_cells_ex($label, $name, 7, 12, $init, $params, $post_label, $dec);
704 }
705
706 //-----------------------------------------------------------------------------------
707
708 function small_qty_cells($label, $name, $init=null, $params=null, $post_label=null, $dec=null)
709 {
710         if (!isset($dec))
711                 $dec = user_qty_dec();
712         amount_cells_ex($label, $name, 7, 12, $init, $params, $post_label, $dec);
713 }
714
715 //-----------------------------------------------------------------------------------
716
717 function textarea_cells($label, $name, $value, $cols, $rows, $title = null, $params="")
718 {
719         global $Ajax;
720
721         default_focus($name);
722         if ($label != null)
723                 echo "<td $params>$label</td>\n";
724         if ($value == null)
725                 $value = (!isset($_POST[$name]) ? "" : $_POST[$name]);
726         echo "<td><textarea name='$name' cols='$cols' rows='$rows'"
727         .($title ? " title='$title'" : '')
728         .">$value</textarea></td>\n";
729         $Ajax->addUpdate($name, $name, $value);
730 }
731
732 function textarea_row($label, $name, $value, $cols, $rows, $title=null, $params="")
733 {
734         echo "<tr>";
735         textarea_cells($label, $name, $value, $cols, $rows, $title, $params);
736         echo "</tr>\n";
737 }
738
739 //-----------------------------------------------------------------------------------
740 /*
741 function text_row_with_submit($label, $name, $value, $size, $max, $input_name, $input_value)
742 {
743         global $Ajax;
744
745         default_focus($name);
746         echo "<tr><td>$label</td>\n";
747         echo "<td>";
748
749         if ($value == null)
750                 $value = (!isset($_POST[$name]) ? "" : $_POST[$name]);
751         echo "<input type=\"text\" name=\"$name\" size=\"$size\" maxlength=\"$max\" value=\"$value\">   ";
752
753         submit($input_name, $input_value);
754
755         echo "</td></tr>\n";
756         $Ajax->addUpdate($name, $name, $value);
757 }
758 */
759 //-----------------------------------------------------------------------------------
760
761
762 ?>