Skip to content
This repository has been archived by the owner on Nov 29, 2022. It is now read-only.

Commit

Permalink
Fix nesting tables in other modules
Browse files Browse the repository at this point in the history
  • Loading branch information
jcameron committed Dec 8, 2019
1 parent 691c363 commit b777b3d
Showing 1 changed file with 15 additions and 15 deletions.
30 changes: 15 additions & 15 deletions theme.pl
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@
# Global state for wrapper
# if 0, wrapper isn't on, add one and open it, if 1 close it, if 2+, subtract
# but don't close
$WRAPPER_OPEN = 0;
$COLUMNS_WRAPPER_OPEN = 0;
$main::WRAPPER_OPEN = 0;
$main::COLUMNS_WRAPPER_OPEN = 0;

# theme_ui_post_header([subtext])
# Returns HTML to appear directly after a standard header() call
Expand Down Expand Up @@ -301,11 +301,11 @@ sub theme_ui_table_start
my $rv;
my $colspan = 1;

if (!$WRAPPER_OPEN) {
if (!$main::WRAPPER_OPEN) {
$rv .= "<table class='shrinkwrapper' $tabletags>\n";
$rv .= "<tr><td>\n";
}
$WRAPPER_OPEN++;
$main::WRAPPER_OPEN++;
$rv .= "<table class='ui_table' $tabletags>\n";
if (defined($heading) || defined($rightheading)) {
$rv .= "<thead><tr>";
Expand Down Expand Up @@ -395,12 +395,12 @@ sub theme_ui_table_end
$main::ui_table_default_tds = undef;
}
$rv .= "</tbody></table></td></tr></table>\n";
if ($WRAPPER_OPEN==1) {
if ($main::WRAPPER_OPEN==1) {
#$rv .= "</div>\n";
$rv .= "</td></tr>\n";
$rv .= "</table>\n";
}
$WRAPPER_OPEN--;
$main::WRAPPER_OPEN--;
return $rv;
}

Expand Down Expand Up @@ -493,14 +493,14 @@ sub theme_ui_columns_start
my ($href) = grep { $_ =~ /<a\s+href/i } @$heads;
my $rv;
$theme_ui_columns_row_toggle = 0;
if (!$noborder && !$COLUMNS_WRAPPER_OPEN) {
if (!$noborder && !$main::COLUMNS_WRAPPER_OPEN) {
$rv .= "<table class='wrapper' width="
. ($width ? $width : "100")
. "%>\n";
$rv .= "<tr><td>\n";
}
if (!$noborder) {
$COLUMNS_WRAPPER_OPEN++;
$main::COLUMNS_WRAPPER_OPEN++;
}
my @classes;
push(@classes, "ui_table") if (!$noborder);
Expand Down Expand Up @@ -547,10 +547,10 @@ sub theme_ui_columns_end
{
my $rv;
$rv = "</tbody> </table>\n";
if ($COLUMNS_WRAPPER_OPEN == 1) { # Last wrapper
if ($main::COLUMNS_WRAPPER_OPEN == 1) { # Last wrapper
$rv .= "</td> </tr> </table>\n";
}
$COLUMNS_WRAPPER_OPEN--;
$main::COLUMNS_WRAPPER_OPEN--;
return $rv;
}

Expand Down Expand Up @@ -613,11 +613,11 @@ sub theme_ui_hidden_table_start
my $defclass = $status ? 'opener_shown' : 'opener_hidden';
my $text = defined($tconfig{'cs_text'}) ? $tconfig{'cs_text'} :
defined($gconfig{'cs_text'}) ? $gconfig{'cs_text'} : "000000";
if (!$WRAPPER_OPEN) { # If we're not already inside of a wrapper, wrap it
if (!$main::WRAPPER_OPEN) { # If we're not already inside of a wrapper, wrap it
$rv .= "<table class='shrinkwrapper' $tabletags>\n";
$rv .= "<tr><td>\n";
}
$WRAPPER_OPEN++;
$main::WRAPPER_OPEN++;
my $colspan = 1;
$rv .= "<table class='ui_table' $tabletags>\n";
if (defined($heading) || defined($rightheading)) {
Expand Down Expand Up @@ -645,12 +645,12 @@ sub theme_ui_hidden_table_end
{
my ($name) = @_;
local $rv = "</table></div></td></tr></tbody></table>\n";
if ( $WRAPPER_OPEN == 1 ) {
$WRAPPER_OPEN--;
if ( $main::WRAPPER_OPEN == 1 ) {
$main::WRAPPER_OPEN--;
#$rv .= "</div>\n";
$rv .= "</td></tr></table>\n";
}
elsif ($WRAPPER_OPEN) { $WRAPPER_OPEN--; }
elsif ($main::WRAPPER_OPEN) { $main::WRAPPER_OPEN--; }
return $rv;
}

Expand Down

0 comments on commit b777b3d

Please sign in to comment.