1 [% INCLUDE 'doc-head-open.inc' %]
2 <title>Koha › Cataloging › [% title |html %] [% IF ( author ) %] by [% author %][% END %] (Record #[% biblionumber %]) › Items</title>
3 [% INCLUDE 'doc-head-close.inc' %]
4 <script type="text/javascript">
6 $(document).ready(function(){
7 $("fieldset.rows input").keydown(function(e){ return checkEnter(e); });
8 /* Inline edit/delete links */
9 var biblionumber = $("input[name='biblionumber']").attr("value");
10 $("td").click(function(event){
11 var $tgt = $(event.target);
12 if($tgt.is("a")||$tgt.is(":first-child")||$tgt.is(":nth-child(2)")){ return true; } else {
13 var rowid = $(this).parent().attr("id");
14 num_rowid = rowid.replace("row","");
15 $(".linktools").remove();
16 $(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>");
20 function active(numlayer)
22 for (i=10; i < 11 ; i++ ) {
26 document.getElementById(ong).style.visibility="visible";
27 document.getElementById(link).style.backgroundColor="#11AA11";
28 document.getElementById(link).style.backgroundImage="url([% themelang %]/images/background-mem.gif)";
30 document.getElementById(ong).style.visibility="hidden";
31 document.getElementById(link).style.backgroundColor="#FFFFFF";
32 document.getElementById(link).style.backgroundImage="";
39 // alert(f.field_value.length);
40 for (i=0 ; i<f.field_value.length ; i++) {
41 // alert (f.field_value[i].value);
42 if (f.field_value[i].value.length==0 && f.mandatory[i].value==1) {
43 document.getElementById("error"+i).style.backgroundColor="#FF0000";
46 // document.getElementById("error"+i).style.backgroundColor="#FFFFFF";
50 if (total_errors==0) {
53 alertString2 = _("Form not submitted because of the following problem(s)");
54 alertString2 += "\n------------------------------------------------------------------------------------\n";
55 alertString2 += "\n- "+ total_errors+_(" mandatory fields empty (see bold subfields)");
60 function CheckMultipleAdd(f) {
62 if (!f || isNaN(f) || !parseInt(f) == f || f <= 0) {
63 alert(_("Please enter a number of items to create."));
67 function Dopop(link,i) {
68 defaultvalue=document.forms[0].field_value[i].value;
69 newin=window.open(link+"&result="+defaultvalue,"valuebuilder",'width=500,height=400,toolbar=false,scrollbars=yes');
72 function confirm_deletion(biblionumber,itemnumber) {
73 var original = $("#row"+itemnumber).attr("class");
74 $("#row"+itemnumber).attr("class","confirm");
75 var is_confirmed = confirm(_("Are you sure you want to delete this item?"));
77 window.location = "additem.pl?op=delitem&biblionumber="+biblionumber+"&itemnumber="+itemnumber;
79 $("#row"+itemnumber).attr("class","");
83 function CloneSubfield(index){
84 var original = document.getElementById(index); //original <div>
85 var clone = original.cloneNode(true);
86 var new_key = CreateKey();
87 var old_id = original.getAttribute('id');
88 old_id=old_id.substr(12);
89 var new_id = old_id+new_key;
91 // set the attribute for the new 'div' subfields
92 var inputs = clone.getElementsByTagName('input');
93 var selects = clone.getElementsByTagName('select');
94 var textareas = clone.getElementsByTagName('textarea');
98 for(var i=0,len=inputs.length; i<len ; i++ ){
99 id_input = inputs[i].getAttribute('id')+new_key;
100 inputs[i].setAttribute('id',id_input);
101 inputs[i].setAttribute('name',inputs[i].getAttribute('name'));
105 for(var i=0,len=selects.length; i<len ; i++ ){
106 id_input = selects[i].getAttribute('id')+new_key;
107 selects[i].setAttribute('id',selects[i].getAttribute('id')+new_key);
108 selects[i].setAttribute('name',selects[i].getAttribute('name'));
112 for(var i=0,len=textareas.length; i<len ; i++ ){
113 id_input = textareas[i].getAttribute('id')+new_key;
114 textareas[i].setAttribute('id',textareas[i].getAttribute('id')+new_key);
115 textareas[i].setAttribute('name',textareas[i].getAttribute('name'));
118 [% UNLESS ( advancedMARCEditor ) %]
119 // when cloning a subfield, reset its label too.
120 var label = clone.getElementsByTagName('label')[0];
121 label.setAttribute('for',id_input);
124 // setting a new if for the parent div
125 clone.setAttribute('id',new_id);
129 var spans = clone.getElementsByTagName('span');
131 for(var i = 0 ,lenspans = spans.length ; i < lenspans ; i++){
132 if(spans[i].getAttribute('class') == 'buttonPlus'){
133 CloneButtonPlus = spans[i];
134 CloneButtonPlus.setAttribute('onclick',"CloneSubfield('" + new_id + "')");
135 var buttonUp = clone.getElementsByTagName('img')[0];
136 buttonUp.setAttribute('onclick',"upSubfield('" + new_id + "')");
142 // do nothing if ButtonPlus & CloneButtonPlus don't exist.
144 // insert this line on the page
145 original.parentNode.insertBefore(clone,original.nextSibling);
149 * This function creates a random number
151 function CreateKey(){
152 return parseInt(Math.random() * 100000);
155 $(document).ready(function() {
156 $("#cataloguing_additem_itemlist tr").hover(
157 function () {$(this).attr("class","highlight");},
158 function () {$(this).attr("class","" );}
162 function set_to_today(id, force) {
163 if (! id) { alert(_("Bad id ") + id + _(" sent to set_to_today()")); return 0; }
164 if ($("#" + id).val() == '' || $("#" + id).val() == '0000-00-00' || force) {
165 $("#" + id).val("[% today_iso %]");
170 <link type="text/css" rel="stylesheet" href="[% themelang %]/css/addbiblio.css" />
173 [% INCLUDE 'header.inc' %]
174 <div id="breadcrumbs">
175 <a href="/cgi-bin/koha/mainpage.pl">Home</a>
176 › <a href="/cgi-bin/koha/cataloguing/addbooks.pl">Cataloging</a>
177 › Edit <a href="/cgi-bin/koha/cataloguing/addbiblio.pl?biblionumber=[% biblionumber %]">[% title |html %] [% IF ( author ) %] by [% author %][% END %] (Record #[% biblionumber %])</a>
178 › <a href="/cgi-bin/koha/cataloguing/additem.pl?biblionumber=[% biblionumber %]">Items</a>
181 <div id="doc3" class="yui-t2">
188 <h1>Items for [% title |html %] [% IF ( author ) %] by [% author %][% END %] (Record #[% biblionumber %])</h1>
190 [% IF ( barcode_not_unique ) %]<div class="dialog alert"><strong>Error saving item</strong>: Barcode must be unique.</div>[% END %]
191 [% 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 %]
192 [% IF ( book_on_loan ) %]<div class="dialog alert"><strong>Cannot Delete</strong>: item is checked out.</div>[% END %]
193 [% IF ( book_reserved ) %]<div class="dialogalert"><strong>Cannot Delete</strong>: item has a waiting hold.</div>[% END %]
194 [% IF ( not_same_branch ) %]<div class="dialog alert"><strong>Cannot Delete</strong>: The items do not belong to your branch.</div>[% END %]
196 <div id="cataloguing_additem_itemlist">
197 [% IF ( item_loop ) %]
201 <th colspan="2"> </th>
202 [% FOREACH item_header_loo IN item_header_loop %]
204 [% item_header_loo.header_value %]
208 [% FOREACH item_loo IN item_loop %]
209 <tr id="row[% item_loo.itemnumber %]">
210 [% IF ( item_loo.nomod ) %] <td colspan="2"> </td>[% ELSE %]<td><a href="additem.pl?op=edititem&biblionumber=[% item_loo.biblionumber %]&itemnumber=[% item_loo.itemnumber %]#edititem">Edit</a></td>
211 <td><a class="delete" href="/cgi-bin/koha/cataloguing/additem.pl?op=delitem&biblionumber=[% item_loo.biblionumber %]&itemnumber=[% item_loo.itemnumber %]" onclick="confirm_deletion([% item_loo.biblionumber %],[% item_loo.itemnumber %]); return false;">Delete</a></td>[% END %]
212 [% FOREACH item_valu IN item_loo.item_value %]
213 <td>[% item_valu.field |html %]</td>
222 <div id="cataloguing_additem_newitem">
223 <form method="post" action="/cgi-bin/koha/cataloguing/additem.pl" name="f">
224 <input type="hidden" name="op" value="[% op %]" />
225 <input type="hidden" name="biblionumber" value="[% biblionumber %]" />
227 <h2 id="additema">Add Item</h2>
229 <h2 id="edititem">Edit Item #[% itemnumber %]</h2>
231 <fieldset class="rows">
233 [% FOREACH ite IN item %]
234 <li><div class="subfield_line" style="[% ite.visibility %]" id="subfield[% ite.tag %][% ite.subfield %][% ite.random %]">
236 <label>[% ite.subfield %] - [% IF ( ite.mandatory ) %]<b>[% END %][% ite.marc_lib %][% IF ( ite.mandatory ) %] *</b>[% END %]</label>
238 <input type="hidden" name="tag" value="[% ite.tag %]" />
239 <input type="hidden" name="subfield" value="[% ite.subfield %]" />
240 <input type="hidden" name="mandatory" value="[% ite.mandatory %]" />
241 [% IF ( ite.repeatable ) %]
242 <span class="buttonPlus" onclick="CloneSubfield('subfield[% ite.tag %][% ite.subfield %][% ite.random %]')">+</span>
249 <input type="hidden" name="indicator" value=" " />
250 <input type="hidden" name="indicator" value=" " />
251 <input type="hidden" name="itemnumber" value="[% itemnumber %]" />
253 <fieldset class="action"> [% IF ( opisadd ) %]
254 <input type="submit" name="phony_submit" value="phony_submit" id="phony_submit" style="display:none;" onclick="return false;" />
255 <!-- 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
256 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.
257 It is a bit tricky, but necessary in the sake of UI correctness.
260 <input type="submit" name="add_submit" value="Add item" onclick="return Check(this.form)" />
261 <input type="submit" name="add_duplicate_submit" value="Add & Duplicate" onclick="return Check(this.form)" />
262 <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">
263 <label for="number_of_copies">Number of copies to add : </label>
264 <input type="text" id="number_of_copies" name="number_of_copies" value="" size="2" />
265 <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);" />
269 <input type="hidden" name="tag" value="[% itemtagfield %]" />
270 <input type="hidden" name="subfield" value="[% itemtagsubfield %]" />
271 <input type="hidden" name="field_value" value="[% itemnumber %]" />
272 <input type="submit" value="Save Changes" onclick="return Check(this.form)" />
280 [% INCLUDE 'biblio-view-menu.inc' %]
283 [% INCLUDE 'intranet-bottom.inc' %]