bug-2923: replaces 'renew/not renew' text with nice 'renew/return 'yui buttons.
[koha.git] / labels / label-create-template.pl
blob1b7e5261ef210e4b1d1449ef9c93600a1b35b2ea
1 #!/usr/bin/perl
3 use strict;
4 use CGI;
5 use C4::Auth;
6 use C4::Context;
7 use C4::Output;
8 use C4::Labels;
9 use HTML::Template::Pro;
10 use POSIX;
12 #use Data::Dumper;
13 #use Smart::Comments;
15 my $dbh = C4::Context->dbh;
16 my $query = new CGI;
17 ### $query
19 my $tmpl_code = $query->param('tmpl_code');
20 my $tmpl_desc = $query->param('tmpl_desc');
21 my $page_height = $query->param('page_height');
22 my $page_width = $query->param('page_width');
23 my $label_height = $query->param('label_height');
24 my $label_width = $query->param('label_width');
25 my $topmargin = $query->param('topmargin');
26 my $leftmargin = $query->param('leftmargin');
27 my $cols = $query->param('cols');
28 my $rows = $query->param('rows');
29 my $colgap = $query->param('colgap');
30 my $rowgap = $query->param('rowgap');
31 my $units = $query->param('units');
32 my $font = $query->param('fonts');
33 my $fontsize = $query->param('fontsize');
35 my $batch_id = $query->param('batch_id');
38 my $op = $query->param('op');
39 my @resultsloop;
41 my ( $template, $loggedinuser, $cookie );
43 if ( $op eq 'blank' ) {
45 my @units = (
46 { unit => 'INCH', desc => 'Inches' },
47 { unit => 'CM', desc => 'Centimeters' },
48 { unit => 'MM', desc => 'Millimeters' },
49 { unit => 'POINT', desc => 'Postscript Points' },
52 my @fonts = ( #FIXME: There is probably a way to discover what additional fonts are installed on a user's system and generate this list dynamically...
53 { font => 'TR', name => 'Times Roman' },
54 { font => 'TB', name => 'Times Bold' },
55 { font => 'TI', name => 'Times Italic' },
56 { font => 'TBI', name => 'Times Bold Italic' },
57 { font => 'C', name => 'Courier' },
58 { font => 'CB', name => 'Courier Bold' },
59 { font => 'CO', name => 'Courier Oblique' },
60 { font => 'CBO', name => 'Courier Bold Oblique' },
61 { font => 'H', name => 'Helvetica' },
62 { font => 'HB', name => 'Helvetica Bold' },
63 { font => 'HO', name => 'Helvetica Oblique' },
64 { font => 'HBO', name => 'Helvetica Bold Oblique' },
67 ( $template, $loggedinuser, $cookie ) = get_template_and_user(
69 template_name => "labels/label-create-template.tmpl",
70 query => $query,
71 type => "intranet",
72 authnotrequired => 1,
73 flagsrequired => { catalogue => 1 },
74 debug => 1,
78 $template->param(
79 units => \@units,
80 fonts => \@fonts,
85 elsif ( $op eq 'Create' ) {
86 CreateTemplate(
88 $tmpl_code, $tmpl_desc, $page_width,
89 $page_height, $label_width, $label_height, $topmargin,
90 $leftmargin, $cols, $rows, $colgap,
91 $rowgap, $font, $fontsize, $units );
93 print $query->redirect("./label-templates.pl");
94 exit;
98 elsif ( $op eq 'Cancel' ) {
99 print $query->redirect("./label-home.pl");
100 exit;
103 output_html_with_http_headers $query, $cookie, $template->output;