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(){
12 $("fieldset.rows input").keydown(function(e){ return checkEnter(e); });
13 /* Inline edit/delete links */
14 var biblionumber = $("input[name='biblionumber']").attr("value");
15 $("td").click(function(event){
16 var $tgt = $(event.target);
17 if($tgt.is("a")||$tgt.is(":first-child")||$tgt.is(":nth-child(2)")){ return true; } else {
18 var rowid = $(this).parent().attr("id");
19 num_rowid = rowid.replace("row","");
20 $(".linktools").remove();
21 $(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>");
25 function active(numlayer)
27 for (i=10; i < 11 ; i++ ) {
31 document.getElementById(ong).style.visibility="visible";
32 document.getElementById(link).style.backgroundColor="#11AA11";
33 document.getElementById(link).style.backgroundImage="url([% themelang %]/images/background-mem.gif)";
35 document.getElementById(ong).style.visibility="hidden";
36 document.getElementById(link).style.backgroundColor="#FFFFFF";
37 document.getElementById(link).style.backgroundImage="";
43 $("input[name='mandatory'],select[name='mandatory']").each(function(i){
44 if($(this).val() == 1){
45 var mandatory_field = $("input[name='field_value'],select[name='field_value']").eq(i);
46 if(mandatory_field.val() == ''){
47 mandatory_field.css("background-color","#FFFFCC");
54 if (total_errors==0) {
57 alertString2 = _("Form not submitted because of the following problem(s)");
58 alertString2 += "\n------------------------------------------------------------------------------------\n";
59 alertString2 += "\n- "+ total_errors+_(" mandatory fields empty (highlighted)");
64 function CheckMultipleAdd(f) {
66 if (!f || isNaN(f) || !parseInt(f) == f || f <= 0) {
67 alert(_("Please enter a number of items to create."));
71 function Dopop(link,i) {
72 defaultvalue=document.forms[0].field_value[i].value;
73 newin=window.open(link+"&result="+defaultvalue,"valuebuilder",'width=500,height=400,toolbar=false,scrollbars=yes');
76 function confirm_deletion(biblionumber,itemnumber) {
77 var original = $("#row"+itemnumber).attr("class");
78 $("#row"+itemnumber).attr("class","confirm");
79 var is_confirmed = confirm(_("Are you sure you want to delete this item?"));
81 window.location = "additem.pl?op=delitem&biblionumber="+biblionumber+"&itemnumber="+itemnumber;
83 $("#row"+itemnumber).attr("class","");
87 function CloneSubfield(index){
88 var original = document.getElementById(index); //original <div>
89 var clone = original.cloneNode(true);
90 var new_key = CreateKey();
91 var old_id = original.getAttribute('id');
92 old_id=old_id.substr(12);
93 var new_id = old_id+new_key;
95 // set the attribute for the new 'div' subfields
96 var inputs = clone.getElementsByTagName('input');
97 var selects = clone.getElementsByTagName('select');
98 var textareas = clone.getElementsByTagName('textarea');
102 for(var i=0,len=inputs.length; i<len ; i++ ){
103 id_input = inputs[i].getAttribute('id')+new_key;
104 inputs[i].setAttribute('id',id_input);
105 inputs[i].setAttribute('name',inputs[i].getAttribute('name'));
109 for(var i=0,len=selects.length; i<len ; i++ ){
110 id_input = selects[i].getAttribute('id')+new_key;
111 selects[i].setAttribute('id',selects[i].getAttribute('id')+new_key);
112 selects[i].setAttribute('name',selects[i].getAttribute('name'));
116 for(var i=0,len=textareas.length; i<len ; i++ ){
117 id_input = textareas[i].getAttribute('id')+new_key;
118 textareas[i].setAttribute('id',textareas[i].getAttribute('id')+new_key);
119 textareas[i].setAttribute('name',textareas[i].getAttribute('name'));
122 [% UNLESS ( advancedMARCEditor ) %]
123 // when cloning a subfield, reset its label too.
124 var label = clone.getElementsByTagName('label')[0];
125 label.setAttribute('for',id_input);
128 // setting a new if for the parent div
129 clone.setAttribute('id',new_id);
133 var spans = clone.getElementsByTagName('span');
135 for(var i = 0 ,lenspans = spans.length ; i < lenspans ; i++){
136 if(spans[i].getAttribute('class') == 'buttonPlus'){
137 CloneButtonPlus = spans[i];
138 CloneButtonPlus.setAttribute('onclick',"CloneSubfield('" + new_id + "')");
139 var buttonUp = clone.getElementsByTagName('img')[0];
140 buttonUp.setAttribute('onclick',"upSubfield('" + new_id + "')");
146 // do nothing if ButtonPlus & CloneButtonPlus don't exist.
148 // insert this line on the page
149 original.parentNode.insertBefore(clone,original.nextSibling);
153 * This function creates a random number
155 function CreateKey(){
156 return parseInt(Math.random() * 100000);
159 $(document).ready(function() {
160 $("#cataloguing_additem_itemlist tr").hover(
161 function () {$(this).attr("class","highlight");},
162 function () {$(this).attr("class","" );}
167 <link type="text/css" rel="stylesheet" href="[% themelang %]/css/addbiblio.css" />
169 <body id="cat_additem" class="cat">
170 [% INCLUDE 'header.inc' %]
171 <div id="breadcrumbs">
172 <a href="/cgi-bin/koha/mainpage.pl">Home</a>
173 › <a href="/cgi-bin/koha/cataloguing/addbooks.pl">Cataloging</a>
174 › Edit <a href="/cgi-bin/koha/cataloguing/addbiblio.pl?biblionumber=[% biblionumber %]">[% title |html %] [% IF ( author ) %] by [% author %][% END %] (Record #[% biblionumber %])</a>
175 › <a href="/cgi-bin/koha/cataloguing/additem.pl?biblionumber=[% biblionumber %]">Items</a>
178 <div id="doc3" class="yui-t7">
183 <h1>Items for [% title |html %] [% IF ( author ) %] by [% author %][% END %] (Record #[% biblionumber %])</h1>
185 [% IF ( barcode_not_unique ) %]<div class="dialog alert"><strong>Error saving item</strong>: Barcode must be unique.</div>[% END %]
186 [% 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 %]
187 [% IF ( book_on_loan ) %]<div class="dialog alert"><strong>Cannot Delete</strong>: item is checked out.</div>[% END %]
188 [% IF ( book_reserved ) %]<div class="dialogalert"><strong>Cannot Delete</strong>: item has a waiting hold.</div>[% END %]
189 [% IF ( not_same_branch ) %]<div class="dialog alert"><strong>Cannot Delete</strong>: The items do not belong to your library.</div>[% END %]
190 [% 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 %]
192 <div id="cataloguing_additem_itemlist">
193 [% IF ( item_loop ) %]
197 <th colspan="2"> </th>
198 [% FOREACH item_header_loo IN item_header_loop %]
200 [% item_header_loo.header_value %]
204 [% FOREACH item_loo IN item_loop %]
205 <tr id="row[% item_loo.itemnumber %]">
206 [% 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>
207 <td><a class="delete" href="/cgi-bin/koha/cataloguing/additem.pl?op=delinkitem&biblionumber=[% biblionumber %]&hostitemnumber=[% item_loo.itemnumber %]">Delink</a></td>
208 [% ELSE %]<td><a href="additem.pl?op=edititem&biblionumber=[% biblionumber %]&itemnumber=[% item_loo.itemnumber %]#edititem">Edit</a></td>
209 <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 %]
210 [% FOREACH item_valu IN item_loo.item_value %]
211 <td>[% item_valu.field |html %]</td>
220 <div class="yui-u first">
221 [% INCLUDE 'biblio-view-menu.inc' %]
224 <div id="cataloguing_additem_newitem">
225 <form method="post" action="/cgi-bin/koha/cataloguing/additem.pl" name="f">
226 <input type="hidden" name="op" value="[% op %]" />
228 <input type="hidden" name="popup" value="1" />
230 <input type="hidden" name="biblionumber" value="[% biblionumber %]" />
232 <h2 id="additema">Add item</h2>
234 <h2 id="edititem">Edit Item #[% itemnumber %][% IF ( barcode ) %] / Barcode [% barcode %][% END %]</h2>
236 <fieldset class="rows">
238 [% FOREACH ite IN item %]
239 <li><div class="subfield_line" style="[% ite.visibility %]" id="subfield[% ite.tag %][% ite.subfield %][% ite.random %]">
240 [% IF ( ite.mandatory ) %]
241 <label class="required">[% ite.subfield %] - [% ite.marc_lib %]</label>
243 <label>[% ite.subfield %] - [% ite.marc_lib %]</label>
246 <input type="hidden" name="tag" value="[% ite.tag %]" />
247 <input type="hidden" name="subfield" value="[% ite.subfield %]" />
248 <input type="hidden" name="mandatory" value="[% ite.mandatory %]" />
249 [% IF ( ite.repeatable ) %]
250 <span class="buttonPlus" onclick="CloneSubfield('subfield[% ite.tag %][% ite.subfield %][% ite.random %]')">+</span>
252 [% IF ( ite.mandatory ) %] <span class="required">Required</span>[% END %]
257 <input type="hidden" name="indicator" value=" " />
258 <input type="hidden" name="indicator" value=" " />
259 <input type="hidden" name="itemnumber" value="[% itemnumber %]" />
261 <fieldset class="action"> [% IF ( opisadd ) %]
262 <input type="submit" name="phony_submit" value="phony_submit" id="phony_submit" style="display:none;" onclick="return false;" />
263 <!-- 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
264 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.
265 It is a bit tricky, but necessary in the sake of UI correctness.
268 <input type="submit" name="add_submit" value="Add item" onclick="return Check(this.form)" />
269 <input type="submit" name="add_duplicate_submit" value="Add & Duplicate" onclick="return Check(this.form)" />
270 <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">
271 <label for="number_of_copies">Number of copies to add : </label>
272 <input type="text" id="number_of_copies" name="number_of_copies" value="" size="2" />
273 <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);" />
277 <input type="hidden" name="tag" value="[% itemtagfield %]" />
278 <input type="hidden" name="subfield" value="[% itemtagsubfield %]" />
279 <input type="hidden" name="field_value" value="[% itemnumber %]" />
280 <input type="submit" value="Save Changes" onclick="return Check(this.form)" />
283 <input type="hidden" name="borrowernumber" value="[% borrowernumber %]" />
284 <input type="hidden" name="stickyduedate" value="[% stickyduedate %]" />
285 <input type="hidden" name="barcode" value="[% barcode %]" />
286 <input type="hidden" name="duedatespec" value="[% duedatespec %]" />
291 </div><!-- /yui-u -->
292 </div><!-- /yui-gf -->
296 [% INCLUDE 'intranet-bottom.inc' %]