|
Lines 231-269
sub generate_subfield_form {
Link Here
|
| 231 |
} |
231 |
} |
| 232 |
|
232 |
|
| 233 |
if ( $subfieldlib->{hidden} > 4 or $subfieldlib->{hidden} <= -4 ) { |
233 |
if ( $subfieldlib->{hidden} > 4 or $subfieldlib->{hidden} <= -4 ) { |
| 234 |
$subfield_data{marc_value} = qq(<input type="hidden" $attributes /> $authorised_lib{$value}); |
234 |
$subfield_data{marc_value} = { |
|
|
235 |
type => 'hidden', |
| 236 |
id => $subfield_data{id}, |
| 237 |
maxlength => $subfield_data{max_length}, |
| 238 |
value => $value, |
| 239 |
avalue => $authorised_lib{$value}, |
| 240 |
}; |
| 235 |
} |
241 |
} |
| 236 |
else { |
242 |
else { |
| 237 |
my @scrparam = ( |
243 |
$subfield_data{marc_value} = { |
| 238 |
-name => "field_value", |
244 |
type => 'select', |
| 239 |
-values => \@authorised_values, |
245 |
id => "tag_".$tag."_subfield_".$subfieldtag."_".$index_subfield, |
| 240 |
-default => $value, |
246 |
values => \@authorised_values, |
| 241 |
-labels => \%authorised_lib, |
247 |
labels => \%authorised_lib, |
| 242 |
-override => 1, |
248 |
default => $value, |
| 243 |
-size => 1, |
249 |
}; |
| 244 |
-multiple => 0, |
|
|
| 245 |
-id => "tag_".$tag."_subfield_".$subfieldtag."_".$index_subfield, |
| 246 |
-class => "input_marceditor", |
| 247 |
); |
| 248 |
|
| 249 |
# If we're on restricted editing, and our field is not in the list of subfields to allow, |
250 |
# If we're on restricted editing, and our field is not in the list of subfields to allow, |
| 250 |
# then it is read-only |
251 |
# then it is read-only |
| 251 |
push @scrparam, (-readonly => "readonly"), (-disabled => "disabled") |
252 |
if ( |
| 252 |
if ( |
253 |
not $allowAllSubfields |
| 253 |
not $allowAllSubfields |
254 |
and $restrictededition |
| 254 |
and $restrictededition |
255 |
and !grep { $tag . '$' . $subfieldtag eq $_ } @subfieldsToAllow |
| 255 |
and !grep { $tag . '$' . $subfieldtag eq $_ } @subfieldsToAllow |
256 |
) { |
| 256 |
); |
257 |
$subfield_data{marc_value}->{readonly} ='readonly="readonly"', |
| 257 |
$subfield_data{marc_value} =CGI::scrolling_list(@scrparam); |
258 |
$subfield_data{marc_value}->{disabled} ='disabled="disabled"', |
|
|
259 |
} |
| 258 |
} |
260 |
} |
| 259 |
|
|
|
| 260 |
} |
261 |
} |
| 261 |
# it's a thesaurus / authority field |
262 |
# it's a thesaurus / authority field |
| 262 |
elsif ( $subfieldlib->{authtypecode} ) { |
263 |
elsif ( $subfieldlib->{authtypecode} ) { |
| 263 |
$subfield_data{marc_value} = "<input type=\"text\" $attributes /> |
264 |
$subfield_data{marc_value} = { |
| 264 |
<a href=\"#\" class=\"buttonDot\" |
265 |
type => 'text_auth', |
| 265 |
onclick=\"Dopop('/cgi-bin/koha/authorities/auth_finder.pl?authtypecode=".$subfieldlib->{authtypecode}."&index=$subfield_data{id}','$subfield_data{id}'); return false;\" title=\"Tag Editor\">...</a> |
266 |
id => $subfield_data{id}, |
| 266 |
"; |
267 |
maxlength => $subfield_data{max_length}, |
|
|
268 |
value => $value, |
| 269 |
authtypecode => $subfieldlib->{authtypecode}, |
| 270 |
}; |
| 267 |
} |
271 |
} |
| 268 |
# it's a plugin field |
272 |
# it's a plugin field |
| 269 |
elsif ( $subfieldlib->{value_builder} ) { # plugin |
273 |
elsif ( $subfieldlib->{value_builder} ) { # plugin |
|
Lines 279-307
sub generate_subfield_form {
Link Here
|
| 279 |
#TODO Report 12176 will make this even better ! |
283 |
#TODO Report 12176 will make this even better ! |
| 280 |
my $class= 'buttonDot'. ( $plugin->noclick? ' disabled': '' ); |
284 |
my $class= 'buttonDot'. ( $plugin->noclick? ' disabled': '' ); |
| 281 |
my $title= $plugin->noclick? 'No popup': 'Tag editor'; |
285 |
my $title= $plugin->noclick? 'No popup': 'Tag editor'; |
| 282 |
$subfield_data{marc_value} = qq[<input type="text" $attributes /><a href="#" id="buttonDot_$subfield_data{id}" class="$class" title="$title">...</a>\n].$plugin->javascript; |
286 |
$subfield_data{marc_value} = { |
|
|
287 |
type => 'text_plugin', |
| 288 |
id => $subfield_data{id}, |
| 289 |
maxlength => $subfield_data{max_length}, |
| 290 |
value => $value, |
| 291 |
class => $class, |
| 292 |
title => $title, |
| 293 |
javascript => $plugin->javascript, |
| 294 |
}; |
| 283 |
} else { |
295 |
} else { |
| 284 |
warn $plugin->errstr; |
296 |
warn $plugin->errstr; |
| 285 |
$subfield_data{marc_value} = "<input type=\"text\" $attributes />"; # supply default input form |
297 |
$subfield_data{marc_value} = { |
|
|
298 |
type => 'text', |
| 299 |
id => $subfield_data{id}, |
| 300 |
maxlength => $subfield_data{max_length}, |
| 301 |
value => $value, |
| 302 |
}; # supply default input form |
| 286 |
} |
303 |
} |
| 287 |
} |
304 |
} |
| 288 |
elsif ( $tag eq '' ) { # it's an hidden field |
305 |
elsif ( $tag eq '' ) { # it's an hidden field |
| 289 |
$subfield_data{marc_value} = qq(<input type="hidden" $attributes />); |
306 |
$subfield_data{marc_value} = { |
|
|
307 |
type => 'hidden', |
| 308 |
id => $subfield_data{id}, |
| 309 |
maxlength => $subfield_data{max_length}, |
| 310 |
value => $value, |
| 311 |
}; |
| 290 |
} |
312 |
} |
| 291 |
elsif ( $subfieldlib->{'hidden'} ) { # FIXME: shouldn't input type be "hidden" ? |
313 |
elsif ( $subfieldlib->{'hidden'} ) { # FIXME: shouldn't input type be "hidden" ? |
| 292 |
$subfield_data{marc_value} = qq(<input type="text" $attributes />); |
314 |
$subfield_data{marc_value} = { |
|
|
315 |
type => 'text', |
| 316 |
id => $subfield_data{id}, |
| 317 |
maxlength => $subfield_data{max_length}, |
| 318 |
value => $value, |
| 319 |
}; |
| 293 |
} |
320 |
} |
| 294 |
elsif ( length($value) > 100 |
321 |
elsif ( |
| 295 |
or (C4::Context->preference("marcflavour") eq "UNIMARC" and |
322 |
length($value) > 100 |
| 296 |
300 <= $tag && $tag < 400 && $subfieldtag eq 'a' ) |
323 |
or ( |
| 297 |
or (C4::Context->preference("marcflavour") eq "MARC21" and |
324 |
C4::Context->preference("marcflavour") eq "UNIMARC" |
| 298 |
500 <= $tag && $tag < 600 ) |
325 |
and 300 <= $tag && $tag < 400 && $subfieldtag eq 'a' |
| 299 |
) { |
326 |
) |
|
|
327 |
or ( |
| 328 |
C4::Context->preference("marcflavour") eq "MARC21" |
| 329 |
and 500 <= $tag && $tag < 600 |
| 330 |
) |
| 331 |
) { |
| 300 |
# oversize field (textarea) |
332 |
# oversize field (textarea) |
| 301 |
$subfield_data{marc_value} = "<textarea $attributes_no_value_textarea>$value</textarea>\n"; |
333 |
$subfield_data{marc_value} = { |
|
|
334 |
type => 'textarea', |
| 335 |
id => $subfield_data{id}, |
| 336 |
value => $value, |
| 337 |
}; |
| 302 |
} else { |
338 |
} else { |
| 303 |
# it's a standard field |
339 |
# it's a standard field |
| 304 |
$subfield_data{marc_value} = "<input type=\"text\" $attributes />"; |
340 |
$subfield_data{marc_value} = { |
|
|
341 |
type => 'text', |
| 342 |
id => $subfield_data{id}, |
| 343 |
maxlength => $subfield_data{max_length}, |
| 344 |
value => $value, |
| 345 |
}; |
| 305 |
} |
346 |
} |
| 306 |
|
347 |
|
| 307 |
return \%subfield_data; |
348 |
return \%subfield_data; |