View | Details | Raw Unified | Return to bug 22399
Collapse All | Expand All

(-)a/koha-tmpl/intranet-tmpl/prog/css/addbiblio.css (-15 / +45 lines)
Lines 109-116 li.subfield_line { Link Here
109
li.subfield_line label {
109
li.subfield_line label {
110
    font-size:89%;
110
    font-size:89%;
111
    float: left;
111
    float: left;
112
	 padding-right : .4em;
112
    padding-right: .4em;
113
    width: 16em;
113
    width: 10em;
114
    text-align: left;
114
    text-align: left;
115
    clear:left;
115
    clear:left;
116
}
116
}
Lines 151-162 a.tagnum { Link Here
151
}
151
}
152
152
153
.subfieldcode {
153
.subfieldcode {
154
	display: block;
154
    display: block;
155
	float: left;
155
    float: left;
156
}
156
}
157
157
158
.labelsubfield {
158
.labelsubfield {
159
	float:left;
159
    float: left;
160
}
161
162
#cat_addbiblio .subfieldcode {
163
    float: none;
164
}
165
166
#cat_addbiblio .labelsubfield {
167
    font-size: 90%;
168
    float: none;
169
}
170
171
#cat_addbiblio .subfield {
172
    float: none;
173
    padding: .25em .5em;
174
}
175
176
#cat_addbiblio .subfield label {
177
    color: #00698a;
160
}
178
}
161
179
162
.input_marceditor {
180
.input_marceditor {
Lines 164-169 a.tagnum { Link Here
164
	width:30em;
182
	width:30em;
165
}
183
}
166
184
185
#cat_addbiblio .input_marceditor {
186
    float: none;
187
    width: 100%;
188
}
189
190
#cat_addbiblio .subfield_line {
191
    display: flex;
192
}
193
194
#cat_addbiblio .field_marceditor {
195
    flex-grow: 1;
196
    padding: .25em .5em;
197
}
198
199
#cat_addbiblio .subfield_loop_mandatory {
200
    padding: .25em .5em;
201
}
202
167
.indicator {
203
.indicator {
168
    width: 1em;
204
    width: 1em;
169
    box-sizing: content-box;
205
    box-sizing: content-box;
Lines 177-188 a.tagnum { Link Here
177
#cataloguing_additem_newitem fieldset.rows li {
213
#cataloguing_additem_newitem fieldset.rows li {
178
	padding-bottom : 3px;
214
	padding-bottom : 3px;
179
}
215
}
216
180
#cataloguing_additem_newitem .input_marceditor {
217
#cataloguing_additem_newitem .input_marceditor {
181
	width : auto;
218
    width: auto;
182
}
219
}
183
220
184
#cataloguing_additem_newitem textarea.input_marceditor {
221
#cataloguing_additem_newitem textarea.input_marceditor {
185
     width : 31em;
222
    width: 31em;
