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

(-)a/admin/auth_subfields_structure.pl (-101 / +51 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 91-115 if ($op eq 'add_form') { Link Here
91
		push @kohafields, "auth_header.".$field;
92
		push @kohafields, "auth_header.".$field;
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 180-232 if ($op eq 'add_form') { Link Here
180
					-size=>1,
170
					-size=>1,
181
					-multiple=>0,
171
					-multiple=>0,
182
					);
172
					);
183
		$row_data{authorised_value}  = CGI::scrolling_list(-name=>'authorised_value',
173
		$row_data{authorised_value} = {
184
					-id=>"authorised_value$i",
174
                  id      => "authorised_value$i",
185
					-values=> \@authorised_values,
175
                  codes   => $authorised_values,
186
					-default=>$data->{'authorised_value'},
176
                  default => $data->{'authorised_value'},
187
					-size=>1,
177
                                              };
188
		 			-tabindex=>'',
178
		$row_data{frameworkcode}    = {
189
					-multiple=>0,
179
                  id      => "frameworkcode$i",
190
					);
180
                  codes   => $authtypes,
191
		$row_data{frameworkcode}  = CGI::scrolling_list(-name=>'frameworkcode',
181
                  default => $data->{'frameworkcode'},
192
					-id=>"frameworkcode$i",
182
                                              };
193
					-values=> \@authtypes,
183
		$row_data{value_builder}    = {
194
					-default=>$data->{'frameworkcode'},
184
                  id      => "value_builder$i",
195
					-size=>1,
185
                  codes   => \@value_builder,
196
		 			-tabindex=>'',
186
                  default => $data->{'value_builder'},
197
					-multiple=>0,
187
                                              };
198
					);
188
		$row_data{repeatable} = "<input id=\"repeatable$i\" type=\"checkbox\" " .
199
		$row_data{value_builder}  = CGI::scrolling_list(-name=>'value_builder',
189
                                        ( $data->{'repeatable'} ? 'checked="checked" ' : '') .
200
					-id=>"value_builder$i",
190
                                        "name=\"repeatable$i\">";
201
					-values=> \@value_builder,
191
		$row_data{mandatory}  = "<input id=\"mandatory$i\" type=\"checkbox\" " .
202
					-default=>$data->{'value_builder'},
192
                                        ( $data->{'mandatory'} ? 'checked="checked" ' : '' ) .
203
					-size=>1,
193
                                        "name=\"mandatory$i\">";
204
		 			-tabindex=>'',
205
					-multiple=>0,
206
					);
207
		
208
		$row_data{repeatable} = CGI::checkbox(-name=>"repeatable$i",
209
	-checked => $data->{'repeatable'}?'checked':'',
210
	-value => 1,
211
	-label => '',
212
	-id => "repeatable$i");
213
		$row_data{mandatory} = CGI::checkbox(-name => "mandatory$i",
214
	-checked => $data->{'mandatory'}?'checked':'',
215
	-value => 1,
216
	-label => '',
217
	-id => "mandatory$i");
218
		$row_data{hidden} = CGI::escapeHTML($data->{hidden}) ;
194
		$row_data{hidden} = CGI::escapeHTML($data->{hidden}) ;
219
		$row_data{isurl} = CGI::checkbox( -name => "isurl$i",
195
		$row_data{isurl}      = "<input id=\"isurl$i\" type=\"checkbox\" " .
220
			-id => "isurl$i",
196
                                        ( $data->{'isurl'} ? 'checked="checked" ' : '' ) .
221
			-checked => $data->{'isurl'}?'checked':'',
197
                                        "name=\"isurl$i\">";
222
			-value => 1,
223
			-label => '');
224
		$row_data{row} = $i;
198
		$row_data{row} = $i;
225
		push(@loop_data, \%row_data);
199
		push(@loop_data, \%row_data);
226
		$i++;
200
		$i++;
227
	}
201
	}
228
	# add more_subfields empty lines for add if needed
202
	# add more_subfields empty lines for add if needed
