Bug 11961 - Add a "Z39.50 search" button to the authority creation and modification...
[koha.git] / koha-tmpl / intranet-tmpl / prog / en / modules / authorities / authorities.tt
index dbbb785..693b61e 100644 (file)
@@ -1,7 +1,7 @@
 [% INCLUDE 'doc-head-open.inc' %]
 <title>Koha &rsaquo; Authorities &rsaquo; [% IF ( authid ) %]Modify authority #[% authid %] ([% authtypetext %])[% ELSE %]Adding authority ([% authtypetext %])[% END %]</title>
 [% INCLUDE 'doc-head-close.inc' %]
-<script type="text/javascript" src="[% themelang %]/lib/jquery/plugins/jquery.fixFloat.js"></script>
+<script type="text/javascript" src="[% interface %]/lib/jquery/plugins/jquery.fixFloat.js"></script>
 <script type="text/javascript" src="[% themelang %]/js/cataloging.js"></script>
 
 <script type="text/javascript">
                 $("#f").submit();
             }
                });
+        $("#z3950submit").click(function(){
+            if (confirm(_("Please note that this Z39.50 search could replace the current record."))){
+                var strQuery = GetZ3950Terms();
+                if(strQuery){
+                    window.open("/cgi-bin/koha/cataloguing/z3950_auth_search.pl?authid=[% authid %]"+strQuery,"z3950search",'width=740,height=450,location=yes,toolbar=no,scrollbars=yes,resize=yes');
+                }
+            }
+            return false;
+        });
         });
 
+/**
+ * check if z3950 mandatories are set or not
+ */
+function GetZ3950Terms(){
+ var strQuery="&authtypecode="+document.forms['f'].authtypecode.value;
+    var mandatories = new Array();
+    var mandatories_label = new Array();
+    [% FOREACH BIG_LOO IN BIG_LOOP %][% FOREACH innerloo IN BIG_LOO.innerloop %][% FOREACH subfield_loo IN innerloo.subfield_loop %][% IF ( subfield_loo.z3950_mandatory ) %]mandatories.push("[% subfield_loo.id %]");
+        mandatories_label.push("[% subfield_loo.z3950_mandatory %]");[% END %][% END %][% END %][% END %]
+
+    for(var i=0,len=mandatories.length; i<len ; i++){
+        var field_value = document.getElementById(mandatories[i]).value;
+        if( field_value ){
+            strQuery += "&"+mandatories_label[i]+"="+field_value;
+        }
+    }
+    return strQuery;
+}
+
 /**
  * check if mandatory subfields are written
  */
@@ -46,7 +74,7 @@ function AreMandatoriesNotOk(){
         // alert (id_string);
         if( ! $("#" + id_string).val() ){
             $("#" + id_string).attr('class','subfield_not_filled').focus();
-            StrAlert += "\t* "+label[i]+_(" in tab ")+tab[i]+"\n";
+            StrAlert += "\t* " + _("%s in tab %s").format(label[i], tab[i]) + "\n";
         }
     }
     
@@ -79,7 +107,7 @@ function AreMandatoriesNotOk(){
        
        if(isempty){
                flag = 1;
-                       StrAlert += "\t* Field " + arr[0] + _(" is mandatory, at least one of its subfields must be filled") + "\n";
+                StrAlert += "\t* " + _("Field %s is mandatory, at least one of its subfields must be filled.").format(arr[0]) + "\n";
        }
        
     }
