Koha/koha-tmpl/intranet-tmpl/prog/en/modules/authorities/authorities.tt
Owen Leonard 5d572ec461
Bug 29732: Check alert in cataloguing authorities should be a static message
This patch modifies the authority record editor so that form
validation errors are collected in a static "dialog" at the top of the
page instead of showing in a transient JavaScript alert.

The text of the message is roughly the same as it was in the alert, and
links have been added so that the user can click to jump directly to the
field referenced.

If the user scrolls down away from the static error message, a button
appears in the floating toolbar to jump back to the message.

- Go to Authorities and create a new authority record using a framework
  which has multiple mandatory fields defined
  (e.g. an unmodified default framework)
- Without entering anything in mandatory fields, click the "Save"
  button.
- You should see a message box appear at the top of the page.
  - It should list each missing mandatory subfield and tag, each with a
    "Go to field" link next to it.
  - Clicking the "Go to field" link should switch you to the correct tab
    and scroll the mandatory field into view.
- When you have scrolled down far enough for the error messages to be
  offscreen, an "Errors" button should appear in the floating toolbar.
  Clicking it should scroll the box back into view.
- If you fix some but not all of the missing mandatory fields the
  message should update with only the current issues.
- Confirm that the record saves when all issues are resolved.

Signed-off-by: Phil Ringnalda <phil@chetcolibrary.org>
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
2023-07-18 14:07:38 -03:00

742 lines
47 KiB
Text

