#!/usr/bin/perl #------------------------------------------------------------------ # required modules #------------------------------------------------------------------ use strict; use warnings; use CGI; #------------------------------------------------------------------ # the global constants #------------------------------------------------------------------ my $TRUE = -1; my $FALSE = 0; #------------------------------------------------------------------ # the global objects #------------------------------------------------------------------ my $g_oCGI = new CGI; #------------------------------------------------------------------ # expected form variables #------------------------------------------------------------------ my $lImageID = getRequestString( 'image_id', '0' ); my $sAction = getRequestString( 'action', 'view' ); #------------------------------------------------------------------ # the gallery images #------------------------------------------------------------------ my @g_aGallery = ( #============================================================== # Image 1 #============================================================== { Caption => q{ Sean Astin records a special greeting just for the DVD to explain the back story of "The Long and Short of It" }, ImageName => q{ } }, #============================================================== # Image 2 #============================================================== { Caption => q{ Elijah Wood acts as the First Assistant Director and takes direction from Sean Astin. }, ImageName => q{ } }, #============================================================== # Image 3 #============================================================== { Caption => q{ Sean Astin directs in the rain. }, ImageName => q{ } }, #============================================================== # Image 4 #============================================================== { Caption => q{ Andrew and Fawn get down to business in the film. }, ImageName => q{ } }, #============================================================== # Image 5 #============================================================== { Caption => q{ Andrew, Fawn and Paul work together in a scene from the movie. }, ImageName => q{ } }, #============================================================== # Image 6 #============================================================== { Caption => q{ The cast takes a moment to view their work. }, ImageName => q{ } }, #============================================================== # Image 7 #============================================================== { Caption => q{ Director Peter Jackson takes the wheel. }, ImageName => q{ } } ); #------------------------------------------------------------------ # format the image send form #------------------------------------------------------------------ sub formatImageSendForm { my $lImageID = shift; my $sTemplate =<<_HTML_EOF_;
_HTML_EOF_ return $sTemplate; } #------------------------------------------------------------------ # format the image sent #------------------------------------------------------------------ sub formatImageSent { my $lImageID = shift; my $lNextImageID = $lImageID + 1; my $lPrevImageID = $lImageID - 1; my $sImage = $g_aGallery[ $lImageID ]{ "Caption" }; my $sCaption = "Thank you.
$sCaption
![]()
$sCaption
_HTML_EOF_ return $sTemplate; } #------------------------------------------------------------------ # format the image #------------------------------------------------------------------ sub formatGalleryImage { my $lImageID = shift; my $sMode = shift; my $sCaption = ''; if( $sMode eq 'send' ) { $sCaption = formatImageSendForm( $lImageID ); } elsif( $sMode eq 'sent' ) { $sCaption = formatImageSent( $lImageID ); } else { $sCaption = formatImageView( $lImageID ); } my $sTemplate =<<_HTML_EOF_;![]() |
$sCaption |