[Koha-cvs] CVS: koha reservereport.pl,1.2,1.3 shelves.pl,1.8,1.9

Henri-Damien LAURENT hdl at users.sourceforge.net
Thu Dec 19 19:55:42 CET 2002


Update of /cvsroot/koha/koha
In directory sc8-pr-cvs1:/tmp/cvs-serv20637

Modified Files:
	reservereport.pl shelves.pl 
Log Message:
Templating reservereport et shelves.


Index: reservereport.pl
===================================================================
RCS file: /cvsroot/koha/koha/reservereport.pl,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -r1.2 -r1.3
*** reservereport.pl	14 Aug 2002 18:12:51 -0000	1.2
--- reservereport.pl	19 Dec 2002 18:55:40 -0000	1.3
***************
*** 22,45 ****
  # Suite 330, Boston, MA  02111-1307 USA
  
- use C4::Stats;
  use strict;
  use Date::Manip;
  use CGI;
  use C4::Output;
  
  my $input=new CGI;
  my $time=$input->param('time');
- print $input->header;
  
! print startpage;
! print startmenu('report');
! print center;
! print mktablehdr();
  my ($count,$data)=unfilledreserves();
! print $count;
  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'}");
  }
! print mktableft();
! print endmenu('report');
! print endpage;
--- 22,55 ----
  # Suite 330, Boston, MA  02111-1307 USA
  
  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');
! my $template = gettemplate("reservereport.tmpl");
! #print center;
! #print mktablehdr();
  my ($count,$data)=unfilledreserves();
! 
! my @dataloop;
  for (my $i=0;$i<$count;$i++){
! 	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);
  }
! 
! $template->param(	count => $count,
! 								dataloop => \@dataloop);
! print "Content-Type: text/html\n\n", $template->output;

Index: shelves.pl
===================================================================
RCS file: /cvsroot/koha/koha/shelves.pl,v
retrieving revision 1.8
retrieving revision 1.9
diff -C2 -r1.8 -r1.9
*** shelves.pl	14 Aug 2002 18:12:51 -0000	1.8
--- shelves.pl	19 Dec 2002 18:55:40 -0000	1.9
***************
*** 30,38 ****
  use C4::Circulation::Circ2;
  use C4::Auth;
  
  my $env;
  my $query = new CGI;
  my ($loggedinuser, $cookie, $sessionID) = checkauth($query);
! print $query->header(-cookie => $cookie);
  my $headerbackgroundcolor='#663266';
  my $circbackgroundcolor='#555555';
--- 30,39 ----
  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);
  my $headerbackgroundcolor='#663266';
  my $circbackgroundcolor='#555555';
***************
*** 40,49 ****
  my $linecolor1='#bbbbbb';
  my $linecolor2='#dddddd';
! 
! print startpage();
! print startmenu('catalogue');
! 
! 
! print "<p align=left>Logged in as: $loggedinuser [<a href=/cgi-bin/koha/logout.pl>Log Out</a>]</p>\n";
  
  
--- 41,48 ----
  my $linecolor1='#bbbbbb';
  my $linecolor2='#dddddd';
! my $template=gettemplate("shelves.tmpl");
! #print startpage();
! #print startmenu('catalogue');
! #print "<p align=left>Logged in as: $loggedinuser [<a href=/cgi-bin/koha/logout.pl>Log Out</a>]</p>\n";
  
  
***************
*** 64,89 ****
  
  SWITCH: {
      if ($query->param('viewshelf')) {  viewshelf($query->param('viewshelf')); last SWITCH;}
      if ($query->param('shelves')) {  shelves(); last SWITCH;}
!     print << "EOF";
!     <center>
!     <table border=0 cellpadding=4 cellspacing=0>
!     <tr><td bgcolor=$headerbackgroundcolor>
!     <table border=0 cellpadding=5 cellspacing=0 width=100%>
!     <tr><th bgcolor=$headerbackgroundcolor>
!     <font color=white>Shelf List</font>
!     </th></tr>
!     </table>
!     </td></tr>
! EOF
!     my $color='';
!     foreach (sort keys %$shelflist) {
! 	($color eq $linecolor1) ? ($color=$linecolor2) : ($color=$linecolor1);
! 	print "<tr><td bgcolor=$color><a href=shelves.pl?viewshelf=$_>$shelflist->{$_}->{'shelfname'} ($shelflist->{$_}->{'count'} books)</a></td></tr>\n";
      }
!     print "</table>\n";
!     print "<P><a href=shelves.pl?shelves=1>Add or Remove Book Shelves</a>\n";
  }
  
  
  
--- 63,88 ----
  
  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;}
! 	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);
      }
! 	$template->param(shelvesloop => \@shelvesloop);
  }
  
