Bug 34436: (QA follow-up) Move spans to surround full text
[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: "#f",
46             stickyClass: "floating"
47         });
48
49         $("#addauth").click(function(){
50             if(Check()){
51                 $("#f").submit();
52             }
53         });
54         $("#z3950submit").click(function(){
55             var strQuery = GetZ3950Terms();
56             var index = "&index=[% index | html %]";
57             if(strQuery){
58                 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');
59             }
60             return false;
61         });
62
63         $(".toolbar-tabs-container .nav-tabs a").on("click",function(e){
64             e.preventDefault();
65             selectTab( this.hash );
66         });
67
68         $(".tag_anchor").on("click", function(e){
69             e.preventDefault();
70             $(".tag_anchor").removeClass("selected");
71             $(this).addClass("selected");
72             var link = this.href;
73             var linkid = link.substring( link.indexOf("#") + 1 );
74             window.scrollTo( 0, getScrollto( linkid, "toolbar" ) );
75         });
76
77         $("body").on("click", ".linkfield", function(e){
78             e.preventDefault();
79             var tab = $(this).data("tab");
80             var field = $(this).data("field");
81             var tablink = $("a[data-tabname='tab" + tab + "XX']" ).get(0).hash;
82             selectTab( tablink );
83             window.scrollTo( 0, getScrollto( field, "toolbar" ) );
84         });
85
86         $(".change-authtype").on("click", function(){
87             var authtypecode = $(this).data("authtypecode");
88             var f = document.f;
89             f.op.value = "[% op | html %]";
90             f.authid.value = "[% authid | html %]";
91             f.changed_authtype.value = "changed";
92             f.authtypecode.value = authtypecode;
93             f.submit();
94         });
95
96         $("body").on("click", ".linkfield", function(e){
97             e.preventDefault();
98             var tab = $(this).data("tab");
99             var field = $(this).data("field");
100             var tablink = $("a[data-tabname='tab" + tab + "XX']" ).get(0).hash;
101             selectTab( tablink );
102             window.scrollTo( 0, getScrollto( field, "toolbar" ) );
103         });
104
105         $("body").on("click", ".show-errors", function(e){
106             document.getElementById("form-errors").scrollIntoView();
107             Sticky.hcSticky('refresh');
108         });
109
110     });
111
112     function selectTab( tablink ){
113         let a = $("a[href='" + tablink + "']");
114         $(".toolbar-tabs-container .nav-tabs li").removeClass("selected");
115         a.tab("show").parent().addClass("selected");
116         /* Get number from string like "tab9XX" */
117         var tabid = a.data("tabname").substring(3, 4);
118         $(".tag_anchors").removeClass("tab_selected").hide();
119         $(".tag_anchors_" + tabid ).addClass("tab_selected").show();
120     }
121
122     /**
123     * Returns a roughly ideal position to scroll an element into view
124     * @param {string} target - The HTML id of the element to scroll into view
125     * @param {string} elemid - The HTML id of the element which might obscure
126     *                          the view of the target element e.g. a floating toolbar
127     * @return {number} - The y-coordinate to pass to window.scrollTo()
128     */
129     function getScrollto( target, elemid ){
130         var dest = $("#" + target );
131         var yoffset = dest.offset();
132
133         if( elemid != "" ){
134             var element = $("#" + elemid );
135             var elem_height = element.outerHeight();
136         } else {
137             elem_height = 0;
138         }
139         return yoffset.top - elem_height - 20;
140     }
141
142
143     /**
144     * check if z3950 mandatories are set or not
145     */
146     function GetZ3950Terms(){
147         var strQuery="&authtypecode="+document.forms['f'].authtypecode.value;
148         var mandatories = new Array();
149         var mandatories_label = new Array();
150         [% 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 %]");
151             mandatories_label.push("[% subfield_loo.z3950_mandatory | html %]");[% END %][% END %][% END %][% END %]
152
153         for(var i=0,len=mandatories.length; i<len ; i++){
154             var field_value = document.getElementById(mandatories[i]).value;
155             if( field_value ){
156                 strQuery += "&"+mandatories_label[i]+"="+encodeURIComponent(field_value);
157             }
158         }
159         return strQuery;
160     }
161
162     /**
163     * check if mandatory subfields are written
164     */
165     function AreMandatoriesNotOk(){
166         var fields = new Array();
167         var subfields = new Array();
168         var   tab = new Array();
169         var label = new Array();
170         var flag = false;
171         var tabflag= new Array();
172         var StrAlert = "<div id='form-errors' class='dialog alert list'>";
173         var notFilledClass = "subfield_not_filled";
174
175         [% FOREACH BIG_LOO IN BIG_LOOP %]
176             [% FOREACH innerloo IN BIG_LOO.innerloop %]
177                 [% IF ( innerloo.mandatory ) %]
178                     fields.push(new Array("[% innerloo.tag | html %]","[% innerloo.index | html %][% innerloo.random | html %]","[% innerloo.index | html %]", "[% BIG_LOO.number | html %]"));
179                 [% END %]
180                 [% FOREACH subfield_loo IN innerloo.subfield_loop %]
181                     [% IF ( subfield_loo.mandatory ) %]subfields.push("[% subfield_loo.id | html %]");
182                         tab.push("[% BIG_LOO.number | html %]");
183                         label.push("[% subfield_loo.marc_lib | $raw %]");
184                     [% END %]
185                 [% END %]
186             [% END %]
187         [% END %]
188
189         StrAlert += "<h4>" + _("The following mandatory subfields aren't filled:") + "</h4>";
190         StrAlert += "<ul>";
191
192         for(var i=0,len=subfields.length; i<len ; i++){
193             var tag=subfields[i].substr(4,3);
194             var subfield=subfields[i].substr(17,1);
195             var tagnumber=subfields[i].substr(19,subfields[i].lastIndexOf("_")-19);
196             if (tabflag[tag+subfield+tagnumber] ==  null) {
197                 tabflag[tag+subfield+tagnumber]=new Array();
198                 tabflag[tag+subfield+tagnumber][0]=0;
199             }
200             if( tabflag[tag+subfield+tagnumber][0] != 1 && (document.getElementById(subfields[i]) != null && ! document.getElementById(subfields[i]).value || document.getElementById(subfields[i]) == null)){
201                 tabflag[tag+subfield+tagnumber][0] = 0 + tabflag[tag+subfield+tagnumber] ;
202
203                 var elt = document.getElementById(subfields[i]);
204                 if ( elt.nodeName == 'SELECT' ) {
205                     $(elt).siblings('.select2').find("span[role='combobox']").addClass(notFilledClass);
206                 } else {
207                     elt.setAttribute('class','input_marceditor noEnterSubmit ' + notFilledClass);
208                 }
209                 $('#' + subfields[i]).focus();
210                 tabflag[tag+subfield+tagnumber][1]=label[i];
211                 tabflag[tag+subfield+tagnumber][2]=tab[i];
212             } else {
213                 tabflag[tag+subfield+tagnumber][0] = 1;
214             }
215             tabflag[tag+subfield+tagnumber][3] = subfields[i];
216         }
217
218         for (var tagsubfieldid in tabflag){
219             if (tabflag[tagsubfieldid][0]==0){
220                 var tag=tagsubfieldid.substr(0,3);
221                 var subfield=tagsubfieldid.substr(3,1);
222                 StrAlert += "<li>"+_("Tag %s subfield %s %s in tab %s").format(tag, subfield, formatFieldName( tabflag[tagsubfieldid][1] ), tabflag[tagsubfieldid][2]) + ' <a class="linkfield btn btn-link" href="#" data-tab="' + tabflag[tagsubfieldid][2] + '" data-field="' + tabflag[tagsubfieldid][3] + '"><i class="fa fa-arrow-right" aria-hidden="true"></i> ' + _("Go to field") + '</a></li>';
223                 flag = true;
224             }
225         }
226
227         StrAlert += "</ul>";
228         mandatoryFields = new Object();
229
230         /* Check for mandatories field(not subfields) */
231         for(var i=0,len=fields.length; i<len; i++){
232             isempty  = true;
233             arr      = fields[i];
234             divid    = "tag_" + arr[0] + "_" + arr[1];
235             varegexp = new RegExp("^tag_" + arr[0] + "_code_");
236
237             if(parseInt(arr[0]) >= 10){
238                 elem = document.getElementById(divid);
239                 eleminputs = elem.getElementsByTagName('input');
240
241                 for(var j=0,len2=eleminputs.length; j<len2; j++){
242
243                     if(eleminputs[j].name.match(varegexp) && eleminputs[j].value){
244                         inputregexp = new RegExp("^tag_" + arr[0] + "_subfield_" + eleminputs[j].value + "_" + arr[2]);
245
246                         for( var k=0; k<len2; k++){
247                             if( eleminputs[k].id.match(inputregexp) ){
248                                 if( eleminputs[k].value ){
249                                     isempty = false
250                                 }
251                             }
252                         }
253
254                         elemselect = elem.getElementsByTagName('select');
255                         for( var k=0; k<elemselect.length; k++){
256                             if(elemselect[k].id.match(inputregexp) && elemselect[k].value){
257                                 isempty = false
258                             }
259                         }
260                     }
261                 }
262
263                 elemtextareas = elem.getElementsByTagName('textarea');
264                 for(var j=0,len2=elemtextareas.length; j<len2; j++){
265                     // this bit assumes that the only textareas in this context would be for subfields
266                     if (elemtextareas[j].value) {
267                         isempty = false;
268                     }
269                 }
270
271             } else {
272                 isempty = false;
273             }
274
275             if(isempty){
276                 flag = true;
277                 mandatoryFields[ arr[0] ] = {
278                     importance: "mandatory",
279                     elemid: "div_indicator_" + divid,
280                     tab: arr[3]
281                 }
282             }
283
284         }
285
286         if( Object.entries(mandatoryFields).length > 0 ){
287             StrAlert += "<h4>" + _("The following fields aren't filled:") + "</h4>";
288             StrAlert += "<ul>";
289             for( var prop in mandatoryFields ){
290                 if( mandatoryFields[prop]["importance"] == "mandatory" ){
291                     StrAlert += "<li>" + _("Field %s is mandatory, at least one of its subfields must be filled.").format( prop ) + ' <a class="linkfield btn btn-link" href="#" data-tab="' + mandatoryFields[prop]["tab"] + '" data-field="' + mandatoryFields[prop]["elemid"] + '"><i class="fa fa-arrow-right" aria-hidden="true"></i> ' + _("Go to field") + '</a></li>';
292                 } else {
293                     StrAlert += "<li>" + _("Field %s is important, at least one of its subfields must be filled.").format(prop) + ' <a class="linkfield btn btn-link" href="#" data-tab="' + mandatoryFields[prop]["tab"] + '" data-field="' + mandatoryFields[prop]["elemid"] + '"><i class="fa fa-arrow-right" aria-hidden="true"></i> ' + _("Go to field") + '</a></li>';
294                 }
295             }
296             StrAlert += "</ul>";
297         }
298         StrAlert += "</div>";
299         if ( flag ) {
300             $("#show-errors").html('<button type="button" class="btn btn-danger show-errors"><i class="fa-solid fa-triangle-exclamation"></i> ' + _("Errors") + '</span>');
301             return StrAlert;
302         } else {
303             return flag;
304         }
305     }
306
307     function Check(){
308         var StrAlert = AreMandatoriesNotOk();
309         if( ! StrAlert ){
310             document.f.submit();
311             return true;
312         } else {
313             $("#check_errors").html( StrAlert );
314             $('html, body').animate({ scrollTop: 0 }, 'fast');
315             Sticky.hcSticky('refresh');
316             return false;
317         }
318     }
319
320     function AddField(field,cntrepeatfield) {
321         document.forms['f'].op.value = "addfield";
322         document.forms['f'].addfield_field.value=field;
323         document.forms['f'].repeat_field.value=cntrepeatfield;
324         document.f.submit();
325     }
326
327     function addauthority() {
328         X = document.forms[0].authtype.value;
329         window.location="/cgi-bin/koha/authorities/authorities.pl?authtypecode="+X;
330     }
331     function searchauthority() {
332         X = document.forms[0].authtype2.value;
333         Y = document.forms[0].value.value;
334         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";
335     }
336     function confirmnotdup(redirect){
337         $("#confirm_not_duplicate").attr("value","1");
338         Check();
339     }
340     /* Wrap a value in HTML without putting HTML in translatable string */
341     function formatFieldName( string ){
342         return "<strong><em>" + string + "</em></strong>";
343     }
344 </script>
345 [% Asset.css("css/addbiblio.css") | $raw %]
346
347 </head>
348 <body id="auth_authorities" class="auth">
349
350     <div id="loading">
351         <div>Loading, please wait...</div>
352     </div>
353
354     [% INCLUDE 'header.inc' %]
355
356 [% WRAPPER 'sub-header.inc' %]
357     [% WRAPPER breadcrumbs %]
358         [% WRAPPER breadcrumb_item %]
359             <a href="/cgi-bin/koha/authorities/authorities-home.pl">Authorities</a>
360         [% END %]
361
362         [% IF ( authid ) %]
363             [% WRAPPER breadcrumb_item bc_active= 1 %]
364                 <span>Modify authority #[% authid | html %] ([% authtypetext | html %])</span>
365             [% END %]
366
367         [% ELSE %]
368             [% WRAPPER breadcrumb_item bc_active= 1 %]
369                 <span>Adding authority [% authtypetext | html %]</span>
370             [% END %]
371
372         [% END %]
373     [% END #/ WRAPPER breadcrumbs %]
374 [% END #/ WRAPPER sub-header.inc %]
375
376     <div class="main container-fluid">
377         <div class="row">
378             <div class="col-md-10 col-md-offset-1">
379
380                 [% IF ( authid ) %]
381                     <h1>Modify authority #[% authid | html %] [% authtypetext | html %]</h1>
382                 [% ELSE %]
383                     <h1>Adding authority [% authtypetext | html %]</h1>
384                 [% END %]
385
386                 <div id="check_errors"></div>
387
388                 [% IF ( duplicateauthid ) %]
389                     <div class="dialog alert">
390                         <h3>Duplicate record suspected</h3>
391                         <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>
392
393                         <form action="authorities.pl" method="get">
394                             <input type="hidden" name="authid" value="[% duplicateauthid | html %]" />
395                             <button type="submit" class="new"><i class="fa-solid fa-pencil" aria-hidden="true"></i> Yes: Edit existing authority</button>
396                         </form>
397                         <form action="authorities.pl" method="get">
398                             <button class="new" onclick="confirmnotdup('items'); return false;"><i class="fa fa-save"></i> No: Save as new authority</button>
399                         </form>
400                     </div>
401                 [% END # /IF duplicateauthid %]
402
403                 <form method="post" id="f" name="f" action="/cgi-bin/koha/authorities/authorities.pl">
404                     <input type="hidden" name="op" value="add" />
405                     <input type="hidden" name="addfield_field" value="" />
406                     <input type="hidden" name="repeat_field" value="" />
407                     <input type="hidden" name="authtypecode" value="[% authtypecode | html%]" />
408                     <input type="hidden" name="authid" value="[% authid | html %]" />
409                     <input type="hidden" name="index" value="[% index | html %]" />
410                     <input type="hidden" value="0" id="confirm_not_duplicate" name="confirm_not_duplicate" />
411                     <input type="hidden" name="changed_authtype" value="" />
412
413                     <div id="toolbar" class="btn-toolbar">
414                         <div class="btn-group"><a href="#" id="addauth" class="btn btn-primary" accesskey="w"><i class="fa fa-save"></i> Save</a></div>
415                         <div class="btn-group">
416                             [% IF ( authid ) %]
417                                 <a class="btn btn-default" id="z3950submit" href="#"><i class="fa fa-search"></i> Replace record via Z39.50/SRU search</a>
418                             [% ELSE %]
419                                 <a class="btn btn-default" id="z3950submit" href="#"><i class="fa fa-search"></i> Z39.50/SRU search</a>
420                             [% END %]
421                         </div>
422                         <div class="btn-group">
423                             <button class="btn btn-default dropdown-toggle" data-toggle="dropdown"><i class="fa fa-cog"></i> Settings <span class="caret"></span></button>
424                             <ul id="settings-menu" class="dropdown-menu">
425                                 <li class="dropdown-header">Change authority type</li>
426                                 <li>
427                                     <a href="#" class="change-authtype" data-authtypecode="">
428                                         [% IF ( authtypecode ) %]
429                                            <i class="fa fa-fw">&nbsp;</i>
430                                         [% ELSE %]
431                                             <i class="fa fa-fw fa-check"></i>
432                                         [% END %]
433                                         Default
434                                     </a>
435                                 </li>
436                                 [% FOREACH authority_type IN authority_types %]
437                                     <li>
438                                         <a href="#" class="change-authtype" data-authtypecode="[% authority_type.authtypecode | html %]">
439                                             [% IF authority_type.authtypecode == authtypecode %]
440                                                 <i class="fa fa-fw fa-check"></i>
441                                             [% ELSE %]
442                                                 <i class="fa fa-fw">&nbsp;</i>
443                                             [% END %]
444                                             [% authority_type.authtypetext | html %]
445                                         </a>
446                                     </li>
447                                 [% END %]
448                             </ul> <!-- /#settings-menu -->
449                         </div> <!-- /.btn-group -->
450                         <div class="btn-group">
451                             [% IF ( authid ) %]
452                                 <a class="btn btn-default" id="cancel" href="/cgi-bin/koha/authorities/detail.pl?authid=[% authid | url %]">Cancel</a>
453                             [% ELSE %]
454                                 <a class="btn btn-default" id="cancel" href="/cgi-bin/koha/authorities/authorities-home.pl">Cancel</a>
455                             [% END %]
456                         </div>
457                         <div id="show-errors" class="btn-group"></div>
458                         <div class="toolbar-tabs-container">
459                             [% IF ( BIG_LOOP && BIG_LOOP.size > 1 ) %]
460                                 [% WRAPPER tabs_nav %]
461                                     [%- FOREACH BIG_LOO IN BIG_LOOP -%]
462                                         [% IF loop.first %]
463                                             [% SET bt_active = 1 %]
464                                         [% ELSE %]
465                                             [% SET bt_active = 0 %]
466                                         [% END %]
467                                         [% WRAPPER tab_item tabname= "tab${BIG_LOO.number}XX" bt_active= bt_active %]
468                                             <span>[% BIG_LOO.number | html %]</span>
469                                         [% END %]
470                                     [%- END -%]
471                                 [% END # /WRAPPER tabs_nav %]
472                             [% END %]
473                             <ul class="tag_anchors_list">
474                                 [% FOREACH BIG_LOO IN BIG_LOOP %]
475                                     [% IF loop.first %][% SET tab_selected = "tab_selected" %][% ELSE %][% SET tab_selected = "" %][% END %]
476                                     [% FOREACH innerloo IN BIG_LOO.innerloop %]
477                                         [% IF ( innerloo.tag ) %]
478                                             <li class="tag_anchors tag_anchors_[% BIG_LOO.number | html %] [% tab_selected | html %]">
479                                                 <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>
480                                             </li>
481                                         [% END %]
482                                     [% END %]
483                                 [% END %]
484                             </ul>
485                         </div>
486                     </div> <!-- /#toolbar -->
487                     <div id="action">
488                         [% IF count %]
489                                 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>
490                         [% ELSE %]
491                                 This authority is not used in any records.
492                         [% END %]
493                     </div>
494
495                     [% WRAPPER tabs id= "authoritytabs" %]
496                         [% WRAPPER tab_panels %]
497                             [% FOREACH BIG_LOO IN BIG_LOOP %]
498                                 [% IF loop.first %]
499                                     [% SET bt_active = 1 %]
500                                 [% ELSE %]
501                                     [% SET bt_active = 0 %]
502                                 [% END %]
503                                 [% WRAPPER tab_panel tabname="tab${BIG_LOO.number}XX" bt_active= bt_active %]
504                                     [% IF ( BIG_LOOP.size > 1 ) %]
505                                         <h2>Section [% BIG_LOO.number | html %]</h2>
506                                     [% END %]
507                                     [% previous = "" %]
508                                     [% FOREACH innerloo IN BIG_LOO.innerloop %]
509                                         [% IF ( innerloo.tag ) %]
510                                             [% IF innerloo.tag != previous %]
511                                                 [% IF previous != "" %]
512                                                     </ul>
513                                                 [% END %]
514                                                 [% previous = innerloo.tag %]
515                                                 [% IF ( innerloo.repeatable ) %]
516                                                     <ul class="sortable_field">
517                                                 [% ELSE %]
518                                                     <ul>
519                                                 [% END %]
520                                             [% END %]
521
522                                             [% IF ( innerloo.repeatable ) %]
523                                                 <li class="tag sortable_tag clearfix" id="tag_[% innerloo.tag | html %]_[% innerloo.index | html %][% innerloo.random | html %]">
524                                             [% ELSE %]
525                                                 <li class="tag clearfix" id="tag_[% innerloo.tag | html %]_[% innerloo.index | html %][% innerloo.random | html %]">
526                                             [% END %]
527
528                                                 <div class="tag_title" id="div_indicator_tag_[% innerloo.tag | html %]_[% innerloo.index | html %][% innerloo.random | html %]">
529                                                     [% UNLESS hide_marc %]
530                                                         [% IF advancedMARCEditor %]
531                                                             <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>
532                                                         [% ELSE %]
533                                                             <span class="tagnum" title="[% innerloo.tag_lib | html %]">[% innerloo.tag | html %]</span>
534                                                         [% END %]
535                                                         [% IF ( innerloo.fixedfield ) %]
536                                                             <input type="text"
537                                                                 tabindex="1"
538                                                                 class="indicator flat"
539                                                                 style="display:none;"
540                                                                 name="tag_[% innerloo.tag | html %]_indicator1_[% innerloo.index | html %][% innerloo.random | html %]"
541                                                                 size="1"
542                                                                 maxlength="1"
543                                                                 value="[% innerloo.indicator1 | html %]" />
544                                                             <input type="text"
545                                                                 tabindex="1"
546                                                                 class="indicator flat"
547                                                                 style="display:none;"
548                                                                 name="tag_[% innerloo.tag | html %]_indicator2_[% innerloo.index | html %][% innerloo.random | html %]"
549                                                                 size="1"
550                                                                 maxlength="1"
551                                                                 value="[% innerloo.indicator2 | html %]" />
552                                                         [% ELSE %]
553                                                             <input type="text"
554                                                                 tabindex="1"
555                                                                 class="indicator flat"
556                                                                 name="tag_[% innerloo.tag | html %]_indicator1_[% innerloo.index | html %][% innerloo.random | html %]"
557                                                                 size="1"
558                                                                 maxlength="1"
559                                                                 value="[% innerloo.indicator1 | html %]" />
560                                                             <input type="text"
561                                                                 tabindex="1"
562                                                                 class="indicator flat"
563                                                                 name="tag_[% innerloo.tag | html %]_indicator2_[% innerloo.index | html %][% innerloo.random | html %]"
564                                                                 size="1"
565                                                                 maxlength="1"
566                                                                 value="[% innerloo.indicator2 | html %]" />
567                                                         [% END # /IF ( innerloo.fixedfield ) %] -
568                                                     [% ELSE %]
569                                                         [% IF ( innerloo.fixedfield ) %]
570                                                             <input type="hidden"
571                                                                 tabindex="1"
572                                                                 name="tag_[% innerloo.tag | html %]_indicator1_[% innerloo.index | html %][% innerloo.random | html %]"
573                                                                 value="[% innerloo.indicator1 | html %]" />
574                                                             <input type="hidden"
575                                                                 tabindex="1"
576                                                                 name="tag_[% innerloo.tag | html %]_indicator2_[% innerloo.index | html %][% innerloo.random | html %]"
577                                                                 value="[% innerloo.indicator2 | html %]" />
578                                                         [% ELSE %]
579                                                             <input type="hidden"
580                                                                 tabindex="1"
581                                                                 name="tag_[% innerloo.tag | html %]_indicator1_[% innerloo.index | html %][% innerloo.random | html %]"
582                                                                 value="[% innerloo.indicator1 | html %]" />
583                                                             <input type="hidden"
584                                                                 tabindex="1"
585                                                                 name="tag_[% innerloo.tag | html %]_indicator2_[% innerloo.index | html %][% innerloo.random | html %]"
586                                                                 value="[% innerloo.indicator2 | html %]" />
587                                                         [% END # /IF ( innerloo.fixedfield ) %]
588                                                     [% END # /UNLESS hide_marc %]
589
590                                                     [% UNLESS advancedMARCEditor %]
591                                                         <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>
592                                                     [% END %]
593                                                     <span class="field_controls">
594                                                         [% IF ( innerloo.repeatable ) %]
595                                                             <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">
596                                                                 <img src="[% interface | html %]/[% theme | html %]/img/repeat-tag.png" alt="Repeat this tag" />
597                                                             </a>
598                                                         [% END %]
599                                                         <a href="#" tabindex="1" class="buttonMinus" onclick="UnCloneField('tag_[% innerloo.tag | html %]_[% innerloo.index | html %][% innerloo.random | html %]'); return false;" title="Delete this tag">
600                                                             <img src="[% interface | html %]/[% theme | html %]/img/delete-tag.png" alt="Delete this tag" />
601                                                         </a>
602                                                     </span> <!-- /.field_controls -->
603                                                 </div> <!-- /div.tag_title -->
604
605                                                 <ul class="sortable_subfield">
606                                                     [% FOREACH subfield_loo IN innerloo.subfield_loop %]
607                                                         <!--  One line on the marc editor -->
608                                                         <li class="subfield_line" style="[% subfield_loo.visibility | html %]" id="subfield[% subfield_loo.tag | html %][% subfield_loo.subfield | html %][% subfield_loo.random | html %]">
609
610                                                             [% UNLESS hide_marc %]
611                                                                 <div class="subfieldcode">
612                                                                     <input type="text"
613                                                                         title="[% subfield_loo.marc_lib | $raw %]"
614                                                                         style=" [% IF ( subfield_loo.fixedfield ) %]display:none; [% END %]border:0;"
615                                                                         name="tag_[% subfield_loo.tag | html %]_code_[% subfield_loo.subfield | html %]_[% subfield_loo.index | html %]_[% subfield_loo.index_subfield | html %]"
616                                                                         value="[% subfield_loo.subfield | html %]"
617                                                                         size="1"
618                                                                         maxlength="1"
619                                                                         class="flat"
620                                                                         tabindex="0" />
621                                                                 </div>
622                                                             [% ELSE %]
623                                                                 <input type="hidden"
624                                                                     name="tag_[% subfield_loo.tag | html %]_code_[% subfield_loo.subfield | html %]_[% subfield_loo.index | html %]_[% subfield_loo.index_subfield | html %]"
625                                                                     value="[% subfield_loo.subfield | html %]" />
626                                                             [% END # /UNLESS hide_marc %]
627
628                                                             [% UNLESS advancedMARCEditor %]
629                                                                 [% IF ( subfield_loo.mandatory ) %]
630                                                                     <div class="subfield subfield_mandatory">
631                                                                 [% ELSE %]
632                                                                     <div class="subfield">
633                                                                 [% END %]
634                                                                     [% IF ( subfield_loo.fixedfield ) %]
635                                                                         <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">
636                                                                     [% ELSE %]
637                                                                         <label for="tag_[% subfield_loo.tag | html %]_subfield_[% subfield_loo.subfield | html %]_[% subfield_loo.index | html %]_[% subfield_loo.index_subfield | html %]" class="labelsubfield">
638                                                                     [% END %]
639                                                                         [% subfield_loo.marc_lib | $raw %]
640                                                                     </label>
641                                                                 </div> <!-- /.subfield -->
642                                                             [% END # UNLESS advancedMARCEditor %]
643
644                                                             [% SET mv = subfield_loo.marc_value %]
645                                                             <div id="field_marceditor[% subfield_loo.tag | html %][% subfield_loo.subfield | html %][% subfield_loo.random | html %]" class="field_marceditor">
646                                                                 [% IF ( mv.type == 'select' ) %]
647                                                                     [% IF mv.category AND CAN_user_parameters_manage_auth_values %]
648                                                                         <select name="[%- mv.name | html -%]" tabindex="1" class="input_marceditor" id="[%- mv.id | html -%]" data-category="[% mv.category | html %]">
649                                                                     [% ELSE %]
650                                                                         <select name="[%- mv.name | html -%]" tabindex="1" class="input_marceditor select2" id="[%- mv.id | html -%]">
651                                                                     [% END %]
652                                                                         [% FOREACH aval IN mv.values %]
653                                                                             [% IF aval == mv.default %]
654                                                                                 <option value="[%- aval | html -%]" selected="selected">[%- mv.labels.$aval | html -%]</option>
655                                                                             [% ELSE %]
656                                                                                 <option value="[%- aval | html -%]">[%- mv.labels.$aval | html -%]</option>
657                                                                             [% END %]
658                                                                         [% END %]
659                                                                     </select>
660                                                                 [% ELSIF ( mv.type == 'text1' ) %]
661                                                                     <input type="text" id="[%- mv.id | html -%]" name="[%- mv.id | html -%]" value="[%- mv.value | html -%]" class="input_marceditor" tabindex="1" />
662                                                                 [% ELSIF ( mv.type == 'text2' ) %]
663                                                                     <input type="text" id="[%- mv.id | html -%]" size="67" maxlength="[%- mv.maxlength | html -%]" name="[%- mv.name | html -%]" value="[%- mv.value | html -%]" class="input_marceditor" />
664                                                                 [% ELSIF ( mv.type == 'text' ) %]
665                                                                     <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 -%]" />
666                                                                 [% ELSIF ( mv.type == 'textarea' ) %]
667                                                                     <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>
668                                                                 [% ELSIF ( mv.type == 'hidden' ) %]
669                                                                     <input tabindex="1" type="hidden" id="[%- mv.id | html -%]" name="[%- mv.name | html -%]" size="67" maxlength="[%- mv.maxlength | html -%]" value="[%- mv.value | html -%]" />
670                                                                 [% ELSIF ( mv.type == 'hidden_simple' ) %]
671                                                                     <input type="hidden" name="[%- mv.name | html -%]" />
672                                                                 [% END # /IF mv.type %]
673                                                             </div> <!-- /.field_marceditor -->
674
675                                                             [% IF ( subfield_loo.mandatory ) %]
676                                                                 <div class="subfield_loop_mandatory">
677                                                                     <span class="required">Required</span>
678                                                                 </div>
679                                                             [% END %]
680
681                                                             <div class="subfield_controls">
682                                                                 [% IF ( mv.type == 'text1' ) %]
683                                                                     <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>
684                                                                 [% ELSIF ( mv.type == 'text2' ) %]
685                                                                     [% IF mv.noclick %]
686                                                                         <a href="#" class="buttonDot tag_editor disabled" tabindex="-1" title="No popup">...</a>
687                                                                     [% ELSE %]
688                                                                         <a href="#" id="buttonDot_[% mv.id | html %]" class="buttonDot tag_editor" title="Tag editor">...</a>
689                                                                     [% END %]
690                                                                     [% mv.javascript | $raw %]
691                                                                 [% END #/IF ( mv.type == 'text1' ) %]
692                                                                 [% IF ( subfield_loo.repeatable ) %]
693                                                                     <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;">
694                                                                         <img src="[% interface | html %]/[% theme | html %]/img/clone-subfield.png" alt="Clone" title="Clone this subfield" />
695                                                                     </a>
696                                                                     <a href="#" class="buttonMinus" tabindex="1" onclick="UnCloneField('subfield[% subfield_loo.tag | html %][% subfield_loo.subfield | html %][% subfield_loo.random | html %]'); return false;">
697                                                                         <img src="[% interface | html %]/[% theme | html %]/img/delete-subfield.png" alt="Delete" title="Delete this subfield" />
698                                                                     </a>
699                                                                 [% END # /IF ( subfield_loo.repeatable ) %]
700                                                             </div> <!-- /.subfield_controls -->
701                                                         </li> <!-- /.subfield_line -->
702                                                     [% END # /FOREACH subfield_loo %]
703                                                 </ul> <!-- /.sortable_subfield -->
704                                             </li> <!-- /.tag -->
705                                         [% END # /IF ( innerloo.tag ) %]
706                                     [% END # /FOREACH innerloo %]
707                                     </ul> <!-- /.sortable_field -->
708                                 [% END # /tab_panel#tabXXX %]
709                             [% END #/FOREACH BIG_LOO %]
710                         [% END # /WRAPPER tab_panels %]
711                     [% END # /WRAPPER tabs %]
712
713                     <div name="hidden" id="hidden" class="tab">
714                         [% FOREACH hidden_loo IN hidden_loop %]
715                             <input type="hidden" name="tag" value="[% hidden_loo.tag | html %]" />
716                             <input type="hidden" name="subfield" value="[% hidden_loo.subfield | html %]" />
717                             <input type="hidden" name="mandatory" value="[% hidden_loo.mandatory | html %]" />
718                             <input type="hidden" name="kohafield" value="[% hidden_loo.kohafield | html %]" />
719                             <input type="hidden" name="tag_mandatory" value="[% hidden_loo.tag_mandatory | html %]" />
720                         [% END %]
721                     </div> <!-- /.tab -->
722                     [% IF ( oldauthnumtagfield ) %]
723                         <input type="hidden" name="tag" value="[% oldauthnumtagfield | html %]" />
724                         <input type="hidden" name="subfield" value="[% oldauthnumtagsubfield | html %]" />
725                         <input type="hidden" name="field_value" value="[% authid | html %]" />
726                         <input type="hidden" name="mandatory" value="0" />
727                         <input type="hidden" name="kohafield" value="[% kohafield | html %]" />
728                         <input type="hidden" name="tag_mandatory" value="[% tag_mandatory | html %]" />
729                         <input type="hidden" name="tag" value="[% oldauthtypetagfield | html %]" />
730                         <input type="hidden" name="subfield" value="[% oldauthtypetagsubfield | html %]" />
731                         <input type="hidden" name="field_value" value="[% authtypecode | html %]" />
732                     [% END %]
733
734                 </form>
735
736                 [% INCLUDE 'modals/cataloguing_create_av.inc' %]
737
738             </div>
739         </div>
740     </div>
741
742 [% INCLUDE 'intranet-bottom.inc' %]