1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187
|
##
## wml::std::box - Easily Create Rectangular Box
## Copyright (c) 1997-2001 Ralf S. Engelschall, All Rights Reserved.
##
# The <preserve>/<restore> tags with multiple arguments require WML 2.0.3
#use wml::mod::version
<require 2.0.3 />
#use wml::des::space
<define-tag box endtag=required>
<preserve bgcolor fgcolor bdcolor bdwidth bdspace width summary header />
<set-var %attributes />
<when <not <get-var header /> />>
#
# The standard box created via just two nested tables
#
<defvar bdwidth 1 />
<defvar bdspace 4 />
<if <get-var bdcolor /> <group "
<table* cellspacing=0 cellpadding=<get-var bdwidth /> \
bgcolor=<get-var bdcolor /> border=0 \
<if <get-var summary /> "summary=\"<get-var summary />\"" />\
>
<tr*>
<td*>\
" /> />
<table <if <get-var bgcolor /> "bgcolor=<get-var bgcolor />" /> \
<if <get-var width /> "width=<get-var width />" /> \
cellspacing=0 cellpadding=<get-var bdspace /> \
border=0>
<tr>
<td>\
<if <get-var fgcolor /> "<font* color=<get-var fgcolor />>" />\
%body\
<if <get-var fgcolor /> "</font*>" />\
</td>
</tr>
</table>
<if <get-var bdcolor /> <group "
</td*>
</tr*>
</table*>
" /> />
</when>
#
# The headlined box created via one table and space GIFs
#
<when <get-var header />>
<defvar bdcolor "#000000" />
<defvar bdspace 4 />
<defvar width 300 />
<table border=0 cellpadding=0 cellspacing=0\
<if <get-var summary /> " summary=\"<get-var summary />\"" />>
<tr>
<td colspan=2><space width=1 height=8 /></td>
<td rowspan=3> <get-var header /> </td>
<td colspan=2><space width=1 height=1 /></td>
</tr>
<tr>
<td bgcolor="<get-var bdcolor />" colspan=2><space width=1 height=1 /></td>
<td bgcolor="<get-var bdcolor />" colspan=2><space width=1 height=1 /></td>
</tr>
<tr>
<td bgcolor="<get-var bdcolor />"><space width=1 height=5 /></td>
<td <if <get-var bgcolor /> "bgcolor=<get-var bgcolor />" />>\
<space width=40 height=1 /></td>
<td <if <get-var bgcolor /> "bgcolor=<get-var bgcolor />" />>\
<space width=<get-var width /> height=1 /></td>
<td bgcolor="<get-var bdcolor />"><space width=1 height=5 /></td>
</tr>
<tr>
<td bgcolor="<get-var bdcolor />"><space width=1 height=1 /></td>
<td colspan=3 <if <get-var bgcolor /> "bgcolor=<get-var bgcolor />" />>
<table border=0 cellspacing=<get-var bdspace />>
<tr>
<td>%body</td>
</tr>
</table>
</td>
<td bgcolor="<get-var bdcolor />"><space width=1 height=1 /></td>
</tr>
<tr>
<td colspan=5 bgcolor="<get-var bdcolor />"><space width=1 height=1 /></td>
</tr>
</table>
</when>
<restore bgcolor fgcolor bdcolor bdwidth bdspace width summary header />
</define-tag>
##EOF##
__END__
=head1 NAME
wml::std::box - Easily Create Rectangular Box
=head1 SYNOPSIS
#use wml::std::box
<box [attributes]>
...
</box>
=head1 DESCRIPTION
The C<E<lt>boxE<gt>> container tag puts its body into a nice rectangular box
which itself is build via a HTML C<E<lt>tableE<gt>> construct.
=head1 ATTRIBUTES
=over 4
=item C<header>
This attribute switches between two totally different box variants. When it
is present, a headlined box is created by the use of one single table but with
space GIFs. When this attribute is missing a standard box is created by the
use of two nested tables but without any space GIFs.
=item C<bgcolor>
This sets the background color of the box.
=item C<fgcolor>
This sets the foreground (text) color of the box.
=item C<bdcolor>
This sets the color for the border of the box. The effect of this attribute is
the automatic generation of a nested table construct to achieve the optical
effect.
=item C<bdspace>
This sets the space between the border and the body of the box in pixels.
Default is 4 pixel.
=item C<bdwidth>
This sets the border width in pixels. Default is 1 pixel.
=item C<width>
This sets the total table width in pixels. Default is no specific width for
the standard box and 300 pixels for the headlined box (because the headlined
variant needs to know a fixed size to create the GIFs accordingly).
=item C<summary>
Add a description of this table. This attribute is recommended in HTML
4.0.
=back
=head1 EXAMPLE
<box bdcolor="#000000" bdwidth=1 bdspace=10
bgcolor="#ffffff" fgcolor="#000000">
Foo Bar Quux
</box>
<box header="Foo Bar Quux Header"
bdcolor="#000000" bdwidth=1 bdspace=10
bgcolor="#ffffff" fgcolor="#000000">
Foo Bar Quux
</box>
=head1 AUTHOR
Ralf S. Engelschall
rse@engelschall.com
www.engelschall.com
=head1 REQUIRES
Internal: P1, P2
=head1 SEE ALSO
HTML C<E<lt>tableE<gt>> tag.
=cut
|