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

(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/authorities/authorities.tt (-386 / +403 lines)
Lines 29-35 Link Here
29
            if(Check()){
29
            if(Check()){
30
                $("#f").submit();
30
                $("#f").submit();
31
            }
31
            }
32
		});
32
        });
33
        $("#z3950submit").click(function(){
33
        $("#z3950submit").click(function(){
34
            var strQuery = GetZ3950Terms();
34
            var strQuery = GetZ3950Terms();
35
            if(strQuery){
35
            if(strQuery){
Lines 39-461 Link Here
39
        });
39
        });
40
    });
40
    });
41
41
42
/**
42
    /**
43
 * check if z3950 mandatories are set or not
43
    * check if z3950 mandatories are set or not
44
 */
44
    */
45
function GetZ3950Terms(){
45
    function GetZ3950Terms(){
46
 var strQuery="&authtypecode="+document.forms['f'].authtypecode.value;
46
    var strQuery="&authtypecode="+document.forms['f'].authtypecode.value;
47
    var mandatories = new Array();
47
        var mandatories = new Array();
48
    var mandatories_label = new Array();
48
        var mandatories_label = new Array();
49
    [% FOREACH BIG_LOO IN BIG_LOOP %][% FOREACH innerloo IN BIG_LOO.innerloop %][% FOREACH subfield_loo IN innerloo.subfield_loop %][% IF ( subfield_loo.z3950_mandatory ) %]mandatories.push("[% subfield_loo.id | html %]");
49
        [% FOREACH BIG_LOO IN BIG_LOOP %][% FOREACH innerloo IN BIG_LOO.innerloop %][% FOREACH subfield_loo IN innerloo.subfield_loop %][% IF ( subfield_loo.z3950_mandatory ) %]mandatories.push("[% subfield_loo.id | html %]");
50
        mandatories_label.push("[% subfield_loo.z3950_mandatory | html %]");[% END %][% END %][% END %][% END %]
50
            mandatories_label.push("[% subfield_loo.z3950_mandatory | html %]");[% END %][% END %][% END %][% END %]
51
51
52
    for(var i=0,len=mandatories.length; i<len ; i++){
52
        for(var i=0,len=mandatories.length; i<len ; i++){
53
        var field_value = document.getElementById(mandatories[i]).value;
53
            var field_value = document.getElementById(mandatories[i]).value;
54
        if( field_value ){
54
            if( field_value ){
55
            strQuery += "&"+mandatories_label[i]+"="+field_value;
55
                strQuery += "&"+mandatories_label[i]+"="+field_value;
56
            }
56
        }
57
        }
58
        return strQuery;
57
    }
59
    }
58
    return strQuery;
60
59
}
61
    /**
60
62
    * check if mandatory subfields are written
61
/**
63
    */
62
 * check if mandatory subfields are written
