Bugfixing interface issues. Also enabling contextual menu highlighting for catalogue...
[koha.git] / koha-tmpl / intranet-tmpl / prog / en / modules / cataloguing / addbiblio.tmpl
index ff3d767..f9dc4d7 100644 (file)
@@ -3,41 +3,19 @@
 <!-- TMPL_INCLUDE NAME="doc-head-close.inc" -->
 <script type="text/javascript">
 //<![CDATA[
-function _(s) { return s } // dummy function for gettext
+
+        $(document).ready(function() {
+               $('#addbibliotabs').tabs();
+               $("#loading,.loading").hide();
+        });
 
 function confirmnotdup(){
-       document.getElementById("confirm_not_duplicate").value = 1;
-       var checkform = document.getElementById("f");
+       $("#confirm_not_duplicate").attr("value","1");
+       // alert(_("Not a duplicate confirmed. Please click on Add biblio to save the record"));
+       var checkform = $("#f");
        Check(checkform);
 }
 
-function active(numlayer){
-    for (i=0; i <= 10 ; i++ ) {
-       var tab;
-       try{
-               tab = document.getElementById(i+'XX');
-               tab.getAttribute('id'); // do not remove this line. It throws an execption.
-       }
-       catch(e){
-               continue;
-       }
-        if (numlayer==i) {
-            tab.setAttribute("class","content_visible");
-            var tabactive=document.getElementById('link'+i);
-            tabactive.removeAttribute("class");
-            tabactive.setAttribute("class","tab_active");
-        } else {
-            tab.setAttribute("class","content_hidden");
-            try {
-                var tabactive=document.getElementById('link'+i);
-                tabactive.removeAttribute("class");
-                tabactive.setAttribute("class","tab_inactive");
-            }
-            catch(e){};
-        }
-    }
-}
-
 /**
  * 
  * 
@@ -45,7 +23,7 @@ function active(numlayer){
 function Check(){
     var StrAlert = AreMandatoriesNotOk();
     if( ! StrAlert ){
-        document.f.submit;
+        document.f.submit();
         return true;
     } else {
         alert(StrAlert);
@@ -64,7 +42,7 @@ function Dopop(link,i) {
 function PopupZ3950() {
     var strQuery = AreZ3950MandoriesOk();
     if(strQuery){
-        window.open("/cgi-bin/koha/cataloguing/z3950_search.pl?biblionumber=<!-- TMPL_VAR NAME="biblionumber" -->&frameworkcode=<!-- TMPL_VAR NAME="frameworkcode" -->"+strQuery,"z3950search",'width=640,height=400,location=yes,toolbar=no,scrollbars=yes');
+        window.open("/cgi-bin/koha/cataloguing/z3950_search.pl?biblionumber=<!-- TMPL_VAR NAME="biblionumber" -->&frameworkcode=<!-- TMPL_VAR NAME="frameworkcode" -->"+strQuery,"z3950search",'width=640,height=400,location=yes,toolbar=no,scrollbars=yes,resize=yes');
     } else {
         var strAlert = _("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");    
         alert(strAlert);
@@ -79,19 +57,37 @@ function AreMandatoriesNotOk(){
     var tab = new Array();
     var label = new Array();
     var flag=0;
+    var tabflag= new Array();  
     <!-- 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' -->");
                 <!-- /TMPL_IF --><!-- /TMPL_LOOP --><!-- /TMPL_LOOP --><!-- /TMPL_LOOP -->
     var StrAlert = _("Can't save this record because the following field aren't filled :\n\n");
     for(var i=0,len=mandatories.length; i<len ; i++){
+        var tag=mandatories[i].substr(4,3);
+        var subfield=mandatories[i].substr(17,1);
+        var tagnumber=mandatories[i].substr(19,mandatories[i].lastIndexOf("_")-19);
+        tabflag[tag+subfield+tagnumber]=new Array();
+        tabflag[tag+subfield+tagnumber][0]=0;
         if( ! document.getElementById(mandatories[i]).value){
-            flag = 1;
+            tabflag[tag+subfield+tagnumber][0] = 0 + tabflag[tag+subfield+tagnumber] ;
             document.getElementById(mandatories[i]).setAttribute('class','subfield_not_filled');
             document.getElementById(mandatories[i]).focus();
-            StrAlert += "\t* "+label[i]+_(" in tab ")+tab[i]+"\n";
-        }
+            tabflag[tag+subfield+tagnumber][1]=label[i];
+            tabflag[tag+subfield+tagnumber][2]=tab[i];
+        } else {
+            tabflag[tag+subfield+tagnumber][0] = 1;
+        }    
     }
+    for (var tagsubfieldid in tabflag){
+      if (tabflag[tagsubfieldid][0]==0){
+        var tag=tagsubfieldid.substr(0,3);
+        var subfield=tagsubfieldid.substr(3,1);    
+        StrAlert += "\t* "+_("tag ")+tag+_(" subfield ")+subfield+" "+tabflag[tagsubfieldid][1]+_(" in tab ")+tabflag[tagsubfieldid][2]+"\n";
+        //StrAlert += "\t* "+label[i]+_(" in tab ")+tab[i]+"\n"; 
+        flag=1;    
+      }   
+    }   
     if(flag){
            return StrAlert;
        } else {
@@ -233,7 +229,7 @@ function CloneField(index) {
             // button ...
             var spans=0;
             try {
-                spans = divs[i].getElementsByTagName('span');
+                spans = divs[i].getElementsByTagName('a');
             } catch(e) {
                 // no spans
             }
@@ -253,7 +249,6 @@ function CloneField(index) {
                                 }
                             } else {
                                 if(buttonDotOnClick.match('Dopop')) {  // -2- It's a auth value
-                                    
                                     var re1 = /&index=.*',/;
                                     var re2 = /,.*\)/;
 
@@ -422,13 +417,44 @@ function unHideSubfield(index,labelindex) { // FIXME :: is it used ?
 }
 //]]>
 </script>
+<link rel="stylesheet" href="<!-- TMPL_VAR NAME="themelang" -->/css/addbiblio.css" />
 </head>
 <body>
+<script type="text/javascript">
+//<![CDATA[
+          document.write("<div id=\"loading\"></div><div class=\"loading\">Loading...</div>");
+//]]>
+</script>
 
 <!-- TMPL_INCLUDE NAME="header.inc" -->
+<div id="breadcrumbs"><a href="/cgi-bin/koha/mainpage.pl">Home</a> &rsaquo; <a href="/cgi-bin/koha/cataloguing/addbooks.pl">Cataloguing</a>  &rsaquo; <!-- TMPL_IF NAME="biblionumtagfield" -->Edit MARC Record Number <!-- TMPL_VAR name="biblionumber" --><!-- TMPL_ELSE -->Add MARC Record<!-- /TMPL_IF --></div>
+
+<div id="doc" class="yui-t7">
+
+<div id="bd">
+        <div id="yui-main">
+        <div class="yui-g">
+
+
+
+<h1><!-- TMPL_IF NAME="biblionumtagfield" -->Edit MARC Record Number <!-- TMPL_VAR name="biblionumber" --><!-- TMPL_ELSE -->Add MARC Record<!-- /TMPL_IF --></h1>
 
-<div id="doc3">
-   <div id="bd">
+<!-- TMPL_UNLESS name="number" -->
+    <!-- show duplicate warning on tab 0 only -->
+        <!-- TMPL_IF name="duplicatebiblionumber" -->
+                    <div class="error">
+                        <h4>Duplicate Record?</h4>
+                        <p>Is this a duplicate of <a href="/cgi-bin/koha/catalogue/MARCdetail.pl?biblionumber=<!-- TMPL_VAR name="duplicatebiblionumber" -->" onclick="openWindow('../MARCdetail.pl?biblionumber=<!-- TMPL_VAR name="duplicatebiblionumber" -->&amp;popup=1', 'Duplicate biblio'; return false;)"><!-- TMPL_VAR name="duplicatetitle" --></a>?</p>
+                        <form action="/cgi-bin/koha/cataloguing/additem.pl" method="get">
+                            <input type="hidden" name="biblionumber" value="<!-- TMPL_VAR name="duplicatebiblionumber" -->" />
+                            <input type="submit" value="Yes: Edit existing items" />
+                        </form>
+                        <form action="/cgi-bin/koha/cataloguing/addbiblio.pl" method="get">
+                            <input type="submit" onclick="confirmnotdup(); return false;" value="No: Save as New Record" />
+                        </form>
+                    </div>
+        <!-- /TMPL_IF -->
+    <!-- /TMPL_UNLESS -->
 
 <!--TMPL_IF Name="done"-->
     <script type="text/javascript">
@@ -438,22 +464,43 @@ function unHideSubfield(index,labelindex) { // FIXME :: is it used ?
     </script>
 <!--TMPL_ELSE-->
     <form method="post" name="f" id="f" action="/cgi-bin/koha/cataloguing/addbiblio.pl" onsubmit="return Check();">
+       <input type="hidden" value="0" id="confirm_not_duplicate" name="confirm_not_duplicate" />
 <!-- /TMPL_IF -->
+       
+<div id="toolbar">
 
-<h1><!-- TMPL_IF NAME="biblionumtagfield" -->Edit MARC Record Number <!-- TMPL_VAR name="biblionumber" --><!-- TMPL_ELSE -->Add MARC Record<!-- /TMPL_IF --></h1>
+<script type="text/javascript">
+       //<![CDATA[
+
+       // prepare DOM for YUI Toolbar
+
+        $(document).ready(function() {
+               $("#z3950searchc").empty();
+           yuiToolbar();
+        });
+
+       // YUI Toolbar Functions
+
+       function yuiToolbar() {
+           new YAHOO.widget.Button("addbiblio");
+               new YAHOO.widget.Button({
+                                            id: "z3950search", 
+                                            type: "button", 
+                                            label: "z39.50 Search", 
+                                            container: "z3950searchc",
+                                                                                       onclick: {fn:function(){PopupZ3950()}}
+                                        });
+       }
 
-<div id="action">
-    <!-- TMPL_IF name="biblionumber" -->
-        <input type="submit" value="Save Bibliographic Record" />
-    <!-- TMPL_ELSE -->
-        <input type="submit" value="Add Bibliographic Record" />
-    <!-- /TMPL_IF -->
-    <input type="button" value="z39.50 Search" onclick="PopupZ3950(); return false;" />
-</div>
-<br />
- Change framework : <!--TMPL_VAR Name="framework" -->
+       //]]>
+       </script>
 
-        <input type="hidden" name="op" value="addbiblio" />
+               <ul class="toolbar">
+                       <li><input id="addbiblio" type="submit" value="Save" /></li>
+                       <li id="z3950searchc"><input type="button" id="z3950search" value="z39.50 Search" onclick="PopupZ3950(); return false;" /></li>
+                       <li id="changeframework"><label for="Frameworks">Change framework: </label><!--TMPL_VAR Name="framework" -->    <input type="hidden" name="op" value="addbiblio" /></li>
+               </ul>
+</div>
 
 <!--TMPL_IF Name="popup"-->
         <input type="hidden" name="mode" value="popup" />
@@ -462,36 +509,23 @@ function unHideSubfield(index,labelindex) { // FIXME :: is it used ?
         <input type="hidden" name="biblionumber" value="<!-- TMPL_VAR NAME="biblionumber" -->" />
         <input type="hidden" name="breedingid" value="<!-- TMPL_VAR NAME="breedingid" -->" />
 
-       <div id="tabs">
-        <!-- TMPL_LOOP name="BIG_LOOP" -->
-            <!-- TMPL_IF name="number" -->
-                <a href="javascript:active(<!-- TMPL_VAR name="number"-->)" class="tab_inactive" id="link<!-- TMPL_VAR name="number"-->"><!-- TMPL_VAR name="number"--></a>
+<div id="addbibliotabs" class="toptabs numbered">
+       <ul><!-- TMPL_LOOP name="BIG_LOOP" -->
+          <li>  <!-- TMPL_IF name="number" -->
+                <a href="/cgi-bin/koha/cataloguing/addbiblio.pl#tab<!-- TMPL_VAR name="number" -->XX"><!-- TMPL_VAR name="number"--></a>
             <!-- TMPL_ELSE -->
-                <a href="javascript:active(<!-- TMPL_VAR name="number"-->)" class="tab_active" id="link<!-- TMPL_VAR name="number"-->"><!-- TMPL_VAR name="number"--></a>
-            <!-- /TMPL_IF -->
-        <!--  /TMPL_LOOP -->
-       </div>
+                <a href="/cgi-bin/koha/cataloguing/addbiblio.pl#tab<!-- TMPL_VAR name="number" -->XX"><!-- TMPL_VAR name="number"--></a>
+            <!-- /TMPL_IF --></li>
+        <!--  /TMPL_LOOP --></ul>
 
 <!-- TMPL_LOOP name="BIG_LOOP" -->
 <!-- hide every tab except the 1st -->
 <!-- TMPL_IF name="number" -->
-    <div id="<!-- TMPL_VAR name="number" -->XX" class="content_hidden">
+    <div id="tab<!-- TMPL_VAR name="number" -->XX">
 <!-- TMPL_ELSE -->
-    <div id="0XX" class="content_visible">
+    <div id="tab<!-- TMPL_VAR name="number" -->XX">
 <!-- /TMPL_IF -->
-<!-- TMPL_UNLESS name="number" -->
-    <!-- show duplicate warning on tab 0 only -->
-        <!-- TMPL_IF name="duplicatebiblionumber" -->
-                    <div class="error">
-                        <p class="problem">Is this a duplicate of <a href="/cgi-bin/koha/catalogue/MARCdetail.pl?biblionumber=<!-- TMPL_VAR name="duplicatebiblionumber" -->" onclick="openWindow('../MARCdetail.pl?biblionumber=<!-- TMPL_VAR name="duplicatebiblionumber" -->&amp;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="/cgi-bin/koha/cataloguing/additem.pl?biblionumber=<!-- TMPL_VAR name="duplicatebiblionumber" -->">Edit Items</a> of the existing record.</li>
-                            <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" -->
         <!-- TMPL_IF NAME="tag" -->
@@ -513,10 +547,10 @@ function unHideSubfield(index,labelindex) { // FIXME :: is it used ?
             <!-- /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>
+                   <a href="#" class="expandfield" onclick="ExpandField('tag_<!-- TMPL_VAR name="tag"-->_<!-- TMPL_VAR NAME='index'--><!-- TMPL_VAR name="random" -->'); return false;" title="Click to Expand this Tag"><!-- 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>
+                <a href="#" class="buttonPlus" onclick="CloneField('tag_<!-- TMPL_VAR name="tag"-->_<!-- TMPL_VAR NAME='index'--><!-- TMPL_VAR name="random" -->'); return false;" title="Repeat this Tag">+</a>
             <!-- /TMPL_IF -->
             
         </div>
@@ -526,11 +560,15 @@ function unHideSubfield(index,labelindex) { // FIXME :: is it used ?
             <div name="line" class="subfield_line" style="<!-- TMPL_VAR NAME='visibility' -->;" id="subfield<!-- TMPL_VAR NAME='tag' --><!-- TMPL_VAR NAME='subfield' --><!-- TMPL_VAR name="random" -->">
             
                 <!--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" >
+                    <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" -->
-                    <img class="buttonUp" <!-- 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='subfield' --><!-- TMPL_VAR name="random" -->')" alt="" />
+                <!-- 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' --><!-- TMPL_VAR name="random" -->')" 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' --><!-- TMPL_VAR name="random" -->')" 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="-1" />
                 <!-- 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" -->" />
@@ -561,6 +599,7 @@ function unHideSubfield(index,labelindex) { // FIXME :: is it used ?
 
 </form>
 
+</div>
 </div>
 
 <!-- TMPL_INCLUDE NAME="intranet-bottom.inc" -->