229
	for (my $i=1;$i<=$more_subfields;$i++) {
203
	for (my $j=1;$j<=$more_subfields;$j++) {
230
		my %row_data;  # get a fresh hash for the row data
204
		my %row_data;  # get a fresh hash for the row data
231
        $row_data{'new_subfield'} = 1;
205
        $row_data{'new_subfield'} = 1;
232
		$row_data{tab} = CGI::scrolling_list(-name=>'tab',
206
		$row_data{tab} = CGI::scrolling_list(-name=>'tab',
Lines 248-254 if ($op eq 'add_form') { Link Here
248
                                        },
222
                                        },
249
					-default=>"",
223
					-default=>"",
250
					-size=>1,
224
					-size=>1,
251
		 			-tabindex=>'',
252
					-multiple=>0,
225
					-multiple=>0,
253
					);
226
					);
254
		$row_data{ohidden} = CGI::scrolling_list(-name=>'ohidden',
227
		$row_data{ohidden} = CGI::scrolling_list(-name=>'ohidden',
Lines 287-316 if ($op eq 'add_form') { Link Here
287
		#			-multiple=>0,
260
		#			-multiple=>0,
288
		#			);
261
		#			);
289
		$row_data{tagsubfieldinput} = "<input type=\"text\" name=\"tagsubfield\" value=\"".$data->{'tagsubfield'}."\" size=\"1\" id=\"tagsubfield\" maxlength=\"1\" />";
262
		$row_data{tagsubfieldinput} = "<input type=\"text\" name=\"tagsubfield\" value=\"".$data->{'tagsubfield'}."\" size=\"1\" id=\"tagsubfield\" maxlength=\"1\" />";
290
                $row_data{tagsubfieldinput} = 
291
                        "<label><input type=\"text\" name=\"tagsubfield\" value=\""
292
                        . $data->{'tagsubfield'}
293
                        . "\" size=\"1\" id=\"tagsubfield\" maxlength=\"1\" /></label>";
294
		$row_data{tagsubfield} = $data->{'tagsubfield'};
263
		$row_data{tagsubfield} = $data->{'tagsubfield'};
295
		$row_data{liblibrarian} = "";
264
		$row_data{liblibrarian} = "";
296
		$row_data{libopac} = "";
265
		$row_data{libopac} = "";
297
		$row_data{seealso} = "";
266
		$row_data{seealso} = "";
298
		$row_data{hidden} = "000";
267
		$row_data{hidden} = "000";
299
		$row_data{repeatable} = CGI::checkbox( -name=> 'repeatable',
268
		$row_data{repeatable} = "<input id=\"repeatable$i\" type=\"checkbox\" name=\"repeatable$i\">";
300
				-id => "repeatable$i",
269
		$row_data{mandatory}  = "<input id=\"mandatory$i\" type=\"checkbox\" name=\"mandatory$i\">";
301
				-checked => '',
270
		$row_data{isurl}      = "<input id=\"isurl$i\" type=\"checkbox\" name=\"isurl$i\">";
302
				-value => 1,
303
				-label => '');
304
		$row_data{mandatory} = CGI::checkbox( -name=> 'mandatory',
305
			-id => "mandatory$i",
306
			-checked => '',
307
			-value => 1,
308
			-label => '');
309
		$row_data{isurl} = CGI::checkbox(-name => 'isurl',
310
			-id => "isurl$i",
311
			-checked => '',
312
			-value => 1,
313
			-label => '');
314
		$row_data{kohafield}= CGI::scrolling_list( -name=>'kohafield',
271
		$row_data{kohafield}= CGI::scrolling_list( -name=>'kohafield',
315
					-id => "kohafield$i",
272
					-id => "kohafield$i",
316
					-values=> \@kohafields,
273
					-values=> \@kohafields,
Lines 318-347 if ($op eq 'add_form') { Link Here
318
					-size=>1,
275
					-size=>1,
319
					-multiple=>0,
276
					-multiple=>0,
320
					);
277
					);
321
		$row_data{frameworkcode}  = CGI::scrolling_list(-name=>'frameworkcode',
278
                $row_data{frameworkcode}    = {
322
					-id=>'frameworkcode',
279
                  id      => 'frameworkcode',
323
					-values=> \@authtypes,
280
                  codes   => $authtypes,
324
					-default=>$data->{'frameworkcode'},
281
                  default => $data->{'frameworkcode'},
325
					-size=>1,
282
                                              };
326
		 			-tabindex=>'',
283
                $row_data{authorised_value} = {
327
					-multiple=>0,
284
                  id      => 'authorised_value',
328
					);
285
                  codes   => $authorised_values,
329
		$row_data{authorised_value}  = CGI::scrolling_list(-name=>'authorised_value',
286
                  default => $data->{'authorised_values'},
330
					-id => 'authorised_value',
287
                                              };
331
					-values=> \@authorised_values,
288
                $row_data{value_builder}    = {
332
					-size=>1,
289
                  id      => 'value_builder',
333
		 			-tabindex=>'',
290
                  codes   => \@value_builder,
334
					-multiple=>0,
291
                  default => $data->{'value_builder'},
335
					);
292
                                              };
336
		$row_data{value_builder}  = CGI::scrolling_list(-name=>'value_builder',
337
					-id=>'value_builder',
338
					-values=> \@value_builder,
339
					-default=>$data->{'value_builder'},
340
					-size=>1,
341
		 			-tabindex=>'',
342
					-multiple=>0,
343
					);
344
		$row_data{row} = $i;
293
		$row_data{row} = $i;
294
                ++$i;
345
		push(@loop_data, \%row_data);
295
		push(@loop_data, \%row_data);
346
	}
296
	}
347
	$template->param('use_heading_flags_p' => 1);
297
	$template->param('use_heading_flags_p' => 1);
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/auth_subfields_structure.tt (-17 / +61 lines)
Lines 76-95 function displayMoreConstraint(numlayer){ Link Here
76
        [% FOREACH loo IN loop %]
76
        [% FOREACH loo IN loop %]
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
                [% IF ( loo.new_subfield ) %]
80
                    [% IF ( loo.new_subfield ) %]
80
                <li><label for="tagsubfield">Subfield code: </label>[% loo.tagsubfieldinput %]&nbsp;</li>
81
                <li><label for="tagsubfieldinput[% loo.row %]">Subfield code: </label>[% loo.tagsubfieldinput %]&nbsp;</li>
81
                [% ELSE %]
82
                    [% ELSE %]
82
                <li><input type="hidden" name="tagsubfield" value="[% loo.tagsubfield %]" />
83
                <li>
83
                [% END %]
84
                <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>
84
                <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>
85
                <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>
86
                <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>
87
                <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>
88
                <li><label for="tab[% loo.row %]">Managed in tab: </label>
92
                    <select name="tab" tabindex="" size="1" id="[% loo.tab.id %]">
89
                    <select name="tab[% loo.row %]" size="1" id="tab[% loo.row %]">
93
                        [%- IF ( loo.tab.default ==  -1 ) -%]
90
                        [%- IF ( loo.tab.default ==  -1 ) -%]
94
                        <option value="-1" selected="selected">ignore</option>
91
                        <option value="-1" selected="selected">ignore</option>
95
                        [%- ELSE -%]
92
                        [%- ELSE -%]
Lines 110-116 function displayMoreConstraint(numlayer){ Link Here
110
                        <legend>Display</legend>
107
                        <legend>Display</legend>
111
                        <ol>
108
                        <ol>
112
                            <li><label for="ohidden[% loo.row %]">Select to display or not:</label>
109
                            <li><label for="ohidden[% loo.row %]">Select to display or not:</label>
113
                                <select name="ohidden" size="1" id="[% loo.ohidden.id %]">
110
                                <select name="ohidden[% loo.row %]" size="1" id="ohidden[% loo.row %]">
114
                                    [%- IF ( loo.ohidden.default ==  0 ) -%]
111
                                    [%- IF ( loo.ohidden.default ==  0 ) -%]
115
                                    <option value= "0" selected="selected">Show all</option>
112
                                    <option value= "0" selected="selected">Show all</option>
116
                                    <option value="-5">Hide all</option>
113
                                    <option value="-5">Hide all</option>
Lines 135-141 function displayMoreConstraint(numlayer){ Link Here
135
                            <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>
132
                            <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>
136
                            <li>
133
                            <li>
137
                                <label for="defaultvalue[% loo.row %]">Default value:</label>
134
                                <label for="defaultvalue[% loo.row %]">Default value:</label>
138
                                <input type="text" name="defaultvalue" id="defaultvalue[% loo.row %]" value="[% loo.defaultvalue %]" />
135
                                <input type="text" name="defaultvalue[% loo.row %]" id="defaultvalue[% loo.row %]" value="[% loo.defaultvalue %]" />
139
                            </li>
136
                            </li>
140
                        </ol>
137
                        </ol>
141
                    </fieldset>
138
                    </fieldset>
Lines 143-151 function displayMoreConstraint(numlayer){ Link Here
143
                <li>
140
                <li>
144
                    <fieldset><legend>Help input</legend>    
141
                    <fieldset><legend>Help input</legend>    
145
                        <ol>
142
                        <ol>
146
                            <li><label for="authorised_value[% loo.row %]">Authorized value:</label> [% loo.authorised_value %]</li>
143
                            <li>
147
                            <li><label for="frameworkcode[% loo.row %]">Thesaurus:</label> [% loo.frameworkcode %]</li>
144
<label for="authorised_value[% loo.row %]">Authorized value:</label>
148
                            <li><label for="value_builder[% loo.row %]">Plugin:</label> [% loo.value_builder %]</li>
145
<select name="authorised_value[% loo.row %]" size="1" id="authorised_value[% loo.row %]">
146
[%- FOREACH t IN loo.authorised_value.codes -%]
147
    [%- IF loo.authorised_value.default == t && t == "" %]
148
    <!-- this case for a space is necessary to validate HTML nicely. -->
149
    <option selected="selected" value="[% t %]"> </option>
150
    [%- ELSIF loo.frameworkcode.default == t %]
151
    <option selected="selected" value="[% t %]">[% t %]</option>
152
    [%- ELSIF t == "" %]
153
    <option                     value=""> </option>
154
    [%- ELSE %]
155
    <option                     value="[% t %]">[% t %]</option>
156
    [%- END %]
157
[%- END -%]
158
</select>
159
                            </li>
160
                            <li>
161
<label for="frameworkcode[% loo.row %]">Thesaurus:</label>
162
<select name="frameworkcode[% loo.row %]"  size="1" id="frameworkcode[% loo.row %]">
163
[%- FOREACH t IN loo.frameworkcode.codes -%]
164
    [%- IF loo.frameworkcode.default == t.value.authtypecode && t.value.authtypecode == "" %]
165
    <!-- this case for a space is necessary to validate HTML nicely. -->
166
    <option selected="selected" value="[% t.value.authtypecode %]"> </option>
167
    [%- ELSIF loo.frameworkcode.default == t.value.authtypecode %]
168
    <option selected="selected" value="[% t.value.authtypecode %]">[% t.value.authtypecode %]</option>
169
    [%- ELSIF t.value.authtypecode == "" %]
170
    <option                     value=""> </option>
171
    [%- ELSE %]
172
    <option                     value="[% t.value.authtypecode %]">[% t.value.authtypecode %]</option>
173
    [%- END %]
174
[%- END -%]
175
</select>
176
                            </li>
177
                            <li>
178
<label for="value_builder[% loo.row %]">Plugin:</label>
179
<select name="value_builder[% loo.row %]"  size="1" id="value_builder[% loo.row %]">
180
[%- FOREACH t IN loo.value_builder.codes -%]
181
    [%- IF loo.value_builder.default == t && t == "" %]
182
    <!-- this case for a space is necessary to validate HTML nicely. -->
183
    <option selected="selected" value="[% t %]"> </option>
184
    [%- ELSIF loo.value_builder.default == t %]
185
    <option selected="selected" value="[% t %]">[% t %]</option>
186
    [%- ELSIF t == "" %]
187
    <option                     value=""> </option>
188
    [%- ELSE %]
189
    <option                     value="[% t %]">[% t %]</option>
190
    [%- END %]
191
[%- END -%]
192
</select>
193
                            </li>
149
                        </ol>
194
                        </ol>
150
                    </fieldset>
195
                    </fieldset>
151
                </li>
196
                </li>
152
- 

Return to bug 12091