Owen Leonard
7420421a71
This patch changes the item edit page to add a highlighting background color to the row in the table of all items corresponding to the item being edited. Changes to JavaScript have been made to allow row color changes on hover. Other minor edits: Capitalization corrections. Signed-off-by: Melia Meggs <melia@bywatersolutions.com> Signed-off-by: Katrin Fischer <Katrin.Fischer.83@web.de> String changes, changes to JavaScript. All tests pass. Test plan: 1) 'Edit items' on a record with some items. 2) Check edited item is highlighted correctly in table above. 3) Add, edit, delete an item, should all work the same as before. Signed-off-by: Jared Camins-Esakov <jcamins@cpbibliography.com>
231 lines
12 KiB
Text
231 lines
12 KiB
Text
[% INCLUDE 'doc-head-open.inc' %]
|
|
<title>Koha › Cataloging › [% title |html %] [% IF ( author ) %] by [% author %][% END %] (Record #[% biblionumber %]) › Items</title>
|
|
[% INCLUDE 'doc-head-close.inc' %]
|
|
<script type="text/javascript" src="[% themelang %]/js/cataloging.js"></script>
|
|
<script type="text/javascript">
|
|
//<![CDATA[
|
|
$(document).ready(function(){
|
|
[% IF (popup) %]
|
|
[% IF (opisadd) %]
|
|
window.close();
|
|
[% END %]
|
|
[% END %]
|
|
$("fieldset.rows input").keydown(function(e){ return checkEnter(e); });
|
|
/* Inline edit/delete links */
|
|
var biblionumber = $("input[name='biblionumber']").attr("value");
|
|
$("td").click(function(event){
|
|
var $tgt = $(event.target);
|
|
if($tgt.is("a")||$tgt.is(":first-child")||$tgt.is(":nth-child(2)")){ return true; } else {
|
|
var rowid = $(this).parent().attr("id");
|
|
num_rowid = rowid.replace("row","");
|
|
$(".linktools").remove();
|
|
$(this).append("<span class=\"linktools\"><a href=\"/cgi-bin/koha/cataloguing/additem.pl?op=edititem&frameworkcode=[% frameworkcode %]&biblionumber=[% biblionumber %]&itemnumber="+num_rowid+"#edititem\">Edit Item</a> <a href=\"/cgi-bin/koha/cataloguing/additem.pl?op=delitem&frameworkcode=[% frameworkcode %]&biblionumber=[% biblionumber %]&itemnumber="+num_rowid+"\" onclick=\"confirm_deletion([% biblionumber %],"+num_rowid+"); return false;\">Delete Item</a></span>");
|
|
}
|
|
});
|
|
});
|
|
function active(numlayer)
|
|
{
|
|
for (i=10; i < 11 ; i++ ) {
|
|
ong = i+"XX";
|
|
link = "link"+i;
|
|
if (numlayer==i) {
|
|
document.getElementById(ong).style.visibility="visible";
|
|
document.getElementById(link).style.backgroundColor="#11AA11";
|
|
document.getElementById(link).style.backgroundImage="url([% themelang %]/images/background-mem.gif)";
|
|
} else {
|
|
document.getElementById(ong).style.visibility="hidden";
|
|
document.getElementById(link).style.backgroundColor="#FFFFFF";
|
|
document.getElementById(link).style.backgroundImage="";
|
|
}
|
|
}
|
|
}
|
|
function Check(f) {
|
|
var total_errors=0;
|
|
$("input[name='mandatory'],select[name='mandatory']").each(function(i){
|
|
if($(this).val() == 1){
|
|
var mandatory_field = $("input[name='field_value'],select[name='field_value']").eq(i);
|
|
if(mandatory_field.val() == ''){
|
|
mandatory_field.addClass("missing");
|
|
total_errors++;
|
|
}
|
|
}
|
|
});
|
|
|
|
var alertString2;
|
|
if (total_errors==0) {
|
|
return true;
|
|
} else {
|
|
alertString2 = _("Form not submitted because of the following problem(s)");
|
|
alertString2 += "\n------------------------------------------------------------------------------------\n";
|
|
alertString2 += "\n- "+ total_errors+_(" mandatory fields empty (highlighted)");
|
|
alert(alertString2);
|
|
return false;
|
|
}
|
|
}
|
|
function CheckMultipleAdd(f) {
|
|
|
|
if (!f || isNaN(f) || !parseInt(f) == f || f <= 0) {
|
|
alert(_("Please enter a number of items to create."));
|
|
return false;
|
|
}
|
|
}
|
|
function Dopop(link,i) {
|
|
defaultvalue=document.forms[0].field_value[i].value;
|
|
newin=window.open(link+"&result="+defaultvalue,"valuebuilder",'width=500,height=400,toolbar=false,scrollbars=yes');
|
|
}
|
|
|
|
function confirm_deletion(biblionumber,itemnumber) {
|
|
var original = $("#row"+itemnumber).attr("class");
|
|
$("#row"+itemnumber).attr("class","confirm");
|
|
var is_confirmed = confirm(_("Are you sure you want to delete this item?"));
|
|
if (is_confirmed) {
|
|
window.location = "additem.pl?op=delitem&biblionumber="+biblionumber+"&itemnumber="+itemnumber;
|
|
} else {
|
|
$("#row"+itemnumber).attr("class","");
|
|
}
|
|
}
|
|
|
|
$(document).ready(function() {
|
|
$("#cataloguing_additem_itemlist tr").hover(
|
|
function () {$(this).addClass("highlight");},
|
|
function () {$(this).removeClass("highlight");}
|
|
);
|
|
});
|
|
//]]>
|
|
</script>
|
|
<link type="text/css" rel="stylesheet" href="[% themelang %]/css/addbiblio.css" />
|
|
</head>
|
|
<body id="cat_additem" class="cat">
|
|
[% INCLUDE 'header.inc' %]
|
|
<div id="breadcrumbs">
|
|
<a href="/cgi-bin/koha/mainpage.pl">Home</a>
|
|
› <a href="/cgi-bin/koha/cataloguing/addbooks.pl">Cataloging</a>
|
|
› Edit <a href="/cgi-bin/koha/cataloguing/addbiblio.pl?biblionumber=[% biblionumber %]">[% title |html %] [% IF ( author ) %] by [% author %][% END %] (Record #[% biblionumber %])</a>
|
|
› <a href="/cgi-bin/koha/cataloguing/additem.pl?biblionumber=[% biblionumber %]">Items</a>
|
|
</div>
|
|
|
|
<div id="doc3" class="yui-t7">
|
|
|
|
<div id="bd">
|
|
<div id="yui-main">
|
|
|
|
<h1>Items for [% title |html %] [% IF ( author ) %] by [% author %][% END %] (Record #[% biblionumber %])</h1>
|
|
|
|
[% IF ( barcode_not_unique ) %]<div class="dialog alert"><strong>Error saving item</strong>: Barcode must be unique.</div>[% END %]
|
|
[% IF ( no_next_barcode ) %]<div class="dialog alert"><strong>Error saving items</strong>: Unable to automatically determine values for barcodes. No item has been inserted.</div>[% END %]
|
|
[% IF ( book_on_loan ) %]<div class="dialog alert"><strong>Cannot Delete</strong>: item is checked out.</div>[% END %]
|
|
[% IF ( book_reserved ) %]<div class="dialogalert"><strong>Cannot Delete</strong>: item has a waiting hold.</div>[% END %]
|
|
[% IF ( not_same_branch ) %]<div class="dialog alert"><strong>Cannot Delete</strong>: The items do not belong to your library.</div>[% END %]
|
|
[% IF ( linked_analytics ) %]<div class="dialog alert"><strong>Cannot Delete</strong>: item has linked <a href="/cgi-bin/koha/catalogue/detail.pl?biblionumber=[% biblionumber %]&analyze=1">analytics.</a>.</div>[% END %]
|
|
|
|
<div id="cataloguing_additem_itemlist">
|
|
[% IF ( item_loop ) %]
|
|
<div>
|
|
<table>
|
|
<tr>
|
|
<th colspan="2"> </th>
|
|
[% FOREACH item_header_loo IN item_header_loop %]
|
|
<th>
|
|
[% item_header_loo.header_value %]
|
|
</th>
|
|
[% END %]
|
|
</tr>
|
|
[% FOREACH item_loo IN item_loop %]
|
|
[% IF ( item_loo.itemnumber == itemnumber) %]
|
|
<tr id="row[% item_loo.itemnumber %]" class="active">
|
|
[% ELSE %]
|
|
<tr id="row[% item_loo.itemnumber %]">
|
|
[% END %]
|
|
[% IF ( item_loo.nomod ) %] <td colspan="2"> </td>[% ELSE %][% IF ( item_loo.hostitemflag ) %]<td><a href="additem.pl?op=edititem&biblionumber=[% item_loo.hostbiblionumber %]&itemnumber=[% item_loo.itemnumber %]#edititem">Edit in host</a></td>
|
|
<td><a class="delete" href="/cgi-bin/koha/cataloguing/additem.pl?op=delinkitem&biblionumber=[% biblionumber %]&hostitemnumber=[% item_loo.itemnumber %]">Delink</a></td>
|
|
[% ELSE %]<td><a href="additem.pl?op=edititem&biblionumber=[% biblionumber %]&itemnumber=[% item_loo.itemnumber %]#edititem">Edit</a></td>
|
|
<td>[% IF ( item_loo.countanalytics ) %]<a href="/cgi-bin/koha/catalogue/search.pl?idx=hi&q=% item_loo.itemnumber %]">View analytics</a>[% ELSE %]<a class="delete" href="/cgi-bin/koha/cataloguing/additem.pl?op=delitem&biblionumber=[% biblionumber %]&itemnumber=[% item_loo.itemnumber %]" onclick="confirm_deletion([% biblionumber %],[% item_loo.itemnumber %]); return false;">Delete</a>[% END %]</td>[% END %][% END %]
|
|
[% FOREACH item_valu IN item_loo.item_value %]
|
|
<td>[% item_valu.field |html %]</td>
|
|
[% END %]
|
|
</tr>
|
|
[% END %]
|
|
</table>
|
|
</div>
|
|
[% END %]
|
|
</div>
|
|
<div class="yui-gf">
|
|
<div class="yui-u first">
|
|
[% INCLUDE 'biblio-view-menu.inc' %]
|
|
</div>
|
|
<div class="yui-u">
|
|
<div id="cataloguing_additem_newitem">
|
|
<form method="post" action="/cgi-bin/koha/cataloguing/additem.pl" name="f">
|
|
<input type="hidden" name="op" value="[% op %]" />
|
|
[% IF (popup) %]
|
|
<input type="hidden" name="popup" value="1" />
|
|
[% END %]
|
|
<input type="hidden" name="biblionumber" value="[% biblionumber %]" />
|
|
[% IF ( opisadd ) %]
|
|
<h2 id="additema">Add item</h2>
|
|
[% ELSE %]
|
|
<h2 id="edititem">Edit Item #[% itemnumber %][% IF ( barcode ) %] / Barcode [% barcode %][% END %]</h2>
|
|
[% END %]
|
|
<fieldset class="rows">
|
|
<ol>
|
|
[% FOREACH ite IN item %]
|
|
<li><div class="subfield_line" style="[% ite.visibility %]" id="subfield[% ite.tag %][% ite.subfield %][% ite.random %]">
|
|
[% IF ( ite.mandatory ) %]
|
|
<label class="required">[% ite.subfield %] - [% ite.marc_lib %]</label>
|
|
[% ELSE %]
|
|
<label>[% ite.subfield %] - [% ite.marc_lib %]</label>
|
|
[% END %]
|
|
[% ite.marc_value %]
|
|
<input type="hidden" name="tag" value="[% ite.tag %]" />
|
|
<input type="hidden" name="subfield" value="[% ite.subfield %]" />
|
|
<input type="hidden" name="mandatory" value="[% ite.mandatory %]" />
|
|
[% IF ( ite.repeatable ) %]
|
|
<a href="#" class="buttonPlus" onclick="CloneItemSubfield(this.parentNode); return false;">
|
|
<img src="/intranet-tmpl/prog/img/clone-subfield.png" alt="Clone" title="Clone this subfield" />
|
|
</a>
|
|
[% END %]
|
|
[% IF ( ite.mandatory ) %] <span class="required">Required</span>[% END %]
|
|
</div></li>
|
|
[% END %]
|
|
</ol>
|
|
</fieldset>
|
|
<input type="hidden" name="indicator" value=" " />
|
|
<input type="hidden" name="indicator" value=" " />
|
|
<input type="hidden" name="itemnumber" value="[% itemnumber %]" />
|
|
|
|
<fieldset class="action"> [% IF ( opisadd ) %]
|
|
<input type="submit" name="phony_submit" value="phony_submit" id="phony_submit" style="display:none;" onclick="return false;" />
|
|
<!-- Note : We use here a false submit button because we have several submit buttons and we don't want the user to believe he validated the adding of multiple copies
|
|
when pressing the enter key, while in fact it is the first submit button that is validated, in our case the "add (single) item" button.
|
|
It is a bit tricky, but necessary in the sake of UI correctness.
|
|
-->
|
|
|
|
<input type="submit" name="add_submit" value="Add item" onclick="return Check(this.form)" />
|
|
<input type="submit" name="add_duplicate_submit" value="Add & duplicate" onclick="return Check(this.form)" />
|
|
<input type="submit" name="add_multiple_copies" value="Add multiple copies" onclick="javascript:this.nextSibling.style.visibility='visible';document.f.number_of_copies.focus(); return false;" /><span id="add_multiple_copies_span" style="visibility:hidden">
|
|
<label for="number_of_copies">Number of copies to add : </label>
|
|
<input type="text" id="number_of_copies" name="number_of_copies" value="" size="2" />
|
|
<input type="submit" id="add_multiple_copies_submit" name="add_multiple_copies_submit" value="Add" onclick="javascript:return Check(this.form) && CheckMultipleAdd(this.form.number_of_copies.value);" />
|
|
</span>
|
|
|
|
[% ELSE %]
|
|
<input type="hidden" name="tag" value="[% itemtagfield %]" />
|
|
<input type="hidden" name="subfield" value="[% itemtagsubfield %]" />
|
|
<input type="hidden" name="field_value" value="[% itemnumber %]" />
|
|
<input type="submit" value="Save changes" onclick="return Check(this.form)" />
|
|
[% END %]</fieldset>
|
|
|
|
<input type="hidden" name="borrowernumber" value="[% borrowernumber %]" />
|
|
<input type="hidden" name="stickyduedate" value="[% stickyduedate %]" />
|
|
<input type="hidden" name="barcode" value="[% barcode %]" />
|
|
<input type="hidden" name="duedatespec" value="[% duedatespec %]" />
|
|
|
|
|
|
</form>
|
|
</div>
|
|
</div><!-- /yui-u -->
|
|
</div><!-- /yui-gf -->
|
|
|
|
</div>
|
|
</div>
|
|
[% INCLUDE 'intranet-bottom.inc' %]
|