{
local $groups = "as_supported() >= 2;
-print "<tr> <td valign=top><b>$text{'acl_fss'}</b></td>\n";
-print "<td colspan=3>\n";
-printf "<input type=radio name=filesys_def value=1 %s> %s\n",
- $_[0]->{'filesys'} eq '*' ? 'checked' : '', $text{'acl_fall'};
-printf "<input type=radio name=filesys_def value=0 %s> %s<br>\n",
- $_[0]->{'filesys'} eq '*' ? '' : 'checked', $text{'acl_fsel'};
-print "<select width=150 name=filesys multiple size=3>\n";
-local ($f, %qcan);
-map { $qcan{$_}++ } split(/\s+/, $_[0]->{'filesys'});
-foreach $f (&list_filesystems()) {
- if ($f->[4]) {
- printf "<option %s>%s\n",
- $qcan{$f->[0]} ? "selected" : "", $f->[0];
- }
- }
-print "</select></td> </tr>\n";
-
-print "<tr> <td><b>$text{'acl_ro'}</b></td> <td>\n";
-printf "<input type=radio name=ro value=1 %s> $text{'yes'}\n",
- $_[0]->{'ro'} ? "checked" : "";
-printf "<input type=radio name=ro value=0 %s> $text{'no'}</td> </tr>\n",
- $_[0]->{'ro'} ? "" : "checked";
-
-print "<tr> <td colspan=4><hr></td> </tr>\n";
-
-print "<tr> <td><b>$text{'acl_quotaon'}</b></td> <td>\n";
-printf "<input type=radio name=enable value=1 %s> $text{'yes'}\n",
- $_[0]->{'enable'} ? "checked" : "";
-printf "<input type=radio name=enable value=0 %s> $text{'no'}</td>\n",
- $_[0]->{'enable'} ? "" : "checked";
-
-print "<td><b>$text{'acl_quotanew'}</b></td> <td>\n";
-printf "<input type=radio name=default value=1 %s> $text{'yes'}\n",
- $_[0]->{'default'} ? "checked" : "";
-printf "<input type=radio name=default value=0 %s> $text{'no'}</td> </tr>\n",
- $_[0]->{'default'} ? "" : "checked";
-
-print "<tr> <td><b>$text{'acl_ugrace'}</b></td> <td>\n";
-printf "<input type=radio name=ugrace value=1 %s> $text{'yes'}\n",
- $_[0]->{'ugrace'} ? "checked" : "";
-printf "<input type=radio name=ugrace value=0 %s> $text{'no'}</td>\n",
- $_[0]->{'ugrace'} ? "" : "checked";
-
-print "<td><b>$text{'acl_vtotal'}</b></td> <td>\n";
-printf "<input type=radio name=diskspace value=1 %s> $text{'yes'}\n",
- $_[0]->{'diskspace'} ? "checked" : "";
-printf "<input type=radio name=diskspace value=0 %s> $text{'no'}</td> </tr>\n",
- $_[0]->{'diskspace'} ? "" : "checked";
-
-print "<tr> <td><b>$text{'acl_maxblocks'}</b></td> <td>\n";
-printf "<input type=radio name=maxblocks_def value=1 %s> %s\n",
- $_[0]->{'maxblocks'} ? '' : 'checked', $text{'acl_unlimited'};
-printf "<input type=radio name=maxblocks_def value=0 %s>\n",
- $_[0]->{'maxblocks'} ? 'checked' : '';
-print "<input name=maxblocks size=8 value='$_[0]->{'maxblocks'}'></td>\n";
-
-print "<td><b>$text{'acl_maxfiles'}</b></td> <td>\n";
-printf "<input type=radio name=maxfiles_def value=1 %s> %s\n",
- $_[0]->{'maxfiles'} ? '' : 'checked', $text{'acl_unlimited'};
-printf "<input type=radio name=maxfiles_def value=0 %s>\n",
- $_[0]->{'maxfiles'} ? 'checked' : '';
-print "<input name=maxfiles size=8 value='$_[0]->{'maxfiles'}'></td> </tr>\n";
-
-print "<tr> <td><b>$text{'acl_email'}</b></td> <td>\n";
-printf "<input type=radio name=email value=1 %s> $text{'yes'}\n",
- $_[0]->{'email'} ? "checked" : "";
-printf "<input type=radio name=email value=0 %s> $text{'no'}</td>\n",
- $_[0]->{'email'} ? "" : "checked";
-
+# Allowed filesystems
+print &ui_table_row($text{'acl_fss'},
+ &ui_radio("filesys_def", $_[0]->{'filesys'} eq '*' ? 1 : 0,
+ [ [ 1, $text{'acl_fall'} ], [ 0, $text{'acl_fsel'} ] ]).
+ "<br>\n".
+ &ui_select("filesys",
+ $_[0]->{'filesys'} eq '*' ? [ ] :
+ [ split(/\s+/, $_[0]->{'filesys'}) ],
+ [ map { $_->[0] } grep { $_->[4] } &list_filesystems() ],
+ 6, 1, 1, 0), 3);
+
+# Readonly mode
+print &ui_table_row($text{'acl_ro'},
+ &ui_yesno_radio("ro", $_[0]->{'ro'}), 3);
+
+print &ui_table_hr();
+
+# Can enable quotas?
+print &ui_table_row($text{'acl_quotaon'},
+ &ui_yesno_radio("enable", $_[0]->{'enable'}));
+
+# Can edit defaults for new users?
+print &ui_table_row($text{'acl_quotanew'},
+ &ui_yesno_radio("default", $_[0]->{'default'}));
+
+# Can edit user grace times
+print &ui_table_row($text{'acl_ugrace'},
+ &ui_yesno_radio("ugrace", $_[0]->{'ugrace'}));
+
+# Can edit group grace times
if ($groups) {
- print "<td><b>$text{'acl_ggrace'}</b></td> <td>\n";
- printf "<input type=radio name=ggrace value=1 %s> $text{'yes'}\n",
- $_[0]->{'ggrace'} ? "checked" : "";
- printf "<input type=radio name=ggrace value=0 %s> $text{'no'}</td>\n",
- $_[0]->{'ggrace'} ? "" : "checked";
+ print &ui_table_row($text{'acl_ggrace'},
+ &ui_yesno_radio("ggrace", $_[0]->{'ggrace'}));
}
-print "</tr>\n";
-
-print "<tr> <td colspan=4><hr></td> </tr>\n";
-
-print "<tr> <td valign=top><b>$text{'acl_uquota'}",
- "</b></td> <td colspan=3>\n";
-printf "<input type=radio name=umode value=0 %s> $text{'acl_uall'}<br>\n",
- $_[0]->{'umode'} == 0 ? "checked" : "";
-printf "<input type=radio name=umode value=1 %s> $text{'acl_uonly'}\n",
- $_[0]->{'umode'} == 1 ? "checked" : "";
-printf "<input name=ucan size=40 value='%s'> %s<br>\n",
- $_[0]->{'umode'} == 1 ? $_[0]->{'users'} : "",
- &user_chooser_button("ucan", 1);
-printf "<input type=radio name=umode value=2 %s> $text{'acl_uexcept'}\n",
- $_[0]->{'umode'} == 2 ? "checked" : "";
-printf "<input name=ucannot size=40 value='%s'> %s<br>\n",
- $_[0]->{'umode'} == 2 ? $_[0]->{'users'} : "",
- &user_chooser_button("ucannot", 1);
-printf "<input type=radio name=umode value=3 %s> $text{'acl_ugroup'}\n",
- $_[0]->{'umode'} == 3 ? "checked" : "";
-printf "<input name=upri size=8 value='%s'> %s<br>\n",
- $_[0]->{'umode'} == 3 ? scalar(getgrgid($_[0]->{'users'})) : "",
- &group_chooser_button("upri", 0);
-printf "<input type=radio name=umode value=4 %s> $text{'acl_uuid'}\n",
- $_[0]->{'umode'} == 4 ? "checked" : "";
-printf "<input name=umin size=6 value='%s'> -\n",
- $_[0]->{'umode'} == 4 ? $_[0]->{'umin'} : "";
-printf "<input name=umax size=6 value='%s'></td> </tr>\n",
- $_[0]->{'umode'} == 4 ? $_[0]->{'umax'} : "";
+# Can see total disk space
+print &ui_table_row($text{'acl_vtotal'},
+ &ui_yesno_radio("diskspace", $_[0]->{'diskspace'}));
+
+# Maximum block quota
+print &ui_table_row($text{'acl_maxblocks'},
+ &ui_opt_textbox("maxblocks", $_[0]->{'maxblocks'}, 8,
+ $text{'acl_unlimited'}));
+
+# Maximum file quota
+print &ui_table_row($text{'acl_maxfiles'},
+ &ui_opt_textbox("maxfiles", $_[0]->{'maxfiles'}, 8,
+ $text{'acl_unlimited'}));
+
+# Can edit email notifications?
+print &ui_table_row($text{'acl_email'},
+ &ui_yesno_radio("email", $_[0]->{'email'}));
+
+print &ui_table_hr();
+
+# Allowed users
+print &ui_table_row($text{'acl_uquota'},
+ &ui_radio_table("umode", int($_[0]->{'umode'}),
+ [ [ 0, $text{'acl_uall'} ],
+ [ 1, $text{'acl_uonly'},
+ &ui_textbox("ucan",
+ $_[0]->{'umode'} == 1 ? $_[0]->{'users'} : "",
+ 40)." ".&user_chooser_button("ucan", 1) ],
+ [ 2, $text{'acl_uexcept'},
+ &ui_textbox("ucannot",
+ $_[0]->{'umode'} == 2 ? $_[0]->{'users'} : "",
+ 40)." ".&user_chooser_button("ucannot", 1) ],
+ [ 3, $text{'acl_ugroup'},
+ &ui_group_textbox("upri", $_[0]->{'umode'} == 3 ?
+ scalar(getgrgid($_[0]->{'users'})) : "") ],
+ [ 4, $text{'acl_uuid'},
+ &ui_textbox("umin",
+ $_[0]->{'umode'} == 4 ? $_[0]->{'umin'} : "", 6)." - ".
+ &ui_textbox("umax",
+ $_[0]->{'umode'} == 4 ? $_[0]->{'umax'} : "", 6) ]
+ ]), 3);
+
+# Allowed groups
if ($groups) {
- print "<tr> <td colspan=4><hr></td> </tr>\n";
+ print &ui_hr();
+ # XXX
print "<tr> <td valign=top><b>$text{'acl_gquota'}",
"</b></td> <td colspan=3>\n";
print "$text{'ggracef_info'}<p>\n";
@gr = &get_group_grace($in{'filesys'});
-print "<form action=group_grace_save.cgi>\n";
-print "<input type=hidden name=filesys value=\"$in{'filesys'}\">\n";
-print "<table border width=100%>\n";
-print "<tr $tb> <td colspan=2><b>",&text('ggracef_graces', $in{'filesys'}),"</b></td></tr>\n";
+print &ui_form_start("group_grace_save.cgi");
+print &ui_hidden("filesys", $in{'filesys'});
+print &ui_table_start(&text('ggracef_graces', $in{'filesys'}), undef, 2);
-print "<tr $cb> <td width=20%><b>$text{'ggracef_block'}</b></td> <td>\n";
+# Block grace time
+$bfield = &ui_textbox("btime", $gr[0], 6)." ".
+ &select_grace_units("bunits", $gr[1]);
if (&default_grace()) {
- printf "<input type=radio name=bdef value=1 %s> $text{'default'}\n",
- $gr[0] ? "" : "checked";
- printf "<input type=radio name=bdef value=0 %s>\n",
- $gr[0] ? "checked" : "";
+ $bfield = &ui_radio("bdef", $gr[0] ? 0 : 1,
+ [ [ 1, $text{'default'} ],
+ [ 0, $bfield ] ]);
}
-print "<input name=btime size=6 value=\"$gr[0]\">";
-&select_units("bunits", $gr[1]);
-print "</td> </tr>\n";
+print &ui_table_row($text{'ugracef_block'}, $bfield);
-print "<tr $cb> <td width=20%><b>$text{'ggracef_file'}</b></td> <td>\n";
+# Files grace time
+$ffield = &ui_textbox("ftime", $gr[2], 6)." ".
+ &select_grace_units("funits", $gr[3]);
if (&default_grace()) {
- printf "<input type=radio name=fdef value=1 %s> $text{'default'}\n",
- $gr[2] ? "" : "checked";
- printf "<input type=radio name=fdef value=0 %s>\n",
- $gr[2] ? "checked" : "";
+ $ffield = &ui_radio("fdef", $gr[2] ? 0 : 1,
+ [ [ 1, $text{'default'} ],
+ [ 0, $ffield ] ]);
}
-print "<input name=ftime size=6 value=\"$gr[2]\">";
-&select_units("funits", $gr[3]);
-print "</td> </tr>\n";
-
-print "</table>\n";
-print "<input type=submit value=$text{'ggracef_update'}></form>\n";
-
-&ui_print_footer("list_groups.cgi?dir=".&urlize($in{'filesys'}),$text{'ggracef_return'});
-
-sub select_units
-{
-@uarr = &grace_units();
-print "<select name=$_[0]>\n";
-for($i=0; $i<@uarr; $i++) {
- printf "<option value=$i %s>$uarr[$i]\n",
- $i == $_[1] ? "selected" : "";
- }
-print "</select>\n";
-}
+print &ui_table_row($text{'ugracef_file'}, $ffield);
+
+print &ui_table_end();
+print &ui_form_end([ [ undef, $text{'ugracef_update'} ] ]);
+
+&ui_print_footer("list_groups.cgi?dir=".&urlize($in{'filesys'}),
+ $text{'ggracef_return'});
+