[Koha-cvs] koha/koha-tmpl/intranet-tmpl/npl/en/acqui.simpl... [dev_week]

Ryan Higgins rch at liblime.com
Sat Dec 9 00:09:03 CET 2006


CVSROOT:	/sources/koha
Module name:	koha
Branch:		dev_week
Changes by:	Ryan Higgins <rych>	06/12/08 23:09:03

Modified files:
	koha-tmpl/intranet-tmpl/npl/en/acqui.simple: addbiblio.tmpl 

Log message:
	sync with rel_2_2 - fixes javascript for authority-controlled fields

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/koha/koha-tmpl/intranet-tmpl/npl/en/acqui.simple/addbiblio.tmpl?cvsroot=koha&only_with_tag=dev_week&r1=1.4.2.15.2.7&r2=1.4.2.15.2.8

Patches:
Index: addbiblio.tmpl
===================================================================
RCS file: /sources/koha/koha/koha-tmpl/intranet-tmpl/npl/en/acqui.simple/Attic/addbiblio.tmpl,v
retrieving revision 1.4.2.15.2.7
retrieving revision 1.4.2.15.2.8
diff -u -b -r1.4.2.15.2.7 -r1.4.2.15.2.8
--- addbiblio.tmpl	3 Nov 2006 00:37:34 -0000	1.4.2.15.2.7
+++ addbiblio.tmpl	8 Dec 2006 23:09:03 -0000	1.4.2.15.2.8
@@ -12,8 +12,10 @@
 	<form method="post" name="f" id="f" action="addbiblio.pl">
 <h1><!-- TMPL_IF NAME="oldbiblionumtagfield" -->Editing <em><!-- TMPL_VAR name="title" --> (<!-- TMPL_VAR name="oldbiblionumber" -->)</em><!-- TMPL_ELSE -->Add MARC Record<!-- /TMPL_IF --></h1> <h4>Using Framework : <!--TMPL_VAR Name="framework" --></h4>
 
+<div class="tabbed">
 		<input type="hidden" name="op" value="addbiblio" />
 		<input type="hidden" name="addfield_field" />
+		<input type="hidden" name="repeat_field" />
 		<input type="hidden" name="frameworkcode" value="<!-- TMPL_VAR NAME="frameworkcode" -->" />
 		<input type="hidden" name="oldbiblionumber" value="<!-- TMPL_VAR NAME="oldbiblionumber" -->" />
 		<!-- TMPL_IF name="bibid" -->
@@ -26,23 +28,23 @@
 
 	<div class="tabs">
         <!-- TMPL_LOOP name="BIG_LOOP" -->
-            <a href="#" class="addbiblioTabOff" onclick="active(<!-- TMPL_VAR name="number"-->); return false;" id="link<!-- TMPL_VAR name="number"-->"><!-- TMPL_VAR name="number"--></a>
+            <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 -->
+<! -- RESET PAGINATION -->
 <!-- TMPL_LOOP name="BIG_LOOP" -->
 <!-- hide every tab except the 1st -->
 <!-- TMPL_IF name="number" -->
-    <div id="<!-- TMPL_VAR name="number" -->XX" class="tab" style="visibility:hidden">
+    <div name="<!-- TMPL_VAR name="number" -->XX" id="<!-- TMPL_VAR name="number" -->XX" class="tab" style="visibility:hidden">
 <!-- TMPL_ELSE -->
-    <div id="<!-- TMPL_VAR name="number" -->XX" class="tab" style="visibility:visible">
+    <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="../MARCdetail.pl?bib=<!-- TMPL_VAR name="duplicatebiblionumber" -->" onclick="openWindow('../MARCdetail.pl?bib=<!-- TMPL_VAR name="duplicatebiblionumber" -->&amp;popup=1', 'Duplicate biblio'; return false;)"><!-- TMPL_VAR name="duplicatetitle" --></a>?</p>
+                        <p>Is this a duplicate of <a href="../MARCdetail.pl?bib=<!-- TMPL_VAR name="duplicatebiblionumber" -->" onclick="openWindow('../MARCdetail.pl?bib=<!-- 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="duplicatebibid" -->">Edit Items</a> of the existing record.</li>
@@ -55,22 +57,22 @@
 		<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" -->" />
+            <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" class="indicator" onblur="this.className='indicator';" onfocus="this.className='indicatorFocus';" type="text" <!-- TMPL_IF NAME="fixedfield" --> style="display:none;" <!-- /TMPL_IF --> name="indicator" size="2" maxlength="2" value="<!-- TMPL_VAR NAME="indicator" -->" /> -
+                <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" -->" />
+                <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" -->')" title="Clone this Tag">+</a><!-- /TMPL_IF -->
+            <!-- TMPL_IF name="repeatable" --><a href="#<!-- TMPL_VAR NAME="tag" -->" onclick="javascript:this.nextSibling.type='text';this.nextSibling.focus()">+</a><input type="hidden" value="" size="2" onchange="javascript:AddField('<!-- TMPL_VAR NAME="tag" -->',this.value)" ><!-- /TMPL_IF -->
         </p>
         <!-- /TMPL_IF -->
         <!-- TMPL_LOOP NAME="subfield_loop" -->
             <!-- TMPL_IF NAME="visibility" -->
