ui-lib conversion

This commit is contained in:
Jamie Cameron
2019-12-20 20:37:46 -08:00
parent 2d71cdfd34
commit 8eb9b8f0a4

View File

@@ -8,96 +8,56 @@ sub acl_security_form
my ($o) = @_;
# Users whose mail can be read
print "<tr> <td valign=top><b>$text{'acl_read'}</b></td> <td colspan=3>\n";
printf "<input type=radio name=mmode value=0 %s> $text{'acl_none'}\n",
$o->{'mmode'} == 0 ? "checked" : "";
printf "<input type=radio name=mmode value=4 %s> $text{'acl_same'}\n",
$o->{'mmode'} == 4 ? "checked" : "";
printf "<input type=radio name=mmode value=1 %s> $text{'acl_all'}<br>\n",
$o->{'mmode'} == 1 ? "checked" : "";
printf "<input type=radio name=mmode value=2 %s> $text{'acl_users'}\n",
$o->{'mmode'} == 2 ? "checked" : "";
printf "<input name=musers size=40 value='%s'> %s<br>\n",
$o->{'mmode'} == 2 ? $o->{'musers'} : "",
&user_chooser_button("musers", 1);
printf "<input type=radio name=mmode value=3 %s> $text{'acl_userse'}\n",
$o->{'mmode'} == 3 ? "checked" : "";
printf "<input name=muserse size=40 value='%s'> %s<br>\n",
$o->{'mmode'} == 3 ? $o->{'musers'} : "",
&user_chooser_button("muserse", 1);
printf "<input type=radio name=mmode value=5 %s> $text{'acl_usersg'}\n",
$o->{'mmode'} == 5 ? "checked" : "";
printf "<input name=musersg size=30 value='%s'> %s\n",
$o->{'mmode'} == 5 ? join(" ", map { scalar(getgrgid($_)) }
split(/\s+/, $o->{'musers'})) : "",
&group_chooser_button("musersg", 1);
printf "<input type=checkbox name=msec value=1 %s> %s<br>\n",
$o->{'msec'} ? "checked" : "", $text{'acl_sec'};
printf "<input type=radio name=mmode value=7 %s> $text{'acl_usersu'}\n",
$o->{'mmode'} == 7 ? "checked" : "";
printf "<input name=musersu1 size=6 value='%s'> -\n",
$o->{'mmode'} == 7 ? $o->{'musers'} : "";
printf "<input name=musersu2 size=6 value='%s'><br>\n",
$o->{'mmode'} == 7 ? $o->{'musers2'} : "";
printf "<input type=radio name=mmode value=6 %s> $text{'acl_usersm'}\n",
$o->{'mmode'} == 6 ? "checked" : "";
printf "<input name=musersm size=15 value='%s'></td> </tr>\n",
$o->{'mmode'} == 6 ? $o->{'musers'} : "";
print &ui_table_row($text{'acl_read'},
&ui_radio_table("mmode", $o->{'mmode'},
[ [ 0, $text{'acl_none'} ],
[ 4, $text{'acl_same'} ],
[ 1, $text{'acl_all'} ],
[ 2, $text{'acl_users'},
&ui_users_textbox("musers",
$o->{'mmode'} == 2 ? $o->{'musers'} : "") ],
[ 3, $text{'acl_userse'},
&ui_users_textbox("muserse",
$o->{'mmode'} == 3 ? $o->{'musers'} : "") ],
[ 5, $text{'acl_usersg'},
&ui_groups_textbox("musersg",
$o->{'mmode'} == 5 ? join(" ", map { scalar(getgrgid($_)) }
split(/\s+/, $o->{'musers'})) : "").
" ".&ui_checkbox("msec", 1, $text{'acl_sec'}, $o->{'msec'}) ],
[ 7, $text{'acl_usersu'},
&ui_textbox("musersu1", $o->{'mmode'} == 7 ? $o->{'musers'} : "", 6)." - ".&ui_textbox("musersu2", $o->{'mmode'} == 7 ? $o->{'musers2'} : "", 6) ],
[ 6, &ui_textbox("musersm", $o->{'mmode'} == 6 ? $o->{'musers'} : "", 15) ],
]), 3);
# Directory for arbitrary files
print "<tr> <td valign=top><b>$text{'acl_dir'}</b></td> <td colspan=3>\n";
print &ui_opt_textbox("dir", $o->{'dir'}, 40, $text{'acl_dirauto'}."<br>");
print "</td> </tr>\n";
print &ui_table_row($text{'acl_dir'},
&ui_opt_textbox("dir", $o->{'dir'}, 60, $text{'acl_dirauto'}."<br>"),
3);
# Allowed From: addresses
print "<tr> <td valign=top><b>$text{'acl_from'}</b></td> <td colspan=3>\n";
printf "<input type=radio name=fmode value=0 %s> $text{'acl_any'}<br>\n",
$o->{'fmode'} == 0 ? "checked" : "";
printf "<input type=radio name=fmode value=1 %s> $text{'acl_fdoms'}\n",
$o->{'fmode'} == 1 ? "checked" : "";
printf "<input name=fdoms size=40 value='%s'><br>\n",
$o->{'fmode'} == 1 ? $o->{'from'} : '';
printf "<input type=radio name=fmode value=2 %s> $text{'acl_faddrs'}\n",
$o->{'fmode'} == 2 ? "checked" : "";
printf "<input name=faddrs size=40 value='%s'><br>\n",
$o->{'fmode'} == 2 ? $o->{'from'} : '';
printf "<input type=radio name=fmode value=3 %s> $text{'acl_fdom'}\n",
$o->{'fmode'} == 3 ? "checked" : "";
printf "<input name=fdom size=20 value='%s'><br>\n",
$o->{'fmode'} == 3 ? $o->{'from'} : '';
print "</td> </tr>\n";
print &ui_table_row($text{'acl_from'},
&ui_radio_table("fmode", $o->{'fmode'},
[ [ 0, $text{'acl_any'} ],
[ 1, $text{'acl_fdoms'},
&ui_textbox("fdoms", $o->{'fmode'} == 1 ? $o->{'from'} : '', 40) ],
[ 2, $text{'acl_faddrs'},
&ui_textbox("faddrs", $o->{'fmode'} == 2 ? $o->{'from'} : '', 40) ],
[ 3, $text{'acl_fdom'},
&ui_textbox("fdom", $o->{'fmode'} == 3 ? $o->{'from'} : '', 20) ],
]), 3);
print "<tr> <td><b>$text{'acl_fromname'}</b></td>\n";
print "<td colspan=3><input name=fromname size=40 ",
"value='$o->{'fromname'}'></td> </tr>\n";
print &ui_table_row($text{'acl_fromname'},
&ui_textbox("fromname", $o->{'fromname'}, 60), 3);
print "<tr> <td><b>$text{'acl_attach'}</b></td> <td colspan=3>\n";
printf "<input type=radio name=attach_def value=1 %s> %s\n",
$o->{'attach'}<0 ? 'checked' : '', $text{'acl_unlimited'};
printf "<input type=radio name=attach_def value=0 %s>\n",
$o->{'attach'}<0 ? '' : 'checked';
printf "<input name=attach size=5 value='%s'> kB\n",
$o->{'attach'}<0 ? '' : $o->{'attach'};
print "</td> </tr>\n";
print &ui_table_row($text{'acl_attach'},
&ui_opt_textbox("attach", $o->{'attach'}<0 ? "" : $o->{'attach'},
5, "")." kB");
print "<tr> <td><b>$text{'acl_canattach'}</b></td>\n";
printf "<td colspan=3><input type=radio name=canattach value=1 %s> %s\n",
$o->{'canattach'} ? 'checked' : '', $text{'yes'};
printf "<input type=radio name=canattach value=0 %s> %s</td> </tr>\n",
$o->{'canattach'} ? '' : 'checked', $text{'no'};
print &ui_table_row($text{'acl_canattach'},
&ui_yesno_radio("canattach", $o->{'canattach'}));
print "<tr> <td><b>$text{'acl_candetach'}</b></td>\n";
printf "<td colspan=3><input type=radio name=candetach value=1 %s> %s\n",
$o->{'candetach'} ? 'checked' : '', $text{'yes'};
printf "<input type=radio name=candetach value=0 %s> %s</td> </tr>\n",
$o->{'candetach'} ? '' : 'checked', $text{'no'};
print &ui_table_row($text{'acl_candetach'},
&ui_yesno_radio("candetach", $o->{'candetach'}));
}
# acl_security_save(&options)