@@ -154,11 +182,11 @@ function confirmnotdup(redirect){
 [% IF ( duplicateauthid ) %]
         <div class="dialog alert">
                 <h4>Duplicate record suspected</h4>
-                <p>Is this a duplicate of <a href="/cgi-bin/koha/authorities/detail.pl?authid=[% duplicateauthid %]" onclick="openWindow('/cgi-bin/koha/authorities/detail.pl?authid=[% duplicateauthid %]&amp;popup=1', 'Duplicate authority','800','600'); return false;" class="button">[% duplicateauthvalue %]</a>?</p>
+                <p>Is this a duplicate of <a href="/cgi-bin/koha/authorities/detail.pl?authid=[% duplicateauthid %]" onclick="openWindow('/cgi-bin/koha/authorities/detail.pl?authid=[% duplicateauthid %]&amp;popup=1', 'DuplicateAuthority','800','600'); return false;" class="button">[% duplicateauthvalue %]</a>?</p>
 
                 <form action="authorities.pl" method="get">
                     <input type="hidden" name="authid" value="[% duplicateauthid %]" />
-                    <input type="submit" class="edit" value="Yes: Edit exisiting authority" />
+                    <input type="submit" class="edit" value="Yes: Edit existing authority" />
                 </form>
                 <form action="authorities.pl" method="get">
                     <input type="button" value="No: Save as new authority" class="save" accesskey="w" onclick="confirmnotdup('items'); return false;" />
@@ -177,6 +205,9 @@ function confirmnotdup(redirect){
 
     <div id="toolbar" class="btn-toolbar">
         <div class="btn-group"><a href="#" id="addauth" class="btn btn-small" accesskey="w"><i class="icon-hdd"></i> Save</a></div>
+        <div class="btn-group">
+            <a class="btn btn-small" id="z3950submit" href="#"><i class="icon-search"></i> Z39.50 search</a>
+        </div>
     </div>
 
 <div id="authoritytabs" class="toptabs numbered">
@@ -260,11 +291,11 @@ function confirmnotdup(redirect){
                 <span class="field_controls">
                 [% IF ( innerloo.repeatable ) %]
                     <a href="#" tabindex="1" class="buttonPlus" onclick="CloneField('tag_[% innerloo.tag %]_[% innerloo.index %][% innerloo.random %]','[% hide_marc %]','[% advancedMARCEditor %]'); return false;" title="Repeat this Tag">
-                        <img src="/intranet-tmpl/prog/img/repeat-tag.png" alt="Repeat this Tag" />
+                        <img src="[% interface %]/[% theme %]/img/repeat-tag.png" alt="Repeat this Tag" />
                     </a>
                 [% END %]
                     <a href="#" tabindex="1" class="buttonMinus" onclick="UnCloneField('tag_[% innerloo.tag %]_[% innerloo.index %][% innerloo.random %]'); return false;" title="Delete this Tag">
-                        <img src="/intranet-tmpl/prog/img/delete-tag.png" alt="Delete this Tag" />
+                        <img src="[% interface %]/[% theme %]/img/delete-tag.png" alt="Delete this Tag" />
                     </a>
                 </span>
 
@@ -283,9 +314,9 @@ function confirmnotdup(redirect){
                 [% UNLESS hide_marc %]
                 <span class="subfieldcode">
                     [% IF ( subfield_loo.fixedfield ) %]
-                        <img class="buttonUp" style="display:none;" src="/intranet-tmpl/prog/img/up.png" onclick="upSubfield('subfield[% subfield_loo.tag %][% subfield_loo.subfield %][% subfield_loo.random %]')" alt="Move Up" title="Move Up" />
+                        <img class="buttonUp" style="display:none;" src="[% interface %]/[% theme %]/img/up.png" onclick="upSubfield('subfield[% subfield_loo.tag %][% subfield_loo.subfield %][% subfield_loo.random %]')" alt="Move Up" title="Move Up" />
                     [% ELSE %]
-                        <img class="buttonUp" src="/intranet-tmpl/prog/img/up.png" onclick="upSubfield('subfield[% subfield_loo.tag %][% subfield_loo.subfield %][% subfield_loo.random %]')" alt="Move Up" title="Move Up" />
+                        <img class="buttonUp" src="[% interface %]/[% theme %]/img/up.png" onclick="upSubfield('subfield[% subfield_loo.tag %][% subfield_loo.subfield %][% subfield_loo.random %]')" alt="Move Up" title="Move Up" />
                     [% END %]
                         <input type="text"
                             title="[% subfield_loo.marc_lib_plain %]"
@@ -311,15 +342,41 @@ function confirmnotdup(redirect){
                     </label>
                 [% END %]
                 
-                [% subfield_loo.marc_value %]
+                [% SET mv = subfield_loo.marc_value %]
+                [% IF ( mv.type == 'select' ) %]
+                     <select name="[%- mv.name -%]" tabindex="1" size="1" class="input_marceditor" id="[%- mv.id -%]">
+                     [% FOREACH aval IN mv.values %]
+                         [% IF aval == mv.default %]
+                         <option value="[%- aval -%]" selected="selected">[%- mv.labels.$aval -%]</option>
+                         [% ELSE %]
+                         <option value="[%- aval -%]">[%- mv.labels.$aval -%]</option>
+                         [% END %]
+                     [% END %]
+                     </select>
+                [% ELSIF ( mv.type == 'text1' ) %]
+                    <input type="text" id="[%- mv.id -%]" name="[%- mv.id -%]" value="[%- mv.value -%]" class="input_marceditor" tabindex="1" />
+                    <a href="#" class="buttonDot" onclick="openAuth(this.parentNode.getElementsByTagName('input')[1].id,'[%- mv.authtypecode -%]','auth'); return false;" tabindex="1" title="Tag editor">...</a>
+                [% ELSIF ( mv.type == 'text2' ) %]
+                    <input tabindex="1" type="text" id="[%- mv.id -%]" size="67" maxlength="[%- mv.maxlength -%]" name="[%- mv.id -%]" value="[%- mv.value -%]" class="input_marceditor" onfocus="Focus[%- mv.function -%]([%- mv.index_tag -%])" onblur="Blur[%- mv.function -%]([%- mv.index_tag -%]);" />
+                    <a href="#" class="buttonDot" onclick="Clic[%- mv.function -%]('[%- mv.id -%]'); return false;" title="Tag editor">...</a>
+                    [% mv.javascript %]
+                [% ELSIF ( mv.type == 'text' ) %]
+                    <input type="text" id="[%- mv.id -%]" name="[%- mv.name -%]" value="[%- mv.value -%]" class="input_marceditor" tabindex="1" size="67" maxlength="[%- mv.maxlength -%]" />
+                [% ELSIF ( mv.type == 'textarea' ) %]
+                    <textarea cols="70" rows="4" id="[%- mv.id -%]" name="[%- mv.name -%]" class="input_marceditor" tabindex="1" size="67" maxlength="[%- mv.maxlength -%]">[%- mv.value -%]</textarea>
+                [% ELSIF ( mv.type == 'hidden' ) %]
+                    <input tabindex="1" type="hidden" id="[%- mv.id -%]" name="[%- mv.name -%]" size="67" maxlength="[%- mv.maxlength -%]" value="[%- mv.value -%]" />
+                [% ELSIF ( mv.type == 'hidden_simple' ) %]
+                    <input type="hidden" name="[%- mv.name -%]" />
+                [% END %]
 
                 <span class="subfield_controls">
                 [% IF ( subfield_loo.repeatable ) %]
                     <a href="#" class="buttonPlus" tabindex="1" onclick="CloneSubfield('subfield[% subfield_loo.tag %][% subfield_loo.subfield %][% subfield_loo.random %]','[% advancedMARCEditor %]'); return false;">
-                        <img src="/intranet-tmpl/prog/img/clone-subfield.png" alt="Clone" title="Clone this subfield" />
+                        <img src="[% interface %]/[% theme %]/img/clone-subfield.png" alt="Clone" title="Clone this subfield" />
                     </a>
                     <a href="#" class="buttonMinus" tabindex="1" onclick="UnCloneField('subfield[% subfield_loo.tag %][% subfield_loo.subfield %][% subfield_loo.random %]'); return false;">
-                        <img src="/intranet-tmpl/prog/img/delete-subfield.png" alt="Delete" title="Delete this subfield" />
+                        <img src="[% interface %]/[% theme %]/img/delete-subfield.png" alt="Delete" title="Delete this subfield" />
                     </a>
                 [% END %]
                 </span>