Bugzilla – Attachment 14781 Details for
Bug 9458
Add sorting to lists
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 9458 - Add sorting to lists
Bug-9458---Add-sorting-to-lists.patch (text/plain), 5.30 KB, created by
Kyle M Hall (khall)
on 2013-01-23 14:07:21 UTC
(
hide
)
Description:
Bug 9458 - Add sorting to lists
Filename:
MIME Type:
Creator:
Kyle M Hall (khall)
Created:
2013-01-23 14:07:21 UTC
Size:
5.30 KB
patch
obsolete
>From d75c06c5a2ce989261d8d7884501875f3d48090d Mon Sep 17 00:00:00 2001 >From: Kyle M Hall <kyle@bywatersolutions.com> >Date: Wed, 23 Jan 2013 09:05:20 -0500 >Subject: [PATCH] Bug 9458 - Add sorting to lists > >Test Plan: >1) Apply patch >2) View list in staff interface, try sorting by title, then author >3) Repeat 2 with same list in OPAC >--- > C4/VirtualShelves/Page.pm | 4 ++- > .../prog/en/modules/virtualshelves/shelves.tt | 18 +++++++++++-- > .../opac-tmpl/prog/en/modules/opac-shelves.tt | 27 ++++++++++++++++++++ > 3 files changed, 45 insertions(+), 4 deletions(-) > >diff --git a/C4/VirtualShelves/Page.pm b/C4/VirtualShelves/Page.pm >index 6a4d431..6880297 100644 >--- a/C4/VirtualShelves/Page.pm >+++ b/C4/VirtualShelves/Page.pm >@@ -249,6 +249,7 @@ sub shelfpage { > my $items; > my $tag_quantity; > my $sortfield = ( $sorton ? $sorton : 'title' ); >+ $sortfield = $query->param('sort') || $sortfield; ## Passed in sorting overrides default sorting > ( $items, $totitems ) = GetShelfContents( $shelfnumber, $shelflimit, $shelfoffset, $sortfield ); > for my $this_item (@$items) { > my $biblionumber = $this_item->{'biblionumber'}; >@@ -419,7 +420,7 @@ sub shelfpage { > > my $url = $type eq 'opac' ? "/cgi-bin/koha/opac-shelves.pl" : "/cgi-bin/koha/virtualshelves/shelves.pl"; > my %qhash = (); >- foreach (qw(display viewshelf sortfield)) { >+ foreach (qw(display viewshelf sortfield sort)) { > $qhash{$_} = $query->param($_) if $query->param($_); > } > ( scalar keys %qhash ) and $url .= '?' . join '&', map { "$_=$qhash{$_}" } keys %qhash; >@@ -459,6 +460,7 @@ sub shelfpage { > barshelvesloop => $barshelves, > pubshelves => $total->{pubtotal}, > pubshelvesloop => $pubshelves, >+ sort => $query->param('sort'), > ); > > output_html_with_http_headers $query, $cookie, $template->output; >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/virtualshelves/shelves.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/virtualshelves/shelves.tt >index 81fe513..61488cc 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/virtualshelves/shelves.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/virtualshelves/shelves.tt >@@ -207,10 +207,22 @@ function placeHold () { > <tr> > [% IF ( itemsloop ) %]<th class="checkall"> </th>[% END %] > [% UNLESS ( item_level_itypes ) %]<th>Item type</th>[% END %] >- <th>Title</th> >- <th>Author</th> >+ <th> >+ [% IF sort == 'title' %]<i>[% END %] >+ <a href="/cgi-bin/koha/virtualshelves/shelves.pl?viewshelf=[% shelfnumber %]&sort=title">Title</a> >+ [% IF sort == 'title' %]</i>[% END %] >+ </th> >+ <th> >+ [% IF sort == 'author' %]<i>[% END %] >+ <a href="/cgi-bin/koha/virtualshelves/shelves.pl?viewshelf=[% shelfnumber %]&sort=author">Author</a> >+ [% IF sort == 'author' %]</i>[% END %] >+ </th> > <th>Date added</th> >- <th>Call number</th> >+ <th> >+ [% IF sort == 'itemcallnumber' %]<i>[% END %] >+ <a href="/cgi-bin/koha/virtualshelves/shelves.pl?viewshelf=[% shelfnumber %]&sort=itemcallnumber">Call number</a> >+ [% IF sort == 'itemcallnumber' %]</i>[% END %] >+ </th> > <th> </th> > </tr> > [% FOREACH itemsloo IN itemsloop %] >diff --git a/koha-tmpl/opac-tmpl/prog/en/modules/opac-shelves.tt b/koha-tmpl/opac-tmpl/prog/en/modules/opac-shelves.tt >index 8f31917..3747bc1 100644 >--- a/koha-tmpl/opac-tmpl/prog/en/modules/opac-shelves.tt >+++ b/koha-tmpl/opac-tmpl/prog/en/modules/opac-shelves.tt >@@ -287,6 +287,33 @@ $(function() { > > <a class="print" href="opac-shelves.pl" onclick="print(); return false;">Print list</a> > >+<form action="/cgi-bin/koha/opac-shelves.pl" id="sorting-form"> >+ <input type="hidden" name="viewshelf" value="[% shelfnumber %]" /> >+ >+ <label for="sort">Sort by: </label> >+ <select name="sort" onchange="$('#sorting-form').submit()"> >+ <option value="">Default sorting</option> >+ >+ [% IF sort == 'author' %] >+ <option value="author" selected="selected">Author</option> >+ [% ELSE %] >+ <option value="author">Author</option> >+ [% END %] >+ >+ [% IF sort == 'title' %] >+ <option value="title" selected="selected">Title</option> >+ [% ELSE %] >+ <option value="title">Title</option> >+ [% END %] >+ >+ [% IF sort == 'itemcallnumber' %] >+ <option value="itemcallnumber" selected="selected">Call number</option> >+ [% ELSE %] >+ <option value="itemcallnumber">Call number</option> >+ [% END %] >+ </select> >+</form> >+ > [% IF ( manageshelf ) %] <span class="sep">|</span> <form method="get" action="opac-shelves.pl"><input type="hidden" name="op" value="modif" /> > <input type="hidden" name="display" value="viewshelf" /> > <input type="hidden" name="shelfnumber" value="[% shelfnumber %]" /> <input type="submit" class="editshelf" value="Edit list" /></form> >-- >1.7.2.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 9458
:
14781
|
14790
|
14791
|
14792
|
15363
|
15543
|
15545
|
15554
|
15674
|
15675
|
15694
|
15891
|
15952
|
16031