+ print $query->header(-cookie => $cookie), $template->output;
  
  
***************
*** 92,136 ****
  	my ($status, $string) = AddShelf($env,$newshelf);
  	if ($status) {
! 	    print "<font color=red>$string</font><p>\n";
  	}
      }
      foreach ($query->param()) {
! 	if (/DEL-(\d+)/) {
! 	    my $delshelf=$1;
! 	    my ($status, $string) = RemoveShelf($env,$delshelf);
! 	    if ($status) {
! 		print "<font color=red>$string</font><p>\n";
! 	    }
! 	}
      }
      my ($shelflist) = GetShelfList();
-     print << "EOF";
- <center>
- <a href=shelves.pl>Modify Shelf Contents</a><p>
- <h1>Bookshelves</h1>
- <table border=0 cellpadding=7>
- <tr><td align=center>
- <form method=post>
- <input type=hidden name=shelves value=1>
- <table border=0 cellpadding=0 cellspacing=0>
- <tr><th bgcolor=$headerbackgroundcolor>
- <font color=white>Select Shelves to Delete</font>
- </th></tr>
- EOF
      my $color='';
!     my $color='';
!     foreach (sort keys %$shelflist) {
! 	($color eq $linecolor1) ? ($color=$linecolor2) : ($color=$linecolor1);
! 	print "<tr><td bgcolor=$color><input type=checkbox name=DEL-$_> $shelflist->{$_}->{'shelfname'} ($shelflist->{$_}->{'count'} books)</td></tr>\n";
!     }
!     print "</table>\n";
!     print '<p><input type=submit value="Delete Shelves"><p>';
!     print "</td><td align=center valign=top>\n";
!     print "<form method=post>\n";
!     print "<input type=hidden name=shelves value=1>\n";
!     print "<p>Add Shelf: <input name=addshelf size=25><p>\n";
!     print '<p><input type=submit value="Add New Shelf"><p>';
!     print "</form>\n";
!     print "</td></tr></table>\n";
  }
  
--- 91,125 ----
  	my ($status, $string) = AddShelf($env,$newshelf);
  	if ($status) {
! 	    $template->param(status1 => $status, string1 => $string);
  	}
      }
+ 	my @paramsloop;
      foreach ($query->param()) {
! 		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();
      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);
!     }
! 	$template->param(shelvesloop=>\@shelvesloop);
  }
  
***************
*** 141,191 ****
      my ($itemlist) = GetShelfContents($env, $shelfnumber);
      my $item='';
-     print << "EOF";
-     <center>
-     <form>
-     <a href=shelves.pl>Shelf List</a><p>
-     <table border=0 cellpadding=0 cellspacing=0>
-     <tr><td colspan=7>
-     <table>
-     <tr><td>Add a book by barcode:</td><td><input name=addbarcode></td></tr>
-     </table>
-     <br>
-     <table border=0 cellpadding=5 cellspacing=0 width=100%>
-     <tr><th bgcolor=$headerbackgroundcolor>
-     <font color=white>Contents of $shelflist->{$shelfnumber}->{'shelfname'} shelf</font>
-     </th></tr>
-     </table>
-     </td></tr>
- EOF
      my $color='';
      foreach $item (sort {$a->{'barcode'} cmp $b->{'barcode'}} @$itemlist) {
! 	($color eq $linecolor1) ? ($color=$linecolor2) : ($color=$linecolor1);
! 	print << "EOF";
! 	<tr>
! 	<td bgcolor=$color><input type=checkbox name=REM-$item->{'itemnumber'}></td>
! 	<td bgcolor=$color width=10 align=center><img src=/images/blankdot.gif></td>
! 	<td bgcolor=$color>$item->{'barcode'}</td>
! 	<td bgcolor=$color width=10 align=center><img src=/images/blankdot.gif></td>
! 	<td bgcolor=$color>$item->{'title'}</td>
! 	<td bgcolor=$color width=10 align=center><img src=/images/blankdot.gif></td>
! 	<td bgcolor=$color>$item->{'author'}</td>
! 	</tr>
! EOF
!     }
!     print << "EOF";
!     </table>
!     <br>
!     <input type=hidden name=shelfnumber value=$shelfnumber>
!     <input type=hidden name=modifyshelfcontents value=1>
!     <input type=hidden name=viewshelf value=$shelfnumber>
!     <input type=submit value="Remove Selected Items">
!     </form>
! EOF
  }
  
! 
  
  #
  # $Log$
  # Revision 1.8  2002/08/14 18:12:51  tonnesen
  # Added copyright statement to all .pl and .pm files
--- 130,161 ----
      my ($itemlist) = GetShelfContents($env, $shelfnumber);
      my $item='';
      my $color='';
+ 	my @itemsloop;
      foreach $item (sort {$a->{'barcode'} cmp $b->{'barcode'}} @$itemlist) {
! 		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);
!     }
! 	$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
***************
*** 209,212 ****
  
  
- print endpage();
- print endmenu('catalogue');
--- 179,180 ----





More information about the Koha-cvs mailing list