web: fix row2_init() formatting.

remove unnecessary 2nd arg of row2_init(); echo it instead
This commit is contained in:
David Anderson 2024-04-09 18:04:30 -07:00
parent 75477880b0
commit 653625ffd4
6 changed files with 22 additions and 16 deletions

View File

@ -83,7 +83,7 @@ function pm_team_form($user, $teamid, $error=null) {
"<input type=\"text\" class=\"form-control\" name=\"subject\" value=\"$subject\">",
null, '20%'
);
row2_init(tra("Message")."<small>".bbcode_info()."</small>", "", '20%');
row2_init(tra("Message")."<small>".bbcode_info()."</small>", '20%');
start_table();
echo $bbcode_html;
echo "<tr><td>\n";
@ -165,7 +165,6 @@ function pm_form($replyto, $userid, $error = null) {
);
row2_init(
tra("Message")."<small>".bbcode_info().pm_rules()."</small>",
"",
'20%'
);
start_table();

View File

@ -41,7 +41,7 @@ function team_search_form($params) {
row2(
tra('Key words').'<br><small>'.tra('Find teams with these words in their names or descriptions').'</small>',
'<input class="form-control" type="text" name="keywords" value="' . htmlspecialchars($params->keywords) . '">');
row2_init(tra('Country'), '');
row2_init(tra('Country'));
echo '<select class="form-control" name="country"><option value="" selected>---</option>';
$country = $params->country;
if (!$country || $country == 'None') $country = "XXX";
@ -499,12 +499,11 @@ function team_edit_form($team, $label, $url) {
row2(tra('Type of team').':', team_type_select($team?$team->type:null));
row2_init(tra('Country'),
'<select class="form-control" name="country">'
);
row2_init(tra('Country'));
echo '<select class="form-control" name="country">';
echo country_select_options($team?$team->country:null);
echo "</select></td></tr>\n";
$x = (!$team || $team->joinable)?"checked":"";
row2(tra("Accept new members?"), "<input type=checkbox name=joinable $x>");
// Check if we're using reCaptcha to prevent spam accounts

View File

@ -518,6 +518,8 @@ define('NAME_ATTRS', 'class="text-right " style="padding-right:12px"');
define('VALUE_ATTRS', 'style="padding-left:12px"');
define('VALUE_ATTRS_ERR', 'class="danger" style="padding-left:12px"');
// a table row with 2 columns, with the left on right-aligned
function row2($x, $y, $show_error=false, $lwidth='40%') {
if ($x==="") $x="<br>";
if ($y==="") $y="<br>";
@ -529,11 +531,15 @@ function row2($x, $y, $show_error=false, $lwidth='40%') {
";
}
function row2_init($x, $y, $lwidth='40%') {
echo '<tr>
<td class="text-right " width="'.$lwidth.'" style="padding-right: 20px;">'.$x.'</td>
<td '.VALUE_ATTRS.'>'.$y.'
';
// output the first part of row2();
// then write the content, followed by </td></tr>
function row2_init($x, $lwidth='40%') {
echo sprintf('<tr>
<td width="%s" %s>%s</td>
<td %s>',
$lwidth, NAME_ATTRS, $x, VALUE_ATTRS
);
}
function row2_plain($x, $y) {

View File

@ -42,11 +42,12 @@ row2(
sprintf('<input name="name" class="form-control" value="%s">', $user->name)
);
row2_init(
tra("Country")."<br><small>".tra("Select the country you want to represent, if any.")."</small>",
'<select name="country" class="form-control">'
tra("Country")."<br><small>".tra("Select the country you want to represent, if any.")."</small>"
);
echo '<select name="country" class="form-control">';
echo country_select_options();
echo "</select></td></tr>\n";
if (POSTAL_CODE) {
row2(
tra("Postal or ZIP Code")."<br><small>".tra("Optional; not shown to others")."</small>",

View File

@ -129,7 +129,7 @@ if ($force_title && $title){
);
}
row2_init(tra("Message").bbcode_info().post_warning($forum).$body_help, "");
row2_init(tra("Message").bbcode_info().post_warning($forum).$body_help);
start_table();
echo $bbcode_html;
end_table();

View File

@ -53,7 +53,8 @@ function user_search_form() {
tra("User name starts with"),
'<input class="form-control" type="text" name="search_string">'
);
row2_init(tra("Country"), "<select class=\"form-control\" name=\"country\"><option value=\"any\" selected>".tra("Any")."</option>");
row2_init(tra("Country"));
echo "<select class=\"form-control\" name=\"country\"><option value=\"any\" selected>".tra("Any")."</option>";
echo country_select_options("asdf");
echo "</select></td></tr>";
row2(tra("With profile?"),