Koha/koha-tmpl/intranet-tmpl/prog/en/modules/virtualshelves/shelves.tt
Marcel de Rooy 95e513f400 Bug 7310 Followup: Warnings for nothingdeleted and somedeleted for staff client.
Test this patch by trying to delete items from a public list that someone else created (so you do not have sufficient permissions). Check the warning.

Signed-off-by: Jared Camins-Esakov <jcamins@cpbibliography.com>
Signed-off-by: Ian Walls <koha.sekjal@gmail.com>
2012-03-21 16:47:33 +01:00

451 lines
20 KiB
Text

[% INCLUDE 'doc-head-open.inc' %]
<title>Koha &rsaquo; [% IF ( viewshelf ) %]Lists &rsaquo; Contents of [% shelfname | html %][% ELSE %]Lists[% END %][% IF ( shelves ) %] &rsaquo; Create New List[% END %][% IF ( edit ) %] &rsaquo; Edit List [% shelfname | html %][% END %]</title>
[% INCLUDE 'doc-head-close.inc' %]
<script type="text/javascript" src="[% themelang %]/lib/jquery/plugins/jquery.checkboxes.min.js"></script>
<script type="text/javascript">
//<![CDATA[
var MSG_NO_ITEM_SELECTED = _("Nothing is selected.");
$(document).ready(function(){
$("#addbarcode").focus();
$("span.clearall").html("<a id=\"CheckNone\" href=\"/cgi-bin/koha/shelves.pl\">"+_('Clear All')+"<\/a>");
$("span.checkall").html("<a id=\"CheckAll\" href=\"/cgi-bin/koha/shelves.pl\">"+_('Select All')+"<\/a>");
$("#CheckAll").click(function(){
$(".checkboxed").checkCheckboxes();
return false;
});
$("#CheckNone").click(function(){
$(".checkboxed").unCheckCheckboxes();
return false;
});
$("#placehold").show();
});
function confirmDelete(message){
if (window.confirm(message)) {
location.href="/cgi-bin/koha/virtualshelves/shelves.pl?[% IF ( showprivateshelves ) %]display=privateshelves&[% END %]shelves=1&DEL-[% shelfnumber %]=1&shelfoff=[% shelfoff %]";
} else {
return false;
}
}
/**
* This function checks if the adequate number of records are checked for merging
*/
function MergeItems() {
var checkboxes = $("input:checkbox:checked");
var nbCheckbox = checkboxes.length;
if (nbCheckbox != 2) {
alert(_('Two records must be selected for merging.'));
} else {
location.href='/cgi-bin/koha/cataloguing/merge.pl?biblionumber=' + checkboxes[0].value + '&amp;biblionumber=' + checkboxes[1].value;
}
return false;
}
/**
* This function checks all checkboxes if all are empty,
* or unchecks all if any already checked.
*/
function CheckAll(){
var checkboxes = document.getElementsByTagName('input');
var nbCheckbox = checkboxes.length;
var check = areAllChecked();
for(var i=0;i<nbCheckbox;i++){
if(checkboxes[i].getAttribute('type') == "checkbox" ){
checkboxes[i].checked = (check) ? 0 : 1;
}
}
}
/**
* This function returns true if ALL checkboxes are checked
*/
function areAllChecked(){
var checkboxes = document.getElementsByTagName('input');
var nbCheckbox = checkboxes.length;
for(var i=0;i<nbCheckbox;i++){
if(checkboxes[i].getAttribute('type') == "checkbox" ){
if(checkboxes[i].checked == 0){
return false;
}
}
}
return true;
}
function placeHold () {
var checkedItems = $(".selection:checked");
if ($(checkedItems).size() == 0) {
alert(MSG_NO_ITEM_SELECTED);
return false;
}
var bibs = "";
$(checkedItems).each(function() {
bibs += $(this).val() + "/";
});
$("#hold_form_biblios").val(bibs);
$("#hold_form").submit();
return false;
}
/**
* This function checks to make sure a list title is assigned
*/
function Check(f) {
var _alertString="";
var alertString2;
if($("#shelfname").val() == ""){
_alertString += _("- You must enter a List Name") + "\n";
}
if (_alertString.length==0) {
f.submit();
} else {
alertString2 = _("Form not submitted because of the following problem(s)");
alertString2 += "\n------------------------------------------------------------------------------------\n\n";
alertString2 += _alertString;
alert(alertString2);
}
}
//]]>
</script>
</head>
<body>
[% INCLUDE 'header.inc' %]
[% INCLUDE 'cat-search.inc' %]
<div id="breadcrumbs"><a href="/cgi-bin/koha/mainpage.pl">Home</a> &rsaquo; <a href="/cgi-bin/koha/virtualshelves/shelves.pl">Lists</a> [% IF ( category1 ) %] &rsaquo; [% IF ( viewshelf || edit ) %] <a href="/cgi-bin/koha/virtualshelves/shelves.pl?display=privateshelves">Your Lists</a> [% ELSE %] Your Lists [% END %] [% ELSIF ( category2 ) %] &rsaquo; [% IF ( viewshelf ) %] <a href="/cgi-bin/koha/virtualshelves/shelves.pl?display=publicshelves">Public Lists</a> [% ELSE %] Public Lists [% END %] [% ELSIF ( showprivateshelves ) %] &rsaquo; [% IF ( viewshelf || edit ) %] <a href="/cgi-bin/koha/virtualshelves/shelves.pl?display=privateshelves">Your Lists</a> [% ELSE %] Your Lists [% END %] [% ELSIF ( showpublicshelves ) %] &rsaquo; [% IF ( viewshelf || edit ) %] <a href="/cgi-bin/koha/virtualshelves/shelves.pl?display=publicshelves">Public Lists</a> [% ELSE %] Public Lists [% END %] [% END %]
[% IF ( viewshelf ) %]&rsaquo; Contents of <i>[% shelfname | html %]</i>[% END %][% IF ( shelves ) %] &rsaquo; Create New List[% END %][% IF ( edit ) %] &rsaquo; Edit List <i>[% shelfname | html %]</i>[% END %]</div>
<div id="doc" class="yui-t7">
<div id="bd">
<div id="yui-main">
<div class="yui-g">[% INCLUDE 'virtualshelves-toolbar.inc' %]
</div>
[% IF ( paramsloop ) %]
[% FOREACH paramsloo IN paramsloop %]
<div class="yui-ge">
<div class="yui-u first">
[% IF ( paramsloo.already ) %]<div class="dialog alert">A List named [% paramsloo.already %] already exists!</div>[% END %]
[% IF ( paramsloo.status ) %]<div class="dialog alert">[% paramsloo.string %]</div>[% END %]
[% IF ( paramsloo.nobarcode ) %]<div class="dialog alert">ERROR: No barcode given.</div>[% END %]
[% IF ( paramsloo.noshelfnumber ) %]<div class="dialog alert">ERROR: No shelfnumber given.</div>[% END %]
[% IF ( paramsloo.need_confirm ) %]
<div class="dialog alert">The list <i>[% paramsloo.need_confirm %]</i> is not empty.
<br />It has <b>[% paramsloo.count %]</b> entries.
<br />Use the "Confirm" button below to confirm deletion.
</div>
[% END %]
[% IF ( paramsloo.nopermission ) %]
<div class="dialog alert">ERROR: You do not have adequate permission for that action on list [% paramsloo.nopermission %].</div>
[% END %]
[% IF ( paramsloo.failgetitem ) %]
<div class="dialog alert">ERROR: No item found with barcode [% paramsloo.failgetitem %].</div>
[% END %]
[% IF ( paramsloo.duplicatebiblio ) %]
<div class="dialog alert">A record matching barcode <b>[% paramsloo.duplicatebiblio %]</b> has already been added.</div>
[% END %]
[% IF ( paramsloo.nothingdeleted) %]
<div class="dialog message">Warning: You could not delete any selected items from this shelf.</div>
[% END %]
[% IF ( paramsloo.somedeleted) %]
<div class="dialog message">Warning: You could not delete all selected items from this shelf.</div>
[% END %]
</div>
</div>
[% END %]
[% END %]
[% IF ( viewshelf ) %]
<div class="yui-g">
[% IF ( itemsloop ) %]
<form action="/cgi-bin/koha/virtualshelves/shelves.pl" method="post" class="checkboxed">
<input type="hidden" name="viewshelf" value="[% shelfnumber %]" />
<input type="hidden" name="modifyshelfcontents" value="1" />
<fieldset>
<legend>Contents of <i>[% shelfname | html %]</i></legend>
[% IF ( itemsloop ) %]
<p><span class="checkall"></span> |
<span class="clearall"></span></p>
[% END %]
<div class="pages">[% pagination_bar %]</div>
<table>
<tr>
[% IF ( itemsloop ) %]<th class="checkall">&nbsp;</th>[% END %]
[% UNLESS ( item_level_itypes ) %]<th>Item Type</th>[% END %]
<th>Title</th>
<th>Author</th>
<th>Date Added</th>
<th>&nbsp;</th>
</tr>
[% FOREACH itemsloo IN itemsloop %]
[% UNLESS ( loop.odd ) %]
<tr class="highlight">
[% ELSE %]
<tr>
[% END %]
[% IF ( itemsloop ) %]
<td>
[% IF ( itemsloo.confirm ) %]
<input type="hidden" name="CONFIRM-[% itemsloo.confirm %]" />
<input type="checkbox" class="selection" value="[% itemsloo.biblionumber %]" name="REM-[% itemsloo.biblionumber %]" checked />
[% ELSE %]
<input type="checkbox" class="selection" value="[% itemsloo.biblionumber %]" name="REM-[% itemsloo.biblionumber %]" />
[% END %]
</td>
[% END %]
[% UNLESS ( item_level_itypes ) %]<td>
[% UNLESS ( noItemTypeImages || !itemsloo.imageurl ) %]<img src="[% itemsloo.imageurl %]" alt="[% itemsloo.description %]" title="[% itemsloo.description %]" />[% END %][% itemsloo.description %]
</td>[% END %]
<td>
[% INCLUDE 'biblio-default-view.inc' biblionumber = itemsloo.biblionumber %]
[% itemsloo.title |html %][% FOREACH subtitl IN itemsloo.subtitle %] [% subtitl.subfield %][% END %]</a>
</td>
<td>[% itemsloo.author %]</td>
<td>[% itemsloo.dateadded %]</td>
<td>
[% UNLESS ( itemsloo.notforloan ) %]
<a href="/cgi-bin/koha/reserve/request.pl?biblionumber=[% itemsloo.biblionumber %]">Holds</a>
[% END %]
</td>
</tr>
[% END %]<!-- /itemsloop -->
</table><fieldset class="action">
[% IF ( itemsloop ) %]
<input type="button" id="placehold" style="display:none" onclick="placeHold(); return false;" value="Place Holds" />
[% IF ( allowremovingitems ) %]<input type="submit" value="Remove selected records" onclick="return confirm(_('Are you sure you want to remove these records from the shelf?'));" />[% END %]
<input type="submit" value="Merge selected records" onclick="return MergeItems();" />
[% END %]
</fieldset>
</fieldset>
</form>
[% END %]
</div>
[% END %]<!-- /viewshelf -->
[% IF ( allowaddingitem ) %]
<div class="yui-g">
<form action="/cgi-bin/koha/virtualshelves/shelves.pl" method="post">
<fieldset class="brief">
<legend>Add an item to <i>[% shelfname | html %]</i></legend>
<ol>
<li>
<label for="addbarcode">Barcode:</label>
<input name="addbarcode" type="text" id="addbarcode" size="14" />
<input type="hidden" name="viewshelf" value="[% shelfnumber %]" />
<input type="hidden" name="modifyshelfcontents" value="1" />
<input type="submit" value="Add" />
</li>
</ol>
</fieldset>
</form>
</div>
[% END %]<!-- /allowaddingitem -->
[% IF ( debug ) %]
[% IF ( edit ) %]<div>Edit is on ([% shelfname | html %])</div>[% END %]
[% IF ( seflag ) %]<div>seflag is on ([% seflag %])</div>[% END %]
[% END %]
[% IF ( seflag ) %]
<div class="yui-ge">
<div class="yui-u first">
<form method="post" action="/cgi-bin/koha/virtualshelves/shelves.pl">
<fieldset class="rows">
[% IF ( shelves ) %]
<input type="hidden" name="shelves" value="1" />
<legend>Create a new List</legend>
<ol>
<li><label class="required" for="addshelf">List Name:</label><input id="addshelf" type="text" name="addshelf" size="25" /></li>
<li><span class="label">Owner: </span><input type="hidden" name="owner" id="owner" value="[% loggedinuser %]" />[% loggedinusername %]</li>
<li><label for="sortfield" >Sort this list by: </label>
<select name="sortfield" id="sortfield">
[% IF ( sort_title ) %]<option value="title" selected="selected">Title</option>[% ELSE %]<option value="title">Title</option>[% END %]
[% IF ( sort_author ) %]<option value="author" selected="selected">Author</option>[% ELSE %]<option value="author">Author</option>[% END %]
[% IF ( sort_copyrightdate ) %]<option value="copyrightdate" selected="selected">Copyrightdate</option>[% ELSE %]<option value="copyrightdate">Copyrightdate</option>[% END %]
</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>
[% END %]
[% IF ( edit ) %]
<input type="hidden" name="op" value="modifsave" />
[% IF ( showprivateshelves ) %]<input type="hidden" name="display" value="privateshelves" />[% END %]
<input type="hidden" name="shelfnumber" value="[% shelfnumber %]" />
<legend>Edit List <i>[% shelfname | html %]</i></legend>
<ol>
<li><label for="shelfname">Name: </label><input type="text" id="shelfname" name="shelfname" size="25" value="[% shelfname |html %]" /></li>
<li><label for="owner">Owner: </label><input type="hidden" id="owner" name="owner" value="[% IF ( owner ) %][% ownername %][% ELSE %][% loggedinusername %][% END %]" />[% IF ( owner ) %][% ownername %][% ELSE %][% loggedinusername %][% END %]</li>
<li><label for="sortfield" >Sort this list by: </label>
<select name="sortfield">
[% IF ( sort_title ) %]<option value="title" selected="selected">Title</option>[% ELSE %]<option value="title">Title</option>[% END %]
[% IF ( sort_author ) %]<option value="author" selected="selected">Author</option>[% ELSE %]<option value="author">Author</option>[% END %]
[% IF ( sort_copyrightdate ) %]<option value="copyrightdate" selected="selected">Copyrightdate</option>[% ELSE %]<option value="copyrightdate">Copyrightdate</option>[% END %]
</select></li>
<li><label for="category">Category: </label>
<select id="category" name="category">
[% IF ( category1 ) %]
<option value="1" selected="selected">Private</option>
[% ELSE %]
<option value="1">Private</option>
[% END %]
[% IF ( category2 ) %]
<option value="2" selected="selected">Public</option>
[% ELSE %]
<option value="2">Public</option>
[% END %]
</select></li></ol>
[% END %]
</fieldset>
<fieldset class="action"><input type="submit" onclick="Check(this.form); return false;" value="Save" class="submit" />
[% IF ( showprivateshelves ) %]<a href="/cgi-bin/koha/virtualshelves/shelves.pl?display=privateshelves" class="cancel">Cancel</a>[% ELSE %]<a href="/cgi-bin/koha/virtualshelves/shelves.pl" class="cancel">Cancel</a>[% END %]
</fieldset>
</form>
</div>
<div class="yui-u">
<div class="help"><ul>
<li>A <b>Private</b> List is managed by you and can be seen only by you.</li>
<li> A <b>Public</b> List can be seen by everybody, but managed only by you.</li>
</ul>
</div>
</div>
</div>
[% END %]<!-- /seflag -->
[% UNLESS ( vseflag ) %]
<h2>Lists</h2>
<div class="toptabs">
<ul class="ui-tabs-nav">
[% IF ( showprivateshelves ) %]
<li id="privateshelves_tab" class="ui-tabs-selected"><a href="/cgi-bin/koha/virtualshelves/shelves.pl?display=privateshelves">Your Lists</a></li>
[% ELSE %]
<li id="privateshelves_tab" class=""><a href="/cgi-bin/koha/virtualshelves/shelves.pl?display=privateshelves">Your Lists</a></li>
[% END %]
[% IF ( showpublicshelves ) %]
<li id="publicshelves_tab" class="ui-tabs-selected"><a href="/cgi-bin/koha/virtualshelves/shelves.pl?display=publicshelves">Public Lists</a></li>
[% ELSE %]
<li id="publicshelves_tab" class=""><a href="/cgi-bin/koha/virtualshelves/shelves.pl?display=publicshelves">Public Lists</a></li>
[% END %]
</ul>
[% IF ( showprivateshelves ) %]
<div id="privateshelves" class="ui-tabs-panel" style="display:block;">
[% ELSE %]
<div id="privateshelves" class="ui-tabs-panel" style="display:none;">
[% END %]
[% IF ( shelveslooppriv ) %]
<div class="pages">[% pagination_bar %]</div>
<table>
<tr><th>List Name</th><th>Contents</th><th>Sort by</th><th>Type</th><th>Options</th></tr>
[% FOREACH shelveslooppri IN shelveslooppriv %]
[% IF ( shelveslooppri.toggle ) %]<tr class="highlight">[% ELSE %]<tr>[% END %]
<td><a href="shelves.pl?[% IF ( shelveslooppri.showprivateshelves ) %]display=privateshelves&amp;[% END %]viewshelf=[% shelveslooppri.shelf %]&amp;shelfoff=[% shelfoff %]">[% shelveslooppri.shelfname |html %]</a></td>
<td>[% shelveslooppri.count %] item(s)</td>
<td>[% IF ( shelveslooppri.authorsort ) %]Author[% ELSIF ( shelveslooppri.yearsort ) %]Year[% ELSE %]Title[% END %]</td>
<td>[% IF ( shelveslooppri.viewcategory1 ) %]Private[% END %]
[% IF ( shelveslooppri.viewcategory2 ) %]Public[% END %]
</td>
<td>
[% IF ( shelveslooppri.mine ) %]
<form action="merge.pl" method="get">
<input type="hidden" name="shelf" value="[% shelveslooppri.shelf %]" />
</form>
<form action="shelves.pl" method="get">
<input type="hidden" name="shelfnumber" value="[% shelveslooppri.shelf %]" />
<input type="hidden" name="op" value="modif" />
<input type="hidden" name="display" value="privateshelves" />
<input type="submit" class="editshelf" value="Edit" />
</form>
<form action="shelves.pl" method="post">
<input type="hidden" name="shelfoff" value="[% shelfoff %]" />
<input type="hidden" name="shelves" value="1" />
<input type="hidden" name="display" value="privateshelves" />
<input type="hidden" name="DEL-[% shelveslooppri.shelf %]" value="1" />
[% IF ( shelveslooppri.confirm ) %]
<input type="hidden" name="CONFIRM-[% shelveslooppri.confirm %]" value="1" />
<input type="submit" class="approve" value="Confirm" />
[% ELSE %]
<input type="submit" class="deleteshelf" onclick="return confirmDelete(_('Are you sure you want to remove this List?'));" value="Delete" />
[% END %]
</form>
[% ELSE %]
None
[% END %]
</td>
</tr>
[% END %]
</table>
[% ELSE %]
<p>No Private Lists.</p>
[% END %]<!-- /shelveslooppriv -->
</div><!-- /privateshelves -->
[% IF ( showpublicshelves ) %]
<div id="publicshelves" class="ui-tabs-panel" style="display:block;">
[% ELSE %]
<div id="publicshelves" class="ui-tabs-panel" style="display:none;">
[% END %]
[% IF ( shelvesloop ) %]
<div class="pages">[% pagination_bar %]</div>
<table>
<tr><th>List Name</th><th>Created by</th><th>Contents</th><th>Sort By</th><th>Type</th><th>Options</th></tr>
[% FOREACH shelvesloo IN shelvesloop %]
[% IF ( shelvesloo.toggle ) %]<tr class="highlight">[% ELSE %]<tr>[% END %]
<td><a href="shelves.pl?viewshelf=[% shelvesloo.shelf %]">[% shelvesloo.shelfname |html %]</a></td>
<td><a href="/cgi-bin/koha/members/moremember.pl?borrowernumber=[% shelvesloo.owner %]">[% shelvesloo.ownername %]</td>
<td>[% shelvesloo.count %] item(s)</td>
<td>[% IF ( shelvesloo.authorsort ) %]Author[% ELSIF ( shelvesloo.yearsort ) %]Year[% ELSE %]Title[% END %]</td>
<td>[% IF ( shelvesloo.viewcategory1 ) %]Private[% END %]
[% IF ( shelvesloo.viewcategory2 ) %]Public[% END %]
</td>
<td>
[% IF ( shelvesloo.manageshelf ) %]
<form action="shelves.pl" method="get">
<input type="hidden" name="shelfnumber" value="[% shelvesloo.shelf %]" />
<input type="hidden" name="op" value="modif" />
<input type="submit" class="editshelf" value="Edit" />
</form>
<form action="shelves.pl" method="post">
<input type="hidden" name="shelfoff" value="[% shelfoff %]" />
<input type="hidden" name="shelves" value="1" />
<input type="hidden" name="DEL-[% shelvesloo.shelf %]" value="1" />
[% IF ( shelvesloo.confirm ) %]
<input type="hidden" name="CONFIRM-[% shelvesloo.confirm %]" value="1" />
<input type="submit" class="approve" value="Confirm" />
[% ELSE %]
<input type="submit" class="deleteshelf" onclick="return confirmDelete(_('Are you sure you want to remove this List?'));" value="Delete" />
[% END %]
</form>
[% ELSE %]
None
[% END %]
</td>
</tr>
[% END %]
</table>
[% ELSE %]
[% IF ( showpublicshelves ) %]No Public Lists.[% END %]
[% END %]<!-- /shelvesloop -->
</div><!-- /publicshelves -->
</div>
[% END %]
<form id="hold_form" method="get" action="/cgi-bin/koha/reserve/request.pl">
<!-- Value will be set here by placeHold() -->
<input id="hold_form_biblios" type="hidden" name="biblionumbers" value="" />
<input type="hidden" name="multi_hold" value="1"/>
</form>
</div>
</div>
[% INCLUDE 'intranet-bottom.inc' %]