[Koha-devel] CVS: koha/C4 Output.pm,1.6.2.6,1.6.2.7

Pat Eyler pate at users.sourceforge.net
Thu Apr 25 13:23:07 CEST 2002


Update of /cvsroot/koha/koha/C4
In directory usw-pr-cvs1:/tmp/cvs-serv25430

Modified Files:
      Tag: rel-1-2
	Output.pm 
Log Message:
refactored &mkformnotable to use foreach and ifels instead of while and many ifs

Index: Output.pm
===================================================================
RCS file: /cvsroot/koha/koha/C4/Output.pm,v
retrieving revision 1.6.2.6
retrieving revision 1.6.2.7
diff -C2 -r1.6.2.6 -r1.6.2.7
*** Output.pm	25 Apr 2002 19:45:46 -0000	1.6.2.6
--- Output.pm	25 Apr 2002 20:16:50 -0000	1.6.2.7
***************
*** 267,289 ****
    my ($action, at inputs)=@_;
    my $string="<form action=$action method=post>\n";
!   my $count=@inputs;
!   for (my $i=0; $i<$count; $i++){
!     if ($inputs[$i][0] eq 'hidden'){
!       $string=$string."<input type=hidden name=$inputs[$i][1] value=\"$inputs[$i][2]\">\n";
!     }
!     if ($inputs[$i][0] eq 'radio') {
!       $string.="<input type=radio name=$inputs[$i][1] value=$inputs[$i][2]>$inputs[$i][2]";
!     } 
!     if ($inputs[$i][0] eq 'text') {
!       $string.="<input type=$inputs[$i][0] name=$inputs[$i][1] value=\"$inputs[$i][2]\">";
!     }
!     if ($inputs[$i][0] eq 'textarea') {
!         $string.="<textarea name=$inputs[$i][1] wrap=physical cols=40 rows=4>$inputs[$i][2]</textarea>";
!     }
!     if ($inputs[$i][0] eq 'reset'){
!       $string.="<input type=reset name=$inputs[$i][1] value=\"$inputs[$i][2]\">";
!     }    
!     if ($inputs[$i][0] eq 'submit'){
!       $string.="<input type=submit name=$inputs[$i][1] value=\"$inputs[$i][2]\">";
      }    
    }
--- 267,290 ----
    my ($action, at inputs)=@_;
    my $string="<form action=$action method=post>\n";
!   foreach my $input (@inputs){
!       if ($$input[0] eq 'hidden'){
! 	  $string .= 
! 	      "<input type=hidden name=$$input[1] value=\"$$input[2]\">\n";
!       } elsif ($$input[0] eq 'radio') {
! 	  $string .= 
! 	      "<input type=radio name=$$input[1] value=$$input[2]>$$input[2]";
!       } elsif ($$input[0] eq 'text') {
! 	  $string .= 
! 	      "<input type=$$input[0] name=$$input[1] value=\"$$input[2]\">";
!       } elsif ($$input[0] eq 'textarea') {
!         $string .= 
! 	    "<textarea name=$$input[1] wrap=physical cols=40 rows=4>";
! 	$string .= 
! 	    "$$input[2]</textarea>";
!     } elsif ($$input[0] eq 'reset'){
! 	$string .= 
! 	    "<input type=reset name=$$input[1] value=\"$$input[2]\">";
!     } elsif ($$input[0] eq 'submit'){
!       $string.="<input type=submit name=$$input[1] value=\"$$input[2]\">";
      }    
    }





More information about the Koha-devel mailing list