App-Widget
view release on metacpan or search on metacpan
lib/App/Widget/DataTable2.pm view on Meta::CPAN
override => 1,
class => "App::Widget::ImageButton",
image_script => 'App/app-button',
volatile => 1,
height => 17,
width => 50,
bevel => 2,
);
$rowactiondef = $rowactiondefs->{$rowaction};
if ($rowactiondef) {
foreach (keys %$rowactiondef) {
$args{$_} = $rowactiondef->{$_};
}
}
$html .= $context->widget("$name-${rowaction}", %args,
args => "{${name}" . "{row_single_selected}}"
)->html();
$html .= "<br>\n" if ($rowaction ne $single_select_actions[$#select_actions]);
}
$html .= "</td>\n";
}
else {
$html .= " <td bgcolor=\"#ffaaaa\" class=\"App-DataTable-td_single_select\"> </td>\n";
}
}
$html .= " <td bgcolor=\"$heading_bgcolor\"> </td>\n" if ($#row_actions > -1);
for ($col = 0; $col < $numcols; $col++) {
$td_col_attrib = "";
$elem = $headings->[$col];
$elem = " " if (!defined $elem || $elem eq "");
$html .= " <td$td_row_attrib$td_col_attrib>$elem_begin$elem$elem_end</td>\n";
}
$html .= "</tr>\n";
$td_row_attrib = "";
$td_row_attrib .= " bgcolor=\"$bgcolor\"" if ($bgcolor);
$td_row_attrib .= " valign=\"$valign\"" if ($valign);
$td_row_attrib .= " nowrap" if ($nowrap);
# since we are editing, we need to prepare these two arrays...
@edit_style = ();
@column_length = ();
my ($view_widget_args, $view_widget, $view_width);
if ($mode eq "edit") {
# prepare the style attribute arrays
push(@edit_style, "font_family", $font_face) if ($font_face);
push(@edit_style, "color", $font_color) if ($font_color);
# This seems to cause <input> elements to take on the font size
# currently active for text that surrounds them
# i.e. <font size="-2"><input type="text" style="font-size: 100%;"></font>
push(@edit_style, "font_size", "100%") if ($font_size);
# border_style",
# border_width",
# border_color",
# padding",
# background_color",
# any columns we are editing, we need to compute max width (size) for textfield
for ($col = 0; $col < $numcols; $col++) {
$column_length[$col] = 5; # minimum length
$column = "";
if (defined $columns && defined $columns->[$col]) {
$column = $columns->[$col];
}
# Removed because when a row is added without a selected row
# the inputs would be set to the minimum length
#if (($column ne "" && $self->{column_selected}{$column}) ||
# ($self->{row_selected} && %{$self->{row_selected}})) { }
if ($column ne "") {
for ($row = 0; $row <= $#$data; $row++) {
$elem = $data->[$row][$col];
if (defined $elem && length($elem) > $column_length[$col]) {
$column_length[$col] = length($elem);
}
}
}
}
my $add_data = $self->{add_data};
if ($add_data && $#$add_data > -1) {
my ($errmsg, $row);
for (my $i = 0; $i <= $#$add_data; $i++) {
$row = $add_data->[$i];
my ($format, $scale_factor, $edit_widget_args, $edit_widget);
$html .= "<tr class=\"App-DataTable-tr_add\">\n";
$html .= " <td bgcolor=\"$heading_bgcolor\" align=\"right\">Add</td>\n" if ($numbered);
if ($row_selectable) {
$errmsg = "<br />$row->{row_error}" || " ";
$html .= " <td bgcolor=\"#ffaaaa\" class=\"App-DataTable-td_select\">$errmsg</td>\n";
}
if ($row_single_selectable) {
$html .= " <td bgcolor=\"$heading_bgcolor\"> </td>\n";
}
$html .= " <td bgcolor=\"$heading_bgcolor\"> </td>\n" if ($#row_actions > -1);
my $key = $i;
for ($col = 0; $col < $numcols; $col++) {
if (defined $columns && defined $columns->[$col]) {
$column = $columns->[$col];
$format = $view_column_defs->{$column}{format} || $table_column_defs->{$column}{format};
$scale_factor = $view_column_defs->{$column}{scale_factor} || $table_column_defs->{$column}{scale_factor};
$align = $view_column_defs->{$column}{align} ||
$table_column_defs->{$column}{align};
if (!$align && defined $table_column_defs->{$column}{quoted}) {
$align = ($table_column_defs->{$column}{quoted} ? "left" : "right");
}
}
$html .= " <td>";
( run in 1.133 second using v1.01-cache-2.11-cpan-f56aa216473 )