Bug 3128: IE7 tweak
[koha.git] / koha-tmpl / intranet-tmpl / prog / en / modules / authorities / authorities.tmpl
index d293498..57af9dc 100644 (file)
@@ -1,12 +1,33 @@
 <!-- TMPL_INCLUDE NAME="doc-head-open.inc" -->
-<title>Koha -- Authority details</title>
+<title>Koha &rsaquo; Authorities &rsaquo; <!-- TMPL_IF name="authid" -->Modify authority #<!-- TMPL_VAR NAME="authid" --> (<!-- TMPL_VAR name="authtypetext" -->)<!-- TMPL_ELSE -->Adding authority (<!-- TMPL_VAR name="authtypetext" -->)<!-- /TMPL_IF --></title>
 <!-- TMPL_INCLUDE NAME="doc-head-close.inc" -->
+<script type="text/javascript" src="<!-- TMPL_VAR name="themelang" -->/lib/yui/plugins/bubbling-min.js"></script>
 
 <script type="text/javascript">
 //<![CDATA[
 
+     var fields_in_use = {};
         $(document).ready(function() {
-               $('#authoritytabs').tabs();
+               $('#authoritytabs > ul').tabs();
+        $('.tag').each(function() {
+            var field_id = this.getAttribute('id').substring(0, 7);
+            if (field_id in fields_in_use) {
+                fields_in_use[field_id]++;
+            } else {
+                fields_in_use[field_id] = 1;
+            }
+        });
+        $('.subfield_line').each(function() {
+            var field_id = this.getAttribute('id').substring(0, 12);
+            if (field_id in fields_in_use) {
+                fields_in_use[field_id]++;
+            } else {
+                fields_in_use[field_id] = 1;
+            }
+        });
+               $("#f").submit(function(){
+                       return $(this).Check();
+               });
         });
 
 /**
  */
 function AreMandatoriesNotOk(){
     var mandatories = new Array();
-    var tab = new Array();
+    var   tab = new Array();
     var label = new Array();
-    var flag=0;
     <!-- TMPL_LOOP NAME='BIG_LOOP' --><!-- TMPL_LOOP NAME='innerloop' --><!-- TMPL_LOOP NAME='subfield_loop'--><!-- TMPL_IF NAME='mandatory'-->mandatories.push("<!-- TMPL_VAR NAME='id' -->");
                         tab.push("<!-- TMPL_VAR NAME='number' -->");
                         label.push("<!-- TMPL_VAR NAME='marc_lib' ESCAPE=JS-->");<!-- /TMPL_IF --><!-- /TMPL_LOOP --><!-- /TMPL_LOOP --><!-- /TMPL_LOOP -->
-    var StrAlert = _("Can't save this record because the following field aren't filled :\n\n");
+    var StrAlert = "";
     for(var i=0,len=mandatories.length; i<len ; i++){
-        //alert (  mandatories[i]);
-        if( ! document.getElementById(mandatories[i]).value){
-            flag = 1;
-            document.getElementById(mandatories[i]).setAttribute('class','subfield_not_filled');
-            document.getElementById(mandatories[i]).focus();
+        var id_string = mandatories[i];
+        alert (id_string);
+        if( ! $("#" + id_string).val() ){
+            $("#" + id_string).attr('class','subfield_not_filled').focus();
             StrAlert += "\t* "+label[i]+_(" in tab ")+tab[i]+"\n";
         }
     }
-    if(flag){
-      return StrAlert;
-  } else {
-    return flag;
-  }
+    if(StrAlert){
+        return _("Can't save this record because the following field aren't filled :\n\n") + StrAlert;
+    } else {
+        return flag;
+    }
 }
 
 /**
@@ -53,8 +72,6 @@ function Check(){
 }
 
 
-
-
 function AddField(field,cntrepeatfield) {
     document.forms['f'].op.value = "addfield";
     document.forms['f'].addfield_field.value=field;
@@ -64,7 +81,7 @@ function AddField(field,cntrepeatfield) {
 
 function Dopop(link,i) {
     defaultvalue = document.getElementById(i).value;
-    window.open(link+"&result="+defaultvalue,"value builder",'width=700,height=550,toolbar=false,scrollbars=yes');
+    window.open(link+"&result="+defaultvalue,"valuebuilder",'width=700,height=550,toolbar=false,scrollbars=yes');
 }
 
 function ExpandField(index) {
@@ -86,6 +103,7 @@ function ExpandField(index) {
  */ 
 function CloneField(index) {
     var original = document.getElementById(index); //original <div>
+    fields_in_use[index.substr(0, 7)]++;
     var clone = original.cloneNode(true);
     var new_key = CreateKey();
     var new_id  = original.getAttribute('id')+new_key;
@@ -96,8 +114,10 @@ function CloneField(index) {
     
     <!-- TMPL_UNLESS NAME='hide_marc'--> // No indicator if hide_marc
         // setting a new name for the new indicator
-        var indicator = clone.getElementsByTagName('input')[0];
-        indicator.setAttribute('name',indicator.getAttribute('name')+new_key);
+        for(var i=0; i < 2; i++) {
+            var indicator = clone.getElementsByTagName('input')[i];
+            indicator.setAttribute('name',indicator.getAttribute('name')+new_key);
+        }
     <!-- /TMPL_UNLESS -->
         
     // settings all subfields
@@ -143,14 +163,15 @@ function CloneField(index) {
                 imgs[0].setAttribute('onclick',"upSubfield(\'"+divs[i].getAttribute('id')+"\');");
             <!-- /TMPL_UNLESS -->
             
-            // setting its '+' button
-            var CloneButtonPlus=0;
+            // setting its '+' and '-' buttons
             try {
-                CloneButtonPlus = divs[i].getElementsByTagName('span')[0];
-                if(CloneButtonPlus.getAttribute('class') == 'buttonPlus'){
-                    CloneButtonPlus.setAttribute('onclick',"CloneSubfield('" + divs[i].getAttribute('id') + "')");
-                } else {
-                    CloneButtonPlus = 0;
+                var spans = divs[i].getElementsByTagName('span');
+                for (var j = 0; j < spans.length; j++) {
+                    if(spans[j].getAttribute('class') == 'buttonPlus'){
+                        spans[j].setAttribute('onclick',"CloneSubfield('" + divs[i].getAttribute('id') + "')");
+                    } else if (spans[j].getAttribute('class') == 'buttonMinus') {
+                        spans[j].setAttribute('onclick',"UnCloneField('" + divs[i].getAttribute('id') + "')");
+                    }
                 }
             }
             catch(e){
@@ -212,11 +233,18 @@ function CloneField(index) {
             if(divs[i].getAttribute('name') == 'div_indicator'){
                 var inputs = divs[i].getElementsByTagName('input');
                 inputs[0].setAttribute('id',inputs[0].getAttribute('id')+new_key);
+                inputs[1].setAttribute('id',inputs[1].getAttribute('id')+new_key);
                 
                 var CloneButtonPlus;
                 try {
-                    CloneButtonPlus = divs[i].getElementsByTagName('span')[1]; // 0 is the title
-                    CloneButtonPlus.setAttribute('onclick',"CloneField('" + divs[i].parentNode.getAttribute('id') + "')");
+                    var anchors = divs[i].getElementsByTagName('span');
+                    for (var j = 0; j < anchors.length; j++) {
+                        if (anchors[j].getAttribute('class') == 'buttonPlus') {
+                            anchors[j].setAttribute('onclick',"CloneField('" + new_id + "')");
+                        } else if (anchors[j].getAttribute('class') == 'buttonMinus') {
+                            anchors[j].setAttribute('onclick',"UnCloneField('" + new_id + "')");
+                        }
+                    }
                 }
                 catch(e){
                     // do nothig CloneButtonPlus doesn't exist.
@@ -242,6 +270,7 @@ function CloneField(index) {
 
 function CloneSubfield(index){
     var original = document.getElementById(index); //original <div>
+    fields_in_use[index.substr(0, 12)]++;
     var clone = original.cloneNode(true);
     var new_key = CreateKey();
     var new_id  = original.getAttribute('id')+new_key;
@@ -282,16 +311,16 @@ function CloneSubfield(index){
     // setting a new if for the parent div
     clone.setAttribute('id',new_id);
     
-    var CloneButtonPlus;
     try {
+      var buttonUp = clone.getElementsByTagName('img')[0];
+      buttonUp.setAttribute('onclick',"upSubfield('" + new_id + "')");
       var spans = clone.getElementsByTagName('span');
       if(spans.length){
           for(var i = 0 ,lenspans = spans.length ; i < lenspans ; i++){
             if(spans[i].getAttribute('class') == 'buttonPlus'){
-                    CloneButtonPlus = spans[i];
-                    CloneButtonPlus.setAttribute('onclick',"CloneSubfield('" + new_id + "')");
-                    var buttonUp = clone.getElementsByTagName('img')[0];
-                    buttonUp.setAttribute('onclick',"upSubfield('" + new_id + "')");
+                    spans[i].setAttribute('onclick',"CloneSubfield('" + new_id + "')");
+                } else if (spans[i].getAttribute('class') == 'buttonMinus') {
+                    spans[i].setAttribute('onclick',"UnCloneField('" + new_id + "')");
                 }
             }
         }
@@ -303,6 +332,40 @@ function CloneSubfield(index){
     original.parentNode.insertBefore(clone,original.nextSibling);
 }
 
+ /**
+ * This function removes or clears unwanted subfields
+ */
+function UnCloneField(index) {
+    var original = document.getElementById(index);
+    var field_id;
+    if (index.match("tag")) {
+        field_id = index.substr(0, 7);
+    } else {
+        field_id = index.substr(0, 12);
+    }
+    if (1 == fields_in_use[field_id]) {
+        // clear inputs, but don't delete
+        $(":input.input_marceditor", original).each(function(){
+            // thanks to http://www.learningjquery.com/2007/08/clearing-form-data for
+            // hint about clearing selects correctly
+            var type = this.type;
+            var tag = this.tagName.toLowerCase();
+            if (type == 'text' || type == 'password' || tag == 'textarea') {
+                this.value = "";
+            } else if (type == 'checkbox' || type == 'radio') {
+                this.checked = false;
+            } else if (tag == 'select') {
+                this.selectedIndex = -1;
+            }
+        });
+        $(":input.indicator", original).val("");
+    } else {
+        original.parentNode.removeChild(original);
+        fields_in_use[field_id]--;
+    }
+}
+
+
 /**
  * This function create a random number
  */
@@ -360,17 +423,28 @@ function searchauthority() {
 }
 //]]>
 </script>
-<style type="text/css">
-       #authoritytabs {
-               margin-top : 1em;
-               margin-bottom : 1em;
-       }
-</style>
+<link type="text/css" rel="stylesheet" href="<!-- TMPL_VAR NAME="themelang" -->/css/addbiblio.css" />
 </head>
 <body>
+<div id="yui-cms-loading">
+      <div id="yui-cms-float">
+          Loading, please wait...
+      </div>
+  </div>
+<script type="text/javascript" src="<!-- TMPL_VAR name="themelang" -->/lib/yui/plugins/loading-min.js"></script>
+<script type="text/javascript">
+//<![CDATA[
+(function() {
+       // configuring the loading mask
+       YAHOO.widget.Loading.config({
+               opacity: 0.8
+       });
+})();
+//]]>
+</script>
 <!-- TMPL_INCLUDE NAME="header.inc" -->
 
-<div id="breadcrumbs"><a href="/cgi-bin/koha/mainpage.pl">Home</a> &rsaquo; <a href="/cgi-bin/koha/authorities/authorities-home.pl">Authorities</a> &rsaquo; <!-- TMPL_IF name="authid" -->Modify authority #<!-- TMPL_VAR NAME="authid" --> (<!-- TMPL_VAR name="authtypetext" -->)<!-- TMPL_ELSE -->Adding authority (<!-- TMPL_VAR name="authtypetext" -->)<!-- /TMPL_IF -->  </div>
+<div id="breadcrumbs"><a href="/cgi-bin/koha/mainpage.pl">Home</a> &rsaquo; <a href="/cgi-bin/koha/authorities/authorities-home.pl">Authorities</a> &rsaquo; <!-- TMPL_IF name="authid" -->Modify authority #<!-- TMPL_VAR NAME="authid" --> (<!-- TMPL_VAR name="authtypetext" -->)<!-- TMPL_ELSE -->Adding authority <!-- TMPL_VAR name="authtypetext" --><!-- /TMPL_IF -->  </div>
 
 <div id="doc" class="yui-t7">
 
@@ -379,9 +453,9 @@ function searchauthority() {
         <div class="yui-g">
 
 <!-- TMPL_IF name="authid" -->
-<h1>Modify authority #<!-- TMPL_VAR NAME="authid" --> (<!-- TMPL_VAR name="authtypetext" -->)</h1>
+<h1>Modify authority #<!-- TMPL_VAR NAME="authid" --> <!-- TMPL_VAR name="authtypetext" --></h1>
 <!-- TMPL_ELSE -->
-<h1>Adding authority (<!-- TMPL_VAR name="authtypetext" -->)</h1>
+<h1>Adding authority <!-- TMPL_VAR name="authtypetext" --></h1>
 <!-- /TMPL_IF -->  
 <form method="post" name="f" action="/cgi-bin/koha/authorities/authorities.pl">
     <input type="hidden" name="op" value="add" />
@@ -390,17 +464,37 @@ function searchauthority() {
     <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>
+       <div id="toolbar">
+       <script type="text/javascript">
+       //<![CDATA[
+       // prepare DOM for YUI Toolbar
+        $(document).ready(function() {
+           yuiToolbar();
+           $("#addauthc,#action").empty();
+        });
+       // YUI Toolbar Functions
+       function yuiToolbar() {
+       var addauthButton = new YAHOO.widget.Button({
+                                            id: "addauth", 
+                                            type: "button", 
+                                            label: "Save", 
+                                            container: "addauthc",
+                                                                                       onclick: {fn: Check }
+                                        });
+       var addauthButton2 = new YAHOO.widget.Button({
+                                            id: "addauth2", 
+                                            type: "button", 
+                                            label: "Save", 
+                                            container: "action",
+                                                                                       onclick: {fn: Check }
+                                        });
+       } //]]>
+       </script>
+       <ul class="toolbar"><li id="addauthc"><input id="addauth" type="submit" value="Save" accesskey="w" /></li></ul></div>
 
 <!-- TMPL_IF name="duplicateauthid" -->
         <div class="problem">
-                <p>Duplicate suspected with <a href="javascript:openWindow("detail.pl?authid=<!-- TMPL_VAR name="duplicateauthid" -->&amp;popup=1", "Duplicate Authority");" class="button"><!-- TMPL_VAR name="duplicateauthvalue" --></a></p>
+                <p>Duplicate suspected with <a href="javascript:openWindow('detail.pl?authid=<!-- TMPL_VAR name=duplicateauthid -->&amp;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>
@@ -410,7 +504,6 @@ function searchauthority() {
 <!-- /TMPL_IF -->
 
 <div id="authoritytabs" class="toptabs numbered">
-<!--TMPL_UNLESS Name="singletab"-->
        <ul> <!-- TMPL_LOOP name="BIG_LOOP" -->
             <li><!-- TMPL_IF name="number" -->
                 <a href="/cgi-bin/authorities/authorties.pl#tab<!-- TMPL_VAR name="number" -->XX"><!-- TMPL_VAR name="number"--></a>
@@ -418,114 +511,137 @@ function searchauthority() {
                 <a href="/cgi-bin/authorities/authorties.pl#tab<!-- TMPL_VAR name="number" -->XX"><!-- TMPL_VAR name="number"--></a>
             <!-- /TMPL_IF --></li>
         <!--  /TMPL_LOOP --></ul>
-<!--/TMPL_UNLESS-->
 
 <!-- TMPL_LOOP name="BIG_LOOP" -->
-<!-- hide every tab except the 1st -->
-<!--TMPL_UNLESS Name="singletab"-->
-    <!-- TMPL_IF name="number" -->
-        <div id="tab<!-- TMPL_VAR name="number" -->XX">
-    <!-- TMPL_ELSE -->
-        <div id="tab<!-- TMPL_VAR name="number" -->XX">
-    <!-- /TMPL_IF -->
-<!-- /TMPL_UNLESS -->
-    
-    <!-- TMPL_LOOP NAME="innerloop" -->
-        <!-- TMPL_IF NAME="tag" -->
-<div class="tag" id="tag_<!-- TMPL_VAR name="tag"-->_<!-- TMPL_VAR NAME='index'--><!-- TMPL_VAR name="random" -->">
-        <div class="tag_title" name="div_indicator">
-            <!-- TMPL_UNLESS name="hide_marc" -->
-                <span title="<!-- TMPL_VAR NAME="tag_lib" -->"><!-- TMPL_VAR NAME="tag" --></span>
-                <!-- TMPL_IF NAME="fixedfield" -->
-                <input tabindex="1"
-                            class="indicator flat"
-                            type="text"
-                            style="display:none;"
-                            name="tag_<!-- TMPL_VAR NAME="tag" -->_indicator_<!-- TMPL_VAR NAME='index'--><!-- TMPL_VAR name="random" -->"
-                            size="2"
-                            maxlength="2"
-                            value="<!-- TMPL_VAR NAME="indicator" -->" />
-                <!-- TMPL_ELSE -->
-                <input tabindex="1"
-                            class="indicator flat"
-                            type="text"
-                            name="tag_<!-- TMPL_VAR NAME="tag" -->_indicator_<!-- TMPL_VAR NAME='index'--><!-- TMPL_VAR name="random" -->"
-                            size="2"
-                            maxlength="2"
-                            value="<!-- TMPL_VAR NAME="indicator" -->" />
-                <!-- /TMPL_IF --> -
+    <!-- hide every tab except the 1st -->
+            <!-- TMPL_IF name="number" -->
+                <div id="tab<!-- TMPL_VAR name="number" -->XX">
             <!-- TMPL_ELSE -->
-                <!-- TMPL_IF NAME="fixedfield" -->
-                    <input tabindex="1"
-                        type="hidden"
-                        name="tag_<!-- TMPL_VAR NAME="tag" -->_indicator_<!-- TMPL_VAR NAME='index'-->"
-                        value="<!-- TMPL_VAR NAME="indicator" --><!-- TMPL_VAR name="random" -->" />
-                <!-- TMPL_ELSE -->
-                    <input tabindex="1"
-                        type="hidden"
-                        name="tag_<!-- TMPL_VAR NAME="tag" -->_indicator_<!-- TMPL_VAR NAME='index'-->"
-                        value="<!-- TMPL_VAR NAME="indicator" --><!-- TMPL_VAR name="random" -->" />
-                <!-- /TMPL_IF -->
-            <!-- /TMPL_UNLESS -->
-
-            <!-- TMPL_UNLESS NAME="advancedMARCEditor" -->
-            <a onclick="ExpandField('tag_<!-- TMPL_VAR name="tag"-->_<!-- TMPL_VAR NAME='index'--><!-- TMPL_VAR name="random" -->')"><!-- TMPL_VAR NAME="tag_lib" --></a>
-            <!-- /TMPL_UNLESS -->
-            <!-- TMPL_IF name="repeatable" -->
-                <span class="buttonPlus" onclick="CloneField('tag_<!-- TMPL_VAR name="tag"-->_<!-- TMPL_VAR NAME='index'--><!-- TMPL_VAR name="random" -->')">+</span>
+                <div id="tab<!-- TMPL_VAR name="number" -->XX">
             <!-- /TMPL_IF -->
-            
-        </div>
-
-        <!-- TMPL_LOOP NAME="subfield_loop" -->
-            <!--  One line on the marc editor -->
-            <div name="line" class="subfield_line" style="<!-- TMPL_VAR NAME='visibility' -->;" id="subfield<!-- TMPL_VAR NAME='tag' --><!-- TMPL_VAR NAME='subfield' -->">
-            
-                <!--TMPL_UNLESS NAME="advancedMARCEditor" -->
-                <label for="tag_<!-- TMPL_VAR NAME='tag'-->_subfield_<!--  TMPL_VAR NAME='subfield'-->_<!-- TMPL_VAR NAME='index'-->_<!-- TMPL_VAR NAME='index_subfield'-->"
-                        <!-- TMPL_IF NAME="fixedfield" --> style="display:none;" <!-- /TMPL_IF --> class="labelsubfield" >
-                <!-- /TMPL_UNLESS --> 
-                
+        
+        <!-- TMPL_LOOP NAME="innerloop" -->
+            <!-- TMPL_IF NAME="tag" -->
+                <div class="tag" id="tag_<!-- TMPL_VAR name="tag"-->_<!-- TMPL_VAR NAME='index'--><!-- TMPL_VAR name="random" -->">
+                <div class="tag_title" name="div_indicator">
                 <!-- TMPL_UNLESS name="hide_marc" -->
-                    <img class="buttonUp" <!-- TMPL_IF NAME="fixedfield" --> style="display:none;" <!-- /TMPL_IF --> src="<!-- TMPL_VAR NAME="themelang" -->/../img/up.png" onclick="upSubfield('subfield<!-- TMPL_VAR NAME='tag' --><!-- TMPL_VAR NAME='subfield' -->')" alt="Move Up" title="Move Up" />
-                        <input title="<!-- TMPL_VAR NAME='marc_lib_plain' -->"
-                            style=" <!-- TMPL_IF NAME="fixedfield" -->display:none; <!-- /TMPL_IF -->border:0;" type="text"
-                            name="tag_<!-- TMPL_VAR NAME='tag'-->_code_<!--  TMPL_VAR NAME='subfield'-->_<!-- TMPL_VAR NAME='index'-->_<!-- TMPL_VAR NAME='index_subfield'-->"
-                            value="<!-- TMPL_VAR NAME="subfield" -->"
-                            size="1"
-                            maxlength="1"
-                            class="flat"
-                            tabindex="-1" />
+                    <span title="<!-- TMPL_VAR NAME="tag_lib" -->"><!-- TMPL_VAR NAME="tag" --></span>
+                    <!-- TMPL_IF NAME="fixedfield" -->
+                    <input class="indicator flat"
+                                type="text"
+                                style="display:none;"
+                                name="tag_<!-- TMPL_VAR NAME="tag" -->_indicator1_<!-- TMPL_VAR NAME='index'--><!-- TMPL_VAR name="random" -->"
+                                size="1"
+                                maxlength="1"
+                                value="<!-- TMPL_VAR NAME="indicator1" -->" />
+                    <input class="indicator flat"
+                                type="text"
+                                style="display:none;"
+                                name="tag_<!-- TMPL_VAR NAME="tag" -->_indicator2_<!-- TMPL_VAR NAME='index'--><!-- TMPL_VAR name="random" -->"
+                                size="1"
+                                maxlength="1"
+                                value="<!-- TMPL_VAR NAME="indicator2" -->" />
+                    <!-- TMPL_ELSE -->
+                    <input class="indicator flat"
+                                type="text"
+                                name="tag_<!-- TMPL_VAR NAME="tag" -->_indicator1_<!-- TMPL_VAR NAME='index'--><!-- TMPL_VAR name="random" -->"
+                                size="1"
+                                maxlength="1"
+                                value="<!-- TMPL_VAR NAME="indicator1" -->" />
+                    <input class="indicator flat"
+                                type="text"
+                                name="tag_<!-- TMPL_VAR NAME="tag" -->_indicator2_<!-- TMPL_VAR NAME='index'--><!-- TMPL_VAR name="random" -->"
+                                size="1"
+                                maxlength="1"
+                                value="<!-- TMPL_VAR NAME="indicator2" -->" />
+                    <!-- /TMPL_IF --> -
                 <!-- TMPL_ELSE -->
-                    <input type="hidden"
-                        name="tag_<!-- TMPL_VAR NAME='tag'-->_code_<!--  TMPL_VAR NAME='subfield'-->_<!-- TMPL_VAR NAME='index'-->_<!-- TMPL_VAR NAME='index_subfield'-->"
-                        value="<!-- TMPL_VAR NAME="subfield" -->"/>
+                    <!-- TMPL_IF NAME="fixedfield" -->
+                        <input type="hidden"
+                            name="tag_<!-- TMPL_VAR NAME="tag" -->_indicator1_<!-- TMPL_VAR NAME='index'-->"
+                            value="<!-- TMPL_VAR NAME="indicator1" --><!-- TMPL_VAR name="random" -->" />
+                        <input type="hidden"
+                            name="tag_<!-- TMPL_VAR NAME="tag" -->_indicator2_<!-- TMPL_VAR NAME='index'-->"
+                            value="<!-- TMPL_VAR NAME="indicator2" --><!-- TMPL_VAR name="random" -->" />
+                    <!-- TMPL_ELSE -->
+                        <input type="hidden"
+                            name="tag_<!-- TMPL_VAR NAME="tag" -->_indicator1_<!-- TMPL_VAR NAME='index'-->"
+                            value="<!-- TMPL_VAR NAME="indicator1" --><!-- TMPL_VAR name="random" -->" />
+                        <input type="hidden"
+                            name="tag_<!-- TMPL_VAR NAME="tag" -->_indicator2_<!-- TMPL_VAR NAME='index'-->"
+                            value="<!-- TMPL_VAR NAME="indicator2" --><!-- TMPL_VAR name="random" -->" />
+                    <!-- /TMPL_IF -->
                 <!-- /TMPL_UNLESS -->
-            
+    
                 <!-- TMPL_UNLESS NAME="advancedMARCEditor" -->
-                    <!-- TMPL_IF name="mandatory" --><span class="subfield_mandatory"><!-- /TMPL_IF -->
-                        <!-- TMPL_VAR NAME="marc_lib" -->
-                    <!-- TMPL_IF name="mandatory" --></span><!-- /TMPL_IF -->
-                    </label>
+                    <a onclick="ExpandField('tag_<!-- TMPL_VAR name="tag"-->_<!-- TMPL_VAR NAME='index'--><!-- TMPL_VAR name="random" -->')"><!-- TMPL_VAR NAME="tag_lib" --></a>
+                <!-- /TMPL_UNLESS -->
+                <!-- TMPL_IF name="repeatable" -->
+                    <span class="buttonPlus" onclick="CloneField('tag_<!-- TMPL_VAR name="tag"-->_<!-- TMPL_VAR NAME='index'--><!-- TMPL_VAR name="random" -->')">+</span>
+                <!-- /TMPL_IF -->
+                <!-- TMPL_UNLESS NAME="mandatory" -->
+                    <span class="buttonMinus" onclick="UnCloneField('tag_<!-- TMPL_VAR name="tag"-->_<!-- TMPL_VAR NAME='index'--><!-- TMPL_VAR name="random" -->')">&#8722;</span>
                 <!-- /TMPL_UNLESS -->
                 
-                <!-- TMPL_VAR NAME="marc_value" -->
+            </div>
+    
+            <!-- TMPL_LOOP NAME="subfield_loop" -->
+                <!--  One line on the marc editor -->
+                <div name="line" class="subfield_line" style="<!-- TMPL_VAR NAME='visibility' -->;" id="subfield<!-- TMPL_VAR NAME='tag' --><!-- TMPL_VAR NAME='subfield' -->">
                 
-                <!-- TMPL_IF NAME="repeatable" -->
-                    <span class="buttonPlus" onclick="CloneSubfield('subfield<!-- TMPL_VAR NAME='tag' --><!-- TMPL_VAR NAME='subfield' -->')">+</span>
-                <!-- /TMPL_IF -->
+                    <!--TMPL_UNLESS NAME="advancedMARCEditor" -->
+                    <label for="tag_<!-- TMPL_VAR NAME='tag'-->_subfield_<!--  TMPL_VAR NAME='subfield'-->_<!-- TMPL_VAR NAME='index'-->_<!-- TMPL_VAR NAME='index_subfield'-->"
+                            <!-- TMPL_IF NAME="fixedfield" --> style="display:none;" <!-- /TMPL_IF --> class="labelsubfield" >
+                    <!-- /TMPL_UNLESS --> 
+                    
+                    <!-- TMPL_UNLESS name="hide_marc" -->
+                    <!-- TMPL_IF NAME="fixedfield" -->
+                        <img class="buttonUp" style="display:none;" src="<!-- TMPL_VAR NAME="themelang" -->/../img/up.png" onclick="upSubfield('subfield<!-- TMPL_VAR NAME='tag' --><!-- TMPL_VAR NAME='subfield' -->')" alt="Move Up" title="Move Up" />
+                    <!-- TMPL_ELSE -->
+                        <img class="buttonUp"  src="<!-- TMPL_VAR NAME="themelang" -->/../img/up.png" onclick="upSubfield('subfield<!-- TMPL_VAR NAME='tag' --><!-- TMPL_VAR NAME='subfield' -->')" alt="Move Up" title="Move Up" />
+                        <!-- /TMPL_IF -->
+                            <input title="<!-- TMPL_VAR NAME='marc_lib_plain' -->"
+                                style=" <!-- TMPL_IF NAME="fixedfield" -->display:none; <!-- /TMPL_IF -->border:0;" type="text"
+                                name="tag_<!-- TMPL_VAR NAME='tag'-->_code_<!--  TMPL_VAR NAME='subfield'-->_<!-- TMPL_VAR NAME='index'-->_<!-- TMPL_VAR NAME='index_subfield'-->"
+                                value="<!-- TMPL_VAR NAME="subfield" -->"
+                                size="1"
+                                maxlength="1"
+                                class="flat"
+                                tabindex="0" />
+                    <!-- TMPL_ELSE -->
+                        <input type="hidden"
+                            name="tag_<!-- TMPL_VAR NAME='tag'-->_code_<!--  TMPL_VAR NAME='subfield'-->_<!-- TMPL_VAR NAME='index'-->_<!-- TMPL_VAR NAME='index_subfield'-->"
+                            value="<!-- TMPL_VAR NAME="subfield" -->"/>
+                    <!-- /TMPL_UNLESS -->
+                
+                    <!-- TMPL_UNLESS NAME="advancedMARCEditor" -->
+                        <!-- TMPL_IF name="mandatory" --><span class="subfield_mandatory"><!-- /TMPL_IF -->
+                            <!-- TMPL_VAR NAME="marc_lib" -->
+                        <!-- TMPL_IF name="mandatory" --></span><!-- /TMPL_IF -->
+                        </label>
+                    <!-- /TMPL_UNLESS -->
+                    
+                    <!-- TMPL_VAR NAME="marc_value" -->
+                    
+                    <!-- TMPL_IF NAME="repeatable" -->
+                        <span class="buttonPlus" onclick="CloneSubfield('subfield<!-- TMPL_VAR NAME='tag' --><!-- TMPL_VAR NAME='subfield' -->')">+</span>
+                    <!-- /TMPL_IF -->
+                    <!-- TMPL_UNLESS NAME="mandatory" -->
+                        <span class="buttonMinus" onclick="UnCloneField('subfield<!-- TMPL_VAR NAME='tag' --><!-- TMPL_VAR NAME='subfield' --><!-- TMPL_VAR name="random" -->')">&#8722;</span>
+                    <!-- /TMPL_UNLESS -->
+                    
+                </div>
+                <!-- End of the line -->
                 
+            <!-- /TMPL_LOOP -->
             </div>
-            <!-- End of the line -->
-            
+            <!-- /TMPL_IF --><!-- tag -->
         <!-- /TMPL_LOOP -->
         </div>
-        <!-- /TMPL_IF --><!-- tag -->
-    <!-- /TMPL_LOOP -->
-    </div>
 <!-- /TMPL_LOOP -->
-<!--TMPL_UNLESS Name="singletab"-->
-</div> 
+
+<!-- TMPL_UNLESS Name="singletab" -->
+    </div>     
 <!--/TMPL_UNLESS-->
 </div>
 
@@ -549,15 +665,10 @@ function searchauthority() {
     <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 class="action">
+        <input type="button" id="addauth2" value="Save" onclick="Check(this.form)" accesskey="w" />
 </fieldset>
+</form>
 </div>
 </div>