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

(-)a/koha-tmpl/intranet-tmpl/prog/en/includes/marc_editor.inc (+397 lines)
Line 0 Link Here
1
[% USE Koha %]
2
<script type="text/javascript">
3
//<![CDATA[
4
5
$(document).ready(function() {
6
    /* check cookie to hide/show marcdocs*/
7
    if($.cookie("marcdocs_[% borrowernumber | html %]") == 'hide'){
8
        toggleMARCdocLinks(false);
9
    } else {
10
        toggleMARCdocLinks(true);
11
    }
12
13
    $("#marcDocsSelect").click(function(){
14
        if($.cookie("marcdocs_[% borrowernumber | html %]") == 'hide'){
15
            toggleMARCdocLinks(true);
16
        } else {
17
            toggleMARCdocLinks(false);
18
        }
19
    });
20
21
    /* check cookie to hide/show marc tags*/
22
    var marctags_cookie = $.cookie("marctags_[% borrowernumber | html %]");
23
    if( marctags_cookie == 'hide'){
24
        toggleMARCTagLinks(false);
25
    } else if( marctags_cookie == 'show'){
26
        toggleMARCTagLinks(true)
27
    } else {
28
        [% UNLESS Koha.Preference("hide_marc") %]
29
            toggleMARCTagLinks(true)
30
        [% ELSE %]
31
            toggleMARCTagLinks(false);
32
        [% END %]
33
    }
34
35
    $("#marcTagsSelect").click(function(){
36
        if( $.cookie("marctags_[% borrowernumber | html %]") == 'hide'){
37
            toggleMARCTagLinks(true)
38
        } else {
39
            toggleMARCTagLinks(false);
40
        }
41
    });
42
});
43
44
function PopupMARCFieldDoc(field) {
45
    [% IF Koha.Preference('marcfielddocurl') %]
46
        var docurl = "[% Koha.Preference('marcfielddocurl').replace('"','&quot;') | html %]";
47
        docurl = docurl.replace("{MARC}", "[% marcflavour | html %]");
48
        docurl = docurl.replace("{FIELD}", ""+field);
49
        docurl = docurl.replace("{LANG}", "[% lang | html %]");
50
        window.open(docurl);
51
    [% ELSIF ( marcflavour == 'MARC21' ) %]
52
        _MARC21FieldDoc(field);
53
    [% ELSIF ( marcflavour == 'UNIMARC' ) %]
54
        _UNIMARCFieldDoc(field);
55
    [% END %]
56
}
57
58
function _MARC21FieldDoc(field) {
59
    if(field == 0) {
60
        window.open("[%marc21_doc_base | html %]leader.html");
61
    } else if (field < 900) {
62
        window.open("[%marc21_doc_base | html %]" + ("000"+field).slice(-3) + ".html");
63
    } else {
64
        window.open("[%marc21_doc_base | html %]9xx.html");
65
    }
66
}
67
68
function _UNIMARCFieldDoc(field) {
69
    /* Outdated but linkable HTML documentation used to be available at
70
       http://archive.ifla.org/VI/3/p1996-1/, but that's no longer the case. More recent
71
       versions of the UNIMARC standard are available on the IFLA website only as
72
       PDFs (with non-predictable URLs), so just link to the front page.
73
    */
74
    window.open("[%unimarc_doc_base | html %]");
75
}
76
77
/*
78
 * Functions to hide/show marc docs and tags links
79
 */
80
81
function toggleMARCdocLinks(flag){
82
    if( flag === true ){
83
        $(".marcdocs").show();
84
        $.cookie("marcdocs_[% borrowernumber | html %]",'show', { path: "/", expires: 365 });
85
        $("#marcDocsSelect i").addClass('fa-check-square-o').removeClass('fa-square-o');
86
    } else {
87
        $(".marcdocs").hide();
88
        $.cookie("marcdocs_[% borrowernumber | html %]",'hide', { path: "/", expires: 365 });
89
        $("#marcDocsSelect i").removeClass('fa-check-square-o').addClass('fa-square-o');
90
    }
91
}
92
93
function toggleMARCTagLinks(flag){
94
    if( flag === true ){
95
        $(".tagnum").show();
96
        $(".subfieldcode").show();
97
        $.cookie("marctags_[% borrowernumber | html %]",'show', { path: "/", expires: 365 });
98
        $("#marcTagsSelect i").addClass('fa-check-square-o').removeClass('fa-square-o');
99
    } else {
100
        $(".tagnum").hide();
101
        $(".subfieldcode").hide();
102
        $.cookie("marctags_[% borrowernumber | html %]",'hide', { path: "/", expires: 365 });
103
        $("#marcTagsSelect i").removeClass('fa-check-square-o').addClass('fa-square-o');
104
    }
105
}
106
107
/**
108
 * check if mandatory subfields are written
109
 */
110
function AreMandatoriesNotOk(){
111
    var mandatories = new Array();
112
    var mandatoriesfields = new Array();
113
    var tab = new Array();
114
    var label = new Array();
115
    var flag=0;
116
    var tabflag= new Array();
117
    [% FOREACH BIG_LOO IN BIG_LOOP %]
118
        [% FOREACH innerloo IN BIG_LOO.innerloop %]
119
            [% IF ( innerloo.mandatory ) %]
120
                mandatoriesfields.push(new Array("[% innerloo.tag | html %]","[% innerloo.index | html %][% innerloo.random | html %]","[% innerloo.index | html %]"));
121
            [% END %]
122
            [% FOREACH subfield_loo IN innerloo.subfield_loop %]
123
                [% IF ( subfield_loo.mandatory ) %]mandatories.push("[% subfield_loo.id | html %]");
124
                       tab.push("[% BIG_LOO.number | html %]");
125
                    label.push("[% subfield_loo.marc_lib | $raw %]");
126
                [% END %]
127
            [% END %]
128
        [% END %]
129
    [% END %]
130
    var StrAlert = _("Can't save this record because the following field aren't filled:");
131
    StrAlert += "\n\n";
132
    for(var i=0,len=mandatories.length; i<len ; i++){
133
        var tag=mandatories[i].substr(4,3);
134
        var subfield=mandatories[i].substr(17,1);
135
        var tagnumber=mandatories[i].substr(19,mandatories[i].lastIndexOf("_")-19);
136
        if (tabflag[tag+subfield+tagnumber] ==  null) {
137
            tabflag[tag+subfield+tagnumber]=new Array();
138
            tabflag[tag+subfield+tagnumber][0]=0;
139
        }
140
        if( tabflag[tag+subfield+tagnumber][0] != 1 && (document.getElementById(mandatories[i]) != null && ! document.getElementById(mandatories[i]).value || document.getElementById(mandatories[i]) == null)){
141
            tabflag[tag+subfield+tagnumber][0] = 0 + tabflag[tag+subfield+tagnumber] ;
142
            document.getElementById(mandatories[i]).setAttribute('class','subfield_not_filled');
143
            $('#' + mandatories[i]).focus();
144
            tabflag[tag+subfield+tagnumber][1]=label[i];
145
            tabflag[tag+subfield+tagnumber][2]=tab[i];
146
        } else {
147
            tabflag[tag+subfield+tagnumber][0] = 1;
148
        }
149
    }
150
    for (var tagsubfieldid in tabflag){
151
      if (tabflag[tagsubfieldid][0]==0){
152
        var tag=tagsubfieldid.substr(0,3);
153
        var subfield=tagsubfieldid.substr(3,1);
154
        StrAlert += "\t* "+_("tag %s subfield %s %s in tab %s").format(tag, subfield, tabflag[tagsubfieldid][1], tabflag[tagsubfieldid][2]) + "\n";
155
        //StrAlert += "\t* "+label[i]+_(" in tab ")+tab[i]+"\n";
156
        flag=1;
157
      }
158
    }
159
160
    /* Check for mandatories field(not subfields) */
161
    for(var i=0,len=mandatoriesfields.length; i<len; i++){
162
        isempty  = true;
163
        arr      = mandatoriesfields[i];
164
        divid    = "tag_" + arr[0] + "_" + arr[1];
165
        varegexp = new RegExp("^tag_" + arr[0] + "_code_");
166
167
        if(parseInt(arr[0]) >= 10){
168
            elem = document.getElementById(divid);
169
            eleminputs = elem.getElementsByTagName('input');
170
171
            for(var j=0,len2=eleminputs.length; j<len2; j++){
172
173
                if(eleminputs[j].name.match(varegexp) && eleminputs[j].value){
174
                    inputregexp = new RegExp("^tag_" + arr[0] + "_subfield_" + eleminputs[j].value + "_" + arr[2]);
175
176
                    for( var k=0; k<len2; k++){
177
                        if(eleminputs[k].id.match(inputregexp) && eleminputs[k].value){
178
                            isempty = false
179
                        }
180
                    }
181
182
                    elemselect = elem.getElementsByTagName('select');
183
                    for( var k=0; k<elemselect.length; k++){
184
                        if(elemselect[k].id.match(inputregexp) && elemselect[k].value){
185
                            isempty = false
186
                        }
187
                    }
188
                }
189
            }
190
191
            elemtextareas = elem.getElementsByTagName('textarea');
192
            for(var j=0,len2=elemtextareas.length; j<len2; j++){
193
                // this bit assumes that the only textareas in this context would be for subfields
194
                if (elemtextareas[j].value) {
195
                    isempty = false;
196
                }
197
            }
198
        }else{
199
            isempty = false;
200
        }
201
202
        if(isempty){
203
            flag = 1;
204
                StrAlert += "\t* " + _("Field %s is mandatory, at least one of its subfields must be filled.").format(arr[0]) + "\n";
205
        }
206
207
    }
208
209
    if(flag){
210
        return StrAlert;
211
    } else {
212
        return flag;
213
    }
214
}
215
216
/**
217
 * Check that the record is ok
218
 */
