284 lines
No EOL
13 KiB
Cheetah
284 lines
No EOL
13 KiB
Cheetah
<!-- TMPL_INCLUDE NAME="doc-head-open.inc" -->
|
|
<Title>Koha -- Authority details</title>
|
|
<!-- TMPL_INCLUDE NAME="doc-head-close.inc" -->
|
|
|
|
<!-- TMPL_INCLUDE NAME="menus.inc" -->
|
|
<!-- TMPL_INCLUDE NAME="menu-authorities.inc" -->
|
|
|
|
<div id="authorities_authorities_add_or_modify">
|
|
<!-- TMPL_IF name="authid" -->
|
|
<h1>Modify authority #<!-- TMPL_VAR NAME="authid" --> (<!-- TMPL_VAR name="authtypetext" -->)</h1>
|
|
<!-- TMPL_ELSE -->
|
|
<h1>Adding authority (<!-- TMPL_VAR name="authtypetext" -->)</h1>
|
|
<!-- /TMPL_IF -->
|
|
<form method="post" name="f">
|
|
<input type="hidden" name="op" value="add" />
|
|
<input type="hidden" name="addfield_field" value="" />
|
|
<input type="hidden" name="repeat_field" value="" />
|
|
<input type="hidden" name="authtypecode" value="<!-- TMPL_VAR NAME="authtypecode" -->" />
|
|
<input type="hidden" name="authid" value="<!-- TMPL_VAR NAME="authid" -->" />
|
|
|
|
<div id="action">
|
|
<!-- TMPL_IF name="authid" -->
|
|
<input type="button" value="Save" onclick="Check(this.form)" accesskey="w" />
|
|
<!-- TMPL_ELSE -->
|
|
<input type="button" value="Add authority" onclick="Check(this.form)" accesskey="w" />
|
|
<!-- /TMPL_IF -->
|
|
</div>
|
|
|
|
<!-- TMPL_IF name="duplicateauthid" -->
|
|
<div class="problem">
|
|
<p>Duplicate suspected with <a href="javascript:openWindow("detail.pl?authid=<!-- TMPL_VAR name="duplicateauthid" -->&popup=1", "Duplicate Authority");" class="button"><!-- TMPL_VAR name="duplicateauthvalue" --></a></p>
|
|
<p>You must either :</p>
|
|
<ul>
|
|
<p><input type="checkbox" value="1" name="confirm_not_duplicate" />confirm it's not a duplicate (and click on <input type="button" value="Add authority" onclick="Check(this.form)" accesskey="w" class="button" /> again)</p>
|
|
<p>Go to <a href="authorities.pl?authid=<!-- TMPL_VAR name="duplicateauthid" -->" >original authority</a></p>
|
|
</ul>
|
|
</div>
|
|
<!-- /TMPL_IF -->
|
|
|
|
<!-- TMPL_LOOP NAME="0XX" -->
|
|
<!-- TMPL_IF name="tag" -->
|
|
<p class="tag">
|
|
<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='#ffffff;'" 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="#<!-- TMPL_VAR NAME="tag" -->" onclick="this.nextSibling.type='text';this.nextSibling.focus()">+</a><input type="hidden" value="" size="2" onchange="AddField('<!-- TMPL_VAR NAME="tag" -->',this.value)" />
|
|
<!-- /TMPL_IF -->
|
|
</p>
|
|
<!-- /TMPL_IF -->
|
|
<div>
|
|
<!-- TMPL_LOOP NAME="subfield_loop" -->
|
|
<p class="subfield">
|
|
<!-- 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 <!-- 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" value="<!-- TMPL_VAR NAME="subfield" -->" size="1" maxlength="1" class="flat" disabled="disabled" readonly="readonly" tabindex="-1" />
|
|
<!-- TMPL_ELSE -->
|
|
<input type="hidden" name="subfield" 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="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="kohafield" value="<!-- TMPL_VAR NAME="kohafield" -->" />
|
|
<input type="hidden" name="tag_mandatory" value="<!-- TMPL_VAR NAME="tag_mandatory" -->" />
|
|
</p>
|
|
</div>
|
|
<!-- /TMPL_LOOP -->
|
|
</div>
|
|
<!-- /TMPL_LOOP -->
|
|
</div>
|
|
<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" value="<!-- TMPL_VAR NAME="subfield" -->" />
|
|
<input type="hidden" name="mandatory" value="<!-- TMPL_VAR NAME="mandatory" -->" />
|
|
<input type="hidden" name="kohafield" value="<!-- TMPL_VAR NAME="kohafield" -->" />
|
|
<input type="hidden" name="tag_mandatory" value="<!-- TMPL_VAR NAME="tag_mandatory" -->" />
|
|
<!-- /TMPL_LOOP -->
|
|
</div>
|
|
<!-- TMPL_IF name="oldauthnumtagfield" -->
|
|
<input type="hidden" name="tag" value="<!-- TMPL_VAR NAME="oldauthnumtagfield" -->" />
|
|
<input type="hidden" name="subfield" value="<!-- TMPL_VAR NAME="oldauthnumtagsubfield" -->" />
|
|
<input type="hidden" name="field_value" value="<!-- TMPL_VAR NAME="authid" -->" />
|
|
<input type="hidden" name="mandatory" value="0" />
|
|
<input type="hidden" name="kohafield" value="<!-- TMPL_VAR NAME="kohafield" -->" />
|
|
<input type="hidden" name="tag_mandatory" value="<!-- TMPL_VAR NAME="tag_mandatory" -->" />
|
|
<input type="hidden" name="tag" value="<!-- TMPL_VAR NAME="oldauthtypetagfield" -->" />
|
|
<input type="hidden" name="subfield" value="<!-- TMPL_VAR NAME="oldauthtypetagsubfield" -->" />
|
|
<input type="hidden" name="field_value" value="<!-- TMPL_VAR NAME="authtypecode" -->" />
|
|
<!-- /TMPL_IF -->
|
|
<div id="action">
|
|
<!-- TMPL_IF name="authid" -->
|
|
<input type="button" value="Save" onclick="Check(this.form)" accesskey="w" />
|
|
<!-- TMPL_ELSE -->
|
|
<input type="button" value="Add authority" onclick="Check(this.form)" accesskey="w" />
|
|
<!-- /TMPL_IF -->
|
|
</div>
|
|
</form>
|
|
</fieldset>
|
|
|
|
<script language="JavaScript" type="text/javascript">
|
|
function active(numlayer)
|
|
{
|
|
for (i=0; i < 10 ; i++ ) {
|
|
ong = i+"XX";
|
|
link = "link"+i;
|
|
if (numlayer==i) {
|
|
document.getElementById(ong).style.visibility="visible";
|
|
} else {
|
|
document.getElementById(ong).style.visibility="hidden";
|
|
}
|
|
}
|
|
}
|
|
function Check(f) {
|
|
// 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;
|
|
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]) {
|
|
document.getElementById("error"+i).style.backgroundColor="#FF0000";
|
|
total_missing_mandatory_subfields++;
|
|
}
|
|
} else {
|
|
document.getElementById("error"+i).style.backgroundColor="#FFFFFF";
|
|
}
|
|
}
|
|
|
|
// Scan for missing mandatory tags
|
|
var total_missing_mandatory_tags = 0;
|
|
var seen_mandatory_tag_p = 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++;
|
|
}
|
|
document.getElementById("error"+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");
|
|
alertString2 += "\n- "+ total_missing_mandatory_subfields +_(" mandatory fields empty (see bold subfields)");
|
|
alert(alertString2);
|
|
} else {
|
|
document.forms['f'].submit();
|
|
}
|
|
}
|
|
function Dopop(link,i) {
|
|
defaultvalue=document.forms['f'].field_value[i].value;
|
|
newin=window.open(link+"&result="+defaultvalue,"value builder",'width=550,height=550,toolbar=false,scrollbars=yes');
|
|
}
|
|
|
|
function PopupZ3950() {
|
|
var strQuery="";
|
|
for (i=0 ; i<document.forms['f'].field_value.length ; i++) {
|
|
if (document.forms['f'].kohafield[i].value == "biblioitems.isbn" && document.forms['f'].field_value[i].value.length>0) {
|
|
strQuery += "&isbn="+document.forms['f'].field_value[i].value;
|
|
}
|
|
if (document.forms['f'].kohafield[i].value == "biblio.title" && document.forms['f'].field_value[i].value.length>0) {
|
|
strQuery += "&title="+document.forms['f'].field_value[i].value;
|
|
}
|
|
if (document.forms['f'].kohafield[i].value == "biblio.author" &&document.forms['f'].field_value[i].value.length>0) {
|
|
strQuery += "&author="+document.forms['f'].field_value[i].value;
|
|
}
|
|
if (document.forms['f'].kohafield[i].value == "biblioitems.issn" && document.forms['f'].field_value[i].value.length>0) {
|
|
strQuery += "&issn="+document.forms['f'].field_value[i].value;
|
|
}
|
|
}
|
|
newin=window.open("../z3950/search.pl?biblionumber=<!-- TMPL_VAR NAME="biblionumber" -->"+strQuery,"z3950search",'width=500,height=400,toolbar=false,scrollbars=yes');
|
|
}
|
|
|
|
function AddField(field,cntrepeatfield) {
|
|
document.forms['f'].op.value = "addfield";
|
|
document.forms['f'].addfield_field.value=field;
|
|
document.forms['f'].repeat_field.value=cntrepeatfield;
|
|
document.f.submit();
|
|
}
|
|
|
|
function cloneSubfield(index) {
|
|
var original = document.getElementById(index); //original <div>
|
|
var clone = original.cloneNode(true);
|
|
|
|
// set the attribute for the new 'div' subfields
|
|
clone.setAttribute('id',index + index);//set another id.
|
|
var NumTabIndex;
|
|
NumTabIndex = parseInt(original.getAttribute('tabindex'));
|
|
if(isNaN(NumTabIndex)) NumTabIndex = 0;
|
|
clone.setAttribute('tabindex',NumTabIndex+1);
|
|
|
|
var CloneButtonPlus;
|
|
try{
|
|
CloneButtonPlus = clone.getElementsByTagName('a')[0];
|
|
CloneButtonPlus.setAttribute('onclick',"cloneSubfield('" + index + index + "')");
|
|
}
|
|
catch(e){
|
|
// do nothing if ButtonPlus & CloneButtonPlus don't exist.
|
|
}
|
|
|
|
// insert this line on the page
|
|
original.parentNode.insertBefore(clone,original.nextSibling);
|
|
}
|
|
|
|
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';
|
|
}
|
|
|
|
</script>
|
|
|
|
<!-- TMPL_INCLUDE name="intranet-bottom.inc" --> |