X-Git-Url: http://koha-dev.rot13.org:8081/gitweb/?a=blobdiff_plain;f=shelves.pl;h=fd06a41504402ef87a12f75fc53a64ef63e7b9f5;hb=e339f5d64ba06180925f551da12fd5a8cdffd444;hp=f7e0ca120b45c40e163ffd32bd5cb5d57bc6a30d;hpb=1e67687742e36bbb90746ecdd78a0c6a63aad890;p=koha_fer diff --git a/shelves.pl b/shelves.pl index f7e0ca120b..fd06a41504 100755 --- a/shelves.pl +++ b/shelves.pl @@ -1,5 +1,6 @@ #!/usr/bin/perl #script to provide bookshelf management +# WARNING: This file uses 4-character tabs! # # $Header$ # @@ -29,22 +30,27 @@ use C4::Output; use C4::BookShelves; use C4::Circulation::Circ2; use C4::Auth; +use C4::Interface::CGI::Output; +use HTML::Template; my $env; my $query = new CGI; -my ($loggedinuser, $cookie, $sessionID) = checkauth($query); -print $query->header(-cookie => $cookie); +#print $query->header(-cookie => $cookie); my $headerbackgroundcolor='#663266'; my $circbackgroundcolor='#555555'; my $circbackgroundcolor='#550000'; my $linecolor1='#bbbbbb'; my $linecolor2='#dddddd'; - -print startpage(); -print startmenu('catalogue'); - - -print "
Logged in as: $loggedinuser [Log Out]
\n"; +my ($template, $loggedinuser, $cookie) + = get_template_and_user({template_name => "shelves.tmpl", + query => $query, + type => "intranet", + authnotrequired => 0, + flagsrequired => {parameters => 1}, + }); +#print startpage(); +#print startmenu('catalogue'); +#print "Logged in as: $loggedinuser [Log Out]
\n"; my ($shelflist) = GetShelfList(); @@ -63,75 +69,65 @@ if ($query->param('modifyshelfcontents')) { } SWITCH: { + $template->param({ loggedinuser => $loggedinuser, + viewshelf => $query->param('viewshelf'), + shelves => $query->param('shelves'), + headerbackgroundcolor => $headerbackgroundcolor, + circbackgroundcolor => $circbackgroundcolor }); if ($query->param('viewshelf')) { viewshelf($query->param('viewshelf')); last SWITCH;} if ($query->param('shelves')) { shelves(); last SWITCH;} - print << "EOF"; -
-
| |
$shelflist->{$_}->{'shelfname'} ($shelflist->{$_}->{'count'} books) |
Add or Remove Book Shelves\n"; + $template->param(shelvesloop => \@shelvesloop); } +output_html_with_http_headers $query, $cookie, $template->output; sub shelves { if (my $newshelf=$query->param('addshelf')) { my ($status, $string) = AddShelf($env,$newshelf); if ($status) { - print "$string
\n"; + $template->param(status1 => $status, string1 => $string); } } + my @paramsloop; foreach ($query->param()) { - if (/DEL-(\d+)/) { - my $delshelf=$1; - my ($status, $string) = RemoveShelf($env,$delshelf); - if ($status) { - print "$string
\n"; - } - } + my %line; + if (/DEL-(\d+)/) { + my $delshelf=$1; + my ($status, $string) = RemoveShelf($env,$delshelf); + if ($status) { + $line{'status'}=$status; + $line{'string'} = $string; + } + } + #if the shelf is not deleted, %line points on null + push(@paramsloop,\%line); } + $template->param(paramsloop => \@paramsloop); my ($shelflist) = GetShelfList(); - print << "EOF"; -
-
- | \n"; - print "\n"; - print " |