219
function Check(){
220
    var StrAlert = AreMandatoriesNotOk();
221
    if( ! StrAlert ){
222
        document.f.submit();
223
        return true;
224
    } else {
225
        alert(StrAlert);
226
        return false;
227
    }
228
}
229
//]]>
230
</script>
231
232
<div id="[% maindiv | html %]" class="toptabs numbered">
233
    <ul>
234
        [% FOREACH BIG_LOO IN BIG_LOOP %]
235
            <li><a href="#tab[% BIG_LOO.number | uri %]XX">[% BIG_LOO.number | html %]</a></li>
236
        [% END %]
237
    </ul>
238
239
[% FOREACH BIG_LOO IN BIG_LOOP %]
240
    <div id="tab[% BIG_LOO.number | html %]XX">
241
242
    [% IF ( BIG_LOOP.size > 1 ) %]
243
        <h3>Section [% BIG_LOO.number | html %]</h3>
244
    [% END %]
245
    [% FOREACH innerloo IN BIG_LOO.innerloop %]
246
    [% IF ( innerloo.tag ) %]
247
    <div class="tag clearfix" id="tag_[% innerloo.tag | html %]_[% innerloo.index | html %][% innerloo.random | html %]">
248
        <div class="tag_title" id="div_indicator_tag_[% innerloo.tag | html %]_[% innerloo.index | html %][% innerloo.random | html %]">
249
            [% IF advancedMARCEditor %]
250
                <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>
251
            [% ELSE %]
252
                <span class="tagnum" title="[% innerloo.tag_lib | html %]">[% innerloo.tag | html %]</span>
253
                [% IF marcflavour != 'NORMARC' %]<a href="#" class="marcdocs" onclick="PopupMARCFieldDoc('[% innerloo.tag | html %]'); return false;">&nbsp;?</a>[% END %]
254
            [% END %]
255
                [% IF ( innerloo.fixedfield ) %]
256
                    <input type="text"
257
                        tabindex="1"
258
                        class="indicator flat"
259
                        style="display:none;"
260
                        name="tag_[% innerloo.tag | html %]_indicator1_[% innerloo.index | html %][% innerloo.random | html %]"
261
                        size="1"
262
                        maxlength="1"
263
                        value="[% innerloo.indicator1 | html %]" />
264
                    <input type="text"
265
                        tabindex="1"
266
                        class="indicator flat"
267
                        style="display:none;"
268
                        name="tag_[% innerloo.tag | html %]_indicator2_[% innerloo.index | html %][% innerloo.random | html %]"
269
                        size="1"
270
                        maxlength="1"
271
                        value="[% innerloo.indicator2 | html %]" />
272
                [% ELSE %]
273
                    <input type="text"
274
                        tabindex="1"
275
                        class="indicator flat"
276
                        name="tag_[% innerloo.tag | html %]_indicator1_[% innerloo.index | html %][% innerloo.random | html %]"
277
                        size="1"
278
                        maxlength="1"
279
                        value="[% innerloo.indicator1 | html %]" />
280
                    <input type="text"
281
                        tabindex="1"
282
                        class="indicator flat"
283
                        name="tag_[% innerloo.tag | html %]_indicator2_[% innerloo.index | html %][% innerloo.random | html %]"
284
                        size="1"
285
                        maxlength="1"
286
                        value="[% innerloo.indicator2 | html %]" />
287
                [% END %] -
288
289
            [% UNLESS advancedMARCEditor %]
290
                <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>
291
            [% END %]
292
                <span class="field_controls">
293
                [% IF ( innerloo.repeatable ) %]
294
                    <a href="#" tabindex="1" class="buttonPlus" onclick="CloneField('tag_[% innerloo.tag | html %]_[% innerloo.index | html %][% innerloo.random | html %]','0','[% advancedMARCEditor | html %]'); return false;" title="Repeat this Tag">
295
                        <img src="[% interface | html %]/[% theme | html %]/img/repeat-tag.png" alt="Repeat this Tag" />
296
                    </a>
297
                [% END %]
298
                    <a href="#" tabindex="1" class="buttonMinus" onclick="UnCloneField('tag_[% innerloo.tag | html %]_[% innerloo.index | html %][% innerloo.random | html %]'); return false;" title="Delete this Tag">
299
                        <img src="[% interface | html %]/[% theme | html %]/img/delete-tag.png" alt="Delete this Tag" />
300
                    </a>
301
                </span>
302
303
        </div>
304
305
        [% FOREACH subfield_loo IN innerloo.subfield_loop %]
306
            <!--  One line on the marc editor -->
307
            <div class="subfield_line" style="[% subfield_loo.visibility | html %]" id="subfield[% subfield_loo.tag | html %][% subfield_loo.subfield | html %][% subfield_loo.random | html %]">
308
309
                [% UNLESS advancedMARCEditor %]
