Subversion Repositories CoffeeCatalog

Rev

Rev 2 | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 2 Rev 4
Line 1... Line 1...
1
#!/usr/bin/perl -w
1
#!/usr/bin/perl -w
Line 2... Line 2...
2
 
2
 
3
use strict;
3
use strict;
-
 
4
use CGI qw(:standard escape escapeHTML);
Line 4... Line 5...
4
use CGI qw(:standard escapeHTML);
5
use WebDB;
-
 
6
 
-
 
7
if (defined (param ("name"))) {
5
 
8
  my $image = param ("name");
6
if (defined (param ("name"))) {
9
  my $thumb = param ("thumbnail");
7
	display_image (param ("name"), param ("thumbnail"));
10
	display_image ($image, $thumb);
8
} elsif (defined (param ("gallery"))) {
11
} elsif (defined (param ("gallery"))) {
9
	display_gallery ()
12
	display_gallery ()
10
} else {
13
} else {
Line 11... Line 14...
11
	error ("Unknown request type");
14
	error ("Unknown request type");
12
}
15
}
13
 
16
 
14
 
17
 
Line 15... Line 18...
15
sub display_image {
18
sub display_image {
16
	my ($name, $show_thumbnail) = @_;
19
	my ($name, $show_thumbnail) = @_;
17
	my $col_name = (defined ($show_thumbnail) ? "thumbnail" : "image");
20
	my $col_name = (defined ($show_thumbnail) ? "thumbnail" : "logo");
18
	my ($dbh, $mime_type, $data);
21
	my ($dbh, $mime_type, $data);
19
	
22
	
Line 20... Line 23...
20
	$dbh = WebDB::connect ();
23
	$dbh = WebDB::connect ();
21
	($mime_type, $data) = $dbh->selectrow_array (
24
	($mime_type, $data) = $dbh->selectrow_array (
Line 33... Line 36...
33
	my ($dbh, $sth);
36
	my ($dbh, $sth);
Line 34... Line 37...
34
	
37
	
Line 35... Line 38...
35
	print header (), start_html ("Image Gallery");
38
	print header (), start_html ("Image Gallery");
36
	
39
	
37
	$dbh = WebDB::connect ();
40
	$dbh = WebDB::connect ();
Line 38... Line 41...
38
	$sth = $dbh->prepare ("SELECT name FROM image ORDER BY name");
41
	$sth = $dbh->prepare ("SELECT roaster FROM roasters ORDER BY roaster");
39
	$sth->execute ();
42
	$sth->execute ();