2 [% INCLUDE 'doc-head-open.inc' %]
3 <title>Koha › Authority details</title>
4 [% INCLUDE 'doc-head-close.inc' %]
7 <body id="auth_blinddetail-biblio-search" class="auth">
9 <div class="main container-fluid">
11 <div class="col-md-8 col-md-offset-2">
13 <div id="loading"> <img src="[% interface | html %]/[% theme | html %]/img/spinner-small.gif" alt="" /> Loading </div>
18 [% MACRO jsinclude BLOCK %]
19 <script type="text/javascript">
20 $(document).ready(function(){
22 function RancorReplaceField( new_text, ind_1, ind_2 ){
23 var cur_field = opener.opener.jQuery(".CodeMirror")[0].CodeMirror.marceditor.getCurrentField();
24 cur_field.setText(new_text);
25 [% IF update_ind1 %]cur_field.setIndicator1(ind_1);[% END %]
26 [% IF update_ind2 %]cur_field.setIndicator2(ind_2);[% END %]
33 [%- FOREACH SUBFIELD_LOO IN SUBFIELD_LOOP -%]‡
34 [%- SUBFIELD_LOO.marc_subfield |replace("'", "\'") |replace('"', '\"') |replace('\n', '\\n') |replace('\r', '\\r ') | html -%]
35 [%- FOREACH marc_value IN SUBFIELD_LOO.marc_values -%]
36 [%- marc_value |replace("'", "\'") |replace('"', '\"') |replace('\n', '\\n') |replace('\r', '\\r') | html -%]
38 [%- END -%]‡9[% authid | html %]";
40 RancorReplaceField( new_line, "[% indicator1 | html %]", "[% indicator2 | html %]" );
42 var index_start = "[% index | html %]";
45 whichfield = opener.opener.document.getElementById(index_start);
49 var field_start = whichfield.parentNode.parentNode;
51 // Sets the good number of form fields for the specified subfield
52 // Returns false if the cloning failed
53 function SetSubfieldNumber(subfield_name, nb) {
54 // Nothing to do if we only have one value
59 // Find the subfield we want to clone
60 var re = new RegExp('^subfield' + subfield_name,'g');
61 var subfields = $(field_start).children('div').filter( function() {
62 return this.id.match(re);
65 // Try to add as many clones as needed
67 for(var i=0; i<nb-subfields.length; i++) {
68 window.opener.opener.CloneSubfield(subfields[0].getAttribute('id'),'[% advancedMARCEditor | html %]');
77 // Fills the subfield with the values entered in argument
78 function SetSubfieldValues() {
80 var subfield_name = arguments[0];
81 var values = new Array();
82 for(var i=1; i<arguments.length; i++) {
83 values.push(arguments[i]);
86 // Create the correct number of form fields for all values
87 // If the field cloning failed, only the first value will be added to the form.
88 SetSubfieldNumber(subfield_name, values.length);
90 // Find the subfields where we will add the new values
91 var re = new RegExp('^subfield' + subfield_name,'g');
92 var subfields = $(field_start).children('div').filter( function() {
93 return this.id.match(re);
96 // Add the new values to those subfields, empty the additional fields
98 subfields.each(function() {
100 this.getElementsByTagName('input')[1].value = values[i];
103 this.getElementsByTagName('input')[1].value = "";
108 [% UNLESS ( clear ) %]
109 [% FOREACH SUBFIELD_LOO IN SUBFIELD_LOOP %]
111 "[% tag_number |replace("'", "\'") |replace('"', '\"') |replace('\n', '\\n') |replace('\r', '\\r') | html %][% SUBFIELD_LOO.marc_subfield |replace("'", "\'") |replace('"', '\"') |replace('\n', '\\n') |replace('\r', '\\r') | html %]"
112 [% FOREACH marc_value IN SUBFIELD_LOO.marc_values %]
113 ,"[% marc_value |replace("'", "\'") |replace('"', '\"') |replace('\n', '\\n') |replace('\r', '\\r') | html %]"
117 var indicators = field_start.getElementsByClassName('indicator flat');
119 indicators[0].value="[% indicator1 | html %]";
122 indicators[1].value="[% indicator2 | html %]";
126 // browse all its subfields (clear and $9)
127 var subfields = field_start.getElementsByTagName('input');
128 var re = /^tag_\d*_code_/;
129 for(var i=0, len = subfields.length ; i< len ; i++) { // browse all subfields
130 if(subfields[i].hasAttribute('name') == 0 ) {continue; } // div elements specific to Select2
131 if(subfields[i].getAttribute('name').match(re)){ // it s a subfield
132 var code = subfields[i]; // code is the first input
133 var subfield = subfields[i+1]; // subfield the second
136 if (subfield){subfield.value="" ;}
139 subfield.value = "[% authid |replace("'", "\'") |replace('"', '\"') |replace('\n', '\\n') |replace('\r', '\\r') | html %]";
154 [% INCLUDE 'intranet-bottom.inc' popup_window = 1 %]