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

Garry Collum gcollum at gmail.com
Thu Jun 11 21:59:29 CEST 2009


Removed toggle variable form marctagstructure.pl and its .tmpl. Used template __odd__ variable instead.
---
 admin/marctagstructure.pl                          |   15 ---------------
 .../prog/en/modules/admin/marctagstructure.tmpl    |   18 +++++++++++++++---
 2 files changed, 15 insertions(+), 18 deletions(-)

diff --git a/admin/marctagstructure.pl b/admin/marctagstructure.pl
index b930271..b2728df 100755
--- a/admin/marctagstructure.pl
+++ b/admin/marctagstructure.pl
@@ -258,16 +258,10 @@ if ($op eq 'add_form') {
 		}
 		$sth->finish;
 		
-		my $toggle=0;
 		my @loop_data = ();
 		my $j=1;
 		my $i=$offset;
 		while ($i < ($offset+$pagesize<$cnt?$offset+$pagesize:$cnt)) {
-			if ($toggle eq 0){
-				$toggle=1;
-			} else {
-				$toggle=0;
-			}
 			my %row_data;  # get a fresh hash for the row data
 			$row_data{tagfield} = $results[$i]->{'mts_tagfield'};
 			$row_data{liblibrarian} = $results[$i]->{'mts_liblibrarian'};
@@ -277,7 +271,6 @@ if ($op eq 'add_form') {
 			$row_data{subfield_link} ="marc_subfields_structure.pl?op=add_form&amp;tagfield=".$results[$i]->{'mts_tagfield'}."&amp;frameworkcode=".$frameworkcode;
 			$row_data{edit} = "$script_name?op=add_form&amp;searchfield=".$results[$i]->{'mts_tagfield'}."&amp;frameworkcode=".$frameworkcode;
 			$row_data{delete} = "$script_name?op=delete_confirm&amp;searchfield=".$results[$i]->{'mts_tagfield'}."&amp;frameworkcode=".$frameworkcode;
-			$row_data{toggle} = $toggle;
 			$j=$i;
 			my @internal_loop = ();
 			while (($results[$i]->{'tagfield'}==$results[$j]->{'tagfield'}) and ($j< ($offset+$pagesize<$cnt?$offset+$pagesize:$cnt))) {
@@ -292,7 +285,6 @@ if ($op eq 'add_form') {
 				$subfield_data{authorised_value} = $results[$j]->{'authorised_value'};
 				$subfield_data{authtypecode}= $results[$j]->{'authtypecode'};
 				$subfield_data{value_builder}= $results[$j]->{'value_builder'};
-				$subfield_data{toggle}	= $toggle;
 # 				warn "tagfield :  ".$results[$j]->{'tagfield'}." tagsubfield :".$results[$j]->{'tagsubfield'};
 				push @internal_loop,\%subfield_data;
 				$j++;
@@ -310,14 +302,8 @@ if ($op eq 'add_form') {
 		#here, normal old style : display every tags
 		my ($count,$results)=StringSearch($searchfield,$frameworkcode);
 		$cnt = $count;
-		my $toggle=0;
 		my @loop_data = ();
 		for (my $i=$offset; $i < ($offset+$pagesize<$count?$offset+$pagesize:$count); $i++){
-			if ($toggle eq 0){
-				$toggle=1;
-			} else {
-				$toggle=0;
-			}
 			my %row_data;  # get a fresh hash for the row data
 			$row_data{tagfield} = $results->[$i]{'tagfield'};
 			$row_data{liblibrarian} = $results->[$i]{'liblibrarian'};
@@ -327,7 +313,6 @@ if ($op eq 'add_form') {
 			$row_data{subfield_link} ="marc_subfields_structure.pl?tagfield=".$results->[$i]{'tagfield'}."&amp;frameworkcode=".$frameworkcode;
 			$row_data{edit} = "$script_name?op=add_form&amp;searchfield=".$results->[$i]{'tagfield'}."&amp;frameworkcode=".$frameworkcode;
 			$row_data{delete} = "$script_name?op=delete_confirm&amp;searchfield=".$results->[$i]{'tagfield'}."&amp;frameworkcode=".$frameworkcode;
-			$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/marctagstructure.tmpl b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/marctagstructure.tmpl
index dd88246..4b3c9d0 100644
--- a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/marctagstructure.tmpl
+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/marctagstructure.tmpl
@@ -200,7 +200,11 @@
 
     <!-- TMPL_IF NAME="select_display" -->
         <!-- TMPL_LOOP NAME="loop" -->
-            <!-- TMPL_IF NAME="toggle" --><tr><!-- TMPL_ELSE --><tr class="highlight"><!-- /TMPL_IF -->
+            <!-- TMPL_UNLESS NAME="__odd__" -->
+            <tr class="highlight">
+            <!-- TMPL_ELSE -->
+            <tr>
+            <!-- /TMPL_UNLESS -->
             <td><!-- TMPL_VAR NAME="tagfield" --></td>
             <td><!-- TMPL_VAR NAME="liblibrarian" --></td>
             <td><!-- TMPL_IF NAME="repeatable" -->Yes<!-- TMPL_ELSE -->No<!-- /TMPL_IF --></td>
@@ -210,7 +214,11 @@
             <td><a href="<!-- TMPL_VAR NAME="edit" -->">Edit</a></td>
             <td><a href="<!-- TMPL_VAR NAME="delete" -->">Delete</a></td>
         </tr>
-      <!-- TMPL_IF NAME="toggle" --><tr><!-- TMPL_ELSE --><tr class="highlight"><!-- /TMPL_IF -->
+      <!-- TMPL_UNLESS NAME="__odd__" -->
+      <tr class="highlight">
+      <!-- TMPL_ELSE -->
+      <tr>
+      <!-- /TMPL_UNLESS -->
             <td>
                 &nbsp;
             </td>
@@ -225,7 +233,11 @@
         <!-- /TMPL_LOOP -->
     <!-- TMPL_ELSE -->
     <!-- TMPL_LOOP NAME="loop" -->
-    <!-- TMPL_IF NAME="toggle" --><tr><!-- TMPL_ELSE --><tr class="highlight"><!-- /TMPL_IF -->
+        <!-- TMPL_UNLESS NAME="__odd__" -->
+        <tr class="highlight">
+        <!-- TMPL_ELSE -->
+        <tr>
+        <!-- /TMPL_UNLESS -->
         <td><!-- TMPL_VAR NAME="tagfield" --></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