Bugzilla – Attachment 1168 Details for
Bug 3229
The "Sort By" feature for lists does not work
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Proposed patch.
0005-Bug-3229-Fixes-sort-by-feature-for-jquery-tablesort.patch (text/plain), 6.28 KB, created by
Chris Cormack
on 2009-06-24 01:41:00 UTC
(
hide
)
Description:
Proposed patch.
Filename:
MIME Type:
Creator:
Chris Cormack
Created:
2009-06-24 01:41:00 UTC
Size:
6.28 KB
patch
obsolete
>From 383c451eb895e142d8dc22275eeafac06c25b7b6 Mon Sep 17 00:00:00 2001 >From: Garry Collum <gcollum@gmail.com> >Date: Tue, 23 Jun 2009 21:23:15 -0400 >Subject: [PATCH] Bug 3229: Fixes sort-by feature for jquery tablesorter in lists. >Content-Type: text/plain; charset="utf-8" > >This patch adds some variables for the sortfield that are passed through the URL so that the sort-by feature works when the jquery tablesorter is used for a list of titles in opac-shelves.tmpl. >--- > C4/VirtualShelves/Page.pm | 13 ++++++++++++- > koha-tmpl/opac-tmpl/prog/en/includes/masthead.inc | 4 ++-- > .../opac-tmpl/prog/en/modules/opac-shelves.tmpl | 16 ++++++++++++++-- > 3 files changed, 28 insertions(+), 5 deletions(-) > >diff --git a/C4/VirtualShelves/Page.pm b/C4/VirtualShelves/Page.pm >index 99d1f5d..999692c 100644 >--- a/C4/VirtualShelves/Page.pm >+++ b/C4/VirtualShelves/Page.pm >@@ -170,6 +170,15 @@ SWITCH: { > #check that the user can view the shelf > if ( ShelfPossibleAction( $loggedinuser, $shelfnumber, 'view' ) ) { > my $items; >+ my $authorsort; >+ my $copyrightsort; >+ my $sortfield = ($query->param('sortfield') ? $query->param('sortfield') : 'title'); >+ if ($sortfield eq 'author') { >+ $authorsort = 'author'; >+ } >+ if ($sortfield eq 'copyrightdate'){ >+ $copyrightsort = 'copyrightdate'; >+ } > ($items, $totitems) = GetShelfContents($shelfnumber, $shelflimit, $shelfoffset); > for my $this_item (@$items) { > # the virtualshelfcontents table does not store these columns nor are they retrieved from the items >@@ -188,6 +197,8 @@ SWITCH: { > shelfname => $shelflist->{$shelfnumber}->{'shelfname'} || $privshelflist->{$shelfnumber}->{'shelfname'}, > shelfnumber => $shelfnumber, > viewshelf => $shelfnumber, >+ authorsort => $authorsort, >+ copyrightsort => $copyrightsort, > manageshelf => $manageshelf, > itemsloop => $items, > ); >@@ -291,7 +302,7 @@ foreach my $element (sort { lc($shelflist->{$a}->{'shelfname'}) cmp lc($shelflis > > my $url = $type eq 'opac' ? "/cgi-bin/koha/opac-shelves.pl" : "/cgi-bin/koha/virtualshelves/shelves.pl"; > my %qhash = (); >-foreach (qw(display viewshelf)) { >+foreach (qw(display viewshelf sortfield)) { > $qhash{$_} = $query->param($_) if $query->param($_); > } > (scalar keys %qhash) and $url .= '?' . join '&', map {"$_=$qhash{$_}"} keys %qhash; >diff --git a/koha-tmpl/opac-tmpl/prog/en/includes/masthead.inc b/koha-tmpl/opac-tmpl/prog/en/includes/masthead.inc >index 2d4e313..cd258f7 100644 >--- a/koha-tmpl/opac-tmpl/prog/en/includes/masthead.inc >+++ b/koha-tmpl/opac-tmpl/prog/en/includes/masthead.inc >@@ -103,7 +103,7 @@ > <!-- TMPL_IF NAME="pubshelves" --> > <ul class="first-of-type"> > <!-- TMPL_LOOP NAME="pubshelvesloop" --> >- <li class="yuimenuitem"><a href="/cgi-bin/koha/opac-shelves.pl?viewshelf=<!-- TMPL_VAR NAME="shelfnumber" -->"><!-- TMPL_VAR NAME="shelfname" ESCAPE="html" --></a></li> >+ <li class="yuimenuitem"><a href="/cgi-bin/koha/opac-shelves.pl?viewshelf=<!-- TMPL_VAR NAME="shelfnumber" -->&sortfield=<!-- TMPL_VAR NAME="sortfield" -->"><!-- TMPL_VAR NAME="shelfname" ESCAPE="html" --></a></li> > <!-- /TMPL_LOOP --> > </ul> > <!-- TMPL_ELSE --> >@@ -120,7 +120,7 @@ > <!-- TMPL_IF NAME="barshelves" --> > <ul class="first-of-type"> > <!-- TMPL_LOOP NAME="barshelvesloop" --> >- <li class="yuimenuitem"><a href="/cgi-bin/koha/opac-shelves.pl?viewshelf=<!-- TMPL_VAR NAME="shelfnumber" -->"><!-- TMPL_VAR NAME="shelfname" ESCAPE="html" --></a></li> >+ <li class="yuimenuitem"><a href="/cgi-bin/koha/opac-shelves.pl?viewshelf=<!-- TMPL_VAR NAME="shelfnumber" -->&sortfield=<!-- TMPL_VAR NAME="sortfield" -->"><!-- TMPL_VAR NAME="shelfname" ESCAPE="html" --></a></li> > <!-- /TMPL_LOOP --> > </ul> > <!-- TMPL_ELSE --> >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 c15bdc3..a1dda46 100644 >--- a/koha-tmpl/opac-tmpl/prog/en/modules/opac-shelves.tmpl >+++ b/koha-tmpl/opac-tmpl/prog/en/modules/opac-shelves.tmpl >@@ -77,10 +77,22 @@ $(function() { > $("#listcontents").tablesorter({ > widgets : ['zebra'], > <!-- TMPL_IF NAME="manageshelf" --> >+ <!-- TMPL_IF NAME="authorsort" --> >+ sortList: [[2,0]], >+ <!-- TMPL_ELSIF NAME="copyrightsort" --> >+ sortList: [[3,1]], >+ <!-- TMPL_ELSE --> > sortList: [[1,0]], >+ <!-- /TMPL_IF --> > headers: { 0: { sorter: false },1:{sorter: 'articles'} > <!-- TMPL_ELSE --> >+ <!-- TMPL_IF NAME="authorsort" --> >+ sortList: [[1,0]], >+ <!-- TMPL_ELSIF NAME="copyrightsort" --> >+ sortList: [[2,1]], >+ <!-- TMPL_ELSE --> > sortList: [[0,0]], >+ <!-- /TMPL_IF --> > headers: { 0:{sorter:'articles'} > <!-- /TMPL_IF --> > } >@@ -338,7 +350,7 @@ $(document).ready(function(){ > <!--TMPL_ELSE--> > <tr> > <!-- /TMPL_UNLESS --> >- <td><a href="opac-shelves.pl?display=privateshelves&viewshelf=<!-- TMPL_VAR NAME="shelf" -->"><!-- TMPL_VAR NAME="shelfname" ESCAPE="html" --></a></td> >+ <td><a href="opac-shelves.pl?display=privateshelves&viewshelf=<!-- TMPL_VAR NAME="shelf" -->&sortfield=<!-- TMPL_VAR NAME="sortfield" -->"><!-- TMPL_VAR NAME="shelfname" ESCAPE="html" --></a></td> > <td><!-- TMPL_VAR NAME="count" --> item(s)</td> > <td><!-- TMPL_VAR NAME="sortfield" --></td> > <td> >@@ -406,7 +418,7 @@ $(document).ready(function(){ > <!--TMPL_ELSE--> > <tr> > <!-- /TMPL_UNLESS --> >- <td><a href="opac-shelves.pl?viewshelf=<!-- TMPL_VAR NAME="shelf" -->"><!-- TMPL_VAR NAME="shelfname" ESCAPE="html" --></a></td> >+ <td><a href="opac-shelves.pl?viewshelf=<!-- TMPL_VAR NAME="shelf" -->&sortfield=<!-- TMPL_VAR NAME="sortfield" -->"><!-- TMPL_VAR NAME="shelfname" ESCAPE="html" --></a></td> > <td><!-- TMPL_VAR NAME="count" --> item(s)</td> > <td><!-- TMPL_VAR NAME="sortfield" --></td> > <td> >-- >1.5.6.5 >
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 3229
: 1168 |
1169