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

(-)a/cataloguing/additem.pl (-38 / +79 lines)
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;
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/cataloguing/additem.tt (-2 / +31 lines)
Lines 225-231 $(document).ready(function() { Link Here
225
               [% ELSE %]
225
               [% ELSE %]
226
               <label>[% ite.subfield %] - [% ite.marc_lib %]</label>
226
               <label>[% ite.subfield %] - [% ite.marc_lib %]</label>
227
               [% END %]
227
               [% END %]
228
                [% ite.marc_value %]
228
229
                [% SET mv = ite.marc_value %]
230
                [% IF ( mv.type == 'hidden' ) %]
231
                    <input type="hidden" id="[%- mv.id -%]" name="field_value" class="input_marceditor" size="50" maxlength="[%- mv.maxlength -%]" value="[%- mv.value -%]" />[% mv.avalue %].hidden
232
                [% ELSIF ( mv.type == 'select' ) %]
233
                    <select name="[%- mv.name -%]" id="[%- mv.id -%]" size="1" class="input_marceditor" [% mv.readonly %] [% mv.disabled %]>
234
                    [% FOREACH aval IN mv.values %]
235
                        [% IF aval == mv.default %]
236
                        <option value="[%- aval -%]" selected="selected">[%- mv.labels.$aval -%]</option>
237
                        [% ELSE %]
238
                        <option value="[%- aval -%]">[%- mv.labels.$aval -%]</option>
239
                        [% END %]
240
                    [% END %]
241
                    </select>
242
                [% ELSIF ( mv.type == 'text_auth' ) %]
243
                    <input type="text" id="[%- mv.id -%]" name="field_value" class="input_marceditor" size="50" maxlength="[%- mv.maxlength -%]" value="[%- mv.value -%]" />
244
                    [% SET dopop = "Dopop('/cgi-bin/koha/authorities/auth_finder.pl?authtypecode=\"${mv.authtypecode}\"&index=${mv.id}','${mv.id}')" %]
245
                    <a href="#" class="buttonDot"  onclick="[%- dopop -%]; return false;" title="Tag Editor">...</a>
246
                [% ELSIF ( mv.type == 'text_plugin' ) %]
247
                    <input type="text" id="[%- mv.id -%]" name="field_value" class="input_marceditor" size="50" maxlength="[%- mv.maxlength -%]" value="[%- mv.value -%]" />
248
                    [% IF ( mv.title == 'Tag editor' ) %]
249
                    <a href="#" id="buttonDot_[%- mv.id -%]" class="[%- mv.class -%]" title="Tag editor">...</a>[%- mv.javascript -%]
250
                    [% ELSIF ( mv.title == 'No popup' ) %]
251
                    <a href="#" id="buttonDot_[%- mv.id -%]" class="[%- mv.class -%]" title="No popup">...</a>[%- mv.javascript -%]
252
                    [% END %]
253
                [% ELSIF ( mv.type == 'text' ) %]
254
                    <input type="text" id="[%- mv.id -%]" name="field_value" class="input_marceditor" size="50" maxlength="[%- mv.maxlength -%]" value="[%- mv.value -%]" />
255
                [% ELSIF ( mv.type == 'textarea' ) %]
256
                    <textarea id="[%- mv.id -%]" name="field_value" class="input_marceditor" rows="5" cols="64" >[% mv.value %]</textarea>
257
                [% END %]
258
229
                <input type="hidden" name="tag"       value="[% ite.tag %]" />
259
                <input type="hidden" name="tag"       value="[% ite.tag %]" />
230
                <input type="hidden" name="subfield"  value="[% ite.subfield %]" />
260
                <input type="hidden" name="subfield"  value="[% ite.subfield %]" />
231
                <input type="hidden" name="mandatory" value="[% ite.mandatory %]" />
261
                <input type="hidden" name="mandatory" value="[% ite.mandatory %]" />
232
- 

Return to bug 12176