use strict; use HTML::Entities (); package Pos::Webtop::Web::OEM::28::Box; # NOTE that with this new box format, border width is not adjustable due # to the use of shaded graphics my %types = ( default => { borderWidth=> 1, # only used if border true border=> 1, # true or false topicClass=> "BOXTOPIC", topicAlign=> "left", class=> "BOXTD1", align=> "left", valign=> "top", padding=> 4 }, contentModulePreview => { borderWidth=> 1, # only used if border true border=> 1, # true or false topicClass=> "CLMPREVIEWTITLE", topicAlign=> "left", class=> "CLMPREVIEW", align=> "left", valign=> "top", padding=> 2 }, prefModule => { borderWidth=> 1, # only used if border true border=> 1, # true or false topicClass=> "BOXTOPIC", topicAlign=> "left", class=> "PREFMODULEBOX", align=> "left", valign=> "top", padding=> 4 }, webTheme => { borderWidth=> 1, # only used if border true border=> 1, # true or false topicClass=> "WEBTHEMEBOXTOPIC", topicAlign=> "left", class=> "WEBTHEMEBOX", align=> "left", valign=> "top", padding=> 2 } ); sub new { my $this = shift; my $class = ref($this) || $this; my ($self,$title,$type,$width) = @{{@_}}{qw/self title type width/}; if ( not defined $self ) { $self = {}; bless($self,$class); } $title = "Webtop" unless defined $title; $type = "default" unless defined $type; $type = "default" if not exists $types{$type}; $self->{'title'} = $title; $self->{'typeName'} = $type; $self->{'type'} = $types{$type}; $self->{'width'} = $width; return $self; } sub getShadowBoxTableHeader { my $self = shift; my ($width) = @{{@_}}{qw/width/}; my $widthStr = ""; if ( defined($width) && length($width) ) { $widthStr = " width='$width'"; } my $ret = " "; return $ret; } sub getHeaderHtml { my $self = shift; if ( $self->{'typeName'} eq "webTheme" ) { return $self->getWebThemeHeaderHtml(@_); } my ($title) = @{{@_}}{qw/title/}; $title = $self->{'title'} unless defined $title; my $type = $self->{'type'}; my $cp = $type->{'padding'}; my $tc = $type->{'topicClass'}; my $ta = $type->{'topicAlign'}; my $bc = $type->{'class'}; my $ba = $type->{'align'}; my $bv = $type->{'valign'}; my $width = $self->{'width'}; my $topicPaddingString = "padding-left: 4px; padding-right: 4px; padding-top: 2px; padding-bottom: 2px;"; if ( $self->{'typeName'} eq 'contentModulePreview' ) { $topicPaddingString = "padding-left: 4px; padding-right: 4px;"; } my $ret = $self->getShadowBoxTableHeader( width=> $width ); $ret .= "
$title
"; return $ret; } sub getShadowBoxTableFooter { return "
"; } sub getFooterHtml { my $self = shift; if ( $self->{'typeName'} eq "webTheme" ) { return $self->getWebThemeFooterHtml(@_); } my $ret = ""; $ret .= " "; $ret .= $self->getShadowBoxTableFooter(); return $ret; } sub getWebThemeHeaderHtml { my $self = shift; my ($title) = @{{@_}}{qw/title/}; $title = $self->{'title'} unless defined $title; my $type = $self->{'type'}; my $cp = $type->{'padding'}; my $tc = $type->{'topicClass'}; my $ta = $type->{'topicAlign'}; my $bc = $type->{'class'}; my $ba = $type->{'align'}; my $bv = $type->{'valign'}; my $width = $self->{'width'}; my $topicPaddingString = "padding-left: 4px; padding-right: 4px; padding-top: 2px; padding-bottom: 2px;"; if ( $self->{'typeName'} eq 'contentModulePreview' ) { $topicPaddingString = "padding-left: 4px; padding-right: 4px;"; } my $ret = $self->getShadowBoxTableHeader( width=> $width ); $ret .= "
"; } sub getWebThemeFooterHtml { my $self = shift; my $ret = "
"; $ret .= $self->getShadowBoxTableFooter(); return $ret; } 1;