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

(-)a/cataloguing/addbiblio.pl (-90 / +78 lines)
Lines 239-256 sub build_authorized_values_list { Link Here
239
        }
239
        }
240
    }
240
    }
241
    $authorised_values_sth->finish;
241
    $authorised_values_sth->finish;
242
    return CGI::scrolling_list(
242
    return {
243
        -name     => "tag_".$tag."_subfield_".$subfield."_".$index_tag."_".$index_subfield,
243
        type     => 'select',
244
        -values   => \@authorised_values,
244
        id       => "tag_".$tag."_subfield_".$subfield."_".$index_tag."_".$index_subfield,
245
        -default  => $value,
245
        name     => "tag_".$tag."_subfield_".$subfield."_".$index_tag."_".$index_subfield,
246
        -labels   => \%authorised_lib,
246
        default  => $value,
247
        -override => 1,
247
        values   => \@authorised_values,
248
        -size     => 1,
248
        labels   => \%authorised_lib,
249
        -multiple => 0,
249
    };
250
        -tabindex => 1,
250
251
        -id       => "tag_".$tag."_subfield_".$subfield."_".$index_tag."_".$index_subfield,
252
        -class    => "input_marceditor",
253
    );
254
}
251
}
255
252
256
=head2 CreateKey
253
=head2 CreateKey
Lines 366-402 sub create_input { Link Here
366
           defined($tagslib->{$tag}->{'a'}->{authtypecode}) and
363
           defined($tagslib->{$tag}->{'a'}->{authtypecode}) and
367
           $tagslib->{$tag}->{'a'}->{authtypecode} ne '') {
364
           $tagslib->{$tag}->{'a'}->{authtypecode} ne '') {
368
365
369
        $subfield_data{marc_value} =
366
        $subfield_data{marc_value} = {
370
            "<input type=\"text\"
367
            type      => 'text',
371
                    id=\"".$subfield_data{id}."\"
368
            id        => $subfield_data{id},
372
                    name=\"".$subfield_data{id}."\"
369
            name      => $subfield_data{id},
373
                    value=\"$value\"
370
            value     => $value,
374
                    class=\"input_marceditor readonly\"
371
            size      => 5,
375
                    tabindex=\"1\"
372
            maxlength => $subfield_data{maxlength},
376
                    size=\"5\"
373
            readonly  => 1,
377
                    maxlength=\"".$subfield_data{maxlength}."\"
374
        };
378
                    readonly=\"readonly\"
379
                    \/>";
380
375
381
    # it's a thesaurus / authority field
376
    # it's a thesaurus / authority field
382
    }
377
    }
383
    elsif ( $tagslib->{$tag}->{$subfield}->{authtypecode} ) {
378
    elsif ( $tagslib->{$tag}->{$subfield}->{authtypecode} ) {
384
        # when authorities auto-creation is allowed, do not set readonly
379
        # when authorities auto-creation is allowed, do not set readonly
385
        my $is_readonly = !C4::Context->preference("BiblioAddsAuthorities");
380
        my $is_readonly = !C4::Context->preference("BiblioAddsAuthorities");
386
        $subfield_data{marc_value} =
381
387
            "<input type=\"text\"
382
        $subfield_data{marc_value} = {
388
                    id=\"".$subfield_data{id}."\"
383
            type      => 'text',
389
                    name=\"".$subfield_data{id}."\"
384
            id        => $subfield_data{id},
390
                    value=\"$value\"
385
            name      => $subfield_data{id},
391
                    class=\"input_marceditor readonly\"
386
            value     => $value,
392
                    tabindex=\"1\"
387
            size      => 67,
393
                    size=\"67\"
388
            maxlength => $subfield_data{maxlength},
394
                    maxlength=\"".$subfield_data{maxlength}."\"".
389
            readonly  => ($is_readonly) ? 1 : 0,
395
                    ($is_readonly ? "readonly=\"readonly\"" : "").
390
            authtype  => $tagslib->{$tag}->{$subfield}->{authtypecode},
396
                    "\/>
391
        };
397
                    <span class=\"subfield_controls\"><a href=\"#\" class=\"buttonDot tag_editor\"
392
398
                       onclick=\"openAuth(this.parentNode.parentNode.getElementsByTagName('input')[1].id,'".$tagslib->{$tag}->{$subfield}->{authtypecode}."','biblio'); return false;\" tabindex=\"1\" title=\"Tag editor\">Tag editor</a></span>
399
            ";
400
    # it's a plugin field
393
    # it's a plugin field
401
    }
394
    }
