From 6d8f4f88686932d1972a1cf11c02d05485eabdab Mon Sep 17 00:00:00 2001 From: Owen Leonard Date: Tue, 4 Jan 2011 23:51:54 -0500 Subject: [PATCH] Fix for Bug 3347 - Inconsistencies with tables in opac-shelves.tmpl Changes to list contents view to make it consistent with search results My intention is to make the OPAC more consistent in the way it displays lists of items, whether it be in search results, lists, etc. This patch adds data to the list contents output and reformats it to that end. The other significant change is the removal of jQuery table sorting. Since list contents are both sorted and paginated on the server side. Adding a client-side sort to one page of many doesn't make sense. Other changes include: - Change "Your lists" to "Your private lists" - Remove "sort by" column because it seems unnecessary - Adding logic to control display of count (item or items rather than item(s) - Styling pagination bar and placing at the bottom of the page, consistent with other instances of pagination navigation Signed-off-by: Nicole Engard Signed-off-by: Chris Cormack --- C4/VirtualShelves.pm | 3 +- C4/VirtualShelves/Page.pm | 34 +++- koha-tmpl/opac-tmpl/prog/en/css/opac.css | 55 ++--- .../prog/en/modules/opac-shelves.tmpl | 190 ++++++++++++------ koha-tmpl/opac-tmpl/prog/images/download.png | Bin 369 -> 425 bytes 5 files changed, 171 insertions(+), 111 deletions(-) diff --git a/C4/VirtualShelves.pm b/C4/VirtualShelves.pm index 61dbaccc9a..77ae394b11 100644 --- a/C4/VirtualShelves.pm +++ b/C4/VirtualShelves.pm @@ -125,6 +125,7 @@ sub GetShelves ($$$$) { $firstname, $category, $sortfield, $count ) = $sth2->fetchrow ) { $shelflist{$shelfnumber}->{'shelfname'} = $shelfname; $shelflist{$shelfnumber}->{'count'} = $count; + if($count eq 1){ $shelflist{$shelfnumber}->{'single'} = 1; } $shelflist{$shelfnumber}->{'sortfield'} = $sortfield; $shelflist{$shelfnumber}->{'category'} = $category; $shelflist{$shelfnumber}->{'owner'} = $owner; @@ -265,7 +266,7 @@ sub GetShelfContents ($;$$$) { } my $query = " SELECT vc.biblionumber, vc.shelfnumber, vc.dateadded, itemtypes.*, - biblio.*, biblioitems.itemtype, biblioitems.publicationyear + biblio.*, biblioitems.itemtype, biblioitems.publicationyear, biblioitems.publishercode, biblioitems.place, biblioitems.size, biblioitems.pages FROM virtualshelfcontents vc LEFT JOIN biblio ON vc.biblionumber = biblio.biblionumber LEFT JOIN biblioitems ON biblio.biblionumber = biblioitems.biblionumber diff --git a/C4/VirtualShelves/Page.pm b/C4/VirtualShelves/Page.pm index 80d8f3c227..d6d0f7f7b9 100644 --- a/C4/VirtualShelves/Page.pm +++ b/C4/VirtualShelves/Page.pm @@ -31,6 +31,7 @@ use C4::Auth qw/get_session/; use C4::Members; use C4::Output; use C4::Dates qw/format_date/; +use C4::Tags qw(get_tags); use Exporter; use Data::Dumper; use C4::Csv; @@ -61,6 +62,7 @@ sub shelfpage ($$$$$) { my $itemoff = ( $query->param('itemoff') ? $query->param('itemoff') : 1 ); my $displaymode = ( $query->param('display') ? $query->param('display') : 'publicshelves' ); my ( $shelflimit, $shelfoffset, $shelveslimit, $shelvesoffset ); + my $marcflavour = C4::Context->preference("marcflavour"); # FIXME: These limits should not be hardcoded... $shelflimit = 20; # Limits number of items returned for a given query @@ -177,19 +179,20 @@ sub shelfpage ($$$$$) { # explicitly fetch this shelf my ($shelfnumber2,$shelfname,$owner,$category,$sorton) = GetShelf($shelfnumber); + $template->param( 'AllowOnShelfHolds' => C4::Context->preference('AllowOnShelfHolds') ); + if (C4::Context->preference('TagsEnabled')) { + $template->param(TagsEnabled => 1); + foreach (qw(TagsShowOnList TagsInputOnList)) { + C4::Context->preference($_) and $template->param($_ => 1); + } + } #check that the user can view the shelf if ( ShelfPossibleAction( $loggedinuser, $shelfnumber, 'view' ) ) { my $items; my $authorsort; my $yearsort; - my $sortfield; - if ( $query->param('sortfield')) { - $sortfield = $query->param('sortfield'); - } elsif ($sorton) { - $sortfield = $sorton; - } else { - $sortfield = 'title'; - } + my $tag_quantity; + my $sortfield = ( $query->param('sortfield') ? $query->param('sortfield') : 'title' ); if ( $sortfield eq 'author' ) { $authorsort = 'author'; } @@ -208,11 +211,22 @@ sub shelfpage ($$$$$) { $this_item->{'imageurl'} = getitemtypeinfo( $this_item->{'itemtype'} )->{'imageurl'}; $this_item->{'coins'} = GetCOinSBiblio( $this_item->{'biblionumber'} ); $this_item->{'subtitle'} = GetRecordValue('subtitle', $record, GetFrameworkCode($this_item->{'biblionumber'})); - + $this_item->{'normalized_upc'} = GetNormalizedUPC( $record,$marcflavour); + $this_item->{'normalized_ean'} = GetNormalizedEAN( $record,$marcflavour); + $this_item->{'normalized_oclc'} = GetNormalizedOCLCNumber($record,$marcflavour); + $this_item->{'normalized_isbn'} = GetNormalizedISBN(undef,$record,$marcflavour); # Getting items infos for location display my @items_infos = &GetItemsInfo( $this_item->{'biblionumber'}, $type ); + $this_item->{'itemsissued'} = CountItemsIssued( $this_item->{'biblionumber'} ); $this_item->{'ITEM_RESULTS'} = \@items_infos; + if (C4::Context->preference('TagsEnabled') and $tag_quantity = C4::Context->preference('TagsShowOnList')) { + $this_item->{'TagLoop'} = get_tags({ + biblionumber=>$this_item->{'biblionumber'}, approved=>1, 'sort'=>'-weight', + limit=>$tag_quantity + }); + } + } push @paramsloop, { display => 'privateshelves' } if $category == 1; $showadd = 1; @@ -265,7 +279,7 @@ sub shelfpage ($$$$$) { if ( my $count = scalar @$contents ) { unless ( scalar grep { /^CONFIRM-$number$/ } $query->param() ) { if ( defined $shelflist->{$number} ) { - push( @paramsloop, { need_confirm => $shelflist->{$number}->{shelfname}, count => $count } ); + push( @paramsloop, { need_confirm => $shelflist->{$number}->{shelfname}, count => $count, single => ($count eq 1 ? 1:0) } ); $shelflist->{$number}->{confirm} = $number; } else { push( @paramsloop, { need_confirm => $privshelflist->{$number}->{shelfname}, count => $count } ); diff --git a/koha-tmpl/opac-tmpl/prog/en/css/opac.css b/koha-tmpl/opac-tmpl/prog/en/css/opac.css index 4c7d6ada67..0a0b6350bc 100644 --- a/koha-tmpl/opac-tmpl/prog/en/css/opac.css +++ b/koha-tmpl/opac-tmpl/prog/en/css/opac.css @@ -443,6 +443,14 @@ a .term { /* toolbar buttons */ +#toolbar { +background-color:#EEEEEE; +border:1px solid #E8E8E8; +margin : .5em 0; +padding:3px 3px 5px 5px; +vertical-align:middle; +} + #toolbar a, #toolbar input { white-space : nowrap; @@ -1093,38 +1101,9 @@ td.resultscontrol img { line-height : 1.8em; text-align: center; } -a:link.current { - background-color: transparent; - color: #3366CC; - font-weight: bold; - padding: 1px 5px 1px 5px; - text-decoration: none; -} -a:visited.current { - background-color: transparent; - color: #3366CC; - font-weight: bold; - padding: 1px 5px 1px 5px; - text-decoration: none; -} - -a:hover.current { - background-color: #CCFF00; - color: #CC3333; - font-weight: bold; - padding: 1px 5px 1px 5px; - text-decoration: none; -} - -a:active.current { - background-color: #99CC00; - color: #FFFF99; - font-weight: bold; - padding: 1px 5px 1px 5px; - text-decoration: none; -} -.current { +.current, +.currentPage { background-color: #FFFFFF; color: #3366CC; font-weight: bold; @@ -1132,7 +1111,8 @@ a:active.current { text-decoration: none; } -a:link.nav { +a:link.nav, +div.pages a:link { background-color: #EEE; border: 1px solid #CCCC99; color: #3366CC; @@ -1141,7 +1121,8 @@ a:link.nav { text-decoration: none; } -a:visited.nav { +a:visited.nav, +div.pages a:visited { background-color: #EEE; border: 1px solid #CCCC99; color: #3366CC; @@ -1150,7 +1131,8 @@ a:visited.nav { text-decoration: none; } -a:hover.nav { +a:hover.nav, +div.pages a:hover { background-color: #FFFFCC; border: 1px solid #CCCC99; color: #CC3333; @@ -1159,7 +1141,8 @@ a:hover.nav { text-decoration: none; } -a:active.nav { +a:active.nav, +div.pages a:active { background-color: #FFFFCC; border: 1px solid #CCCC99; color: #D25500; @@ -2005,4 +1988,4 @@ div.ft { #plainmarc table { border: 0; margin: .7em 0 0 0; font-family: monospace; font-size: 95%; } #plainmarc th { background-color : #FFF; border: 0; white-space: nowrap; text-align:left; vertical-align: top; padding: 2px; } -#plainmarc td { border: 0; padding : 2px; vertical-align: top; } \ No newline at end of file +#plainmarc td { border: 0; padding : 2px; vertical-align: top; } 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 7013a1c8aa..3c04429baf 100644 --- a/koha-tmpl/opac-tmpl/prog/en/modules/opac-shelves.tmpl +++ b/koha-tmpl/opac-tmpl/prog/en/modules/opac-shelves.tmpl @@ -6,12 +6,7 @@ var MSG_NO_TAG_SPECIFIED = _("No tag was specified."); var MSG_REMOVE_FROM_LIST = _("Are you sure you want to remove these items from the list?"); var MSG_CONFIRM_DELETE_LIST = _("Are you sure you want to delete this list?"); -$.tablesorter.addParser({ - id: 'articles', - is: function(s) {return false; }, - format: function(s) { return s.toLowerCase().replace(/^(the|an|a) /,''); }, - type: 'text' -}); + function holdSelections() { var checkedBoxes = $(":checkbox:checked"); @@ -69,26 +64,17 @@ function tagAdded() { } $(function() { + $(".addtocart").show(); $("span.clearall").html(""+_('Clear All')+"<\/a>|"); $("span.checkall").html(""+_('Select All')+"<\/a>"); $("a.print").show(); + $("#placehold").html(""+_('Place Hold')+"<\/a>"); $("a.hold").click(function(){ holdSelections(); return false; }); - $("#listcontents").tablesorter({ - widgets : ['zebra'], - - sortList: [[2,0]], - - sortList: [[3,1]], - - sortList: [[1,0]], - - headers: { 0: { sorter: false },1:{sorter: 'articles'} - } - }); + $("#CheckAll").click(function(){ $(".checkboxed").checkCheckboxes(); return false; @@ -97,17 +83,38 @@ $(function() { $(".checkboxed").unCheckCheckboxes(); return false; }); + $("#addtags").click(function(){ tagSelected(); return false; }); $("#addtags").html(""+_("Tag")+"<\/a> |"); + + $(".tagbutton").click(KOHA.Tags.add_tag_button); + + + $("#tagsel_tag").click(function(){ + tagSelected(); + return false; + }); + $("#tagsel_cancel").click(function(){ + tagCanceled(); + return false; + }); $("#tagsel_button").click(function(){ tagAdded(); return false; }); - + + $("#tagsel_tag").click(function(){ + window.location = "/cgi-bin/koha/opac-user.pl"; + return false; + }); + + + + KOHA.Google.GetCoverFromIsbn(); }); function Check(f) { var _alertString=""; @@ -148,7 +155,7 @@ $(function() {
The list is not empty. -
It has entries. +
It has entryentries.
Use the "Confirm" button below to confirm deletion.
@@ -176,7 +183,6 @@ $(function() {
-

Lists /../images/caret.gif" width="16" height="16" alt=">" border="0" />

@@ -223,16 +229,8 @@ $(function() { " /> - +
- - - - - - - - @@ -250,35 +248,105 @@ $(function() { - - - - +
 Item TypeTitleAuthorYearLocation
"> - "> "> + + " title="View details for this title"> + + " title="View details for this title"> + " title="View details for this title"> + + + No title + by " title="Search for works by this author" class="author"> +   + + Publication: + + + . + , + + + Holdings: + , + + ()., + + This record has no items. + + + + +
+ Tags: + + + + +
" method="post" action="/cgi-bin/koha/opac-tags.pl"> + + " id="newtag" maxlength="100" /> + " type="submit" value="Add" /> +
+ _status" class="tagstatus" style="display:none;"> + Tag status here. + + Log in to add tags. + + + +
+ + + +Actions: + + + + + ">Place Hold + + + ">Place Hold + + + + + + + " onclick="Dopop('opac-addbybiblionumber.pl?biblionumber='); return false;">Save to another list + + + '); return false;">Add to Cartnocart + + + + ">
_status" class="tagstatus results_summary" style="display:none">Tag status here.
- - - - - - - -

- , - - () - -

- This record has no items. -
+ "> + .01.TZZZZZZZ.jpg" alt="" class="thumbnail" />No cover image available + + + /SC.GIF&client=&type=xw10&upc=&oclc=" alt="" class="thumbnail" /> + + /SC.GIF&client=&type=xw10&upc=&oclc=" alt="" class="thumbnail" /> + +
" class="" id="gbs-thumbnail">
No cover image available +
+ ">See Baker & Taylor" />No cover image available +
+
+
This List is empty. You can add to your lists from the results of any search!
@@ -338,14 +406,14 @@ $(function() {

Lists

@@ -359,12 +427,10 @@ $(function() { - - @@ -375,9 +441,7 @@ $(function() { - - +
List Name ContentsSort by Type  
&sortfield="> item(s)AuthorYearTitle - itemitemsEmpty Private Public @@ -407,6 +471,7 @@ $(function() {
+
No Private Lists. @@ -429,12 +494,10 @@ $(function() {
Log in to create new Lists.
- - @@ -444,9 +507,7 @@ $(function() { - - +
List Name ContentsSort by Type 
&sortfield="> item(s)AuthorYearTitle - itemitem(s) Private Public @@ -474,6 +535,7 @@ $(function() {
+
No Public Lists. diff --git a/koha-tmpl/opac-tmpl/prog/images/download.png b/koha-tmpl/opac-tmpl/prog/images/download.png index bf1394d0c3a442ff33170c608aabe262ce0851c5..0d5bcb89a59037437ffceaa95099057b805c46b3 100644 GIT binary patch delta 345 zcmey!w32y3WPL?|Pl&6cfBn~A{}lb}mL9yT6xgJjFtKj-_OIVAzWDT4Ewr_6*7o0j z|7*weKKk(I{kMO52@^xAm+UzI%pq^i|NsA=fBLH((-%^+C<*cl2AV|- zVA!`xPXef?+0(@_q~camKzMj~Kmfxe2F4={M|=(`2q`o;L`<5^>cPY!(7dZ>kImve zJj<;d7z|gOKK1dWr}ybq%q#){)7)E}V?ttOgA^Jhu84|8R{j(fy~@bc(dZi*8p_nM zlYyzj(bZLwBXr7Cps1rmXRN2E=Y&Wekn$^6mb5HsP;qErWTOV delta 289 zcmV++0p9+p1MvcoS$}mxhTQ4)A5DBHSc*MtoF!F- z-0Ao3_WgL4v`%-S?)LuO>Gq<(+xz|h=<@t8VwFB@o9OcWBT<3%`u^|s{vuI=VTGwC zRfXd4{Pp(GD_o5sPk$?1j