#!/usr/bin/perl
#
use strict;
package LJ::Portal;
use vars qw(%box);
$box{'newtolj'} =
{
'name' => '',
'small' => 1,
'large' => 0,
'handler' => sub {
my ($remote, $opts, $box) = @_;
my $b = $opts->{'body'};
box_start($b, $box, { 'title' => "About $LJ::SITENAME",
'align' => "left",
'url' => '/site/about.bml', });
$$b .= "New to $LJ::SITENAME?";
my @links = ("What is $LJ::SITENAME?", "/site/about.bml",
"Create an account!", "/create.bml");
while (@links) {
my $link = shift @links;
my $url = shift @links;
$$b .= "
$link\n";
}
box_end($b, $box);
$$b .= "\n";
},
};
############################################################################
$box{'goat'} =
{
'name' => '',
'small' => 1,
'large' => 0,
'opts' => [ { 'key' => 'misbehaved',
'name' => '',
'des' => '',
'type' => 'check',
'value' => 1,
'default' => 0, },
{ 'key' => 'goattext',
'name' => '',
'des' => '',
'type' => 'text',
'default' => "Baaaaah",
'size' => 40,
'maxlength' => 40, },
],
'handler' => sub {
my ($remote, $opts, $box) = @_;
my $b = $opts->{'body'};
my $bo = $opts->{'bodyopts'};
my $h = $opts->{'head'};
my $pic;
if ($opts->{'form'}->{'frank'} eq "urinate" || $box->{'args'}->{'misbehaved'}) {
$pic = "pee";
} else {
$pic = "hover";
}
box_start($b, $box, { 'title' => "Frank",
'align' => "center",
'url' => "/site/goat.bml", });
my $imgname = "frankani" . $box->{'uniq'};
my $goattext = $box->{'args'}->{'goattext'} || "Baaaah";
$$b .= <<"GOAT_STUFF";
"$goattext" says Frank.
GOAT_STUFF
box_end($b, $box);
$opts->{'onload'}->{"MM_preloadImages('$LJ::IMGPREFIX/goat-$pic.gif');"} = 1;
unless ($opts->{'did'}->{'image_javascript'})
{
$opts->{'did'}->{'image_javascript'} = 1;
$$h .= <<'JAVASCRIPT';
JAVASCRIPT
} # end unless
}, # end handler
};
############################################################################