[% USE raw %]
[% USE To %]
[% USE Asset %]
[% INCLUDE 'doc-head-open.inc' %]
<title>[% IF ( authid ) %]Modify authority #[% authid | html %] ([% authtypetext | html %])[% ELSE %]Adding authority ([% authtypetext | html %])[% END %] &rsaquo; Authorities &rsaquo; Koha</title>
[% INCLUDE 'doc-head-close.inc' %]
[% Asset.js("lib/hc-sticky.js") | $raw %]
<script>
[% IF Koha.Preference('CreateAVFromCataloguing') && CAN_user_parameters_manage_auth_values %]
var auth_values_creation = 1;
[% ELSE %]
var auth_values_creation = 0;
[% END %]
</script>
[% INCLUDE 'select2.inc' %]
[% Asset.js("js/cataloging.js") | $raw %]
<script>
$(window).load(function(){
$("#loading").hide();
});
var Sticky;
$(document).ready(function() {
$("a[data-toggle='tab']").on("shown.bs.tab", function (e) {
$( e.target.hash + " .input_marceditor:visible:eq(0)").focus();
});
/* On page load, check for location.hash in the page URL */
/* If present the location hash will be used to activate the correct tab */
var hash = location.hash;
var hashPieces = hash.split('?');
if( hashPieces[0] !== "" ){
selectTab( hashPieces[0] );
window.scrollTo( 0, 0 );
} else {
selectTab( "#tab0XX_panel" );
}
$( "ul.sortable_field", "#authoritytabs" ).sortable();
$( "ul.sortable_subfield", "#authoritytabs" ).sortable();
Sticky = $("#toolbar");
Sticky.hcSticky({
stickTo: "#f",
stickyClass: "floating"
});
$("#addauth").click(function(){
if(Check()){
$("#f").submit();
}
});
$("#z3950submit").click(function(){
var strQuery = GetZ3950Terms();
var index = "&index=[% index | html %]";
if(strQuery){
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');
}
return false;
});
$(".toolbar-tabs-container .nav-tabs a").on("click",function(e){
e.preventDefault();
selectTab( this.hash );
});
$(".tag_anchor").on("click", function(e){
e.preventDefault();
$(".tag_anchor").removeClass("selected");
$(this).addClass("selected");
var link = this.href;
var linkid = link.substring( link.indexOf("#") + 1 );
window.scrollTo( 0, getScrollto( linkid, "toolbar" ) );
});
$("body").on("click", ".linkfield", function(e){
e.preventDefault();
var tab = $(this).data("tab");
var field = $(this).data("field");
var tablink = $("a[data-tabname='tab" + tab + "XX']" ).get(0).hash;
selectTab( tablink );
window.scrollTo( 0, getScrollto( field, "toolbar" ) );
});
$(".change-authtype").on("click", function(){
var authtypecode = $(this).data("authtypecode");
var f = document.f;
f.op.value = "[% op | html %]";
f.authid.value = "[% authid | html %]";
f.changed_authtype.value = "changed";
f.authtypecode.value = authtypecode;
f.submit();
});
$("body").on("click", ".linkfield", function(e){
e.preventDefault();
var tab = $(this).data("tab");
var field = $(this).data("field");
var tablink = $("a[data-tabname='tab" + tab + "XX']" ).get(0).hash;
selectTab( tablink );
window.scrollTo( 0, getScrollto( field, "toolbar" ) );
});
$("body").on("click", ".show-errors", function(e){
document.getElementById("form-errors").scrollIntoView();
Sticky.hcSticky('refresh');
});
});
function selectTab( tablink ){
let a = $("a[href='" + tablink + "']");
$(".toolbar-tabs-container .nav-tabs li").removeClass("selected");
a.tab("show").parent().addClass("selected");
/* Get number from string like "tab9XX" */
var tabid = a.data("tabname").substring(3, 4);
$(".tag_anchors").removeClass("tab_selected").hide();
$(".tag_anchors_" + tabid ).addClass("tab_selected").show();
}
/**
* Returns a roughly ideal position to scroll an element into view
* @param {string} target - The HTML id of the element to scroll into view
* @param {string} elemid - The HTML id of the element which might obscure
* the view of the target element e.g. a floating toolbar
* @return {number} - The y-coordinate to pass to window.scrollTo()
*/
function getScrollto( target, elemid ){
var dest = $("#" + target );
var yoffset = dest.offset();
if( elemid != "" ){
var element = $("#" + elemid );
var elem_height = element.outerHeight();
} else {
elem_height = 0;
}
return yoffset.top - elem_height - 20;
}
/**
* check if z3950 mandatories are set or not
*/
function GetZ3950Terms(){
var strQuery="&authtypecode="+document.forms['f'].authtypecode.value;
var mandatories = new Array();
var mandatories_label = new Array();
[% 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 %]");
mandatories_label.push("[% subfield_loo.z3950_mandatory | html %]");[% END %][% END %][% END %][% END %]
for(var i=0,len=mandatories.length; i<len ; i++){
var field_value = document.getElementById(mandatories[i]).value;
if( field_value ){
strQuery += "&"+mandatories_label[i]+"="+encodeURIComponent(field_value);
}
}
return strQuery;
}
/**
* check if mandatory subfields are written
*/
function AreMandatoriesNotOk(){
var fields = new Array();
var subfields = new Array();
var tab = new Array();
var label = new Array();
var flag = false;
var tabflag= new Array();
var StrAlert = "<div id='form-errors' class='dialog alert list'>";
var notFilledClass = "subfield_not_filled";
[% FOREACH BIG_LOO IN BIG_LOOP %]
[% FOREACH innerloo IN BIG_LOO.innerloop %]
[% IF ( innerloo.mandatory ) %]
fields.push(new Array("[% innerloo.tag | html %]","[% innerloo.index | html %][% innerloo.random | html %]","[% innerloo.index | html %]", "[% BIG_LOO.number | html %]"));
[% END %]
[% FOREACH subfield_loo IN innerloo.subfield_loop %]
[% IF ( subfield_loo.mandatory ) %]subfields.push("[% subfield_loo.id | html %]");
tab.push("[% BIG_LOO.number | html %]");
label.push("[% subfield_loo.marc_lib | $raw %]");
[% END %]
[% END %]
[% END %]
[% END %]
StrAlert += "<h4>" + _("The following mandatory subfields aren't filled:") + "</h4>";
StrAlert += "<ul>";
for(var i=0,len=subfields.length; i<len ; i++){
var tag=subfields[i].substr(4,3);
var subfield=subfields[i].substr(17,1);
var tagnumber=subfields[i].substr(19,subfields[i].lastIndexOf("_")-19);
if (tabflag[tag+subfield+tagnumber] == null) {
tabflag[tag+subfield+tagnumber]=new Array();
tabflag[tag+subfield+tagnumber][0]=0;
}
if( tabflag[tag+subfield+tagnumber][0] != 1 && (document.getElementById(subfields[i]) != null && ! document.getElementById(subfields[i]).value || document.getElementById(subfields[i]) == null)){
tabflag[tag+subfield+tagnumber][0] = 0 + tabflag[tag+subfield+tagnumber] ;
var elt = document.getElementById(subfields[i]);
if ( elt.nodeName == 'SELECT' ) {
$(elt).siblings('.select2').find("span[role='combobox']").addClass(notFilledClass);
} else {
elt.setAttribute('class','input_marceditor noEnterSubmit ' + notFilledClass);
}
$('#' + subfields[i]).focus();
tabflag[tag+subfield+tagnumber][1]=label[i];
tabflag[tag+subfield+tagnumber][2]=tab[i];
} else {
tabflag[tag+subfield+tagnumber][0] = 1;
}
tabflag[tag+subfield+tagnumber][3] = subfields[i];
}
for (var tagsubfieldid in tabflag){
if (tabflag[tagsubfieldid][0]==0){
var tag=tagsubfieldid.substr(0,3);
var subfield=tagsubfieldid.substr(3,1);
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>';
flag = true;
}
}
StrAlert += "</ul>";
mandatoryFields = new Object();
/* Check for mandatories field(not subfields) */
for(var i=0,len=fields.length; i<len; i++){
isempty = true;
arr = fields[i];
divid = "tag_" + arr[0] + "_" + arr[1];
varegexp = new RegExp("^tag_" + arr[0] + "_code_");
if(parseInt(arr[0]) >= 10){
elem = document.getElementById(divid);
eleminputs = elem.getElementsByTagName('input');
for(var j=0,len2=eleminputs.length; j<len2; j++){
if(eleminputs[j].name.match(varegexp) && eleminputs[j].value){
inputregexp = new RegExp("^tag_" + arr[0] + "_subfield_" + eleminputs[j].value + "_" + arr[2]);
for( var k=0; k<len2; k++){
if( eleminputs[k].id.match(inputregexp) ){
if( eleminputs[k].value ){
isempty = false
}
}
}
elemselect = elem.getElementsByTagName('select');
for( var k=0; k<elemselect.length; k++){
if(elemselect[k].id.match(inputregexp) && elemselect[k].value){
isempty = false
}
}
}
}
elemtextareas = elem.getElementsByTagName('textarea');
for(var j=0,len2=elemtextareas.length; j<len2; j++){
// this bit assumes that the only textareas in this context would be for subfields
if (elemtextareas[j].value) {
isempty = false;
}
}
} else {
isempty = false;
}
if(isempty){
flag = true;
mandatoryFields[ arr[0] ] = {
importance: "mandatory",
elemid: "div_indicator_" + divid,
tab: arr[3]
}
}
}
if( Object.entries(mandatoryFields).length > 0 ){
StrAlert += "<h4>" + _("The following fields aren't filled:") + "</h4>";
StrAlert += "<ul>";
for( var prop in mandatoryFields ){
if( mandatoryFields[prop]["importance"] == "mandatory" ){
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>';
} else {
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>';
}
}
StrAlert += "</ul>";
}
StrAlert += "</div>";
if ( flag ) {
$("#show-errors").html('<button type="button" class="btn btn-danger show-errors"><i class="fa-solid fa-triangle-exclamation"></i> ' + _("Errors") + '</span>');
return StrAlert;
} else {
return flag;
}
}
function Check(){
var StrAlert = AreMandatoriesNotOk();
if( ! StrAlert ){
document.f.submit();
return true;
} else {
$("#check_errors").html( StrAlert );
$('html, body').animate({ scrollTop: 0 }, 'fast');
Sticky.hcSticky('refresh');
return false;
}
}
function AddField(field,cntrepeatfield) {
document.forms['f'].op.value = "addfield";
document.forms['f'].addfield_field.value=field;
document.forms['f'].repeat_field.value=cntrepeatfield;
document.f.submit();
}
function addauthority() {
X = document.forms[0].authtype.value;
window.location="/cgi-bin/koha/authorities/authorities.pl?authtypecode="+X;
}
function searchauthority() {
X = document.forms[0].authtype2.value;
Y = document.forms[0].value.value;
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";
}
function confirmnotdup(redirect){
$("#confirm_not_duplicate").attr("value","1");
Check();
}
/* Wrap a value in HTML without putting HTML in translatable string */
function formatFieldName( string ){
return "<strong><em>" + string + "</em></strong>";
}
</script>
[% Asset.css("css/addbiblio.css") | $raw %]
</head>
<body id="auth_authorities" class="auth">
<div id="loading">
<div>Loading, please wait...</div>
</div>
[% INCLUDE 'header.inc' %]
[% WRAPPER 'sub-header.inc' %]
[% WRAPPER breadcrumbs %]
[% WRAPPER breadcrumb_item %]
<a href="/cgi-bin/koha/authorities/authorities-home.pl">Authorities</a>
[% END %]
[% IF ( authid ) %]
[% WRAPPER breadcrumb_item bc_active= 1 %]
Modify authority #[% authid | html %] ([% authtypetext | html %])
[% END %]
[% ELSE %]
[% WRAPPER breadcrumb_item bc_active= 1 %]
Adding authority [% authtypetext | html %]
[% END %]
[% END %]
[% END #/ WRAPPER breadcrumbs %]
[% END #/ WRAPPER sub-header.inc %]
<div class="main container-fluid">
<div class="row">
<div class="col-md-10 col-md-offset-1">
[% IF ( authid ) %]
<h1>Modify authority #[% authid | html %] [% authtypetext | html %]</h1>
[% ELSE %]
<h1>Adding authority [% authtypetext | html %]</h1>
[% END %]
<div id="check_errors"></div>
[% IF ( duplicateauthid ) %]
<div class="dialog alert">
<h3>Duplicate record suspected</h3>
<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>
<form action="authorities.pl" method="get">
<input type="hidden" name="authid" value="[% duplicateauthid | html %]" />
<button type="submit" class="new"><i class="fa-solid fa-pencil" aria-hidden="true"></i> Yes: Edit existing authority</button>
</form>
<form action="authorities.pl" method="get">
<button class="new" onclick="confirmnotdup('items'); return false;"><i class="fa fa-save"></i> No: Save as new authority</button>
</form>
</div>
[% END # /IF duplicateauthid %]
<form method="post" id="f" name="f" action="/cgi-bin/koha/authorities/authorities.pl">
<input type="hidden" name="op" value="add" />
<input type="hidden" name="addfield_field" value="" />
<input type="hidden" name="repeat_field" value="" />
<input type="hidden" name="authtypecode" value="[% authtypecode | html%]" />
<input type="hidden" name="authid" value="[% authid | html %]" />
<input type="hidden" name="index" value="[% index | html %]" />
<input type="hidden" value="0" id="confirm_not_duplicate" name="confirm_not_duplicate" />
<input type="hidden" name="changed_authtype" value="" />
<div id="toolbar" class="btn-toolbar">
<div class="btn-group"><a href="#" id="addauth" class="btn btn-primary" accesskey="w"><i class="fa fa-save"></i> Save</a></div>
<div class="btn-group">
[% IF ( authid ) %]
<a class="btn btn-default" id="z3950submit" href="#"><i class="fa fa-search"></i> Replace record via Z39.50/SRU search</a>
[% ELSE %]
<a class="btn btn-default" id="z3950submit" href="#"><i class="fa fa-search"></i> Z39.50/SRU search</a>
[% END %]
</div>
<div class="btn-group">
<button class="btn btn-default dropdown-toggle" data-toggle="dropdown"><i class="fa fa-cog"></i> Settings <span class="caret"></span></button>
<ul id="settings-menu" class="dropdown-menu">
<li class="dropdown-header">Change authority type</li>
<li>
<a href="#" class="change-authtype" data-authtypecode="">
[% IF ( authtypecode ) %]
<i class="fa fa-fw">&nbsp;</i>
[% ELSE %]
<i class="fa fa-fw fa-check"></i>
[% END %]
Default
</a>
</li>
[% FOREACH authority_type IN authority_types %]
<li>
<a href="#" class="change-authtype" data-authtypecode="[% authority_type.authtypecode | html %]">
[% IF authority_type.authtypecode == authtypecode %]
<i class="fa fa-fw fa-check"></i>
[% ELSE %]
<i class="fa fa-fw">&nbsp;</i>
[% END %]
[% authority_type.authtypetext | html %]
</a>
</li>
[% END %]
</ul> <!-- /#settings-menu -->
</div> <!-- /.btn-group -->
<div class="btn-group">
[% IF ( authid ) %]
<a class="btn btn-default" id="cancel" href="/cgi-bin/koha/authorities/detail.pl?authid=[% authid | url %]">Cancel</a>
[% ELSE %]
<a class="btn btn-default" id="cancel" href="/cgi-bin/koha/authorities/authorities-home.pl">Cancel</a>
[% END %]
</div>
<div id="show-errors" class="btn-group"></div>
<div class="toolbar-tabs-container">
[% IF ( BIG_LOOP && BIG_LOOP.size > 1 ) %]
[% WRAPPER tabs_nav %]
[%- FOREACH BIG_LOO IN BIG_LOOP -%]
[% IF loop.first %]
[% SET bt_active = 1 %]
[% ELSE %]
[% SET bt_active = 0 %]
[% END %]
[% WRAPPER tab_item tabname= "tab${BIG_LOO.number}XX" bt_active= bt_active %]
<span>[% BIG_LOO.number | html %]</span>
[% END %]
[%- END -%]
[% END # /WRAPPER tabs_nav %]
[% END %]
<ul class="tag_anchors_list">
[% FOREACH BIG_LOO IN BIG_LOOP %]
[% IF loop.first %][% SET tab_selected = "tab_selected" %][% ELSE %][% SET tab_selected = "" %][% END %]
[% FOREACH innerloo IN BIG_LOO.innerloop %]
[% IF ( innerloo.tag ) %]
<li class="tag_anchors tag_anchors_[% BIG_LOO.number | html %] [% tab_selected | html %]">
<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>
</li>
[% END %]
[% END %]
[% END %]
</ul>
</div>
</div> <!-- /#toolbar -->
<div id="action">
[% IF count %]
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>
[% ELSE %]
This authority is not used in any records.
[% END %]
</div>
[% WRAPPER tabs id= "authoritytabs" %]
[% WRAPPER tab_panels %]
[% FOREACH BIG_LOO IN BIG_LOOP %]
[% IF loop.first %]
[% SET bt_active = 1 %]
[% ELSE %]
[% SET bt_active = 0 %]
[% END %]
[% WRAPPER tab_panel tabname="tab${BIG_LOO.number}XX" bt_active= bt_active %]
[% IF ( BIG_LOOP.size > 1 ) %]
<h2>Section [% BIG_LOO.number | html %]</h2>
[% END %]
[% previous = "" %]
[% FOREACH innerloo IN BIG_LOO.innerloop %]
[% IF ( innerloo.tag ) %]
[% IF innerloo.tag != previous %]
[% IF previous != "" %]
</ul>
[% END %]
[% previous = innerloo.tag %]
[% IF ( innerloo.repeatable ) %]
<ul class="sortable_field">
[% ELSE %]
<ul>
[% END %]
[% END %]
[% IF ( innerloo.repeatable ) %]
<li class="tag sortable_tag clearfix" id="tag_[% innerloo.tag | html %]_[% innerloo.index | html %][% innerloo.random | html %]">
[% ELSE %]
<li class="tag clearfix" id="tag_[% innerloo.tag | html %]_[% innerloo.index | html %][% innerloo.random | html %]">
[% END %]
<div class="tag_title" id="div_indicator_tag_[% innerloo.tag | html %]_[% innerloo.index | html %][% innerloo.random | html %]">
[% UNLESS hide_marc %]
[% IF advancedMARCEditor %]
<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>
[% ELSE %]
<span class="tagnum" title="[% innerloo.tag_lib | html %]">[% innerloo.tag | html %]</span>
[% END %]
[% IF ( innerloo.fixedfield ) %]
<input type="text"
tabindex="1"
class="indicator flat"
style="display:none;"
name="tag_[% innerloo.tag | html %]_indicator1_[% innerloo.index | html %][% innerloo.random | html %]"
size="1"
maxlength="1"
value="[% innerloo.indicator1 | html %]" />
<input type="text"
tabindex="1"
class="indicator flat"
style="display:none;"
name="tag_[% innerloo.tag | html %]_indicator2_[% innerloo.index | html %][% innerloo.random | html %]"
size="1"
maxlength="1"
value="[% innerloo.indicator2 | html %]" />
[% ELSE %]
<input type="text"
tabindex="1"
class="indicator flat"
name="tag_[% innerloo.tag | html %]_indicator1_[% innerloo.index | html %][% innerloo.random | html %]"
size="1"
maxlength="1"
value="[% innerloo.indicator1 | html %]" />
<input type="text"
tabindex="1"
class="indicator flat"
name="tag_[% innerloo.tag | html %]_indicator2_[% innerloo.index | html %][% innerloo.random | html %]"
size="1"
maxlength="1"
value="[% innerloo.indicator2 | html %]" />
[% END # /IF ( innerloo.fixedfield ) %] -
[% ELSE %]
[% IF ( innerloo.fixedfield ) %]
<input type="hidden"
tabindex="1"
name="tag_[% innerloo.tag | html %]_indicator1_[% innerloo.index | html %][% innerloo.random | html %]"
value="[% innerloo.indicator1 | html %]" />
<input type="hidden"
tabindex="1"
name="tag_[% innerloo.tag | html %]_indicator2_[% innerloo.index | html %][% innerloo.random | html %]"
value="[% innerloo.indicator2 | html %]" />
[% ELSE %]
<input type="hidden"
tabindex="1"
name="tag_[% innerloo.tag | html %]_indicator1_[% innerloo.index | html %][% innerloo.random | html %]"
value="[% innerloo.indicator1 | html %]" />
<input type="hidden"
tabindex="1"
name="tag_[% innerloo.tag | html %]_indicator2_[% innerloo.index | html %][% innerloo.random | html %]"
value="[% innerloo.indicator2 | html %]" />
[% END # /IF ( innerloo.fixedfield ) %]
[% END # /UNLESS hide_marc %]
[% UNLESS advancedMARCEditor %]
<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>
[% END %]
<span class="field_controls">
[% IF ( innerloo.repeatable ) %]
<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">
<img src="[% interface | html %]/[% theme | html %]/img/repeat-tag.png" alt="Repeat this tag" />
</a>
[% END %]
<a href="#" tabindex="1" class="buttonMinus" onclick="UnCloneField('tag_[% innerloo.tag | html %]_[% innerloo.index | html %][% innerloo.random | html %]'); return false;" title="Delete this tag">
<img src="[% interface | html %]/[% theme | html %]/img/delete-tag.png" alt="Delete this tag" />
</a>
</span> <!-- /.field_controls -->
</div> <!-- /div.tag_title -->
<ul class="sortable_subfield">
[% FOREACH subfield_loo IN innerloo.subfield_loop %]
<!-- One line on the marc editor -->
<li class="subfield_line" style="[% subfield_loo.visibility | html %]" id="subfield[% subfield_loo.tag | html %][% subfield_loo.subfield | html %][% subfield_loo.random | html %]">
[% UNLESS hide_marc %]
<div class="subfieldcode">
<input type="text"
title="[% subfield_loo.marc_lib | $raw %]"
style=" [% IF ( subfield_loo.fixedfield ) %]display:none; [% END %]border:0;"
name="tag_[% subfield_loo.tag | html %]_code_[% subfield_loo.subfield | html %]_[% subfield_loo.index | html %]_[% subfield_loo.index_subfield | html %]"
value="[% subfield_loo.subfield | html %]"
size="1"
maxlength="1"
class="flat"
tabindex="0" />
</div>
[% ELSE %]
<input type="hidden"
name="tag_[% subfield_loo.tag | html %]_code_[% subfield_loo.subfield | html %]_[% subfield_loo.index | html %]_[% subfield_loo.index_subfield | html %]"
value="[% subfield_loo.subfield | html %]" />
[% END # /UNLESS hide_marc %]
[% UNLESS advancedMARCEditor %]
[% IF ( subfield_loo.mandatory ) %]
<div class="subfield subfield_mandatory">
[% ELSE %]
<div class="subfield">
[% END %]
[% IF ( subfield_loo.fixedfield ) %]
<label for="tag_[% subfield_loo.tag | html %]_subfield_[% subfield_loo.subfield | html %]_[% subfield_loo.index | html %]_[% subfield_loo.index_subfield | html %]" style="display:none;" class="labelsubfield">
[% ELSE %]
<label for="tag_[% subfield_loo.tag | html %]_subfield_[% subfield_loo.subfield | html %]_[% subfield_loo.index | html %]_[% subfield_loo.index_subfield | html %]" class="labelsubfield">
[% END %]
[% subfield_loo.marc_lib | $raw %]
</label>
</div> <!-- /.subfield -->
[% END # UNLESS advancedMARCEditor %]
[% SET mv = subfield_loo.marc_value %]
<div id="field_marceditor[% subfield_loo.tag | html %][% subfield_loo.subfield | html %][% subfield_loo.random | html %]" class="field_marceditor">
[% IF ( mv.type == 'select' ) %]
[% IF mv.category AND CAN_user_parameters_manage_auth_values %]
<select name="[%- mv.name | html -%]" tabindex="1" class="input_marceditor" id="[%- mv.id | html -%]" data-category="[% mv.category | html %]">
[% ELSE %]
<select name="[%- mv.name | html -%]" tabindex="1" class="input_marceditor select2" id="[%- mv.id | html -%]">
[% END %]
[% FOREACH aval IN mv.values %]
[% IF aval == mv.default %]
<option value="[%- aval | html -%]" selected="selected">[%- mv.labels.$aval | html -%]</option>
[% ELSE %]
<option value="[%- aval | html -%]">[%- mv.labels.$aval | html -%]</option>
[% END %]
[% END %]
</select>
[% ELSIF ( mv.type == 'text1' ) %]
<input type="text" id="[%- mv.id | html -%]" name="[%- mv.id | html -%]" value="[%- mv.value | html -%]" class="input_marceditor" tabindex="1" />
[% ELSIF ( mv.type == 'text2' ) %]
<input type="text" id="[%- mv.id | html -%]" size="67" maxlength="[%- mv.maxlength | html -%]" name="[%- mv.name | html -%]" value="[%- mv.value | html -%]" class="input_marceditor" />
[% ELSIF ( mv.type == 'text' ) %]
<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 -%]" />
[% ELSIF ( mv.type == 'textarea' ) %]
<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>
[% ELSIF ( mv.type == 'hidden' ) %]
<input tabindex="1" type="hidden" id="[%- mv.id | html -%]" name="[%- mv.name | html -%]" size="67" maxlength="[%- mv.maxlength | html -%]" value="[%- mv.value | html -%]" />
[% ELSIF ( mv.type == 'hidden_simple' ) %]
<input type="hidden" name="[%- mv.name | html -%]" />
[% END # /IF mv.type %]
</div> <!-- /.field_marceditor -->
[% IF ( subfield_loo.mandatory ) %]
<div class="subfield_loop_mandatory">
<span class="required">Required</span>
</div>
[% END %]
<div class="subfield_controls">
[% IF ( mv.type == 'text1' ) %]
<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>
[% ELSIF ( mv.type == 'text2' ) %]
[% IF mv.noclick %]
<a href="#" class="buttonDot tag_editor disabled" tabindex="-1" title="No popup">...</a>
[% ELSE %]
<a href="#" id="buttonDot_[% mv.id | html %]" class="buttonDot tag_editor" title="Tag editor">...</a>
[% END %]
[% mv.javascript | $raw %]
[% END #/IF ( mv.type == 'text1' ) %]
[% IF ( subfield_loo.repeatable ) %]
<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;">
<img src="[% interface | html %]/[% theme | html %]/img/clone-subfield.png" alt="Clone" title="Clone this subfield" />
</a>
<a href="#" class="buttonMinus" tabindex="1" onclick="UnCloneField('subfield[% subfield_loo.tag | html %][% subfield_loo.subfield | html %][% subfield_loo.random | html %]'); return false;">
<img src="[% interface | html %]/[% theme | html %]/img/delete-subfield.png" alt="Delete" title="Delete this subfield" />
</a>
[% END # /IF ( subfield_loo.repeatable ) %]
</div> <!-- /.subfield_controls -->
</li> <!-- /.subfield_line -->
[% END # /FOREACH subfield_loo %]
</ul> <!-- /.sortable_subfield -->
</li> <!-- /.tag -->
[% END # /IF ( innerloo.tag ) %]
[% END # /FOREACH innerloo %]
</ul> <!-- /.sortable_field -->
[% END # /tab_panel#tabXXX %]
[% END #/FOREACH BIG_LOO %]
[% END # /WRAPPER tab_panels %]
[% END # /WRAPPER tabs %]
<div name="hidden" id="hidden" class="tab">
[% FOREACH hidden_loo IN hidden_loop %]
<input type="hidden" name="tag" value="[% hidden_loo.tag | html %]" />
<input type="hidden" name="subfield" value="[% hidden_loo.subfield | html %]" />
<input type="hidden" name="mandatory" value="[% hidden_loo.mandatory | html %]" />
<input type="hidden" name="kohafield" value="[% hidden_loo.kohafield | html %]" />
<input type="hidden" name="tag_mandatory" value="[% hidden_loo.tag_mandatory | html %]" />
[% END %]
</div> <!-- /.tab -->
[% IF ( oldauthnumtagfield ) %]
<input type="hidden" name="tag" value="[% oldauthnumtagfield | html %]" />
<input type="hidden" name="subfield" value="[% oldauthnumtagsubfield | html %]" />
<input type="hidden" name="field_value" value="[% authid | html %]" />
<input type="hidden" name="mandatory" value="0" />
<input type="hidden" name="kohafield" value="[% kohafield | html %]" />
<input type="hidden" name="tag_mandatory" value="[% tag_mandatory | html %]" />
<input type="hidden" name="tag" value="[% oldauthtypetagfield | html %]" />
<input type="hidden" name="subfield" value="[% oldauthtypetagsubfield | html %]" />
<input type="hidden" name="field_value" value="[% authtypecode | html %]" />
[% END %]
</form>
[% INCLUDE 'modals/cataloguing_create_av.inc' %]
</div>
</div>
</div>
[% INCLUDE 'intranet-bottom.inc' %]