Bug 21751: Replace fixFloat with HC-sticky to fix Chrome display
[koha.git] / koha-tmpl / intranet-tmpl / prog / en / modules / authorities / authorities.tt
1 [% USE raw %]
2 [% USE Asset %]
3 [% INCLUDE 'doc-head-open.inc' %]
4 <title>Koha &rsaquo; Authorities &rsaquo; [% IF ( authid ) %]Modify authority #[% authid | html %] ([% authtypetext | html %])[% ELSE %]Adding authority ([% authtypetext | html %])[% END %]</title>
5 [% INCLUDE 'doc-head-close.inc' %]
6 [% Asset.js("lib/hc-sticky.js") | $raw %]
7 [% Asset.js("js/cataloging.js") | $raw %]
8
9 <script type="text/javascript">
10 //<![CDATA[
11     $(window).load(function(){
12         $("#loading").hide();
13     });
14     var Sticky;
15          $(document).ready(function() {
16         $('#authoritytabs').tabs();
17         Sticky = $("#toolbar");
18         Sticky.hcSticky({
19             stickTo: ".main",
20             stickyClass: "floating"
21         });
22         $("#addauth").click(function(){
23             if(Check()){
24                 $("#f").submit();
25             }
26                 });
27         $("#z3950submit").click(function(){
28             if (confirm(_("Please note that this Z39.50 search could replace the current record."))){
29                 var strQuery = GetZ3950Terms();
30                 if(strQuery){
31                     window.open("/cgi-bin/koha/cataloguing/z3950_auth_search.pl?authid=[% authid | html %]"+strQuery,"z3950search",'width=740,height=450,location=yes,toolbar=no,scrollbars=yes,resize=yes');
32                 }
33             }
34             return false;
35         });
36          });
37
38 /**
39  * check if z3950 mandatories are set or not
40  */
41 function GetZ3950Terms(){
42  var strQuery="&authtypecode="+document.forms['f'].authtypecode.value;
43     var mandatories = new Array();
44     var mandatories_label = new Array();
45     [% 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 | html %]");
46         mandatories_label.push("[% subfield_loo.z3950_mandatory | html %]");[% END %][% END %][% END %][% END %]
47
48     for(var i=0,len=mandatories.length; i<len ; i++){
49         var field_value = document.getElementById(mandatories[i]).value;
50         if( field_value ){
51             strQuery += "&"+mandatories_label[i]+"="+field_value;
52         }
53     }
54     return strQuery;
55 }
56
57 /**
58  * check if mandatory subfields are written
59  */
60 function AreMandatoriesNotOk(){
61     var mandatories = new Array();
62     var mandatoriesfields = new Array();
63     var   tab = new Array();
64     var label = new Array();
65     [% FOREACH BIG_LOO IN BIG_LOOP %]
66         [% FOREACH innerloo IN BIG_LOO.innerloop %]
67                         [% IF ( innerloo.mandatory ) %]
68                         mandatoriesfields.push(new Array("[% innerloo.tag | html %]","[% innerloo.index | html %][% innerloo.random | html %]","[% innerloo.index | html %]"));
69             [% END %]
70                 [% FOREACH subfield_loo IN innerloo.subfield_loop %]
71                         [% IF ( subfield_loo.mandatory ) %]mandatories.push("[% subfield_loo.id | html %]");
72                     tab.push("[% BIG_LOO.number | html %]");
73                     label.push("[% subfield_loo.marc_lib | $raw |replace("'", "\'") |replace('"', '\"') |replace('\n', '\\n') |replace('\r', '\\r') %]");
74                         [% END %]
75                         [% END %]
76                 [% END %]
77         [% END %]
78     var StrAlert = "";
79     for(var i=0,len=mandatories.length; i<len ; i++){
80         var id_string = mandatories[i];
81         // alert (id_string);
82         if( ! $("#" + id_string).val() ){
83             $("#" + id_string).attr('class','subfield_not_filled').focus();
84             StrAlert += "\t* " + _("%s in tab %s").format(label[i], tab[i]) + "\n";
85         }
86     }
87     
88     /* Check for mandatories field(not subfields) */
89     for(var i=0,len=mandatoriesfields.length; i<len; i++){
90         isempty  = true;
91         arr      = mandatoriesfields[i];
92         divid    = "tag_" + arr[0] + "_" + arr[1];
93         varegexp = new RegExp("^tag_" + arr[0] + "_code_");
94
95                 if(parseInt(arr[0]) >= 10){
96                 elem = document.getElementById(divid);
97                 eleminputs = elem.getElementsByTagName('input');
98                 
99                 for(var j=0,len2=eleminputs.length; j<len2; j++){
100         
101                         if(eleminputs[j].name.match(varegexp) && eleminputs[j].value){
102                                         inputregexp = new RegExp("^tag_" + arr[0] + "_subfield_" + eleminputs[j].value + "_" + arr[2]);
103                                         
104                                         for( var k=0; k<len2; k++){
105                                                 if(eleminputs[k].id.match(inputregexp) && eleminputs[k].value){
106                                                         isempty = false
107                                                 }
108                                         }
109                         }
110                 }
111         }else{
112                 isempty = false;
113         }
114         
115         if(isempty){
116                 flag = 1;
117                 StrAlert += "\t* " + _("Field %s is mandatory, at least one of its subfields must be filled.").format(arr[0]) + "\n";
118         }
119         
120     }
121     
122     
123     if(StrAlert){
124         return _("Can't save this record because the following field aren't filled :") + "\n\n" + StrAlert;
125     }
126     return false;
127 }
128
129 function Check(){
130     var StrAlert = AreMandatoriesNotOk();
131     if( ! StrAlert ){
132         document.f.submit();
133         return true;
134     } else {
135         alert(StrAlert);
136         return false;
137     }
138 }
139
140 function AddField(field,cntrepeatfield) {
141     document.forms['f'].op.value = "addfield";
142     document.forms['f'].addfield_field.value=field;
143     document.forms['f'].repeat_field.value=cntrepeatfield;
144     document.f.submit();
145 }
146
147 function addauthority() {
148     X = document.forms[0].authtype.value;
149     window.location="/cgi-bin/koha/authorities/authorities.pl?authtypecode="+X;
150 }
151 function searchauthority() {
152     X = document.forms[0].authtype2.value;
153     Y = document.forms[0].value.value;
154     window.location="/cgi-bin/koha/authorities/authorities-home.pl?op=do_search&type=intranet&authtypecode="+X+"&value="+Y+"&marclist=&and_or=and&excluding=&operator=contains";
155 }
156 function confirmnotdup(redirect){
157     $("#confirm_not_duplicate").attr("value","1");
158     Check();
159 }
160 //]]>
161 </script>
162 [% Asset.css("css/addbiblio.css") | $raw %]
163
164 [% INCLUDE 'select2.inc' %]
165 <script>
166   $(document).ready(function() {
167     $('.subfield_line select').select2();
168   });
169 </script>
170
171 [% IF ( bidi ) %]
172    [% Asset.css("css/right-to-left.css") | $raw %]
173 [% END %]
174 </head>
175 <body id="auth_authorities" class="auth">
176
177 <div id="loading">
178    <div>Loading, please wait...</div>
179 </div>
180
181 [% INCLUDE 'header.inc' %]
182
183 <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; [% IF ( authid ) %]Modify authority #[% authid | html %] ([% authtypetext | html %])[% ELSE %]Adding authority [% authtypetext | html %][% END %]  </div>
184
185 <div class="main container-fluid">
186     <div class="row">
187         <div class="col-md-8 col-md-offset-2">
188
189 [% IF ( authid ) %]
190 <h1>Modify authority #[% authid | html %] [% authtypetext | html %]</h1>
191 [% ELSE %]
192 <h1>Adding authority [% authtypetext | html %]</h1>
193 [% END %]
194
195 [% IF ( duplicateauthid ) %]
196         <div class="dialog alert">
197                 <h3>Duplicate record suspected</h3>
198                 <p>Is this a duplicate of <a href="/cgi-bin/koha/authorities/detail.pl?authid=[% duplicateauthid | uri %]" class="popup" onclick="openWindow('/cgi-bin/koha/authorities/detail.pl?authid=[% duplicateauthid | html %]&amp;popup=1', 'DuplicateAuthority','800','600'); return false;" class="button">[% duplicateauthvalue | html %]</a> ?</p>
199
200                 <form action="authorities.pl" method="get">
201                     <input type="hidden" name="authid" value="[% duplicateauthid | html %]" />
202                     <button type="submit" class="new"><i class="fa fa-pencil"></i> Yes: Edit existing authority</button>
203                 </form>
204                 <form action="authorities.pl" method="get">
205                     <button class="new" onclick="confirmnotdup('items'); return false;"><i class="fa fa-save"></i> No: Save as new authority</button>
206                 </form>
207         </div>
208 [% END %]
209
210 <form method="post" name="f" action="/cgi-bin/koha/authorities/authorities.pl">
211     <input type="hidden" name="op" value="add" />
212     <input type="hidden" name="addfield_field" value="" />
213     <input type="hidden" name="repeat_field" value="" />
214     <input type="hidden" name="authtypecode" value="[% authtypecode | html %]" />
215     <input type="hidden" name="authid" value="[% authid | html %]" />
216     <input type="hidden" name="index" value="[% index | html %]" />
217     <input type="hidden" value="0" id="confirm_not_duplicate" name="confirm_not_duplicate" />
218
219     <div id="toolbar" class="btn-toolbar">
220         <div class="btn-group"><a href="#" id="addauth" class="btn btn-default btn-sm" accesskey="w"><i class="fa fa-save"></i> Save</a></div>
221         <div class="btn-group">
222             <a class="btn btn-default btn-sm" id="z3950submit" href="#"><i class="fa fa-search"></i> Z39.50 search</a>
223         </div>
224         <div class="btn-group">
225             [% IF ( authid ) %]
226                 <a class="btn btn-default btn-sm" id="cancel" href="/cgi-bin/koha/authorities/detail.pl?authid=[% authid | url %]">Cancel</a>
227             [% ELSE %]
228                 <a class="btn btn-default btn-sm" id="cancel" href="/cgi-bin/koha/authorities/authorities-home.pl">Cancel</a>
229             [% END %]
230         </div>
231     </div>
232
233 <div id="authoritytabs" class="toptabs numbered">
234     <ul>
235         [% FOREACH BIG_LOO IN BIG_LOOP %]
236         <li><a href="#tab[% BIG_LOO.number | uri %]XX">[% BIG_LOO.number | html %]</a></li>
237         [% END %]
238     </ul>
239
240 [% FOREACH BIG_LOO IN BIG_LOOP %]
241     <div id="tab[% BIG_LOO.number | html %]XX">
242
243     [% FOREACH innerloo IN BIG_LOO.innerloop %]
244     [% IF ( innerloo.tag ) %]
245     <div class="tag clearfix" id="tag_[% innerloo.tag | html %]_[% innerloo.index | html %][% innerloo.random | html %]">
246         <div class="tag_title" id="div_indicator_tag_[% innerloo.tag | html %]_[% innerloo.index | html %][% innerloo.random | html %]">
247         [% UNLESS hide_marc %]
248             [% IF advancedMARCEditor %]
249                 <a href="#" tabindex="1" class="tagnum" title="[% innerloo.tag_lib | html %] - Click to Expand this Tag" onclick="ExpandField('tag_[% innerloo.tag | html %]_[% innerloo.index | html %][% innerloo.random | html %]'); return false;">[% innerloo.tag | html %]</a>
250             [% ELSE %]
251                 <span title="[% innerloo.tag_lib | html %]">[% innerloo.tag | html %]</span>
252             [% END %]
253                 [% IF ( innerloo.fixedfield ) %]
254                     <input type="text"
255                         tabindex="1"
256                         class="indicator flat"
257                         style="display:none;"
258                         name="tag_[% innerloo.tag | html %]_indicator1_[% innerloo.index | html %][% innerloo.random | html %]"
259                         size="1"
260                         maxlength="1"
261                         value="[% innerloo.indicator1 | html %]" />
262                     <input type="text"
263                         tabindex="1"
264                         class="indicator flat"
265                         style="display:none;"
266                         name="tag_[% innerloo.tag | html %]_indicator2_[% innerloo.index | html %][% innerloo.random | html %]"
267                         size="1"
268                         maxlength="1"
269                         value="[% innerloo.indicator2 | html %]" />
270                 [% ELSE %]
271                     <input type="text"
272                         tabindex="1"
273                         class="indicator flat"
274                         name="tag_[% innerloo.tag | html %]_indicator1_[% innerloo.index | html %][% innerloo.random | html %]"
275                         size="1"
276                         maxlength="1"
277                         value="[% innerloo.indicator1 | html %]" />
278                     <input type="text"
279                         tabindex="1"
280                         class="indicator flat"
281                         name="tag_[% innerloo.tag | html %]_indicator2_[% innerloo.index | html %][% innerloo.random | html %]"
282                         size="1"
283                         maxlength="1"
284                         value="[% innerloo.indicator2 | html %]" />
285                 [% END %] -
286         [% ELSE %]
287                 [% IF ( innerloo.fixedfield ) %]
288                     <input type="hidden"
289                         tabindex="1"
290                         name="tag_[% innerloo.tag | html %]_indicator1_[% innerloo.index | html %][% innerloo.random | html %]"
291                         value="[% innerloo.indicator1 | html %]" />
292                     <input type="hidden"
293                         tabindex="1"
294                         name="tag_[% innerloo.tag | html %]_indicator2_[% innerloo.index | html %][% innerloo.random | html %]"
295                         value="[% innerloo.indicator2 | html %]" />
296                 [% ELSE %]
297                     <input type="hidden"
298                         tabindex="1"
299                         name="tag_[% innerloo.tag | html %]_indicator1_[% innerloo.index | html %][% innerloo.random | html %]"
300                         value="[% innerloo.indicator1 | html %]" />
301                     <input type="hidden"
302                         tabindex="1"
303                         name="tag_[% innerloo.tag | html %]_indicator2_[% innerloo.index | html %][% innerloo.random | html %]"
304                         value="[% innerloo.indicator2 | html %]" />
305                 [% END %]
306         [% END %]
307
308             [% UNLESS advancedMARCEditor %]
309                 <a href="#" tabindex="1" class="expandfield" onclick="ExpandField('tag_[% innerloo.tag | html %]_[% innerloo.index | html %][% innerloo.random | html %]'); return false;" title="Click to Expand this Tag">[% innerloo.tag_lib | html %]</a>
310             [% END %]
311                 <span class="field_controls">
312                 [% IF ( innerloo.repeatable ) %]
313                     <a href="#" tabindex="1" class="buttonPlus" onclick="CloneField('tag_[% innerloo.tag | html %]_[% innerloo.index | html %][% innerloo.random | html %]','[% hide_marc | html %]','[% advancedMARCEditor | html %]'); return false;" title="Repeat this Tag">
314                         <img src="[% interface | html %]/[% theme | html %]/img/repeat-tag.png" alt="Repeat this Tag" />
315                     </a>
316                 [% END %]
317                     <a href="#" tabindex="1" class="buttonMinus" onclick="UnCloneField('tag_[% innerloo.tag | html %]_[% innerloo.index | html %][% innerloo.random | html %]'); return false;" title="Delete this Tag">
318                         <img src="[% interface | html %]/[% theme | html %]/img/delete-tag.png" alt="Delete this Tag" />
319                     </a>
320                 </span>
321
322         </div>
323
324         [% FOREACH subfield_loo IN innerloo.subfield_loop %]
325             <!--  One line on the marc editor -->
326             <div class="subfield_line" style="[% subfield_loo.visibility | html %]" id="subfield[% subfield_loo.tag | html %][% subfield_loo.subfield | html %][% subfield_loo.random | html %]">
327
328                 [% UNLESS advancedMARCEditor %]
329                     [% IF ( subfield_loo.fixedfield ) %]<label for="tag_[% subfield_loo.tag | html %]_subfield_[% subfield_loo.subfield | html %]_[% subfield_loo.index | html %]_[% subfield_loo.index_subfield | html %]" style="display:none;" class="labelsubfield">
330                     [% ELSE %]<label for="tag_[% subfield_loo.tag | html %]_subfield_[% subfield_loo.subfield | html %]_[% subfield_loo.index | html %]_[% subfield_loo.index_subfield | html %]" class="labelsubfield">
331                     [% END %]
332                 [% END %]
333                 
334                 [% UNLESS hide_marc %]
335                 <span class="subfieldcode">
336                     [% IF ( subfield_loo.fixedfield ) %]
337                         <img class="buttonUp" style="display:none;" src="[% interface | html %]/[% theme | html %]/img/up.png" onclick="upSubfield('subfield[% subfield_loo.tag | html %][% subfield_loo.subfield | html %][% subfield_loo.random | html %]')" alt="Move Up" title="Move Up" />
338                     [% ELSE %]
339                         <img class="buttonUp" src="[% interface | html %]/[% theme | html %]/img/up.png" onclick="upSubfield('subfield[% subfield_loo.tag | html %][% subfield_loo.subfield | html %][% subfield_loo.random | html %]')" alt="Move Up" title="Move Up" />
340                     [% END %]
341                         <input type="text"
342                             title="[% subfield_loo.marc_lib | $raw %]"
343                             style=" [% IF ( subfield_loo.fixedfield ) %]display:none; [% END %]border:0;"
344                             name="tag_[% subfield_loo.tag | html %]_code_[% subfield_loo.subfield | html %]_[% subfield_loo.index | html %]_[% subfield_loo.index_subfield | html %]"
345                             value="[% subfield_loo.subfield | html %]"
346                             size="1"
347                             maxlength="1"
348                             class="flat"
349                             tabindex="0" />
350                 </span>
351                 [% ELSE %]
352                     <input type="hidden"
353                         name="tag_[% subfield_loo.tag | html %]_code_[% subfield_loo.subfield | html %]_[% subfield_loo.index | html %]_[% subfield_loo.index_subfield | html %]"
354                         value="[% subfield_loo.subfield | html %]" />
355                 [% END %]
356
357                 [% UNLESS advancedMARCEditor %]
358                     [% IF ( subfield_loo.mandatory ) %]<span class="subfield subfield_mandatory">[% ELSE %]<span class="subfield">[% END %]
359                         [% subfield_loo.marc_lib | $raw %]
360                         [% IF ( subfield_loo.mandatory ) %]<span class="mandatory_marker" title="This field is mandatory">*</span>[% END %]
361                     </span>
362                     </label>
363                 [% END %]
364                 
365                 [% SET mv = subfield_loo.marc_value %]
366                 [% IF ( mv.type == 'select' ) %]
367                      <select name="[%- mv.name | html -%]" tabindex="1" size="1" class="input_marceditor" id="[%- mv.id | html -%]">
368                      [% FOREACH aval IN mv.values %]
369                          [% IF aval == mv.default %]
370                          <option value="[%- aval | html -%]" selected="selected">[%- mv.labels.$aval | html -%]</option>
371                          [% ELSE %]
372                          <option value="[%- aval | html -%]">[%- mv.labels.$aval | html -%]</option>
373                          [% END %]
374                      [% END %]
375                      </select>
376                 [% ELSIF ( mv.type == 'text1' ) %]
377                     <input type="text" id="[%- mv.id | html -%]" name="[%- mv.id | html -%]" value="[%- mv.value | html -%]" class="input_marceditor" tabindex="1" />
378                     <a href="#" class="buttonDot" onclick="openAuth(this.parentNode.getElementsByTagName('input')[1].id,'[%- mv.authtypecode | html -%]','auth'); return false;" tabindex="1" title="Tag editor">...</a>
379                 [% ELSIF ( mv.type == 'text2' ) %]
380                     <input type="text" id="[%- mv.id | html -%]" size="67" maxlength="[%- mv.maxlength | html -%]" name="[%- mv.name | html -%]" value="[%- mv.value | html -%]" class="input_marceditor" />
381                     [% IF mv.noclick %]
382                         <a href="#" class="buttonDot tag_editor disabled" tabindex="-1" title="No popup">...</a>
383                     [% ELSE %]
384                         <a href="#" id="buttonDot_[% mv.id | html %]" class="buttonDot tag_editor" title="Tag editor">...</a>
385                     [% END %]
386                     [% mv.javascript | $raw %]
387                 [% ELSIF ( mv.type == 'text' ) %]
388                     <input type="text" id="[%- mv.id | html -%]" name="[%- mv.name | html -%]" value="[%- mv.value | html -%]" class="input_marceditor" tabindex="1" size="67" maxlength="[%- mv.maxlength | html -%]" />
389                 [% ELSIF ( mv.type == 'textarea' ) %]
390                     <textarea cols="70" rows="4" id="[%- mv.id | html -%]" name="[%- mv.name | html -%]" class="input_marceditor" tabindex="1" size="67" maxlength="[%- mv.maxlength | html -%]">[%- mv.value | html -%]</textarea>
391                 [% ELSIF ( mv.type == 'hidden' ) %]
392                     <input tabindex="1" type="hidden" id="[%- mv.id | html -%]" name="[%- mv.name | html -%]" size="67" maxlength="[%- mv.maxlength | html -%]" value="[%- mv.value | html -%]" />
393                 [% ELSIF ( mv.type == 'hidden_simple' ) %]
394                     <input type="hidden" name="[%- mv.name | html -%]" />
395                 [% END %]
396
397                 <span class="subfield_controls">
398                 [% IF ( subfield_loo.repeatable ) %]
399                     <a href="#" class="buttonPlus" tabindex="1" onclick="CloneSubfield('subfield[% subfield_loo.tag | html %][% subfield_loo.subfield | html %][% subfield_loo.random | html %]','[% advancedMARCEditor | html %]'); return false;">
400                         <img src="[% interface | html %]/[% theme | html %]/img/clone-subfield.png" alt="Clone" title="Clone this subfield" />
401                     </a>
402                     <a href="#" class="buttonMinus" tabindex="1" onclick="UnCloneField('subfield[% subfield_loo.tag | html %][% subfield_loo.subfield | html %][% subfield_loo.random | html %]'); return false;">
403                         <img src="[% interface | html %]/[% theme | html %]/img/delete-subfield.png" alt="Delete" title="Delete this subfield" />
404                     </a>
405                 [% END %]
406                 </span>
407                 
408             </div>
409             <!-- End of the line -->
410         [% END %]
411
412     </div>
413     [% END %]<!-- if innerloo.tag -->
414     [% END %]<!-- BIG_LOO.innerloop -->
415     </div>
416 [% END %]<!-- BIG_LOOP -->
417
418 </div><!-- tabs -->
419
420 <div name="hidden" id="hidden" class="tab">
421 [% FOREACH hidden_loo IN hidden_loop %]
422     <input type="hidden" name="tag" value="[% hidden_loo.tag | html %]" />
423     <input type="hidden" name="subfield" value="[% hidden_loo.subfield | html %]" />
424     <input type="hidden" name="mandatory" value="[% hidden_loo.mandatory | html %]" />
425     <input type="hidden" name="kohafield" value="[% hidden_loo.kohafield | html %]" />
426     <input type="hidden" name="tag_mandatory" value="[% hidden_loo.tag_mandatory | html %]" />
427 [% END %]
428 </div>
429 [% IF ( oldauthnumtagfield ) %]
430     <input type="hidden" name="tag" value="[% oldauthnumtagfield | html %]" />
431     <input type="hidden" name="subfield" value="[% oldauthnumtagsubfield | html %]" />
432     <input type="hidden" name="field_value" value="[% authid | html %]" />
433     <input type="hidden" name="mandatory" value="0" />
434     <input type="hidden" name="kohafield" value="[% kohafield | html %]" />
435     <input type="hidden" name="tag_mandatory" value="[% tag_mandatory | html %]" />
436     <input type="hidden" name="tag" value="[% oldauthtypetagfield | html %]" />
437     <input type="hidden" name="subfield" value="[% oldauthtypetagsubfield | html %]" />
438     <input type="hidden" name="field_value" value="[% authtypecode | html %]" />
439 [% END %]
440
441 </form>
442
443 </div>
444 </div>
445 </div>
446
447 [% INCLUDE 'intranet-bottom.inc' %]