Bug 34571: Remove use of "onclick" for ExpandField in cataloguing editors
[koha.git] / koha-tmpl / intranet-tmpl / prog / en / modules / authorities / authorities.tt
1 [% USE raw %]
2 [% USE To %]
3 [% USE Asset %]
4 [% INCLUDE 'doc-head-open.inc' %]
5 <title>[% IF ( authid ) %]Modify authority #[% authid | html %] ([% authtypetext | html %])[% ELSE %]Adding authority ([% authtypetext | html %])[% END %] &rsaquo; Authorities &rsaquo; Koha</title>
6 [% INCLUDE 'doc-head-close.inc' %]
7 [% Asset.js("lib/hc-sticky.js") | $raw %]
8 <script>
9     [% IF Koha.Preference('CreateAVFromCataloguing') && CAN_user_parameters_manage_auth_values %]
10         var auth_values_creation = 1;
11     [% ELSE %]
12         var auth_values_creation = 0;
13     [% END %]
14 </script>
15 [% INCLUDE 'select2.inc' %]
16 [% Asset.js("js/cataloging.js") | $raw %]
17
18 <script>
19     $(window).load(function(){
20         $("#loading").hide();
21     });
22     var Sticky;
23     $(document).ready(function() {
24
25         $("a[data-toggle='tab']").on("shown.bs.tab", function (e) {
26             $( e.target.hash + " .input_marceditor:visible:eq(0)").focus();
27         });
28
29         /* On page load, check for location.hash in the page URL */
30         /* If present the location hash will be used to activate the correct tab */
31         var hash = location.hash;
32         var hashPieces = hash.split('?');
33         if( hashPieces[0] !== "" ){
34             selectTab( hashPieces[0] );
35             window.scrollTo( 0, 0 );
36         } else {
37             selectTab( "#tab0XX_panel" );
38         }
39
40         $( "ul.sortable_field", "#authoritytabs" ).sortable();
41         $( "ul.sortable_subfield", "#authoritytabs" ).sortable();
42
43         Sticky = $("#toolbar");
44         Sticky.hcSticky({
45             stickTo: ".main",
46             stickyClass: "floating"
47         });
48         $("#addauth").click(function(){
49             if(Check()){
50                 $("#f").submit();
51             }
52         });
53         $("#z3950submit").click(function(){
54             var strQuery = GetZ3950Terms();
55             var index = "&index=[% index | html %]";
56             if(strQuery){
57                 window.open("/cgi-bin/koha/cataloguing/z3950_auth_search.pl?authid=[% authid | html %]"+strQuery+index,"z3950search",'width=800,height=500,location=yes,toolbar=no,scrollbars=yes,resize=yes');
58             }
59             return false;
60         });
61
62         $(".toolbar-tabs-container .nav-tabs a").on("click",function(e){
63             e.preventDefault();
64             selectTab( this.hash );
65         });
66
67         $(".tag_anchor").on("click", function(e){
68             e.preventDefault();
69             $(".tag_anchor").removeClass("selected");
70             $(this).addClass("selected");
71             var link = this.href;
72             var linkid = link.substring( link.indexOf("#") + 1 );
73             window.scrollTo( 0, getScrollto( linkid, "toolbar" ) );
74         });
75
76         $("body").on("click", ".linkfield", function(e){
77             e.preventDefault();
78             var tab = $(this).data("tab");
79             var field = $(this).data("field");
80             var tablink = $("a[data-tabname='tab" + tab + "XX']" ).get(0).hash;
81             selectTab( tablink );
82             window.scrollTo( 0, getScrollto( field, "toolbar" ) );
83         });
84     });
85
86     function selectTab( tablink ){
87         let a = $("a[href='" + tablink + "']");
88         $(".toolbar-tabs-container .nav-tabs li").removeClass("selected");
89         a.tab("show").parent().addClass("selected");
90         /* Get number from string like "tab9XX" */
91         var tabid = a.data("tabname").substring(3, 4);
92         $(".tag_anchors").removeClass("tab_selected").hide();
93         $(".tag_anchors_" + tabid ).addClass("tab_selected").show();
94     }
95
96     /**
97     * Returns a roughly ideal position to scroll an element into view
98     * @param {string} target - The HTML id of the element to scroll into view
99     * @param {string} elemid - The HTML id of the element which might obscure
100     *                          the view of the target element e.g. a floating toolbar
101     * @return {number} - The y-coordinate to pass to window.scrollTo()
102     */
103     function getScrollto( target, elemid ){
104         var dest = $("#" + target );
105         var yoffset = dest.offset();
106
107         if( elemid != "" ){
108             var element = $("#" + elemid );
109             var elem_height = element.outerHeight();
110         } else {
111             elem_height = 0;
112         }
113         return yoffset.top - elem_height - 20;
114     }
115
116
117     /**
118     * check if z3950 mandatories are set or not
119     */
120     function GetZ3950Terms(){
121         var strQuery="&authtypecode="+document.forms['f'].authtypecode.value;
122         var mandatories = new Array();
123         var mandatories_label = new Array();
124         [% 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 %]");
125             mandatories_label.push("[% subfield_loo.z3950_mandatory | html %]");[% END %][% END %][% END %][% END %]
126
127         for(var i=0,len=mandatories.length; i<len ; i++){
128             var field_value = document.getElementById(mandatories[i]).value;
129             if( field_value ){
130                 strQuery += "&"+mandatories_label[i]+"="+encodeURIComponent(field_value);
131             }
132         }
133         return strQuery;
134     }
135
136     /**
137     * check if mandatory subfields are written
138     */
139     function AreMandatoriesNotOk(){
140         var mandatories = new Array();
141         var mandatoriesfields = new Array();
142         var   tab = new Array();
143         var label = new Array();
144         [% FOREACH BIG_LOO IN BIG_LOOP %]
145             [% FOREACH innerloo IN BIG_LOO.innerloop %]
146                 [% IF ( innerloo.mandatory ) %]
147                     mandatoriesfields.push(new Array("[% innerloo.tag | html %]","[% innerloo.index | html %][% innerloo.random | html %]","[% innerloo.index | html %]"));
148                 [% END %]
149                 [% FOREACH subfield_loo IN innerloo.subfield_loop %]
150                     [% IF ( subfield_loo.mandatory ) %]mandatories.push("[% subfield_loo.id | html %]");
151                         tab.push("[% BIG_LOO.number | html %]");
152                         label.push("[% To.json(subfield_loo.marc_lib) | html %]");
153                     [% END %]
154                 [% END %]
155             [% END %]
156         [% END %]
157         var StrAlert = "";
158         for(var i=0,len=mandatories.length; i<len ; i++){
159             var id_string = mandatories[i];
160             // alert (id_string);
161             if( ! $("#" + id_string).val() ){
162                 var elt = document.getElementById(id_string);
163                 if ( elt.nodeName == 'SELECT' ) {
164                     $(elt).siblings('.select2').find("span[role='combobox']").addClass('subfield_not_filled');
165                 } else {
166                     $(elt).addClass('subfield_not_filled');
167                 }
168
169                 $(elt).focus();
170                 StrAlert += "\t* " + _("%s in tab %s").format(label[i], tab[i]) + "\n";
171             }
172         }
173
174         /* Check for mandatories field(not subfields) */
175         for(var i=0,len=mandatoriesfields.length; i<len; i++){
176             isempty  = true;
177             arr      = mandatoriesfields[i];
178             divid    = "tag_" + arr[0] + "_" + arr[1];
179             varegexp = new RegExp("^tag_" + arr[0] + "_code_");
180
181             if(parseInt(arr[0]) >= 10){
182                 elem = document.getElementById(divid);
183                 eleminputs = elem.getElementsByTagName('input');
184
185                 for(var j=0,len2=eleminputs.length; j<len2; j++){
186
187                     if(eleminputs[j].name.match(varegexp) && eleminputs[j].value){
188                         inputregexp = new RegExp("^tag_" + arr[0] + "_subfield_" + eleminputs[j].value + "_" + arr[2]);
189
190                         for( var k=0; k<len2; k++){
191                             if(eleminputs[k].id.match(inputregexp) && eleminputs[k].value){
192                                 isempty = false
193                             }
194                         }
195                     }
196                 }
197             }else{
198                 isempty = false;
199             }
200
201             if(isempty){
202                 flag = 1;
203                     StrAlert += "\t* " + _("Field %s is mandatory, at least one of its subfields must be filled.").format(arr[0]) + "\n";
204             }
205
206         }
207
208
209         if(StrAlert){
210             return _("Can't save this record because the following field aren't filled :") + "\n\n" + StrAlert;
211         }
212         return false;
213     }
214
215     function Check(){
216         var StrAlert = AreMandatoriesNotOk();
217         if( ! StrAlert ){
218             document.f.submit();
219             return true;
220         } else {
221             alert(StrAlert);
222             return false;
223         }
224     }
225
226     function AddField(field,cntrepeatfield) {
227         document.forms['f'].op.value = "addfield";
228         document.forms['f'].addfield_field.value=field;
229         document.forms['f'].repeat_field.value=cntrepeatfield;
230         document.f.submit();
231     }
232
233     function addauthority() {
234         X = document.forms[0].authtype.value;
235         window.location="/cgi-bin/koha/authorities/authorities.pl?authtypecode="+X;
236     }
237     function searchauthority() {
238         X = document.forms[0].authtype2.value;
239         Y = document.forms[0].value.value;
240         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";
241     }
242     function confirmnotdup(redirect){
243         $("#confirm_not_duplicate").attr("value","1");
244         Check();
245     }
246     /* Wrap a value in HTML without putting HTML in translatable string */
247     function formatFieldName( string ){
248         return "<strong><em>" + string + "</em></strong>";
249     }
250
251     $(document).ready(function(){
252         $('body').on('click','.expandfield',ExpandField);
253     });
254 </script>
255 [% Asset.css("css/addbiblio.css") | $raw %]
256
257 </head>
258 <body id="auth_authorities" class="auth">
259
260     <div id="loading">
261         <div>Loading, please wait...</div>
262     </div>
263
264     [% INCLUDE 'header.inc' %]
265
266 [% WRAPPER 'sub-header.inc' %]
267     [% WRAPPER breadcrumbs %]
268         [% WRAPPER breadcrumb_item %]
269             <a href="/cgi-bin/koha/authorities/authorities-home.pl">Authorities</a>
270         [% END %]
271
272         [% IF ( authid ) %]
273             [% WRAPPER breadcrumb_item bc_active= 1 %]
274                 <span>Modify authority #[% authid | html %] ([% authtypetext | html %])</span>
275             [% END %]
276
277         [% ELSE %]
278             [% WRAPPER breadcrumb_item bc_active= 1 %]
279                 <span>Adding authority [% authtypetext | html %]</span>
280             [% END %]
281
282         [% END %]
283     [% END #/ WRAPPER breadcrumbs %]
284 [% END #/ WRAPPER sub-header.inc %]
285
286     <div class="main container-fluid">
287         <div class="row">
288             <div class="col-md-10 col-md-offset-1">
289
290                 [% IF ( authid ) %]
291                     <h1>Modify authority #[% authid | html %] [% authtypetext | html %]</h1>
292                 [% ELSE %]
293                     <h1>Adding authority [% authtypetext | html %]</h1>
294                 [% END %]
295
296                 [% IF ( duplicateauthid ) %]
297                     <div class="dialog alert">
298                         <h3>Duplicate record suspected</h3>
299                         <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>
300
301                         <form action="authorities.pl" method="get">
302                             <input type="hidden" name="authid" value="[% duplicateauthid | html %]" />
303                             <button type="submit" class="new"><i class="fa fa-pencil"></i> Yes: Edit existing authority</button>
304                         </form>
305                         <form action="authorities.pl" method="get">
306                             <button class="new" onclick="confirmnotdup('items'); return false;"><i class="fa fa-save"></i> No: Save as new authority</button>
307                         </form>
308                     </div>
309                 [% END # /IF duplicateauthid %]
310
311                 <form method="post" name="f" action="/cgi-bin/koha/authorities/authorities.pl">
312                     <input type="hidden" name="op" value="add" />
313                     <input type="hidden" name="addfield_field" value="" />
314                     <input type="hidden" name="repeat_field" value="" />
315                     <input type="hidden" name="authtypecode" value="[% authtypecode | html%]" />
316                     <input type="hidden" name="authid" value="[% authid | html %]" />
317                     <input type="hidden" name="index" value="[% index | html %]" />
318                     <input type="hidden" value="0" id="confirm_not_duplicate" name="confirm_not_duplicate" />
319
320                     <div id="toolbar" class="btn-toolbar">
321                         <div class="btn-group"><a href="#" id="addauth" class="btn btn-primary" accesskey="w"><i class="fa fa-save"></i> Save</a></div>
322                         <div class="btn-group">
323                             [% IF ( authid ) %]
324                                 <a class="btn btn-default" id="z3950submit" href="#"><i class="fa fa-search"></i> Replace record via Z39.50/SRU search</a>
325                             [% ELSE %]
326                                 <a class="btn btn-default" id="z3950submit" href="#"><i class="fa fa-search"></i> Z39.50/SRU search</a>
327                             [% END %]
328                         </div>
329                         <div class="btn-group">
330                             [% IF ( authid ) %]
331                                 <a class="btn btn-default" id="cancel" href="/cgi-bin/koha/authorities/detail.pl?authid=[% authid | url %]">Cancel</a>
332                             [% ELSE %]
333                                 <a class="btn btn-default" id="cancel" href="/cgi-bin/koha/authorities/authorities-home.pl">Cancel</a>
334                             [% END %]
335                         </div>
336                         <div class="toolbar-tabs-container">
337                             [% IF ( BIG_LOOP && BIG_LOOP.size > 1 ) %]
338                                 [% WRAPPER tabs_nav %]
339                                     [%- FOREACH BIG_LOO IN BIG_LOOP -%]
340                                         [% IF loop.first %]
341                                             [% SET bt_active = 1 %]
342                                         [% ELSE %]
343                                             [% SET bt_active = 0 %]
344                                         [% END %]
345                                         [% WRAPPER tab_item tabname= "tab${BIG_LOO.number}XX" bt_active= bt_active %]
346                                             <span>[% BIG_LOO.number | html %]</span>
347                                         [% END %]
348                                     [%- END -%]
349                                 [% END # /WRAPPER tabs_nav %]
350                             [% END %]
351                             <ul class="tag_anchors_list">
352                                 [% FOREACH BIG_LOO IN BIG_LOOP %]
353                                     [% IF loop.first %][% SET tab_selected = "tab_selected" %][% ELSE %][% SET tab_selected = "" %][% END %]
354                                     [% FOREACH innerloo IN BIG_LOO.innerloop %]
355                                         [% IF ( innerloo.tag ) %]
356                                             <li class="tag_anchors tag_anchors_[% BIG_LOO.number | html %] [% tab_selected | html %]">
357                                                 <a class="tag_anchor" id="tag_anchor_[% innerloo.tag | html %]_[% innerloo.index | html %][% innerloo.random | html %]" title="tag_anchor_[% innerloo.tag | html %]_[% innerloo.index | html %][% innerloo.random | html %]" href="#div_indicator_tag_[% innerloo.tag | uri %]_[% innerloo.index | uri %][% innerloo.random | uri %]">[% innerloo.tag | uri %]</a>
358                                             </li>
359                                         [% END %]
360                                     [% END %]
361                                 [% END %]
362                             </ul>
363                         </div>
364                     </div> <!-- /#toolbar -->
365                     <div id="action">
366                         [% IF count %]
367                                 Used in <a href="/cgi-bin/koha/catalogue/search.pl?type=intranet&amp;op=do_search&amp;q=an:[% authid | uri %]">[% count | html %] record(s)</a>
368                         [% ELSE %]
369                                 This authority is not used in any records.
370                         [% END %]
371                     </div>
372
373                     [% WRAPPER tabs id= "authoritytabs" %]
374                         [% WRAPPER tab_panels %]
375                             [% FOREACH BIG_LOO IN BIG_LOOP %]
376                                 [% IF loop.first %]
377                                     [% SET bt_active = 1 %]
378                                 [% ELSE %]
379                                     [% SET bt_active = 0 %]
380                                 [% END %]
381                                 [% WRAPPER tab_panel tabname="tab${BIG_LOO.number}XX" bt_active= bt_active %]
382                                     [% IF ( BIG_LOOP.size > 1 ) %]
383                                         <h2>Section [% BIG_LOO.number | html %]</h2>
384                                     [% END %]
385                                     [% previous = "" %]
386                                     [% FOREACH innerloo IN BIG_LOO.innerloop %]
387                                         [% IF ( innerloo.tag ) %]
388                                             [% IF innerloo.tag != previous %]
389                                                 [% IF previous != "" %]
390                                                     </ul>
391                                                 [% END %]
392                                                 [% previous = innerloo.tag %]
393                                                 [% IF ( innerloo.repeatable ) %]
394                                                     <ul class="sortable_field">
395                                                 [% ELSE %]
396                                                     <ul>
397                                                 [% END %]
398                                             [% END %]
399
400                                             [% IF ( innerloo.repeatable ) %]
401                                                 <li class="tag sortable_tag clearfix" id="tag_[% innerloo.tag | html %]_[% innerloo.index | html %][% innerloo.random | html %]">
402                                             [% ELSE %]
403                                                 <li class="tag clearfix" id="tag_[% innerloo.tag | html %]_[% innerloo.index | html %][% innerloo.random | html %]">
404                                             [% END %]
405
406                                                 <div class="tag_title" id="div_indicator_tag_[% innerloo.tag | html %]_[% innerloo.index | html %][% innerloo.random | html %]">
407                                                     [% UNLESS hide_marc %]
408                                                         [% IF advancedMARCEditor %]
409                                                             <a href="#" tabindex="1" class="tagnum" title="[% innerloo.tag_lib | html %] - Click to expand this tag" data-field_id="tag_[% innerloo.tag | html %]_[% innerloo.index | html %][% innerloo.random | html %]'">[% innerloo.tag | html %]</a>
410                                                         [% ELSE %]
411                                                             <span class="tagnum" title="[% innerloo.tag_lib | html %]">[% innerloo.tag | html %]</span>
412                                                         [% END %]
413                                                         [% IF ( innerloo.fixedfield ) %]
414                                                             <input type="text"
415                                                                 tabindex="1"
416                                                                 class="indicator flat"
417                                                                 style="display:none;"
418                                                                 name="tag_[% innerloo.tag | html %]_indicator1_[% innerloo.index | html %][% innerloo.random | html %]"
419                                                                 size="1"
420                                                                 maxlength="1"
421                                                                 value="[% innerloo.indicator1 | html %]" />
422                                                             <input type="text"
423                                                                 tabindex="1"
424                                                                 class="indicator flat"
425                                                                 style="display:none;"
426                                                                 name="tag_[% innerloo.tag | html %]_indicator2_[% innerloo.index | html %][% innerloo.random | html %]"
427                                                                 size="1"
428                                                                 maxlength="1"
429                                                                 value="[% innerloo.indicator2 | html %]" />
430                                                         [% ELSE %]
431                                                             <input type="text"
432                                                                 tabindex="1"
433                                                                 class="indicator flat"
434                                                                 name="tag_[% innerloo.tag | html %]_indicator1_[% innerloo.index | html %][% innerloo.random | html %]"
435                                                                 size="1"
436                                                                 maxlength="1"
437                                                                 value="[% innerloo.indicator1 | html %]" />
438                                                             <input type="text"
439                                                                 tabindex="1"
440                                                                 class="indicator flat"
441                                                                 name="tag_[% innerloo.tag | html %]_indicator2_[% innerloo.index | html %][% innerloo.random | html %]"
442                                                                 size="1"
443                                                                 maxlength="1"
444                                                                 value="[% innerloo.indicator2 | html %]" />
445                                                         [% END # /IF ( innerloo.fixedfield ) %] -
446                                                     [% ELSE %]
447                                                         [% IF ( innerloo.fixedfield ) %]
448                                                             <input type="hidden"
449                                                                 tabindex="1"
450                                                                 name="tag_[% innerloo.tag | html %]_indicator1_[% innerloo.index | html %][% innerloo.random | html %]"
451                                                                 value="[% innerloo.indicator1 | html %]" />
452                                                             <input type="hidden"
453                                                                 tabindex="1"
454                                                                 name="tag_[% innerloo.tag | html %]_indicator2_[% innerloo.index | html %][% innerloo.random | html %]"
455                                                                 value="[% innerloo.indicator2 | html %]" />
456                                                         [% ELSE %]
457                                                             <input type="hidden"
458                                                                 tabindex="1"
459                                                                 name="tag_[% innerloo.tag | html %]_indicator1_[% innerloo.index | html %][% innerloo.random | html %]"
460                                                                 value="[% innerloo.indicator1 | html %]" />
461                                                             <input type="hidden"
462                                                                 tabindex="1"
463                                                                 name="tag_[% innerloo.tag | html %]_indicator2_[% innerloo.index | html %][% innerloo.random | html %]"
464                                                                 value="[% innerloo.indicator2 | html %]" />
465                                                         [% END # /IF ( innerloo.fixedfield ) %]
466                                                     [% END # /UNLESS hide_marc %]
467
468                                                     [% UNLESS advancedMARCEditor %]
469                                                         <a href="#" tabindex="1" class="expandfield" data-field_id="tag_[% innerloo.tag | html %]_[% innerloo.index | html %][% innerloo.random | html %]" title="Click to expand this tag">[% innerloo.tag_lib | html %]</a>
470                                                     [% END %]
471                                                     <span class="field_controls">
472                                                         [% IF ( innerloo.repeatable ) %]
473                                                             <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">
474                                                                 <img src="[% interface | html %]/[% theme | html %]/img/repeat-tag.png" alt="Repeat this tag" />
475                                                             </a>
476                                                         [% END %]
477                                                         <a href="#" tabindex="1" class="buttonMinus" onclick="UnCloneField('tag_[% innerloo.tag | html %]_[% innerloo.index | html %][% innerloo.random | html %]'); return false;" title="Delete this tag">
478                                                             <img src="[% interface | html %]/[% theme | html %]/img/delete-tag.png" alt="Delete this tag" />
479                                                         </a>
480                                                     </span> <!-- /.field_controls -->
481                                                 </div> <!-- /div.tag_title -->
482
483                                                 <ul class="sortable_subfield">
484                                                     [% FOREACH subfield_loo IN innerloo.subfield_loop %]
485                                                         <!--  One line on the marc editor -->
486                                                         <li class="subfield_line" style="[% subfield_loo.visibility | html %]" id="subfield[% subfield_loo.tag | html %][% subfield_loo.subfield | html %][% subfield_loo.random | html %]">
487
488                                                             [% UNLESS hide_marc %]
489                                                                 <div class="subfieldcode">
490                                                                     <input type="text"
491                                                                         title="[% subfield_loo.marc_lib | $raw %]"
492                                                                         style=" [% IF ( subfield_loo.fixedfield ) %]display:none; [% END %]border:0;"
493                                                                         name="tag_[% subfield_loo.tag | html %]_code_[% subfield_loo.subfield | html %]_[% subfield_loo.index | html %]_[% subfield_loo.index_subfield | html %]"
494                                                                         value="[% subfield_loo.subfield | html %]"
495                                                                         size="1"
496                                                                         maxlength="1"
497                                                                         class="flat"
498                                                                         tabindex="0" />
499                                                                 </div>
500                                                             [% ELSE %]
501                                                                 <input type="hidden"
502                                                                     name="tag_[% subfield_loo.tag | html %]_code_[% subfield_loo.subfield | html %]_[% subfield_loo.index | html %]_[% subfield_loo.index_subfield | html %]"
503                                                                     value="[% subfield_loo.subfield | html %]" />
504                                                             [% END # /UNLESS hide_marc %]
505
506                                                             [% UNLESS advancedMARCEditor %]
507                                                                 [% IF ( subfield_loo.mandatory ) %]
508                                                                     <div class="subfield subfield_mandatory">
509                                                                 [% ELSE %]
510                                                                     <div class="subfield">
511                                                                 [% END %]
512                                                                     [% IF ( subfield_loo.fixedfield ) %]
513                                                                         <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">
514                                                                     [% ELSE %]
515                                                                         <label for="tag_[% subfield_loo.tag | html %]_subfield_[% subfield_loo.subfield | html %]_[% subfield_loo.index | html %]_[% subfield_loo.index_subfield | html %]" class="labelsubfield">
516                                                                     [% END %]
517                                                                         [% subfield_loo.marc_lib | $raw %]
518                                                                     </label>
519                                                                 </div> <!-- /.subfield -->
520                                                             [% END # UNLESS advancedMARCEditor %]
521
522                                                             [% SET mv = subfield_loo.marc_value %]
523                                                             <div id="field_marceditor[% subfield_loo.tag | html %][% subfield_loo.subfield | html %][% subfield_loo.random | html %]" class="field_marceditor">
524                                                                 [% IF ( mv.type == 'select' ) %]
525                                                                     [% IF mv.category AND CAN_user_parameters_manage_auth_values %]
526                                                                         <select name="[%- mv.name | html -%]" tabindex="1" class="input_marceditor" id="[%- mv.id | html -%]" data-category="[% mv.category | html %]">
527                                                                     [% ELSE %]
528                                                                         <select name="[%- mv.name | html -%]" tabindex="1" class="input_marceditor select2" id="[%- mv.id | html -%]">
529                                                                     [% END %]
530                                                                         [% FOREACH aval IN mv.values %]
531                                                                             [% IF aval == mv.default %]
532                                                                                 <option value="[%- aval | html -%]" selected="selected">[%- mv.labels.$aval | html -%]</option>
533                                                                             [% ELSE %]
534                                                                                 <option value="[%- aval | html -%]">[%- mv.labels.$aval | html -%]</option>
535                                                                             [% END %]
536                                                                         [% END %]
537                                                                     </select>
538                                                                 [% ELSIF ( mv.type == 'text1' ) %]
539                                                                     <input type="text" id="[%- mv.id | html -%]" name="[%- mv.id | html -%]" value="[%- mv.value | html -%]" class="input_marceditor" tabindex="1" />
540                                                                 [% ELSIF ( mv.type == 'text2' ) %]
541                                                                     <input type="text" id="[%- mv.id | html -%]" size="67" maxlength="[%- mv.maxlength | html -%]" name="[%- mv.name | html -%]" value="[%- mv.value | html -%]" class="input_marceditor" />
542                                                                 [% ELSIF ( mv.type == 'text' ) %]
543                                                                     <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 -%]" />
544                                                                 [% ELSIF ( mv.type == 'textarea' ) %]
545                                                                     <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>
546                                                                 [% ELSIF ( mv.type == 'hidden' ) %]
547                                                                     <input tabindex="1" type="hidden" id="[%- mv.id | html -%]" name="[%- mv.name | html -%]" size="67" maxlength="[%- mv.maxlength | html -%]" value="[%- mv.value | html -%]" />
548                                                                 [% ELSIF ( mv.type == 'hidden_simple' ) %]
549                                                                     <input type="hidden" name="[%- mv.name | html -%]" />
550                                                                 [% END # /IF mv.type %]
551                                                             </div> <!-- /.field_marceditor -->
552
553                                                             [% IF ( subfield_loo.mandatory ) %]
554                                                                 <div class="subfield_loop_mandatory">
555                                                                     <span class="required">Required</span>
556                                                                 </div>
557                                                             [% END %]
558
559                                                             <div class="subfield_controls">
560                                                                 [% IF ( mv.type == 'text1' ) %]
561                                                                     <a href="#" class="buttonDot tag_editor" onclick="openAuth(this.parentNode.parentNode.getElementsByTagName('input')[1].id,'[%- mv.authtypecode | html -%]','auth'); return false;" tabindex="1" title="Tag editor">Tag editor</a>
562                                                                 [% ELSIF ( mv.type == 'text2' ) %]
563                                                                     [% IF mv.noclick %]
564                                                                         <a href="#" class="buttonDot tag_editor disabled" tabindex="-1" title="No popup">...</a>
565                                                                     [% ELSE %]
566                                                                         <a href="#" id="buttonDot_[% mv.id | html %]" class="buttonDot tag_editor" title="Tag editor">...</a>
567                                                                     [% END %]
568                                                                     [% mv.javascript | $raw %]
569                                                                 [% END #/IF ( mv.type == 'text1' ) %]
570                                                                 [% IF ( subfield_loo.repeatable ) %]
571                                                                     <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;">
572                                                                         <img src="[% interface | html %]/[% theme | html %]/img/clone-subfield.png" alt="Clone" title="Clone this subfield" />
573                                                                     </a>
574                                                                     <a href="#" class="buttonMinus" tabindex="1" onclick="UnCloneField('subfield[% subfield_loo.tag | html %][% subfield_loo.subfield | html %][% subfield_loo.random | html %]'); return false;">
575                                                                         <img src="[% interface | html %]/[% theme | html %]/img/delete-subfield.png" alt="Delete" title="Delete this subfield" />
576                                                                     </a>
577                                                                 [% END # /IF ( subfield_loo.repeatable ) %]
578                                                             </div> <!-- /.subfield_controls -->
579                                                         </li> <!-- /.subfield_line -->
580                                                     [% END # /FOREACH subfield_loo %]
581                                                 </ul> <!-- /.sortable_subfield -->
582                                             </li> <!-- /.tag -->
583                                         [% END # /IF ( innerloo.tag ) %]
584                                     [% END # /FOREACH innerloo %]
585                                     </ul> <!-- /.sortable_field -->
586                                 [% END # /tab_panel#tabXXX %]
587                             [% END #/FOREACH BIG_LOO %]
588                         [% END # /WRAPPER tab_panels %]
589                     [% END # /WRAPPER tabs %]
590
591                     <div name="hidden" id="hidden" class="tab">
592                         [% FOREACH hidden_loo IN hidden_loop %]
593                             <input type="hidden" name="tag" value="[% hidden_loo.tag | html %]" />
594                             <input type="hidden" name="subfield" value="[% hidden_loo.subfield | html %]" />
595                             <input type="hidden" name="mandatory" value="[% hidden_loo.mandatory | html %]" />
596                             <input type="hidden" name="kohafield" value="[% hidden_loo.kohafield | html %]" />
597                             <input type="hidden" name="tag_mandatory" value="[% hidden_loo.tag_mandatory | html %]" />
598                         [% END %]
599                     </div> <!-- /.tab -->
600                     [% IF ( oldauthnumtagfield ) %]
601                         <input type="hidden" name="tag" value="[% oldauthnumtagfield | html %]" />
602                         <input type="hidden" name="subfield" value="[% oldauthnumtagsubfield | html %]" />
603                         <input type="hidden" name="field_value" value="[% authid | html %]" />
604                         <input type="hidden" name="mandatory" value="0" />
605                         <input type="hidden" name="kohafield" value="[% kohafield | html %]" />
606                         <input type="hidden" name="tag_mandatory" value="[% tag_mandatory | html %]" />
607                         <input type="hidden" name="tag" value="[% oldauthtypetagfield | html %]" />
608                         <input type="hidden" name="subfield" value="[% oldauthtypetagsubfield | html %]" />
609                         <input type="hidden" name="field_value" value="[% authtypecode | html %]" />
610                     [% END %]
611
612                 </form>
613
614                 [% INCLUDE 'modals/cataloguing_create_av.inc' %]
615
616             </div>
617         </div>
618     </div>
619
620 [% INCLUDE 'intranet-bottom.inc' %]