64
    function AreMandatoriesNotOk(){
63
 */
65
        var mandatories = new Array();
64
function AreMandatoriesNotOk(){
66
        var mandatoriesfields = new Array();
65
    var mandatories = new Array();
67
        var   tab = new Array();
66
    var mandatoriesfields = new Array();
68
        var label = new Array();
67
    var   tab = new Array();
69
        [% FOREACH BIG_LOO IN BIG_LOOP %]
68
    var label = new Array();
70
            [% FOREACH innerloo IN BIG_LOO.innerloop %]
69
    [% FOREACH BIG_LOO IN BIG_LOOP %]
71
                [% IF ( innerloo.mandatory ) %]
70
    	[% FOREACH innerloo IN BIG_LOO.innerloop %]
72
                    mandatoriesfields.push(new Array("[% innerloo.tag | html %]","[% innerloo.index | html %][% innerloo.random | html %]","[% innerloo.index | html %]"));
71
			[% IF ( innerloo.mandatory ) %]
73
                [% END %]
72
        		mandatoriesfields.push(new Array("[% innerloo.tag | html %]","[% innerloo.index | html %][% innerloo.random | html %]","[% innerloo.index | html %]"));
74
                [% FOREACH subfield_loo IN innerloo.subfield_loop %]
75
                    [% IF ( subfield_loo.mandatory ) %]mandatories.push("[% subfield_loo.id | html %]");
76
                        tab.push("[% BIG_LOO.number | html %]");
77
                        label.push("[% To.json(subfield_loo.marc_lib) | $raw %]");
78
                    [% END %]
79
                [% END %]
73
            [% END %]
80
            [% END %]
74
    		[% FOREACH subfield_loo IN innerloo.subfield_loop %]
81
        [% END %]
75
    			[% IF ( subfield_loo.mandatory ) %]mandatories.push("[% subfield_loo.id | html %]");
82
        var StrAlert = "";
76
                    tab.push("[% BIG_LOO.number | html %]");
83
        for(var i=0,len=mandatories.length; i<len ; i++){
77
                    label.push("[% To.json(subfield_loo.marc_lib) | $raw %]");
84
            var id_string = mandatories[i];
78
    			[% END %]
85
            // alert (id_string);
79
			[% END %]
86
            if( ! $("#" + id_string).val() ){
80
		[% END %]
87
                var elt = document.getElementById(id_string);
81
	[% END %]
88
                if ( elt.nodeName == 'SELECT' ) {
82
    var StrAlert = "";
89
                    $(elt).siblings('.select2').find("span[role='combobox']").addClass('subfield_not_filled');
83
    for(var i=0,len=mandatories.length; i<len ; i++){
90
                } else {
84
        var id_string = mandatories[i];
91
                    $(elt).addClass('subfield_not_filled');
85
        // alert (id_string);
92
                }
86
        if( ! $("#" + id_string).val() ){
93
87
            var elt = document.getElementById(id_string);
94
                $(elt).focus();
88
            if ( elt.nodeName == 'SELECT' ) {
95
                StrAlert += "\t* " + _("%s in tab %s").format(label[i], tab[i]) + "\n";
89
                $(elt).siblings('.select2').find("span[role='combobox']").addClass('subfield_not_filled');
96
            }
97
        }
98
99
        /* Check for mandatories field(not subfields) */
100
        for(var i=0,len=mandatoriesfields.length; i<len; i++){
101
            isempty  = true;
102
            arr      = mandatoriesfields[i];
103
            divid    = "tag_" + arr[0] + "_" + arr[1];
104
            varegexp = new RegExp("^tag_" + arr[0] + "_code_");
105
106
            if(parseInt(arr[0]) >= 10){
107
                elem = document.getElementById(divid);
108
                eleminputs = elem.getElementsByTagName('input');
109
110
                for(var j=0,len2=eleminputs.length; j<len2; j++){
111
112
                    if(eleminputs[j].name.match(varegexp) && eleminputs[j].value){
113
                        inputregexp = new RegExp("^tag_" + arr[0] + "_subfield_" + eleminputs[j].value + "_" + arr[2]);
114
115
                        for( var k=0; k<len2; k++){
116
                            if(eleminputs[k].id.match(inputregexp) && eleminputs[k].value){
117
                                isempty = false
118
                            }
119
                        }
120
                    }
121
                }
90
            } else {
122
            } else {
91
                $(elt).addClass('subfield_not_filled');
123
                isempty = false;
92
            }
124
            }
93
125
94
            $(elt).focus();
126
            if(isempty){
95
            StrAlert += "\t* " + _("%s in tab %s").format(label[i], tab[i]) + "\n";
127
                flag = 1;
96
        }
97
    }
98
    
99
    /* Check for mandatories field(not subfields) */
100
    for(var i=0,len=mandatoriesfields.length; i<len; i++){
101
    	isempty  = true;
102
    	arr      = mandatoriesfields[i];
103
    	divid    = "tag_" + arr[0] + "_" + arr[1];
104
    	varegexp = new RegExp("^tag_" + arr[0] + "_code_");
105
106
		if(parseInt(arr[0]) >= 10){
107
	    	elem = document.getElementById(divid);
108
	    	eleminputs = elem.getElementsByTagName('input');
109
	    	
110
	    	for(var j=0,len2=eleminputs.length; j<len2; j++){
111
	
112
	    		if(eleminputs[j].name.match(varegexp) && eleminputs[j].value){
113
					inputregexp = new RegExp("^tag_" + arr[0] + "_subfield_" + eleminputs[j].value + "_" + arr[2]);
114
					
115
					for( var k=0; k<len2; k++){
116
						if(eleminputs[k].id.match(inputregexp) && eleminputs[k].value){
117
							isempty = false
118
						}
119
					}
120
	    		}
121
	    	}
122
    	}else{
123
    		isempty = false;
124
    	}
125
    	
126
    	if(isempty){
127
    		flag = 1;
128
                StrAlert += "\t* " + _("Field %s is mandatory, at least one of its subfields must be filled.").format(arr[0]) + "\n";
128
                StrAlert += "\t* " + _("Field %s is mandatory, at least one of its subfields must be filled.").format(arr[0]) + "\n";
129
    	}
129
            }
130
    	
131
    }
132
    
133
    
134
    if(StrAlert){
135
        return _("Can't save this record because the following field aren't filled :") + "\n\n" + StrAlert;
136
    }
137
    return false;
138
}
139
130
140
function Check(){
131
        }
141
    var StrAlert = AreMandatoriesNotOk();
132
142
    if( ! StrAlert ){
133
143
        document.f.submit();
134
        if(StrAlert){
144
        return true;
135
            return _("Can't save this record because the following field aren't filled :") + "\n\n" + StrAlert;
145
    } else {
136
        }
146
        alert(StrAlert);
147
        return false;
137
        return false;
148
    }
138
    }
149
}
150
151
function AddField(field,cntrepeatfield) {
152
    document.forms['f'].op.value = "addfield";
153
    document.forms['f'].addfield_field.value=field;
154
    document.forms['f'].repeat_field.value=cntrepeatfield;
155
    document.f.submit();
156
}
157
158
function addauthority() {
159
    X = document.forms[0].authtype.value;
160
    window.location="/cgi-bin/koha/authorities/authorities.pl?authtypecode="+X;
161
}
162
function searchauthority() {
163
    X = document.forms[0].authtype2.value;
164
    Y = document.forms[0].value.value;
165
    window.location="/cgi-bin/koha/authorities/authorities-home.pl?op=do_search&type=intranet&authtypecode="+X+"&value="+Y+"&marclist=&and_or=and&excluding=&operator=contains";
166
}
167
function confirmnotdup(redirect){
168
    $("#confirm_not_duplicate").attr("value","1");
169
    Check();
170
}
171
</script>
172
[% Asset.css("css/addbiblio.css") | $raw %]
173
139
174
</head>
140
    function Check(){
175
<body id="auth_authorities" class="auth">
141
        var StrAlert = AreMandatoriesNotOk();
176
142
        if( ! StrAlert ){
177
<div id="loading">
143
            document.f.submit();
178
   <div>Loading, please wait...</div>
144
            return true;
179
</div>
145
        } else {
146
            alert(StrAlert);
147
            return false;
148
        }
149
    }
180
150
181
[% INCLUDE 'header.inc' %]
151
    function AddField(field,cntrepeatfield) {
152
        document.forms['f'].op.value = "addfield";
153
        document.forms['f'].addfield_field.value=field;
154
        document.forms['f'].repeat_field.value=cntrepeatfield;
155
        document.f.submit();
156
    }
