1 # Copyright 2002-2007 Interchange Development Group and others
3 # This program is free software; you can redistribute it and/or modify
4 # it under the terms of the GNU General Public License as published by
5 # the Free Software Foundation; either version 2 of the License, or
6 # (at your option) any later version. See the LICENSE file for details.
8 # $Id: tabbed_display.coretag,v 1.6 2007-03-30 23:40:54 pajamian Exp $
10 UserTag tabbed-display PosNumber 0
11 UserTag tabbed-display addAttr
12 UserTag tabbed-display hasEndTag
13 UserTag tabbed-display Interpolate
14 UserTag tabbed-display NoReparse
15 UserTag tabbed-display Version $Revision: 1.6 $
16 UserTag tabbed-display Documentation <<EOD
19 tabbed-display -- DHTML tabbed display
23 [tabbed-display OPTIONS]
24 [tabbed-panel The title of one]
27 [tabbed-panel The contents of two]
34 The [tabbed-display] ITL tag breaks text into a tabbed DHTML display.
35 There are many options which can change the size of the display,
38 NOTE: All sizes are in pixels to allow size calculation.
44 =item tab_bgcolor_template
46 Default #xxxxxx. A template where each "x" will be broken into
47 descending-brightness colors. The default value will cause
48 the selected tab to have a color of #eeeeee, the first unselected
49 tab will have #dddddd, the next #cccccc, etc. To create a yellow
54 Sets the height of the title tab. Default 30.
58 Sets the width of the title tab. Default is 100.
62 Sets the height of the panel display. Default 600.
66 Sets the width of the panel display. Default is 800.
70 To account for multiple tabbed displays in a page, the second
71 one should have a unique ID assigned to it. Default is "mvpan".
73 =item tab_horiz_offset
75 The amount that the tab will be offset from tabs in multi-row
76 displays to allow view of all tabs. Default 10.
80 The amount that the tab will be offset from tabs in multi-row
81 displays to allow view of all tabs. Default 8.
85 The style items which will be set for the title tab portion.
89 font-family: sans-serif;
94 border-bottom-style:none;
99 The style items which will be set for the panel portion. Default:
101 font-family: sans-serif;
104 border-color:#999999;
109 A string which will be prepended to every panel content.
110 A typical value might be "<table>", which allows table rows to
111 be sent as content. This is the value used in Interchange's
117 A string which will be appended to every panel content.
118 A typical value might be "</table>", which allows table rows to
119 be sent as content. This is the value used in Interchange's
124 If you have an array set with the value of each panel's content,
125 you can send it as an array reference in the contents option.
126 This option will also accept a null-separated string as might
127 be found in a form input.
129 If there are contents in an array, the body text of the tag
134 If you have an array set with the value of each tab's title,
135 you can send it as an array reference in the C<titles> option.
136 This option will also accept a null-separated string as might
137 be found in a form input.
139 If the title for a panel is set in the array, the title found in the
140 body text of the tag is ignored.
144 =head2 Use in embedded Perl
146 The tabbed_display tag can be used in embedded Perl as well.
148 my @titles = ( 'Title 1', 'Title 2' );
149 my @contents = ( 'Content of panel 1: foo', 'Content of 2' );
151 return $Tag->tabbed_display({
153 contents => \@contents,
156 tab_bgcolor_template => '#ffffxx',
161 UserTag tabbed-display Routine <<EOR
165 #::logDebug("opt is $opt, body is $body");
169 if(ref($opt->{titles}) eq 'ARRAY') {
170 $tit = delete $opt->{titles};
172 elsif($opt->{titles} =~ /\0/) {
173 $tit = [ split /\0/, delete $opt->{titles} ];
175 elsif($opt->{titles} =~ /\n/) {
176 $tit = [ split /\n/, delete $opt->{titles} ];
179 $tit = [ map { $::Scratch->{$_} } split /[\s,]+/, delete $opt->{titles}];
183 if($opt->{contents}) {
184 if(ref($opt->{contents}) eq 'ARRAY') {
185 $cont = delete $opt->{contents};
187 elsif($opt->{contents} =~ /\0/) {
188 $cont = [ split /\0/, delete $opt->{contents} ];
196 \[tabbed[-_]panel (.*?) \]
198 \[/tabbed[-_]panel\]}
204 if($t and $t =~ /\S/) {
205 $tit->[$#$cont] ||= $t;
209 return Vend::Table::Editor::tabbed_display($tit, $cont, $opt);