[Koha-patches] [PATCH] Bug 3347: Inconsistencies with public and private list tables in opac-shelves.tmpl.

Garry Collum gcollum at gmail.com
Sat Jun 20 04:42:46 CEST 2009


This patch fixes inconsistencies with the public and private list tables in opac-shelves.tmpl.  It adds a "new list" link to the public list view, and it adds a "sort by" column.

This patch also removes the toggle variables from the tables in opac-shelves.tmpl and Page.pm, and uses the template __odd__ variable for table highlighting if javascript is turned off.
---
 C4/VirtualShelves/Page.pm                          |    5 -----
 .../opac-tmpl/prog/en/modules/opac-shelves.tmpl    |   16 +++++++++-------
 2 files changed, 9 insertions(+), 12 deletions(-)

diff --git a/C4/VirtualShelves/Page.pm b/C4/VirtualShelves/Page.pm
index ac47219..99d1f5d 100644
--- a/C4/VirtualShelves/Page.pm
+++ b/C4/VirtualShelves/Page.pm
@@ -183,9 +183,6 @@ SWITCH: {
 			push @paramsloop, {display => 'privateshelves'} if $category == 1;
 			$showadd = 1;
 			my $i = 0;
-			foreach (grep {$i++ % 2} @$items) {     # every other item
-				$_->{toggle} = 1;
-			}
 			my $manageshelf = ShelfPossibleAction( $loggedinuser, $shelfnumber, 'manage' );
 			$template->param(
 				shelfname   => $shelflist->{$shelfnumber}->{'shelfname'} || $privshelflist->{$shelfnumber}->{'shelfname'},
@@ -286,10 +283,8 @@ foreach my $element (sort { lc($shelflist->{$a}->{'shelfname'}) cmp lc($shelflis
 	$shelflist->{$element}->{ownername} = defined($member) ? $member->{firstname} . " " . $member->{surname} : '';
 	$numberCanManage++ if $canmanage;	# possibly outmoded
 	if ($shelflist->{$element}->{'category'} eq '1') {
-		(scalar(@shelveslooppriv) % 2) and $shelflist->{$element}->{toggle} = 1;
 		push (@shelveslooppriv, $shelflist->{$element});
 	} else {
-		(scalar(@shelvesloop)     % 2) and $shelflist->{$element}->{toggle} = 1;
 		push (@shelvesloop, $shelflist->{$element});
 	}
 }
diff --git a/koha-tmpl/opac-tmpl/prog/en/modules/opac-shelves.tmpl b/koha-tmpl/opac-tmpl/prog/en/modules/opac-shelves.tmpl
index aa8ac4c..643b478 100644
--- a/koha-tmpl/opac-tmpl/prog/en/modules/opac-shelves.tmpl
+++ b/koha-tmpl/opac-tmpl/prog/en/modules/opac-shelves.tmpl
@@ -210,11 +210,11 @@ $(document).ready(function(){
                   </tr></thead>
                   <tbody>
                   <!-- TMPL_LOOP NAME="itemsloop" -->
-                    <!-- TMPL_IF NAME="toggle" -->
+                    <!-- TMPL_UNLESS NAME="__odd__" -->
                       <tr class="highlight">
                     <!-- TMPL_ELSE -->
                       <tr>
-                    <!-- /TMPL_IF -->
+                    <!-- /TMPL_UNLESS -->
                     <!-- TMPL_IF NAME="manageshelf" -->
                         <td><input type="checkbox" name="REM-<!-- TMPL_VAR NAME="biblionumber" -->"
                                    value="<!-- TMPL_VAR NAME="biblionumber">" /></td>
@@ -333,11 +333,11 @@ $(document).ready(function(){
                           <th>&nbsp;</th>
                         </tr>
                         <!-- TMPL_LOOP NAME="shelveslooppriv" -->
-                          <!-- TMPL_IF NAME="toggle" -->
+                          <!-- TMPL_UNLESS NAME="__odd__" -->
                             <tr class="highlight">
                           <!--TMPL_ELSE-->
                             <tr>
-                          <!-- /TMPL_IF -->
+                          <!-- /TMPL_UNLESS -->
                               <td><a href="opac-shelves.pl?display=privateshelves&amp;viewshelf=<!-- TMPL_VAR NAME="shelf" -->"><!-- TMPL_VAR NAME="shelfname" ESCAPE="html"  --></a></td>
                               <td><!-- TMPL_VAR NAME="count" --> item(s)</td>
                               <td><!-- TMPL_VAR NAME="sortfield" --></td>
@@ -386,23 +386,25 @@ $(document).ready(function(){
                   <!-- TMPL_ELSE -->
                     <div id="publicshelves" class="tab-container" style="display:none;">
                   <!-- /TMPL_IF -->
-                  
+                  <a class="newshelf" href="/cgi-bin/koha/opac-shelves.pl?shelves=1">New List</a>
                   <!-- TMPL_IF NAME="shelvesloop" -->
                     <!-- TMPL_VAR name='pagination_bar'-->
                       <table>
                         <tr>
                           <th>List Name</th>
                           <th>Contents</th>
+                          <th>Sort by</th>
                           <th>Type</th><th>&nbsp;</th>
                         </tr>
                     <!-- TMPL_LOOP NAME="shelvesloop" -->
-                      <!-- TMPL_IF NAME="toggle" -->
+                      <!-- TMPL_UNLESS NAME="__odd__" -->
                         <tr class="highlight">
                       <!--TMPL_ELSE-->
                         <tr>
-                      <!-- /TMPL_IF -->
+                      <!-- /TMPL_UNLESS -->
                           <td><a href="opac-shelves.pl?viewshelf=<!-- TMPL_VAR NAME="shelf" -->"><!-- TMPL_VAR NAME="shelfname" ESCAPE="html"  --></a></td>
                           <td><!-- TMPL_VAR NAME="count" --> item(s)</td>
+                          <td><!-- TMPL_VAR NAME="sortfield" --></td>
                           <td>
                             <!-- TMPL_IF NAME="viewcategory1" -->Private<!-- /TMPL_IF -->
                             <!-- TMPL_IF NAME="viewcategory2" -->Public<!-- /TMPL_IF -->
-- 
1.5.6.5




More information about the Koha-patches mailing list