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