182
157
183
<div id="breadcrumbs"><a href="/cgi-bin/koha/mainpage.pl">Home</a> &rsaquo; <a href="/cgi-bin/koha/authorities/authorities-home.pl">Authorities</a> &rsaquo; [% IF ( authid ) %]Modify authority #[% authid | html %] ([% authtypetext | html %])[% ELSE %]Adding authority [% authtypetext | html %][% END %]  </div>
158
    function addauthority() {
159
        X = document.forms[0].authtype.value;
160
        window.location="/cgi-bin/koha/authorities/authorities.pl?authtypecode="+X;
161
    }
184
162
185
<div class="main container-fluid">
163
    function searchauthority() {
186
    <div class="row">
164
        X = document.forms[0].authtype2.value;
187
        <div class="col-md-8 col-md-offset-2">
165
        Y = document.forms[0].value.value;
166
        window.location="/cgi-bin/koha/authorities/authorities-home.pl?op=do_search&type=intranet&authtypecode="+X+"&value="+Y+"&marclist=&and_or=and&excluding=&operator=contains";
167
    }
188
168
189
[% IF ( authid ) %]
169
    function confirmnotdup(redirect){
190
<h1>Modify authority #[% authid | html %] [% authtypetext | html %]</h1>
170
        $("#confirm_not_duplicate").attr("value","1");
191
[% ELSE %]
171
        Check();
192
<h1>Adding authority [% authtypetext | html %]</h1>
172
    }
193
[% END %]
173
</script>
174
[% Asset.css("css/addbiblio.css") | $raw %]
175
</head>
194
176
195
[% IF ( duplicateauthid ) %]
177
<body id="auth_authorities" class="auth">
196
        <div class="dialog alert">
197
                <h3>Duplicate record suspected</h3>
198
                <p>Is this a duplicate of <a href="/cgi-bin/koha/authorities/detail.pl?authid=[% duplicateauthid | uri %]" class="popup" onclick="openWindow('/cgi-bin/koha/authorities/detail.pl?authid=[% duplicateauthid | html %]&amp;popup=1', 'DuplicateAuthority','800','600'); return false;" class="button">[% duplicateauthvalue | html %]</a> ?</p>
199
178
200
                <form action="authorities.pl" method="get">
179
    <div id="loading">
201
                    <input type="hidden" name="authid" value="[% duplicateauthid | html %]" />
180
        <div>Loading, please wait...</div>
202
                    <button type="submit" class="new"><i class="fa fa-pencil"></i> Yes: Edit existing authority</button>
203
                </form>
204
                <form action="authorities.pl" method="get">
205
                    <button class="new" onclick="confirmnotdup('items'); return false;"><i class="fa fa-save"></i> No: Save as new authority</button>
206
                </form>
207
        </div>
208
[% END %]
209
210
<form method="post" name="f" action="/cgi-bin/koha/authorities/authorities.pl">
211
    <input type="hidden" name="op" value="add" />
212
    <input type="hidden" name="addfield_field" value="" />
213
    <input type="hidden" name="repeat_field" value="" />
214
    <input type="hidden" name="authtypecode" value="[% authtypecode | html %]" />
215
    <input type="hidden" name="authid" value="[% authid | html %]" />
216
    <input type="hidden" name="index" value="[% index | html %]" />
217
    <input type="hidden" value="0" id="confirm_not_duplicate" name="confirm_not_duplicate" />
218
219
    <div id="toolbar" class="btn-toolbar">
220
        <div class="btn-group"><a href="#" id="addauth" class="btn btn-default" accesskey="w"><i class="fa fa-save"></i> Save</a></div>
221
        <div class="btn-group">
222
            [% IF ( authid ) %]
223
                <a class="btn btn-default" id="z3950submit" href="#"><i class="fa fa-search"></i> Replace record via Z39.50/SRU search</a>
224
            [% ELSE %]
225
                <a class="btn btn-default" id="z3950submit" href="#"><i class="fa fa-search"></i> Z39.50/SRU search</a>
226
            [% END %]
227
        </div>
228
        <div class="btn-group">
229
            [% IF ( authid ) %]
230
                <a class="btn btn-default" id="cancel" href="/cgi-bin/koha/authorities/detail.pl?authid=[% authid | url %]">Cancel</a>
231
            [% ELSE %]
232
                <a class="btn btn-default" id="cancel" href="/cgi-bin/koha/authorities/authorities-home.pl">Cancel</a>
233
            [% END %]
234
        </div>
235
    </div>
181
    </div>
236
182
237
<div id="authoritytabs" class="toptabs numbered">
183
    [% INCLUDE 'header.inc' %]
238
    <ul>
239
        [% FOREACH BIG_LOO IN BIG_LOOP %]
240
        <li><a href="#tab[% BIG_LOO.number | uri %]XX">[% BIG_LOO.number | html %]</a></li>
241
        [% END %]
242
    </ul>
243
244
[% FOREACH BIG_LOO IN BIG_LOOP %]
245
    <div id="tab[% BIG_LOO.number | html %]XX">
246
184
247
    [% previous = "" %]
185
    <div id="breadcrumbs">
248
    [% FOREACH innerloo IN BIG_LOO.innerloop %]
186
        <a href="/cgi-bin/koha/mainpage.pl">Home</a> &rsaquo;
249
    [% IF ( innerloo.tag ) %]
187
        <a href="/cgi-bin/koha/authorities/authorities-home.pl">Authorities</a> &rsaquo;
250
    [% IF innerloo.tag != previous %]
188
        [% IF ( authid ) %]
251
        [% IF previous != "" %]
189
            Modify authority #[% authid | html %] ([% authtypetext | html %])
252
            </ul>
253
        [% END %]
254
        [% previous = innerloo.tag %]
255
        <ul class="sortable_field">
256
    [% END %]
257
    <li class="tag clearfix" id="tag_[% innerloo.tag | html %]_[% innerloo.index | html %][% innerloo.random | html %]">
258
        <div class="tag_title" id="div_indicator_tag_[% innerloo.tag | html %]_[% innerloo.index | html %][% innerloo.random | html %]">
259
        [% UNLESS hide_marc %]
