Fix buttons row support single cell

This commit is contained in:
Ilia Ross
2026-07-31 03:18:05 +02:00
parent 562126206b
commit 1bb558f18a

View File

@@ -1835,7 +1835,7 @@ return &theme_ui_buttons_end(@_) if (defined(&theme_ui_buttons_end));
return "</table>\n";
}
=head2 ui_buttons_row(script, button-label, description, [hiddens], [after-submit], [before-submit], [postmethod])
=head2 ui_buttons_row(script, button-label, description, [hiddens], [after-submit], [before-submit], [postmethod], [single-cell])
Returns HTML for a button with a description next to it, and perhaps other
inputs. The parameters are :
@@ -1854,11 +1854,14 @@ inputs. The parameters are :
=item postmethod - Defines the method used to submit the form. Defaults to 'post'.
=item single-cell - If set to 1, omits the description cell and spans the button cell across both columns.
=cut
sub ui_buttons_row
{
return &theme_ui_buttons_row(@_) if (defined(&theme_ui_buttons_row));
my ($script, $label, $desc, $hiddens, $after, $before, $postmethod) = @_;
my ($script, $label, $desc, $hiddens, $after, $before, $postmethod,
$singlecell) = @_;
$postmethod ||= 'post';
if (ref($hiddens)) {
$hiddens = join("\n", map { &ui_hidden(@$_) } @$hiddens);
@@ -1866,11 +1869,14 @@ if (ref($hiddens)) {
return "<form action='$script' class='ui_buttons_form' method='$postmethod'>\n".
$hiddens.
"<tr class='ui_buttons_row'> ".
"<td nowrap width='20%' valign='top' class='ui_buttons_label'>".
"<td nowrap".($singlecell ? " colspan='2'" : " width='20%'").
" valign='top' class='ui_buttons_label'>".
($before ? $before." " : "").
&ui_submit($label).($after ? " ".$after : "")."</td>\n".
"<td width='80%' valign='top' class='ui_buttons_value'>".
$desc."</td></tr>\n".
($singlecell ? "" :
"<td width='80%' valign='top' class='ui_buttons_value'>".
$desc."</td>\n").
"</tr>\n".
"</form>\n";
}