186
}
223
}
187
224
188
.mandatory_marker {
225
.mandatory_marker {
Lines 193-210 a.tagnum { Link Here
193
.linktools a {margin:0 2px;padding:2px;background-color:#FFF;text-align:center; }
230
.linktools a {margin:0 2px;padding:2px;background-color:#FFF;text-align:center; }
194
.linktools a:first-child { border-bottom: 1px solid #DDD; }
231
.linktools a:first-child { border-bottom: 1px solid #DDD; }
195
.linktools a:hover { background-color: #FFC; }
232
.linktools a:hover { background-color: #FFC; }
196
.subfield_controls { margin : 0 .5em; }
233
.subfield_controls { margin: 0 .5em; }
197
234
198
#cataloguing_additem_itemlist {
235
#cataloguing_additem_itemlist {
199
	margin-bottom : 1em;
236
	margin-bottom : 1em;
200
}
237
}
201
.yui-gf div.first {
202
	width : 19%;
203
}
204
205
.yui-gf .yui-u {
206
	width: 79.2%;
207
}
208
238
209
tbody tr.active:nth-child(2n+1) td,
239
tbody tr.active:nth-child(2n+1) td,
210
tbody tr.active td {
240
tbody tr.active td {
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/authorities/blinddetail-biblio-search.tt (-107 / +107 lines)
Lines 20-148 Link Here
20
    <script>
20
    <script>
21
        $(document).ready(function(){
21
        $(document).ready(function(){
22
            [% IF rancor %]
22
            [% IF rancor %]
23
            function RancorReplaceField( new_text, ind_1, ind_2 ){
23
                function RancorReplaceField( new_text, ind_1, ind_2 ){
24
                var cur_field = opener.opener.jQuery(".CodeMirror")[0].CodeMirror.marceditor.getCurrentField();
24
                    var cur_field = opener.opener.jQuery(".CodeMirror")[0].CodeMirror.marceditor.getCurrentField();
25
                cur_field.setText(new_text);
25
                    cur_field.setText(new_text);
26
                [% IF update_ind1 %]cur_field.setIndicator1(ind_1);[% END %]
26
                    [% IF update_ind1 %]cur_field.setIndicator1(ind_1);[% END %]
27
                [% IF update_ind2 %]cur_field.setIndicator2(ind_2);[% END %]
27
                    [% IF update_ind2 %]cur_field.setIndicator2(ind_2);[% END %]
28
                return true;
28
                    return true;
29
            }
29
                }
30
                [% IF ( clear ) %]
30
                [% IF ( clear ) %]
31
                var new_line = "";
31
                    var new_line = "";
32
                [% ELSE %]
32
                [% ELSE %]
33
                var new_line = "
33
                    var new_line = "
34
                [%- FOREACH SUBFIELD_LOO IN SUBFIELD_LOOP -%]‡
34
                    [%- FOREACH SUBFIELD_LOO IN SUBFIELD_LOOP -%]‡
35
                    [%- To.json( SUBFIELD_LOO.marc_subfield ) | $raw -%]
35
                        [%- To.json( SUBFIELD_LOO.marc_subfield ) | $raw -%]
36
                    [%- FOREACH marc_value IN SUBFIELD_LOO.marc_values -%]
36
                        [%- FOREACH marc_value IN SUBFIELD_LOO.marc_values -%]
37
                        [%- To.json( marc_value ) | $raw -%]
37
                            [%- To.json( marc_value ) | $raw -%]
38
                    [%- END -%]
38
                        [%- END -%]
39
                [%- END -%]‡9[% authid | html %]";
39
                    [%- END -%]‡9[% authid | html %]";
40
                [% END %]
40
                [% END %]
41
                RancorReplaceField( new_line, "[% indicator1 | html %]", "[% indicator2 | html %]" );
41
                RancorReplaceField( new_line, "[% indicator1 | html %]", "[% indicator2 | html %]" );
42
            [% ELSE %]
42
            [% ELSE %]
43
            var index_start = "[% index | html %]";
43
                var index_start = "[% index | html %]";
44
            var whichfield;
44
                var whichfield;
45
            try {
45
                try {
46
                whichfield = opener.opener.document.getElementById(index_start);
46
                    whichfield = opener.opener.document.getElementById(index_start);
47
            } catch(e) {
47
                } catch(e) {
48
                return;
48
                    return;
49
            }
50
            var field_start = whichfield.parentNode.parentNode.parentNode;
51
52
            // Sets the good number of form fields for the specified subfield
53
            // Returns false if the cloning failed
54
            function SetSubfieldNumber(subfield_name, nb) {
55
                // Nothing to do if we only have one value
56
                if(nb <= 1) {
57
                    return true;
58
                }
49
                }
50
                var field_start = whichfield.parentNode.parentNode.parentNode.parentNode;
51
52
                // Sets the good number of form fields for the specified subfield
53
                // Returns false if the cloning failed
54
                function SetSubfieldNumber(subfield_name, nb) {
55
                    // Nothing to do if we only have one value
56
                    if(nb <= 1) {
57
                        return true;
58
                    }
59
59
60
                // Find the subfield we want to clone
60
                    // Find the subfield we want to clone
61
                var re = new RegExp('^subfield' + subfield_name,'g');
61
                    var re = new RegExp('^subfield' + subfield_name,'g');
62
                var subfields = $(field_start).children('ul').children('li').filter( function() {
62
                    var subfields = $(field_start).children('ul').children('li').filter( function() {
63
                    return this.id.match(re);
63
                        return this.id.match(re);
64
                });
64
                    });
65
65
66
                // Try to add as many clones as needed
66
                    // Try to add as many clones as needed
67
                try {
67
                    try {
68
                    for(var i=0; i<nb-subfields.length; i++) {
68
                        for(var i=0; i<nb-subfields.length; i++) {
69
                        window.opener.opener.CloneSubfield(subfields[0].getAttribute('id'),'[% advancedMARCEditor | html %]');
69
                            window.opener.opener.CloneSubfield(subfields[0].getAttribute('id'),'[% advancedMARCEditor | html %]');
70
                        }
70
                    }
71
                    }
71
                }
72
                    catch(err) {
72
                catch(err) {
73
                        return false;
73
                    return false;
74
                    }
74
                }
75
                    return true;
75
                return true;
76
            }
77
78
            // Fills the subfield with the values entered in argument
79
            function SetSubfieldValues() {
80
                // Get the arguments
81
                var subfield_name = arguments[0];
82
                var values = new Array();
83
                for(var i=1; i<arguments.length; i++) {
84
                    values.push(arguments[i]);
85
                }
76
                }
86
77
87
                // Create the correct number of form fields for all values
78
                // Fills the subfield with the values entered in argument
88
                // If the field cloning failed, only the first value will be added to the form.
79
                function SetSubfieldValues() {
89
                SetSubfieldNumber(subfield_name, values.length);
80
                    // Get the arguments
90
81
                    var subfield_name = arguments[0];
91
                // Find the subfields where we will add the new values
82
                    var values = new Array();
92
                var re = new RegExp('^subfield' + subfield_name,'g');
83
                    for(var i=1; i<arguments.length; i++) {
93
                var subfields = $(field_start).children('ul').children('li').filter( function() {
84
                        values.push(arguments[i]);
94
                    return this.id.match(re);
95
                });
96
97
                // Add the new values to those subfields, empty the additional fields
98
                var i=0;
99
                subfields.each(function() {
100
                    if(i in values) {
101
                        this.getElementsByTagName('input')[1].value = values[i];
102
                    }
103
                    else {
104
                        this.getElementsByTagName('input')[1].value = "";
105
                    }
85
                    }
106
                    i++;
86
107
                });
87
                    // Create the correct number of form fields for all values
108
            }
88
                    // If the field cloning failed, only the first value will be added to the form.
109
            [% UNLESS ( clear ) %]
89
                    SetSubfieldNumber(subfield_name, values.length);
110
                [% FOREACH SUBFIELD_LOO IN SUBFIELD_LOOP %]
90
111
                    SetSubfieldValues(
91
                    // Find the subfields where we will add the new values
112
                        "[% To.json(tag_number) | $raw %][% To.json(SUBFIELD_LOO.marc_subfield) | $raw %]"
92
                    var re = new RegExp('^subfield' + subfield_name,'g');
113
                    [% FOREACH marc_value IN SUBFIELD_LOO.marc_values %]
93
                    var subfields = $(field_start).children('ul').children('li').filter( function() {
114
                        ,"[% To.json( marc_value ) | $raw %]"
94
                        return this.id.match(re);
95
                    });
96
97
                    // Add the new values to those subfields, empty the additional fields
98
                    var i=0;
99
                    subfields.each(function() {
100
                        if(i in values) {
101
                            this.getElementsByTagName('input')[1].value = values[i];
102
                        }
103
                        else {
104
                            this.getElementsByTagName('input')[1].value = "";
105
                        }
106
                        i++;
107
                    });
108
                }
109
                [% UNLESS ( clear ) %]
110
                    [% FOREACH SUBFIELD_LOO IN SUBFIELD_LOOP %]
111
                        SetSubfieldValues(
112
                            "[% To.json(tag_number) | $raw %][% To.json(SUBFIELD_LOO.marc_subfield) | $raw %]"
113
                        [% FOREACH marc_value IN SUBFIELD_LOO.marc_values %]
114
                            ,"[% To.json( marc_value ) | $raw %]"
115
                        [% END %]
116
                        );
117
                    [% END %]
118
                    var indicators = field_start.getElementsByClassName('indicator flat');
119
                    [% IF update_ind1 %]
120
                        indicators[0].value="[% indicator1 | html %]";
121
                    [% END %]
122
                    [% IF update_ind2 %]
123
                        indicators[1].value="[% indicator2 | html %]";
115
                    [% END %]
124
                    [% END %]
116
                    );
117
                [% END %]
118
                var indicators = field_start.getElementsByClassName('indicator flat');
119
                [% IF update_ind1 %]
120
                    indicators[0].value="[% indicator1 | html %]";
121
                [% END %]
122
                [% IF update_ind2 %]
123
                    indicators[1].value="[% indicator2 | html %]";
124
                [% END %]
125
                [% END %]
125
            [% END %]
126
127
            // browse all its subfields (clear and $9)
128
            var subfields = field_start.getElementsByTagName('input');
129
            var re = /^tag_\d*_code_/;
130
            for(var i=0, len = subfields.length ; i< len ; i++) { // browse all subfields
131
                if(subfields[i].hasAttribute('name') == 0 ) {continue; }  // div elements specific to Select2
132
                if(subfields[i].getAttribute('name').match(re)){ // it s a subfield
133
                    var code     = subfields[i];   // code is the first input
134
                    var subfield = subfields[i+1]; // subfield the second
135
126
136
                [% IF ( clear ) %]
127
                // browse all its subfields (clear and $9)
137
                    if (subfield){subfield.value="" ;}
128
                var subfields = field_start.getElementsByTagName('input');
138
                [% ELSE %]
129
                var re = /^tag_\d*_code_/;
139
                    if(code.value=='9'){
130
                for(var i=0, len = subfields.length ; i< len ; i++) { // browse all subfields
140
                        subfield.value = "[% To.json(authid) | $raw %]";
131
                    if(subfields[i].hasAttribute('name') == 0 ) {continue; }  // div elements specific to Select2
141
                        break;
132
                    if(subfields[i].getAttribute('name').match(re)){ // it s a subfield
133
                        var code     = subfields[i];   // code is the first input
134
                        var subfield = subfields[i+1]; // subfield the second
135
136
                    [% IF ( clear ) %]
137
                        if (subfield){subfield.value="" ;}
138
                    [% ELSE %]
139
                        if(code.value=='9'){
140
                            subfield.value = "[% To.json(authid) | $raw %]";
141
                            break;
142
                        }
143
                    [% END %]
142
                    }
144
                    }
143
                [% END %]
144
                }
145
                }
145
            }
146
            [% END %]
146
            [% END %]
147
147
148
            opener.close();
148
            opener.close();
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/cataloguing/addbiblio.tt (-65 / +69 lines)
Lines 7-12 Link Here
7
[% Asset.js("lib/hc-sticky.js") | $raw %]
7
[% Asset.js("lib/hc-sticky.js") | $raw %]
8
<script>
8
<script>
9
    var CAN_user_parameters_manage_auth_values = "[% CAN_user_parameters_manage_auth_values | html %]";
9
    var CAN_user_parameters_manage_auth_values = "[% CAN_user_parameters_manage_auth_values | html %]";
10
    var select2Width = "100%";
10
</script>
11
</script>
11
[% INCLUDE 'select2.inc' %]
12
[% INCLUDE 'select2.inc' %]
12
[% Asset.js("js/cataloging.js") | $raw %]
13
[% Asset.js("js/cataloging.js") | $raw %]
Lines 484-490 Link Here
484
485
485
</script>
486
</script>
486
[% Asset.css("css/addbiblio.css") | $raw %]
487
[% Asset.css("css/addbiblio.css") | $raw %]
487
488
</head>
488
</head>
489
<body id="cat_addbiblio" class="cat">
489
<body id="cat_addbiblio" class="cat">
490
490
Lines 789-877 Link Here
789
                                        [% FOREACH subfield_loo IN innerloo.subfield_loop %]
789
                                        [% FOREACH subfield_loo IN innerloo.subfield_loop %]
790
                                            <!--  One line on the marc editor -->
790
                                            <!--  One line on the marc editor -->
791
                                            <li class="subfield_line" style="[% subfield_loo.visibility | html %]" id="subfield[% subfield_loo.tag | html %][% subfield_loo.subfield | html %][% subfield_loo.random | html %]">
791
                                            <li class="subfield_line" style="[% subfield_loo.visibility | html %]" id="subfield[% subfield_loo.tag | html %][% subfield_loo.subfield | html %][% subfield_loo.random | html %]">
792
                                                <div class="subfieldcode">
793
                                                    <input type="text"
794
                                                            title="[% subfield_loo.marc_lib | $raw %]"
795
                                                            style=" [% IF ( subfield_loo.fixedfield ) %]display:none; [% END %]border:0;"
796
                                                            name="tag_[% subfield_loo.tag | html %]_code_[% subfield_loo.subfield | html %]_[% subfield_loo.index | html %]_[% subfield_loo.index_subfield | html %]"
797
                                                            value="[% subfield_loo.subfield | html %]"
798
                                                            size="1"
799
                                                            maxlength="1"
800
                                                            class="flat"
801
                                                            tabindex="0" />
802
                                                </div>
792
                                                [% UNLESS advancedMARCEditor %]
803
                                                [% UNLESS advancedMARCEditor %]
793
                                                    [% IF ( subfield_loo.fixedfield ) %]
804
                                                    [% IF ( subfield_loo.mandatory ) %]
794
                                                        <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">
805
                                                        <div class="subfield subfield_mandatory">
806
                                                    [% ELSIF ( subfield_loo.important ) %]
807
                                                        <div class="subfield subfield_important">
795
                                                    [% ELSE %]
808
                                                    [% ELSE %]
796
                                                        <label for="tag_[% subfield_loo.tag | html %]_subfield_[% subfield_loo.subfield | html %]_[% subfield_loo.index | html %]_[% subfield_loo.index_subfield | html %]" class="labelsubfield">
809
                                                        <div class="subfield">
797
                                                    [% END %]
810
                                                    [% END %]
798
                                                [% END %]
811
                                                        [% IF ( subfield_loo.fixedfield ) %]
799
812
                                                            <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">
800
                                                    <span class="subfieldcode">
801
                                                            <input type="text"
802
                                                                title="[% subfield_loo.marc_lib | $raw %]"
803
                                                                style=" [% IF ( subfield_loo.fixedfield ) %]display:none; [% END %]border:0;"
804
                                                                name="tag_[% subfield_loo.tag | html %]_code_[% subfield_loo.subfield | html %]_[% subfield_loo.index | html %]_[% subfield_loo.index_subfield | html %]"
805
                                                                value="[% subfield_loo.subfield | html %]"
806
                                                                size="1"
807
                                                                maxlength="1"
808
                                                                class="flat"
809
                                                                tabindex="0" />
810
                                                    </span>
811
812
                                                [% UNLESS advancedMARCEditor %]
813
                                                        [% IF ( subfield_loo.mandatory ) %]
814
                                                            <span class="subfield subfield_mandatory">
815
                                                        [% ELSIF ( subfield_loo.important ) %]
816
                                                            <span class="subfield subfield_important">
817
                                                        [% ELSE %]
813
                                                        [% ELSE %]
818
                                                            <span class="subfield">
814
                                                            <label for="tag_[% subfield_loo.tag | html %]_subfield_[% subfield_loo.subfield | html %]_[% subfield_loo.index | html %]_[% subfield_loo.index_subfield | html %]" class="labelsubfield">
819
                                                        [% END %]
815
                                                        [% END %]
820
                                                        [% subfield_loo.marc_lib | $raw %]
816
                                                        [% subfield_loo.marc_lib | $raw %]
821
                                                        </span>
817
                                                        </label>
822
                                                    </label>
818
                                                    </div>
823
                                                [% END %]
819
                                                [% END %]
824
820
825
                                                [% SET mv = subfield_loo.marc_value %]
821
                                                [% SET mv = subfield_loo.marc_value %]
826
                                                [% IF ( mv.type == 'text' ) %]
822
                                                <div id="field_marceditor[% subfield_loo.tag | html %][% subfield_loo.subfield | html %][% subfield_loo.random | html %]" class="field_marceditor">
827
                                                    [% IF ( mv.readonly == 1 ) %]
823
                                                    [% IF ( mv.type == 'text' ) %]
828
                                                        <input type="text" id="[%- mv.id | html -%]" name="[%- mv.name | html -%]" value="[%- mv.value | html -%]" class="input_marceditor readonly" tabindex="1" size="[%- mv.size | html -%]" maxlength="[%- mv.maxlength | html -%]" readonly="readonly" />
824
                                                        [% IF ( mv.readonly == 1 ) %]
829
                                                    [% ELSE %]
825
                                                            <input type="text" id="[%- mv.id | html -%]" name="[%- mv.name | html -%]" value="[%- mv.value | html -%]" class="input_marceditor readonly" tabindex="1" size="[%- mv.size | html -%]" maxlength="[%- mv.maxlength | html -%]" readonly="readonly" />
830
                                                        <input type="text" id="[%- mv.id | html -%]" name="[%- mv.name | html -%]" value="[%- mv.value | html -%]" class="input_marceditor" tabindex="1" size="[%- mv.size | html -%]" maxlength="[%- mv.maxlength | html -%]" />
831
                                                    [% END %]
832
833
                                                    [% IF ( mv.authtype ) %]
834
                                                        <span class="subfield_controls"><a href="#" class="buttonDot tag_editor" onclick="openAuth(this.parentNode.parentNode.getElementsByTagName('input')[1].id,'[%- mv.authtype | html -%]','biblio'); return false;" tabindex="1" title="Tag editor">Tag editor</a></span>
835
                                                    [% END %]
836
                                                [% ELSIF ( mv.type == 'text_complex' ) %]
837
                                                    <input type="text" id="[%- mv.id | html -%]" name="[%- mv.name | html -%]" value="[%- mv.value | html -%]" class="input_marceditor framework_plugin" tabindex="1" size="[%- mv.size | html -%]" maxlength="[%- mv.maxlength | html -%]" />
838
                                                    <span class="subfield_controls">
839
                                                        [% IF mv.noclick %]
840
                                                            <span class="buttonDot tag_editor disabled" tabindex="-1" title="Field autofilled by plugin"></span>
841
                                                        [% ELSE %]
826
                                                        [% ELSE %]
842
                                                            [% IF mv.plugin == "upload.pl" %]
827
                                                            <input type="text" id="[%- mv.id | html -%]" name="[%- mv.name | html -%]" value="[%- mv.value | html -%]" class="input_marceditor" tabindex="1" size="[%- mv.size | html -%]" maxlength="[%- mv.maxlength | html -%]" />
843
                                                                <a href="#" id="buttonDot_[% mv.id | html %]" class="tag_editor upload framework_plugin" tabindex="1"><i class="fa fa-upload" aria-hidden="true"></i> Upload</a>
844
                                                            [% ELSE %]
845
                                                                <a href="#" id="buttonDot_[% mv.id | html %]" class="buttonDot tag_editor framework_plugin" tabindex="1" title="Tag editor">Tag editor</a>
846
                                                            [% END %]
847
                                                        [% END %]
828
                                                        [% END %]
848
                                                    </span>
829
849
                                                    [% mv.javascript | $raw %]
830
                                                    [% ELSIF ( mv.type == 'text_complex' ) %]
850
                                                [% ELSIF ( mv.type == 'hidden' ) %]
831
                                                        <input type="text" id="[%- mv.id | html -%]" name="[%- mv.name | html -%]" value="[%- mv.value | html -%]" class="input_marceditor framework_plugin" tabindex="1" size="[%- mv.size | html -%]" maxlength="[%- mv.maxlength | html -%]" />
851
                                                    <input tabindex="1" type="hidden" id="[%- mv.id | html -%]" name="[%- mv.name | html -%]" size="[%- mv.size | html -%]" maxlength="[%- mv.maxlength | html -%]" value="[%- mv.value | html -%]" />
832
                                                        [% mv.javascript | $raw %]
852
                                                [% ELSIF ( mv.type == 'textarea' ) %]
833
                                                    [% ELSIF ( mv.type == 'hidden' ) %]
853
                                                    <textarea cols="70" rows="4" id="[%- mv.id | html -%]" name="[%- mv.name | html -%]" class="input_marceditor" tabindex="1">[%- mv.value | html -%]</textarea>
834
                                                        <input tabindex="1" type="hidden" id="[%- mv.id | html -%]" name="[%- mv.name | html -%]" size="[%- mv.size | html -%]" maxlength="[%- mv.maxlength | html -%]" value="[%- mv.value | html -%]" />
854
                                                [% ELSIF ( mv.type == 'select' ) %]
835
                                                    [% ELSIF ( mv.type == 'textarea' ) %]
836
                                                        <textarea cols="70" rows="4" id="[%- mv.id | html -%]" name="[%- mv.name | html -%]" class="input_marceditor" tabindex="1">[%- mv.value | html -%]</textarea>
837
                                                    [% ELSIF ( mv.type == 'select' ) %]
855
                                                    [% IF mv.category AND CAN_user_parameters_manage_auth_values %]
838
                                                    [% IF mv.category AND CAN_user_parameters_manage_auth_values %]
856
                                                        <select name="[%- mv.name | html -%]" tabindex="1" size="1" class="input_marceditor" id="[%- mv.id | html -%]" data-category="[% mv.category | html %]">
839
                                                        <select name="[%- mv.name | html -%]" tabindex="1" size="1" class="input_marceditor" id="[%- mv.id | html -%]" data-category="[% mv.category | html %]">
857
                                                    [% ELSE %]
840
                                                    [% ELSE %]
858
                                                        <select name="[%- mv.name | html -%]" tabindex="1" size="1" class="input_marceditor select2" id="[%- mv.id | html -%]">
841
                                                        <select name="[%- mv.name | html -%]" tabindex="1" size="1" class="input_marceditor select2" id="[%- mv.id | html -%]">
859
                                                    [% END %]
842
                                                    [% END %]
860
                                                    [% FOREACH aval IN mv.values %]
843
                                                        [% FOREACH aval IN mv.values %]
861
                                                        [% IF aval == mv.default %]
844
                                                            [% IF aval == mv.default %]
862
                                                        <option value="[%- aval | html -%]" selected="selected">[%- mv.labels.$aval | html -%]</option>
845
                                                            <option value="[%- aval | html -%]" selected="selected">[%- mv.labels.$aval | html -%]</option>
863
                                                        [% ELSE %]
846
                                                            [% ELSE %]
864
                                                        <option value="[%- aval | html -%]">[%- mv.labels.$aval | html -%]</option>
847
                                                            <option value="[%- aval | html -%]">[%- mv.labels.$aval | html -%]</option>
848
                                                            [% END %]
865
                                                        [% END %]
849
                                                        [% END %]
866
                                                    [% END %]
850
                                                        </select>
867
                                                    </select>
851
                                                    [% END  # /IF (mv.type...) %]
868
                                                [% END  # /IF (mv.type...) %]
852
                                                </div>
869
                                                [% IF ( subfield_loo.mandatory ) %]
853
                                                [% IF ( subfield_loo.mandatory ) %]
870
                                                    <span class="required">Required</span>
854
                                                    <div class="subfield_loop_mandatory">
855
                                                        <span class="required">Required</span>
856
                                                    </div>
871
                                                [% ELSIF ( subfield_loo.important ) %]
857
                                                [% ELSIF ( subfield_loo.important ) %]
872
                                                    <span class="important">Important</span>
858
                                                    <div class="subfield_loop_mandatory">
859
                                                        <span class="important">Important</span>
860
                                                    </div>
873
                                                [% END %]
861
                                                [% END %]
874
                                                <span class="subfield_controls">
862
                                                <div class="subfield_controls">
863
                                                    [% IF ( mv.type == 'text' ) %]
864
                                                        [% IF ( mv.authtype ) %]
865
                                                            <a href="#" class="buttonDot tag_editor" onclick="openAuth(this.parentNode.parentNode.getElementsByTagName('input')[1].id,'[%- mv.authtype | html -%]','biblio'); return false;" tabindex="1" title="Tag editor">Tag editor</a>
866
                                                        [% END %]
867
                                                    [% ELSIF ( mv.type == 'text_complex' ) %]
868
                                                            [% IF mv.noclick %]
869
                                                                <span class="buttonDot tag_editor disabled" tabindex="-1" title="Field autofilled by plugin"></span>
870
                                                            [% ELSE %]
871
                                                                [% IF mv.plugin == "upload.pl" %]
872
                                                                    <a href="#" id="buttonDot_[% mv.id | html %]" class="tag_editor upload framework_plugin" tabindex="1"><i class="fa fa-upload" aria-hidden="true"></i> Upload</a>
873
                                                                [% ELSE %]
874
                                                                    <a href="#" id="buttonDot_[% mv.id | html %]" class="buttonDot tag_editor framework_plugin" tabindex="1" title="Tag editor">Tag editor</a>
875
                                                                [% END %]
876
                                                            [% END %]
877
                                                        </span>
878
                                                    [% END %]
875
                                                    [% IF ( subfield_loo.repeatable ) %]
879
                                                    [% IF ( subfield_loo.repeatable ) %]
876
                                                        <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;">
880
                                                        <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;">
877
                                                            <img src="[% interface | html %]/[% theme | html %]/img/clone-subfield.png" alt="Clone" title="Clone this subfield" />
881
                                                            <img src="[% interface | html %]/[% theme | html %]/img/clone-subfield.png" alt="Clone" title="Clone this subfield" />
Lines 880-886 Link Here
880
                                                            <img src="[% interface | html %]/[% theme | html %]/img/delete-subfield.png" alt="Delete" title="Delete this subfield" />
884
                                                            <img src="[% interface | html %]/[% theme | html %]/img/delete-subfield.png" alt="Delete" title="Delete this subfield" />
881
                                                        </a>
885
                                                        </a>
882
                                                    [% END %]
886
                                                    [% END %]
883
                                                </span>
887
                                                </div>
884
                                            </li> <!-- /.subfield_line -->
888
                                            </li> <!-- /.subfield_line -->
885
                                            <!-- End of the line -->
889
                                            <!-- End of the line -->
886
                                        [% END # /FOREACH subfield_loop %]
890
                                        [% END # /FOREACH subfield_loop %]
(-)a/koha-tmpl/intranet-tmpl/prog/js/cataloging.js (-34 / +36 lines)
Lines 65-74 function ExpandField(index) { Link Here
65
        if(lis[i].getAttribute('id').match(/^subfield/)){  // if it s a subfield
65
        if(lis[i].getAttribute('id').match(/^subfield/)){  // if it s a subfield
66
            if (!lis[i].style.display) {
66
            if (!lis[i].style.display) {
67
                // first time => show all subfields
67
                // first time => show all subfields
68
                lis[i].style.display = 'block';
68
                lis[i].style.display = 'flex';
69
            } else if (lis[i].style.display == 'none') {
69
            } else if (lis[i].style.display == 'none') {
70
                // show
70
                // show
71
                lis[i].style.display = 'block';
71
                lis[i].style.display = 'flex';
72
            } else {
72
            } else {
73
                // hide
73
                // hide
74
                lis[i].style.display = 'none';
74
                lis[i].style.display = 'none';
Lines 174-180 function CloneField(index, hideMarc, advancedMARCEditor) { Link Here
174
    // settings all subfields
174
    // settings all subfields
175
    var divslen = divs.length;
175
    var divslen = divs.length;
176
    for( i=0; i < divslen ; i++ ){      // foreach div/li
176
    for( i=0; i < divslen ; i++ ){      // foreach div/li
177
        if(divs[i].getAttribute("id").match(/^subfield/)){  // if it s a subfield
177
        if( divs[i].getAttribute("id") && divs[i].getAttribute("id").match(/^subfield/)){  // if it s a subfield
178
178
179
            // set the attribute for the new 'li' subfields
179
            // set the attribute for the new 'li' subfields
180
            divs[i].setAttribute('id',divs[i].getAttribute('id')+new_key);
180
            divs[i].setAttribute('id',divs[i].getAttribute('id')+new_key);
Lines 195-232 function CloneField(index, hideMarc, advancedMARCEditor) { Link Here
195
                    textareas[j].value = "";
195
                    textareas[j].value = "";
196
                }
196
                }
197
            }
197
            }
198
            if( inputs.length > 0 ){
199
                inputs[0].setAttribute('id',inputs[0].getAttribute('id')+new_key);
200
                inputs[0].setAttribute('name',inputs[0].getAttribute('name')+new_key);
198
201
199
            inputs[0].setAttribute('id',inputs[0].getAttribute('id')+new_key);
202
                try {
200
            inputs[0].setAttribute('name',inputs[0].getAttribute('name')+new_key);
203
                    id_input = inputs[1].getAttribute('id')+new_key;
201
204
                    inputs[1].setAttribute('id',id_input);
202
            try {
205
                    inputs[1].setAttribute('name',inputs[1].getAttribute('name')+new_key);
203
                id_input = inputs[1].getAttribute('id')+new_key;
206
                } catch(e) {
204
                inputs[1].setAttribute('id',id_input);
207
                    try{ // it s a select if it is not an input
205
                inputs[1].setAttribute('name',inputs[1].getAttribute('name')+new_key);
208
                        var selects = divs[i].getElementsByTagName('select');
206
            } catch(e) {
209
                        id_input = selects[0].getAttribute('id')+new_key;
207
                try{ // it s a select if it is not an input
210
                        selects[0].setAttribute('id',id_input);
208
                    var selects = divs[i].getElementsByTagName('select');
211
                        selects[0].setAttribute('name',selects[0].getAttribute('name')+new_key);
209
                    id_input = selects[0].getAttribute('id')+new_key;
212
                    }catch(e2){ // it is a textarea if it s not a select or an input
210
                    selects[0].setAttribute('id',id_input);
213
                        var textareas = divs[i].getElementsByTagName('textarea');
211
                    selects[0].setAttribute('name',selects[0].getAttribute('name')+new_key);
214
                        if( textareas.length > 0 ){
212
                }catch(e2){ // it is a textarea if it s not a select or an input
215
                            id_input = textareas[0].getAttribute('id')+new_key;
213
                    var textaeras = divs[i].getElementsByTagName('textarea');
216
                            textareas[0].setAttribute('id',id_input);
214
                    id_input = textaeras[0].getAttribute('id')+new_key;
217
                            textareas[0].setAttribute('name',textareas[0].getAttribute('name')+new_key);
215
                    textaeras[0].setAttribute('id',id_input);
218
                        }
216
                    textaeras[0].setAttribute('name',textaeras[0].getAttribute('name')+new_key);
219
                    }
220
                }
221
                if( $(inputs[1]).hasClass('framework_plugin') ) {
222
                    olddiv= original.getElementsByTagName('li')[i];
223
                    oldcontrol= olddiv.getElementsByTagName('input')[1];
224
                    AddEventHandlers( oldcontrol,inputs[1],id_input );
217
                }
225
                }
218
            }
226
            }
219
            if( $(inputs[1]).hasClass('framework_plugin') ) {
227
            // when cloning a subfield, re set its label too.
220
                olddiv= original.getElementsByTagName('li')[i];
228
            var labels = divs[i].getElementsByTagName('label');
221
                oldcontrol= olddiv.getElementsByTagName('input')[1];
229
            labels[0].setAttribute('for', id_input);
222
                AddEventHandlers( oldcontrol,inputs[1],id_input );
223
            }
224
225
            if (advancedMARCEditor == '0') {
226
                // when cloning a subfield, re set its label too.
227
                var labels = divs[i].getElementsByTagName('label');
228
                labels[0].setAttribute('for',id_input);
229
            }
230
230
231
            // setting its '+' and '-' buttons
231
            // setting its '+' and '-' buttons
232
            try {
232
            try {
Lines 277-283 function CloneField(index, hideMarc, advancedMARCEditor) { Link Here
277
            }
277
            }
278
278
279
        } else { // it's a indicator div
279
        } else { // it's a indicator div
280
            if(divs[i].getAttribute('id').match(/^div_indicator/)){
280
            if ( divs[i].getAttribute("id") && divs[i].getAttribute('id').match(/^div_indicator/)) {
281
281
282
                // setting a new id for the indicator div
282
                // setting a new id for the indicator div
283
                divs[i].setAttribute('id',divs[i].getAttribute('id')+new_key);
283
                divs[i].setAttribute('id',divs[i].getAttribute('id')+new_key);
Lines 381-387 function CloneSubfield(index, advancedMARCEditor){ Link Here
381
    if(advancedMARCEditor == '0') {
381
    if(advancedMARCEditor == '0') {
382
        // when cloning a subfield, reset its label too.
382
        // when cloning a subfield, reset its label too.
383
        var label = clone.getElementsByTagName('label')[0];
383
        var label = clone.getElementsByTagName('label')[0];
384
        label.setAttribute('for',id_input);
384
        if( label ){
385
            label.setAttribute('for',id_input);
386
        }
385
    }
387
    }
386
388
387
    // setting a new id for the parent div
389
    // setting a new id for the parent div
(-)a/koha-tmpl/intranet-tmpl/prog/js/select2.js (-2 / +1 lines)
Lines 1-7 Link Here
1
/* global __ */
1
/* global __ */
2
$.fn.select2.defaults.set("allowClear", true);
2
$.fn.select2.defaults.set("allowClear", true);
3
$.fn.select2.defaults.set("placeholder", "");
3
$.fn.select2.defaults.set("placeholder", "");
4
$.fn.select2.defaults.set("width", "element");
4
$.fn.select2.defaults.set("width", select2Width || "element" );
5
5
6
// Internationalization
6
// Internationalization
7
$.fn.select2.defaults.set("language", {
7
$.fn.select2.defaults.set("language", {
8
- 

Return to bug 22399