5
use HTML::Widgets::SelectLayers;
7
tie my %o, 'Tie::IxHash',
8
'download' => 'Download',
9
'installation' => 'Installation',
10
'compatibility' => 'Compatibility',
11
'documentation' => 'Documentation',
12
'cvs' => 'Anonymous CVS access',
17
'download' => '<A HREF="HTML-Widgets-SelectLayers-0.01.tar.gz">Download HTML-Widgets-SelectLayers-0.01.tar.gz</a>',
19
'installation' => '<PRE>
27
Anonymous CVS access is available:
28
$ export CVSROOT=":pserver:anonymous@cleanwhisker.420.am:/home/cvs/cvsroot"
30
(Logging in to anonymous@cleanwhisker.420.am
31
CVS password: anonymous
32
$ cvs checkout DBIx-DBSchema
33
as well as <A HREF="http://www.420.am/cgi-bin/cvsweb/HTML-Widgets-SelectLayers">browsable via cvsweb</A>.
36
'documentation' => join('',<DATA>),
38
'compatibility' => '<PRE>
39
This HTML generated by this module uses JavaScript, but nevertheless attempts
40
to be as cross-browser as possible, testing for features via DOM support rather
41
than specific browsers or versions. It has been tested under Mozilla 0.9.8,
42
Netscape 4.77, IE 5.5, Konqueror 2.2.2, and Opera 5.0.
48
my $w = new HTML::Widgets::SelectLayers(
50
'selected_layer' => 'download',
51
'layer_callback' => sub {
53
"<BR>". $html{$layer};
57
#'form_checkbox' => [],
60
print <<END, $w->html, "</BODY></HTML>\n";
63
<TITLE>HTML::Widgets::SelectLayers - selectable HTML layers</TITLE>
67
HTML::Widgets::SelectLayers
69
Copyright (c) 2002 Ivan Kohler
71
This program is free software; you can redistribute it and/or modify it under
72
the same terms as Perl itself.
74
This module implements an HTML widget with multiple layers. Only one layer
75
is visible at any given time, controlled by a <SELECT> box. For an example
85
<H1><A NAME="name">NAME</A></H1>
86
<P>HTML::Widgets::SelectLayers - Perl extension for selectable HTML layers</P>
89
<H1><A NAME="synopsis">SYNOPSIS</A></H1>
91
use HTML::Widgets::SelectLayers;</PRE>
94
tie my %options, 'Tie::IxHash',
95
'value' => 'Select One',
96
'value2' => 'Select Two',
99
$widget = new HTML::Widgets::SelectLayers(
100
'options' => \%options,
101
'form_name' => 'dummy',
102
'form_actoin' => 'process.cgi',
103
'form_text' => [ qw( textfield1 textfield2 ) ],
104
'form_checkbox' => [ qw( checkbox1 ) ],
105
'layer_callback' => sub {
107
my $html = qq!<INPUT TYPE="hidden" NAME="layer" VALUE="$layer">!;
108
$html .= $other_stuff;
113
print '<FORM NAME=dummy>'.
114
'<INPUT TYPE="text" NAME="textfield1">'.
115
'<INPUT TYPE="text" NAME="textfield2">'.
116
'<INPUT TYPE="checkbox" NAME="checkbox1" VALUE="Y">'.
117
$widget->html;</PRE>
120
<H1><A NAME="description">DESCRIPTION</A></H1>
121
<P>This module implements an HTML widget with multiple layers. Only one layer
122
is visible at any given time, controlled by a <SELECT> box. For an
123
example see <A HREF="http://www.420.am/selectlayers/">http://www.420.am/selectlayers/</A></P>
124
<P>This HTML generated by this module uses JavaScript, but nevertheless attempts
125
to be as cross-browser as possible, testing for features via DOM support rather
126
than specific browsers or versions. It has been tested under Mozilla 0.9.8,
127
Netscape 4.77, IE 5.5, Konqueror 2.2.2, and Opera 5.0.</P>
130
<H1><A NAME="forms">FORMS</A></H1>
131
<P>Not all browsers seem happy with forms that span layers. The generated HTML
132
will have a </FORM> tag before the layers and will generate
133
<FORM> and </FORM> tags for each layer. To facilitate
134
<SUBMIT> buttons located within the layers, you can pass a form name
135
and element names, and the relevant values will be copied to the layer's form.
136
See the <STRONG>form_</STRONG> options below.</P>
139
<H1><A NAME="methods">METHODS</A></H1>
141
<DT><STRONG><A NAME="item_new_KEY%2C_VALUE%2C_KEY%2C_VALUE%2E%2E%2E">new KEY, VALUE, KEY, VALUE...</A></STRONG><BR>
143
Options are passed as name/value pairs:
144
<P>options - Hash reference of layers and labels for the <SELECT>. See
145
<A HREF="http://search.cpan.org/doc/GSAR/Tie-IxHash-1.21/lib/Tie/IxHash.pm">the Tie::IxHash manpage</A> to control ordering.
146
In HTML: <OPTION VALUE=``$layer''>$label</OPTION></P>
147
<P>layer_callback - subroutine reference to create each layer. The layer name
148
is passed as an option in <EM>@_</EM></P>
149
<P>selected_layer - (optional) initially selected layer</P>
150
<P>form_name - (optional) Form name to copy values from. If not supplied, no
151
values will be copied.</P>
152
<P>form_action - Form action</P>
153
<P>form_text - (optional) Array reference of text (or hidden) form fields to copy
154
from the <STRONG>form_name</STRONG> form.</P>
155
<P>form_checkbox - (optional) Array reference of checkbox form fields to copy from
156
the <STRONG>form_name</STRONG> form.</P>
157
<P>fixup_callback - (optional) subroutine reference, returns supplimentary
158
JavaScript for the function described above under FORMS.</P>
160
<P>size - (optional) size of the <SELECT>, default 1.</P>
161
<P>unique_key - (optional) prepended to all JavaScript function/variable/object
162
names to avoid namespace collisions.</P>
163
<P>html_beween - (optional) HTML between the <SELECT> and the layers.</P>
165
<DT><STRONG><A NAME="item_html">html</A></STRONG><BR>
167
Returns HTML for the widget.
171
<H1><A NAME="author">AUTHOR</A></H1>
172
<P>Ivan Kohler <<A HREF="mailto:ivan-selectlayers@420.am">ivan-selectlayers@420.am</A>></P>
175
<H1><A NAME="copyright">COPYRIGHT</A></H1>
176
<P>Copyright (c) 2002 Ivan Kohler
178
This program is free software; you can redistribute it and/or modify it under
179
the same terms as Perl itself.</P>
182
<H1><A NAME="bugs">BUGS</A></H1>
186
<H1><A NAME="see also">SEE ALSO</A></H1>
187
<P><EM>perl</EM>. <A HREF="http://search.cpan.org/doc/GSAR/Tie-IxHash-1.21/lib/Tie/IxHash.pm">the Tie::IxHash manpage</A>, <A HREF="http://www.xs4all.nl/~ppk/js/dom.html">http://www.xs4all.nl/~ppk/js/dom.html</A>,
188
<A HREF="http://javascript.about.com/library/scripts/blsafeonload.htm">http://javascript.about.com/library/scripts/blsafeonload.htm</A></P>