%# This is the default web page to visit. it displays the left, middle, and right
%# colums of the body. it also sets up what album we are looking at, and what
%# the image in the middle should look like.
<& display_links , (album=>$album, links=>[@left_links]) &>
|
<& display_middle , (main_picture=>$main_picture , album=>$album,
title=>$title, description=>$description) &>
|
<& display_links , (album=>$album, links=>[@right_links]) &>
|
<%args>
$album=>''
$main_picture=>''
$title=>''
$description=>''
$change_album=>''
%args>
<%init>
my $loop;
our $pictures;
#if you are pased an album to move something to, make that the main image
$album = $change_album if ($change_album);
if ($change_album and $main_picture)
{
#move the album of a selected image if none is specified
$pictures->change_album($main_picture,$change_album);
#print "you are trying to change the album $change_album $main_picture
".$pictures->error;
}
else
{
#print "youa re not trying to change ablum
";
}
#album list is gotten from the database
my @album_list = $pictures->get_albums();
#default to the first album if none is specified, or the one given is invalid
$album=$album_list[0] if ($album eq '' or $pictures->is_an_album($album) eq 0);
#now, get the list of images from the database.
my @picture_list=$pictures->get_pictures($album);
#default the main picture if no valid image is passed in.
$main_picture=($picture_list[0])
if ($main_picture eq '' or not $pictures->is_a_picture($main_picture,$album));
my @left_links;
my @right_links;
#now place half the images onto one aray, and the other half onto another
my $number_of_images=@picture_list;
for ($loop=0;$loop< ($number_of_images/2);$loop++)
{
push (@left_links , shift @picture_list);
}
#what you dont put on the left, put on the right
@right_links=@picture_list;
%init>