402
    elsif ( $tagslib->{$tag}->{$subfield}->{'value_builder'} ) {
395
    elsif ( $tagslib->{$tag}->{$subfield}->{'value_builder'} ) {
Lines 413-458 sub create_input { Link Here
413
            my $extended_param = plugin_parameters( $dbh, $rec, $tagslib, $subfield_data{id}, $tabloop );
406
            my $extended_param = plugin_parameters( $dbh, $rec, $tagslib, $subfield_data{id}, $tabloop );
414
            my ( $function_name, $javascript ) = plugin_javascript( $dbh, $rec, $tagslib, $subfield_data{id}, $tabloop );
407
            my ( $function_name, $javascript ) = plugin_javascript( $dbh, $rec, $tagslib, $subfield_data{id}, $tabloop );
415
        
408
        
416
            $subfield_data{marc_value} =
409
            $subfield_data{marc_value} = {
417
                    "<input tabindex=\"1\"
410
                type           => 'text_complex',
418
                            type=\"text\"
411
                id             => $subfield_data{id},
419
                            id=\"".$subfield_data{id}."\"
412
                name           => $subfield_data{id},
420
                            name=\"".$subfield_data{id}."\"
413
                value          => $value,
421
                            value=\"$value\"
414
                size           => 67,
422
                            class=\"input_marceditor\"
415
                maxlength      => $subfield_data{maxlength},
423
                            onfocus=\"Focus$function_name($index_tag)\"
416
                function_name  => $function_name,
424
                            size=\"67\"
417
                index_tag      => $index_tag,
425
                            maxlength=\"".$subfield_data{maxlength}."\"
418
                javascript     => $javascript,
426
                            onblur=\"Blur$function_name($index_tag); \" \/>
419
            };
427
                            <span class=\"subfield_controls\"><a href=\"#\" class=\"buttonDot tag_editor\" onclick=\"Clic$function_name('$subfield_data{id}'); return false;\" tabindex=\"1\" title=\"Tag editor\">Tag editor</a></span>
420
428
                    $javascript";
429
        } else {
421
        } else {
430
            warn "Plugin Failed: $plugin";
422
            warn "Plugin Failed: $plugin";
431
            # supply default input form
423
            # supply default input form
432
            $subfield_data{marc_value} =
424
            $subfield_data{marc_value} = {
433
                "<input type=\"text\"
425
                type      => 'text',
434
                        id=\"".$subfield_data{id}."\"
426
                id        => $subfield_data{id},
435
                        name=\"".$subfield_data{id}."\"
427
                name      => $subfield_data{id},
436
                        value=\"$value\"
428
                value     => $value,
437
                        tabindex=\"1\"
429
                size      => 67,
438
                        size=\"67\"
430
                maxlength => $subfield_data{maxlength},
439
                        maxlength=\"".$subfield_data{maxlength}."\"
431
                readonly  => 0,
440
                        class=\"input_marceditor\"
432
            };
441
                \/>
433
442
                ";
443
        }
434
        }
444
        # it's an hidden field
435
        # it's an hidden field
445
    }
436
    }
446
    elsif ( $tag eq '' ) {
437
    elsif ( $tag eq '' ) {
447
        $subfield_data{marc_value} =
438
        $subfield_data{marc_value} = {
448
            "<input tabindex=\"1\"
439
            type      => 'hidden',
449
                    type=\"hidden\"
440
            id        => $subfield_data{id},
450
                    id=\"".$subfield_data{id}."\"
441
            name      => $subfield_data{id},
451
                    name=\"".$subfield_data{id}."\"
442
            value     => $value,
452
                    size=\"67\"
443
            size      => 67,
453
                    maxlength=\"".$subfield_data{maxlength}."\"
444
            maxlength => $subfield_data{maxlength},
454
                    value=\"$value\" \/>
445
        };
455
            ";
446
456
    }
447
    }
457
    else {
448
    else {
458
        # it's a standard field
449
        # it's a standard field
Lines 466-493 sub create_input { Link Here
466
                && C4::Context->preference("marcflavour") eq "MARC21" )
457
                && C4::Context->preference("marcflavour") eq "MARC21" )
467
          )
458
          )
468
        {
459
        {
469
            $subfield_data{marc_value} =
460
            $subfield_data{marc_value} = {
470
                "<textarea cols=\"70\"
461
                type      => 'textarea',
471
                           rows=\"4\"
462
                id        => $subfield_data{id},
472
                           id=\"".$subfield_data{id}."\"
463
                name      => $subfield_data{id},
473
                           name=\"".$subfield_data{id}."\"
464
                value     => $value,
474
                           class=\"input_marceditor\"
465
            };
475
                           tabindex=\"1\"
466
476
                           >$value</textarea>
477
                ";
478
        }
467
        }