-                <a tabindex="1" class="unHideSubfield" id="label<!-- TMPL_VAR name="index" -->" onclick="unHideSubfield('subfield<!-- TMPL_VAR NAME="tag" --><!-- TMPL_VAR name="index" -->','label<!-- TMPL_VAR name="index" -->')" title="Expand this subfield">
+                <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 -->
@@ -80,8 +82,8 @@
                     <label <!-- TMPL_IF NAME="fixedfield" --> style="display:none;" <!-- /TMPL_IF --> class="labelsubfield">
                 <!-- /TMPL_UNLESS -->
                 <!-- TMPL_UNLESS name="hide_marc" -->
-                    <img class="upsubfield" <!-- 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" -->')" alt="Move Subfield Up" title="Move Subfield Up" />
-                        <input title="<!-- TMPL_VAR NAME="marc_lib_plain" -->"<!-- TMPL_IF NAME="fixedfield" --> style="display : none;"<!-- /TMPL_IF --> type="text" name="subfield" value="<!-- TMPL_VAR NAME="subfield" -->" size="1" maxlength="1" class="flat" readonly="readonly" tabindex="-1" />
+                    <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" value="<!-- TMPL_VAR NAME="subfield" -->" size="1" maxlength="1" class="flat" DISABLE READONLY tabindex=-1 />
                 <!-- TMPL_ELSE -->
                     <input type="hidden" name="subfield" value="<!-- TMPL_VAR NAME="subfield" -->"/>
                 <!-- /TMPL_UNLESS -->
@@ -93,7 +95,7 @@
                 <!-- /TMPL_UNLESS -->
                 <!-- TMPL_VAR NAME="marc_value" -->
                 <!-- TMPL_IF NAME="repeatable" -->
-                    <a class="clonesubfield" onclick="cloneSubfield('subfield<!-- TMPL_VAR NAME="tag" --><!-- TMPL_VAR name="index" -->')" title="Clone this Subfield">+</a>
+                    <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"/>
@@ -107,7 +109,7 @@
     <!-- /TMPL_LOOP -->
     </div>
 <!-- /TMPL_LOOP -->
-		<div id="hidden" class="tab">
+		<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" -->">
@@ -153,7 +155,8 @@
 				document.getElementById(ong).style.visibility="visible";
 			}
 			if(document.getElementById(link)){
-				document.getElementById(link).className="addbiblioTabOn";
+				document.getElementById(link).style.color="#000066";
+				document.getElementById(link).style.backgroundColor="#FFFFCC";
 			}
 			}
 		} else {
@@ -162,7 +165,8 @@
 				document.getElementById(ong).style.visibility="hidden";
 			}
 			if (document.getElementById(link)) {
-				document.getElementById(link).className="addbiblioTabOff";
+				document.getElementById(link).style.color="#669999";
+				document.getElementById(link).style.backgroundColor="#D8DEB8";
 			}
 			}
 		}
@@ -192,20 +196,20 @@
 		    // 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].className="addbiblioInputFocus";
+				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 + " ( is B tab " +  f.field_value[i].parentNode.parentNode.parentNode.parentNode.id.substr(0,1) + ")");
+				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 + " field " + f.tag[i].value + " $" +f.subfieldYYY[i].value);
+				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].className="addbiblioInput";
+			f.field_value[i].style.backgroundColor="#FFFFFF";
 		}
 	document.body.style.cursor ="default";
 	}
@@ -222,15 +226,14 @@
 		    total_missing_mandatory_tags++;
  		    if (f.field_value[i].parentNode.tagName == "B")
 		    {
-				missing_mandatory_tags.push(f.field_value[i].innerHTML + " (check tab " +  f.field_value[i].parentNode.parentNode.parentNode.parentNode.id.substr(0,1) + ")");
+				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 + " field " + f.tag[i].value);
-				//+ " (check tab " +  f.field_value[i].parentNode.parentNode.parentNode.id.substr(0,1) + ")");
+				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].className="mandatory";
+		f.field_value[i].style.backgroundColor="#FFFF00";
 	    }
 	}
 
@@ -256,7 +259,7 @@
 }
 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');
+	newin=window.open(link+"&result="+defaultvalue,"value builder",'width=700,height=550,toolbar=false,scrollbars=yes');
 }
 
 function PopupZ3950() {
@@ -293,7 +296,7 @@
 		}
 	}
 	if(error < 4){
-	newin=window.open("../z3950/search.pl?oldbiblionumber=<!-- TMPL_VAR NAME="oldbiblionumber" -->"+strQuery,"z3950search",'width=640,height=400,location=yes,toolbar=no,scrollbars=yes');
+	newin=window.open("../z3950/search.pl?oldbiblionumber=<!-- TMPL_VAR NAME="bibid" -->"+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");
 	}
@@ -309,44 +312,66 @@
 //     alert("X"+X);
     Y=X.parentNode.getAttribute("id");
 //     alert("tagid"+Y);
-	newin=window.open("../authorities/auth_finder.pl?authtypecode="+  authtype+ "&tagid="+Y, "value builder",'width=550,height=550,toolbar=false,scrollbars=yes');
+	newin=window.open("../authorities/auth_finder.pl?authtypecode="+  authtype+ "&tagid="+Y, "value builder",'width=700,height=550,toolbar=false,scrollbars=yes');
 }
 
 
-function AddField(field) {
+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);
+    var original = document.getElementById(index); //original <div>
  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.nextSibling); 
+
+    // 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 nothig if ButtonPlus & CloneButtonPlus don't exist.
+    }
+
+    // insert this line on the page
+    original.parentNode.insertBefore(clone,original.nextSibling);
 }
 
 function upSubfield(index) {
-var original = document.getElementById(index);
-var previous = original.previousSibling;
-original.parentNode.insertBefore( original, previous );
+	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) {





More information about the Koha-cvs mailing list