Koha/koha-tmpl/intranet-tmpl/prog/en/cataloguing/addbiblio.tmpl
2006-09-22 00:11:37 +00:00

420 lines
18 KiB
Cheetah

<!-- TMPL_INCLUDE NAME="doc-head-open.inc" -->Koha -- Cataloging: <!-- TMPL_IF NAME="oldbiblionumtagfield" -->Edit MARC Record Number <!-- TMPL_VAR name="biblionumber" --><!-- TMPL_ELSE -->Add MARC Record<!-- /TMPL_IF --><!-- TMPL_INCLUDE NAME="doc-head-close.inc" -->
<!--TMPL_UNLESS NAME="fromserials" -->
<!-- TMPL_INCLUDE NAME="menus.inc" -->
<!-- TMPL_INCLUDE NAME="menu-catalogue.inc" -->
<!--/TMPL_UNLESS-->
<!-- TMPL_IF name="error" -->
<div class="error">
<!--TMPL_IF NAME="onloan"-->
<ul>
<li>Item currenly onloan you can not DELETE!</li>
<li><a href="/cgi-bin/koha/mainpage.pl">Return to home page</a></li>
</ul>
<!--/TMPL_IF-->
<!--TMPL_IF NAME="xmlerror"-->
<ul>
<li>Non UTF-8 characters present or malformed XML</li>
<li>Please correct and save.</li>
</ul>
<!--/TMPL_IF-->
</div>
<!-- /TMPL_IF -->
<!--TMPL_UNLESS NAME="onloan"-->
<form method="post" name="f" id="f" action="addbiblio.pl">
<h1><!-- TMPL_IF NAME="oldbiblionumtagfield" -->Edit MARC Record Number <!-- TMPL_VAR name="oldbiblionumber" --><!-- TMPL_ELSE -->Add MARC Record<!-- /TMPL_IF --> With Framework : <!--TMPL_VAR Name="framework" --></h1>
<div class="tabitem">
<input type="hidden" name="fromserials" value="<!-- TMPL_VAR NAME="fromserials" -->" />
<input type="hidden" name="op" value="addbiblio" />
<input type="hidden" name="addfield_field" /><input type="hidden" name="duplicateok" value="<!-- TMPL_VAR NAME="duplicateok" -->" />
<input type="hidden" name="frameworkcode" value="<!-- TMPL_VAR NAME="frameworkcode" -->" />
<input type="hidden" name="oldbiblionumber" value="<!-- TMPL_VAR NAME="oldbiblionumber" -->" />
<!-- TMPL_IF name="biblionumber" -->
<input type="button" value="Save Bibliographic Record and go to Items" onclick="Check(this.form);" accesskey="w" class="submit" />
<!-- TMPL_ELSE -->
<!--TMPL_UNLESS NAME="fromserials" -->
<input type="button" value="Add Bibliographic Record and go to Items" onclick="Check(this.form);" accesskey="w" class="submit" />
<!-- TMPL_ELSE -->
<input type="button" value="Add Bibliographic Record" onclick="Check(this.form);" accesskey="w" class="submit" />
<!--/TMPL_UNLESS-->
<!-- /TMPL_IF -->
<input type="button" value="z39.50 Search" class="submit" onclick="PopupZ3950(); return false;" / >
</div>
<br>
<div class="tabs">
<!-- TMPL_LOOP name="BIG_LOOP" -->
<a href="#" onclick="active(<!-- TMPL_VAR name="number"-->); return false;" id="link<!-- TMPL_VAR name="number"-->"><!-- TMPL_VAR name="number"--></a>
<!-- /TMPL_LOOP -->
</div>
<! -- RESET PAGINATION -->
<!-- TMPL_LOOP name="BIG_LOOP" -->
<!-- hide every tab except the 1st -->
<!-- TMPL_IF name="number" -->
<div name="<!-- TMPL_VAR name="number" -->XX" id="<!-- TMPL_VAR name="number" -->XX" class="tab" style="visibility:hidden">
<!-- TMPL_ELSE -->
<div name="<!-- TMPL_VAR name="number" -->XX" id="<!-- TMPL_VAR name="number" -->XX" class="tab" style="visibility:visible">
<!-- /TMPL_IF -->
<!-- TMPL_UNLESS name="number" -->
<!-- show duplicate warning on tab 0 only -->
<!-- TMPL_IF name="duplicatebiblionumber" -->
<div class="error">
<p>Is this a duplicate of <a href="../catalogue/MARCdetail.pl?biblionumber=<!-- TMPL_VAR name="duplicatebiblionumber" -->" onclick="openWindow('../catalogue/MARCdetail.pl?biblionumber=<!-- TMPL_VAR name="duplicatebiblionumber" -->&popup=1', 'Duplicate_biblio'; return false;)"><!-- TMPL_VAR name="duplicatetitle" --></a>?</p>
<p>You must either :</p>
<ul>
<li>If it <em>is</em> a duplicate, <a href="additem.pl?biblionumber=<!-- TMPL_VAR name="duplicatebiblionumber" -->">Edit Items</a> of the existing record.</li>
<li>If not, click to <input type="hidden" value="0" id="confirm_not_duplicate" name="confirm_not_duplicate" /> <a href="#" onclick="confirmnotdup(); return false;">Confirm it's not a duplicate</a></li>
</ul>
</div>
<!-- /TMPL_IF -->
<!-- /TMPL_UNLESS -->
<!-- TMPL_LOOP NAME="innerloop" -->
<div style=";" id="tag<!-- TMPL_VAR name="tag"-->">
<!-- TMPL_IF name="tag" -->
<p class="MARCtag">
<input type="hidden" name="ind_tag" value="<!-- TMPL_VAR NAME="tag" -->">
<!-- TMPL_UNLESS name="hide_marc" -->
<a title="<!-- TMPL_VAR NAME="tag_lib" -->"><!-- TMPL_VAR NAME="tag" --></a>
<input tabindex="1" onblur="this.style.backgroundColor='#ffffff';" onfocus="this.style.backgroundColor='#ffff00;'" type="text" <!-- TMPL_IF NAME="fixedfield" --> style="display:none;" <!-- /TMPL_IF --> name="indicator" size="2" maxlength="2" value="<!-- TMPL_VAR NAME="indicator" -->" class="flat"> -
<!-- TMPL_ELSE -->
<input tabindex="1" type="hidden" <!-- TMPL_IF NAME="fixedfield" --> style="display:none;" <!-- /TMPL_IF --> name="indicator" value="<!-- TMPL_VAR NAME="indicator" -->">
<!-- /TMPL_UNLESS -->
<!-- TMPL_UNLESS NAME="advancedMARCEditor" -->
<!-- TMPL_VAR NAME="tag_lib" -->
<!-- /TMPL_UNLESS -->
<!-- TMPL_IF name="repeatable" --><a href="javascript:AddField('<!-- TMPL_VAR NAME="tag" -->')">+</a><!-- /TMPL_IF -->
</p>
<!-- /TMPL_IF -->
<!-- TMPL_LOOP NAME="subfield_loop" -->
<!-- TMPL_IF NAME="visibility" -->
<a tabindex="1" style="color: grey; font-size: 80%; cursor: se-resize;" id="label<!-- TMPL_VAR name="index" -->" onclick="unHideSubfield('subfield<!-- TMPL_VAR NAME="tag" --><!-- TMPL_VAR name="index" -->','label<!-- TMPL_VAR name="index" -->')">
<!-- TMPL_VAR NAME="subfield" -->
</a>
<!-- /TMPL_IF -->
<div style="<!-- TMPL_VAR NAME='visibility' -->;" id="subfield<!-- TMPL_VAR NAME='tag' --><!-- TMPL_VAR NAME='index' -->">
<p>
<!-- TMPL_UNLESS NAME="advancedMARCEditor" -->
<label <!-- TMPL_IF NAME="fixedfield" --> style="display:none;" <!-- /TMPL_IF --> class="labelsubfield">
<!-- /TMPL_UNLESS -->
<!-- TMPL_UNLESS name="hide_marc" -->
<img style="cursor: crosshair; color: grey; font-size: 80%;" <!-- TMPL_IF NAME="fixedfield" --> style="display:none;" <!-- /TMPL_IF --> src="<!-- TMPL_VAR NAME="themelang" -->/images/up.png" onclick="upSubfield('subfield<!-- TMPL_VAR NAME="tag" --><!-- TMPL_VAR name="index" -->')"/>
<input title="<!-- TMPL_VAR NAME="marc_lib_plain" -->" style=" <!-- TMPL_IF NAME="fixedfield" -->display:none; <!-- /TMPL_IF -->border:0;" type="text" name="subfield" id="subfield<!--TMPL_VAR NAME="id"-->" value="<!-- TMPL_VAR NAME="subfield" -->" size="1" maxlength="1" class="flat" DISABLE READONLY tabindex=-1 />
<!-- TMPL_ELSE -->
<input type="hidden" name="subfield" id="subfield<!--TMPL_VAR NAME="id"-->" value="<!-- TMPL_VAR NAME="subfield" -->"/>
<!-- /TMPL_UNLESS -->
<!-- TMPL_UNLESS NAME="advancedMARCEditor" -->
<!-- TMPL_IF name="mandatory" --><b><!-- /TMPL_IF -->
<!-- TMPL_VAR NAME="marc_lib" -->
<!-- TMPL_IF name="mandatory" --> *</b><!-- /TMPL_IF -->
</label>
<!-- /TMPL_UNLESS -->
<!-- TMPL_VAR NAME="marc_value" -->
<!-- TMPL_IF NAME="repeatable" -->
<a style="cursor: crosshair; color: grey; font-size: 80%;" onclick="cloneSubfield('subfield<!-- TMPL_VAR NAME="tag" --><!-- TMPL_VAR name="index" -->')">+</a>
<!-- /TMPL_IF -->
<input type="hidden" name="tagindex" value="<!-- TMPL_VAR NAME="id" -->"/>
<input type="hidden" name="tag" value="<!-- TMPL_VAR NAME="tag" -->"/>
<input type="hidden" name="subfieldYYY" value="<!-- TMPL_VAR NAME="subfield" -->" size="2" maxlength="1"/>
<input type="hidden" name="mandatory" value="<!-- TMPL_VAR NAME="mandatory" -->"/>
<input type="hidden" name="tag_mandatory" value="<!-- TMPL_VAR NAME="tag_mandatory" -->"/>
</p>
</div>
<!-- /TMPL_LOOP -->
</div>
<!-- /TMPL_LOOP -->
</div>
<!-- /TMPL_LOOP -->
<div name="hidden" id="hidden" class="tab">
<!-- TMPL_LOOP NAME="hidden_loop" -->
<input type="hidden" name="tag" value="<!-- TMPL_VAR NAME="tag" -->">
<input type="hidden" name="subfield" id="subfield<!--TMPL_VAR NAME="id"-->" value="<!-- TMPL_VAR NAME="subfield" -->">
<input type="hidden" name="mandatory" value="<!-- TMPL_VAR NAME="mandatory" -->">
<input type="hidden" name="tag_mandatory" value="<!-- TMPL_VAR NAME="tag_mandatory" -->">
<!-- /TMPL_LOOP -->
</div>
<!-- TMPL_IF name="oldbiblionumtagfield" -->
<input type="hidden" name="tag" value="<!-- TMPL_VAR NAME="oldbiblionumtagfield" -->">
<input type="hidden" name="subfield" id="subfield<!--TMPL_VAR NAME="id"-->" value="<!-- TMPL_VAR NAME="oldbiblionumtagsubfield" -->">
<input type="hidden" name="field_value" value="<!-- TMPL_VAR NAME="oldbiblionumber" -->">
<input type="hidden" name="mandatory" value="0">
<input type="hidden" name="tag_mandatory" value="<!-- TMPL_VAR NAME="tag_mandatory" -->">
<!-- /TMPL_IF -->
</form>
<script language="JavaScript" type="text/javascript">
<!--TMPL_IF name="exit"-->
var finished=CloseMe(<!--TMPL_VAR NAME="biblionumber"-->,'<!--TMPL_VAR NAME="title"-->');
<!--/TMPL_IF-->
function loading(){
document.getElementById("loading").style.display = "none";
}
function _(s) { return s } // dummy function for gettext
function confirmnotdup(){
document.getElementById("confirm_not_duplicate").value = 1;
var checkform = document.getElementById("f");
Check(checkform);
}
function active(numlayer)
{
for (i=0; i <= 9 ; i++ ) {
ong = i+"XX";
link = "link"+i;
if (numlayer==i) {
with(document){
if (document.getElementById(ong)){
document.getElementById(ong).style.visibility="visible";
}
if(document.getElementById(link)){
document.getElementById(link).style.color="#000066";
document.getElementById(link).style.backgroundColor="#FFFFCC";
}
}
} else {
with(document){
if (document.getElementById(ong)){
document.getElementById(ong).style.visibility="hidden";
}
if (document.getElementById(link)) {
document.getElementById(link).style.color="#669999";
document.getElementById(link).style.backgroundColor="#D8DEB8";
}
}
}
}
}
active(0);
function Check(f) {
document.body.style.cursor ="wait";
// Scan for nonempty fields
var field_is_nonempty_p = new Array();
for (i=0 ; i<f.field_value.length ; i++) {
field_is_nonempty_p[f.tag[i].value] = 0;
}
for (i=0 ; i<f.field_value.length ; i++) {
if (f.field_value[i].value.length != 0) {
field_is_nonempty_p[f.tag[i].value] += 1;
}
}
// Scan for missing mandatory subfields
var total_missing_mandatory_subfields = 0;
var missing_mandatory_subfields = new Array();
for (i=0 ; i<f.field_value.length-2 ; i++) {
if (f.field_value[i].value.length==0 && f.mandatory[i].value==1) {
// We should not flag an error unless the tag is also
// mandatory, or if something else in the tag is entered
if (f.tag_mandatory[i].value == 1 || field_is_nonempty_p[f.tag[i].value]) {
f.field_value[i].style.backgroundColor="#FF0000";
total_missing_mandatory_subfields++;
if (f.field_value[i].parentNode.tagName == "B")
{
missing_mandatory_subfields.push(f.field_value[i].innerHTML + " (tab " + f.field_value[i].parentNode.parentNode.parentNode.parentNode.id.substr(0,1) + ")");
}
else
{
missing_mandatory_subfields.push(f.field_value[i].innerHTML + " (tab " + f.field_value[i].parentNode.parentNode.parentNode.id.substr(0,1) + ")");
}
}
} else {
f.field_value[i].style.backgroundColor="#FFFFFF";
}
}
// Scan for missing mandatory tags
var total_missing_mandatory_tags = 0;
var seen_mandatory_tag_p = new Array();
var missing_mandatory_tags = new Array();
for (i=0 ; i<f.field_value.length ; i++) {
var j = f.tag[i].value;
if (!field_is_nonempty_p[j] && f.tag_mandatory[i].value == 1) {
if (seen_mandatory_tag_p[j] != 1) {
seen_mandatory_tag_p[j] = 1;
total_missing_mandatory_tags++;
if (f.field_value[i].parentNode.tagName == "B")
{
missing_mandatory_tags.push(f.field_value[i].innerHTML + " (tab " + f.field_value[i].parentNode.parentNode.parentNode.parentNode.id.substr(0,1) + ")");
}
else
{
missing_mandatory_tags.push(f.field_value[i].innerHTML + " (tab " + f.field_value[i].parentNode.parentNode.parentNode.id.substr(0,1) + ")");
}
}
f.field_value[i].style.backgroundColor="#FFFF00";
}
}
var total_errors = total_missing_mandatory_tags + total_missing_mandatory_subfields;
var alertString2;
if (total_errors!=0) {
alertString2 = _("Form not submitted because of the following problem(s)");
alertString2 += "\n------------------------------------------------------------------------------------\n";
alertString2 += "\n- "+ total_missing_mandatory_tags +_(" mandatory tags empty");
for (i=0; i<missing_mandatory_tags.length; i++)
{
alertString2 += "\n--->"+ missing_mandatory_tags[i];
}
alertString2 += "\n- "+ total_missing_mandatory_subfields +_(" mandatory fields empty (see bold subfields)");
for (i=0; i<missing_mandatory_subfields.length; i++)
{
alertString2 += "\n--->"+ missing_mandatory_subfields[i];
}
alert(alertString2);
} else {
document.forms['f'].submit();
}
}
function Dopop(link,id) {
var subf=document.getElementsByName('subfield'+id);
var fields=document.getElementsByName('field_value'+id);
var defaultvalue="";
for (var s=0; s<fields.length; s++){
if (subf.item(s).value == 'a'){
defaultvalue=fields.item(s).value;
}
}
newin=window.open(link+"&result="+defaultvalue,"",'width=550,height=550,toolbar=false,scrollbars=yes');
}
function PopupZ3950() {
var strQuery="";
var error = 0;
for (i=0 ; i<document.forms['f'].field_value.length ; i++) {
if (document.forms['f'].tag[i].value == "<!--TMPL_VAR NAME="isbntag"-->"){
if (document.forms['f'].subfieldYYY[i].value =="<!--TMPL_VAR NAME="isbnsub"-->"){
if(document.forms['f'].field_value[i].value.length>0) {
strQuery += "&isbn="+document.forms['f'].field_value[i].value;
} else {
error++;
}
}
}
if (document.forms['f'].tag[i].value == "<!--TMPL_VAR NAME="titletag"-->"){
if (document.forms['f'].subfieldYYY[i].value == "<!--TMPL_VAR NAME="titlesub"-->"){
if(document.forms['f'].field_value[i].value.length>0) {
strQuery += "&title="+document.forms['f'].field_value[i].value;
} else {
error++;
}
}
}
if (document.forms['f'].tag[i].value == "<!--TMPL_VAR NAME="authortag"-->"){
if (document.forms['f'].subfieldYYY[i].value == "<!--TMPL_VAR NAME="authorsub"-->"){
if(document.forms['f'].field_value[i].value.length>0) {
strQuery += "&author="+document.forms['f'].field_value[i].value;
} else {
error++;
}
}
}
if (document.forms['f'].tag[i].value == "<!--TMPL_VAR NAME="issntag"-->"){
if (document.forms['f'].subfieldYYY[i].value == "<!--TMPL_VAR NAME="issnsub"-->"){
if(document.forms['f'].field_value[i].value.length>0) {
strQuery += "&issn="+document.forms['f'].field_value[i].value;
} else {
error++;
}
}
}
}
if(error < 4){
newin=window.open("../z3950/search.pl?oldbiblionumber=<!-- TMPL_VAR NAME="biblionumber" -->"+strQuery,"z3950search",'width=640,height=400,location=yes,toolbar=no,scrollbars=yes');
} else {
alert("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");
}
}
function Changefwk(FwkList) {
var fwk = FwkList.options[FwkList.selectedIndex].value;
window.location = "addbiblio.pl?oldbiblionumber=<!--TMPL_VAR Name="oldbiblionumber"-->&frameworkcode="+fwk;
}
function AddField(field) {
document.forms['f'].op.value = "addfield";
document.forms['f'].addfield_field.value=field;
document.f.submit();
}
function cloneSubfield(index) {
var original = document.getElementById(index);
var clone = original.cloneNode(true);
clone.setAttribute("id", index + index);
// orginput : the value of the original field (in [0] if hide_marc=1, otherwise in [1]
// image : the up button. don't exist is hide_marc=1
<!-- TMPL_IF name="hide_marc" -->
var orginput = original.getElementsByTagName('input')[0];
<!-- TMPL_ELSE -->
var orginput = original.getElementsByTagName('input')[1];
image = clone.getElementsByTagName('img')[0];
image.setAttribute("onclick","upSubfield('" + index + index + "')");
<!-- /TMPL_IF -->
trigger = original.getElementsByTagName('a')[0];
if (trigger) {
// trigger.parentNode.removeChild(trigger);
}
clonetrigger = clone.getElementsByTagName('a')[0];
clonetrigger.setAttribute("onclick","cloneSubfield('" + index + index + "')");
clone.setAttribute("tabindex","1");
orginput.value = '';
original.parentNode.insertBefore( clone, original);
}
function upSubfield(index) {
try{
var line = document.getElementById(index); // get the line where the user has clicked.
} catch(e) {
return;
}
var tag = line.parentNode; // get the dad of this line. (should be "<div tag=XXX>")
// getting all subfields for this tag
var subfields = tag.getElementsByTagName('div');
var subfieldsLength = subfields.length;
if(subfieldsLength<=1) return; // nothing to do if there is just one subfield.
// among all subfields
for(var i=0;i<subfieldsLength;i++){
if(subfields[i].getAttribute('id') == index){ //looking for the subfield which is clicked :
if(i==0){ // if the clicked subfield is on the top
tag.appendChild(subfields[0]);
return;
}else{
var lineAbove = subfields[i-1];
tag.insertBefore(line,lineAbove);
return;
}
}
}
}
function unHideSubfield(index,labelindex) {
subfield = document.getElementById(index);
subfield.style.display = 'block';
label = document.getElementById(labelindex);
label.style.display='none';
}
function CloseMe(biblionumber,title) {
var myfield = opener.document.getElementById('biblionumber');
myfield.value = biblionumber;
var myfield = opener.document.getElementById('title');
myfield.value = title;
self.close();
return false;
}
</script>
<!--/TMPL_UNLESS-->
</div>
<!-- TMPL_INCLUDE NAME="intranet-bottom.inc" -->