# Copyright 2002-2007 Interchange Development Group and others # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. See the LICENSE file for details. UserTag tabbed-display PosNumber 0 UserTag tabbed-display addAttr UserTag tabbed-display hasEndTag UserTag tabbed-display Interpolate UserTag tabbed-display NoReparse UserTag tabbed-display Version 1.6 UserTag tabbed-display Documentation <", which allows table rows to be sent as content. This is the value used in Interchange's table editor. =item panel_append A string which will be appended to every panel content. A typical value might be "", which allows table rows to be sent as content. This is the value used in Interchange's table editor. =item contents If you have an array set with the value of each panel's content, you can send it as an array reference in the contents option. This option will also accept a null-separated string as might be found in a form input. If there are contents in an array, the body text of the tag is ignored. =item titles If you have an array set with the value of each tab's title, you can send it as an array reference in the C option. This option will also accept a null-separated string as might be found in a form input. If the title for a panel is set in the array, the title found in the body text of the tag is ignored. =back =head2 Use in embedded Perl The tabbed_display tag can be used in embedded Perl as well. my @titles = ( 'Title 1', 'Title 2' ); my @contents = ( 'Content of panel 1: foo', 'Content of 2' ); return $Tag->tabbed_display({ titles => \@titles, contents => \@contents, panel_width => 600, panel_height => 400, tab_bgcolor_template => '#ffffxx', }); =cut EOD UserTag tabbed-display Routine <{titles}) { if(ref($opt->{titles}) eq 'ARRAY') { $tit = delete $opt->{titles}; } elsif($opt->{titles} =~ /\0/) { $tit = [ split /\0/, delete $opt->{titles} ]; } elsif($opt->{titles} =~ /\n/) { $tit = [ split /\n/, delete $opt->{titles} ]; } else { $tit = [ map { $::Scratch->{$_} } split /[\s,]+/, delete $opt->{titles}]; } } if($opt->{contents}) { if(ref($opt->{contents}) eq 'ARRAY') { $cont = delete $opt->{contents}; } elsif($opt->{contents} =~ /\0/) { $cont = [ split /\0/, delete $opt->{contents} ]; } } $tit ||= []; if(! $cont) { $cont = []; while($body =~ s{ \[tabbed[-_]panel (.*?) \] (.*?) \[/tabbed[-_]panel\]} {}xis ) { push @$cont, $2; my $t = $1; if($t and $t =~ /\S/) { $tit->[$#$cont] ||= $t; } } } return Vend::Table::Editor::tabbed_display($tit, $cont, $opt); } EOR