From 16c57f0a7556b9a36c8cedd01fc57d19ac26d514 Mon Sep 17 00:00:00 2001 From: hdl Date: Thu, 19 Dec 2002 18:55:40 +0000 Subject: [PATCH] Templating reservereport et shelves. --- C4/Stats.pm | 2 +- .../default/en/reservereport.tmpl | 29 +++ .../intranet-tmpl/default/en/shelves.tmpl | 102 +++++++++++ reservereport.pl | 32 ++-- shelves.pl | 166 +++++++----------- 5 files changed, 220 insertions(+), 111 deletions(-) create mode 100644 koha-tmpl/intranet-tmpl/default/en/reservereport.tmpl create mode 100644 koha-tmpl/intranet-tmpl/default/en/shelves.tmpl diff --git a/C4/Stats.pm b/C4/Stats.pm index ea3a1d53db..accae1cfff 100644 --- a/C4/Stats.pm +++ b/C4/Stats.pm @@ -124,7 +124,7 @@ sub circrep { my @results; while (my $data=$sth->fetchrow_hashref){ my %tempvalue; - $tempvalue->{'value'}="$data->{'datetime'}\t$data->{'branch'}"; + $tempvalue{'value'}="$data->{'datetime'}\t$data->{'branch'}"; push(@results, \%tempvalue); } $sth->finish; diff --git a/koha-tmpl/intranet-tmpl/default/en/reservereport.tmpl b/koha-tmpl/intranet-tmpl/default/en/reservereport.tmpl new file mode 100644 index 0000000000..4dbba19fbd --- /dev/null +++ b/koha-tmpl/intranet-tmpl/default/en/reservereport.tmpl @@ -0,0 +1,29 @@ + + +
+ + + + + + + + + + + + + +
+ + + + + + + +
+ +     
+ + diff --git a/koha-tmpl/intranet-tmpl/default/en/shelves.tmpl b/koha-tmpl/intranet-tmpl/default/en/shelves.tmpl new file mode 100644 index 0000000000..0d42e7db4f --- /dev/null +++ b/koha-tmpl/intranet-tmpl/default/en/shelves.tmpl @@ -0,0 +1,102 @@ + + +

Logged in as: [Log Out]

+ + + +
+
+ Shelf List

+ + + + + + + + + + + + + +
+ + +
Add a book by barcode:
+
+ + +
"> + Contents of shelf +
+
">">" width=10 align=center>">" width=10 align=center>">" width=10 align=center>">
+
+ "> + + "> + +

+ + + +

+ + + +

+ + +

+ Modify Shelf Contents

+

Bookshelves

+ +
+
+ + + + + + + + +
"> + Select Shelves to Delete +
"> + "> + ( books) +
+

+

+ + +

Add Shelf:

+

+ +

+ + +
+ + + + + +
"> + + +
"> + Shelf List +
+
"> + "> + ( books) + +
+

Add or Remove Book Shelves + + + + + \ No newline at end of file diff --git a/reservereport.pl b/reservereport.pl index 51b4a4a8d3..ea2c4a2d88 100755 --- a/reservereport.pl +++ b/reservereport.pl @@ -21,25 +21,35 @@ # Koha; if not, write to the Free Software Foundation, Inc., 59 Temple Place, # Suite 330, Boston, MA 02111-1307 USA -use C4::Stats; use strict; +use C4::Stats; use Date::Manip; use CGI; use C4::Output; +use HTML::Template; + my $input=new CGI; my $time=$input->param('time'); -print $input->header; -print startpage; -print startmenu('report'); -print center; -print mktablehdr(); +#print $input->header; +#print startpage; +#print startmenu('report'); +my $template = gettemplate("reservereport.tmpl"); +#print center; +#print mktablehdr(); my ($count,$data)=unfilledreserves(); -print $count; + +my @dataloop; for (my $i=0;$i<$count;$i++){ - print mktablerow(4,'white',"$data->[$i]->{'surname'}\, $data->[$i]->{'firstname'}",$data->[$i]->{'reservedate'},$data->[$i]->{'title'},"$data->[$i]->{'classification'}$data->[$i]->{'dewey'}"); + my %line; + $line{name}="$data->[$i]->{'surname'}\, $data->[$i]->{'firstname'}"; + $line{'reservedate'}=$data->[$i]->{'reservedate'}; + $line{'title'}=$data->[$i]->{'title'}; + $line{'classification'}="$data->[$i]->{'classification'}$data->[$i]->{'dewey'}"); + push(@dataloop,\%line); } -print mktableft(); -print endmenu('report'); -print endpage; + +$template->param( count => $count, + dataloop => \@dataloop); +print "Content-Type: text/html\n\n", $template->output; diff --git a/shelves.pl b/shelves.pl index f7e0ca120b..4dc6e7167b 100755 --- a/shelves.pl +++ b/shelves.pl @@ -29,22 +29,21 @@ use C4::Output; use C4::BookShelves; use C4::Circulation::Circ2; use C4::Auth; +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=gettemplate("shelves.tmpl"); +#print startpage(); +#print startmenu('catalogue'); +#print "

Logged in as: $loggedinuser [Log Out]

\n"; my ($shelflist) = GetShelfList(); @@ -63,75 +62,65 @@ if ($query->param('modifyshelfcontents')) { } SWITCH: { + $template->param( loggedinuser => $loggedinuser, + viewshelf => $query->param('viewshelf'), + shelves => $query->param('shelves'), + headerbackground => $headerbackground, + circbackgroundcolor => $circbackgroundcolor); if ($query->param('viewshelf')) { viewshelf($query->param('viewshelf')); last SWITCH;} if ($query->param('shelves')) { shelves(); last SWITCH;} - print << "EOF"; -
- - -EOF - my $color=''; - foreach (sort keys %$shelflist) { - ($color eq $linecolor1) ? ($color=$linecolor2) : ($color=$linecolor1); - print "\n"; + my $color=''; + my @shelvesloop; + foreach $element (sort keys %$shelflist) { + my %line; + ($color eq $linecolor1) ? ($color=$linecolor2) : ($color=$linecolor1); + $line{'color'}= $color; + $line{'shelf'}=$element; + $line{'shelfname'}=$shelflist->{$element}->{'shelfname'}; + $line{'shelfbookcount'}=$shelflist->{$element}->{'count'}; + push (@shelvesloop, \%line); } - print "
- - -
- Shelf List -
-
$shelflist->{$_}->{'shelfname'} ($shelflist->{$_}->{'count'} books)
\n"; - print "

Add or Remove Book Shelves\n"; + $template->param(shelvesloop => \@shelvesloop); } +print $query->header(-cookie => $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"; -

-Modify Shelf Contents

-

Bookshelves

- -
-
- - - -EOF my $color=''; - my $color=''; - foreach (sort keys %$shelflist) { - ($color eq $linecolor1) ? ($color=$linecolor2) : ($color=$linecolor1); - print "\n"; + my @shelvesloop; + foreach $element (sort keys %$shelflist) { + my %line; + ($color eq $linecolor1) ? ($color=$linecolor2) : ($color=$linecolor1); + $line{'color'}=$color; + $line{'shelf'}=$element; + $line{'shelfname'}=$shelflist->{$element}->{'shelfname'} ; + $line{'shelfbookcount'}=$shelflist->{$element}->{'count'} ; + push(@shelvesloop, \%line); } - print "
-Select Shelves to Delete -
$shelflist->{$_}->{'shelfname'} ($shelflist->{$_}->{'count'} books)
\n"; - print '

'; - print "

\n"; - print "\n"; - print "\n"; - print "

Add Shelf:

\n"; - print '

'; - print "\n"; - print "

\n"; + $template->param(shelvesloop=>\@shelvesloop); } @@ -140,53 +129,34 @@ sub viewshelf { my $shelfnumber=shift; my ($itemlist) = GetShelfContents($env, $shelfnumber); my $item=''; - print << "EOF"; -
-
- Shelf List

- - -EOF my $color=''; + my @itemsloop; foreach $item (sort {$a->{'barcode'} cmp $b->{'barcode'}} @$itemlist) { - ($color eq $linecolor1) ? ($color=$linecolor2) : ($color=$linecolor1); - print << "EOF"; - - - - - - - - - -EOF + my %line; + ($color eq $linecolor1) ? ($color=$linecolor2) : ($color=$linecolor1); + $line{'color'}=$color; + $line{'itemnumber'}=$item->{'itemnumber'}; + $line{'barcode'}=$item->{'barcode'}; + $line{'title'}=$item->{'title'}; + $line{'author'}=$item->{'author'}; + push(@itemsloop, \%line); } - print << "EOF"; -
- - -
Add a book by barcode:
-
- - -
- Contents of $shelflist->{$shelfnumber}->{'shelfname'} shelf -
-
{'itemnumber'}>$item->{'barcode'}$item->{'title'}$item->{'author'}
-
- - - - -

-EOF + $template->param( itemsloop => \@itemsloop); + $template->param( shelfname => $shelflist->{$shelfnumber}->{'shelfname'}); + $template->param( shelfnumber => $shelfnumber); } - +#print endpage(); +#print endmenu('catalogue'); # # $Log$ +# Revision 1.9 2002/12/19 18:55:40 hdl +# Templating reservereport et shelves. +# +# Revision 1.9 2002/08/14 18:12:51 hdl +# Templating files +# # Revision 1.8 2002/08/14 18:12:51 tonnesen # Added copyright statement to all .pl and .pm files # @@ -208,5 +178,3 @@ EOF -print endpage(); -print endmenu('catalogue'); -- 2.39.5