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

Owen Leonard oleonard at athenscounty.lib.oh.us
Mon Oct 2 17:09:22 CEST 2006


CVSROOT:	/sources/koha
Module name:	koha
Branch:		rel_2_2
Changes by:	Owen Leonard <oleonard>	06/10/02 15:09:22

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

Log message:
	Synching revised cloneSubfield javascript from default

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

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.24
retrieving revision 1.4.2.25
diff -u -b -r1.4.2.24 -r1.4.2.25
--- addbiblio.tmpl	14 Sep 2006 14:11:41 -0000	1.4.2.24
+++ addbiblio.tmpl	2 Oct 2006 15:09:22 -0000	1.4.2.25
@@ -319,27 +319,31 @@
 }
 
 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 ButtonPlus;
+    var CloneButtonPlus;
+    try{
+        ButtonPlus = original.getElementsByTagName('a')[0];  // getting the '<a href=...>+</a>
+        ButtonPlus.parentNode.removeChild(ButtonPlus);  // removing the '+' button
+
+        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) {





More information about the Koha-cvs mailing list