310
                    [% 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">
311
                    [% ELSE %]<label for="tag_[% subfield_loo.tag | html %]_subfield_[% subfield_loo.subfield | html %]_[% subfield_loo.index | html %]_[% subfield_loo.index_subfield | html %]" class="labelsubfield">
312
                    [% END %]
313
                [% END %]
314
315
                <span class="subfieldcode">
316
                    [% IF ( subfield_loo.fixedfield ) %]
317
                        <img class="buttonUp" style="display:none;" src="[% interface | html %]/[% theme | html %]/img/up.png" onclick="upSubfield('subfield[% subfield_loo.tag | html %][% subfield_loo.subfield | html %][% subfield_loo.random | html %]')" alt="Move Up" title="Move Up" />
318
                    [% ELSE %]
319
                        <img class="buttonUp" src="[% interface | html %]/[% theme | html %]/img/up.png" onclick="upSubfield('subfield[% subfield_loo.tag | html %][% subfield_loo.subfield | html %][% subfield_loo.random | html %]')" alt="Move Up" title="Move Up" />
320
                    [% END %]
321
                        <input type="text"
322
                            title="[% subfield_loo.marc_lib | $raw %]"
323
                            style=" [% IF ( subfield_loo.fixedfield ) %]display:none; [% END %]border:0;"
324
                            name="tag_[% subfield_loo.tag | html %]_code_[% subfield_loo.subfield | html %]_[% subfield_loo.index | html %]_[% subfield_loo.index_subfield | html %]"
325
                            value="[% subfield_loo.subfield | html %]"
326
                            size="1"
327
                            maxlength="1"
328
                            class="flat"
329
                            tabindex="0" />
330
                </span>
331
332
                [% UNLESS advancedMARCEditor %]
333
                    [% IF ( subfield_loo.mandatory ) %]<span class="subfield subfield_mandatory">[% ELSE %]<span class="subfield">[% END %]
334
                        [% subfield_loo.marc_lib | $raw %]
335
                        [% IF ( subfield_loo.mandatory ) %]<span class="mandatory_marker" title="This field is mandatory">*</span>[% END %]
336
                    </span>
337
                    </label>
338
                [% END %]
339
340
                [% SET mv = subfield_loo.marc_value %]
341
                [% IF ( mv.type == 'text' or mv.type == 'text1' ) %]
342
                    [% IF ( mv.readonly == 1 ) %]
343
                    <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" />
344
                    [% ELSE %]
345
                    <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 -%]" />
346
                    [% END %]
347
                    [% IF ( mv.authtype ) %]
348
                    <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>
349
                    [% END %]
350
                [% ELSIF ( mv.type == 'text_complex' or mv.type == 'text2' ) %]
351
                    <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 -%]" />
352
                    <span class="subfield_controls">
353
                        [% IF mv.noclick %]
354
                            <a href="#" class="buttonDot tag_editor disabled" tabindex="-1" title="No popup"></a>
355
                        [% ELSE %]
356
                            <a href="#" id="buttonDot_[% mv.id | html %]" class="buttonDot tag_editor framework_plugin" tabindex="1" title="Tag editor">Tag editor</a>
357
                        [% END %]
358
                    </span>
359
                    [% mv.javascript | $raw %]
360
                [% ELSIF ( mv.type == 'hidden' ) %]
361
                    <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 -%]" />
362
                [% ELSIF ( mv.type == 'textarea' ) %]
363
                    <textarea cols="70" rows="4" id="[%- mv.id | html -%]" name="[%- mv.name | html -%]" class="input_marceditor" tabindex="1">[%- mv.value | html -%]</textarea>
364
                [% ELSIF ( mv.type == 'select' ) %]
365
                    <select name="[%- mv.name | html -%]" tabindex="1" size="1" class="input_marceditor" id="[%- mv.id | html -%]">
366
                    [% FOREACH aval IN mv.values %]
367
                        [% IF aval == mv.default %]
368
                        <option value="[%- aval | html -%]" selected="selected">[%- mv.labels.$aval | html -%]</option>
369
                        [% ELSE %]
370
                        <option value="[%- aval | html -%]">[%- mv.labels.$aval | html -%]</option>
371
                        [% END %]
372
                    [% END %]
373
                    </select>
374
                [% END %]
375
376
                <span class="subfield_controls">
377
                [% IF ( subfield_loo.repeatable ) %]
378
                    <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;">
379
                        <img src="[% interface | html %]/[% theme | html %]/img/clone-subfield.png" alt="Clone" title="Clone this subfield" />
380
                    </a>
381
                    <a href="#" class="buttonMinus" tabindex="1" onclick="UnCloneField('subfield[% subfield_loo.tag | html %][% subfield_loo.subfield | html %][% subfield_loo.random | html %]'); return false;">
382
                        <img src="[% interface | html %]/[% theme | html %]/img/delete-subfield.png" alt="Delete" title="Delete this subfield" />
383
                    </a>
384
                [% END %]
385
                </span>
386
387
            </div>
388
            <!-- End of the line -->
389
        [% END %]
390
391
    </div>
392
    [% END %]<!-- if innerloo.tag -->
393
    [% END %]<!-- BIG_LOO.innerloop -->
394
    </div>
395
[% END %]<!-- BIG_LOOP -->
396
397
</div><!-- tabs -->
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/authorities/authorities.tt (-278 / +13 lines)
Lines 54-142 function GetZ3950Terms(){ Link Here
54
    return strQuery;
54
    return strQuery;
55
}
55
}
56
56
57
/**
58
 * check if mandatory subfields are written
59
 */
