Koha/koha-tmpl/intranet-tmpl/prog/en/authorities/authorities.tmpl
2006-09-27 21:40:47 +00:00

342 lines
No EOL
15 KiB
Cheetah

<!-- TMPL_INCLUDE NAME="doc-head-open.inc" -->NEULIS -- Authorities
<!-- TMPL_INCLUDE NAME="doc-head-close.inc" -->
<!--TMPL_UNLESS NAME="nonav"--><!-- TMPL_INCLUDE NAME="menus.inc" -->
<!-- TMPL_INCLUDE NAME="menu-authorities.inc" -->
<!--TMPL_ELSE-->
<!-- TMPL_INCLUDE NAME="menu-authorities.inc" -->
<!--/TMPL_UNLESS-->
<!-- TMPL_IF name="error" -->
<div class="error">
<!--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 -->
<form method="post" name="f" id="f" action="authorities.pl?authid=<!-- TMPL_VAR NAME="authid" -->&nonav=<!-- TMPL_VAR NAME="nonav" -->&linkid="+document.form.f.linkid.value >
<div class="tabitem">
<h1>Authority number <!-- TMPL_VAR NAME="authid" --></h1>
<p><input type="hidden" name="nonav" value="<!-- TMPL_VAR NAME="nonav" -->"><input type="hidden" name="index" value="<!-- TMPL_VAR NAME="index" -->">
<input type="hidden" name="op" value="add">
<input type="hidden" name="addfield_field">
<input type="hidden" name="authtypecode" value="<!-- TMPL_VAR NAME="authtypecode" -->">
<input type="hidden" name="authid" value="<!-- TMPL_VAR NAME="authid" -->">
<input type="hidden" name="linkid" id="linkid" value="0000">
<!-- TMPL_IF name="authid" -->
<input type="button" value="Save" onClick="Check(this.form)" accesskey="w" class="button authority">
<!-- TMPL_ELSE -->
<input type="button" value="Add authority" onClick="Check(this.form)" accesskey="w" class="button authority">
<!-- /TMPL_IF -->
</p>
</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="duplicateauthid" -->
<div class="error">
<p>Is this a duplicate of <a href="detail.pl?authid=<!-- TMPL_VAR name="duplicateauthid" -->&nonav=<!-- TMPL_VAR name="nonav" -->" onclick="openWindow('detail.pl?nonav=<!-- TMPL_VAR name="nonav" -->&authid=<!-- TMPL_VAR name="duplicateauthid" -->&popup=1', ''; return false;)"><!-- TMPL_VAR name="duplicateauthvalue" --></a>?</p>
<ul>
<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="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="oldauthnumtagfield" -->
<input type="hidden" name="tag" value="<!-- TMPL_VAR NAME="oldauthnumtagfield" -->">
<input type="hidden" name="subfield" id="subfield<!--TMPL_VAR NAME="id"-->" 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="tag_mandatory" value="<!-- TMPL_VAR NAME="tag_mandatory" -->">
<input type="hidden" name="tag" value="<!-- TMPL_VAR NAME="oldauthtypetagfield" -->">
<input type="hidden" name="subfield" id="subfield<!--TMPL_VAR NAME="id"-->" value="<!-- TMPL_VAR NAME="oldauthtypetagsubfield" -->">
<input type="hidden" name="field_value" value="<!-- TMPL_VAR NAME="authtypecode" -->">
<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">
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 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';
}
</script>
<!-- TMPL_INCLUDE NAME="intranet-bottom.inc" -->