UBBC [box] tag SP1/1.1/1.2/1.3
1.3
This mod adds an extra [box] UBBC tag
Anything contained within the [box]...[/box] tags will appear in a box similar to the code box or quote box, but without any heading text.
The width, alignment and background colour of the box can be changed by using the "width=???", "align=???", or "color=???" attributes in any combination or order. Width can be a number (pixels) or a percentage (%), color can be a name (white) or number (#FFFFFF)
The style can be controlled by changing the style settings for .messagebox in the template
To install: Apply the mod and upload the files - that's it!
Version 1.1 - bug fix: The boxes are now displayed on the printable thread display, but any align, width or color attributes are ignored.
Version 1.2 - bug fix: Empty boxes (nothing between the [box][/box] tags are now displayed correctly.
Version 1.3 - maximum box width now limited to 100% or 1000.
BHRA Webmaster
http://www.bhra.org.uk
###############################################################################
english.lng
$txt{'706'} = qq~Code:~;
$txt{'706a'} = qq~~;
###############################################################################
template.html
/* Post quote/code colors */
.messagebox { color: #000000; background-color: #DEE7EF; }
###############################################################################
Sources/YaBBC.pl
sub quotemsg {
sub box {
undef %parameter;
my ($tmpstuff, $tmpmessage) = @_;
foreach $dummy (split(/\s+/, $tmpstuff)) {
($key, $value) = split(/=/,$dummy);
$parameter{$key} = $value;
}
$parameter{'width'} =~ s~[^0-9\%]~~g;
if ($parameter{'width'} =~ m/\%/) {
my ($tmp_width, $dummy) = split(/\%/,$parameter{'width'});
if ($tmp_width > 100) {$tmp_width = 100;}
$parameter{'width'} = "$tmp_width%";
} else {
if (int $parameter{'width'} > 1000) {$parameter{'width'} = "1000";}
}
if ($parameter{'width'} eq "") {$parameter{'width'} = "90%";}
if ($parameter{'color'} ne "") {$parameter{'color'} = qq~ bgcolor="$parameter{'color'}" style="background-color:$parameter{'color'}"~;}
if ($parameter{'colour'} ne "") {$parameter{'color'} = qq~ bgcolor="$parameter{'colour'}" style="background-color:$parameter{'colour'}"~;}
if ($parameter{'align'} ne "") {$parameter{'align'} = qq~ align="$parameter{'align'}"~;}
$_ = $txt{'706a'};
$_ =~ s~BOXWIDTH~$parameter{"width"}~ig;
$_ =~ s~BOXSTYLE~$parameter{'color'}~ig;
$_ =~ s~BOXALIGN~$parameter{'align'}~ig;
$_ =~ s~BOXMESSAGE~$tmpmessage~ig;
return $_;
}
$message =~ s~\[quote\s+author=(.*?)link=(.*?)\s+date=(.*?)\s*\]\n*(.*?)\n*\[/quote\]~"emsg($1,$2,$3,$4)~eisg;
$message =~ s~\[box(.*?)\](.*?)\[/box\]~&box($1,$2)~eisg;
###############################################################################
Sources/Printpage.pl
$threadpost =~ s~\[list\]~
$threadpost =~ s~\[box(.*?)\](.*?)\[\/box\]~~isg;