Add new API: ui_space, ui_newline, ui_text

Nothing can be thrown to the browser without being used with UI lib!
This commit is contained in:
iliajie
2023-07-09 23:07:59 +03:00
parent 097e24a7b1
commit 643ace4777
4 changed files with 48 additions and 3 deletions

File diff suppressed because one or more lines are too long

View File

@ -1041,7 +1041,7 @@ sub edit_LimitRequestBody
{
return (1, $text{'core_maxbody'},
&opt_input($_[0]->{'value'}, "LimitRequestBody", $text{'core_default'}, 8)
.$text{'bytes'});
.&ui_space(2).$text{'bytes'});
}
sub save_LimitRequestBody
{
@ -1052,7 +1052,7 @@ sub edit_LimitXMLRequestBody
{
return (1, $text{'core_maxxml'},
&opt_input($_[0]->{'value'}, "LimitXMLRequestBody",
$text{'core_default'}, 8).$text{'bytes'});
$text{'core_default'}, 8).&ui_space(2).$text{'bytes'});
}
sub save_LimitXMLRequestBody
{

View File

@ -13,6 +13,7 @@ sub edit_SuexecUserGroup
local $rv;
$rv .= sprintf "<input type=radio name=SuexecUserGroup_def value=1 %s> %s\n",
$_[0] ? "" : "checked", $text{'suexec_none'};
$rv .= &ui_newline();
$rv .= sprintf "<input type=radio name=SuexecUserGroup_def value=0 %s>\n",
$_[0] ? "checked" : "";
$rv .= sprintf "%s <input name=SuexecUserGroup_u size=8 value='%s'> %s\n",

View File

@ -2807,6 +2807,50 @@ my ($label, $content) = @_;
return "<div class='ui_div_row'><span>$label</span><span>$content</span></div>";
}
=head2 ui_space(number)
Prints no breakable space number of given times
=cut
sub ui_space
{
if (defined(&theme_ui_space)) {
return &theme_ui_space(@_);
}
my ($number) = @_;
$number ||= 1;
return "<span class='ui_space'>".("&nbsp;" x $number)."</span>";
}
=head2 ui_newline(number)
Prints new lines given number of times
=cut
sub ui_newline
{
if (defined(&theme_ui_newline)) {
return &theme_ui_newline(@_);
}
my ($number) = @_;
$number ||= 1;
return "<span class='ui_newline'>".("<br>" x $number)."</span>";
}
=head2 ui_text(text)
Wraps any text into span tags
=cut
sub ui_text
{
if (defined(&theme_ui_text)) {
return &theme_ui_text(@_);
}
my ($text) = @_;
return "<span>$text</span>";
}
=head2 ui_paginations(&array, &opts)
Given an array reference, slice it and return hash