260
            [% IF advancedMARCEditor %]
261
                <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>
262
            [% ELSE %]
263
                <span title="[% innerloo.tag_lib | html %]">[% innerloo.tag | html %]</span>
264
            [% END %]
265
                [% IF ( innerloo.fixedfield ) %]
266
                    <input type="text"
267
                        tabindex="1"
268
                        class="indicator flat"
269
                        style="display:none;"
270
                        name="tag_[% innerloo.tag | html %]_indicator1_[% innerloo.index | html %][% innerloo.random | html %]"
271
                        size="1"
272
                        maxlength="1"
273
                        value="[% innerloo.indicator1 | html %]" />
274
                    <input type="text"
275
                        tabindex="1"
276
                        class="indicator flat"
277
                        style="display:none;"
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
                [% ELSE %]
283
                    <input type="text"
284
                        tabindex="1"
285
                        class="indicator flat"
286
                        name="tag_[% innerloo.tag | html %]_indicator1_[% innerloo.index | html %][% innerloo.random | html %]"
287
                        size="1"
288
                        maxlength="1"
289
                        value="[% innerloo.indicator1 | html %]" />
290
                    <input type="text"
291
                        tabindex="1"
292
                        class="indicator flat"
293
                        name="tag_[% innerloo.tag | html %]_indicator2_[% innerloo.index | html %][% innerloo.random | html %]"
294
                        size="1"
295
                        maxlength="1"
296
                        value="[% innerloo.indicator2 | html %]" />
297
                [% END %] -
298
        [% ELSE %]
190
        [% ELSE %]
299
                [% IF ( innerloo.fixedfield ) %]
191
            Adding authority [% authtypetext | html %]
300
                    <input type="hidden"
301
                        tabindex="1"
302
                        name="tag_[% innerloo.tag | html %]_indicator1_[% innerloo.index | html %][% innerloo.random | html %]"
303
                        value="[% innerloo.indicator1 | html %]" />
304
                    <input type="hidden"
305
                        tabindex="1"
306
                        name="tag_[% innerloo.tag | html %]_indicator2_[% innerloo.index | html %][% innerloo.random | html %]"
307
                        value="[% innerloo.indicator2 | html %]" />
308
                [% ELSE %]
309
                    <input type="hidden"
310
                        tabindex="1"
311
                        name="tag_[% innerloo.tag | html %]_indicator1_[% innerloo.index | html %][% innerloo.random | html %]"
312
                        value="[% innerloo.indicator1 | html %]" />
313
                    <input type="hidden"
314
                        tabindex="1"
315
                        name="tag_[% innerloo.tag | html %]_indicator2_[% innerloo.index | html %][% innerloo.random | html %]"
316
                        value="[% innerloo.indicator2 | html %]" />
317
                [% END %]
318
        [% END %]
192
        [% END %]
193
    </div>
319
194
320
            [% UNLESS advancedMARCEditor %]
195
    <div class="main container-fluid">
321
                <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>
196
        <div class="row">
322
            [% END %]
197
            <div class="col-md-8 col-md-offset-2">
323
                <span class="field_controls">
324
                [% IF ( innerloo.repeatable ) %]
325
                    <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">
326
                        <img src="[% interface | html %]/[% theme | html %]/img/repeat-tag.png" alt="Repeat this Tag" />
327
                    </a>
328
                [% END %]
329
                    <a href="#" tabindex="1" class="buttonMinus" onclick="UnCloneField('tag_[% innerloo.tag | html %]_[% innerloo.index | html %][% innerloo.random | html %]'); return false;" title="Delete this Tag">
330
                        <img src="[% interface | html %]/[% theme | html %]/img/delete-tag.png" alt="Delete this Tag" />
331
                    </a>
332
                </span>
333
334
        </div>
335
336
        <ul class="sortable_subfield">
337
        [% FOREACH subfield_loo IN innerloo.subfield_loop %]
338
            <!--  One line on the marc editor -->
339
            <li class="subfield_line" style="[% subfield_loo.visibility | html %]" id="subfield[% subfield_loo.tag | html %][% subfield_loo.subfield | html %][% subfield_loo.random | html %]">
340
198
341
                [% UNLESS advancedMARCEditor %]
199
                [% IF ( authid ) %]