60
function AreMandatoriesNotOk(){
61
    var mandatories = new Array();
62
    var mandatoriesfields = new Array();
63
    var   tab = new Array();
64
    var label = new Array();
65
    [% FOREACH BIG_LOO IN BIG_LOOP %]
66
    	[% FOREACH innerloo IN BIG_LOO.innerloop %]
67
			[% IF ( innerloo.mandatory ) %]
68
        		mandatoriesfields.push(new Array("[% innerloo.tag | html %]","[% innerloo.index | html %][% innerloo.random | html %]","[% innerloo.index | html %]"));
69
            [% END %]
70
    		[% FOREACH subfield_loo IN innerloo.subfield_loop %]
71
    			[% IF ( subfield_loo.mandatory ) %]mandatories.push("[% subfield_loo.id | html %]");
72
                    tab.push("[% BIG_LOO.number | html %]");
73
                    label.push("[% subfield_loo.marc_lib | $raw |replace("'", "\'") |replace('"', '\"') |replace('\n', '\\n') |replace('\r', '\\r') %]");
74
    			[% END %]
75
			[% END %]
76
		[% END %]
77
	[% END %]
78
    var StrAlert = "";
79
    for(var i=0,len=mandatories.length; i<len ; i++){
80
        var id_string = mandatories[i];
81
        // alert (id_string);
82
        if( ! $("#" + id_string).val() ){
83
            $("#" + id_string).attr('class','subfield_not_filled').focus();
84
            StrAlert += "\t* " + _("%s in tab %s").format(label[i], tab[i]) + "\n";
85
        }
86
    }
87
    
88
    /* Check for mandatories field(not subfields) */
89
    for(var i=0,len=mandatoriesfields.length; i<len; i++){
90
    	isempty  = true;
91
    	arr      = mandatoriesfields[i];
92
    	divid    = "tag_" + arr[0] + "_" + arr[1];
93
    	varegexp = new RegExp("^tag_" + arr[0] + "_code_");
94
95
		if(parseInt(arr[0]) >= 10){
96
	    	elem = document.getElementById(divid);
97
	    	eleminputs = elem.getElementsByTagName('input');
98
	    	
99
	    	for(var j=0,len2=eleminputs.length; j<len2; j++){
100
	
101
	    		if(eleminputs[j].name.match(varegexp) && eleminputs[j].value){
102
					inputregexp = new RegExp("^tag_" + arr[0] + "_subfield_" + eleminputs[j].value + "_" + arr[2]);
103
					
104
					for( var k=0; k<len2; k++){
105
						if(eleminputs[k].id.match(inputregexp) && eleminputs[k].value){
106
							isempty = false
107
						}
108
					}
109
	    		}
110
	    	}
111
    	}else{
112
    		isempty = false;
113
    	}
114
    	
115
    	if(isempty){
116
    		flag = 1;
117
                StrAlert += "\t* " + _("Field %s is mandatory, at least one of its subfields must be filled.").format(arr[0]) + "\n";
118
    	}
119
    	
120
    }
121
    
122
    
123
    if(StrAlert){
124
        return _("Can't save this record because the following field aren't filled :") + "\n\n" + StrAlert;
125
    }
126
    return false;
127
}
128
129
function Check(){
130
    var StrAlert = AreMandatoriesNotOk();
131
    if( ! StrAlert ){
132
        document.f.submit();
133
        return true;
134
    } else {
135
        alert(StrAlert);
136
        return false;
137
    }
138
}
139
140
function AddField(field,cntrepeatfield) {
57
function AddField(field,cntrepeatfield) {
141
    document.forms['f'].op.value = "addfield";
58
    document.forms['f'].op.value = "addfield";
142
    document.forms['f'].addfield_field.value=field;
59
    document.forms['f'].addfield_field.value=field;
Lines 218-223 function confirmnotdup(redirect){ Link Here
218
        <div class="btn-group">
135
        <div class="btn-group">
219
            <a class="btn btn-default" id="z3950submit" href="#"><i class="fa fa-search"></i> Z39.50 search</a>
136
            <a class="btn btn-default" id="z3950submit" href="#"><i class="fa fa-search"></i> Z39.50 search</a>
220
        </div>
137
        </div>
138
139
        <div class="btn-group">
140
            <button class="btn btn-default btn-sm dropdown-toggle" data-toggle="dropdown"><i class="fa fa-cog"></i> Settings <span class="caret"></span></button>
141
            <ul id="settings-menu" class="dropdown-menu">
142
                <li>
143
                    <a href="#" id="marcDocsSelect"><i class="fa fa-check-square-o"></i> Show MARC tag documentation links</a>
144
                <li>
145
                    <a href="#" id="marcTagsSelect"><i class="fa fa-check-square-o"></i> Show tags</a>
146
                </li>
147
            </ul>
148
        </div>
149
221
        <div class="btn-group">
150
        <div class="btn-group">
222
            [% IF ( authid ) %]
151
            [% IF ( authid ) %]
223
                <a class="btn btn-default" id="cancel" href="/cgi-bin/koha/authorities/detail.pl?authid=[% authid | url %]">Cancel</a>
152
                <a class="btn btn-default" id="cancel" href="/cgi-bin/koha/authorities/detail.pl?authid=[% authid | url %]">Cancel</a>
Lines 227-428 function confirmnotdup(redirect){ Link Here
227
        </div>
156
        </div>
228
    </div>
157
    </div>
229
158
230
<div id="authoritytabs" class="toptabs numbered">
159
    [% INCLUDE 'marc_editor.inc' maindiv='authoritytabs' marc21_doc_base='http://www.loc.gov/marc/authority/ad' unimarc_doc_base='https://www.ifla.org/publications/unimarc-authorities--3rd-edition--updates' %]
231
    <ul>
232
        [% FOREACH BIG_LOO IN BIG_LOOP %]
233
        <li><a href="#tab[% BIG_LOO.number | uri %]XX">[% BIG_LOO.number | html %]</a></li>
234
        [% END %]
235
    </ul>
236
160
237
[% FOREACH BIG_LOO IN BIG_LOOP %]
238
    <div id="tab[% BIG_LOO.number | html %]XX">
239
240
    [% FOREACH innerloo IN BIG_LOO.innerloop %]
241
    [% IF ( innerloo.tag ) %]
242
    <div class="tag clearfix" id="tag_[% innerloo.tag | html %]_[% innerloo.index | html %][% innerloo.random | html %]">
243
        <div class="tag_title" id="div_indicator_tag_[% innerloo.tag | html %]_[% innerloo.index | html %][% innerloo.random | html %]">
244
        [% UNLESS hide_marc %]
245
            [% IF advancedMARCEditor %]
246
                <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>
247
            [% ELSE %]
248
                <span title="[% innerloo.tag_lib | html %]">[% innerloo.tag | html %]</span>
249
            [% END %]
250
                [% IF ( innerloo.fixedfield ) %]
251
                    <input type="text"
252
                        tabindex="1"
253
                        class="indicator flat"
254
                        style="display:none;"
255
                        name="tag_[% innerloo.tag | html %]_indicator1_[% innerloo.index | html %][% innerloo.random | html %]"
256
                        size="1"
257
                        maxlength="1"
258
                        value="[% innerloo.indicator1 | html %]" />
259
                    <input type="text"
260
                        tabindex="1"
261
                        class="indicator flat"
262
                        style="display:none;"
263
                        name="tag_[% innerloo.tag | html %]_indicator2_[% innerloo.index | html %][% innerloo.random | html %]"
264
                        size="1"
265
                        maxlength="1"
266
                        value="[% innerloo.indicator2 | html %]" />
267
                [% ELSE %]
268
                    <input type="text"
269
                        tabindex="1"
270
                        class="indicator flat"
271
                        name="tag_[% innerloo.tag | html %]_indicator1_[% innerloo.index | html %][% innerloo.random | html %]"
272
                        size="1"
273
                        maxlength="1"
274
                        value="[% innerloo.indicator1 | html %]" />
275
                    <input type="text"
276
                        tabindex="1"
277
                        class="indicator flat"
278
                        name="tag_[% innerloo.tag | html %]_indicator2_[% innerloo.index | html %][% innerloo.random | html %]"
279
                        size="1"
280
                        maxlength="1"
281
                        value="[% innerloo.indicator2 | html %]" />
282
                [% END %] -
283
        [% ELSE %]
284
                [% IF ( innerloo.fixedfield ) %]
285
                    <input type="hidden"
286
                        tabindex="1"
287
                        name="tag_[% innerloo.tag | html %]_indicator1_[% innerloo.index | html %][% innerloo.random | html %]"
288
                        value="[% innerloo.indicator1 | html %]" />
289
                    <input type="hidden"
290
                        tabindex="1"
291
                        name="tag_[% innerloo.tag | html %]_indicator2_[% innerloo.index | html %][% innerloo.random | html %]"
292
                        value="[% innerloo.indicator2 | html %]" />
293
                [% ELSE %]
294
                    <input type="hidden"
295
                        tabindex="1"
296
                        name="tag_[% innerloo.tag | html %]_indicator1_[% innerloo.index | html %][% innerloo.random | html %]"
297
                        value="[% innerloo.indicator1 | html %]" />
298
                    <input type="hidden"
299
                        tabindex="1"
300
                        name="tag_[% innerloo.tag | html %]_indicator2_[% innerloo.index | html %][% innerloo.random | html %]"
301
                        value="[% innerloo.indicator2 | html %]" />
302
                [% END %]
303
        [% END %]
304
305
            [% UNLESS advancedMARCEditor %]
306
                <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>
307
            [% END %]
308
                <span class="field_controls">
309
                [% IF ( innerloo.repeatable ) %]
310
                    <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">
311
                        <img src="[% interface | html %]/[% theme | html %]/img/repeat-tag.png" alt="Repeat this Tag" />
312
                    </a>
313
                [% END %]
314
                    <a href="#" tabindex="1" class="buttonMinus" onclick="UnCloneField('tag_[% innerloo.tag | html %]_[% innerloo.index | html %][% innerloo.random | html %]'); return false;" title="Delete this Tag">
315
                        <img src="[% interface | html %]/[% theme | html %]/img/delete-tag.png" alt="Delete this Tag" />
316
                    </a>
317
                </span>
318
319
        </div>
320
321
        [% FOREACH subfield_loo IN innerloo.subfield_loop %]
322
            <!--  One line on the marc editor -->
323
            <div class="subfield_line" style="[% subfield_loo.visibility | html %]" id="subfield[% subfield_loo.tag | html %][% subfield_loo.subfield | html %][% subfield_loo.random | html %]">
324
325
                [% UNLESS advancedMARCEditor %]
326
                    [% 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">
327
                    [% ELSE %]<label for="tag_[% subfield_loo.tag | html %]_subfield_[% subfield_loo.subfield | html %]_[% subfield_loo.index | html %]_[% subfield_loo.index_subfield | html %]" class="labelsubfield">
328
                    [% END %]
329
                [% END %]
330
                
331
                [% UNLESS hide_marc %]
332
                <span class="subfieldcode">
333
                    [% IF ( subfield_loo.fixedfield ) %]
334
                        <img class="buttonUp" style="display:none;" src="[% interface | html %]/[% theme | html %]/img/up.png" onclick="upSubfield('subfield[% subfield_loo.tag | html %][% subfield_loo.subfield | html %][% subfield_loo.random | html %]')" alt="Move Up" title="Move Up" />
335
                    [% ELSE %]
336
                        <img class="buttonUp" src="[% interface | html %]/[% theme | html %]/img/up.png" onclick="upSubfield('subfield[% subfield_loo.tag | html %][% subfield_loo.subfield | html %][% subfield_loo.random | html %]')" alt="Move Up" title="Move Up" />
337
                    [% END %]
338
                        <input type="text"
339
                            title="[% subfield_loo.marc_lib | $raw %]"
340
                            style=" [% IF ( subfield_loo.fixedfield ) %]display:none; [% END %]border:0;"
341
                            name="tag_[% subfield_loo.tag | html %]_code_[% subfield_loo.subfield | html %]_[% subfield_loo.index | html %]_[% subfield_loo.index_subfield | html %]"
342
                            value="[% subfield_loo.subfield | html %]"
343
                            size="1"
344
                            maxlength="1"
345
                            class="flat"
346
                            tabindex="0" />
347
                </span>
348
                [% ELSE %]
349
                    <input type="hidden"
350
                        name="tag_[% subfield_loo.tag | html %]_code_[% subfield_loo.subfield | html %]_[% subfield_loo.index | html %]_[% subfield_loo.index_subfield | html %]"
351
                        value="[% subfield_loo.subfield | html %]" />
352
                [% END %]
353
354
                [% UNLESS advancedMARCEditor %]
355
                    [% IF ( subfield_loo.mandatory ) %]<span class="subfield subfield_mandatory">[% ELSE %]<span class="subfield">[% END %]
356
                        [% subfield_loo.marc_lib | $raw %]
357
                        [% IF ( subfield_loo.mandatory ) %]<span class="mandatory_marker" title="This field is mandatory">*</span>[% END %]
358
                    </span>
359
                    </label>
360
                [% END %]
361
                
362
                [% SET mv = subfield_loo.marc_value %]
363
                [% IF ( mv.type == 'select' ) %]
364
                     <select name="[%- mv.name | html -%]" tabindex="1" size="1" class="input_marceditor" id="[%- mv.id | html -%]">
365
                     [% FOREACH aval IN mv.values %]
366
                         [% IF aval == mv.default %]
367
                         <option value="[%- aval | html -%]" selected="selected">[%- mv.labels.$aval | html -%]</option>
368
                         [% ELSE %]
369
                         <option value="[%- aval | html -%]">[%- mv.labels.$aval | html -%]</option>
370
                         [% END %]
371
                     [% END %]
372
                     </select>
373
                [% ELSIF ( mv.type == 'text1' ) %]
374
                    <input type="text" id="[%- mv.id | html -%]" name="[%- mv.id | html -%]" value="[%- mv.value | html -%]" class="input_marceditor" tabindex="1" />
375
                    <a href="#" class="buttonDot" onclick="openAuth(this.parentNode.getElementsByTagName('input')[1].id,'[%- mv.authtypecode | html -%]','auth'); return false;" tabindex="1" title="Tag editor">...</a>
376
                [% ELSIF ( mv.type == 'text2' ) %]
377
                    <input type="text" id="[%- mv.id | html -%]" size="67" maxlength="[%- mv.maxlength | html -%]" name="[%- mv.name | html -%]" value="[%- mv.value | html -%]" class="input_marceditor" />
378
                    [% IF mv.noclick %]
379
                        <a href="#" class="buttonDot tag_editor disabled" tabindex="-1" title="No popup">...</a>
380
                    [% ELSE %]
381
                        <a href="#" id="buttonDot_[% mv.id | html %]" class="buttonDot tag_editor" title="Tag editor">...</a>
382
                    [% END %]
383
                    [% mv.javascript | $raw %]
384
                [% ELSIF ( mv.type == 'text' ) %]
385
                    <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 -%]" />
386
                [% ELSIF ( mv.type == 'textarea' ) %]
387
                    <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>
388
                [% ELSIF ( mv.type == 'hidden' ) %]
389
                    <input tabindex="1" type="hidden" id="[%- mv.id | html -%]" name="[%- mv.name | html -%]" size="67" maxlength="[%- mv.maxlength | html -%]" value="[%- mv.value | html -%]" />
390
                [% ELSIF ( mv.type == 'hidden_simple' ) %]
391
                    <input type="hidden" name="[%- mv.name | html -%]" />
392
                [% END %]
393
394
                <span class="subfield_controls">
395
                [% IF ( subfield_loo.repeatable ) %]
396
                    <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;">
397
                        <img src="[% interface | html %]/[% theme | html %]/img/clone-subfield.png" alt="Clone" title="Clone this subfield" />
398
                    </a>
399
                    <a href="#" class="buttonMinus" tabindex="1" onclick="UnCloneField('subfield[% subfield_loo.tag | html %][% subfield_loo.subfield | html %][% subfield_loo.random | html %]'); return false;">
400
                        <img src="[% interface | html %]/[% theme | html %]/img/delete-subfield.png" alt="Delete" title="Delete this subfield" />
401
                    </a>
402
                [% END %]
403
                </span>
404
                
405
            </div>
406
            <!-- End of the line -->
407
        [% END %]
408
409
    </div>
410
    [% END %]<!-- if innerloo.tag -->
411
    [% END %]<!-- BIG_LOO.innerloop -->
412
    </div>
413
[% END %]<!-- BIG_LOOP -->
414
415
</div><!-- tabs -->
416
417
<div name="hidden" id="hidden" class="tab">
418
[% FOREACH hidden_loo IN hidden_loop %]
419
    <input type="hidden" name="tag" value="[% hidden_loo.tag | html %]" />
420
    <input type="hidden" name="subfield" value="[% hidden_loo.subfield | html %]" />
421
    <input type="hidden" name="mandatory" value="[% hidden_loo.mandatory | html %]" />
422
    <input type="hidden" name="kohafield" value="[% hidden_loo.kohafield | html %]" />
423
    <input type="hidden" name="tag_mandatory" value="[% hidden_loo.tag_mandatory | html %]" />
424
[% END %]
425
</div>
426
[% IF ( oldauthnumtagfield ) %]
161
[% IF ( oldauthnumtagfield ) %]
427
    <input type="hidden" name="tag" value="[% oldauthnumtagfield | html %]" />
162
    <input type="hidden" name="tag" value="[% oldauthnumtagfield | html %]" />
428
    <input type="hidden" name="subfield" value="[% oldauthnumtagsubfield | html %]" />
163
    <input type="hidden" name="subfield" value="[% oldauthnumtagsubfield | html %]" />
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/cataloguing/addbiblio.tt (-401 / +1 lines)
Lines 37-79 Link Here
37
            stickyClass: "floating"
37
            stickyClass: "floating"
38
        });
38
        });
