1 <!-- TMPL_INCLUDE NAME="doc-head-open.inc" -->
2 <title>Koha › Cataloging › <!-- TMPL_IF NAME="biblionumber" -->Edit MARC Record Number <!-- TMPL_VAR name="biblionumber" --><!-- TMPL_ELSE -->Add MARC Record<!-- /TMPL_IF --></title>
3 <!-- TMPL_INCLUDE NAME="doc-head-close.inc" -->
4 <script type="text/javascript">
7 $(document).ready(function() {
8 $('#addbibliotabs').tabs();
11 function confirmnotdup(){
12 $("#confirm_not_duplicate").attr("value","1");
13 // alert(_("Not a duplicate confirmed. Please click on Add biblio to save the record"));
14 var checkform = $("#f");
23 var StrAlert = AreMandatoriesNotOk();
33 function Dopop(link,i) {
34 defaultvalue = document.getElementById(i).value;
35 window.open(link+"&result="+defaultvalue,"value builder",'width=700,height=550,toolbar=false,scrollbars=yes');
39 * this function open a popup to search on z3950 server.
41 function PopupZ3950() {
42 var strQuery = AreZ3950MandoriesOk();
44 window.open("/cgi-bin/koha/cataloguing/z3950_search.pl?biblionumber=<!-- TMPL_VAR NAME="biblionumber" -->&frameworkcode=<!-- TMPL_VAR NAME="frameworkcode" -->"+strQuery,"z3950search",'width=640,height=400,location=yes,toolbar=no,scrollbars=yes');
46 var strAlert = _("To perform a z39.50 search, you must enter at least one of the following: \n\n ISBN\n ISSN\n Title\n Author\n");
52 * check if mandatory subfields are writed
54 function AreMandatoriesNotOk(){
55 var mandatories = new Array();
56 var tab = new Array();
57 var label = new Array();
59 <!-- TMPL_LOOP NAME='BIG_LOOP' --><!-- TMPL_LOOP NAME='innerloop' --><!-- TMPL_LOOP NAME='subfield_loop'--><!-- TMPL_IF NAME='mandatory'-->mandatories.push("<!-- TMPL_VAR NAME='id' -->");
60 tab.push("<!-- TMPL_VAR NAME='number' -->");
61 label.push("<!-- TMPL_VAR NAME='marc_lib' -->");
62 <!-- /TMPL_IF --><!-- /TMPL_LOOP --><!-- /TMPL_LOOP --><!-- /TMPL_LOOP -->
63 var StrAlert = _("Can't save this record because the following field aren't filled :\n\n");
64 for(var i=0,len=mandatories.length; i<len ; i++){
65 if( ! document.getElementById(mandatories[i]).value){
67 document.getElementById(mandatories[i]).setAttribute('class','subfield_not_filled');
68 document.getElementById(mandatories[i]).focus();
69 StrAlert += "\t* "+label[i]+_(" in tab ")+tab[i]+"\n";
80 * check if z3950 mandatories are set or not
82 function AreZ3950MandoriesOk(){
83 var mandatories = new Array();
84 var mandatories_label = new Array();
85 <!-- TMPL_LOOP NAME='BIG_LOOP' --><!-- TMPL_LOOP NAME='innerloop' --><!-- TMPL_LOOP NAME='subfield_loop'--><!-- TMPL_IF NAME='z3950_mandatory'-->mandatories.push("<!-- TMPL_VAR NAME='id' -->");
86 mandatories_label.push("<!-- TMPL_VAR NAME='z3950_mandatory' -->");<!-- /TMPL_IF --><!-- /TMPL_LOOP --><!-- /TMPL_LOOP --><!-- /TMPL_LOOP -->
90 for(var i=0,len=mandatories.length; i<len ; i++){
91 var field_value = document.getElementById(mandatories[i]).value;
95 strQuery += "&"+mandatories_label[i]+"="+field_value;
105 function Changefwk(FwkList) {
106 var fwk = FwkList.options[FwkList.selectedIndex].value;
107 window.location = "/cgi-bin/koha/cataloguing/addbiblio.pl?biblionumber=<!--TMPL_VAR Name="biblionumber"-->&breedingid=<!-- TMPL_VAR name="breedingid" -->&frameworkcode="+fwk;
111 function openAuth(tagid,authtype,X) {
112 // defaultid=document.getElementById(subfieldid);
114 Y=X.parentNode.getAttribute("id");
116 newin=window.open("../authorities/auth_finder.pl?authtypecode="+ authtype+ "&tagid="+Y, "value builder",'width=700,height=550,toolbar=false,scrollbars=yes');
120 function ExpandField(index) {
121 var original = document.getElementById(index); //original <div>
122 var divs = original.getElementsByTagName('div');
123 for(var i=0,divslen = divs.length ; i<divslen ; i++){ // foreach div
124 if(divs[i].getAttribute("name") == 'line'){ // if it s a subfield
131 * To clone a field or a subfield by clickink on '+' button
133 function CloneField(index) {
134 var original = document.getElementById(index); //original <div>
135 var clone = original.cloneNode(true);
136 var new_key = CreateKey();
137 var new_id = original.getAttribute('id')+new_key;
139 clone.setAttribute('id',new_id); // setting a new id for the parent div
141 var divs = clone.getElementsByTagName('div');
143 <!-- TMPL_UNLESS NAME='hide_marc'--> // No indicator if hide_marc
144 // setting a new name for the new indicator
145 var indicator = clone.getElementsByTagName('input')[0];
146 indicator.setAttribute('name',indicator.getAttribute('name')+new_key);
147 <!-- /TMPL_UNLESS -->
149 // settings all subfields
150 for(var i=0,divslen = divs.length ; i<divslen ; i++){ // foreach div
151 if(divs[i].getAttribute("name") == 'line'){ // if it s a subfield
153 // set the attribute for the new 'div' subfields
154 divs[i].setAttribute('id',divs[i].getAttribute('id')+new_key);
156 var inputs = divs[i].getElementsByTagName('input');
159 inputs[0].setAttribute('id',inputs[0].getAttribute('id')+new_key);
160 inputs[0].setAttribute('name',inputs[0].getAttribute('name')+new_key);
163 id_input = inputs[1].getAttribute('id')+new_key;
164 inputs[1].setAttribute('id',id_input);
165 inputs[1].setAttribute('name',inputs[1].getAttribute('name')+new_key);
167 try{ // it s a select if it is not an input
168 var selects = divs[i].getElementsByTagName('select');
169 id_input = selects[0].getAttribute('id')+new_key;
170 selects[0].setAttribute('id',id_input);
171 selects[0].setAttribute('name',selects[0].getAttribute('name')+new_key);
172 }catch(e2){ // it is a textarea if it s not a select or an input
173 var textaeras = divs[i].getElementsByTagName('textarea');
174 id_input = textaeras[0].getAttribute('id')+new_key;
175 textaeras[0].setAttribute('id',id_input);
176 textaeras[0].setAttribute('name',textaeras[0].getAttribute('name')+new_key);
180 <!-- TMPL_UNLESS NAME='advancedMARCEditor'-->
181 // when cloning a subfield, re set its label too.
182 var labels = divs[i].getElementsByTagName('label');
183 labels[0].setAttribute('for',id_input);
184 <!-- /TMPL_UNLESS -->
186 <!-- TMPL_UNLESS NAME='hide_marc'-->
187 // updating javascript parameters on button up
188 var imgs = divs[i].getElementsByTagName('img');
189 imgs[0].setAttribute('onclick',"upSubfield(\'"+divs[i].getAttribute('id')+"\');");
190 <!-- /TMPL_UNLESS -->
192 // setting its '+' button
193 var CloneButtonPlus=0;
195 CloneButtonPlus = divs[i].getElementsByTagName('span')[0];
196 if(CloneButtonPlus.getAttribute('class') == 'buttonPlus'){
197 CloneButtonPlus.setAttribute('onclick',"CloneSubfield('" + divs[i].getAttribute('id') + "')");
203 // do nothig if ButtonPlus & CloneButtonPlus don t exist.
209 spans = divs[i].getElementsByTagName('span');
215 if(!CloneButtonPlus){ // it s impossible to have + ... (buttonDot AND buttonPlus)
216 buttonDot = spans[0];
220 var buttonDotOnClick = buttonDot.getAttribute('onclick');
221 if(buttonDotOnClick.match('Clictag')){ // -1- It s a plugin
222 var re = /\('.*'\)/i;
223 buttonDotOnClick = buttonDotOnClick.replace(re,"('"+inputs[1].getAttribute('id')+"')");
224 if(buttonDotOnClick){
225 buttonDot.setAttribute('onclick',buttonDotOnClick);
228 if(buttonDotOnClick.match('Dopop')) { // -2- It's a auth value
230 var re1 = /&index=.*',/;
233 buttonDotOnClick = buttonDotOnClick.replace(re1,"&index="+inputs[1].getAttribute('id')+"',");
234 buttonDotOnClick = buttonDotOnClick.replace(re2,",'"+inputs[1].getAttribute('id')+"')");
236 if(buttonDotOnClick){
237 buttonDot.setAttribute('onclick',buttonDotOnClick);
242 // do not copy the script section.
243 var script = spans[0].getElementsByTagName('script')[0];
244 spans[0].removeChild(script);
246 // do nothing if there is no script
252 <!-- TMPL_UNLESS NAME='hide_marc'-->
253 var buttonUp = divs[i].getElementsByTagName('img')[0];
254 buttonUp.setAttribute('onclick',"upSubfield('" + divs[i].getAttribute('id') + "')");
255 <!-- /TMPL_UNLESS -->
257 } else { // it's a indicator div
258 if(divs[i].getAttribute('name') == 'div_indicator'){
259 var inputs = divs[i].getElementsByTagName('input');
260 inputs[0].setAttribute('id',inputs[0].getAttribute('id')+new_key);
264 CloneButtonPlus = divs[i].getElementsByTagName('span')[1]; // 0 is the title
265 CloneButtonPlus.setAttribute('onclick',"CloneField('" + divs[i].parentNode.getAttribute('id') + "')");
268 // do nothig CloneButtonPlus doesn't exist.
270 // setting its 'Expand' property
273 ExpandFieldA = divs[i].getElementsByTagName('a')[0];
274 ExpandFieldA.setAttribute('onclick',"ExpandField('" + divs[i].parentNode.getAttribute('id') + "')");
277 // do nothig if ButtonPlus & CloneButtonPlus don t exist.
284 // insert this line on the page
285 original.parentNode.insertBefore(clone,original.nextSibling);
288 function CloneSubfield(index){
289 var original = document.getElementById(index); //original <div>
290 var clone = original.cloneNode(true);
291 var new_key = CreateKey();
292 var new_id = original.getAttribute('id')+new_key;
294 // set the attribute for the new 'div' subfields
295 var inputs = clone.getElementsByTagName('input');
296 var selects = clone.getElementsByTagName('select');
297 var textareas = clone.getElementsByTagName('textarea');
301 for(var i=0,len=inputs.length; i<len ; i++ ){
302 id_input = inputs[i].getAttribute('id')+new_key;
303 inputs[i].setAttribute('id',id_input);
304 inputs[i].setAttribute('name',inputs[i].getAttribute('name')+new_key);
308 for(var i=0,len=selects.length; i<len ; i++ ){
309 id_input = selects[i].getAttribute('id')+new_key;
310 selects[i].setAttribute('id',selects[i].getAttribute('id')+new_key);
311 selects[i].setAttribute('name',selects[i].getAttribute('name')+new_key);
315 for(var i=0,len=textareas.length; i<len ; i++ ){
316 id_input = textareas[i].getAttribute('id')+new_key;
317 textareas[i].setAttribute('id',textareas[i].getAttribute('id')+new_key);
318 textareas[i].setAttribute('name',textareas[i].getAttribute('name')+new_key);
321 <!-- TMPL_UNLESS NAME='advancedMARCEditor' -->
322 // when cloning a subfield, reset its label too.
323 var label = clone.getElementsByTagName('label')[0];
324 label.setAttribute('for',id_input);
325 <!-- /TMPL_UNLESS -->
327 // setting a new if for the parent div
328 clone.setAttribute('id',new_id);
332 var spans = clone.getElementsByTagName('span');
334 for(var i = 0 ,lenspans = spans.length ; i < lenspans ; i++){
335 if(spans[i].getAttribute('class') == 'buttonPlus'){
336 CloneButtonPlus = spans[i];
337 CloneButtonPlus.setAttribute('onclick',"CloneSubfield('" + new_id + "')");
338 var buttonUp = clone.getElementsByTagName('img')[0];
339 buttonUp.setAttribute('onclick',"upSubfield('" + new_id + "')");
345 // do nothig if ButtonPlus & CloneButtonPlus don't exist.
347 // insert this line on the page
348 original.parentNode.insertBefore(clone,original.nextSibling);
352 * This function create a random number
354 function CreateKey(){
355 return parseInt(Math.random() * 100000);
359 * This function allows to move a subfield up by clickink on the 'up' button .
361 function upSubfield(index) {
363 var line = document.getElementById(index); // get the line where the user has clicked.
365 return; // this line doesn't exist...
367 var tag = line.parentNode; // get the dad of this line. (should be "<div id='tag_...'>")
369 // getting all subfields for this tag
370 var subfields = tag.getElementsByTagName('div');
371 var subfieldsLength = subfields.length;
373 if(subfieldsLength<=1) return; // nothing to do if there is just one subfield.
375 // among all subfields
376 for(var i=0;i<subfieldsLength;i++){
377 if(subfields[i].getAttribute('id') == index){ //looking for the subfield which is clicked :
378 if(i==1){ // if the clicked subfield is on the top
379 tag.appendChild(subfields[1]);
382 var lineAbove = subfields[i-1];
383 tag.insertBefore(line,lineAbove);
390 function unHideSubfield(index,labelindex) { // FIXME :: is it used ?
391 subfield = document.getElementById(index);
392 subfield.style.display = 'block';
393 label = document.getElementById(labelindex);
394 label.style.display='none';
398 <style type="text/css">
399 #addbibliotabs { margin-top : 1em; }
402 text-decoration : none;
406 text-decoration : none;
412 <!-- TMPL_INCLUDE NAME="header.inc" -->
414 <div id="doc" class="yui-t7">
420 <h1><!-- TMPL_IF NAME="biblionumtagfield" -->Edit MARC Record Number <!-- TMPL_VAR name="biblionumber" --><!-- TMPL_ELSE -->Add MARC Record<!-- /TMPL_IF --></h1>
422 <!-- TMPL_UNLESS name="number" -->
423 <!-- show duplicate warning on tab 0 only -->
424 <!-- TMPL_IF name="duplicatebiblionumber" -->
426 <h4>Duplicate Record?</h4>
427 <p>Is this a duplicate of <a href="/cgi-bin/koha/catalogue/MARCdetail.pl?biblionumber=<!-- TMPL_VAR name="duplicatebiblionumber" -->" onclick="openWindow('../MARCdetail.pl?biblionumber=<!-- TMPL_VAR name="duplicatebiblionumber" -->&popup=1', 'Duplicate biblio'; return false;)"><!-- TMPL_VAR name="duplicatetitle" --></a>?</p>
428 <form action="/cgi-bin/koha/cataloguing/additem.pl" method="get"><input type="hidden" name="biblionumber" value="<!-- TMPL_VAR name="duplicatebiblionumber" -->" /><input type="submit" value="Yes: Edit existing items" /></form>
429 <form action="/cgi-bin/koha/cataloguing/addbibliopl" method="get"><input type="submit" onclick="confirmnotdup(); return false;" value="No: Save as New Record" /></form>
432 <!-- /TMPL_UNLESS -->
434 <!--TMPL_IF Name="done"-->
435 <script type="text/javascript">
436 opener.document.forms['f'].biblionumber.value=<!--TMPL_VAR Name="biblionumber"-->;
437 opener.document.forms['f'].title.value='<!--TMPL_VAR Name="title" ESCAPE="HTML"-->';
441 <form method="post" name="f" id="f" action="/cgi-bin/koha/cataloguing/addbiblio.pl" onsubmit="return Check();">
442 <input type="hidden" value="0" id="confirm_not_duplicate" name="confirm_not_duplicate" />
446 <!-- TMPL_IF name="biblionumber" -->
447 <input type="submit" value="Save Bibliographic Record" />
449 <input type="submit" value="Add Bibliographic Record" />
451 <input type="button" value="z39.50 Search" onclick="PopupZ3950(); return false;" />
452 <label for="Frameworks">Change framework: </label><!--TMPL_VAR Name="framework" -->
453 <input type="hidden" name="op" value="addbiblio" />
456 <!--TMPL_IF Name="popup"-->
457 <input type="hidden" name="mode" value="popup" />
459 <input type="hidden" name="frameworkcode" value="<!-- TMPL_VAR NAME="frameworkcode" -->" />
460 <input type="hidden" name="biblionumber" value="<!-- TMPL_VAR NAME="biblionumber" -->" />
461 <input type="hidden" name="breedingid" value="<!-- TMPL_VAR NAME="breedingid" -->" />
463 <div id="addbibliotabs" class="toptabs numbered">
464 <ul><!-- TMPL_LOOP name="BIG_LOOP" -->
465 <li> <!-- TMPL_IF name="number" -->
466 <a href="/cgi-bin/koha/cataloguing/addbiblio.pl#tab<!-- TMPL_VAR name="number" -->XX"><!-- TMPL_VAR name="number"--></a>
468 <a href="/cgi-bin/koha/cataloguing/addbiblio.pl#tab<!-- TMPL_VAR name="number" -->XX"><!-- TMPL_VAR name="number"--></a>
469 <!-- /TMPL_IF --></li>
470 <!-- /TMPL_LOOP --></ul>
472 <!-- TMPL_LOOP name="BIG_LOOP" -->
473 <!-- hide every tab except the 1st -->
474 <!-- TMPL_IF name="number" -->
475 <div id="tab<!-- TMPL_VAR name="number" -->XX">
477 <div id="tab<!-- TMPL_VAR name="number" -->XX">
481 <!-- TMPL_LOOP NAME="innerloop" -->
482 <!-- TMPL_IF NAME="tag" -->
483 <div class="tag" id="tag_<!-- TMPL_VAR name="tag"-->_<!-- TMPL_VAR NAME='index'--><!-- TMPL_VAR name="random" -->">
484 <div class="tag_title" name="div_indicator">
485 <!-- TMPL_UNLESS name="hide_marc" -->
486 <span title="<!-- TMPL_VAR NAME="tag_lib" -->"><!-- TMPL_VAR NAME="tag" --></span>
487 <!-- TMPL_IF NAME="fixedfield" -->
488 <input tabindex="1" class="indicator flat" type="text" style="display:none;" name="tag_<!-- TMPL_VAR NAME="tag" -->_indicator_<!-- TMPL_VAR NAME='index'--><!-- TMPL_VAR name="random" -->" size="2" maxlength="2" value="<!-- TMPL_VAR NAME="indicator" -->" />
490 <input tabindex="1" class="indicator flat" type="text" name="tag_<!-- TMPL_VAR NAME="tag" -->_indicator_<!-- TMPL_VAR NAME='index'--><!-- TMPL_VAR name="random" -->" size="2" maxlength="2" value="<!-- TMPL_VAR NAME="indicator" -->" />
493 <!-- TMPL_IF NAME="fixedfield" -->
494 <input tabindex="1" type="hidden" name="tag_<!-- TMPL_VAR NAME="tag" -->_indicator_<!-- TMPL_VAR NAME='index'--><!-- TMPL_VAR name="random" -->" value="<!-- TMPL_VAR NAME="indicator" -->" />
496 <input tabindex="1" type="hidden" name="tag_<!-- TMPL_VAR NAME="tag" -->_indicator_<!-- TMPL_VAR NAME='index'--><!-- TMPL_VAR name="random" -->" value="<!-- TMPL_VAR NAME="indicator" -->" />
498 <!-- /TMPL_UNLESS -->
500 <!-- TMPL_UNLESS NAME="advancedMARCEditor" -->
501 <a href="#" class="expandfield" onclick="ExpandField('tag_<!-- TMPL_VAR name="tag"-->_<!-- TMPL_VAR NAME='index'--><!-- TMPL_VAR name="random" -->'); return false;" title="Click to Expand this Tag"><!-- TMPL_VAR NAME="tag_lib" --></a>
502 <!-- /TMPL_UNLESS -->
503 <!-- TMPL_IF name="repeatable" -->
504 <a href="#" class="buttonPlus" onclick="CloneField('tag_<!-- TMPL_VAR name="tag"-->_<!-- TMPL_VAR NAME='index'--><!-- TMPL_VAR name="random" -->'); return false;" title="Repeat this Tag">+</a>
509 <!-- TMPL_LOOP NAME="subfield_loop" -->
510 <!-- One line on the marc editor -->
511 <div name="line" class="subfield_line" style="<!-- TMPL_VAR NAME='visibility' -->;" id="subfield<!-- TMPL_VAR NAME='tag' --><!-- TMPL_VAR NAME='subfield' --><!-- TMPL_VAR name="random" -->">
513 <!--TMPL_UNLESS NAME="advancedMARCEditor" -->
514 <label for="tag_<!-- TMPL_VAR NAME='tag'-->_subfield_<!-- TMPL_VAR NAME='subfield'-->_<!-- TMPL_VAR NAME='index'-->_<!-- TMPL_VAR NAME='index_subfield'-->" <!-- TMPL_IF NAME="fixedfield" --> style="display:none;" <!-- /TMPL_IF --> class="labelsubfield">
515 <!-- /TMPL_UNLESS -->
517 <!-- TMPL_UNLESS name="hide_marc" -->
518 <img class="buttonUp" <!-- TMPL_IF NAME="fixedfield" --> style="display:none;" <!-- /TMPL_IF --> src="<!-- TMPL_VAR NAME="themelang" -->/../img/up.png" onclick="upSubfield('subfield<!-- TMPL_VAR NAME='tag' --><!-- TMPL_VAR NAME='subfield' --><!-- TMPL_VAR name="random" -->')" alt="Move Up" title="Move Up" />
519 <input title="<!-- TMPL_VAR NAME='marc_lib_plain' -->" style=" <!-- TMPL_IF NAME="fixedfield" -->display:none; <!-- /TMPL_IF -->border:0;" type="text" name="tag_<!-- TMPL_VAR NAME='tag'-->_code_<!-- TMPL_VAR NAME='subfield'-->_<!-- TMPL_VAR NAME='index'-->_<!-- TMPL_VAR NAME='index_subfield'-->" value="<!-- TMPL_VAR NAME="subfield" -->" size="1" maxlength="1" class="flat" tabindex="-1" />
521 <input type="hidden" name="tag_<!-- TMPL_VAR NAME='tag'-->_code_<!-- TMPL_VAR NAME='subfield'-->_<!-- TMPL_VAR NAME='index'-->_<!-- TMPL_VAR NAME='index_subfield'-->" value="<!-- TMPL_VAR NAME="subfield" -->" />
522 <!-- /TMPL_UNLESS -->
524 <!-- TMPL_UNLESS NAME="advancedMARCEditor" -->
525 <!-- TMPL_IF name="mandatory" --><span class="subfield_mandatory"><!-- /TMPL_IF -->
526 <!-- TMPL_VAR NAME="marc_lib" -->
527 <!-- TMPL_IF name="mandatory" --></span><!-- /TMPL_IF -->
529 <!-- /TMPL_UNLESS -->
531 <!-- TMPL_VAR NAME="marc_value" -->
533 <!-- TMPL_IF NAME="repeatable" -->
534 <span class="buttonPlus" onclick="CloneSubfield('subfield<!-- TMPL_VAR NAME='tag' --><!-- TMPL_VAR NAME='subfield' --><!-- TMPL_VAR name="random" -->')">+</span>
538 <!-- End of the line -->
542 <!-- /TMPL_IF --><!-- tag -->
552 <!-- TMPL_INCLUDE NAME="intranet-bottom.inc" -->