342
                    [% 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">
200
                    <h1>Modify authority #[% authid | html %] [% authtypetext | html %]</h1>
343
                    [% ELSE %]<label for="tag_[% subfield_loo.tag | html %]_subfield_[% subfield_loo.subfield | html %]_[% subfield_loo.index | html %]_[% subfield_loo.index_subfield | html %]" class="labelsubfield">
344
                    [% END %]
345
                [% END %]
346
                
347
                [% UNLESS hide_marc %]
348
                <span class="subfieldcode">
349
                        <input type="text"
350
                            title="[% subfield_loo.marc_lib | $raw %]"
351
                            style=" [% IF ( subfield_loo.fixedfield ) %]display:none; [% END %]border:0;"
352
                            name="tag_[% subfield_loo.tag | html %]_code_[% subfield_loo.subfield | html %]_[% subfield_loo.index | html %]_[% subfield_loo.index_subfield | html %]"
353
                            value="[% subfield_loo.subfield | html %]"
354
                            size="1"
355
                            maxlength="1"
356
                            class="flat"
357
                            tabindex="0" />
358
                </span>
359
                [% ELSE %]
201
                [% ELSE %]
360
                    <input type="hidden"
202
                    <h1>Adding authority [% authtypetext | html %]</h1>
361
                        name="tag_[% subfield_loo.tag | html %]_code_[% subfield_loo.subfield | html %]_[% subfield_loo.index | html %]_[% subfield_loo.index_subfield | html %]"
362
                        value="[% subfield_loo.subfield | html %]" />
363
                [% END %]
203
                [% END %]
364
204
365
                [% UNLESS advancedMARCEditor %]
205
                [% IF ( duplicateauthid ) %]
366
                    [% IF ( subfield_loo.mandatory ) %]<span class="subfield subfield_mandatory">[% ELSE %]<span class="subfield">[% END %]
206
                    <div class="dialog alert">
367
                        [% subfield_loo.marc_lib | $raw %]
207
                        <h3>Duplicate record suspected</h3>
368
                        [% IF ( subfield_loo.mandatory ) %]<span class="mandatory_marker" title="This field is mandatory">*</span>[% END %]
208
                        <p>Is this a duplicate of <a href="/cgi-bin/koha/authorities/detail.pl?authid=[% duplicateauthid | uri %]" class="popup" onclick="openWindow('/cgi-bin/koha/authorities/detail.pl?authid=[% duplicateauthid | html %]&amp;popup=1', 'DuplicateAuthority','800','600'); return false;" class="button">[% duplicateauthvalue | html %]</a> ?</p>
369
                    </span>
209
370
                    </label>
210
                        <form action="authorities.pl" method="get">
211
                            <input type="hidden" name="authid" value="[% duplicateauthid | html %]" />
212
                            <button type="submit" class="new"><i class="fa fa-pencil"></i> Yes: Edit existing authority</button>
213
                        </form>
214
                        <form action="authorities.pl" method="get">
215
                            <button class="new" onclick="confirmnotdup('items'); return false;"><i class="fa fa-save"></i> No: Save as new authority</button>
216
                        </form>
217
                    </div>
371
                [% END %]
218
                [% END %]
372
                
373
                [% SET mv = subfield_loo.marc_value %]
374
                [% IF ( mv.type == 'select' ) %]
375
                    [% IF mv.category AND CAN_user_parameters_manage_auth_values %]
376
                        <select name="[%- mv.name | html -%]" tabindex="1" size="1" class="input_marceditor" id="[%- mv.id | html -%]" data-category="[% mv.category | html %]">
377
                    [% ELSE %]
378
                        <select name="[%- mv.name | html -%]" tabindex="1" size="1" class="input_marceditor select2" id="[%- mv.id | html -%]">
379
                    [% END %]
380
219
381
                     [% FOREACH aval IN mv.values %]
220
                <form method="post" name="f" action="/cgi-bin/koha/authorities/authorities.pl">
382
                         [% IF aval == mv.default %]
221
                    <input type="hidden" name="op" value="add" />
383
                         <option value="[%- aval | html -%]" selected="selected">[%- mv.labels.$aval | html -%]</option>
222
                    <input type="hidden" name="addfield_field" value="" />
384
                         [% ELSE %]
223
                    <input type="hidden" name="repeat_field" value="" />
385
                         <option value="[%- aval | html -%]">[%- mv.labels.$aval | html -%]</option>
224
                    <input type="hidden" name="authtypecode" value="[% authtypecode | html %]" />
386
                         [% END %]
225
                    <input type="hidden" name="authid" value="[% authid | html %]" />
387
                     [% END %]
226
                    <input type="hidden" name="index" value="[% index | html %]" />
388
                     </select>
227
                    <input type="hidden" value="0" id="confirm_not_duplicate" name="confirm_not_duplicate" />
389
                [% ELSIF ( mv.type == 'text1' ) %]
228
390
                    <input type="text" id="[%- mv.id | html -%]" name="[%- mv.id | html -%]" value="[%- mv.value | html -%]" class="input_marceditor" tabindex="1" />
229
                    <div id="toolbar" class="btn-toolbar">
391
                    <a href="#" class="buttonDot" onclick="openAuth(this.parentNode.getElementsByTagName('input')[1].id,'[%- mv.authtypecode | html -%]','auth'); return false;" tabindex="1" title="Tag editor">...</a>
230
                        <div class="btn-group"><a href="#" id="addauth" class="btn btn-default" accesskey="w"><i class="fa fa-save"></i> Save</a></div>
392
                [% ELSIF ( mv.type == 'text2' ) %]
231
                        <div class="btn-group">
393
                    <input type="text" id="[%- mv.id | html -%]" size="67" maxlength="[%- mv.maxlength | html -%]" name="[%- mv.name | html -%]" value="[%- mv.value | html -%]" class="input_marceditor" />
232
                            [% IF ( authid ) %]
394
                    [% IF mv.noclick %]
233
                                <a class="btn btn-default" id="z3950submit" href="#"><i class="fa fa-search"></i> Replace record via Z39.50/SRU search</a>
395
                        <a href="#" class="buttonDot tag_editor disabled" tabindex="-1" title="No popup">...</a>
234
                            [% ELSE %]
396
                    [% ELSE %]
235
                                <a class="btn btn-default" id="z3950submit" href="#"><i class="fa fa-search"></i> Z39.50/SRU search</a>
397
                        <a href="#" id="buttonDot_[% mv.id | html %]" class="buttonDot tag_editor" title="Tag editor">...</a>
236
                            [% END %]
237
                        </div>
238
                        <div class="btn-group">
239
                            [% IF ( authid ) %]
240
                                <a class="btn btn-default" id="cancel" href="/cgi-bin/koha/authorities/detail.pl?authid=[% authid | url %]">Cancel</a>
241
                            [% ELSE %]
242
                                <a class="btn btn-default" id="cancel" href="/cgi-bin/koha/authorities/authorities-home.pl">Cancel</a>
243
                            [% END %]
244
                        </div>
245
                    </div>
246
247
                    <div id="authoritytabs" class="toptabs numbered">
248
                        <ul>
249
                            [% FOREACH BIG_LOO IN BIG_LOOP %]
250
                                <li><a href="#tab[% BIG_LOO.number | uri %]XX">[% BIG_LOO.number | html %]</a></li>
251
                            [% END %]
252
                        </ul>
253
254
                        [% FOREACH BIG_LOO IN BIG_LOOP %]
255
                            <div id="tab[% BIG_LOO.number | html %]XX">
256
                                [% previous = "" %]
257
                                [% FOREACH innerloo IN BIG_LOO.innerloop %]
258
                                    [% IF ( innerloo.tag ) %]
259
                                        [% IF innerloo.tag != previous %]
260
                                            [% IF previous != "" %]
261
                                                </ul>
262
                                            [% END %]
263
                                            [% previous = innerloo.tag %]
264
                                            <ul class="sortable_field">
265
                                        [% END %]
266
                                            <li class="tag clearfix" id="tag_[% innerloo.tag | html %]_[% innerloo.index | html %][% innerloo.random | html %]">
267
                                                <div class="tag_title" id="div_indicator_tag_[% innerloo.tag | html %]_[% innerloo.index | html %][% innerloo.random | html %]">
268
                                                    [% UNLESS hide_marc %]
269
                                                        [% IF advancedMARCEditor %]
270
                                                            <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>
271
                                                        [% ELSE %]
272
                                                            <span title="[% innerloo.tag_lib | html %]">[% innerloo.tag | html %]</span>
273
                                                        [% END %]
274
275
                                                        [% IF ( innerloo.fixedfield ) %]
276
                                                            <input type="text"
277
                                                                tabindex="1"
278
                                                                class="indicator flat"
279
                                                                style="display:none;"
280
                                                                name="tag_[% innerloo.tag | html %]_indicator1_[% innerloo.index | html %][% innerloo.random | html %]"
281
                                                                size="1"
282
                                                                maxlength="1"
283
                                                                value="[% innerloo.indicator1 | html %]" />
284
                                                            <input type="text"
285
                                                                tabindex="1"
286
                                                                class="indicator flat"
287
                                                                style="display:none;"
288
                                                                name="tag_[% innerloo.tag | html %]_indicator2_[% innerloo.index | html %][% innerloo.random | html %]"
289
                                                                size="1"
290
                                                                maxlength="1"
291
                                                                value="[% innerloo.indicator2 | html %]" />
292
                                                        [% ELSE %]
293
                                                            <input type="text"
294
                                                                tabindex="1"
295
                                                                class="indicator flat"
296
                                                                name="tag_[% innerloo.tag | html %]_indicator1_[% innerloo.index | html %][% innerloo.random | html %]"
297
                                                                size="1"
298
                                                                maxlength="1"
299
                                                                value="[% innerloo.indicator1 | html %]" />
300
                                                            <input type="text"
301
                                                                tabindex="1"
302
                                                                class="indicator flat"
303
                                                                name="tag_[% innerloo.tag | html %]_indicator2_[% innerloo.index | html %][% innerloo.random | html %]"
304
                                                                size="1"
305
                                                                maxlength="1"
306
                                                                value="[% innerloo.indicator2 | html %]" />
307
                                                        [% END %] -
308
                                                    [% ELSE %]
309
                                                        [% IF ( innerloo.fixedfield ) %]
310
                                                            <input type="hidden"
311
                                                                tabindex="1"
312
                                                                name="tag_[% innerloo.tag | html %]_indicator1_[% innerloo.index | html %][% innerloo.random | html %]"
313
                                                                value="[% innerloo.indicator1 | html %]" />
314
                                                            <input type="hidden"
315
                                                                tabindex="1"
316
                                                                name="tag_[% innerloo.tag | html %]_indicator2_[% innerloo.index | html %][% innerloo.random | html %]"
317
                                                                value="[% innerloo.indicator2 | html %]" />
318
                                                        [% ELSE %]
319
                                                            <input type="hidden"
320
                                                                tabindex="1"
321
                                                                name="tag_[% innerloo.tag | html %]_indicator1_[% innerloo.index | html %][% innerloo.random | html %]"
322
                                                                value="[% innerloo.indicator1 | html %]" />
323
                                                            <input type="hidden"
324
                                                                tabindex="1"
325
                                                                name="tag_[% innerloo.tag | html %]_indicator2_[% innerloo.index | html %][% innerloo.random | html %]"
326
                                                                value="[% innerloo.indicator2 | html %]" />
327
                                                        [% END %]
328
                                                    [% END %]
329
330
                                                    [% UNLESS advancedMARCEditor %]
331
                                                        <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>
332
                                                    [% END %]
333
334
                                                    <span class="field_controls">
335
                                                        [% IF ( innerloo.repeatable ) %]
336
                                                            <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">
337
                                                                <img src="[% interface | html %]/[% theme | html %]/img/repeat-tag.png" alt="Repeat this Tag" />
338
                                                            </a>
339
                                                        [% END %]
340
                                                        <a href="#" tabindex="1" class="buttonMinus" onclick="UnCloneField('tag_[% innerloo.tag | html %]_[% innerloo.index | html %][% innerloo.random | html %]'); return false;" title="Delete this Tag">
341
                                                            <img src="[% interface | html %]/[% theme | html %]/img/delete-tag.png" alt="Delete this Tag" />
342
                                                        </a>
343
                                                    </span>
344
                                                </div>
345
346
                                                <ul class="sortable_subfield">
347
                                                    [% FOREACH subfield_loo IN innerloo.subfield_loop %]
348
                                                        <!--  One line on the marc editor -->
349
                                                        <li class="subfield_line" style="[% subfield_loo.visibility | html %]" id="subfield[% subfield_loo.tag | html %][% subfield_loo.subfield | html %][% subfield_loo.random | html %]">
350
351
                                                            [% UNLESS advancedMARCEditor %]
352
                                                                [% IF ( subfield_loo.fixedfield ) %]
353
                                                                    <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">
354
                                                                [% ELSE %]
355
                                                                    <label for="tag_[% subfield_loo.tag | html %]_subfield_[% subfield_loo.subfield | html %]_[% subfield_loo.index | html %]_[% subfield_loo.index_subfield | html %]" class="labelsubfield">
356
                                                                [% END %]
357
                                                            [% END %]
358
359
                                                            [% UNLESS hide_marc %]
360
                                                                <span class="subfieldcode">
361
                                                                    <input type="text"
362
                                                                        title="[% subfield_loo.marc_lib | $raw %]"
363
                                                                        style=" [% IF ( subfield_loo.fixedfield ) %]display:none; [% END %]border:0;"
364
                                                                        name="tag_[% subfield_loo.tag | html %]_code_[% subfield_loo.subfield | html %]_[% subfield_loo.index | html %]_[% subfield_loo.index_subfield | html %]"
365
                                                                        value="[% subfield_loo.subfield | html %]"
366
                                                                        size="1"
367
                                                                        maxlength="1"
368
                                                                        class="flat"
369
                                                                        tabindex="0" />
370
                                                                </span>
371
                                                            [% ELSE %]
372
                                                                <input type="hidden"
373
                                                                    name="tag_[% subfield_loo.tag | html %]_code_[% subfield_loo.subfield | html %]_[% subfield_loo.index | html %]_[% subfield_loo.index_subfield | html %]"
374
                                                                    value="[% subfield_loo.subfield | html %]" />
375
                                                            [% END %]
376
377
                                                            [% UNLESS advancedMARCEditor %]
378
                                                                    [% IF ( subfield_loo.mandatory ) %]
379
                                                                        <span class="subfield subfield_mandatory">
380
                                                                    [% ELSE %]
381
                                                                        <span class="subfield">
382
                                                                    [% END %]
383
                                                                    [% subfield_loo.marc_lib | $raw %]
384
                                                                    [% IF ( subfield_loo.mandatory ) %]
385
                                                                        <span class="mandatory_marker" title="This field is mandatory">*</span>
386
                                                                    [% END %]
387
                                                                    </span>
388
                                                                </label>
389
                                                            [% END %]
390
391
                                                            [% SET mv = subfield_loo.marc_value %]
392
                                                            [% IF ( mv.type == 'select' ) %]
393
                                                                [% IF mv.category AND CAN_user_parameters_manage_auth_values %]
394
                                                                    <select name="[%- mv.name | html -%]" tabindex="1" size="1" class="input_marceditor" id="[%- mv.id | html -%]" data-category="[% mv.category | html %]">
395
                                                                [% ELSE %]
396
                                                                    <select name="[%- mv.name | html -%]" tabindex="1" size="1" class="input_marceditor select2" id="[%- mv.id | html -%]">
397
                                                                [% END %]
398
399
                                                                [% FOREACH aval IN mv.values %]
400
                                                                    [% IF aval == mv.default %]
401
                                                                        <option value="[%- aval | html -%]" selected="selected">[%- mv.labels.$aval | html -%]</option>
402
                                                                    [% ELSE %]
403
                                                                        <option value="[%- aval | html -%]">[%- mv.labels.$aval | html -%]</option>
404
                                                                    [% END %]
405
                                                                [% END %]
406
                                                                </select>
407
                                                            [% ELSIF ( mv.type == 'text1' ) %]
408
                                                                <input type="text" id="[%- mv.id | html -%]" name="[%- mv.id | html -%]" value="[%- mv.value | html -%]" class="input_marceditor" tabindex="1" />
409
                                                                <a href="#" class="buttonDot" onclick="openAuth(this.parentNode.getElementsByTagName('input')[1].id,'[%- mv.authtypecode | html -%]','auth'); return false;" tabindex="1" title="Tag editor">...</a>
410
                                                            [% ELSIF ( mv.type == 'text2' ) %]
411
                                                                <input type="text" id="[%- mv.id | html -%]" size="67" maxlength="[%- mv.maxlength | html -%]" name="[%- mv.name | html -%]" value="[%- mv.value | html -%]" class="input_marceditor" />
412
                                                                [% IF mv.noclick %]
413
                                                                    <a href="#" class="buttonDot tag_editor disabled" tabindex="-1" title="No popup">...</a>
414
                                                                [% ELSE %]
415
                                                                    <a href="#" id="buttonDot_[% mv.id | html %]" class="buttonDot tag_editor" title="Tag editor">...</a>
416
                                                                [% END %]
417
                                                                [% mv.javascript | $raw %]
418
                                                            [% ELSIF ( mv.type == 'text' ) %]
419
                                                                <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 -%]" />
