From 0fcad140596b77665e098edfd6ed36000267247c Mon Sep 17 00:00:00 2001 From: Owen Leonard Date: Tue, 29 Jan 2008 00:13:38 -0600 Subject: [PATCH] Changing the way items are added to the cart and and lists from the searchresults page: Users now check items and choose from an 'add to...' dropdown which is populated with the logged-in user's lists. The add-to-shelf popup has been modified to accept a shelfnumber so that a users can add straight to the selected list. Signed-off-by: Chris Cormack Signed-off-by: Joshua Ferraro --- koha-tmpl/opac-tmpl/prog/en/css/opac.css | 27 ++++++++-- .../prog/en/includes/doc-head-close.inc | 1 + koha-tmpl/opac-tmpl/prog/en/js/script.js | 3 ++ .../en/modules/opac-addbybiblionumber.tmpl | 31 ++++++----- .../prog/en/modules/opac-results.tmpl | 52 +++++++++++-------- .../prog/en/modules/opac-shelves.tmpl | 8 +-- opac/opac-addbybiblionumber.pl | 25 +++++++-- 7 files changed, 100 insertions(+), 47 deletions(-) diff --git a/koha-tmpl/opac-tmpl/prog/en/css/opac.css b/koha-tmpl/opac-tmpl/prog/en/css/opac.css index 0ce0b5ae6a..193428d513 100644 --- a/koha-tmpl/opac-tmpl/prog/en/css/opac.css +++ b/koha-tmpl/opac-tmpl/prog/en/css/opac.css @@ -484,7 +484,7 @@ a .term { border-bottom : 1px solid #e8e8e8; font-size : 90%; margin : 0; - padding : .4em .2em; + padding : .7em .2em; text-align : center; } @@ -697,9 +697,30 @@ a.cancel { margin-right : .1em; } -.resultscontrol input, .resultscontrol label, .resultscontrol select { +.resultscontrol, .resultscontrol select { font-size: 90%; - margin-top : 4px; +} + +.cartlist { + margin-top : 5px; +} + +.cartlist input.submit { + background-color : #d8deb8; + color : #333; + font-size : 87%; + padding : 2px 0; + margin : 0 0 0 0; +} + +#CheckAll, #CheckNone { + font-weight : normal; + margin : 0 .5em; +} + +.resultscontrol label { + font-weight : bold; + margin-left : .5em; } .resort { diff --git a/koha-tmpl/opac-tmpl/prog/en/includes/doc-head-close.inc b/koha-tmpl/opac-tmpl/prog/en/includes/doc-head-close.inc index 21f4c5b4da..0bb0f8b0aa 100644 --- a/koha-tmpl/opac-tmpl/prog/en/includes/doc-head-close.inc +++ b/koha-tmpl/opac-tmpl/prog/en/includes/doc-head-close.inc @@ -1,5 +1,6 @@ +/includes/favicon.ico" type="image/x-icon" /> /opac-rss.pl?q=" /> /lib/yui/button.css" /> /lib/yui/menu.css" /> diff --git a/koha-tmpl/opac-tmpl/prog/en/js/script.js b/koha-tmpl/opac-tmpl/prog/en/js/script.js index 4330224b41..dab5beef6e 100644 --- a/koha-tmpl/opac-tmpl/prog/en/js/script.js +++ b/koha-tmpl/opac-tmpl/prog/en/js/script.js @@ -38,6 +38,9 @@ function Dopop(link) { $(document).ready(function(){ if(basketcount){ updateBasket(basketcount,document) } + $(".close").click(function(){ + window.close(); + }); }); YAHOO.util.Event.onContentReady("changelanguage", function () { diff --git a/koha-tmpl/opac-tmpl/prog/en/modules/opac-addbybiblionumber.tmpl b/koha-tmpl/opac-tmpl/prog/en/modules/opac-addbybiblionumber.tmpl index 4e65cbc77b..eaf957985d 100644 --- a/koha-tmpl/opac-tmpl/prog/en/modules/opac-addbybiblionumber.tmpl +++ b/koha-tmpl/opac-tmpl/prog/en/modules/opac-addbybiblionumber.tmpl @@ -8,10 +8,10 @@
- -

Add items to a list:

+ +

Add items to : a list:

-

Add to a list:

+

