[Koha-patches] [PATCH] bug 3034: Tag multiple items at once.
Stephen Edwards
sedwards at alloycomputing.com
Wed Apr 1 19:19:35 CEST 2009
Added a "Tag" button in the toolbar area of the results
page. This activates an inline form that allows the user
to enter a tag that can then be applied to all currently
selected items.
In addition, a "Tag" link has been added to both the List and
Cart pages that provides the same functionality in those contexts.
In these two cases, the a per-item states appears below the
bibliographic information for each item.
Status that applies to the overall operation, such as failing to
provide a tag, will be shown in an alert dialog box.
---
koha-tmpl/opac-tmpl/prog/en/css/opac.css | 2 +-
koha-tmpl/opac-tmpl/prog/en/js/tags.js | 86 +++-
.../opac-tmpl/prog/en/modules/opac-basket.tmpl | 88 +++-
.../opac-tmpl/prog/en/modules/opac-reserve.tmpl | 14 +-
.../opac-tmpl/prog/en/modules/opac-results.tmpl | 85 +++-
.../opac-tmpl/prog/en/modules/opac-shelves.tmpl | 765 ++++++++++++--------
opac/opac-basket.pl | 6 +
opac/opac-tags.pl | 46 ++-
8 files changed, 760 insertions(+), 332 deletions(-)
diff --git a/koha-tmpl/opac-tmpl/prog/en/css/opac.css b/koha-tmpl/opac-tmpl/prog/en/css/opac.css
index cb5697a..6bf54e0 100644
--- a/koha-tmpl/opac-tmpl/prog/en/css/opac.css
+++ b/koha-tmpl/opac-tmpl/prog/en/css/opac.css
@@ -870,7 +870,7 @@ td.resultscontrol img {
color:#006699;
}
-.unavailable {
+.unavailable, .tagerror, .tagerror:visited {
color: #990033;
}
diff --git a/koha-tmpl/opac-tmpl/prog/en/js/tags.js b/koha-tmpl/opac-tmpl/prog/en/js/tags.js
index e27447d..83f5be8 100644
--- a/koha-tmpl/opac-tmpl/prog/en/js/tags.js
+++ b/koha-tmpl/opac-tmpl/prog/en/js/tags.js
@@ -63,6 +63,10 @@ KOHA.Tags = {
$(tagid).html(newstatus);
$(tagid).css({display:"inline"});
},
+ append_tag_status : function(tagid, newstatus) {
+ $(tagid).append(newstatus);
+ $(tagid).css({display:"inline"});
+ },
tag_message: {
tagsdisabled : function(arg) {return (_("Sorry, tags are not enabled on this system."));},
@@ -70,7 +74,85 @@ KOHA.Tags = {
badparam : function(arg) {return (_("Error! Illegal parameter '" +arg+ "'."));},
scrubbed : function(arg) {return (_("Note: your tag contained markup code that was removed. The tag was added as '" +arg+ "'."));},
failed_add_tag : function(arg) {return (_("Error! The add_tag operation failed on '" +arg+ "'. Note: you can only tag an item with a given term once. Check 'My Tags' to see your current tags."));},
- failed_delete : function(arg) {return (_("Error! You cannot delete the tag '" +arg+ "'. Note: you can only delete your own tags."));}
- }
+ failed_delete : function(arg) {return (_("Error! You cannot delete the tag '" +arg+ "'. Note: you can only delete your own tags."));},
+ login : function(arg) {return (_("You must be logged in to add tags."));},
+ },
+
+ // Used to tag multiple items at once. The main difference
+ // is that status is displayed on a per item basis.
+ add_multitags_button : function(bibarray, tag){
+ var mydata = {CGISESSID: readCookie('CGISESSID')}; // Someday this should be OPACSESSID
+ for (var i = 0; i < bibarray.length; i++) {
+ var mynewtag = "newtag" + bibarray[i];
+ mydata[mynewtag] = tag;
+ }
+ var response; // AJAX from server will assign value to response.
+ $.post(
+ "/cgi-bin/koha/opac-tags.pl",
+ mydata,
+ function(data){
+ eval(data);
+ $(".tagstatus").empty();
+ var bibErrors = false;
+
+ // Display the status for each tagged bib
+ for (var i = 0; i < bibarray.length; i++) {
+ var bib = bibarray[i];
+ var mytagid = "#newtag" + bib;
+ var status = "";
+
+ // Number of tags added.
+ if (response[bib]) {
+ var added = response[bib]["added"];
+ if (added > 0) {
+ status = "Added " + added + (added == 1 ? " tag" : " tags") + ". ";
+ KOHA.Tags.set_tag_status(mytagid + "_status", status);
+ }
+
+ // Show a link that opens an error dialog, if necessary.
+ var errors = response[bib]["errors"];
+ if (errors.length > 0) {
+ bibErrors = true;
+ var errid = "tagerr_" + bib;
+ var errstat = "<a id=\"" + errid + "\" class=\"tagerror\" href=\"#\">";
+ errstat += "Error" + (errors.length > 1 ? "s" : "") + " adding tag.";
+ errstat += "</a>";
+ KOHA.Tags.append_tag_status(mytagid + "_status", errstat);
+ var errmsg = "";
+ for (var e = 0; e < errors.length; e++){
+ if (e) {
+ errmsg += "\n\n";
+ }
+ errmsg += errors[e];
+ }
+ $("#" + errid).click(function(){
+ alert(errmsg);
+ });
+ }
+ }
+ }
+
+ if (bibErrors || response["global_errors"]) {
+ var msg = "";
+ if (bibErrors) {
+ msg = "Unable to add one or more tags.";
+ }
+
+ // Show global errors in a dialog.
+ if (response["global_errors"]) {
+ var global_errors = response["global_errors"];
+ var msg;
+ for (var e = 0; e < global_errors.length; e++) {
+ msg += "\n\n";
+ msg += response.alerts[global_errors[e]];
+ }
+ }
+ alert(msg);
+ }
+ },
+ 'script'
+ );
+ return false;
+ }
};
diff --git a/koha-tmpl/opac-tmpl/prog/en/modules/opac-basket.tmpl b/koha-tmpl/opac-tmpl/prog/en/modules/opac-basket.tmpl
index f575d7c..a102457 100644
--- a/koha-tmpl/opac-tmpl/prog/en/modules/opac-basket.tmpl
+++ b/koha-tmpl/opac-tmpl/prog/en/modules/opac-basket.tmpl
@@ -11,6 +11,52 @@
<script type="text/javascript" src="<!-- TMPL_VAR name="themelang" -->/lib/jquery/plugins/jquery.checkboxes.pack.js"></script>
<script type="text/javascript">
//<![CDATA[
+var MSG_NO_TAG_SPECIFIED = _("No tag was specified.");
+
+function tagSelected() {
+ <!-- TMPL_IF NAME="loggedinusername" -->
+ var bibs = document.getElementById('records').value;
+ if (bibs) {
+ $("#tagsel_tag").hide();
+ $("#tag_hides").hide();
+ $("#tagsel_form").show();
+ } else {
+ alert(MSG_NO_RECORD_SELECTED);
+ }
+ <!-- TMPL_ELSE -->
+ window.location = "/cgi-bin/koha/opac-user.pl";
+ <!-- /TMPL_IF -->
+}
+
+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;
+}
+
$(document).ready(function(){
$("#CheckAll").click(function(){
var checked = [];
@@ -32,8 +78,20 @@
});
$(".holdsep").text("| ");
$(".hold").text("Place Hold");
-
+
+ <!-- TMPL_IF NAME="TagsEnabled" -->
+ <!-- TMPL_IF NAME="TagsInputOnList" -->
+ $(".tagsep").text("| ");
+ $("#tagsel_tag").text("Tag");
+ $("#tagsel_button").click(function(){
+ tagAdded();
+ return false;
+ });
+ $("#tablehead").attr("colspan", $("#tablehead").attr("colspan") + 1);
+ <!-- /TMPL_IF -->
+ <!-- /TMPL_IF -->
});
+
function holdSel() {
var items = document.getElementById('records').value;
if (items) {
@@ -42,6 +100,7 @@
alert(MSG_NO_RECORD_SELECTED);
}
}
+
//]]>
</script>
<!-- /TMPL_IF -->
@@ -66,11 +125,23 @@
<!-- TMPL_IF NAME="verbose" -->
<!-- TMPL_UNLESS NAME="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>
<!-- TMPL_IF NAME="loggedinusername" -->
| <a href="#" onclick="addSelToShelf(); return false;">Add to a list</a>
<!-- /TMPL_IF -->
- <span class="holdsep"></span><a href="#" onclick="holdSel(); return false;"><span class="hold"></span></a>
+ <span class="holdsep"></span><a href="#" onclick="holdSel(); return false;">
+ <span class="hold"></span></a>
+ <span class="tagsep"></span>
+ <a href="#" onclick="tagSelected(); return false;"><span id="tagsel_tag"></span></a>
+</span>
+ <span id="tagsel_form" style="display:none">
+ <label for="tagsel_new" style="display:inline">New 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><!-- /TMPL_UNLESS -->
<form action="opac-basket.pl" method="get" name="bookbag_form" id="bookbag_form">
<!-- TMPL_LOOP NAME="BIBLIO_RESULTS" -->
@@ -211,12 +282,21 @@
<!-- TMPL_ELSE -->
<form action="/cgi-bin/koha/opac-basket.pl" method="get" name="bookbag_form" id="bookbag_form">
<table>
- <!-- TMPL_UNLESS NAME="print_basket" --><tr><td colspan="3" style="padding-bottom: 7px;"><a id="CheckAll" href="#">Select All</a> <a id="CheckNone" href="#">Clear All</a> | <b>Selected items :</b>
+ <!-- TMPL_UNLESS NAME="print_basket" --><tr><td id="tablehead" colspan="3" style="padding-bottom: 7px;"><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>
<!-- TMPL_IF NAME="loggedinusername" -->
| <a href="#" onclick="addSelToShelf(); return false;">Add to a list</a>
<!-- /TMPL_IF -->
<span class="holdsep"></span><a href="#" onclick="holdSel(); return false;"><span class="hold"></span></a>
+ <span class="tagsep"></span><a href="#" onclick="tagSelected(); return false;"><span id="tagsel_tag"></span></a>
+</span>
+ <span id="tagsel_form" style="display:none">
+ <label for="tagsel_new" style="display:inline">New 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>
</td></tr><!-- /TMPL_UNLESS -->
<!-- TMPL_LOOP NAME="BIBLIO_RESULTS" -->
<!-- TMPL_IF NAME="even" -->
@@ -242,6 +322,8 @@
<!-- /TMPL_IF -->
<!-- COinS / OpenURL -->
<span class="Z3988" title="ctx_ver=Z39.88-2004&rft_val_fmt=info%3Aofi%2Ffmt%3Akev%3Amtx%3Abook&rft.au=<!-- TMPL_VAR NAME="author" -->&rft.btitle=<!-- TMPL_VAR NAME="title" ESCAPE="url" -->&rft.date=<!-- TMPL_VAR NAME="publicationyear" -->&rft.tpages=<!-- TMPL_VAR NAME="size" -->&rft.isbn=<!-- TMPL_VAR NAME="isbn" ESCAPE="url" -->&rft.aucorp=&rft.place=<!-- TMPL_VAR NAME="place" -->&rft.pub=<!-- TMPL_VAR NAME="publisher" ESCAPE="url" -->&rft.edition=<!-- TMPL_VAR NAME="edition" -->&rft.series=<!-- TMPL_VAR NAME="series" -->&rft.genre="></span>
+ <div id="newtag<!-- TMPL_VAR NAME="biblionumber">_status" class="tagstatus results_summary" style="display:none">Tag status here.</div>
+
</td>
<td><!-- TMPL_VAR name="description" --></td>
<td><!-- TMPL_IF NAME="ITEM_RESULTS" --><!-- TMPL_LOOP NAME="ITEM_RESULTS" -->
diff --git a/koha-tmpl/opac-tmpl/prog/en/modules/opac-reserve.tmpl b/koha-tmpl/opac-tmpl/prog/en/modules/opac-reserve.tmpl
index 214a7ba..4e015a2 100644
--- a/koha-tmpl/opac-tmpl/prog/en/modules/opac-reserve.tmpl
+++ b/koha-tmpl/opac-tmpl/prog/en/modules/opac-reserve.tmpl
@@ -254,11 +254,11 @@
<input class="single_bib" name="single_bib" type="hidden" value="<!-- TMPL_VAR NAME="biblionumber" -->"/>
<span class="confirmjs_hold" title="<!-- TMPL_VAR NAME="biblionumber" -->"></span>
<span class="confirm_nonjs">
- <input type="radio" class="confirmbox checkitem checkitem_<!-- TMPL_VAR NAME="biblionumber" -->"
- name="checkitem_<!-- TMPL_VAR NAME="biblionumber" -->" checked="checked"
- id="checkitem_<!-- TMPL_VAR NAME="biblionumber" -->"
+ <input type="radio" class="confirmbox checkitem <!-- TMPL_VAR NAME="checkitem_bib" -->"
+ name="<!-- TMPL_VAR NAME="checkitem_bib" -->" checked="checked"
+ id="<!-- TMPL_VAR NAME="checkitem_bib" -->"
value="any" />
- <label class="confirm_label" for="checkitem_<!-- TMPL_VAR NAME="biblionumber" -->">Next available copy</label>
+ <label class="confirm_label" for="<!-- TMPL_VAR NAME="checkitem_bib" -->">Next available copy</label>
</span>
</td>
<!-- TMPL_ELSE -->
@@ -267,9 +267,9 @@
<input class="single_bib" name="single_bib" type="hidden" value="<!-- TMPL_VAR NAME="biblionumber" -->"/>
<span class="confirmjs_nohold" title="<!-- TMPL_VAR NAME="biblionumber" -->"></span>
<span class="confirm_nonjs">
- <input type="radio" class="confirmbox checkitem checkitem_<!-- TMPL_VAR NAME="biblionumber" -->"
- name="checkitem_<!-- TMPL_VAR NAME="biblionumber" -->" disabled="disabled"
- id="checkitem_<!-- TMPL_VAR NAME="biblionumber" -->"
+ <input type="radio" class="confirmbox checkitem <!-- TMPL_VAR NAME="checkitem_bib" -->"
+ name="<!-- TMPL_VAR NAME="checkitem_bib" -->" disabled="disabled"
+ id="<!-- TMPL_VAR NAME="checkitem_bib" -->"
value="any" />
</span>
</td><td>
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 29b7882..35fe0f9 100644
--- a/koha-tmpl/opac-tmpl/prog/en/modules/opac-results.tmpl
+++ b/koha-tmpl/opac-tmpl/prog/en/modules/opac-results.tmpl
@@ -39,6 +39,45 @@ function holdBiblioNums(numList) {
}
+function tagSelected() {
+ var checkedBoxes = $(".searchresults :checkbox:checked");
+ if ($(checkedBoxes).size() == 0) {
+ alert(MSG_NO_RECORD_SELECTED);
+ } else {
+ $("#tagsel_tag").hide();
+ $("#sort_by").hide();
+ $("#tagsel_form").show();
+ }
+}
+
+function tagCanceled() {
+ $("#tagsel_form").hide();
+ $("#tagsel_tag").show();
+ $("#sort_by").show();
+}
+
+function tagAdded() {
+ var checkedBoxes = $(".searchresults :checkbox:checked");
+ if ($(checkedBoxes).size() == 0) {
+ alert(MSG_NO_RECORD_SELECTED);
+ return false;
+ }
+
+ var tag = $("#tagsel_new").val();
+ if (!tag || (tag == "")) {
+ 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;
+}
+
$(document).ready(function(){
var param1 = "<label for=\"addto\">Add to: <\/label><select name=\"addto\" id=\"addto\"><option value=\"\"><\/option>";
<!-- TMPL_IF name="opacbookbag" --> param1 += "<option value=\"addtocart\">Cart<\/option>";
@@ -65,6 +104,9 @@ $(document).ready(function(){
cartList();
return false;
});
+
+ $("#tagsel_span").html("<input id=\"tagsel_tag\" class=\"submit\" type=\"submit\" value=\"Tag\"/>");
+
function cartList(){
if($("#addto").find("option:selected").attr("value") == "addtolist"){
var shelfnumber = $("#addto").find("option:selected").attr("id").replace("s","");
@@ -97,7 +139,31 @@ $(document).ready(function(){
return false;
});
$("#holdDetails").hide();
- <!-- TMPL_IF NAME="TagsEnabled" -->$(".tagbutton").click(KOHA.Tags.add_tag_button);<!-- /TMPL_IF -->
+
+ <!-- TMPL_IF NAME="TagsEnabled" -->
+ $(".tagbutton").click(KOHA.Tags.add_tag_button);
+ <!-- TMPL_IF NAME="TagsInputOnList" -->
+ <!-- TMPL_IF NAME="loggedinusername" -->
+ $("#tagsel_tag").click(function(){
+ tagSelected();
+ return false;
+ });
+ $("#tagsel_cancel").click(function(){
+ tagCanceled();
+ return false;
+ });
+ $("#tagsel_button").click(function(){
+ tagAdded();
+ return false;
+ });
+ <!-- TMPL_ELSE -->
+ $("#tagsel_tag").click(function(){
+ window.location = "/cgi-bin/koha/opac-user.pl";
+ return false;
+ });
+ <!-- /TMPL_IF -->
+ <!-- /TMPL_IF -->
+ <!-- /TMPL_IF -->
<!-- TMPL_IF NAME="GoogleJackets" -->KOHA.Google.GetCoverFromIsbn();<!-- /TMPL_IF -->
});
//]]>
@@ -214,6 +280,23 @@ $(document).ready(function(){
<!-- /TMPL_IF -->
<span id="placehold"><!-- input class="submit" type="submit" value="Place Hold"/ --></span>
<div id="holdDetails"></div>
+
+ <!-- TMPL_IF NAME="TagsEnabled" -->
+ <!-- TMPL_IF NAME="TagsInputOnList" -->
+ <span id="tagsel_span"></span>
+ <!-- TMPL_IF NAME="loggedinusername" -->
+ <span id="tagsel_form" style="display:none">
+ <label for="tagsel_new">New Tag:</label>
+ <input name="tagsel_new" id="tagsel_new" maxlength="100" />
+ <input id="tagsel_button" name="tagsel_button" class="input tagsel_button" title="tagsel_button" type="submit" value="Add" />
+ <a href="#" id="tagsel_cancel">Cancel</a>
+ </span>
+ <span id="tagsel_status" class="tagsel_tatus" style="display:none;">
+ Tag status here.
+ </span>
+ <!-- /TMPL_IF -->
+ <!-- /TMPL_IF -->
+ <!-- /TMPL_IF -->
</div>
</td></tr>
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 a54b34b..f6b8449 100644
--- a/koha-tmpl/opac-tmpl/prog/en/modules/opac-shelves.tmpl
+++ b/koha-tmpl/opac-tmpl/prog/en/modules/opac-shelves.tmpl
@@ -3,6 +3,8 @@
<script type="text/javascript" src="<!-- TMPL_VAR name="themelang" -->/lib/jquery/plugins/jquery.tablesorter.min.js"></script>
<script type="text/JavaScript" language="JavaScript">
//<![CDATA[
+var MSG_NO_TAG_SPECIFIED = _("No tag was specified.");
+
$.tablesorter.addParser({
id: 'articles',
is: function(s) {return false; },
@@ -25,344 +27,473 @@ function holdSelections() {
}
}
- $(function() {
- $("span.clearall").html("<a id=\"CheckNone\" href=\"#\">Clear All</a>");
- $("span.checkall").html("<a id=\"CheckAll\" href=\"#\">Select All</a>");
- $("#listcontents").tablesorter({
- widgets : ['zebra'],
- <!-- TMPL_IF NAME="manageshelf" -->
- sortList: [[1,0]],
- headers: { 0: { sorter: false },1:{sorter: 'articles'}
- <!-- TMPL_ELSE -->
- sortList: [[0,0]],
- headers: { 0:{sorter:'articles'}
- <!-- /TMPL_IF -->
- }
- });
- $("#CheckAll").click(function(){
- $(".checkboxed").checkCheckboxes();
- return false;
- });
- $("#CheckNone").click(function(){
- $(".checkboxed").unCheckCheckboxes();
- return false;
- });
- });
+function tagSelected() {
+ <!-- TMPL_IF NAME="loggedinusername" -->
+ var checkedBoxes = $("input:checkbox:checked");
+ if ($(checkedBoxes).size()) {
+ $("#tagsel_tag").hide();
+ $(".tag_hides").hide();
+ $("#tagsel_form").show();
+ } else {
+ alert(MSG_NO_RECORD_SELECTED);
+ }
+ <!-- TMPL_ELSE -->
+ window.location = "/cgi-bin/koha/opac-user.pl";
+ <!-- /TMPL_IF -->
+}
+
+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;
+}
- $(document).ready(function(){
- $(".hold").html("Place Hold");
- });
+$(function() {
+ $("span.clearall").html("<a id=\"CheckNone\" href=\"#\">Clear All</a>");
+ $("span.checkall").html("<a id=\"CheckAll\" href=\"#\">Select All</a>");
+ $("#listcontents").tablesorter({
+ widgets : ['zebra'],
+ <!-- TMPL_IF NAME="manageshelf" -->
+ sortList: [[1,0]],
+ headers: { 0: { sorter: false },1:{sorter: 'articles'}
+ <!-- TMPL_ELSE -->
+ sortList: [[0,0]],
+ headers: { 0:{sorter:'articles'}
+ <!-- /TMPL_IF -->
+ }
+ });
+ $("#CheckAll").click(function(){
+ $(".checkboxed").checkCheckboxes();
+ return false;
+ });
+ $("#CheckNone").click(function(){
+ $(".checkboxed").unCheckCheckboxes();
+ return false;
+ });
+});
+
+$(document).ready(function(){
+ $(".hold").html("Place Hold");
+
+ <!-- TMPL_IF NAME="TagsEnabled" -->
+ $("#tagsel_tag").text("Tag");
+ $("#tagsel_button").click(function(){
+ tagAdded();
+ return false;
+ });
+ <!-- /TMPL_IF -->
+});
//]]>
</script>
</head>
<!-- TMPL_IF NAME="loggedinusername" --><body id="opac-userlists"><!-- TMPL_ELSE --><body id="opac-lists"><!-- /TMPL_IF -->
- <!-- TMPL_IF EXPR="OpacNav||loggedinusername" --><div id="doc3" class="yui-t1"><!-- TMPL_ELSE --><div id="doc3" class="yui-t7"><!-- /TMPL_IF -->
- <div id="bd">
-<!-- TMPL_INCLUDE NAME="masthead.inc" -->
+ <!-- TMPL_IF EXPR="OpacNav||loggedinusername" --><div id="doc3" class="yui-t1"><!-- TMPL_ELSE --><div id="doc3" class="yui-t7"><!-- /TMPL_IF -->
+ <div id="bd">
+ <!-- TMPL_INCLUDE NAME="masthead.inc" -->
+ <div id="yui-main">
+ <div class="yui-b">
+ <div class="container">
+
+ <!-- TMPL_IF NAME="paramsloop" -->
+ <!-- TMPL_LOOP NAME="paramsloop" -->
+ <div class="yui-ge">
+ <div class="yui-u first">
+ <!-- TMPL_IF NAME="already" --><div class="dialog alert">A List named <b><!-- TMPL_VAR NAME="already" --></b> already exists!</div><!-- /TMPL_IF -->
+ <!-- TMPL_IF NAME="status" --><div class="dialog alert"><!-- TMPL_VAR NAME="string" --></div><!-- /TMPL_IF -->
+ <!-- TMPL_IF NAME="nobarcode" --><div class="dialog alert">ERROR: No barcode given.</div><!-- /TMPL_IF -->
+ <!-- TMPL_IF NAME="noshelfnumber" --><div class="dialog alert">ERROR: No shelfnumber given.</div><!-- /TMPL_IF -->
+ <!-- TMPL_IF NAME="need_confirm" -->
+ <div class="dialog alert">
+ The list <i><!-- TMPL_VAR NAME="need_confirm" --></i> is not empty.
+ <br />It has <b><!-- TMPL_VAR NAME="count" --></b> entries.
+ <br />Use the "Confirm" button below to confirm deletion.
+ </div>
+ <!-- /TMPL_IF -->
+ <!-- TMPL_IF NAME="nopermission" -->
+ <div class="dialog alert">ERROR: You do not have adequate permission for that action on list <!-- TMPL_VAR NAME="nopermission" -->.</div>
+ <!-- /TMPL_IF -->
+ <!-- TMPL_IF NAME="failgetitem" -->
+ <div class="dialog alert">ERROR: No item found with barcode <!-- TMPL_VAR NAME="failgetitem" -->.</div>
+ <!-- /TMPL_IF -->
+ <!-- TMPL_IF NAME="duplicatebiblio" -->
+ <div class="dialog alert">A record matching barcode <b><!-- TMPL_VAR NAME="duplicatebiblio" --></b> has already been added.</div>
+ <!-- /TMPL_IF -->
+ <!-- TMPL_IF NAME="delete_ok" -->
+ <div class="dialog message">List <!-- TMPL_VAR NAME="delete_ok" --> Deleted.</div>
+ <!-- /TMPL_IF -->
+ <!-- TMPL_IF NAME="delete_fail" -->
+ <div class="dialog message">ERROR: Database error. Delete (list number <!-- TMPL_VAR NAME="delete_fail" -->) failed.</div>
+ <!-- /TMPL_IF -->
+ <!-- TMPL_IF NAME="unrecognized" -->
+ <div class="dialog message">ERROR: List number <!-- TMPL_VAR NAME="unrecognized" --> unrecognized.</div>
+ <!-- /TMPL_IF -->
+ </div>
+ </div>
+ <!-- /TMPL_LOOP --><!-- /paramsloop -->
+ <!-- /TMPL_IF --> <!-- /paramsloop -->
- <div id="yui-main">
- <div class="yui-b">
-<div class="container">
-<!-- TMPL_IF NAME="paramsloop" -->
-<!-- TMPL_LOOP NAME="paramsloop" -->
-<div class="yui-ge">
- <div class="yui-u first">
- <!-- TMPL_IF NAME="already" --><div class="dialog alert">A List named <b><!-- TMPL_VAR NAME="already" --></b> already exists!</div><!-- /TMPL_IF -->
- <!-- TMPL_IF NAME="status" --><div class="dialog alert"><!-- TMPL_VAR NAME="string" --></div><!-- /TMPL_IF -->
- <!-- TMPL_IF NAME="nobarcode" --><div class="dialog alert">ERROR: No barcode given.</div><!-- /TMPL_IF -->
- <!-- TMPL_IF NAME="noshelfnumber" --><div class="dialog alert">ERROR: No shelfnumber given.</div><!-- /TMPL_IF -->
- <!-- TMPL_IF NAME="need_confirm" -->
- <div class="dialog alert">The list <i><!-- TMPL_VAR NAME="need_confirm" --></i> is not empty.
- <br />It has <b><!-- TMPL_VAR NAME="count" --></b> entries.
- <br />Use the "Confirm" button below to confirm deletion.
- </div>
- <!-- /TMPL_IF -->
- <!-- TMPL_IF NAME="nopermission" -->
- <div class="dialog alert">ERROR: You do not have adequate permission for that action on list <!-- TMPL_VAR NAME="nopermission" -->.</div>
- <!-- /TMPL_IF -->
- <!-- TMPL_IF NAME="failgetitem" -->
- <div class="dialog alert">ERROR: No item found with barcode <!-- TMPL_VAR NAME="failgetitem" -->.</div>
- <!-- /TMPL_IF -->
- <!-- TMPL_IF NAME="duplicatebiblio" -->
- <div class="dialog alert">A record matching barcode <b><!-- TMPL_VAR NAME="duplicatebiblio" --></b> has already been added.</div>
- <!-- /TMPL_IF -->
- <!-- TMPL_IF NAME="delete_ok" -->
- <div class="dialog message">List <!-- TMPL_VAR NAME="delete_ok" --> Deleted.</div>
- <!-- /TMPL_IF -->
- <!-- TMPL_IF NAME="delete_fail" -->
- <div class="dialog message">ERROR: Database error. Delete (list number <!-- TMPL_VAR NAME="delete_fail" -->) failed.</div>
- <!-- /TMPL_IF -->
- <!-- TMPL_IF NAME="unrecognized" -->
- <div class="dialog message">ERROR: List number <!-- TMPL_VAR NAME="unrecognized" --> unrecognized.</div>
- <!-- /TMPL_IF -->
- </div>
-</div>
-<!-- /TMPL_LOOP -->
-<!-- /TMPL_IF -->
+ <div id="toolbar" class="yui-g">
+
- <div class="yui-g">
-
-
- <!-- TMPL_IF NAME="viewshelf" -->
- <!-- Viewing a particular shelf -->
- <h3><a href="/cgi-bin/koha/opac-shelves.pl">Lists</a> <img src="<!-- TMPL_VAR NAME="themelang" -->/../images/caret.gif" width="16" height="16" alt=">" border="0" /> <em><!-- TMPL_VAR NAME="shelfname" ESCAPE="html" --></em></h3>
- <!-- TMPL_IF NAME="itemsloop" -->
- <!-- TMPL_IF NAME="manageshelf" --><div><span class="checkall"></span>
- <span class="clearall"></span> | <a class="editshelf" href="/cgi-bin/koha/opac-shelves.pl?shelfnumber=<!-- TMPL_VAR NAME="shelfnumber" -->&op=modif">Edit List</a> <form method="post" action="opac-shelves.pl">
-<input type="hidden" value="1" name="shelves"/>
-<!-- TMPL_IF NAME="showprivateshelves" -->
-<input type="hidden" name="display" value="privateshelves" />
-<!-- /TMPL_IF -->
-<input type="hidden" value="1" name="DEL-<!-- TMPL_VAR NAME="shelfnumber" -->"/>
-<input type="submit" class="deleteshelf" value="Delete List" onclick="return confirmDelete(_('Are you sure you want to remove this List?'));"/></form>
-<a href="#" class="send" onClick="open(CGIBIN+'opac-sendshelf.pl?shelfid=<!-- TMPL_VAR NAME="shelfnumber" -->','win_form','dependant=yes,scrollbars=no,resizable=no,height=300,width=450,top=50,left=100')">Send List</a>
-<a href="#" class="hold" onClick="holdSelections();return false;"></a>
-</div><!-- /TMPL_IF -->
- <!-- TMPL_IF NAME="manageshelf" --><form action="/cgi-bin/koha/opac-shelves.pl" method="post" name="myform" class="checkboxed">
- <input type="hidden" name="viewshelf" value="<!-- TMPL_VAR NAME="shelfnumber" -->" />
- <input type="hidden" name="modifyshelfcontents" value="1" /><!-- /TMPL_IF -->
- <!-- TMPL_VAR name='pagination_bar'-->
-<table id="listcontents">
- <thead><tr>
- <!-- TMPL_IF NAME="manageshelf" --><th> </th><!-- /TMPL_IF -->
- <!-- TMPL_UNLESS NAME="item-level_itypes" --><th>Item Type</th><!-- /TMPL_UNLESS -->
- <th>Title</th>
- <th>Author</th>
- <th>Copyright</th>
- </tr></thead>
- <tbody><!-- TMPL_LOOP NAME="itemsloop" -->
- <!-- TMPL_IF NAME="toggle" -->
- <tr class="highlight">
- <!-- TMPL_ELSE -->
- <tr>
+ <!-- TMPL_IF NAME="viewshelf" --><!-- Viewing a particular shelf -->
+ <h3><a href="/cgi-bin/koha/opac-shelves.pl">Lists</a> <img src="<!-- TMPL_VAR NAME="themelang" -->/../images/caret.gif" width="16" height="16" alt=">" border="0" /> <em><!-- TMPL_VAR NAME="shelfname" ESCAPE="html" --></em></h3>
+ <!-- TMPL_IF NAME="itemsloop" -->
+ <!-- TMPL_IF NAME="manageshelf" -->
+ <div>
+ <span class="checkall"></span>
+ <span class="clearall"></span>
+ |
+ <!-- div id="tag_hides" -->
+ <a class="editshelf tag_hides" href="/cgi-bin/koha/opac-shelves.pl?shelfnumber=<!-- TMPL_VAR NAME="shelfnumber" -->&op=modif">Edit List</a>
+ <form method="post" action="opac-shelves.pl" class="tag_hides">
+ <input type="hidden" value="1" name="shelves"/>
+ <!-- TMPL_IF NAME="showprivateshelves" -->
+ <input type="hidden" name="display" value="privateshelves" />
+ <!-- /TMPL_IF -->
+ <input type="hidden" value="1" name="DEL-<!-- TMPL_VAR NAME="shelfnumber" -->"/>
+ <input type="submit" class="deleteshelf" value="Delete List" onclick="return confirmDelete(_('Are you sure you want to remove this List?'));"/>
+ </form>
+ <a href="#" class="send tag_hides" onclick="open(CGIBIN+'opac-sendshelf.pl?shelfid=<!-- TMPL_VAR NAME="shelfnumber" -->','win_form','dependant=yes,scrollbars=no,resizable=no,height=300,width=450,top=50,left=100')">Send List</a>
+ <a href="#" class="hold tag_hides" onclick="holdSelections();return false;"></a>
+ <!-- /div -->
+ <a id="tagsel_tag" href="#" onclick="tagSelected(); return false;"></a>
+ <span id="tagsel_form" style="display:none">
+ <label for="tagsel_new" style="display:inline">New 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>
+ </div>
<!-- /TMPL_IF -->
<!-- TMPL_IF NAME="manageshelf" -->
- <td>
- <input type="checkbox" name="REM-<!-- TMPL_VAR NAME="biblionumber" -->" />
- </td>
+ <form action="/cgi-bin/koha/opac-shelves.pl" method="post" name="myform" class="checkboxed">
+ <input type="hidden" name="viewshelf" value="<!-- TMPL_VAR NAME="shelfnumber" -->" />
+ <input type="hidden" name="modifyshelfcontents" value="1" />
<!-- /TMPL_IF -->
- <!-- TMPL_UNLESS NAME="item-level_itypes" --><td>
- <!-- TMPL_IF NAME="imageurl" -->
- <img src="<!-- TMPL_VAR NAME="imageurl" -->" alt="<!-- TMPL_VAR NAME="description" -->" title="<!-- TMPL_VAR NAME="description" -->" />
- </TMPL_IF>
- <!-- TMPL_VAR NAME="description" -->
- </td> <!-- /TMPL_UNLESS -->
+ <!-- TMPL_VAR name='pagination_bar'-->
+ <table id="listcontents">
+ <thead><tr>
+ <!-- TMPL_IF NAME="manageshelf" --><th> </th><!-- /TMPL_IF -->
+ <!-- TMPL_UNLESS NAME="item-level_itypes" --><th>Item Type</th><!-- /TMPL_UNLESS -->
+ <th>Title</th>
+ <th>Author</th>
+ <th>Copyright</th>
+ </tr></thead>
+ <tbody>
+ <!-- TMPL_LOOP NAME="itemsloop" -->
+ <!-- TMPL_IF NAME="toggle" -->
+ <tr class="highlight">
+ <!-- TMPL_ELSE -->
+ <tr>
+ <!-- /TMPL_IF -->
+ <!-- TMPL_IF NAME="manageshelf" -->
+ <td><input type="checkbox" name="REM-<!-- TMPL_VAR NAME="biblionumber" -->"
+ value="<!-- TMPL_VAR NAME="biblionumber">" /></td>
+ <!-- /TMPL_IF -->
+ <!-- TMPL_UNLESS NAME="item-level_itypes" -->
+ <td>
+ <img src="<!-- TMPL_VAR NAME="imageurl" -->" alt="<!-- TMPL_VAR NAME="description" -->" title="<!-- TMPL_VAR NAME="description" -->" /><!-- TMPL_VAR NAME="description" -->
+ </td>
+ <!-- /TMPL_UNLESS -->
+ <td>
+ <!-- TMPL_IF NAME="BiblioDefaultViewmarc" -->
+ <a class="title" href="/cgi-bin/koha/opac-MARCdetail.pl?biblionumber=<!-- TMPL_VAR NAME="biblionumber" ESCAPE="URL" -->"><!-- TMPL_VAR NAME="title" escape="html" --> <!-- TMPL_VAR NAME="subtitle" --></a>
+ <!-- TMPL_ELSE -->
+ <!-- TMPL_IF NAME="BiblioDefaultViewisbd" -->
+ <a class="title" href="/cgi-bin/koha/opac-ISBDdetail.pl?biblionumber=<!-- TMPL_VAR NAME="biblionumber" ESCAPE="URL" -->"><!-- TMPL_VAR NAME="title" escape="html" --> <!-- TMPL_VAR NAME="subtitle" --></a>
+ <!-- TMPL_ELSE -->
+ <a class="title" href="/cgi-bin/koha/opac-detail.pl?biblionumber=<!-- TMPL_VAR NAME="biblionumber" ESCAPE="URL" -->"><!-- TMPL_VAR NAME="title" escape="html" --> <!-- TMPL_VAR NAME="subtitle" --></a>
+ <!-- /TMPL_IF -->
+ <!-- /TMPL_IF -->
+ <!-- COinS / OpenURL -->
+ <span class="Z3988" title="ctx_ver=Z39.88-2004&rft_val_fmt=info%3Aofi%2Ffmt%3Akev%3Amtx%3Abook&rft.au=<!-- TMPL_VAR NAME="author" -->&rft.btitle=<!-- TMPL_VAR NAME="title" ESCAPE="url" -->&rft.date=<!-- TMPL_VAR NAME="publicationyear" -->&rft.tpages=<!-- TMPL_VAR NAME="size" -->&rft.isbn=<!-- TMPL_VAR NAME="isbn" ESCAPE="url" -->&rft.aucorp=&rft.place=<!-- TMPL_VAR NAME="place" -->&rft.pub=<!-- TMPL_VAR NAME="publisher" ESCAPE="url" -->&rft.edition=<!-- TMPL_VAR NAME="edition" -->&rft.series=<!-- TMPL_VAR NAME="series" -->&rft.genre="></span>
+ <br/>
+ <div id="newtag<!-- TMPL_VAR NAME="biblionumber">_status" class="tagstatus results_summary" style="display:none">Tag status here.</div>
+ </td>
+ <td><!-- TMPL_VAR NAME="author" --></td>
+ <td><!-- TMPL_VAR NAME="copyrightdate" --></td>
+ </tr>
+ <!-- /TMPL_LOOP --><!-- /itemsloop -->
+ </tbody>
+ </table>
+ <!-- TMPL_ELSE -->
+ <div class="dialog message">This List is empty. You can add to your lists from the results of any <a href="opac-main.pl">search</a>!</div>
+ <!-- /TMPL_IF --><!-- /itemsloop -->
+ <!-- /TMPL_IF --><!-- /viewshelf -->
+
- <td><!-- TMPL_IF NAME="BiblioDefaultViewmarc" --><a class="title" href="/cgi-bin/koha/opac-MARCdetail.pl?biblionumber=<!-- TMPL_VAR NAME="biblionumber" ESCAPE="URL" -->"><!-- TMPL_VAR NAME="title" escape="html" --> <!-- TMPL_VAR NAME="subtitle" --></a>
+ <!-- TMPL_IF NAME="manageshelf" -->
+ <!-- Editing shelf -->
+ <!-- TMPL_IF NAME="itemsloop" -->
+ <input type="hidden" name="shelfnumber" value="<!-- TMPL_VAR NAME="shelfnumber" -->" />
+ <input type="hidden" name="modifyshelfcontents" value="1" />
+ <input type="hidden" name="viewshelf" value="<!-- TMPL_VAR NAME="shelfnumber" -->" /><input type="submit" value="Remove Selected Items" class="icon delete" onclick="return confirmDelete(_('Are you sure you want to remove these items from the list?'))" />
<!-- TMPL_ELSE -->
- <!-- TMPL_IF NAME="BiblioDefaultViewisbd" --><a class="title" href="/cgi-bin/koha/opac-ISBDdetail.pl?biblionumber=<!-- TMPL_VAR NAME="biblionumber" ESCAPE="URL" -->"><!-- TMPL_VAR NAME="title" escape="html" --> <!-- TMPL_VAR NAME="subtitle" --></a>
- <!-- TMPL_ELSE --><a class="title" href="/cgi-bin/koha/opac-detail.pl?biblionumber=<!-- TMPL_VAR NAME="biblionumber" ESCAPE="URL" -->"><!-- TMPL_VAR NAME="title" escape="html" --> <!-- TMPL_VAR NAME="subtitle" --></a>
- <!-- /TMPL_IF --><!-- /TMPL_IF -->
- <!-- COinS / OpenURL --><span class="Z3988" title="ctx_ver=Z39.88-2004&rft_val_fmt=info%3Aofi%2Ffmt%3Akev%3Amtx%3Abook&rft.au=<!-- TMPL_VAR NAME="author" -->&rft.btitle=<!-- TMPL_VAR NAME="title" ESCAPE="url" -->&rft.date=<!-- TMPL_VAR NAME="publicationyear" -->&rft.tpages=<!-- TMPL_VAR NAME="size" -->&rft.isbn=<!-- TMPL_VAR NAME="isbn" ESCAPE="url" -->&rft.aucorp=&rft.place=<!-- TMPL_VAR NAME="place" -->&rft.pub=<!-- TMPL_VAR NAME="publisher" ESCAPE="url" -->&rft.edition=<!-- TMPL_VAR NAME="edition" -->&rft.series=<!-- TMPL_VAR NAME="series" -->&rft.genre="></span>
- </td>
- <td><!-- TMPL_VAR NAME="author" --></td>
- <td><!-- TMPL_VAR NAME="copyrightdate" --></td>
- </tr>
- <!-- /TMPL_LOOP --></tbody><!-- /itemsloop -->
- </table>
- <!-- TMPL_ELSE -->
- <div class="dialog message">This List is empty. You can add to your lists from the results of any <a href="opac-main.pl">search</a>!</div>
- <!-- /TMPL_IF --><!-- /itemsloop -->
- <!-- /TMPL_IF -->
- <!-- /viewshelf -->
+ <form method="post" action="opac-shelves.pl">
+ <input type="hidden" name="DEL-<!-- TMPL_VAR NAME="shelfnumber" -->" value="1" />
+ <input type="hidden" name="shelves" value="1" />
+ <input type="submit" class="icon delete" value="Delete this List" onclick="return confirmDelete(_('Are you sure you want to delete this List?'))" />
+ <!-- /TMPL_IF -->
+ </form>
+ <!-- /TMPL_IF -->
- <!-- TMPL_IF NAME="manageshelf" -->
- <!-- Editing shelf -->
- <!-- TMPL_IF NAME="itemsloop" -->
- <input type="hidden" name="shelfnumber" value="<!-- TMPL_VAR NAME="shelfnumber" -->" />
- <input type="hidden" name="modifyshelfcontents" value="1" />
- <input type="hidden" name="viewshelf" value="<!-- TMPL_VAR NAME="shelfnumber" -->" /><input type="submit" value="Remove Selected Items" class="icon delete" onclick="return confirmDelete(_('Are you sure you want to remove these items from the list?'))" />
- <!-- TMPL_ELSE -->
-<form method="post" action="opac-shelves.pl">
- <input type="hidden" name="DEL-<!-- TMPL_VAR NAME="shelfnumber" -->" value="1" />
- <input type="hidden" name="shelves" value="1" />
- <input type="submit" class="icon delete" value="Delete this List" onclick="return confirmDelete(_('Are you sure you want to delete this List?'))" />
- <!-- /TMPL_IF -->
- </form>
- <!-- /TMPL_IF -->
+
+ <!-- TMPL_IF NAME="edit" -->
+ <h3><a href="/cgi-bin/koha/opac-shelves.pl">Lists</a> <img src="<!-- TMPL_VAR NAME="themelang" -->/../images/caret.gif" width="16" height="16" alt=">" border="0" /> <a href="/cgi-bin/koha/opac-shelves.pl?viewshelf=<!-- TMPL_VAR NAME="shelfnumber" -->"><em><!-- TMPL_VAR NAME="shelfname" ESCAPE="html" --></em></a> <img src="<!-- TMPL_VAR NAME="themelang" -->/../images/caret.gif" width="16" height="16" alt=">" border="0" /> Editing</h3>
+ <form method="post" action="/cgi-bin/koha/opac-shelves.pl">
+ <input type="hidden" name="op" value="modifsave" />
+ <input type="hidden" name="shelfnumber" value="<!-- TMPL_VAR NAME="shelfnumber" -->" />
+ <fieldset class="rows">
+ <ol>
+ <li><label for="shelfname">List Name: </label><input type="text" id="shelfname" name="shelfname" size="60" value="<!-- TMPL_VAR NAME="shelfname" ESCAPE="html" -->" /></li>
+ <li>
+ <label for="sortfield" >Sort this list by: </label>
+ <select name="sortfield">
+ <!-- TMPL_IF NAME="sort_title" --><option value="title" selected="selected">Title</option><!-- TMPL_ELSE --><option value="title">Title</option><!-- /TMPL_IF -->
+ <!-- TMPL_IF NAME="sort_author" --><option value="author" selected="selected">Author</option><!-- TMPL_ELSE --><option value="author">Author</option><!-- /TMPL_IF -->
+ <!-- TMPL_IF NAME="sort_copyrightdate" --><option value="copyrightdate" selected="selected">Copyrightdate</option><!-- TMPL_ELSE --><option value="copyrightdate">Copyrightdate</option><!-- /TMPL_IF -->
+ </select>
+ </li>
+ <li>
+ <label for="category">Category: </label>
+ <select name="category" id="category">
+ <option value="1">Private</option>
+ <option value="2">Public</option>
+ </select>
+ </li>
+ </ol>
+ </fieldset>
+ <fieldset class="action"><input type="submit" value="Save" class="submit" /> <a class="cancel" href="/cgi-bin/koha/opac-shelves.pl?shelfnumber=<!-- TMPL_VAR NAME="shelfnumber" -->">Cancel</a></fieldset>
+ </form>
+ <!-- /TMPL_IF --><!-- /edit -->
- <!-- TMPL_IF NAME="edit" -->
- <h3><a href="/cgi-bin/koha/opac-shelves.pl">Lists</a> <img src="<!-- TMPL_VAR NAME="themelang" -->/../images/caret.gif" width="16" height="16" alt=">" border="0" /> <a href="/cgi-bin/koha/opac-shelves.pl?viewshelf=<!-- TMPL_VAR NAME="shelfnumber" -->"><em><!-- TMPL_VAR NAME="shelfname" ESCAPE="html" --></em></a> <img src="<!-- TMPL_VAR NAME="themelang" -->/../images/caret.gif" width="16" height="16" alt=">" border="0" /> Editing</h3>
- <form method="post" action="/cgi-bin/koha/opac-shelves.pl">
- <input type="hidden" name="op" value="modifsave" />
- <input type="hidden" name="shelfnumber" value="<!-- TMPL_VAR NAME="shelfnumber" -->" />
- <fieldset class="rows">
- <ol>
- <li><label for="shelfname">List Name: </label><input type="text" id="shelfname" name="shelfname" size="60" value="<!-- TMPL_VAR NAME="shelfname" ESCAPE="html" -->" /></li>
- <li><label for="sortfield" >Sort this list by: </label>
- <select name="sortfield">
- <!-- TMPL_IF NAME="sort_title" --><option value="title" selected="selected">Title</option><!-- TMPL_ELSE --><option value="title">Title</option><!-- /TMPL_IF -->
- <!-- TMPL_IF NAME="sort_author" --><option value="author" selected="selected">Author</option><!-- TMPL_ELSE --><option value="author">Author</option><!-- /TMPL_IF -->
- <!-- TMPL_IF NAME="sort_copyrightdate" --><option value="copyrightdate" selected="selected">Copyrightdate</option><!-- TMPL_ELSE --><option value="copyrightdate">Copyrightdate</option><!-- /TMPL_IF -->
- </select></li>
- <li><label for="category">Category: </label>
- <select name="category" id="category">
- <option value="1">Private</option>
- <option value="2">Public</option>
- </select>
- </li>
- </ol>
- </fieldset>
- <fieldset class="action"><input type="submit" value="Save" class="submit" /> <a class="cancel" href="/cgi-bin/koha/opac-shelves.pl?shelfnumber=<!-- TMPL_VAR NAME="shelfnumber" -->">Cancel</a></fieldset>
- </form>
- <!-- /TMPL_IF -->
- <!-- TMPL_UNLESS NAME="edit" --> <!-- TMPL_UNLESS NAME="viewshelf" --> <!-- TMPL_UNLESS NAME="shelves" -->
- <h2>Lists</h2>
- <ul class="link-tabs">
- <!-- TMPL_IF NAME="showprivateshelves" -->
- <li id="privateshelves_tab" class="on"><a href="/cgi-bin/koha/opac-shelves.pl?display=privateshelves">Your Lists</a></li>
- <!-- TMPL_ELSE -->
- <li id="privateshelves_tab" class="off"><a href="/cgi-bin/koha/opac-shelves.pl?display=privateshelves">Your Lists</a></li>
- <!-- /TMPL_IF -->
- <!-- TMPL_IF NAME="showpublicshelves" -->
- <li id="publicshelves_tab" class="on"><a href="/cgi-bin/koha/opac-shelves.pl?display=publicshelves">Public Lists</a></li>
- <!-- TMPL_ELSE -->
- <li id="publicshelves_tab" class="off"><a href="/cgi-bin/koha/opac-shelves.pl?display=publicshelves">Public Lists</a></li>
- <!-- /TMPL_IF -->
- </ul>
- <!-- TMPL_IF NAME="showprivateshelves" -->
- <div id="privateshelves" class="tab-container" style="display:block;">
- <!-- TMPL_ELSE -->
- <div id="privateshelves" class="tab-container" style="display:none;">
- <!-- /TMPL_IF -->
+ <!-- TMPL_UNLESS NAME="edit" -->
+ <!-- TMPL_UNLESS NAME="viewshelf" -->
+ <!-- TMPL_UNLESS NAME="shelves" -->
+ <h2>Lists</h2>
+ <ul class="link-tabs">
+ <!-- TMPL_IF NAME="showprivateshelves" -->
+ <li id="privateshelves_tab" class="on"><a href="/cgi-bin/koha/opac-shelves.pl?display=privateshelves">Your Lists</a></li>
+ <!-- TMPL_ELSE -->
+ <li id="privateshelves_tab" class="off"><a href="/cgi-bin/koha/opac-shelves.pl?display=privateshelves">Your Lists</a></li>
+ <!-- /TMPL_IF -->
+ <!-- TMPL_IF NAME="showpublicshelves" -->
+ <li id="publicshelves_tab" class="on"><a href="/cgi-bin/koha/opac-shelves.pl?display=publicshelves">Public Lists</a></li>
+ <!-- TMPL_ELSE -->
+ <li id="publicshelves_tab" class="off"><a href="/cgi-bin/koha/opac-shelves.pl?display=publicshelves">Public Lists</a></li>
+ <!-- /TMPL_IF -->
+ </ul>
+
+ <!-- TMPL_IF NAME="showprivateshelves" -->
+ <div id="privateshelves" class="tab-container" style="display:block;">
+ <!-- TMPL_ELSE -->
+ <div id="privateshelves" class="tab-container" style="display:none;">
+ <!-- /TMPL_IF -->
- <!-- TMPL_IF NAME="loggedinusername" -->
- <a class="newshelf" href="/cgi-bin/koha/opac-shelves.pl?shelves=1">New List</a>
- <!-- TMPL_IF NAME="shelveslooppriv" -->
- <!-- TMPL_VAR name='pagination_bar'-->
- <table>
- <tr><th>List Name</th><th>Contents</th><th>Sort by</th><th>Type</th><th> </th></tr>
- <!-- TMPL_LOOP NAME="shelveslooppriv" -->
- <!-- TMPL_IF NAME="toggle" --><tr class="highlight"><!--TMPL_ELSE--><tr><!-- /TMPL_IF -->
- <td><a href="opac-shelves.pl?display=privateshelves&viewshelf=<!-- TMPL_VAR NAME="shelf" -->"><!-- TMPL_VAR NAME="shelfname" ESCAPE="html" --></a></td>
- <td><!-- TMPL_VAR NAME="count" --> item(s)</td>
- <td><!-- TMPL_VAR NAME="sortfield" --></td>
- <td><!-- TMPL_IF NAME="viewcategory1" -->Private<!-- /TMPL_IF -->
- <!-- TMPL_IF NAME="viewcategory2" -->Public<!-- /TMPL_IF -->
- <!-- TMPL_IF NAME="viewcategory3" -->Open<!-- /TMPL_IF -->
- </td>
- <td>
- <!-- TMPL_IF NAME="mine" -->
- <form action="opac-shelves.pl" method="get">
- <input type="hidden" name="shelfnumber" value="<!-- TMPL_VAR NAME="shelf" -->" />
- <input type="hidden" name="display" value="privateshelves" />
- <input type="hidden" name="op" value="modif" />
- <input type="submit" class="editshelf" value="Edit" />
- </form>
- <form action="opac-shelves.pl" method="post">
- <input type="hidden" name="shelves" value="1" />
- <input type="hidden" name="display" value="privateshelves" />
- <input type="hidden" name="DEL-<!-- TMPL_VAR NAME="shelf" -->" value="1" />
- <!-- TMPL_IF NAME="confirm" -->
- <input type="hidden" name="CONFIRM-<!-- TMPL_VAR NAME="confirm" -->" value="1" />
- <input type="submit" class="confirm" value="Confirm" />
+ <!-- TMPL_IF NAME="loggedinusername" -->
+ <a class="newshelf" href="/cgi-bin/koha/opac-shelves.pl?shelves=1">New List</a>
+ <!-- TMPL_IF NAME="shelveslooppriv" -->
+ <!-- TMPL_VAR name='pagination_bar'-->
+ <table>
+ <tr>
+ <th>List Name</th>
+ <th>Contents</th>
+ <th>Sort by</th>
+ <th>Type</th>
+ <th> </th>
+ </tr>
+ <!-- TMPL_LOOP NAME="shelveslooppriv" -->
+ <!-- TMPL_IF NAME="toggle" -->
+ <tr class="highlight">
+ <!--TMPL_ELSE-->
+ <tr>
+ <!-- /TMPL_IF -->
+ <td><a href="opac-shelves.pl?display=privateshelves&viewshelf=<!-- TMPL_VAR NAME="shelf" -->"><!-- TMPL_VAR NAME="shelfname" ESCAPE="html" --></a></td>
+ <td><!-- TMPL_VAR NAME="count" --> item(s)</td>
+ <td><!-- TMPL_VAR NAME="sortfield" --></td>
+ <td>
+ <!-- TMPL_IF NAME="viewcategory1" -->Private<!-- /TMPL_IF -->
+ <!-- TMPL_IF NAME="viewcategory2" -->Public<!-- /TMPL_IF -->
+ <!-- TMPL_IF NAME="viewcategory3" -->Open<!-- /TMPL_IF -->
+ </td>
+ <td id="toolbar">
+ <!-- TMPL_IF NAME="mine" -->
+ <form action="opac-shelves.pl" method="get">
+ <input type="hidden" name="shelfnumber" value="<!-- TMPL_VAR NAME="shelf" -->" />
+ <input type="hidden" name="display" value="privateshelves" />
+ <input type="hidden" name="op" value="modif" />
+ <input type="submit" class="editshelf" value="Edit" />
+ </form>
+ <form action="opac-shelves.pl" method="post">
+ <input type="hidden" name="shelves" value="1" />
+ <input type="hidden" name="display" value="privateshelves" />
+ <input type="hidden" name="DEL-<!-- TMPL_VAR NAME="shelf" -->" value="1" />
+ <!-- TMPL_IF NAME="confirm" -->
+ <input type="hidden" name="CONFIRM-<!-- TMPL_VAR NAME="confirm" -->" value="1" />
+ <input type="submit" class="confirm" value="Confirm" />
+ <!-- TMPL_ELSE -->
+ <input type="submit" class="deleteshelf" onclick="return confirmDelete(_('Are you sure you want to remove this List?'));" value="Delete" />
+ <!-- /TMPL_IF -->
+ </form>
+ <!-- /TMPL_IF -->
+ <a href="#" class="send" onclick="open(CGIBIN+'opac-sendshelf.pl?shelfid=<!-- TMPL_VAR NAME="shelf" -->','win_form','dependant=yes,scrollbars=no,resizable=no,height=300,width=450,top=50,left=100')">Send List</a>
+ </td>
+ </tr>
+ <!-- /TMPL_LOOP -->
<!-- TMPL_ELSE -->
- <input type="submit" class="deleteshelf" onclick="return confirmDelete(_('Are you sure you want to remove this List?'));" value="Delete" />
- <!-- /TMPL_IF -->
+ <tr><td colspan="4">No Private Lists.</td></tr>
+ <!-- /TMPL_IF --><!-- /shelveslooppriv -->
+ </table>
+ <!-- TMPL_ELSE --><!-- /loggedinusername -->
+ <div><a href="/cgi-bin/koha/opac-user.pl">Log in</a> to create new Lists.</div>
+ <!-- /TMPL_IF --><!-- /loggedinusername -->
+
+
+ </div><!-- /privateshelves -->
+
+ <!-- TMPL_IF NAME="showpublicshelves" -->
+ <div id="publicshelves" class="tab-container" style="display:block;">
+ <!-- TMPL_ELSE -->
+ <div id="publicshelves" class="tab-container" style="display:none;">
+ <!-- /TMPL_IF -->
+
+ <!-- TMPL_IF NAME="shelvesloop" -->
+ <!-- TMPL_VAR name='pagination_bar'-->
+ <table>
+ <tr>
+ <th>List Name</th>
+ <th>Contents</th>
+ <th>Type</th><th> </th>
+ </tr>
+ <!-- TMPL_LOOP NAME="shelvesloop" -->
+ <!-- TMPL_IF NAME="toggle" -->
+ <tr class="highlight">
+ <!--TMPL_ELSE-->
+ <tr>
+ <!-- /TMPL_IF -->
+ <td><a href="opac-shelves.pl?viewshelf=<!-- TMPL_VAR NAME="shelf" -->"><!-- TMPL_VAR NAME="shelfname" ESCAPE="html" --></a></td>
+ <td><!-- TMPL_VAR NAME="count" --> item(s)</td>
+ <td>
+ <!-- TMPL_IF NAME="viewcategory1" -->Private<!-- /TMPL_IF -->
+ <!-- TMPL_IF NAME="viewcategory2" -->Public<!-- /TMPL_IF -->
+ <!-- TMPL_IF NAME="viewcategory3" -->Open<!-- /TMPL_IF -->
+ </td>
+ <td id="toolbar">
+ <!-- TMPL_IF NAME="mine" -->
+ <form action="opac-shelves.pl" method="get">
+ <input type="hidden" name="shelfnumber" value="<!-- TMPL_VAR NAME="shelf" -->" />
+ <input type="hidden" name="op" value="modif" />
+ <input type="submit" class="editshelf" value="Edit" />
+ </form>
+ <form action="opac-shelves.pl" method="post">
+ <input type="hidden" name="shelves" value="1" />
+ <input type="hidden" name="DEL-<!-- TMPL_VAR NAME="shelf" -->" value="1" />
+ <!-- TMPL_IF NAME="confirm" -->
+ <input type="hidden" name="CONFIRM-<!-- TMPL_VAR NAME="confirm" -->" value="1" />
+ <input type="submit" class="confirm" value="Confirm" />
+ <!-- TMPL_ELSE -->
+ <input type="submit" class="deleteshelf" onclick="return confirmDelete(_('Are you sure you want to remove this List?'));" value="Delete" />
+ <!-- /TMPL_IF -->
+ </form>
+ <!-- /TMPL_IF -->
+ <a href="#" class="send" onclick="open(CGIBIN+'opac-sendshelf.pl?shelfid=<!-- TMPL_VAR NAME="shelf" -->','win_form','dependant=yes,scrollbars=no,resizable=no,height=300,width=450,top=50,left=100')">Send List</a>
+ </td>
+ </tr>
+ <!-- /TMPL_LOOP --><!-- /shelvesloop -->
+ </table>
+ <!-- TMPL_ELSE --><!-- /shelvesloop -->
+ <!-- TMPL_IF NAME="showpublicshelves" -->No Public Lists.<!-- /TMPL_IF -->
+ <!-- /TMPL_IF --><!-- /shelvesloop -->
+
+ </div><!-- /publicshelves -->
+
+ <!-- /TMPL_UNLESS --><!-- /shelves -->
+ <!-- /TMPL_UNLESS --><!-- /viewshelf -->
+ <!-- /TMPL_UNLESS --><!-- /edit -->
+
+ <!-- TMPL_IF NAME="shelves" -->
+ <div id="addshelf">
+ <form method="post" action="/cgi-bin/koha/opac-shelves.pl">
+ <fieldset class="rows">
+ <legend>Create a New List</legend>
+ <input type="hidden" name="shelves" value="1" />
+ <ol>
+ <li>
+ <label for="addshelf">List Name:</label>
+ <!-- TMPL_IF NAME="already" -->
+ <input id="addshelf" type="text" name="addshelf" value="<!-- TMPL_VAR NAME="already" -->" size="60" />
+ <!-- TMPL_ELSE -->
+ <input id="addshelf" type="text" name="addshelf" size="60" />
+ <!-- /TMPL_IF -->
+ <input type="hidden" name="owner" id="owner" value="<!-- TMPL_VAR NAME="loggedinuser" -->" />
+ </li>
+ <li>
+ <label for="sortfield" >Sort this list by: </label>
+ <select name="sortfield">
+ <!-- TMPL_IF NAME="sort_title" --><option value="title" selected="selected">Title</option><!-- TMPL_ELSE --><option value="title">Title</option><!-- /TMPL_IF -->
+ <!-- TMPL_IF NAME="sort_author" --><option value="author" selected="selected">Author</option><!-- TMPL_ELSE --><option value="author">Author</option><!-- /TMPL_IF -->
+ <!-- TMPL_IF NAME="sort_copyrightdate" --><option value="copyrightdate" selected="selected">Copyrightdate</option><!-- TMPL_ELSE --><option value="copyrightdate">Copyrightdate</option><!-- /TMPL_IF -->
+ </select>
+ </li>
+ <li>
+ <label for="category">Category:</label>
+ <select name="category" id="category">
+ <option value="1">Private</option>
+ <option value="2">Public</option>
+ </select>
+ </li>
+ </ol>
+ </fieldset>
+ <fieldset class="action">
+ <input type="submit" value="Save" class="submit" />
+ <a class="cancel" href="/cgi-bin/koha/opac-shelves.pl">Cancel</a>
+ </fieldset>
</form>
- <!-- /TMPL_IF -->
- <a href="#" class="send" onclick="open(CGIBIN+'opac-sendshelf.pl?shelfid=<!-- TMPL_VAR NAME="shelf" -->','win_form','dependant=yes,scrollbars=no,resizable=no,height=300,width=450,top=50,left=100')">Send List</a>
- </td>
- </tr>
- <!-- /TMPL_LOOP -->
- <!-- TMPL_ELSE -->
- <tr><td colspan="4">No Private Lists.</td></tr>
- <!-- /TMPL_IF --><!-- /shelveslooppriv -->
- </table>
- <!-- TMPL_ELSE --><!-- /loggedinusername -->
- <div><a href="/cgi-bin/koha/opac-user.pl">Log in</a> to create new Lists.</div>
- <!-- /TMPL_IF --><!-- /loggedinusername -->
- </div><!-- /privateshelves -->
+ </div>
+ <!-- /TMPL_IF --><!-- /shelves -->
- <!-- TMPL_IF NAME="showpublicshelves" -->
- <div id="publicshelves" class="tab-container" style="display:block;">
- <!-- TMPL_ELSE -->
- <div id="publicshelves" class="tab-container" style="display:none;">
- <!-- /TMPL_IF -->
- <!-- TMPL_IF NAME="shelvesloop" -->
- <!-- TMPL_VAR name='pagination_bar'-->
- <table>
- <tr><th>List Name</th><th>Contents</th><th>Type</th><th> </th></tr>
- <!-- TMPL_LOOP NAME="shelvesloop" -->
- <!-- TMPL_IF NAME="toggle" --><tr class="highlight"><!--TMPL_ELSE--><tr><!-- /TMPL_IF -->
- <td><a href="opac-shelves.pl?viewshelf=<!-- TMPL_VAR NAME="shelf" -->"><!-- TMPL_VAR NAME="shelfname" ESCAPE="html" --></a></td>
- <td><!-- TMPL_VAR NAME="count" --> item(s)</td>
- <td><!-- TMPL_IF NAME="viewcategory1" -->Private<!-- /TMPL_IF -->
- <!-- TMPL_IF NAME="viewcategory2" -->Public<!-- /TMPL_IF -->
- <!-- TMPL_IF NAME="viewcategory3" -->Open<!-- /TMPL_IF -->
- </td>
- <td>
- <!-- TMPL_IF NAME="mine" -->
- <form action="opac-shelves.pl" method="get">
- <input type="hidden" name="shelfnumber" value="<!-- TMPL_VAR NAME="shelf" -->" />
- <input type="hidden" name="op" value="modif" />
- <input type="submit" class="editshelf" value="Edit" />
- </form>
- <form action="opac-shelves.pl" method="post">
- <input type="hidden" name="shelves" value="1" />
- <input type="hidden" name="DEL-<!-- TMPL_VAR NAME="shelf" -->" value="1" />
- <!-- TMPL_IF NAME="confirm" -->
- <input type="hidden" name="CONFIRM-<!-- TMPL_VAR NAME="confirm" -->" value="1" />
- <input type="submit" class="confirm" value="Confirm" />
- <!-- TMPL_ELSE -->
- <input type="submit" class="deleteshelf" onclick="return confirmDelete(_('Are you sure you want to remove this List?'));" value="Delete" />
- <!-- /TMPL_IF -->
- </form>
- <!-- /TMPL_IF -->
- <a href="#" class="send" onclick="open(CGIBIN+'opac-sendshelf.pl?shelfid=<!-- TMPL_VAR NAME="shelf" -->','win_form','dependant=yes,scrollbars=no,resizable=no,height=300,width=450,top=50,left=100')">Send List</a>
- </td>
- </tr>
- <!-- /TMPL_LOOP -->
- </table>
- <!-- TMPL_ELSE -->
- <!-- TMPL_IF NAME="showpublicshelves" -->No Public Lists.<!-- /TMPL_IF -->
- <!-- /TMPL_IF --><!-- /shelvesloop -->
- </div><!-- /publicshelves -->
- <!-- /TMPL_UNLESS --><!-- /viewshelf --><!-- /TMPL_UNLESS --><!-- /edit --><!-- /TMPL_UNLESS --><!-- /shelves -->
+
+ </div>
+ </div>
+ </div>
+ </div>
+ <!-- TMPL_IF EXPR="OpacNav||loggedinusername" -->
+ <div class="yui-b">
+ <div class="container">
+ <!-- TMPL_INCLUDE NAME="navigation.inc" -->
+ <!-- TMPL_INCLUDE NAME="usermenu.inc" -->
+ </div>
+ </div>
+ <!-- /TMPL_IF -->
+ </div><!-- /bd -->
- <!-- TMPL_IF NAME="shelves" -->
- <div id="addshelf"><form method="post" action="/cgi-bin/koha/opac-shelves.pl">
- <fieldset class="rows">
- <legend>Create a New List</legend>
- <input type="hidden" name="shelves" value="1" />
- <ol><li><label for="addshelf">List Name:</label>
- <!-- TMPL_IF NAME="already" -->
- <input id="addshelf" type="text" name="addshelf" value="<!-- TMPL_VAR NAME="already" -->" size="60" />
- <!-- TMPL_ELSE -->
- <input id="addshelf" type="text" name="addshelf" size="60" />
- <!-- /TMPL_IF -->
- <input type="hidden" name="owner" id="owner" value="<!-- TMPL_VAR NAME="loggedinuser" -->" /></li>
- <li><label for="sortfield" >Sort this list by: </label>
- <select name="sortfield">
- <!-- TMPL_IF NAME="sort_title" --><option value="title" selected="selected">Title</option><!-- TMPL_ELSE --><option value="title">Title</option><!-- /TMPL_IF -->
- <!-- TMPL_IF NAME="sort_author" --><option value="author" selected="selected">Author</option><!-- TMPL_ELSE --><option value="author">Author</option><!-- /TMPL_IF -->
- <!-- TMPL_IF NAME="sort_copyrightdate" --><option value="copyrightdate" selected="selected">Copyrightdate</option><!-- TMPL_ELSE --><option value="copyrightdate">Copyrightdate</option><!-- /TMPL_IF -->
- </select></li>
- <li><label for="category">Category:</label>
- <select name="category" id="category">
- <option value="1">Private</option>
- <option value="2">Public</option>
- </select></li>
-</ol>
- </fieldset>
- <fieldset class="action"><input type="submit" value="Save" class="submit" /> <a class="cancel" href="/cgi-bin/koha/opac-shelves.pl">Cancel</a></fieldset>
- </form> </div>
- <!-- /TMPL_IF --><!-- /showadd -->
- </div></div>
- </div>
- </div>
-<!-- TMPL_IF EXPR="OpacNav||loggedinusername" -->
- <div class="yui-b">
- <div class="container">
- <!-- TMPL_INCLUDE NAME="navigation.inc" -->
- <!-- TMPL_INCLUDE NAME="usermenu.inc" -->
- </div>
- </div><!-- /TMPL_IF -->
- </div>
<!-- </div> -->
-
<!-- DEBUG -->
-<div id="debug"></div>
+ <div id="debug"></div>
<!-- TMPL_INCLUDE NAME="opac-bottom.inc" -->
diff --git a/opac/opac-basket.pl b/opac/opac-basket.pl
index 399e666..154d8af 100755
--- a/opac/opac-basket.pl
+++ b/opac/opac-basket.pl
@@ -48,6 +48,12 @@ my @results;
my $num = 1;
my $marcflavour = C4::Context->preference('marcflavour');
+if (C4::Context->preference('TagsEnabled')) {
+ $template->param(TagsEnabled => 1);
+ foreach (qw(TagsShowOnList TagsInputOnList)) {
+ C4::Context->preference($_) and $template->param($_ => 1);
+ }
+}
foreach my $biblionumber ( @bibs ) {
diff --git a/opac/opac-tags.pl b/opac/opac-tags.pl
index 2b9dfd7..76c3abc 100755
--- a/opac/opac-tags.pl
+++ b/opac/opac-tags.pl
@@ -44,6 +44,10 @@ my %newtags = ();
my @deltags = ();
my %counts = ();
my @errors = ();
+my $perBibResults = {};
+
+# Indexes of @errors that do not apply to a particular biblionumber.
+my @globalErrorIndexes = ();
sub ajax_auth_cgi ($) { # returns CGI object
my $needed_flags = shift;
@@ -75,6 +79,7 @@ my $openadds = C4::Context->preference('TagsModeration') ? 0 : 1;
my $query = ($is_ajax) ? &ajax_auth_cgi({}) : CGI->new();
unless (C4::Context->preference('TagsEnabled')) {
push @errors, {+ tagsdisabled=>1 };
+ push @globalErrorIndexes, $#errors;
} else {
foreach ($query->param) {
if (/^newtag(.*)/) {
@@ -82,6 +87,7 @@ unless (C4::Context->preference('TagsEnabled')) {
unless ($biblionumber =~ /^\d+$/) {
$debug and warn "$_ references non numerical biblionumber '$biblionumber'";
push @errors, {+'badparam' => $_ };
+ push @globalErrorIndexes, $#errors;
next;
}
$newtags{$biblionumber} = $query->param($_);
@@ -109,6 +115,7 @@ if ($is_ajax) {
if ($add_op) {
unless ($loggedinuser) {
push @errors, {+'login' => 1 };
+ push @globalErrorIndexes, $#errors;
%newtags=(); # zero out any attempted additions
@deltags=(); # zero out any attempted deletions
}
@@ -119,6 +126,7 @@ my @newtags_keys = (keys %newtags);
if (scalar @newtags_keys) {
$scrubber = C4::Scrubber->new();
foreach my $biblionumber (@newtags_keys) {
+ my $bibResults = {adds=>0, errors=>[]};
my @values = split /[;,]/, $newtags{$biblionumber};
foreach (@values) {
s/^\s*(.+)\s*$/$1/;
@@ -126,8 +134,10 @@ if (scalar @newtags_keys) {
unless ($clean_tag eq $_) {
if ($clean_tag =~ /\S/) {
push @errors, {scrubbed=>$clean_tag};
+ push @{$bibResults->{errors}}, {scrubbed=>$clean_tag};
} else {
push @errors, {scrubbed_all_bad=>1};
+ push @{$bibResults->{errors}}, {scrubbed_all_bad=>1};
next; # we don't add it if there's nothing left!
}
}
@@ -136,11 +146,14 @@ if (scalar @newtags_keys) {
add_tag($biblionumber,$clean_tag,$loggedinuser) ;
if ($result) {
$counts{$biblionumber}++;
+ $bibResults->{adds}++;
} else {
push @errors, {failed_add_tag=>$clean_tag};
+ push @{$bibResults->{errors}}, {failed_add_tag=>$clean_tag};
$debug and warn "add_tag($biblionumber,$clean_tag,$loggedinuser...) returned bad result (" . (defined $result ? $result : 'UNDEF') .")";
}
}
+ $perBibResults->{$biblionumber} = $bibResults;
}
}
my $dels = 0;
@@ -156,6 +169,19 @@ if ($is_ajax) {
my $sum = 0;
foreach (values %counts) {$sum += $_;}
my $js_reply = sprintf("response = {\n\tadded: %d,\n\tdeleted: %d,\n\terrors: %d",$sum,$dels,scalar @errors);
+
+ # If no add attempts were made, flag global errors.
+ if (@globalErrorIndexes) {
+ $js_reply .= ",\n\tglobal_errors: [";
+ my $first = 1;
+ foreach (@globalErrorIndexes) {
+ $js_reply .= "," unless $first;
+ $first = 0;
+ $js_reply .= "\n\t\t$_";
+ }
+ $js_reply .= "\n\t]";
+ }
+
my $err_string = '';
if (scalar @errors) {
$err_string = ",\n\talerts: ["; # open response_function
@@ -168,7 +194,25 @@ if ($is_ajax) {
}
$err_string .= "\n\t]\n"; # close response_function
}
- output_ajax_with_http_headers($query, "$js_reply\n$err_string};");
+
+ # Add per-biblionumber results for use on results page
+ my $js_perbib = "";
+ for my $bib (keys %$perBibResults) {
+ my $bibResult = $perBibResults->{$bib};
+ my $js_bibres = ",\n\t$bib: {\n\t\tadded: $bibResult->{adds}";
+ $js_bibres .= ",\n\t\terrors: [";
+ my $i = 0;
+ foreach (@{$bibResult->{errors}}) {
+ $js_bibres .= "," if ($i);
+ my $key = (keys %$_)[0];
+ $js_bibres .= "\n\t\t\t KOHA.Tags.tag_message.$key(\"" . $_->{$key} . '")';
+ $i++;
+ }
+ $js_bibres .= "\n\t\t]\n\t}";
+ $js_perbib .= $js_bibres;
+ }
+
+ output_ajax_with_http_headers($query, "$js_reply\n$err_string\n$js_perbib\n};");
exit;
}
--
1.5.6.5
More information about the Koha-patches
mailing list