39
39
40
        /* check cookie to hide/show marcdocs*/
41
        if($.cookie("marcdocs_[% borrowernumber | html %]") == 'hide'){
42
            toggleMARCdocLinks(false);
43
        } else {
44
            toggleMARCdocLinks(true);
45
        }
46
47
        $("#marcDocsSelect").click(function(){
48
            if($.cookie("marcdocs_[% borrowernumber | html %]") == 'hide'){
49
                toggleMARCdocLinks(true);
50
            } else {
51
                toggleMARCdocLinks(false);
52
            }
53
        });
54
55
        /* check cookie to hide/show marc tags*/
56
        var marctags_cookie = $.cookie("marctags_[% borrowernumber | html %]");
57
        if( marctags_cookie == 'hide'){
58
            toggleMARCTagLinks(false);
59
        } else if( marctags_cookie == 'show'){
60
            toggleMARCTagLinks(true)
61
        } else {
62
            [% UNLESS Koha.Preference("hide_marc") %]
63
                toggleMARCTagLinks(true)
64
            [% ELSE %]
65
                toggleMARCTagLinks(false);
66
            [% END %]
67
        }
68
69
        $("#marcTagsSelect").click(function(){
70
            if( $.cookie("marctags_[% borrowernumber | html %]") == 'hide'){
71
                toggleMARCTagLinks(true)
72
            } else {
73
                toggleMARCTagLinks(false);
74
            }
75
        });
