<%args> $item $height => 400 $email => undef $password => undef $comment => undef $piccount => 1 $thumbs => 2 $thumbsperline => 5 <%perl> use IVG; if ($thumbs < 0 || $thumbs > 100) { $thumbs = 2; } # connect to database my $d = &IVG::connect(); # adjustments my $actualheight = $height - 40; $actualheight -= ($actualheight/5); # navigation print "
"; print qq{ << Gallery list }; my @keywords = &IVG::keywords($d,$item); my $masterkey = $keywords[0]; foreach my $key (@keywords) { print ""; my $b = &IVG::backnext($d,$item,$key,'<'); print "
" , $key , "
"; if (defined ($b)) { print qq{ Back }; } print ""; $b = &IVG::backnext($d,$item,$key,'>'); if (defined ($b)) { print qq{ Next }; } print "
"; } print "
\n"; # Print login or logout #use APR::Request::Cookie(); use Apache2::Cookie (); use Apache2::RequestRec (); use Apache2::Request (); #my $rr = shift; #print $r; #my $r = Apache2::Request->new; #<($rr); my $loggedin = 0; # fetch existing cookies my %cookies = fetch Apache2::Cookie; my $ivgses; if (defined ($cookies{'IVGSES'})) { $ivgses = $cookies{'IVGSES'}->value; } # print "IVG" . $ivgses . "# "; # print "EMAIL" . $email . "# "; # print "PASS" . $password . "# "; if (defined ($email) && defined ($password)) { #print "email and pass"; if ($ivgses = &IVG::login($d,Digest::MD5::md5_hex($email) . Digest::MD5::md5_hex($password))) { my $cookie = Apache2::Cookie->new($r, -name => 'IVGSES', -value => $ivgses, -expires => '+1h', -domain => '.helenius.fi' ); $cookie->bake($r); $loggedin = 1; } } else { #print "check cookie"; if (&IVG::login($d,$ivgses)) { $loggedin = 1; } } if ($loggedin) { print "LOGGED IN"; if (defined ($comment)) { &IVG::updatetext ($d,$item . "-text", $comment); } } else { print "
"; print "Login:
"; print "
\n"; print "Password:
"; print "
\n"; print ""; print ""; print "
"; } print "
\n"; print qq{ }; #print 'petri@helenius.fi'; print '
'; while ($piccount-- && defined ($item)) { print qq{
}; print qq{ }; if ((($thumbs*2) + 1) <= $thumbsperline) { print qq{ }; } print "\n"; my $thumbheight = $actualheight / 5; my $c = $thumbs; # loop until exhausted my $tempitem = $item; my @items; while ($c) { my $b2 = &IVG::backnext($d,$tempitem,$masterkey,'<'); if (defined ($b2)) { push @items,$b2; $tempitem = $b2; $c--; } else { $c = 0; } } my $b2; my $b1; #my $b2 = &IVG::backnext($d,$item,$masterkey,'<'); #my $b1; #if (defined ($b2)) { # $b1 = &IVG::backnext($d,$b2,$masterkey,'<'); #} $c = 0; while (my $b1 = pop (@items)) { #if (defined ($b1)) { print qq{ }; $c++; if (!($c % $thumbsperline)) { print ""; } # undef $b1; } #else { # print ""; } #if (defined ($b2)) { # print qq{ }; # undef $b2; #} else { print ""; } print qq{ }; $c = $thumbs; # loop until exhausted $tempitem = $item; while ($c) { my $b2 = &IVG::backnext($d,$tempitem,$masterkey,'>'); if (defined ($b2)) { print qq{ }; $tempitem = $b2; if (!(($c - 1) % $thumbsperline)) { print ""; } $c--; } else { $c = 0; } } #$b2 = &IVG::backnext($d,$item,$masterkey,'>'); #$b1 = &IVG::backnext($d,$b2,$masterkey,'>'); #if (defined ($b2)) { #print qq{ }; #} else { print ""; } #if (defined ($b1)) { #print qq{ }; #} else { print ""; } print qq{
}; print qq{
}; if ($loggedin) { print "
"; print ""; print ""; print ""; print "
"; } else { print &IVG::gettext($d,$item . "-text"); } print qq{
}; print qq{ }; print qq{
}; # print qq{
# #
}; $item = &IVG::backnext($d,$item,$keywords[0],'>'); } &IVG::disconnect($d);