Bug 3347: Inconsistencies with public and private list tables in opac-shelves.tmpl.
authorGarry Collum <gcollum@gmail.com>
Sat, 20 Jun 2009 02:42:46 +0000 (22:42 -0400)
committerGalen Charlton <galen.charlton@liblime.com>
Mon, 29 Jun 2009 19:02:28 +0000 (14:02 -0500)
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.

Signed-off-by: Galen Charlton <galen.charlton@liblime.com>
C4/VirtualShelves/Page.pm
koha-tmpl/opac-tmpl/prog/en/modules/opac-shelves.tmpl

index ac47219..99d1f5d 100644 (file)
@@ -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});
        }
 }
index aa8ac4c..643b478 100644 (file)
@@ -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 -->