quick payment tool improvements, RT10698
[freeside.git] / httemplate / elements / customer-table.html
1 <%doc>
2
3 Example:
4
5   include( '/elements/customer-table.html',
6
7              ###
8              # required
9              ###
10
11              #listrefs...
12              'header'        => [ '#', 'Item' ],
13              'fields'        => [
14                                   'column',
15                                   sub { my ($row,$param) = @_;
16                                         $param->{"column$row"};
17                                       },
18                                 ],
19
20              ###
21              # optional
22              ###
23
24              'name_singular' => 'customer', #label
25              'custnum_update_callback' => 'name_of_js_callback' #passed a rownum
26
27              #listrefs
28              'types'         => ['immutable', ''], # immutable or ''/text
29              'align'         => [ 'c', 'l', 'r', '' ],
30              'size'          => [],                # sizes ignored for immutable
31              'color'         => [],
32              'footer'        => ['string', '_TOTAL'], # strings or the special
33                                                       #value _TOTAL
34              'footer_align'  => [ 'c', 'l', 'r', '' ],
35
36              'param'         => { column0 => 1 },  # preset column of row 0 to 1
37
38          )
39
40 </%doc>
41
42 <SCRIPT TYPE="text/javascript">
43
44   function clearhint_invnum() {
45
46     if ( this.value == 'Not found' || this.value == 'Multiple' ) {
47       this.value = '';
48       this.style.color = '#000000';
49     }
50
51   }
52
53   function clearhint_custnum() {
54
55     if ( this.value == 'Not found' || this.value == 'Multiple' ) {
56       this.value = '';
57       this.style.color = '#000000';
58     }
59
60   }
61
62   function clearhint_customer() {
63
64     this.style.color = '#000000';
65
66     if ( this.value == '(last name or company)' || this.value == 'Not found' )
67       this.value = '';
68
69   }
70   
71   function <% $opt{prefix} %>search_invnum() {
72
73     this.style.color = '#000000'
74
75     var invnum_obj = this;
76     var searchrow = this.getAttribute('rownum');
77     var invnum = this.value;
78
79     if ( invnum == 'searching...' || invnum == 'Not found' || invnum == '' )
80       return;
81
82     if ( this.getAttribute('magic') == 'nosearch' ) {
83       this.setAttribute('magic', '');
84       return;
85     }
86
87     if ( ( <% $opt{prefix} %>rownum - searchrow ) == 1 ) {
88       <% $opt{prefix} %>addRow();
89     }
90     var customer = document.getElementById('customer'+searchrow);
91     customer.value = 'searching...';
92     customer.disabled = true;
93     customer.style.color = '#000000';
94     customer.style.backgroundColor = '#dddddd';
95
96     var customer_select = document.getElementById('cust_select'+searchrow);
97
98     customer.style.display = '';
99     customer_select.style.display = 'none';
100     
101     var custnum_obj = document.getElementById('custnum'+searchrow);
102     var balance = document.getElementById('balance'+searchrow);
103     balance.value = '';
104
105     function search_invnum_update(customers) {
106       
107       var customerArray = eval('(' + customers + ')');
108
109       custnum_obj.disabled = false;
110       custnum_obj.style.backgroundColor = '#ffffff';
111       customer.disabled = false;
112       customer.style.backgroundColor = '#ffffff';
113
114       if ( customerArray.length == 0 ) {
115
116         custnum_obj.value = 'Not found';
117         customer.value = 'Not found';
118         custnum_obj.style.color = '#ff0000';
119         customer.style.color = '#ff0000';
120
121         customer.style.display = '';
122         customer_select.style.display = 'none';
123
124       } else if ( customerArray.length == 3 ) {
125
126         custnum_obj.value = customerArray[0];
127         custnum_obj.style.color = '#000000';
128         customer.value = customerArray[1];
129         balance.value = customerArray[2];
130
131         customer.style.display = '';
132         customer_select.style.display = 'none';
133
134 % if ( $opt{invnum_update_callback} ) {
135         <% $opt{invnum_update_callback} %>(searchrow, '<% $opt{prefix} %>')
136 % }
137
138       }
139
140     }
141
142     invnum_search( invnum, search_invnum_update );
143
144   }
145
146
147   function <% $opt{prefix} %>search_custnum() {
148
149     this.style.color = '#000000'
150
151     var custnum_obj = this;
152     var searchrow = this.getAttribute('rownum');
153     var custnum = this.value;
154
155     if ( custnum == 'searching...' || custnum == 'Not found' || custnum == '' )
156       return;
157
158     if ( this.getAttribute('magic') == 'nosearch' ) {
159       this.setAttribute('magic', '');
160       return;
161     }
162
163     if ( ( <% $opt{prefix} %>rownum - searchrow ) == 1 ) {
164       <% $opt{prefix} %>addRow();
165     }
166     var customer = document.getElementById('customer'+searchrow);
167     customer.value = 'searching...';
168     customer.disabled = true;
169     customer.style.color = '#000000';
170     customer.style.backgroundColor = '#dddddd';
171
172     var customer_select = document.getElementById('cust_select'+searchrow);
173
174     customer.style.display = '';
175     customer_select.style.display = 'none';
176
177     var invnum = document.getElementById('invnum'+searchrow);
178     invnum.value = '';
179     
180     var balance = document.getElementById('balance'+searchrow);
181     balance.value = '';
182
183     function search_custnum_update(customers) {
184
185       var customerArray = eval('(' + customers + ')');
186
187       customer.disabled = false;
188       customer.style.backgroundColor = '#ffffff';
189       
190       if ( customerArray.length == 0 ) {
191
192         customer.value = 'Not found';
193         customer.style.color = '#ff0000';
194         custnum_obj.style.color = '#ff0000';
195
196       } else if ( customerArray.length == 3 ) {
197
198         custnum_obj.value = customerArray[0];
199         custnum_obj.style.color = '#000000';
200         customer.value = customerArray[1];
201         balance.value = customerArray[2];
202
203         customer.style.display = '';
204         customer_select.style.display = 'none';
205
206 % if ( $opt{custnum_update_callback} ) {
207         <% $opt{custnum_update_callback} %>(searchrow, '<% $opt{prefix} %>')
208 % }
209       }
210     }
211
212     custnum_search(custnum, search_custnum_update );
213
214   }
215
216   function <% $opt{prefix} %>search_customer() {
217
218     var customer_obj = this;
219     var searchrow = this.getAttribute('rownum');
220     var customer = this.value;
221
222     if ( customer == 'searching...' || customer == 'Not found' || customer == '' )
223       return;
224
225     if ( this.getAttribute('magic') == 'nosearch' ) {
226       this.setAttribute('magic', '');
227       return;
228     }
229
230     if ( ( <% $opt{prefix} %>rownum - searchrow ) == 1 ) {
231       <% $opt{prefix} %>addRow();
232     }
233     
234     var invnum = document.getElementById('invnum'+searchrow);
235     invnum.value = '';
236
237     var custnum_obj = document.getElementById('custnum'+searchrow);
238     custnum_obj.value = 'searching...';
239     custnum_obj.disabled = true;
240     custnum_obj.style.color = '#000000';
241     custnum_obj.style.backgroundColor = '#dddddd';
242
243     var customer_select = document.getElementById('cust_select'+searchrow);
244     
245     var balance = document.getElementById('balance'+searchrow);
246     balance.value = '';
247
248     function search_customer_update(customers) {
249
250       var customerArray = eval('(' + customers + ')');
251
252       custnum_obj.disabled = false;
253       custnum_obj.style.backgroundColor = '#ffffff';
254
255       if ( customerArray.length == 0 ) {
256
257         custnum_obj.value = 'Not found';
258         custnum_obj.style.color = '#ff0000';
259         customer_obj.style.color = '#ff0000';
260
261         customer_obj.style.display = '';
262         customer_select.style.display = 'none';
263
264       } else if ( customerArray.length == 1 ) {
265
266         custnum_obj.value = customerArray[0][0];
267         customer_obj.value = customerArray[0][1];
268         balance.value = customerArray[0][2];
269
270         customer_obj.style.display = '';
271         customer_select.style.display = 'none';
272
273 % if ( $opt{custnum_update_callback} ) {
274         <% $opt{custnum_update_callback} %>(searchrow, '<% $opt{prefix} %>')
275 % }
276
277       } else {
278
279         custnum_obj.value = 'Multiple'; // or something
280         custnum_obj.style.color = '#ff0000';
281
282         //blank the current list
283         for ( var i = customer_select.length; i >= 0; i-- )
284           customer_select.options[i] = null;
285
286         opt(customer_select, '', 'Multiple customers match "' + customer + '" - select one', '#ff0000');
287
288         //add the multiple customers
289         for ( var s = 0; s < customerArray.length; s++ )
290           opt(customer_select, customerArray[s][0] + '_' + customerArray[s][2], customerArray[s][1], '#000000');
291
292         opt(customer_select, 'cancel', '(Edit search string)', '#000000');
293
294         customer_obj.style.display = 'none';
295
296         customer_select.style.display = '';
297
298       }
299
300     }
301
302     smart_search( customer, search_customer_update );
303
304   }
305
306   function select_customer() {
307
308     var custnum_balance = this.options[this.selectedIndex].value;
309     var customer = this.options[this.selectedIndex].text;
310
311     var searchrow = this.getAttribute('rownum');
312     var custnum_obj = document.getElementById('custnum'+searchrow);
313     var customer_obj = document.getElementById('customer'+searchrow);
314     var balance_obj = document.getElementById('balance'+searchrow);
315
316     if ( custnum_balance == '' ) {
317
318     } else if ( custnum_balance == 'cancel' ) {
319
320       custnum_obj.value = '';
321       custnum_obj.style.color = '#000000';
322
323       this.style.display = 'none';
324       customer_obj.style.display = '';
325       customer_obj.focus();
326
327     } else {
328     
329       var custnum = custnum_balance.substring(0,custnum_balance.indexOf('_'));
330       var balance = custnum_balance.substring(custnum_balance.indexOf('_')+1);
331
332       custnum_obj.value = custnum;
333       custnum_obj.style.color = '#000000';
334
335       customer_obj.value = customer;
336       customer_obj.style.color = '#000000';
337
338       balance_obj.value = balance;
339
340       this.style.display = 'none';
341       customer_obj.style.display = '';
342
343 % if ( $opt{custnum_update_callback} ) {
344       <% $opt{custnum_update_callback} %>(searchrow, '<% $opt{prefix} %>')
345 % }
346
347     }
348
349   }
350
351   function opt(what,value,text,color) {
352     var optionName = new Option(text, value, false, false);
353     optionName.style.color = color;
354     var length = what.length;
355     what.options[length] = optionName;
356   }
357
358 </SCRIPT>
359
360 <TABLE ID="<% $opt{prefix} %>OneTrueTable" BGCOLOR="#cccccc" BORDER=0 CELLSPACING=0>
361
362 <TR>
363   <TH>Inv #</TH>
364   <TH>Cust #</TH>
365   <TH>Customer</TH>
366 % foreach my $header ( @{$opt{header}} ) {
367     <TH><% $header %></TH>
368 % }
369   <TH>Balance</TH>
370 </TR>
371 % my $row = 0;
372 % for ( $row = 0; exists($param->{"custnum$row"}); $row++ ) { 
373
374     <TR>
375       <TD>
376         <INPUT TYPE      = "text"
377                NAME      = "invnum<% $row %>"
378                ID        = "invnum<% $row %>"
379                SIZE      = 8
380                MAXLENGTH = 12
381                STYLE     = "text-align:right;"
382                VALUE     = "<% $param->{"invnum$row"} %>"
383                rownum    = "<% $row %>"
384         >
385         <SCRIPT TYPE="text/javascript">
386           var invnum_input<% $row %> = document.getElementById("invnum<% $row %>");
387           invnum_input<% $row %>.onfocus = clearhint_invnum;
388           invnum_input<% $row %>.onchange = <% $opt{prefix} %>search_invnum;
389         </SCRIPT>
390       </TD>
391
392       <TD>
393         <INPUT TYPE      = "text"
394                NAME      = "custnum<% $row %>"
395                ID        = "custnum<% $row %>"
396                SIZE      = 8
397                MAXLENGTH = 12
398                STYLE     = "text-align:right;"
399                VALUE     = "<% $param->{"custnum$row"} %>"
400                rownum    = "<% $row %>"
401         >
402         <SCRIPT TYPE="text/javascript">
403           var custnum_input<% $row %> = document.getElementById("custnum<% $row %>");
404           custnum_input<% $row %>.onfocus = clearhint_custnum;
405           custnum_input<% $row %>.onchange = <% $opt{prefix} %>search_custnum;
406         </SCRIPT>
407       </TD>
408
409       <TD>
410         <INPUT TYPE="text" NAME="customer<% $row %>" ID="customer<% $row %>" SIZE=64 VALUE="<% $param->{"customer$row"} %>" rownum="<% $row %>">
411           <SCRIPT TYPE="text/javascript">
412             var customer_input<% $row %> = document.getElementById("customer<% $row %>");
413             customer_input<% $row %>.onfocus = clearhint_customer;
414             customer_input<% $row %>.onclick = clearhint_customer;
415             customer_input<% $row %>.onchange = <% $opt{prefix} %>search_customer;
416           </SCRIPT>
417         <SELECT NAME="cust_select<% $row %>" ID="cust_select<% $row %>" rownum="<% $row %>" STYLE="color:#ff0000; display:none">
418         </SELECT>
419           <SCRIPT TYPE="text/javascript">
420             var customer_select<% $row %> = document.getElementById("cust_select<% $row %>");
421             customer_select<% $row %>.onchange = select_customer;
422           </SCRIPT>
423       </TD>
424
425 %   my $col = 0;
426 %   foreach my $field ( @{$opt{fields}} ) {
427 %     my $value;
428 %     if ( ref($field) eq 'CODE' ) {
429 %       $value = &{$field}($row,$param);
430 %     } else {
431 %       $value = $param->{"$field$row"}; 
432 %     }
433 %     my $name  = (ref($field) eq 'CODE') ? "column${col}_$row" : "$field$row";
434 %     my $align = $align{ $opt{align}->[$col] || 'l' };
435 %     my $size  = $sizes->[$col]  || 10;
436 %     my $color = $opt{color}->[$col];
437 %     my $font = $color ? qq(<FONT COLOR="$color">) : '';
438 %     my $onchange = '';
439 %     if ( $opt{footer}->[$col] eq '_TOTAL' ) {
440 %       $total[$col] += $value;
441 %       $onchange = $opt{prefix}. "calc_total$col();";
442 %       $onchange = qq(onchange="$onchange" onkeyup="$onchange");
443 %     }
444       <TD ALIGN="<% $align %>">
445 %     if (! $types->[$col] || $types->[$col] eq 'text') {
446         <INPUT TYPE  = "text"
447                NAME  = "<% $name %>"
448                ID    = "<% $name %>"
449                SIZE  = "<% $size %>"
450                STYLE = "text-align: <% $align %>;"
451                VALUE = "<% $value %>"
452                <% $onchange %>
453         >
454 %     } elsif ($types->[$col] eq 'immutable') {
455         <% $font %><% $value %><% $font ? '</FONT>' : '' %>
456         <INPUT TYPE="hidden" ID="<% $name %>" NAME="<% $name %>" VALUE="<% $value %>" >
457 %     } else {
458         Cannot represent unknown type: <% $types->[$col] %>
459 %     }
460       </TD>
461 %     $col++;
462 %   }
463       <TD>
464         <INPUT TYPE      = "text"
465                NAME      = "balance<% $row %>"
466                ID        = "balance<% $row %>"
467                SIZE      = 8
468                MAXLENGTH = 12
469                STYLE     = "text-align:right;"
470                VALUE     = "<% $param->{"balance$row"} %>"
471                rownum    = "<% $row %>"
472         >
473       </TD>
474     </TR>
475 % } 
476
477 <TR>
478   <TH COLSPAN=3 ID="<% $opt{'prefix'} %>_TOTAL_TOTAL">
479     Total <% $row ? $row-1 : 0 %>
480     <% PL($opt{name_singular} || 'customer', ( $row ? $row-1 : 0 ) ) %>
481   </TH>
482 % my $col = 0;
483 % foreach my $footer ( @{$opt{footer}} ) {
484 %   my $align = $align{ $opt{'footer_align'}->[$col] || 'c' };
485 %   if ($footer eq '_TOTAL' ) {
486 %     my $id = $opt{'fields'}->[$col];
487 %     $id = ref($id) ? "column${col}_TOTAL" : "${id}_TOTAL";
488       <TH ALIGN="<% $align %>" ID="<% $id %>">&nbsp;<% sprintf('%.2f', $total[$col] ) %></TH>
489 %   } else {
490       <TH ALIGN="<% $align %>"><% $footer %></TH>
491 %   }
492 %   $col++;
493 % }
494 </TR>
495
496 </TABLE>
497
498 <SCRIPT TYPE="text/javascript">
499 % my $col = 0;
500 % foreach my $footer ( @{$opt{footer}} ) {
501 %   if ($footer eq '_TOTAL' ) {
502 %     my $name = $opt{fields}->[$col];
503 %     $name = ref($name) ? "column$col" : $name;
504       var <% $opt{prefix}.$name %>_CACHE = new Array ();
505       var <% $opt{prefix} %>th_el = document.getElementById("<%$name%>_TOTAL");
506       function <% $opt{prefix} %>calc_total<% $col %>() {
507         var row = 0;
508         var total = 0;
509         for ( var row = 0;
510               
511               ( <% $opt{prefix}.$name%>_CACHE[row] =
512                                         <% $opt{prefix}.$name%>_CACHE[row]
513                                      || document.getElementById("<%$name%>"+row)
514               ) != null;
515               
516               row++
517             )
518         {
519           var value = <%$name%>_CACHE[row].value;
520           value = parseFloat(value);
521           if ( ! isNaN(value) ) {
522             total = total + value;
523           }
524         }
525         <% $opt{prefix} %>th_el.innerHTML = '&nbsp;' + total.toFixed(2);
526
527       }
528 %   }
529 %   $col++;
530 % }
531 </SCRIPT>
532
533 <% include('/elements/xmlhttp.html',
534               'url'  => $p. 'misc/xmlhttp-cust_main-search.cgi',
535               'subs' => [qw( custnum_search smart_search invnum_search )],
536            )
537 %>
538
539 <SCRIPT TYPE="text/javascript">
540
541   var <% $opt{prefix} %>total_el =
542     document.getElementById("<% $opt{'prefix'} %>_TOTAL_TOTAL");
543
544   var <% $opt{prefix} %>rownum = <% $row %>;
545
546   function <% $opt{prefix} %>addRow() {
547
548     var table = document.getElementById('<% $opt{prefix} %>OneTrueTable');
549     var tablebody = table.getElementsByTagName('tbody').item(0);
550
551     var row = table.insertRow(rownum+1);
552     
553     var invnum_cell = document.createElement('TD');
554
555       var invnum_input = document.createElement('INPUT');
556       invnum_input.setAttribute('name', 'invnum'+<% $opt{prefix} %>rownum);
557       invnum_input.setAttribute('id',   'invnum'+<% $opt{prefix} %>rownum);
558       invnum_input.style.textAlign = 'right';
559       invnum_input.setAttribute('size', 8);
560       invnum_input.setAttribute('maxlength', 12);
561       invnum_input.setAttribute('rownum', <% $opt{prefix} %>rownum);
562       invnum_input.onfocus = clearhint_invnum;
563       invnum_input.onchange = <% $opt{prefix} %>search_invnum;
564       invnum_cell.appendChild(invnum_input);
565
566     row.appendChild(invnum_cell);
567
568     var custnum_cell = document.createElement('TD');
569
570       var custnum_input = document.createElement('INPUT');
571       custnum_input.setAttribute('name', 'custnum'+<% $opt{prefix} %>rownum);
572       custnum_input.setAttribute('id',   'custnum'+<% $opt{prefix} %>rownum);
573       custnum_input.style.textAlign = 'right';
574       custnum_input.setAttribute('size', 8);
575       custnum_input.setAttribute('maxlength', 12);
576       custnum_input.setAttribute('rownum', <% $opt{prefix} %>rownum);
577       custnum_input.onfocus = clearhint_custnum;
578       custnum_input.onchange = <% $opt{prefix} %>search_custnum;
579       custnum_cell.appendChild(custnum_input);
580
581     row.appendChild(custnum_cell);
582
583     var customer_cell = document.createElement('TD');
584
585       var customer_input = document.createElement('INPUT');
586       customer_input.setAttribute('name', 'customer'+<% $opt{prefix} %>rownum);
587       customer_input.setAttribute('id',   'customer'+<% $opt{prefix} %>rownum);
588       customer_input.setAttribute('size', 64);
589       customer_input.setAttribute('value', '(last name or company)' );
590       customer_input.setAttribute('rownum', <% $opt{prefix} %>rownum);
591       customer_input.onfocus = clearhint_customer;
592       customer_input.onclick = clearhint_customer;
593       customer_input.onchange = <% $opt{prefix} %>search_customer;
594       customer_cell.appendChild(customer_input);
595
596       var customer_select = document.createElement('SELECT');
597       customer_select.setAttribute('name', 'cust_select'+<% $opt{prefix} %>rownum);
598       customer_select.setAttribute('id',   'cust_select'+<% $opt{prefix} %>rownum);
599       customer_select.setAttribute('rownum', <% $opt{prefix} %>rownum);
600       customer_select.style.color = '#ff0000';
601       customer_select.style.display = 'none';
602       customer_select.onchange = select_customer;
603       customer_cell.appendChild(customer_select);
604
605     row.appendChild(customer_cell);
606
607 %   my $col = 0;
608 %   foreach my $field ( @{$opt{fields}} ) {
609
610       var my_cell = document.createElement('TD');
611       my_cell.setAttribute('align', '<% $align{ $opt{align}->[$col] || 'l' } %>');
612
613 %     if ($types->[$col] eq 'immutable') {
614 %       my $value;
615 %       if ( ref($field) eq 'CODE' ) {
616 %         $value = &{$field}($row,$param);
617 %       } else {
618 %         $value = $param->{"$field$row"}; 
619 %       }
620         var my_text = document.createTextNode('<% $value %>');
621         my_cell.appendChild(my_text);
622 %     }
623
624       var my_input = document.createElement('INPUT');
625       my_input.setAttribute('name', '<% $field %>'+<% $opt{prefix} %>rownum);
626       my_input.setAttribute('id',   '<% $field %>'+<% $opt{prefix} %>rownum);
627       my_input.style.textAlign = '<% $align{ $opt{align}->[$col] || 'l' } %>';
628       my_input.setAttribute('size', <% $sizes->[$col] || 10 %>);
629 %     if ($types->[$col] eq 'immutable') {
630         my_input.setAttribute('type', 'hidden');
631 %     }
632 %     if ( $opt{footer}->[$col] eq '_TOTAL' ) {
633         my_input.onchange   = <% $opt{prefix} %>calc_total<%$col%>;
634         my_input.onkeyup    = <% $opt{prefix} %>calc_total<%$col%>;
635 %     }
636       my_cell.appendChild(my_input);
637
638     row.appendChild(my_cell);
639
640 %     $col++;
641 %   }
642
643     var balance_cell = document.createElement('TD');
644
645       var balance_input = document.createElement('INPUT');
646       balance_input.setAttribute('name', 'balance'+<% $opt{prefix} %>rownum);
647       balance_input.setAttribute('id',   'balance'+<% $opt{prefix} %>rownum);
648       balance_input.style.textAlign = 'right';
649       balance_input.setAttribute('size', 8);
650       balance_input.setAttribute('maxlength', 12);
651       balance_input.setAttribute('rownum', <% $opt{prefix} %>rownum);
652       balance_input.disabled = true;
653       balance_input.style.backgroundColor = '#dddddd';
654       balance_cell.appendChild(balance_input);
655
656     row.appendChild(balance_cell);
657
658     //update the total # of rows display
659     if ( <% $opt{prefix} %>rownum == 1 ) {
660       <% $opt{prefix} %>total_el.innerHTML =
661         'Total '
662           + <% $opt{prefix} %>rownum
663           + ' <% $opt{name_singular} || 'customer' %>';
664     } else {
665       <% $opt{prefix} %>total_el.innerHTML =
666         'Total '
667           + <% $opt{prefix} %>rownum
668           + ' <% PL($opt{name_singular} || 'customer') %>';
669     }
670
671     <% $opt{prefix} %>rownum++;
672
673   }
674
675 % unless ($cgi->param('error')) {
676   <% $opt{prefix} %>addRow();
677 % }
678 </SCRIPT>
679
680 <%init>
681
682 my(%opt) = @_;
683
684 $opt{prefix} = '' unless defined $opt{prefix};
685 $opt{prefix} .= '_' if $opt{prefix};
686
687 my $types = $opt{'types'} ? [ @{$opt{'types'}} ] : [];
688 my $sizes = $opt{'size'} ? [ @{$opt{'size'}} ] : [];
689
690 my $param = $opt{param};
691 $param = $cgi->Vars if $cgi->param('error');
692
693 $opt{$_} ||= [] foreach qw(align color footer footer_align);
694
695 my @total = map 0, @{$opt{footer}};
696
697 my %align = (
698   'l' => 'left',
699   'r' => 'right',
700   'c' => 'center',
701 );
702
703 </%init>