420
                                                            [% ELSIF ( mv.type == 'textarea' ) %]
421
                                                                <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>
422
                                                            [% ELSIF ( mv.type == 'hidden' ) %]
423
                                                                <input tabindex="1" type="hidden" id="[%- mv.id | html -%]" name="[%- mv.name | html -%]" size="67" maxlength="[%- mv.maxlength | html -%]" value="[%- mv.value | html -%]" />
424
                                                            [% ELSIF ( mv.type == 'hidden_simple' ) %]
425
                                                                <input type="hidden" name="[%- mv.name | html -%]" />
426
                                                            [% END %]
427
428
                                                            <span class="subfield_controls">
429
                                                                [% IF ( subfield_loo.repeatable ) %]
430
                                                                    <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;">
431
                                                                        <img src="[% interface | html %]/[% theme | html %]/img/clone-subfield.png" alt="Clone" title="Clone this subfield" />
432
                                                                    </a>
433
                                                                    <a href="#" class="buttonMinus" tabindex="1" onclick="UnCloneField('subfield[% subfield_loo.tag | html %][% subfield_loo.subfield | html %][% subfield_loo.random | html %]'); return false;">
434
                                                                        <img src="[% interface | html %]/[% theme | html %]/img/delete-subfield.png" alt="Delete" title="Delete this subfield" />
