9 use HTML::Template::Pro;
14 my $dbh = C4::Context->dbh;
17 my $tmpl_id = $query->param('tmpl_id');
19 my $width = $query->param('width');
20 my $height = $query->param('height');
21 my $topmargin = $query->param('topmargin');
22 my $leftmargin = $query->param('leftmargin');
23 my $columns = $query->param('columns');
24 my $rows = $query->param('rows');
25 my $colgap = $query->param('colgap');
26 my $rowgap = $query->param('rowgap');
27 my $prof_id = $query->param('prof_id');
29 my ( $template, $loggedinuser, $cookie ) = get_template_and_user(
31 template_name => "labels/label-edit-template.tmpl",
35 flagsrequired => { catalogue => 1 },
40 my $tmpl = GetSingleLabelTemplate($tmpl_id);
41 my $curprof = GetAssociatedProfile($tmpl_id);
42 my @prof = GetAllPrinterProfiles();
45 # Generate an array of hashes containing possible profiles for given template and mark the currently associated one...
47 foreach my $prof (@prof) {
48 if ( $prof->{'tmpl_id'} eq $tmpl->{'tmpl_id'} && $prof->{'prof_id'} eq $curprof->{'prof_id'} ) {
49 push ( @proflist, {prof_id => $prof->{'prof_id'},
50 printername => $prof->{'printername'},
51 paper_bin => $prof->{'paper_bin'},
55 elsif ( $prof->{'tmpl_id'} eq $tmpl->{'tmpl_id'} ) {
56 push ( @proflist, {prof_id => $prof->{'prof_id'},
57 printername => $prof->{'printername'},
58 paper_bin => $prof->{'paper_bin'}} );
67 { unit => 'INCH', desc => 'Inches' },
68 { unit => 'CM', desc => 'Centimeters' },
69 { unit => 'MM', desc => 'Millimeters' },
70 { unit => 'POINT', desc => 'Postscript Points' },
73 foreach my $unit (@units) {
74 if ( $unit->{'unit'} eq $tmpl->{'units'} ) {
75 $unit->{'selected'} = 1;
79 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...
80 { font => 'TR', name => 'Times Roman' },
81 { font => 'TB', name => 'Times Bold' },
82 { font => 'TI', name => 'Times Italic' },
83 { font => 'TBI', name => 'Times Bold Italic' },
84 { font => 'C', name => 'Courier' },
85 { font => 'CB', name => 'Courier Bold' },
86 { font => 'CO', name => 'Courier Oblique' },
87 { font => 'CBO', name => 'Courier Bold Oblique' },
88 { font => 'H', name => 'Helvetica' },
89 { font => 'HB', name => 'Helvetica Bold' },
90 { font => 'HO', name => 'Helvetica Oblique' },
91 { font => 'HBO', name => 'Helvetica Bold Oblique' },
94 foreach my $font (@fonts) {
95 if ( $font->{'font'} eq $tmpl->{'font'} ) {
96 $font->{'selected'} = 1;
102 proflist => \@proflist,
106 tmpl_id => $tmpl->{'tmpl_id'},
107 tmpl_code => $tmpl->{'tmpl_code'},
108 tmpl_desc => $tmpl->{'tmpl_desc'},
109 page_width => $tmpl->{'page_width'},
110 page_height => $tmpl->{'page_height'},
111 label_width => $tmpl->{'label_width'},
112 label_height => $tmpl->{'label_height'},
113 topmargin => $tmpl->{'topmargin'},
114 leftmargin => $tmpl->{'leftmargin'},
115 cols => $tmpl->{'cols'},
116 rows => $tmpl->{'rows'},
117 colgap => $tmpl->{'colgap'},
118 rowgap => $tmpl->{'rowgap'},
119 fontsize => $tmpl->{'fontsize'},
120 active => $tmpl->{'active'},
123 output_html_with_http_headers $query, $cookie, $template->output;