2 #script to provide bookshelf management
8 # Copyright 2000-2002 Katipo Communications
10 # This file is part of Koha.
12 # Koha is free software; you can redistribute it and/or modify it under the
13 # terms of the GNU General Public License as published by the Free Software
14 # Foundation; either version 2 of the License, or (at your option) any later
17 # Koha is distributed in the hope that it will be useful, but WITHOUT ANY
18 # WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
19 # A PARTICULAR PURPOSE. See the GNU General Public License for more details.
21 # You should have received a copy of the GNU General Public License along with
22 # Koha; if not, write to the Free Software Foundation, Inc., 59 Temple Place,
23 # Suite 330, Boston, MA 02111-1307 USA
30 use C4::Circulation::Circ2;
36 my ($loggedinuser, $cookie, $sessionID) = checkauth($query);
37 #print $query->header(-cookie => $cookie);
38 my $headerbackgroundcolor='#663266';
39 my $circbackgroundcolor='#555555';
40 my $circbackgroundcolor='#550000';
41 my $linecolor1='#bbbbbb';
42 my $linecolor2='#dddddd';
43 my $template=gettemplate("shelves.tmpl");
45 #print startmenu('catalogue');
46 #print "<p align=left>Logged in as: $loggedinuser [<a href=/cgi-bin/koha/logout.pl>Log Out</a>]</p>\n";
49 my ($shelflist) = GetShelfList();
51 if ($query->param('modifyshelfcontents')) {
52 my $shelfnumber=$query->param('shelfnumber');
53 my $barcode=$query->param('addbarcode');
54 my ($item) = getiteminformation($env, 0, $barcode);
55 AddToShelf($env, $item->{'itemnumber'}, $shelfnumber);
56 foreach ($query->param) {
59 RemoveFromShelf($env, $itemnumber, $shelfnumber);
65 $template->param( loggedinuser => $loggedinuser,
66 viewshelf => $query->param('viewshelf'),
67 shelves => $query->param('shelves'),
68 headerbackground => $headerbackground,
69 circbackgroundcolor => $circbackgroundcolor);
70 if ($query->param('viewshelf')) { viewshelf($query->param('viewshelf')); last SWITCH;}
71 if ($query->param('shelves')) { shelves(); last SWITCH;}
74 foreach $element (sort keys %$shelflist) {
76 ($color eq $linecolor1) ? ($color=$linecolor2) : ($color=$linecolor1);
77 $line{'color'}= $color;
78 $line{'shelf'}=$element;
79 $line{'shelfname'}=$shelflist->{$element}->{'shelfname'};
80 $line{'shelfbookcount'}=$shelflist->{$element}->{'count'};
81 push (@shelvesloop, \%line);
83 $template->param(shelvesloop => \@shelvesloop);
86 output_html_with_http_headers $query, $cookie, $template->output;
90 if (my $newshelf=$query->param('addshelf')) {
91 my ($status, $string) = AddShelf($env,$newshelf);
93 $template->param(status1 => $status, string1 => $string);
97 foreach ($query->param()) {
101 my ($status, $string) = RemoveShelf($env,$delshelf);
103 $line{'status'}=$status;
104 $line{'string'} = $string;
107 #if the shelf is not deleted, %line points on null
108 push(@paramsloop,\%line);
110 $template->param(paramsloop => \@paramsloop);
111 my ($shelflist) = GetShelfList();
114 foreach $element (sort keys %$shelflist) {
116 ($color eq $linecolor1) ? ($color=$linecolor2) : ($color=$linecolor1);
117 $line{'color'}=$color;
118 $line{'shelf'}=$element;
119 $line{'shelfname'}=$shelflist->{$element}->{'shelfname'} ;
120 $line{'shelfbookcount'}=$shelflist->{$element}->{'count'} ;
121 push(@shelvesloop, \%line);
123 $template->param(shelvesloop=>\@shelvesloop);
129 my $shelfnumber=shift;
130 my ($itemlist) = GetShelfContents($env, $shelfnumber);
134 foreach $item (sort {$a->{'barcode'} cmp $b->{'barcode'}} @$itemlist) {
136 ($color eq $linecolor1) ? ($color=$linecolor2) : ($color=$linecolor1);
137 $line{'color'}=$color;
138 $line{'itemnumber'}=$item->{'itemnumber'};
139 $line{'barcode'}=$item->{'barcode'};
140 $line{'title'}=$item->{'title'};
141 $line{'author'}=$item->{'author'};
142 push(@itemsloop, \%line);
144 $template->param( itemsloop => \@itemsloop);
145 $template->param( shelfname => $shelflist->{$shelfnumber}->{'shelfname'});
146 $template->param( shelfnumber => $shelfnumber);
150 #print endmenu('catalogue');
154 # Revision 1.10 2003/02/02 07:18:37 acli
155 # Moved C4/Charset.pm to C4/Interface/CGI/Output.pm
157 # Create output_html_with_http_headers function to contain the "print $query
158 # ->header(-type => guesstype...),..." call. This is in preparation for
159 # non-HTML output (e.g., text/xml) and charset conversion before output in
162 # Created C4/Interface/CGI/Template.pm to hold convenience functions specific
163 # to the CGI interface using HTML::Template
165 # Modified moremembers.pl to make the "sex" field localizable for languages
166 # where M and F doesn't make sense
168 # Revision 1.9 2002/12/19 18:55:40 hdl
169 # Templating reservereport et shelves.
171 # Revision 1.9 2002/08/14 18:12:51 hdl
174 # Revision 1.8 2002/08/14 18:12:51 tonnesen
175 # Added copyright statement to all .pl and .pm files
177 # Revision 1.7 2002/07/05 05:03:37 tonnesen
178 # Minor changes to authentication routines.
180 # Revision 1.5 2002/07/04 19:42:48 tonnesen
183 # Revision 1.4 2002/07/04 19:21:29 tonnesen
184 # Beginning of authentication api. Applied to shelves.pl for now as a test case.
186 # Revision 1.2.2.1 2002/06/26 20:28:15 tonnesen
187 # Some udpates that I made here locally a while ago. Still won't be useful, but
188 # should be functional