Koha/koha-tmpl/opac-tmpl/prog/en/modules/opac-basket.tt
Owen Leonard 5528b06fda Bug 7461 - Cart offering to remove items when closing
The "hide window" button in the cart called a quit() function
which deletes any checked items. My understanding of the "hide
window" button is that it should *only* hide the window, not
perform any other operations. I'm removing the calls to the
quit() function in both the OPAC and staff client and adding
a CSS class, "close," which is already tied via jQuery to
the window.close() function.

To test in both OPAC and staff client: Add items to the cart.
Try clicking the "hide window" button with items selected and
without. In both cases the window should close without affecting
the contents of the cart.

Signed-off-by: Nicole C. Engard <nengard@bywatersolutions.com>
Signed-off-by: Paul Poulain <paul.poulain@biblibre.com>
2012-02-03 15:13:10 +01:00

390 lines
16 KiB
Text

[% INCLUDE 'doc-head-open.inc' %]
[% IF ( LibraryNameTitle ) %][% LibraryNameTitle %][% ELSE %]Koha Online[% END %] Catalog &rsaquo; Your Cart
[% IF ( print_basket ) %]</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<link rel="shortcut icon" href="[% themelang %]/includes/favicon.ico" type="image/x-icon" />
<meta http-equiv="Content-Language" content="en-us" />
<script type="text/javascript" src="[% themelang %]/lib/jquery/jquery.js"></script>
<script type="text/javascript">
//<![CDATA[
$(document).ready(function(){
print();
location.href="/cgi-bin/koha/opac-basket.pl?bib_list=[% bib_list %][% IF ( verbose ) %]&verbose=1[% END %]";
});
//]]>
</script>
<style type="text/css">
@import url([% themelang %]/css/print.css);
</style>
[% ELSE %][% INCLUDE 'doc-head-close.inc' %]
<script type="text/javascript" src="[% themelang %]/lib/jquery/plugins/jquery.checkboxes.min.js"></script>
<script type="text/javascript" src="[% themelang %]/lib/jquery/plugins/jquery.tablesorter.min.js"></script>
<script type="text/javascript">
//<![CDATA[
$(document).ready(function()
{
$("#itemst").tablesorter({
headers: { 0: { sorter: false },4:{sorter:false}}
});
}
);
[% IF ( opacuserlogin ) %][% IF ( loggedinusername ) %][% IF ( TagsEnabled ) %]
var MSG_NO_TAG_SPECIFIED = _("No tag was specified.");
function tagSelected() {
var bibs = document.getElementById('records').value;
if (bibs) {
$("#tagsel_tag").hide();
$("#tag_hides").hide();
$("#tagsel_form").show();
} else {
alert(MSG_NO_RECORD_SELECTED);
}
}
function tagCanceled() {
$("#tagsel_form").hide();
$("#tagsel_tag").show();
$("#tag_hides").show();
}
function tagAdded() {
var checkedBoxes = $("input:checkbox:checked");
if (!$(checkedBoxes).size()) {
alert(MSG_NO_RECORD_SELECTED);
return false;
}
var tag = $("#tagsel_new").val();
if (!tag || (tag == "")) {
alert(MSG_NO_TAG_SPECIFIED);
return false;
}
var bibs = [];
for (var i = 0; i < $(checkedBoxes).size(); i++) {
var box = $(checkedBoxes).get(i);
bibs[i] = $(box).val();
}
KOHA.Tags.add_multitags_button(bibs, tag);
return false;
}
[% END %][% END %][% END %]
$(document).ready(function(){
$("#CheckAll").click(function(){
var checked = [];
$("#bookbag_form").checkCheckboxes("*", true).each(
function() {
selRecord(this.value,true);
}
);
return false;
});
$("#CheckNone").click(function(){
var checked = [];
$("#bookbag_form").unCheckCheckboxes("*",true).each(
function() {
selRecord(this.value,false);
}
);
return false;
});
[% IF ( opacuserlogin ) %][% IF ( loggedinusername ) %][% IF ( TagsEnabled ) %]
$("#tagsel_button").click(function(){
tagAdded();
return false;
});
[% END %][% END %][% END %]
});
[% IF ( opacuserlogin ) %][% IF ( RequestOnOpac ) %]
function holdSel() {
var items = document.getElementById('records').value;
if (items) {
document.location = "/cgi-bin/koha/opac-reserve.pl?biblionumbers=" + items;
} else {
alert(MSG_NO_RECORD_SELECTED);
}
}
[% END %][% END %]
//]]>
</script>
[% END %]
</head>
<body id="basket">
<div id="doc" class="yui-t7">
<div id="userbasket" class="container">
<h2>Your Cart</h2>
[% UNLESS ( print_basket ) %]
<div id="toolbar">
<ul>
<li>[% IF ( verbose ) %]<a href="opac-basket.pl" class="brief" onclick="showLess(); return false;">Brief Display</a>[% ELSE %]<a href="opac-basket.pl" class="detail" onclick="showMore(); return false;">More Details</a>[% END %]</li>
<li><a class="send" href="opac-basket.pl" onclick="sendBasket(); return false;">Send</a></li>
<li><a class="download" href="opac-basket.pl" onclick="downloadBasket(); return false;">Download</a></li>
<li><a class="print" href="opac-basket.pl" onclick="printBasket(); return false;">Print</a></li>
<li><a class="empty" href="opac-basket.pl" onclick="delBasket(); return false;">Empty and Close</a></li>
<li><a class="hide close" href="opac-basket.pl">Hide Window</a></li>
</ul>
</div>
[% END %]
[% IF ( verbose ) %]
[% UNLESS ( print_basket ) %]<p style="padding: 7px 0; border-top : 1px solid #E8E8E8;"><a id="CheckAll" href="#">Select All</a> <a id="CheckNone" href="#">Clear All</a> | <b>Selected items :</b>
<span id="tag_hides">
<a href="#" onclick="delSelRecords(); return false;">Remove</a>
[% IF ( opacuserlogin ) %]
[% IF ( virtualshelves ) %][% IF ( loggedinusername ) %]
| <a href="#" onclick="addSelToShelf(); return false;">Add to a list</a>
[% END %][% END %]
[% IF ( RequestOnOpac ) %]| <a href="#" onclick="holdSel(); return false;">Place hold</a>[% END %]
[% IF ( loggedinusername ) %][% IF ( TagsEnabled ) %]
| <a href="#" onclick="tagSelected(); return false;">Tag</a>[% END %][% END %]
[% END %]
</span>
<span id="tagsel_form" style="display:none">
<label for="tagsel_new" style="display:inline">New&nbsp;Tag:</label>
<input name="tagsel_new" id="tagsel_new" maxlength="100" style="display:inline"/>
<input id="tagsel_button" name="tagsel_button" class="input tagsel_button" title="tagsel_button"
type="submit" value="Add" style="display:inline" />
<a href="#" id="tagsel_cancel" onclick="tagCanceled(); return false;" style="display:inline">Cancel</a>
</span>
</p>[% END %]
<form action="opac-basket.pl" method="get" name="bookbag_form" id="bookbag_form">
[% FOREACH BIBLIO_RESULT IN BIBLIO_RESULTS %]
<h3>
[% IF ( print_basket ) %]
[% BIBLIO_RESULT.title |html %]
[% IF ( BIBLIO_RESULT.subtitle ) %] [% FOREACH subtitl IN BIBLIO_RESULT.subtitle %][% subtitl.subfield |html %][% END %][% END %]
[% IF ( BIBLIO_RESULT.author ) %] [% BIBLIO_RESULT.author |html %][% END %]
[% ELSE %]
<input type="checkbox" value="[% BIBLIO_RESULT.biblionumber %]" name="bib[% BIBLIO_RESULT.biblionumber %]" id="bib[% BIBLIO_RESULT.biblionumber %]" onclick="selRecord(value,checked)" />
[% BIBLIO_RESULT.title |html %]
[% IF ( BIBLIO_RESULT.subtitle ) %] [% FOREACH subtitl IN BIBLIO_RESULT.subtitle %][% subtitl.subfield |html %][% END %][% END %]
[% IF ( BIBLIO_RESULT.author ) %] [% BIBLIO_RESULT.author |html %][% END %]
[% END %]
</h3>
<!-- COinS / Openurl -->
<span class="Z3988" title="ctx_ver=Z39.88-2004&amp;rft_val_fmt=info%3Aofi%2Ffmt%3Akev%3Amtx%3Abook&amp;rft.au=[% BIBLIO_RESULT.author %]&amp;rft.btitle=[% BIBLIO_RESULT.title |url %]&amp;rft.date=[% BIBLIO_RESULT.publicationyear %]&amp;rft.tpages=[% BIBLIO_RESULT.size %]&amp;rft.isbn=[% BIBLIO_RESULT.isbn |url %]&amp;rft.aucorp=&amp;rft.place=[% BIBLIO_RESULT.place %]&amp;rft.pub=[% BIBLIO_RESULT.publisher |url %]&amp;rft.edition=[% BIBLIO_RESULT.edition %]&amp;rft.series=[% BIBLIO_RESULT.series %]&amp;rft.genre="></span>
<table>
[% IF ( BIBLIO_RESULT.isbn ) %]
<tr>
<th scope="row">ISBN</th>
<td>[% BIBLIO_RESULT.isbn %]</td>
</tr>
[% END %]
[% IF ( BIBLIO_RESULT.HASAUTHORS ) %]
<tr>
<th scope="row">Author(s)</th>
<td>
[% IF ( BIBLIO_RESULT.author ) %]
<p>[% BIBLIO_RESULT.author %]</p>
[% END %]
[% IF ( BIBLIO_RESULT.MARCAUTHORS ) %]
[% FOREACH MARCAUTHOR IN BIBLIO_RESULT.MARCAUTHORS %]
<p> [% FOREACH MARCAUTHOR_SUBFIELDS_LOO IN MARCAUTHOR.MARCAUTHOR_SUBFIELDS_LOOP %]
[% MARCAUTHOR_SUBFIELDS_LOO.separator %]
[% MARCAUTHOR_SUBFIELDS_LOO.value %]
[% END %]
</p>
[% END %]
[% END %]
</td>
</tr>
[% END %]
[% IF ( BIBLIO_RESULT.publishercode ) %]
<tr>
<th scope="row">Publisher</th>
<td>[% BIBLIO_RESULT.place %] [% BIBLIO_RESULT.publishercode %] [% BIBLIO_RESULT.publicationyear %]
</td>
</tr>
[% END %]
[% IF ( BIBLIO_RESULT.pages ) %]
<tr>
<th scope="row">Details</th>
<td>[% BIBLIO_RESULT.pages %] [% BIBLIO_RESULT.illus %] [% BIBLIO_RESULT.size %]</td>
</tr>
[% END %]
[% IF ( BIBLIO_RESULT.seriestitle ) %]
<tr>
<th scope="row">Collection</th>
<td> [% BIBLIO_RESULT.seriestitle %]</td>
</tr>
[% END %]
[% IF ( BIBLIO_RESULT.MARCSUBJCTS ) %]
<tr>
<th scope="row">Subject(s)</th>
<td>[% FOREACH MARCSUBJCT IN BIBLIO_RESULT.MARCSUBJCTS %]
<p> [% FOREACH MARCSUBJECT_SUBFIELDS_LOO IN MARCSUBJCT.MARCSUBJECT_SUBFIELDS_LOOP %]
[% MARCSUBJECT_SUBFIELDS_LOO.separator %][% MARCSUBJECT_SUBFIELDS_LOO.value %][% END %]
</p>
[% END %]</td>
</tr>
[% END %]
[% IF ( BIBLIO_RESULT.copyrightdate ) %]
<tr><th scope="row">Copyright</th>
<td> [% BIBLIO_RESULT.copyrightdate %]</td>
</tr>
[% END %]
[% IF ( BIBLIO_RESULT.MARCNOTES ) %]
<tr>
<th scope="row">Notes</th>
<td>
[% FOREACH MARCNOTE IN BIBLIO_RESULT.MARCNOTES %]
<p>- [% MARCNOTE.marcnote %]</p>
[% END %]</td>
</tr>
[% END %]
[% IF ( BIBLIO_RESULT.unititle ) %]
<tr>
<th scope="row">Unified title</th>
<td> [% BIBLIO_RESULT.unititle %]</td>
</tr>
[% END %]
[% IF ( BIBLIO_RESULT.serial ) %]
<tr>
<th scope="row">Serial</th>
<td>[% BIBLIO_RESULT.serial %]</td>
</tr>
[% END %]
[% IF ( BIBLIO_RESULT.dewey ) %]
<tr>
<th scope="row">Dewey</th>
<td>[% BIBLIO_RESULT.dewey %]</td>
</tr>
[% END %]
[% IF ( BIBLIO_RESULT.classification ) %]
<tr>
<th scope="row">Classification</th>
<td> [% BIBLIO_RESULT.classification %]</td>
</tr>
[% END %]
[% IF ( BIBLIO_RESULT.lccn ) %]
<tr>
<th scope="row">LCCN</th>
<td> [% BIBLIO_RESULT.lccn %]</td>
</tr>
[% END %]
[% IF ( BIBLIO_RESULT.MARCurlS ) %]
<tr>
<th scope="row">url(s)</th>
<td>
[% FOREACH MARCurl IN BIBLIO_RESULT.MARCurlS %]
<p>[% IF ( MARCurl.part ) %][% MARCurl.part %]
<br />[% END %]
[% MARCurl.MARCurl %]
[% IF ( MARCurl.notes ) %][% FOREACH note IN MARCurl.notes %][% note.note %]<br />[% END %][% END %]
[% END %]</p></td>
</tr>[% END %]
<tr>
<th scope="row">Location(s)</th>
<td>[% IF ( BIBLIO_RESULT.ITEM_RESULTS ) %]<ul>[% FOREACH ITEM_RESULT IN BIBLIO_RESULT.ITEM_RESULTS %]
<li>
<strong>[% ITEM_RESULT.homebranch %]</strong>[% IF ( ITEM_RESULT.location_opac ) %], [% ITEM_RESULT.location_opac %][% END %]
[% IF ( ITEM_RESULT.itemcallnumber ) %]
([% ITEM_RESULT.itemcallnumber %])
[% END %]
</li>
[% END %]</ul>[% ELSE %]This record has no items.[% END %]</td>
</tr>
</table>
[% END %]
</form>
[% ELSE %]
[% UNLESS ( print_basket ) %]
<form action="/cgi-bin/koha/opac-basket.pl" method="get" name="bookbag_form" id="bookbag_form">
<p style="border-top : 1px solid #E8E8E8;padding:5px 0;">
<a id="CheckAll" href="#">Select All</a>
<a id="CheckNone" href="#">Clear All</a>
| <b>Selected items :</b>
<span id="tag_hides">
<a href="#" onclick="delSelRecords(); return false;">Remove</a>
[% IF ( opacuserlogin ) %]
[% IF ( virtualshelves ) %][% IF ( loggedinusername ) %]
| <a href="#" onclick="addSelToShelf(); return false;">Add to a list</a>
[% END %][% END %]
[% IF ( RequestOnOpac ) %]| <a href="#" onclick="holdSel(); return false;">Place hold</a>[% END %]
[% IF ( loggedinusername ) %][% IF ( TagsEnabled ) %]
| <a href="#" onclick="tagSelected(); return false;">Tag</a>[% END %][% END %]
[% END %]
</span>
[% IF ( opacuserlogin ) %][% IF ( loggedinusername ) %][% IF ( TagsEnabled ) %]<span id="tagsel_form" style="display:none">
<label for="tagsel_new" style="display:inline">New&nbsp;Tag:</label>
<input name="tagsel_new" id="tagsel_new" maxlength="100" style="display:inline"/>
<input id="tagsel_button" name="tagsel_button" class="input tagsel_button" title="tagsel_button" type="submit" value="Add" style="display:inline"/>
<a href="#" id="tagsel_cancel" onclick="tagCanceled(); return false;" style="display:inline">Cancel</a>
</span>[% END %][% END %][% END %]
</p>
[% END %]
<table id="itemst">
<thead><tr>
[% UNLESS ( print_basket ) %]<th>&nbsp;</th>[% END %]
<th>Title</th>
<th>Author</th>
<th>Year</th>
<th>Location</th>
</tr></thead>
[% FOREACH BIBLIO_RESULT IN BIBLIO_RESULTS %]
[% IF ( BIBLIO_RESULT.even ) %]
<tr class="highlight">
[% ELSE %]
<tr>
[% END %]
[% UNLESS ( print_basket ) %]<td>
<input type="checkbox" value="[% BIBLIO_RESULT.biblionumber %]" name="bib[% BIBLIO_RESULT.biblionumber %]" id="bib[% BIBLIO_RESULT.biblionumber %]" onclick="selRecord(value,checked);" />
</td> [% END %]
<td>
<a href="#" onclick="openBiblio('[% BIBLIO_RESULT.dest %]',[% BIBLIO_RESULT.biblionumber %])">
[% BIBLIO_RESULT.title |html %][% IF ( BIBLIO_RESULT.subtitle ) %] [% FOREACH subtitl IN BIBLIO_RESULT.subtitle %][% subtitl.subfield |html %][% END %][% END %]
</a>
<!-- COinS / Openurl -->
<span class="Z3988" title="ctx_ver=Z39.88-2004&amp;rft_val_fmt=info%3Aofi%2Ffmt%3Akev%3Amtx%3Abook&amp;rft.au=[% BIBLIO_RESULT.author %]&amp;rft.btitle=[% BIBLIO_RESULT.title |url %]&amp;rft.date=[% BIBLIO_RESULT.publicationyear %]&amp;rft.tpages=[% BIBLIO_RESULT.size %]&amp;rft.isbn=[% BIBLIO_RESULT.isbn |url %]&amp;rft.aucorp=&amp;rft.place=[% BIBLIO_RESULT.place %]&amp;rft.pub=[% BIBLIO_RESULT.publisher |url %]&amp;rft.edition=[% BIBLIO_RESULT.edition %]&amp;rft.series=[% BIBLIO_RESULT.series %]&amp;rft.genre="></span>
[% IF ( opacuserlogin ) %][% IF ( loggedinusername ) %][% IF ( TagsEnabled ) %]<div id="newtag[% BIBLIO_RESULT.biblionumber %]_status" class="tagstatus results_summary" style="display:none">Tag status here.</div>[% END %][% END %][% END %]
</td>
<td>[% BIBLIO_RESULT.author %]</td>
<td>
[% IF ( BIBLIO_RESULT.publicationyear ) %]
[% BIBLIO_RESULT.publicationyear %]
[% ELSE %]
[% BIBLIO_RESULT.copyrightdate %]
[% END %]
</td>
<td>[% IF ( BIBLIO_RESULT.ITEM_RESULTS ) %]<ul>[% FOREACH ITEM_RESULT IN BIBLIO_RESULT.ITEM_RESULTS %]
<li>
[% ITEM_RESULT.homebranch %][% IF ( ITEM_RESULT.location_opac ) %], [% ITEM_RESULT.location_opac %][% END %]
[% IF ( ITEM_RESULT.itemcallnumber ) %]
([% ITEM_RESULT.itemcallnumber %])
[% END %]
</li>
[% END %]</ul>[% ELSE %]This record has no items.[% END %]</td>
</tr>
[% END %]
</table></form>
[% END %]
[% UNLESS ( print_basket ) %]
<form name="myform" action="opac-basket.pl" method="get">
<input type="hidden" name="records" id="records" />
</form>
[% END %]
</div>
</div>
</body>
</html>