76
77
        [%# Only ask for a confirmation if it is an edit %]
40
        [%# Only ask for a confirmation if it is an edit %]
78
        $("#z3950search").click(function(){
41
        $("#z3950search").click(function(){
79
            [% IF biblionumber %]
42
            [% IF biblionumber %]
Lines 190-392 function PopupZ3950() { Link Here
190
    } 
153
    } 
191
}
154
}
192
155
193
function PopupMARCFieldDoc(field) {
194
    [% IF Koha.Preference('marcfielddocurl') %]
195
        var docurl = "[% Koha.Preference('marcfielddocurl').replace('"','&quot;') | html %]";
196
        docurl = docurl.replace("{MARC}", "[% marcflavour | html %]");
197
        docurl = docurl.replace("{FIELD}", ""+field);
198
        docurl = docurl.replace("{LANG}", "[% lang | html %]");
199
        window.open(docurl);
200
    [% ELSIF ( marcflavour == 'MARC21' ) %]
201
        _MARC21FieldDoc(field);
202
    [% ELSIF ( marcflavour == 'UNIMARC' ) %]
203
        _UNIMARCFieldDoc(field);
204
    [% END %]
205
}
206
207
function _MARC21FieldDoc(field) {
208
    if(field == 0) {
209
        window.open("http://www.loc.gov/marc/bibliographic/bdleader.html");
210
    } else if (field < 900) {
211
        window.open("http://www.loc.gov/marc/bibliographic/bd" + ("000"+field).slice(-3) + ".html");
212
    } else {
213
        window.open("http://www.loc.gov/marc/bibliographic/bd9xx.html");
214
    }
215
}
216
217
function _UNIMARCFieldDoc(field) {
218
    /* http://archive.ifla.org/VI/3/p1996-1/ is an outdated version of UNIMARC, but
219
       seems to be the only version available that can be linked to per tag.  More recent
220
       versions of the UNIMARC standard are available on the IFLA website only as
221
       PDFs!
222
    */
223
    var url;
224
    if (field == 0) {
225
        url = "http://archive.ifla.org/VI/3/p1996-1/uni.htm";
226
    } else {
227
        var first = field.substring(0,1);
228
        url = "http://archive.ifla.org/VI/3/p1996-1/uni" + first + ".htm#";
229
        if (first == 0) url = url + "b";
230
        url = first == 9
231
              ? "http://archive.ifla.org/VI/3/p1996-1/uni9.htm"
232
              : url + field;
233
    }
234
    window.open(url);
235
}
236
237
/*
238
 * Functions to hide/show marc docs and tags links
239
 */
240
241
function toggleMARCdocLinks(flag){
242
    if( flag === true ){
243
        $(".marcdocs").show();
244
        $.cookie("marcdocs_[% borrowernumber | html %]",'show', { path: "/", expires: 365 });
245
        $("#marcDocsSelect i").addClass('fa-check-square-o').removeClass('fa-square-o');
246
    } else {
247
        $(".marcdocs").hide();
248
        $.cookie("marcdocs_[% borrowernumber | html %]",'hide', { path: "/", expires: 365 });
249
        $("#marcDocsSelect i").removeClass('fa-check-square-o').addClass('fa-square-o');
250
    }
251
}
252
253
function toggleMARCTagLinks(flag){
254
    if( flag === true ){
255
        $(".tagnum").show();
256
        $(".subfieldcode").show();
257
        $.cookie("marctags_[% borrowernumber | html %]",'show', { path: "/", expires: 365 });
258
        $("#marcTagsSelect i").addClass('fa-check-square-o').removeClass('fa-square-o');
259
    } else {
260
        $(".tagnum").hide();
261
        $(".subfieldcode").hide();
262
        $.cookie("marctags_[% borrowernumber | html %]",'hide', { path: "/", expires: 365 });
263
        $("#marcTagsSelect i").removeClass('fa-check-square-o').addClass('fa-square-o');
264
    }
265
}
266
267
/**
268
 * check if mandatory subfields are written
269
 */
270
function AreMandatoriesNotOk(){
271
    var mandatories = new Array();
272
    var mandatoriesfields = new Array();
273
    var tab = new Array();
274
    var label = new Array();
275
    var flag=0;
276
    var tabflag= new Array();  
277
    [% FOREACH BIG_LOO IN BIG_LOOP %]
278
    	[% FOREACH innerloo IN BIG_LOO.innerloop %]
279
	        [% IF ( innerloo.mandatory ) %]
280
    	    	mandatoriesfields.push(new Array("[% innerloo.tag | html %]","[% innerloo.index | html %][% innerloo.random | html %]","[% innerloo.index | html %]"));
281
        	[% END %]
282
    		[% FOREACH subfield_loo IN innerloo.subfield_loop %]
283
    			[% IF ( subfield_loo.mandatory ) %]mandatories.push("[% subfield_loo.id | html %]");
284
                   	tab.push("[% BIG_LOO.number | html %]");
285
                    label.push("[% subfield_loo.marc_lib | $raw %]");
286
                [% END %]
287
            [% END %]
288
        [% END %]
289
    [% END %]
290
    var StrAlert = _("Can't save this record because the following field aren't filled:");
291
    StrAlert += "\n\n";
292
    for(var i=0,len=mandatories.length; i<len ; i++){
293
        var tag=mandatories[i].substr(4,3);
294
        var subfield=mandatories[i].substr(17,1);
295
        var tagnumber=mandatories[i].substr(19,mandatories[i].lastIndexOf("_")-19);
296
        if (tabflag[tag+subfield+tagnumber] ==  null) { 
297
	    tabflag[tag+subfield+tagnumber]=new Array();
298
            tabflag[tag+subfield+tagnumber][0]=0; 
299
	}
300
        if( tabflag[tag+subfield+tagnumber][0] != 1 && (document.getElementById(mandatories[i]) != null && ! document.getElementById(mandatories[i]).value || document.getElementById(mandatories[i]) == null)){
301
            tabflag[tag+subfield+tagnumber][0] = 0 + tabflag[tag+subfield+tagnumber] ;
302
            document.getElementById(mandatories[i]).setAttribute('class','subfield_not_filled');
303
            $('#' + mandatories[i]).focus();
304
            tabflag[tag+subfield+tagnumber][1]=label[i];
305
            tabflag[tag+subfield+tagnumber][2]=tab[i];
306
        } else {
307
            tabflag[tag+subfield+tagnumber][0] = 1;
308
        }    
309
    }
310
    for (var tagsubfieldid in tabflag){
311
      if (tabflag[tagsubfieldid][0]==0){
312
        var tag=tagsubfieldid.substr(0,3);
313
        var subfield=tagsubfieldid.substr(3,1);    
314
        StrAlert += "\t* "+_("tag %s subfield %s %s in tab %s").format(tag, subfield, tabflag[tagsubfieldid][1], tabflag[tagsubfieldid][2]) + "\n";
315
        //StrAlert += "\t* "+label[i]+_(" in tab ")+tab[i]+"\n"; 
316
        flag=1;    
317
      }   
318
    }   
319
    
320
    /* Check for mandatories field(not subfields) */
321
    for(var i=0,len=mandatoriesfields.length; i<len; i++){
322
	    isempty  = true;
323
		arr      = mandatoriesfields[i];
324
    	divid    = "tag_" + arr[0] + "_" + arr[1];
325
    	varegexp = new RegExp("^tag_" + arr[0] + "_code_");
326
    	
327
		if(parseInt(arr[0]) >= 10){
328
	    	elem = document.getElementById(divid);
329
	    	eleminputs = elem.getElementsByTagName('input');
330
	    	
331
	    	for(var j=0,len2=eleminputs.length; j<len2; j++){
332
	
333
	    		if(eleminputs[j].name.match(varegexp) && eleminputs[j].value){
334
					inputregexp = new RegExp("^tag_" + arr[0] + "_subfield_" + eleminputs[j].value + "_" + arr[2]);
335
					
336
					for( var k=0; k<len2; k++){
337
						if(eleminputs[k].id.match(inputregexp) && eleminputs[k].value){
338
							isempty = false
339
						}
340
					}
341
					
342
					elemselect = elem.getElementsByTagName('select');
343
					for( var k=0; k<elemselect.length; k++){
344
						if(elemselect[k].id.match(inputregexp) && elemselect[k].value){
345
							isempty = false
346
						}
347
					}
348
	    		}
349
	    	}
350
351
	    	elemtextareas = elem.getElementsByTagName('textarea');
352
	    	for(var j=0,len2=elemtextareas.length; j<len2; j++){
353
                // this bit assumes that the only textareas in this context would be for subfields
354
                if (elemtextareas[j].value) {
355
                    isempty = false;
356
                }
357
            }
358
    	}else{
359
    		isempty = false;
360
    	}
361
    	
362
    	if(isempty){
363
    		flag = 1;
364
                StrAlert += "\t* " + _("Field %s is mandatory, at least one of its subfields must be filled.").format(arr[0]) + "\n";
365
    	}
366
    	
367
    }
368
    
369
    if(flag){
370
	    return StrAlert;
371
	} else {
372
		return flag;
373
	}
374
}
375
376
/**
377
 *
378
 *
379
 */
380
function Check(){
381
    var StrAlert = AreMandatoriesNotOk();
382
    if( ! StrAlert ){
383
        document.f.submit();
384
        return true;
385
    } else {
386
        alert(StrAlert);
387
        return false;
388
    }
389
}
390
156
391
/** 
157
/** 
392
 * check if z3950 mandatories are set or not
158
 * check if z3950 mandatories are set or not
Lines 615-786 function Changefwk() { Link Here
615
        <input type="hidden" name="breedingid" value="[% breedingid | html %]" />
381
        <input type="hidden" name="breedingid" value="[% breedingid | html %]" />
616
        <input type="hidden" name="changed_framework" value="" />
382
        <input type="hidden" name="changed_framework" value="" />
617
383
618
<div id="addbibliotabs" class="toptabs numbered">
384
    [% INCLUDE 'marc_editor.inc' maindiv='addbibliotabs' marc21_doc_base='http://www.loc.gov/marc/bibliographic/bd' unimarc_doc_base='https://www.ifla.org/publications/unimarc-bibliographic--3rd-edition--updates-2012-and-updates-2016' %]
619
    <ul>
620
        [% FOREACH BIG_LOO IN BIG_LOOP %]
621
            <li><a href="#tab[% BIG_LOO.number | uri %]XX">[% BIG_LOO.number | html %]</a></li>
622
        [% END %]
623
    </ul>
624
625
[% FOREACH BIG_LOO IN BIG_LOOP %]
626
    <div id="tab[% BIG_LOO.number | html %]XX">
627
628
    [% IF ( BIG_LOOP.size > 1 ) %]
629
        <h3>Section [% BIG_LOO.number | html %]</h3>
630
    [% END %]
631
    [% FOREACH innerloo IN BIG_LOO.innerloop %]
632
    [% IF ( innerloo.tag ) %]
633
    <div class="tag clearfix" id="tag_[% innerloo.tag | html %]_[% innerloo.index | html %][% innerloo.random | html %]">
634
        <div class="tag_title" id="div_indicator_tag_[% innerloo.tag | html %]_[% innerloo.index | html %][% innerloo.random | html %]">
635
            [% IF advancedMARCEditor %]
636
                <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>
637
            [% ELSE %]
638
                <span class="tagnum" title="[% innerloo.tag_lib | html %]">[% innerloo.tag | html %]</span>
639
                [% IF marcflavour != 'NORMARC' %]<a href="#" class="marcdocs" onclick="PopupMARCFieldDoc('[% innerloo.tag | html %]'); return false;">&nbsp;?</a>[% END %]
640
            [% END %]
641
                [% IF ( innerloo.fixedfield ) %]
642
                    <input type="text"
643
                        tabindex="1"
644
                        class="indicator flat"
645
                        style="display:none;"
646
                        name="tag_[% innerloo.tag | html %]_indicator1_[% innerloo.index | html %][% innerloo.random | html %]"
647
                        size="1"
648
                        maxlength="1"
649
                        value="[% innerloo.indicator1 | html %]" />
650
                    <input type="text"
651
                        tabindex="1"
652
                        class="indicator flat"
653
                        style="display:none;"
654
                        name="tag_[% innerloo.tag | html %]_indicator2_[% innerloo.index | html %][% innerloo.random | html %]"
655
                        size="1"
656
                        maxlength="1"
657
                        value="[% innerloo.indicator2 | html %]" />
658
                [% ELSE %]
659
                    <input type="text"
660
                        tabindex="1"
661
                        class="indicator flat"
662
                        name="tag_[% innerloo.tag | html %]_indicator1_[% innerloo.index | html %][% innerloo.random | html %]"
663
                        size="1"
664
                        maxlength="1"
665
                        value="[% innerloo.indicator1 | html %]" />
666
                    <input type="text"
667
                        tabindex="1"
668
                        class="indicator flat"
669
                        name="tag_[% innerloo.tag | html %]_indicator2_[% innerloo.index | html %][% innerloo.random | html %]"
670
                        size="1"
671
                        maxlength="1"
672
                        value="[% innerloo.indicator2 | html %]" />
673
                [% END %] -
674
675
            [% UNLESS advancedMARCEditor %]
676
                <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>
677
            [% END %]
678
                <span class="field_controls">
679
                [% IF ( innerloo.repeatable ) %]
680
                    <a href="#" tabindex="1" class="buttonPlus" onclick="CloneField('tag_[% innerloo.tag | html %]_[% innerloo.index | html %][% innerloo.random | html %]','0','[% advancedMARCEditor | html %]'); return false;" title="Repeat this Tag">
681
                        <img src="[% interface | html %]/[% theme | html %]/img/repeat-tag.png" alt="Repeat this Tag" />
682
                    </a>
683
                [% END %]
684
                    <a href="#" tabindex="1" class="buttonMinus" onclick="UnCloneField('tag_[% innerloo.tag | html %]_[% innerloo.index | html %][% innerloo.random | html %]'); return false;" title="Delete this Tag">
685
                        <img src="[% interface | html %]/[% theme | html %]/img/delete-tag.png" alt="Delete this Tag" />
686
                    </a>
687
                </span>
688
689
        </div>
690
691
        [% FOREACH subfield_loo IN innerloo.subfield_loop %]
692
            <!--  One line on the marc editor -->
693
            <div class="subfield_line" style="[% subfield_loo.visibility | html %]" id="subfield[% subfield_loo.tag | html %][% subfield_loo.subfield | html %][% subfield_loo.random | html %]">
694
695
                [% UNLESS advancedMARCEditor %]
696
                    [% 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">
697
                    [% ELSE %]<label for="tag_[% subfield_loo.tag | html %]_subfield_[% subfield_loo.subfield | html %]_[% subfield_loo.index | html %]_[% subfield_loo.index_subfield | html %]" class="labelsubfield">
698
                    [% END %]
699
                [% END %]
700
701
                <span class="subfieldcode">
702
                    [% IF ( subfield_loo.fixedfield ) %]
703
                        <img class="buttonUp" style="display:none;" src="[% interface | html %]/[% theme | html %]/img/up.png" onclick="upSubfield('subfield[% subfield_loo.tag | html %][% subfield_loo.subfield | html %][% subfield_loo.random | html %]')" alt="Move Up" title="Move Up" />
704
                    [% ELSE %]
705
                        <img class="buttonUp" src="[% interface | html %]/[% theme | html %]/img/up.png" onclick="upSubfield('subfield[% subfield_loo.tag | html %][% subfield_loo.subfield | html %][% subfield_loo.random | html %]')" alt="Move Up" title="Move Up" />
706
                    [% END %]
707
                        <input type="text"
708
                            title="[% subfield_loo.marc_lib | $raw %]"
709
                            style=" [% IF ( subfield_loo.fixedfield ) %]display:none; [% END %]border:0;"
710
                            name="tag_[% subfield_loo.tag | html %]_code_[% subfield_loo.subfield | html %]_[% subfield_loo.index | html %]_[% subfield_loo.index_subfield | html %]"
711
                            value="[% subfield_loo.subfield | html %]"
712
                            size="1"
713
                            maxlength="1"
714
                            class="flat"
715
                            tabindex="0" />
716
                </span>
717
718
                [% UNLESS advancedMARCEditor %]
719
                    [% IF ( subfield_loo.mandatory ) %]<span class="subfield subfield_mandatory">[% ELSE %]<span class="subfield">[% END %]
720
                        [% subfield_loo.marc_lib | $raw %]
721
                        [% IF ( subfield_loo.mandatory ) %]<span class="mandatory_marker" title="This field is mandatory">*</span>[% END %]
722
                    </span>
723
                    </label>
724
                [% END %]
725
                
726
                [% SET mv = subfield_loo.marc_value %]
727
                [% IF ( mv.type == 'text' ) %]
728
                    [% IF ( mv.readonly == 1 ) %]
729
                    <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" />
730
                    [% ELSE %]
731
                    <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 -%]" />
732
                    [% END %]
733
                    [% IF ( mv.authtype ) %]
734
                    <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>
735
                    [% END %]
736
                [% ELSIF ( mv.type == 'text_complex' ) %]
737
                    <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 -%]" />
738
                    <span class="subfield_controls">
739
                        [% IF mv.noclick %]
740
                            <a href="#" class="buttonDot tag_editor disabled" tabindex="-1" title="No popup"></a>
741
                        [% ELSE %]
742
                            <a href="#" id="buttonDot_[% mv.id | html %]" class="buttonDot tag_editor framework_plugin" tabindex="1" title="Tag editor">Tag editor</a>
743
                        [% END %]
744
                    </span>
745
                    [% mv.javascript | $raw %]
746
                [% ELSIF ( mv.type == 'hidden' ) %]
747
                    <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 -%]" />
748
                [% ELSIF ( mv.type == 'textarea' ) %]
749
                    <textarea cols="70" rows="4" id="[%- mv.id | html -%]" name="[%- mv.name | html -%]" class="input_marceditor" tabindex="1">[%- mv.value | html -%]</textarea>
750
                [% ELSIF ( mv.type == 'select' ) %]
751
                    <select name="[%- mv.name | html -%]" tabindex="1" size="1" class="input_marceditor" id="[%- mv.id | html -%]">
752
                    [% FOREACH aval IN mv.values %]
753
                        [% IF aval == mv.default %]
754
                        <option value="[%- aval | html -%]" selected="selected">[%- mv.labels.$aval | html -%]</option>
755
                        [% ELSE %]
756
                        <option value="[%- aval | html -%]">[%- mv.labels.$aval | html -%]</option>
757
                        [% END %]
758
                    [% END %]
759
                    </select>
760
                [% END %]
761
                
762
                <span class="subfield_controls">
763
                [% IF ( subfield_loo.repeatable ) %]
764
                    <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;">
765
                        <img src="[% interface | html %]/[% theme | html %]/img/clone-subfield.png" alt="Clone" title="Clone this subfield" />
766
                    </a>
767
                    <a href="#" class="buttonMinus" tabindex="1" onclick="UnCloneField('subfield[% subfield_loo.tag | html %][% subfield_loo.subfield | html %][% subfield_loo.random | html %]'); return false;">
768
                        <img src="[% interface | html %]/[% theme | html %]/img/delete-subfield.png" alt="Delete" title="Delete this subfield" />
769
                    </a>
770
                [% END %]
771
                </span>
772
                
773
            </div>
774
            <!-- End of the line -->
775
        [% END %]
776
777
    </div>
778
    [% END %]<!-- if innerloo.tag -->
779
    [% END %]<!-- BIG_LOO.innerloop -->
780
    </div>
781
[% END %]<!-- BIG_LOOP -->
782
783
</div><!-- tabs -->
784
385
785
[%# Fields for fast cataloging %]
386
[%# Fields for fast cataloging %]
786
<input type="hidden" name="barcode" value="[% barcode | html %]" />
387
<input type="hidden" name="barcode" value="[% barcode | html %]" />
787
- 

Return to bug 21280