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

(-)a/admin/auth_subfields_structure.pl (-88 / +48 lines)
Lines 23-28 use C4::Output; Link Here
23
use C4::Auth;
23
use C4::Auth;
24
use CGI;
24
use CGI;
25
use C4::Context;
25
use C4::Context;
26
use C4::Koha;
26
27
27
28
28
sub string_search  {
29
sub string_search  {
Lines 92-115 if ($op eq 'add_form') { Link Here
92
	}
93
	}
93
	
94
	
94
	# build authorised value list
95
	# build authorised value list
95
	$sth2 = $dbh->prepare("select distinct category from authorised_values");
96
        my $authorised_values = C4::Koha::GetAuthorisedValueCategories;
96
	$sth2->execute;
97
        unshift @$authorised_values,"";
97
	my @authorised_values;
98
	push (@$authorised_values,"branches");
98
	push @authorised_values,"";
99
	push (@$authorised_values,"itemtypes");
99
	while ((my $category) = $sth2->fetchrow_array) {
100
		push @authorised_values, $category;
101
	}
102
	push (@authorised_values,"branches");
103
	push (@authorised_values,"itemtypes");
104
    
100
    
105
    # build thesaurus categories list
101
    # build thesaurus categories list
106
    $sth2 = $dbh->prepare("select authtypecode from auth_types");
102
    my $authtypes = getauthtypes;
107
    $sth2->execute;
108
    my @authtypes;
109
    push @authtypes, "";
110
    while ( ( my $authtypecode ) = $sth2->fetchrow_array ) {
111
        push @authtypes, $authtypecode;
112
    }
113
103
114
	# build value_builder list
104
	# build value_builder list
115
	my @value_builder=('');
105
	my @value_builder=('');
Lines 159-165 if ($op eq 'add_form') { Link Here
159
                                        },
149
                                        },
160
					-default=>$data->{'tab'},
150
					-default=>$data->{'tab'},
161
					-size=>1,
151
					-size=>1,
162
		 			-tabindex=>'',
163
					-multiple=>0,
152
					-multiple=>0,
164
					);
153
					);