Add to a list:

  • @@ -25,12 +25,21 @@
    "> -
    Cancel
    +
    Cancel

    ...or...

    + + +
    + "> + " /> + +
    Cancel
    +
    + -
    +
    Add to a New List:
    "> -
    Cancel
    -
    +
    Cancel
    +



    - close this window. + close this window.

    - - diff --git a/koha-tmpl/opac-tmpl/prog/en/modules/opac-results.tmpl b/koha-tmpl/opac-tmpl/prog/en/modules/opac-results.tmpl index 038d64c975..6ce4bf665d 100644 --- a/koha-tmpl/opac-tmpl/prog/en/modules/opac-results.tmpl +++ b/koha-tmpl/opac-tmpl/prog/en/modules/opac-results.tmpl @@ -15,33 +15,42 @@ $(document).ready(function(){ $('#sort_by').change(function() { $('#bookbag_form').submit(); }); - $("span.bookbag").html(""); - $('#addMultiple').click(function(){ - addMultiple(); + $("span.clearall").html("Clear All"); + $("span.checkall").html("Select All"); + $("span.addto").html(" "); + $("#addto").change(function(){ + cartList(); + }); + $(".addto").find("input:submit").click(function(){ + cartList(); return false; - }) - $("span.lists").html(""); - $('#addtoList').click(function(){ - if (vShelfAdd()) { - Dopop('/cgi-bin/koha/opac-addbybiblionumber.pl?' + vShelfAdd()); + }); + function cartList(){ + if($("#addto").find("option:selected").attr("value") == "addtolist"){ + var shelfnumber = $("#addto").find("option:selected").attr("id").replace("s",""); + if (vShelfAdd()) { + Dopop('/cgi-bin/koha/opac-addbybiblionumber.pl?selectedshelf='+shelfnumber+'&' + vShelfAdd()); } alert('You must be logged in to create or add to Lists'); + return false; + } else if($("#addto").find("option:selected").attr("value") == "newlist"){ + if (vShelfAdd()) { + Dopop('/cgi-bin/koha/opac-addbybiblionumber.pl?newshelf=1&' + vShelfAdd()); + } alert('You must be logged in to create or add to Lists'); + return false; + } + if($("#addto").find("option:selected").attr("value") == "addtocart"){ + addMultiple(); return false; - }); - $("span.clearall").html(""); - $("span.checkall").html("\"Check\"Check"); - $('#CheckNone').hide(); + } + } $("#CheckAll").click(function(){ $("#bookbag_form").checkCheckboxes(); - $('#CheckAll').hide(); - $('#CheckNone').show(); return false; }); $("#CheckNone").click(function(){ $("#bookbag_form").unCheckCheckboxes(); - $('#CheckAll').show(); - $('#CheckNone').hide(); return false; - }); + }); }); @@ -147,10 +156,11 @@ $(document).ready(function(){ 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 a84b114f12..6e2c83f92a 100644 --- a/koha-tmpl/opac-tmpl/prog/en/modules/opac-shelves.tmpl +++ b/koha-tmpl/opac-tmpl/prog/en/modules/opac-shelves.tmpl @@ -32,13 +32,13 @@
    A record matching barcode has already been added.
    -

    Shelf Deleted.

    +
    Shelf Deleted.
    -

    ERROR: Database error. Delete (shelf number ) failed.

    +
    ERROR: Database error. Delete (shelf number ) failed.
    -

    ERROR: Shelf number unrecognized.

    +
    ERROR: Shelf number unrecognized.
    @@ -93,7 +93,7 @@
    - - - - +
    + +
    + +
    -
    This List is empty. You can add to your lists from the results of any search!
    +
    This List is empty. You can add to your lists from the results of any search!
    diff --git a/opac/opac-addbybiblionumber.pl b/opac/opac-addbybiblionumber.pl index 497b869b45..c2b719dda0 100755 --- a/opac/opac-addbybiblionumber.pl +++ b/opac/opac-addbybiblionumber.pl @@ -32,6 +32,8 @@ use C4::Output; my $query = new CGI; my @biblionumber = $query->param('biblionumber'); +my $selectedshelf = $query->param('selectedshelf'); +my $newshelf = $query->param('newshelf'); my $shelfnumber = $query->param('shelfnumber'); my $newvirtualshelf = $query->param('newvirtualshelf'); my $category = $query->param('category'); @@ -63,13 +65,23 @@ if ($shelfnumber && ($shelfnumber != -1)) { exit; } else { + if($selectedshelf){ + # adding to specific shelf + my ( $singleshelf, $singleshelfname, $singlecategory ) = GetShelf( $query->param('selectedshelf') ); + $template->param( + singleshelf => 1, + shelfnumber => $singleshelf, + shelfname => $singleshelfname, + "category$singlecategory" => 1 + ); + } else { + # offer choice of shelves my ($shelflist) = GetShelves( $loggedinuser, 3 ); my @shelvesloop; my %shelvesloop; foreach my $element ( sort keys %$shelflist ) { push( @shelvesloop, $element ); $shelvesloop{$element} = $shelflist->{$element}->{'shelfname'}; - } my $CGIvirtualshelves; if ( @shelvesloop > 0 ) { @@ -81,7 +93,13 @@ else { -tabindex => '', -multiple => 0 ); + + $template->param ( + CGIvirtualshelves => $CGIvirtualshelves, + ); + } } + } my @biblios; for my $bib (@biblionumber) { @@ -93,14 +111,11 @@ else { } ); } $template->param ( + newshelf => $newshelf, multiple => (scalar(@biblios) > 1), total => scalar @biblios, biblios => \@biblios, ); - $template->param ( - CGIvirtualshelves => $CGIvirtualshelves, - ); - output_html_with_http_headers $query, $cookie, $template->output; } -- 2.39.5