porting sort_by stuff from staff to opac
[koha.git] / labels / label-edit-layout.pl
1 #!/usr/bin/perl
2
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;
10 use POSIX;
11
12 #use Data::Dumper;
13 #use Smart::Comments;
14
15 my $dbh       = C4::Context->dbh;
16 my $query     = new CGI;
17 my $layout_id = $query->param('layout_id');
18
19 ### $query;
20
21 my ( $template, $loggedinuser, $cookie ) = get_template_and_user(
22     {
23         template_name   => "labels/label-edit-layout.tmpl",
24         query           => $query,
25         type            => "intranet",
26         authnotrequired => 1,
27         flagsrequired   => { catalogue => 1 },
28         debug           => 1,
29     }
30 );
31
32 my $layout = get_layout($layout_id);
33  my @barcode_types = get_barcode_types($layout_id);
34 my @printingtypes       = get_printingtypes($layout_id);
35 ### @printingtypes 
36 ### $layout
37
38 my $layoutname =  $layout->{'layoutname'};
39 my $layout_id =  $layout->{'id'};
40 my $guidebox =  $layout->{'guidebox'};
41 my $startlabel  =  $layout->{'startlabel'};
42
43 my @title          = build_text_dropbox( $layout->{'title'} );
44 my @subtitle          = build_text_dropbox( $layout->{'subtitle'} );
45 my @author         = build_text_dropbox( $layout->{'author'} );
46 my @barcode        = build_text_dropbox( $layout->{'barcode'} );
47 my @isbn           = build_text_dropbox( $layout->{'isbn'} );
48 my @issn           = build_text_dropbox( $layout->{'issn'} );
49 my @itemtype       = build_text_dropbox( $layout->{'itemtype'} );
50 my @dewey          = build_text_dropbox( $layout->{'dewey'} );
51 my @class          = build_text_dropbox( $layout->{'class'} );
52 my @subclass       = build_text_dropbox( $layout->{'subclass'} );
53 my @itemcallnumber = build_text_dropbox( $layout->{'itemcallnumber'} );
54
55
56 ### @subclass 
57
58 $template->param(
59     barcode_types => \@barcode_types,
60     printingtypes => \@printingtypes,
61
62     layoutname => $layoutname,
63     layout_id => $layout_id,
64
65 guidebox => $guidebox,
66 startlabel => $startlabel,
67
68     tx_title          => \@title,
69     tx_subtitle          => \@subtitle,
70     tx_author         => \@author,
71     tx_isbn           => \@isbn,
72     tx_issn           => \@issn,
73     tx_itemtype       => \@itemtype,
74     tx_dewey          => \@dewey,
75     tx_barcode        => \@barcode,
76     tx_classif        => \@class,
77     tx_subclass       => \@subclass,
78     tx_itemcallnumber => \@itemcallnumber,
79 );
80
81 output_html_with_http_headers $query, $cookie, $template->output;