3 [% INCLUDE 'doc-head-open.inc' %]
4 <title>Koha › Authority details</title>
5 [% INCLUDE 'doc-head-close.inc' %]
8 <body id="auth_blinddetail-biblio-search" class="auth">
10 <div class="main container-fluid">
12 <div class="col-md-8 col-md-offset-2">
14 <div id="loading"> <img src="[% interface | html %]/[% theme | html %]/img/spinner-small.gif" alt="" /> Loading </div>
19 [% MACRO jsinclude BLOCK %]
21 $(document).ready(function(){
23 function RancorReplaceField( new_text, ind_1, ind_2 ){
24 var cur_field = opener.opener.jQuery(".CodeMirror")[0].CodeMirror.marceditor.getCurrentField();
25 cur_field.setText(new_text);
26 [% IF update_ind1 %]cur_field.setIndicator1(ind_1);[% END %]
27 [% IF update_ind2 %]cur_field.setIndicator2(ind_2);[% END %]
34 [%- FOREACH SUBFIELD_LOO IN SUBFIELD_LOOP -%]‡
35 [%- To.json( SUBFIELD_LOO.marc_subfield ) | $raw -%]
36 [%- FOREACH marc_value IN SUBFIELD_LOO.marc_values -%]
37 [%- To.json( marc_value ) | $raw -%]
39 [%- END -%]‡9[% authid | html %]";
41 RancorReplaceField( new_line, "[% indicator1 | html %]", "[% indicator2 | html %]" );
43 var index_start = "[% index | html %]";
46 whichfield = opener.opener.document.getElementById(index_start);
47 autolinker_dialog = opener.opener.document.getElementById("autolinker_dialog");
49 whichfield = opener.document.getElementById(index_start);
50 autolinker_dialog = opener.document.getElementById("autolinker_dialog");
52 var field_start = whichfield.parentNode.parentNode.parentNode.parentNode;
54 // Sets the good number of form fields for the specified subfield
55 // Returns false if the cloning failed
56 function SetSubfieldNumber(subfield_name, nb) {
57 // Nothing to do if we only have one value
62 // Find the subfield we want to clone
63 var re = new RegExp('^subfield' + subfield_name,'g');
64 var subfields = $(field_start).children('ul').children('li').filter( function() {
65 return this.id.match(re);
68 // Try to add as many clones as needed
70 for(var i=0; i<nb-subfields.length; i++) {
71 window.opener.opener.CloneSubfield(subfields[0].getAttribute('id'),'[% advancedMARCEditor | html %]');
80 // Fills the subfield with the values entered in argument
81 function SetSubfieldValues() {
83 var subfield_name = arguments[0];
84 var values = new Array();
85 for(var i=1; i<arguments.length; i++) {
86 values.push(arguments[i]);
89 // Create the correct number of form fields for all values
90 // If the field cloning failed, only the first value will be added to the form.
91 SetSubfieldNumber(subfield_name, values.length);
93 // Find the subfields where we will add the new values
94 var re = new RegExp('^subfield' + subfield_name,'g');
95 var subfields = $(field_start).children('ul').children('li').filter( function() {
96 return this.id.match(re);
99 // Add the new values to those subfields, empty the additional fields
101 subfields.each(function() {
103 this.getElementsByTagName('input')[1].value = values[i];
106 this.getElementsByTagName('input')[1].value = "";
111 [% UNLESS ( clear ) %]
112 [% FOREACH SUBFIELD_LOO IN SUBFIELD_LOOP %]
114 "[% To.json(tag_number) | $raw %][% To.json(SUBFIELD_LOO.marc_subfield) | $raw %]"
115 [% FOREACH marc_value IN SUBFIELD_LOO.marc_values %]
116 ,"[% To.json( marc_value ) | $raw %]"
120 var indicators = field_start.getElementsByClassName('indicator flat');
122 indicators[0].value="[% indicator1 | html %]";
125 indicators[1].value="[% indicator2 | html %]";
129 // browse all its subfields (clear and $9)
130 var subfields = field_start.getElementsByTagName('input');
131 var re = /^tag_\d*_code_/;
132 for(var i=0, len = subfields.length ; i< len ; i++) { // browse all subfields
133 if(subfields[i].hasAttribute('name') == 0 ) {continue; } // div elements specific to Select2
134 if(subfields[i].getAttribute('name').match(re)){ // it s a subfield
135 var code = subfields[i]; // code is the first input
136 var subfield = subfields[i+1]; // subfield the second
139 if (subfield){subfield.value="" ;}
142 subfield.value = "[% To.json(authid) | $raw %]";
143 subfield.className = subfield.className.replace("no_matching_authority_field", "matching_authority_field");
150 //Delete create authority button and status
151 var linkinfos = field_start.getElementsByTagName('i');
152 for (index = linkinfos.length - 1; index >= 0; index--) {
153 linkinfos[index].parentNode.removeChild(linkinfos[index]);
155 //Change message autolinker_dialog
156 var subfield_dialog = $(autolinker_dialog).children('ul').children('li');
157 for (index = subfield_dialog.length - 1; index >= 0; index--){
158 var tag_field = field_start.id.split("_")[1];
159 if (subfield_dialog[index].innerHTML.indexOf(tag_field) !== -1 ){
160 subfield_dialog[index].innerHTML = subfield_dialog[index].innerHTML.replace(_("No matching authority found."), _("No matching authority found. A new authority was created or imported"));
172 [% INCLUDE 'intranet-bottom.inc' popup_window = 1 %]