[Koha-patches] [PATCH] Bug 2889: Removed toggle variable from auth_tag_structure.pl and auth_subfields_structure.pl

Garry Collum gcollum at gmail.com
Thu Jun 11 21:15:38 CEST 2009


Removed toggle variable from auth_tag_structure.pl and .tmpl.  Used template __odd__ in auth_tag_structure.tmpl.

Removed toggle variable from auth_subfields_structure.pl and .tmpl. Use __odd__. Removed a type in the highlight class definition. Fixed a minor xhtml error.
---
 admin/auth_subfields_structure.pl                  |   15 ---------------
 admin/auth_tag_structure.pl                        |    7 -------
 .../en/modules/admin/auth_subfields_structure.tmpl |    8 ++++++--
 .../prog/en/modules/admin/auth_tag_structure.tmpl  |    6 +++++-
 4 files changed, 11 insertions(+), 25 deletions(-)

diff --git a/admin/auth_subfields_structure.pl b/admin/auth_subfields_structure.pl
index b166777..6c6f571 100755
--- a/admin/auth_subfields_structure.pl
+++ b/admin/auth_subfields_structure.pl
@@ -145,16 +145,10 @@ if ($op eq 'add_form') {
 	my $sth=$dbh->prepare("select * from auth_subfield_structure where tagfield=? and authtypecode=?"); # and tagsubfield='$tagsubfield'");
 	$sth->execute($tagfield,$authtypecode);
 	my @loop_data = ();
-	my $toggle=1;
 	my $i=0;
 	while ($data =$sth->fetchrow_hashref) {
 
 		my %row_data;  # get a fresh hash for the row data
-		if ($toggle eq 1){
-			$toggle=0;
-	  	} else {
-			$toggle=1;
-	  	}
 		$row_data{tab} = CGI::scrolling_list(-name=>'tab',
 					-id=>"tab$i",
                                         -values =>
@@ -261,7 +255,6 @@ if ($op eq 'add_form') {
 			-value => 1,
 			-label => '');
 		$row_data{row} = $i;
-		$row_data{toggle} = $toggle;
 		push(@loop_data, \%row_data);
 		$i++;
 	}
@@ -376,7 +369,6 @@ if ($op eq 'add_form') {
 		 			-tabindex=>'',
 					-multiple=>0,
 					);
-		$row_data{toggle} = $toggle;
 		$row_data{row} = $i;
 		push(@loop_data, \%row_data);
 	}
@@ -516,14 +508,8 @@ if ($op eq 'add_form') {
 ################## DEFAULT ##################################
 } else { # DEFAULT
 	my ($count,$results)=string_search($tagfield,$authtypecode);
-	my $toggle=1;
 	my @loop_data = ();
 	for (my $i=$offset; $i < ($offset+$pagesize<$count?$offset+$pagesize:$count); $i++){
-	  	if ($toggle eq 1){
-			$toggle=0;
-	  	} else {
-			$toggle=1;
-	  	}
 		my %row_data;  # get a fresh hash for the row data
 		$row_data{tagfield} = $results->[$i]{'tagfield'};
 		$row_data{tagsubfield} = $results->[$i]{'tagsubfield'};
@@ -539,7 +525,6 @@ if ($op eq 'add_form') {
 		$row_data{hidden}	= $results->[$i]{'hidden'} if($results->[$i]{'hidden'} gt "000") ;
 		$row_data{isurl}	= $results->[$i]{'isurl'};
 		$row_data{delete} = "$script_name?op=delete_confirm&amp;tagfield=$tagfield&amp;tagsubfield=".$results->[$i]{'tagsubfield'}."&amp;authtypecode=$authtypecode";
-		$row_data{toggle} = $toggle;
 		if ($row_data{tab} eq -1) {
 			$row_data{subfield_ignored} = 1;
 		}
diff --git a/admin/auth_tag_structure.pl b/admin/auth_tag_structure.pl
index 279a10c..2bd5581 100755
--- a/admin/auth_tag_structure.pl
+++ b/admin/auth_tag_structure.pl
@@ -234,14 +234,8 @@ if ($op eq 'add_form') {
 		 $template->param(searchfield => $searchfield);
 	}
 	my ($count,$results)=StringSearch($searchfield,$authtypecode);
-	my $toggle=1;
 	my @loop_data = ();
 	for (my $i=$offset; $i < ($offset+$pagesize<$count?$offset+$pagesize:$count); $i++){
-	  	if ($toggle eq 1){
-			$toggle=0;
-	  	} else {
-			$toggle=1;
-	  	}
 		my %row_data;  # get a fresh hash for the row data
 		$row_data{tagfield} = $results->[$i]{'tagfield'};
 		$row_data{liblibrarian} = $results->[$i]{'liblibrarian'};
@@ -251,7 +245,6 @@ if ($op eq 'add_form') {
 		$row_data{subfield_link} ="auth_subfields_structure.pl?tagfield=".$results->[$i]{'tagfield'}."&amp;authtypecode=".$authtypecode;
 		$row_data{edit} = "$script_name?op=add_form&amp;searchfield=".$results->[$i]{'tagfield'}."&amp;authtypecode=".$authtypecode;
 		$row_data{delete} = "$script_name?op=delete_confirm&amp;searchfield=".$results->[$i]{'tagfield'}."&amp;authtypecode=".$authtypecode;
-		$row_data{toggle} = $toggle;
 		push(@loop_data, \%row_data);
 	}
 	$template->param(loop => \@loop_data,
diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/auth_subfields_structure.tmpl b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/auth_subfields_structure.tmpl
index 46054d6..7f77fdd 100644
--- a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/auth_subfields_structure.tmpl
+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/auth_subfields_structure.tmpl
@@ -158,7 +158,11 @@ function displayMoreConstraint(numlayer){
         <th>Delete</th>
     </tr>
     <!-- TMPL_LOOP NAME="loop" -->
-    <!-- TMPL_IF NAME="toggle" --><tr class="highlighted"><!-- TMPL_ELSE --><tr><!-- /TMPL_IF -->
+    <!-- TMPL_UNLESS NAME="__odd__" -->
+    <tr class="highlight">
+    <!-- TMPL_ELSE -->
+    <tr>
+    <!-- /TMPL_IF -->
         <td><!-- TMPL_VAR NAME="tagsubfield" --></td>
         <td>
             <!-- TMPL_IF NAME="subfield_ignored" -->
@@ -202,7 +206,7 @@ function displayMoreConstraint(numlayer){
 	</form>
 
     <!-- TMPL_IF NAME="previous" -->
-    <input type="image" src="<!-- TMPL_VAR NAME="interface" -->/<!-- TMPL_VAR NAME="theme" -->/images/1leftarrow.png" title="previous" alt="previous" border="0" >
+    <input type="image" src="<!-- TMPL_VAR NAME="interface" -->/<!-- TMPL_VAR NAME="theme" -->/images/1leftarrow.png" title="previous" alt="previous" border="0" />
     </a>
     <!-- /TMPL_IF -->
     <!-- TMPL_IF NAME="next" -->
diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/auth_tag_structure.tmpl b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/auth_tag_structure.tmpl
index c0898f5..3b4f9c6 100644
--- a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/auth_tag_structure.tmpl
+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/auth_tag_structure.tmpl
@@ -212,7 +212,11 @@ return false;
         <th>Delete</th>
 	</tr>
     <!-- TMPL_LOOP NAME="loop" -->
-		<!-- TMPL_IF NAME="toggle" --><tr class="highlight"><!-- TMPL_ELSE --><tr><!-- /TMPL_IF -->
+	<!-- TMPL_UNLESS NAME="__odd__" -->
+	<tr class="highlight">
+	<!-- TMPL_ELSE -->
+	<tr>
+	<!-- /TMPL_UNLESS -->
         <td><b><!-- TMPL_VAR NAME="tagfield" --></b></td>
         <td><!-- TMPL_VAR NAME="liblibrarian" --></td>
         <td><!-- TMPL_IF NAME="repeatable" -->Yes<!-- TMPL_ELSE -->No<!-- /TMPL_IF --></td>
-- 
1.5.6.5




More information about the Koha-patches mailing list