435
                                                                    </a>
436
                                                                [% END %]
437
                                                            </span>
438
                                                        </li>
439
                                                        <!-- End of the line -->
440
                                                    [% END %]
441
                                                </ul> <!-- /.sortable_subfield -->
442
                                            </li>
443
                                    [% END %]<!-- if innerloo.tag -->
444
                                [% END %]<!-- BIG_LOO.innerloop -->
445
                            </ul> <!-- /.sortable_field -->
446
                        </div>
447
                    [% END %]<!-- BIG_LOOP -->
448
                </div><!-- tabs -->
449
450
                <div name="hidden" id="hidden" class="tab">
451
                    [% FOREACH hidden_loo IN hidden_loop %]
452
                        <input type="hidden" name="tag" value="[% hidden_loo.tag | html %]" />
453
                        <input type="hidden" name="subfield" value="[% hidden_loo.subfield | html %]" />
454
                        <input type="hidden" name="mandatory" value="[% hidden_loo.mandatory | html %]" />
455
                        <input type="hidden" name="kohafield" value="[% hidden_loo.kohafield | html %]" />
456
                        <input type="hidden" name="tag_mandatory" value="[% hidden_loo.tag_mandatory | html %]" />
398
                    [% END %]
457
                    [% END %]
399
                    [% mv.javascript | $raw %]
