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

(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/tools/letter.tt (+90 lines)
Lines 49-54 Link Here
49
[% END %]
49
[% END %]
50
</head>
50
</head>
51
51
52
[% text_justification_types = [ 'L','C','R' ] %]
53
[% BLOCK translate_justification_types %]
54
    [%  SWITCH type %]
55
        [%   CASE 'L' %]<span>Left</span>
56
        [%   CASE 'C' %]<span>Center</span>
57
        [%   CASE 'R' %]<span>Right</span>
58
    [%  END %]
59
[% END %]
60
61
[% units = [ 'POINT','INCH','MM','CM' ] %]
62
[% BLOCK translate_unit_types %]
63
    [% SWITCH type %]
64
        [%   CASE 'POINT' %]<span>PostScript points</span>
65
        [%   CASE 'INCH' %]<span>US Inches</span>
66
        [%   CASE 'MM' %]<span>SI Millimeters</span>
67
        [%   CASE 'CM' %]<span>SI Centimeters</span>
68
    [% END %]
69
[% END %]
70
52
<body id="tools_letter" class="tools">
71
<body id="tools_letter" class="tools">
53
    [% WRAPPER 'header.inc' %]
72
    [% WRAPPER 'header.inc' %]
54
    [% INCLUDE 'letters-search.inc' %]
73
    [% INCLUDE 'letters-search.inc' %]
Lines 648-653 Link Here
648
                </div> <!-- /.panel-collapse -->
667
                </div> <!-- /.panel-collapse -->
649
            </div> <!-- /.panel.panel-default -->
668
            </div> <!-- /.panel.panel-default -->
650
        [% END # /FOR mtt %]
669
        [% END # /FOR mtt %]
670
671
        <div class="panel panel-default">
672
            <div class="panel-heading" role="tab" id="format_[% lang | html %]Heading">
673
                <h3 class="panel-title">
674
                    <a role="button" class="collapsed" data-toggle="collapse" data-parent="#group_[% lang | html %]" href="#format_[% lang | html %]" aria-expanded="false" aria-controls="format_[% lang | html %]">
675
                        <span>Format</span>
676
                    </a>
677
                </h3>
678
            </div> <!-- /.panel-heading -->
679
            <div id="format_[% lang | html %]" class="panel-collapse collapse" role="tabpanel" aria-labelledby="format_[% lang | html %]Heading">
680
                <div class="panel-body">
681
                    <fieldset class="rows">
682
                        [% SET param = letters.$lang.params %]
683
                        <div class="col-md-6">
684
                            <ol>
685
                                <li>
686
                                    <label for="text_justify">Text justification: </label>
687
                                    <select name="text_justify" id="text_justify">
688
                                        [% FOREACH text_justification_type IN text_justification_types %]
689
                                            [% IF ( text_justification_type == param.text_justify ) %]
690
                                            <option value="[% text_justification_type | html %]" selected="selected">[% PROCESS translate_justification_types type=text_justification_type %]</option>
691
                                            [% ELSE %]
692
                                            <option value="[% text_justification_type | html %]">[% PROCESS translate_justification_types type=text_justification_type %]</option>
693
                                            [% END %]
694
                                        [% END %]
695
                                    </select>
696
                                </li>
697
                                <li>
698
                                    <label for="font_size">Font size: </label>
699
                                    <input type="text" name="font_size" id="font_size" size="2" value="[% param.font_size | html %]" />
700
                                </li>
701
                                <li>
702
                                    <label for="format_all">Apply format settings to all notices:</label>
703
                                    <input type="checkbox" name="format_all" id="format_all" value="1" />
704
                                    <span class="hint">Existing format settings will be overwritten.</span>
705
                                </li>
706
                            </ol>
707
                        </div>
708
                        <div class="col-md-6">
709
                            <ol>
710
                                <li>
711
                                    <label for="units">Units:</label>
712
                                    <select id="units" name="units">
713
                                        [% FOREACH unit IN units %]
714
                                            [% IF ( unit == param.units ) %]
715
                                            <option value="[% unit | html %]" selected="selected">[% PROCESS translate_unit_types type=unit %]</option>
716
                                            [% ELSE %]
717
                                            <option value="[% unit | html %]">[% PROCESS translate_unit_types type=unit %]</option>
718
                                            [% END %]
719
                                        [% END %]
720
                                    </select>
721
                                </li>
722
                                <li>
723
                                    <label for="notice_width">Notice width:</label>
724
                                    <input type="text" size="4" name="notice_width" id="notice_width" value="[% param.notice_width | html %]" />
725
                                </li>
726
                                <li>
727
                                    <label for="top_margin">Top margin:</label>
728
                                    <input type="text" size="4" name="top_margin" id="top_margin" value="[% param.top_margin | html %]" />
729
                                </li>
730
                                <li>
731
                                    <label for="left_margin">Left margin:</label>
732
                                    <input type="text" size="4" name="left_margin" id="left_margin" value="[% param.left_margin | html %]" />
733
                                </li>
734
                            </ol>
735
                        </div>
736
                    </fieldset> <!-- /.rows.mtt -->
737
                </div> <!-- /.panel-body -->
738
            </div> <!-- /.panel-collapse -->
739
        </div> <!-- /.panel.panel-default -->
740
651
    </div> <!-- /.panel-group#lang_lang -->
741
    </div> <!-- /.panel-group#lang_lang -->
652
[% END %]
742
[% END %]
653
743
(-)a/koha-tmpl/intranet-tmpl/prog/js/letter.js (-2 / +16 lines)
Lines 48-53 function confirmOverwrite( new_lettercode, new_branchcode ){ Link Here
48
    }
48
    }
49
}
49
}
50
50
51
function confirmFormatOverwrite( event ) {
52
    if ( confirm(__("Existing format settings for all notices will be overwritten by these format settings.")) ) {
53
        return true;
54
    } else {
55
        return false;
56
    }
57
}
58
51
var Sticky;
59
var Sticky;
52
60
53
$(document).ready(function() {
61
$(document).ready(function() {
Lines 85-92 $(document).ready(function() { Link Here
85
        window.location.href = "/cgi-bin/koha/tools/letter.pl?op=add_form&module=" + $(this).val() + "&branchcode=" + branchcode;
93
        window.location.href = "/cgi-bin/koha/tools/letter.pl?op=add_form&module=" + $(this).val() + "&branchcode=" + branchcode;
86
    });
94
    });
87
95
88
    $("#submit_form").on("click",function(){
96
    $("#submit_form").on("click",function(e){
89
        $("#add_notice").submit();
97
        if ( $("#format_all").is(":checked") ){
98
            if ( confirmFormatOverwrite(e) ) {
99
                $("#add_notice").submit();
100
            } else {
101
                e.preventDefault();
102
            }
103
        }
90
    });
104
    });
91
105
92
    $("#add_notice").validate({
106
    $("#add_notice").validate({
(-)a/tools/letter.pl (-4 / +37 lines)
Lines 49-55 use C4::Context; Link Here
49
use C4::Output qw( output_html_with_http_headers );
49
use C4::Output qw( output_html_with_http_headers );
50
use C4::Letters qw( GetMessageTransportTypes );
50
use C4::Letters qw( GetMessageTransportTypes );
51
use C4::Log qw( logaction );
51
use C4::Log qw( logaction );
52
53
use Koha::Notice::Templates;
52
use Koha::Notice::Templates;
54
use Koha::Patron::Attribute::Types;
53
use Koha::Patron::Attribute::Types;
55
54
Lines 228-233 sub add_form { Link Here
228
                content    => $letter->{content} // '',
227
                content    => $letter->{content} // '',
229
                tt_error   => $letter->{tt_error},
228
                tt_error   => $letter->{tt_error},
230
            };
229
            };
230
            $letters{ $lang }{params} = $letter;
231
        }
231
        }
232
    }
232
    }
233
    else {
233
    else {
Lines 310-321 sub add_validate { Link Here
310
    my $oldmodule     = $input->param('oldmodule');
310
    my $oldmodule     = $input->param('oldmodule');
311
    my $code          = $input->param('code');
311
    my $code          = $input->param('code');
312
    my $name          = $input->param('name');
312
    my $name          = $input->param('name');
313
    my $text_justify  = $input->param('text_justify');
314
    my $font_size     = $input->param('font_size');
315
    my $units         = $input->param('units');
316
    my $notice_width  = $input->param('notice_width');
317
    my $top_margin    = $input->param('top_margin');
318
    my $left_margin   = $input->param('left_margin');
319
    my $format_all    = $input->param('format_all');
313
    my @mtt           = $input->multi_param('message_transport_type');
320
    my @mtt           = $input->multi_param('message_transport_type');
314
    my @title         = $input->multi_param('title');
321
    my @title         = $input->multi_param('title');
315
    my @content       = $input->multi_param('content');
322
    my @content       = $input->multi_param('content');
316
    my @lang          = $input->multi_param('lang');
323
    my @lang          = $input->multi_param('lang');
317
    for my $mtt ( @mtt ) {
324
    for my $mtt ( @mtt ) {
318
        my $lang = shift @lang;
325
        my $lang = shift @lang;
326
        if ( $format_all ) {
327
            my @letters = Koha::Notice::Templates->search({ lang => $lang })->as_list;
328
            foreach my $letter ( @letters ) {
329
                $letter->set(
330
                    {
331
                        text_justify  => $text_justify,
332
                        font_size  => $font_size,
333
                        units      => $units,
334
                        notice_width  => $notice_width,
335
                        top_margin    => $top_margin,
336
                        left_margin   => $left_margin,
337
                    }
338
                )->store;
339
            }
340
        }
319
        my $is_html = $input->param("is_html_$mtt\_$lang");
341
        my $is_html = $input->param("is_html_$mtt\_$lang");
320
        my $title   = shift @title;
342
        my $title   = shift @title;
321
        my $content = shift @content;
343
        my $content = shift @content;
Lines 348-354 sub add_validate { Link Here
348
                    is_html    => $is_html || 0,
370
                    is_html    => $is_html || 0,
349
                    title      => $title,
371
                    title      => $title,
350
                    content    => $content,
372
                    content    => $content,
351
                    lang       => $lang
373
                    lang       => $lang,
374
                    text_justify  => $text_justify,
375
                    font_size  => $font_size,
376
                    units      => $units,
377
                    notice_width  => $notice_width,
378
                    top_margin    => $top_margin,
379
                    left_margin   => $left_margin,
352
                }
380
                }
353
            )->store;
381
            )->store;
354
382
Lines 363-369 sub add_validate { Link Here
363
                    title                  => $title,
391
                    title                  => $title,
364
                    content                => $content,
392
                    content                => $content,
365
                    message_transport_type => $mtt,
393
                    message_transport_type => $mtt,
366
                    lang                   => $lang
394
                    lang                   => $lang,
395
                    text_justify  => $text_justify,
396
                    font_size  => $font_size,
397
                    units      => $units,
398
                    notice_width  => $notice_width,
399
                    top_margin    => $top_margin,
400
                    left_margin   => $left_margin,
367
                }
401
                }
368
            )->store;
402
            )->store;
369
            logaction( 'NOTICES', 'CREATE', $letter->id, $letter->content,
403
            logaction( 'NOTICES', 'CREATE', $letter->id, $letter->content,
370
- 

Return to bug 33478