479
        else {
468
        else {
480
            $subfield_data{marc_value} =
469
            $subfield_data{marc_value} = {
481
                "<input type=\"text\"
470
                type      => 'text',
482
                        id=\"".$subfield_data{id}."\"
471
                id        => $subfield_data{id},
483
                        name=\"".$subfield_data{id}."\"
472
                name      => $subfield_data{id},
484
                        value=\"$value\"
473
                value     => $value,
485
                        tabindex=\"1\"
474
                size      => 67,
486
                        size=\"67\"
475
                maxlength => $subfield_data{maxlength},
487
                        maxlength=\"".$subfield_data{maxlength}."\"
476
                readonly  => 0,
488
                        class=\"input_marceditor\"
477
            };
489
                \/>
478
490
                ";
491
        }
479
        }
492
    }
480
    }
493
    $subfield_data{'index_subfield'} = $index_subfield;
481
    $subfield_data{'index_subfield'} = $index_subfield;
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/cataloguing/addbiblio.tt (-2 / +27 lines)
Lines 610-616 function Changefwk(FwkList) { Link Here
610
                    </label>
610
                    </label>
611
                [% END %]
611
                [% END %]
612
                
612
                
613
                [% subfield_loo.marc_value %]
613
                [% SET val = subfield_loo.marc_value %]
614
                [% IF ( val.type == 'text' ) %]
615
                    [% IF ( val.readonly == 1 ) %]
616
                    <input type="text" id="[%- val.id -%]" name="[%- val.name -%]" value="[%- val.value -%]" class="input_marceditor readonly" tabindex="1" size="[%- val.size -%]" maxlength="[%- val.maxlength -%]" readonly="readonly" />
617
                    [% ELSE %]
618
                    <input type="text" id="[%- val.id -%]" name="[%- val.name -%]" value="[%- val.value -%]" class="input_marceditor" tabindex="1" size="[%- val.size -%]" maxlength="[%- val.maxlength -%]" />
619
                    [% END %]
620
                    [% IF ( val.authtype ) %]
621
                    <span class="subfield_controls"><a href="#" class="buttonDot tag_editor" onclick="openAuth(this.parentNode.parentNode.getElementsByTagName('input')[1].id,'[%- val.authtype -%]','biblio'); return false;" tabindex="1" title="Tag editor">Tag editor</a></span>
622
                    [% END %]
623
                [% ELSIF ( val.type == 'text_complex' ) %]
624
                    <input type="text" id="[%- val.id -%]" name="[%- val.name -%]" value="[%- val.value -%]" class="input_marceditor" tabindex="1" size="[%- val.size -%]" maxlength="[%- val.maxlength -%]" onfocus="Focus[%- val.function_name -%]([%- val.index_tag -%])" onblur="Blur[%- val.function_name -%]([%- val.index_tag -%])" /><span class="subfield_controls"><a href="#" class="buttonDot tag_editor" onclick="Clic[%- val.function_name -%]('[%- val.id -%]'); return false;" tabindex="1" title="Tag editor">Tag editor</a></span>[% val.javascript %]
625
                [% ELSIF ( val.type == 'hidden' ) %]
626
                    <input tabindex="1" type="hidden" id="[%- val.id -%]" name="[%- val.name -%]" size="[%- val.size -%]" maxlength="[%- val.maxlength -%]" value="[%- val.value -%]" />
627
                [% ELSIF ( val.type == 'textarea' ) %]
628
                    <textarea cols="70" rows="4" id="[%- val.id -%]" name="[%- val.name -%]" class="input_marceditor" tabindex="1">[%- val.value -%]</textarea>
629
                [% ELSIF ( val.type == 'select' ) %]
630
                    <select name="[%- val.name -%]" tabindex="1" size="1" class="input_marceditor" id="[%- val.id -%]">
631
                    [% FOREACH aval IN val.values %]
632
                        [% IF aval == val.default %]
633
                        <option value="[%- aval -%]" selected="selected">[%- val.labels.$aval -%]</option>
634
                        [% ELSE %]
635
                        <option value="[%- aval -%]">[%- val.labels.$aval -%]</option>
636
                        [% END %]
637
                    [% END %]
638
                    </select>
639
                [% END %]
614
                
640
                
615
                <span class="subfield_controls">
641
                <span class="subfield_controls">
616
                [% IF ( subfield_loo.repeatable ) %]
642
                [% IF ( subfield_loo.repeatable ) %]
617
- 

Return to bug 11638