458
                </div>
400
                [% ELSIF ( mv.type == 'text' ) %]
459
401
                    <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 -%]" />
460
                [% IF ( oldauthnumtagfield ) %]
402
                [% ELSIF ( mv.type == 'textarea' ) %]
461
                    <input type="hidden" name="tag" value="[% oldauthnumtagfield | html %]" />
403
                    <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>
462
                    <input type="hidden" name="subfield" value="[% oldauthnumtagsubfield | html %]" />
404
                [% ELSIF ( mv.type == 'hidden' ) %]
463
                    <input type="hidden" name="field_value" value="[% authid | html %]" />
405
                    <input tabindex="1" type="hidden" id="[%- mv.id | html -%]" name="[%- mv.name | html -%]" size="67" maxlength="[%- mv.maxlength | html -%]" value="[%- mv.value | html -%]" />
464
                    <input type="hidden" name="mandatory" value="0" />
406
                [% ELSIF ( mv.type == 'hidden_simple' ) %]
465
                    <input type="hidden" name="kohafield" value="[% kohafield | html %]" />
407
                    <input type="hidden" name="[%- mv.name | html -%]" />
466
                    <input type="hidden" name="tag_mandatory" value="[% tag_mandatory | html %]" />
467
                    <input type="hidden" name="tag" value="[% oldauthtypetagfield | html %]" />
468
                    <input type="hidden" name="subfield" value="[% oldauthtypetagsubfield | html %]" />
469
                    <input type="hidden" name="field_value" value="[% authtypecode | html %]" />
408
                [% END %]
470
                [% END %]
471
            </form>
409
472
410
                <span class="subfield_controls">
473
            [% INCLUDE 'modals/cataloguing_create_av.inc' %]
411
                [% IF ( subfield_loo.repeatable ) %]
412
                    <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;">
413
                        <img src="[% interface | html %]/[% theme | html %]/img/clone-subfield.png" alt="Clone" title="Clone this subfield" />
414
                    </a>
415
                    <a href="#" class="buttonMinus" tabindex="1" onclick="UnCloneField('subfield[% subfield_loo.tag | html %][% subfield_loo.subfield | html %][% subfield_loo.random | html %]'); return false;">
416
                        <img src="[% interface | html %]/[% theme | html %]/img/delete-subfield.png" alt="Delete" title="Delete this subfield" />
417
                    </a>
418
                [% END %]
419
                </span>
420
                                </li>
421
                                <!-- End of the line -->
422
                            [% END %]
423
                            </ul> <!-- /.sortable_subfield -->
424
                        </li>
425
                    [% END %]<!-- if innerloo.tag -->
426
                [% END %]<!-- BIG_LOO.innerloop -->
427
                </ul> <!-- /.sortable_field -->
428
            </div>
429
        [% END %]<!-- BIG_LOOP -->
430
    </div><!-- tabs -->
431
432
<div name="hidden" id="hidden" class="tab">
433
[% FOREACH hidden_loo IN hidden_loop %]
434
    <input type="hidden" name="tag" value="[% hidden_loo.tag | html %]" />
435
    <input type="hidden" name="subfield" value="[% hidden_loo.subfield | html %]" />
436
    <input type="hidden" name="mandatory" value="[% hidden_loo.mandatory | html %]" />
437
    <input type="hidden" name="kohafield" value="[% hidden_loo.kohafield | html %]" />
438
    <input type="hidden" name="tag_mandatory" value="[% hidden_loo.tag_mandatory | html %]" />
439
[% END %]
440
</div>
441
[% IF ( oldauthnumtagfield ) %]
442
    <input type="hidden" name="tag" value="[% oldauthnumtagfield | html %]" />
443
    <input type="hidden" name="subfield" value="[% oldauthnumtagsubfield | html %]" />
444
    <input type="hidden" name="field_value" value="[% authid | html %]" />
445
    <input type="hidden" name="mandatory" value="0" />
446
    <input type="hidden" name="kohafield" value="[% kohafield | html %]" />
447
    <input type="hidden" name="tag_mandatory" value="[% tag_mandatory | html %]" />
448
    <input type="hidden" name="tag" value="[% oldauthtypetagfield | html %]" />
449
    <input type="hidden" name="subfield" value="[% oldauthtypetagsubfield | html %]" />
450
    <input type="hidden" name="field_value" value="[% authtypecode | html %]" />
451
[% END %]
452
453
</form>
454
455
[% INCLUDE 'modals/cataloguing_create_av.inc' %]
456
474
457
</div>
475
        </div>
458
</div>
476
    </div>
459
</div>
477
</div>
460
478
461
[% INCLUDE 'intranet-bottom.inc' %]
479
[% INCLUDE 'intranet-bottom.inc' %]
462
- 

Return to bug 26975