165
		$row_data{ohidden} = CGI::scrolling_list(-name=>'ohidden',
154
		$row_data{ohidden} = CGI::scrolling_list(-name=>'ohidden',
Lines 207-253 if ($op eq 'add_form') { Link Here
207
					-size=>1,
196
					-size=>1,
208
					-multiple=>0,
197
					-multiple=>0,
209
					);
198
					);
210
		$row_data{authorised_value}  = CGI::scrolling_list(-name=>'authorised_value',
199
                $row_data{authorised_value} = {
211
					-id=>"authorised_value$i",
200
                  id      => "authorised_value$i",
212
					-values=> \@authorised_values,
201
                  codes   => $authorised_values,
213
					-default=>$data->{'authorised_value'},
202
                  default => $data->{'authorised_value'},
214
					-size=>1,
203
                                              };
215
		 			-tabindex=>'',
204
                $row_data{frameworkcode}    = {
216
					-multiple=>0,
205
                  id      => "frameworkcode$i",
217
					);
206
                  codes   => $authtypes,
218
		$row_data{frameworkcode}  = CGI::scrolling_list(-name=>'frameworkcode',
207
                  default => $data->{'frameworkcode'},
219
					-id=>"frameworkcode$i",
208
                                              };
220
					-values=> \@authtypes,
209
		$row_data{value_builder}    = {
221
					-default=>$data->{'frameworkcode'},
210
                  id      => "value_builder$i",
222
					-size=>1,
211
                  codes   => \@value_builder,
223
		 			-tabindex=>'',
212
                  default =>$data->{'value_builder'},
224
					-multiple=>0,
213
                                              };
225
					);
226
		$row_data{value_builder}  = CGI::scrolling_list(-name=>'value_builder',
227
					-id=>"value_builder$i",
228
					-values=> \@value_builder,
229
					-default=>$data->{'value_builder'},
230
					-size=>1,
231
		 			-tabindex=>'',
232
					-multiple=>0,
233
					);
234
		
235
		$row_data{repeatable} = CGI::checkbox(-name=>"repeatable$i",
214
		$row_data{repeatable} = CGI::checkbox(-name=>"repeatable$i",
236
	-checked => $data->{'repeatable'}?'checked':'',
215
	-checked => $data->{'repeatable'}?'checked':'',
237
	-value => 1,
216
	-value => 1,
238
	-label => '',
239
	-id => "repeatable$i");
217
	-id => "repeatable$i");
240
		$row_data{mandatory} = CGI::checkbox(-name => "mandatory$i",
218
		$row_data{mandatory} = CGI::checkbox(-name => "mandatory$i",
241
	-checked => $data->{'mandatory'}?'checked':'',
219
	-checked => $data->{'mandatory'}?'checked':'',
242
	-value => 1,
220
	-value => 1,
243
	-label => '',
244
	-id => "mandatory$i");
221
	-id => "mandatory$i");
245
		$row_data{hidden} = CGI::escapeHTML($data->{hidden}) ;
222
		$row_data{hidden} = CGI::escapeHTML($data->{hidden}) ;
246
		$row_data{isurl} = CGI::checkbox( -name => "isurl$i",
223
		$row_data{isurl} = CGI::checkbox( -name => "isurl$i",
247
			-id => "isurl$i",
224
			-id => "isurl$i",
248
			-checked => $data->{'isurl'}?'checked':'',
225
			-checked => $data->{'isurl'}?'checked':'',
249
			-value => 1,
226
			-value => 1);
250
			-label => '');
251
		$row_data{row} = $i;
227
		$row_data{row} = $i;
252
		push(@loop_data, \%row_data);
228
		push(@loop_data, \%row_data);
253
		$i++;
229
		$i++;
Lines 257-263 if ($op eq 'add_form') { Link Here
257
		my %row_data;  # get a fresh hash for the row data
233
		my %row_data;  # get a fresh hash for the row data
258
        $row_data{'new_subfield'} = 1;
234
        $row_data{'new_subfield'} = 1;
259
		$row_data{tab} = CGI::scrolling_list(-name=>'tab',
235
		$row_data{tab} = CGI::scrolling_list(-name=>'tab',
260
					-id => "tab$i",
236
					-id => "tab",
261
                                        -values =>
237
                                        -values =>
262
                                        [ '-1', '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', '10' ],
238
                                        [ '-1', '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', '10' ],
263
                                        -labels => {
239
                                        -labels => {
Lines 275-285 if ($op eq 'add_form') { Link Here
275
                                        },
251
                                        },
276
					-default=>"",
252
					-default=>"",
277
					-size=>1,
253
					-size=>1,
278
		 			-tabindex=>'',
279
					-multiple=>0,
254
					-multiple=>0,
280
					);
255
					);
281
		$row_data{ohidden} = CGI::scrolling_list(-name=>'ohidden',
256
		$row_data{ohidden} = CGI::scrolling_list(-name=>'ohidden',
282
					-id=>"ohidden$i",
257
					-id=>"ohidden",
283
					#-values=>['0','1','2'],
258
					#-values=>['0','1','2'],
284
					#-labels => {'0'=>'Show','1'=>'Show Collapsed',
259
					#-labels => {'0'=>'Show','1'=>'Show Collapsed',
285
					#				'2' =>'Hide',
260
					#				'2' =>'Hide',
Lines 294-300 if ($op eq 'add_form') { Link Here
294
					);
269
					);
295
270
296
		#$row_data{ihidden} = CGI::scrolling_list(-name=>'ihidden',
271
		#$row_data{ihidden} = CGI::scrolling_list(-name=>'ihidden',
297
		#			-id=>"ihidden$i",
272
		#			-id=>"ihidden",
298
		#			-values=>['0','1','2'],
273
		#			-values=>['0','1','2'],
299
		#			-labels => {'0'=>'Show','1'=>'Show Collapsed',
274
		#			-labels => {'0'=>'Show','1'=>'Show Collapsed',
300
		#							'2' =>'Hide',
275
		#							'2' =>'Hide',
Lines 304-310 if ($op eq 'add_form') { Link Here
304
		#			-multiple=>0,
279
		#			-multiple=>0,
305
		#			);
280
		#			);
306
		#$row_data{ehidden} = CGI::scrolling_list(-name=>'ehidden',
281
		#$row_data{ehidden} = CGI::scrolling_list(-name=>'ehidden',
307
		#			-id=>"ehidden$i",
282
		#			-id=>"ehidden",
308
		#			-values=>['0','1','2'],
283
		#			-values=>['0','1','2'],
309
		#			-labels => {'0'=>'Show','1'=>'Show Collapsed',
284
		#			-labels => {'0'=>'Show','1'=>'Show Collapsed',
310
		#							'2' =>'Hide',
285
		#							'2' =>'Hide',
Lines 314-373 if ($op eq 'add_form') { Link Here
314
		#			-multiple=>0,
289
		#			-multiple=>0,
315
		#			);
290
		#			);
316
		$row_data{tagsubfieldinput} = "<input type=\"text\" name=\"tagsubfield\" value=\"".$data->{'tagsubfield'}."\" size=\"1\" id=\"tagsubfield\" maxlength=\"1\" />";
291
		$row_data{tagsubfieldinput} = "<input type=\"text\" name=\"tagsubfield\" value=\"".$data->{'tagsubfield'}."\" size=\"1\" id=\"tagsubfield\" maxlength=\"1\" />";
317
                $row_data{tagsubfieldinput} = 
318
                        "<label><input type=\"text\" name=\"tagsubfield\" value=\""
319
                        . $data->{'tagsubfield'}
320
                        . "\" size=\"1\" id=\"tagsubfield\" maxlength=\"1\" /></label>";
321
		$row_data{tagsubfield} = $data->{'tagsubfield'};
292
		$row_data{tagsubfield} = $data->{'tagsubfield'};
322
		$row_data{liblibrarian} = "";
293
		$row_data{liblibrarian} = "";
323
		$row_data{libopac} = "";
294
		$row_data{libopac} = "";
324
		$row_data{seealso} = "";
295
		$row_data{seealso} = "";
325
		$row_data{hidden} = "000";
296
		$row_data{hidden} = "000";
326
		$row_data{repeatable} = CGI::checkbox( -name=> 'repeatable',
297
		$row_data{repeatable} = CGI::checkbox( -name=> 'repeatable',
327
				-id => "repeatable$i",
298
				-id => "repeatable",
328
				-checked => '',
299
				-checked => '',
329
				-value => 1,
300
				-value => 1);
330
				-label => '');
331
		$row_data{mandatory} = CGI::checkbox( -name=> 'mandatory',
301
		$row_data{mandatory} = CGI::checkbox( -name=> 'mandatory',
332
			-id => "mandatory$i",
302
			-id => "mandatory",
333
			-checked => '',
303
			-checked => '',
334
			-value => 1,
304
			-value => 1);
335
			-label => '');
336
		$row_data{isurl} = CGI::checkbox(-name => 'isurl',
305
		$row_data{isurl} = CGI::checkbox(-name => 'isurl',
337
			-id => "isurl$i",
306
			-id => "isurl",
338
			-checked => '',
307
			-checked => '',
339
			-value => 1,
308
			-value => 1);
340
			-label => '');
341
		$row_data{kohafield}= CGI::scrolling_list( -name=>'kohafield',
309
		$row_data{kohafield}= CGI::scrolling_list( -name=>'kohafield',
342
					-id => "kohafield$i",
310
					-id => "kohafield",
343
					-values=> \@kohafields,
311
					-values=> \@kohafields,
344
					-default=> "",
312
					-default=> "",
345
					-size=>1,
313
					-size=>1,
346
					-multiple=>0,
314
					-multiple=>0,
347
					);
315
					);
348
		$row_data{frameworkcode}  = CGI::scrolling_list(-name=>'frameworkcode',
316
                $row_data{frameworkcode}    = {
349
					-id=>'frameworkcode',
317
                  id      => "frameworkcode",
350
					-values=> \@authtypes,
318
                  codes   => $authtypes,
351
					-default=>$data->{'frameworkcode'},
319
                  default => $data->{'frameworkcode'},
352
					-size=>1,
320
                                           };
353
		 			-tabindex=>'',
321
		$row_data{authorised_value} = {
354
					-multiple=>0,
322
                  id      => 'authorised_value',
355
					);
323
                  codes   => @$authorised_values,
356
		$row_data{authorised_value}  = CGI::scrolling_list(-name=>'authorised_value',
324
                  default => $data->{'authorised_value'},
357
					-id => 'authorised_value',
325
                                              };
358
					-values=> \@authorised_values,
326
		$row_data{value_builder}    = {
359
					-size=>1,
327
                  id      => "value_builder",
360
		 			-tabindex=>'',
328
                  codes   => \@value_builder,
361
					-multiple=>0,
329
                  default =>$data->{'value_builder'},
362
					);
330
                                              };
363
		$row_data{value_builder}  = CGI::scrolling_list(-name=>'value_builder',
364
					-id=>'value_builder',
365
					-values=> \@value_builder,
366
					-default=>$data->{'value_builder'},
367
					-size=>1,
368
		 			-tabindex=>'',
369
					-multiple=>0,
370
					);
371
		$row_data{row} = $i;
331
		$row_data{row} = $i;
372
		push(@loop_data, \%row_data);
332
		push(@loop_data, \%row_data);
373
	}
333
	}
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/auth_subfields_structure.tt (-12 / +125 lines)
Lines 77-93 function displayMoreConstraint(numlayer){ Link Here
77
        <div id="sub[% loo.tagsubfield %]field">
77
        <div id="sub[% loo.tagsubfield %]field">
78
            <fieldset class="rows"><ol>
78
            <fieldset class="rows"><ol>
79
79
80
                    [% IF ( loo.new_subfield ) %]
80
                [% IF ( loo.new_subfield ) %]
81
                <li><label for="tagsubfieldinput[% loo.row %]">Subfield code: </label>[% loo.tagsubfieldinput %]&nbsp;</li>
81
                <li><label for="tagsubfield">Subfield code: </label>[% loo.tagsubfieldinput %]&nbsp;</li>
82
                    [% ELSE %]
82
                <li><label for="repeatable">Repeatable: </label>[% loo.repeatable %]&nbsp;</li>
83
                <li><label for="mandatory">Mandatory: </label>[% loo.mandatory %]&nbsp;</li>
84
                <li><label for="liblibrarian">Text for librarian: </label><input id="liblibrarian" type="text" name="liblibrarian" value="[% loo.liblibrarian %]" size="40" maxlength="80" /></li>
85
                <li><label for="libopac">Text for OPAC: </label><input type="text" id="libopac" name="libopac" value="[% loo.libopac %]" size="40" maxlength="80" /></li>
86
                <li><label for="tab">Managed in tab: </label>[% loo.tab %] (ignore means that the subfield does not display in the record editor)</li>
87
                <li>
88
                    <fieldset>
89
                        <legend>Display</legend>
90
                        <ol>
91
                            <li><label for="ohidden">Select to display or not:</label>[% loo.ohidden %]  </li>
92
                        </ol>
93
                    </fieldset>
94
                </li>
95
                <li>
96
                    <fieldset class="rows">
97
                        <legend>Advanced constraints:</legend>
98
                        <ol>
99
                            <li><label for="isurl">Is a URL:</label>[% loo.isurl %] (if checked, it means that the subfield is a URL and can be clicked)</li>
100
                            <li>
101
                                <label for="defaultvalue">Default value:</label>
102
                                <input type="text" name="defaultvalue" id="defaultvalue" value="[% loo.defaultvalue %]" />
103
                            </li>
104
                        </ol>
105
                    </fieldset>
106
                </li>
107
                <li>
108
                    <fieldset><legend>Help input</legend>
109
                        <ol>
110
                            <li>
111
<label for="authorised_value">Authorized value:</label>
112
<select name="authorised_value" size="1" id="[% loo.authorised_value.id %]">
113
[%- FOREACH t IN loo.authorised_value.codes -%]
114
    [%- IF loo.authorised_value.default == t && t == "" %]
115
        <!-- this case for a space is necessary to validate HTML nicely. -->
116
        <option selected="selected" value="[% t %]"> </option>
117
    [%- ELSIF loo.frameworkcode.default == t %]
118
        <option selected="selected" value="[% t %]">[% t %]</option>
119
    [%- ELSE %]
120
        <option                     value="[% t %]">[% t %]</option>
121
    [%- END %]
122
[%- END -%]
123
</select>
124
                            </li>
125
                            <li>
126
<label for="frameworkcode">Thesaurus:</label>
127
<select name="frameworkcode"  size="1" id="[% loo.frameworkcode.id %]">
128
[%- FOREACH t IN loo.frameworkcode.codes -%]
129
    [%- IF loo.frameworkcode.default == t.value.authtypecode && t.value.authtypecode == "" %]
130
    <!-- this case for a space is necessary to validate HTML nicely. -->
131
    <option selected="selected" value="[% t.value.authtypecode %]"> </option>
132
    [%- ELSIF loo.frameworkcode.default == t.value.authtypecode %]
133
    <option selected="selected" value="[% t.value.authtypecode %]">[% t.value.authtypecode %]</option>
134
    [%- ELSE %]
135
    <option                     value="[% t.value.authtypecode %]">[% t.value.authtypecode %]</option>
136
    [%- END %]
137
[%- END -%]
138
</select>
139
                            </li>
140
                            <li>
141
<label for="value_builder[% loo.row %]">Plugin:</label>
142
<select name="value_builder[% loo.row %]"  size="1" id="[% loo.value_builder.id %]">
143
[%- FOREACH t IN loo.value_builder.codes -%]
144
    [%- IF loo.value_builder.default == t && t == "" %]
145
    <!-- this case for a space is necessary to validate HTML nicely. -->
146
    <option selected="selected" value="[% t %]"> </option>
147
    [%- ELSIF loo.value_builder.default == t %]
148
    <option selected="selected" value="[% t %]">[% t %]</option>
149
    [%- ELSE %]
150
    <option                     value="[% t %]">[% t %]</option>
151
    [%- END %]
152
[%- END -%]
153
</select>
154
                            </li>
155
                [% ELSE %]
83
                <li>
156
                <li>
84
                <input type="hidden" name="tagsubfield" value="[% loo.tagsubfield %]" />
157
                <input type="hidden" name="tagsubfield" value="[% loo.tagsubfield %]" />
85
                 </li>
86
                    [% END %]
87
                <li><label for="repeatable[% loo.row %]">Repeatable: </label>[% loo.repeatable %]&nbsp;</li>
158
                <li><label for="repeatable[% loo.row %]">Repeatable: </label>[% loo.repeatable %]&nbsp;</li>
88
                <li><label for="mandatory[% loo.row %]">Mandatory: </label>[% loo.mandatory %]&nbsp;</li>
159
                <li><label for="mandatory[% loo.row %]">Mandatory: </label>[% loo.mandatory %]&nbsp;</li>
89
                <li><label for="liblibrarian[% loo.row %]">Text for librarian: </label><input id="liblibrarian[% loo.row %]" type="text" name="liblibrarian" value="[% loo.liblibrarian %]" size="40" maxlength="80" /></li>
160
                <li><label for="liblibrarian[% loo.row %]">Text for librarian: </label><input id="liblibrarian[% loo.row %]" type="text" name="liblibrarian[% loo.row %]" value="[% loo.liblibrarian %]" size="40" maxlength="80" /></li>
90
                <li><label for="libopac[% loo.row %]">Text for OPAC: </label><input type="text" id="libopac[% loo.row %]" name="libopac" value="[% loo.libopac %]" size="40" maxlength="80" /></li>
161
                <li><label for="libopac[% loo.row %]">Text for OPAC: </label><input type="text" id="libopac[% loo.row %]" name="libopac[% loo.row %]" value="[% loo.libopac %]" size="40" maxlength="80" /></li>
91
                <li><label for="tab[% loo.row %]">Managed in tab: </label>[% loo.tab %] (ignore means that the subfield does not display in the record editor)</li>
162
                <li><label for="tab[% loo.row %]">Managed in tab: </label>[% loo.tab %] (ignore means that the subfield does not display in the record editor)</li>
92
                <li>
163
                <li>
93
                    <fieldset>
164
                    <fieldset>
Lines 106-112 function displayMoreConstraint(numlayer){ Link Here
106
                            <li><label for="isurl[% loo.row %]">Is a URL:</label>[% loo.isurl %] (if checked, it means that the subfield is a URL and can be clicked)</li>
177
                            <li><label for="isurl[% loo.row %]">Is a URL:</label>[% loo.isurl %] (if checked, it means that the subfield is a URL and can be clicked)</li>
107
                            <li>
178
                            <li>
108
                                <label for="defaultvalue[% loo.row %]">Default value:</label>
179
                                <label for="defaultvalue[% loo.row %]">Default value:</label>
109
                                <input type="text" name="defaultvalue" id="defaultvalue[% loo.row %]" value="[% loo.defaultvalue %]" />
180
                                <input type="text" name="defaultvalue[% loo.row %]" id="defaultvalue[% loo.row %]" value="[% loo.defaultvalue %]" />
110
                            </li>
181
                            </li>
111
                        </ol>
182
                        </ol>
112
                    </fieldset>
183
                    </fieldset>
Lines 114-122 function displayMoreConstraint(numlayer){ Link Here
114
                <li>
185
                <li>
115
                    <fieldset><legend>Help input</legend>    
186
                    <fieldset><legend>Help input</legend>    
116
                        <ol>
187
                        <ol>
117
                            <li><label for="authorised_value[% loo.row %]">Authorized value:</label> [% loo.authorised_value %]</li>
188
                            <li>
118
                            <li><label for="frameworkcode[% loo.row %]">Thesaurus:</label> [% loo.frameworkcode %]</li>
189
<label for="authorised_value[% loo.row %]">Authorized value:</label>
119
                            <li><label for="value_builder[% loo.row %]">Plugin:</label> [% loo.value_builder %]</li>
190
<select name="authorised_value[% loo.row %]" size="1" id="[% loo.authorised_value.id %]">
191
[%- FOREACH t IN loo.authorised_value.codes -%]
192
    [%- IF loo.authorised_value.default == t && t == "" %]
193
        <!-- this case for a space is necessary to validate HTML nicely. -->
194
        <option selected="selected" value="[% t %]"> </option>
195
    [%- ELSIF loo.frameworkcode.default == t %]
196
        <option selected="selected" value="[% t %]">[% t %]</option>
197
    [%- ELSE %]
198
        <option                     value="[% t %]">[% t %]</option>
199
    [%- END %]
200
[%- END -%]
201
</select>
202
                            </li>
203
                            <li>
204
<label for="frameworkcode[% loo.row %]">Thesaurus:</label>
205
<select name="frameworkcode[% loo.row %]"  size="1" id="[% loo.frameworkcode.id %]">
206
[%- FOREACH t IN loo.frameworkcode.codes -%]
207
    [%- IF loo.frameworkcode.default == t.value.authtypecode && t.value.authtypecode == "" %]
208
    <!-- this case for a space is necessary to validate HTML nicely. -->
209
    <option selected="selected" value="[% t.value.authtypecode %]"> </option>
210
    [%- ELSIF loo.frameworkcode.default == t.value.authtypecode %]
211
    <option selected="selected" value="[% t.value.authtypecode %]">[% t.value.authtypecode %]</option>
212
    [%- ELSE %]
213
    <option                     value="[% t.value.authtypecode %]">[% t.value.authtypecode %]</option>
214
    [%- END %]
215
[%- END -%]
216
</select>
217
                            </li>
218
                            <li>
219
<label for="value_builder[% loo.row %]">Plugin:</label>
220
<select name="value_builder[% loo.row %]"  size="1" id="[% loo.value_builder.id %]">
221
[%- FOREACH t IN loo.value_builder.codes -%]
222
    [%- IF loo.value_builder.default == t && t == "" %]
223
    <!-- this case for a space is necessary to validate HTML nicely. -->
224
    <option selected="selected" value="[% t %]"> </option>
225
    [%- ELSIF loo.value_builder.default == t %]
226
    <option selected="selected" value="[% t %]">[% t %]</option>
227
    [%- ELSE %]
228
    <option                     value="[% t %]">[% t %]</option>
229
    [%- END %]
230
[%- END -%]
231
</select>
232
                            </li>
233
                [% END %]
120
                        </ol>
234
                        </ol>
121
                    </fieldset>
235
                    </fieldset>
122
                </li>
236
                </li>
123
- 

Return to bug 12091