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