More UI library conversions
authorJamie Cameron <jcameron@webmin.com>
Tue, 27 Nov 2007 05:49:41 +0000 (05:49 +0000)
committerJamie Cameron <jcameron@webmin.com>
Tue, 27 Nov 2007 05:49:41 +0000 (05:49 +0000)
pam/lang/en
pam/pam_cracklib.so.pl
pam/pam_env.so.pl
pam/pam_group.so.pl
pam/pam_listfile.so.pl
pam/pam_mail.so.pl
pam/pam_motd.so.pl
pam/pam_pwdb.so.pl
pam/pam_rhosts_auth.so.pl

index ab37535..4e47b0a 100644 (file)
@@ -269,4 +269,4 @@ inc_edit=Edit Included Service
 inc_create=Create Included Service
 inc_header=Included PAM service details
 inc_inc=Included PAM service
-
+inc_err=Failed to save included service
index 9b73285..982b468 100644 (file)
@@ -3,19 +3,11 @@
 # display_args(&service, &module, &args)
 sub display_module_args
 {
-print "<tr> <td><b>$text{'cracklib_retry'}</b></td>\n";
-printf "<td><input type=radio name=retry_def value=1 %s> %s\n",
-       $_[2]->{'retry'} ? '' : 'checked', $text{'default'};
-printf "<input type=radio name=retry_def value=0 %s>\n",
-       $_[2]->{'retry'} ? 'checked' : '';
-print "<input name=retry size=5 value='$_[2]->{'retry'}'></td>\n";
+print &ui_table_row($text{'cracklib_retry'},
+       &ui_opt_textbox("retry", $_[2]->{'retry'}, 5, $text{'default'}));
 
-print "<td><b>$text{'cracklib_type'}</b></td>\n";
-printf "<td><input type=radio name=type_def value=1 %s> %s\n",
-       $_[2]->{'type'} ? '' : 'checked', $text{'default'};
-printf "<input type=radio name=type_def value=0 %s>\n",
-       $_[2]->{'type'} ? 'checked' : '';
-print "<input name=type size=20 value='$_[2]->{'type'}'></td> </tr>\n";
+print &ui_table_row($text{'cracklib_type'},
+       &ui_opt_textbox("type", $_[2]->{'type'}, 20, $text{'default'}));
 }
 
 # parse_module_args(&service, &module, &args)
index ee91275..025bbc6 100644 (file)
@@ -22,18 +22,21 @@ while(<FILE>) {
                }
        }
 close(FILE);
-print "<tr> <td colspan=4><table width=100% border>\n";
-print "<tr $tb> <td><b>$text{'env_var'}</b></td> ",
-      "<td><b>$text{'env_def'}</b></td> ",
-      "<td><b>$text{'env_over'}</b></td> </tr>\n";
+local $et;
+$et .= &ui_columns_start([ $text{'env_var'},
+                         $text{'env_def'},
+                         $text{'env_over'} ]);
 local $i = 0;
 foreach $e (@env, [ ]) {
-       print "<tr> <td><input name=var_$i size=20 value='$e->[0]'></td>\n";
-       print "<td><input name=def_$i size=30 value='$e->[1]'></td>\n";
-       print "<td><input name=over_$i size=30 value='$e->[2]'></td> </tr>\n";
+       $et .= &ui_columns_row([
+               &ui_textbox("var_$i", $e->[0], 20),
+               &ui_textbox("def_$i", $e->[1], 30),
+               &ui_textbox("over_$i", $e->[2], 30),
+               ]);
        $i++;
        }
-print "</table></td> </tr>\n";
+$et .= &ui_columns_end();
+print &ui_table_row(undef, $et, 4);
 }
 
 # parse_module_args(&service, &module, &args)
index d1040b2..75e6cec 100644 (file)
@@ -14,24 +14,26 @@ while(<FILE>) {
                }
        }
 close(FILE);
-print "<tr> <td colspan=4><table border width=100%>\n";
-print "<tr $tb> <td><b>$text{'group_services'}</b></td> ",
-      "<td><b>$text{'group_ttys'}</b></td> ",
-      "<td><b>$text{'group_users'}</b></td> ",
-      "<td><b>$text{'group_times'}</b></td> ",
-      "<td><b>$text{'group_groups'}</b></td> </tr>\n";
+local $gt;
+$gt .= &ui_columns_start([ $text{'group_services'},
+                          $text{'group_ttys'},
+                          $text{'group_users'},
+                          $text{'group_times'},
+                          $text{'group_groups'} ]);
 local $i = 0;
 foreach $g (@group, [ ]) {
-       print "<tr>\n";
-       print "<td><input name=services_$i size=20 value='$g->[0]'></td>\n";
-       print "<td><input name=ttys_$i size=20 value='$g->[1]'></td>\n";
-       print "<td><input name=users_$i size=20 value='$g->[2]'></td>\n";
-       print "<td><input name=times_$i size=20 value='$g->[3]'></td>\n";
-       print "<td><input name=groups_$i size=20 value='$g->[4]'></td>\n";
-       print "</tr>\n";
+       $gt .= &ui_columns_row([
+               &ui_textbox("services_$i", $g->[0], 20),
+               &ui_textbox("ttys_$i", $g->[1], 20),
+               &ui_textbox("users_$i", $g->[2], 20),
+               &ui_textbox("times_$i", $g->[3], 20),
+               &ui_textbox("groups_$i", $g->[4], 20),
+               ]);
        $i++;
        }
-print "</table><br>$text{'group_info'}</td> </tr>\n";
+$gt .= &ui_columns_end();
+$gt .= "<br>".$text{'group_info'};
+print &ui_table_row(undef, $gt, 4);
 }
 
 # parse_module_args(&service, &module, &args)
index cdc73db..d18bcac 100644 (file)
@@ -3,43 +3,35 @@
 # display_args(&service, &module, &args)
 sub display_module_args
 {
-print "<tr> <td><b>$text{'listfile_item'}</b></td>\n";
-print "<td><select name=item>\n";
-foreach $i ('user', 'tty', 'rhost', 'ruser', 'group', 'shell') {
-       printf "<option value='%s' %s>%s\n",
-               $i, $_[2]->{'item'} eq $i ? 'selected' : '',
-               $text{'listfile_item_'.$i};
-       }
-print "</select></td>\n";
+print &ui_table_row($text{'listfile_item'},
+       &ui_select("item", $_[2]->{'item'},
+               [ map { [ $_, $text{'listfile_item_'.$_} ] }
+                     ('user', 'tty', 'rhost', 'ruser', 'group', 'shell') ]));
 
-print "<td><b>$text{'listfile_sense'}</b></td>\n";
-printf "<td><input type=radio name=sense value=allow %s> %s\n",
-       $_[2]->{'sense'} eq 'allow' ? 'checked' : '', $text{'listfile_succeed'};
-printf "<input type=radio name=sense value=deny %s> %s</td> </tr>\n",
-       $_[2]->{'sense'} eq 'allow' ? '' : 'checked', $text{'listfile_fail'};
+print &ui_table_row($text{'listfile_sense'},
+       &ui_radio("sense", $_[2]->{'sense'} || "deny",
+               [ [ "allow", $text{'listfile_succeed'} ],
+                 [ "deny", $text{'listfile_fail'} ] ]));
 
-print "<tr> <td><b>$text{'listfile_file'}</b></td>\n";
-print "<td colspan=3><input name=file size=50 value='$_[2]->{'file'}'> ",
-      &file_chooser_button("file"),"</td> </tr>\n";
+print &ui_table_row($text{'listfile_file'},
+       &ui_textbox("file", $_[2]->{'file'}, 50)." ".
+       &file_chooser_button("file"), 3);
 
-print "<tr> <td><b>$text{'listfile_onerr'}</b></td>\n";
-printf "<td><input type=radio name=onerr value=fail %s> %s\n",
-       $_[2]->{'onerr'} eq 'fail' ? 'checked' : '', $text{'listfile_fail'};
-printf "<input type=radio name=onerr value=succeed %s> %s</td>\n",
-       $_[2]->{'onerr'} eq 'fail' ? '' : 'checked', $text{'listfile_succeed'};
+print &ui_table_row($text{'listfile_onerr'},
+       &ui_radio("onerr", $_[2]->{'onerr'} || "succeed",
+                 [ [ "fail", $text{'listfile_fail'} ],
+                   [ "success", $text{'listfile_succeed'} ] ]));
 
 local $mode = $_[2]->{'apply'} =~ /^\@/ ? 2 :
              $_[2]->{'apply'} ? 1 : 0;
-print "<td><b>$text{'listfile_apply'}</b></td>\n";
-printf "<td><input type=radio name=apply_mode value=0 %s> %s\n",
-       $mode == 0 ? 'checked' : '', $text{'listfile_all'};
-printf "<input type=radio name=apply_mode value=1 %s> %s %s\n",
-       $mode == 1 ? 'checked' : '', $text{'listfile_user'},
-       &unix_user_input("apply_user", $mode == 1 ? $_[2]->{'apply'} : "");
-printf "<input type=radio name=apply_mode value=2 %s> %s %s</td> </tr>\n",
-       $mode == 2 ? 'checked' : '', $text{'listfile_group'},
-       &unix_group_input("apply_group", $mode == 2 ?
-               substr($_[2]->{'apply'}, 1) : "");
+print &ui_table_row($text{'listfile_apply'},
+    &ui_radio("apply_mode", $mode,
+       [ [ 0, $text{'listfile_all'} ],
+         [ 1, $text{'listfile_user'}." ".
+           &unix_user_input("apply_user", $mode == 1 ? $_[2]->{'apply'} : "")],
+         [ 2, $text{'listfile_group'}." ".
+           &unix_group_input("apply_group", $mode == 2 ?
+                       substr($_[2]->{'apply'}, 1) : "") ] ]), 3);
 }
 
 # parse_module_args(&service, &module, &args)
index 39b9fca..5427edd 100644 (file)
@@ -3,37 +3,25 @@
 # display_args(&service, &module, &args)
 sub display_module_args
 {
-print "<tr> <td><b>$text{'mail_nopen'}</b></td>\n";
-printf "<td><input type=radio name=nopen value=0 %s> %s\n",
-       defined($_[2]->{'nopen'}) ? '' : 'checked', $text{'yes'};
-printf "<input type=radio name=nopen value=1 %s> %s</td>\n",
-       defined($_[2]->{'nopen'}) ? 'checked' : '', $text{'no'};
-
-print "<td><b>$text{'mail_close'}</b></td>\n";
-printf "<td><input type=radio name=close value=1 %s> %s\n",
-       defined($_[2]->{'close'}) ? 'checked' : '', $text{'yes'};
-printf "<input type=radio name=close value=0 %s> %s</td> </tr>\n",
-       defined($_[2]->{'close'}) ? '' : 'checked', $text{'no'};
-
-print "<tr> <td><b>$text{'mail_empty'}</b></td>\n";
-printf "<td><input type=radio name=empty value=1 %s> %s\n",
-       defined($_[2]->{'empty'}) ? 'checked' : '', $text{'yes'};
-printf "<input type=radio name=empty value=0 %s> %s</td>\n",
-       defined($_[2]->{'empty'}) ? '' : 'checked', $text{'no'};
-
-print "<td><b>$text{'mail_noenv'}</b></td>\n";
-printf "<td><input type=radio name=noenv value=0 %s> %s\n",
-       defined($_[2]->{'noenv'}) ? '' : 'checked', $text{'yes'};
-printf "<input type=radio name=noenv value=1 %s> %s</td> </tr>\n",
-       defined($_[2]->{'noenv'}) ? 'checked' : '', $text{'no'};
-
-print "<tr> <td><b>$text{'mail_dir'}</b></td>\n";
-printf "<td colspan=3><input type=radio name=dir_def value=1 %s> %s\n",
-       $_[2]->{'dir'} ? '' : 'checked', $text{'default'};
-printf "<input type=radio name=dir_def value=0 %s> %s\n",
-       $_[2]->{'dir'} ? 'checked' : '';
-print "<input name=dir size=30 value='$_[2]->{'dir'}'> ",
-      &file_chooser_button("dir"),"</td> </tr>\n";
+print &ui_table_row($text{'mail_nopen'},
+       &ui_radio("noopen", defined($_[2]->{'nopen'}) ? 1 : 0,
+                 [ [ 0, $text{'yes'} ], [ 1, $text{'no'} ] ]));
+
+print &ui_table_row($text{'mail_close'},
+       &ui_radio("noopen", defined($_[2]->{'close'}) ? 1 : 0,
+                 [ [ 1, $text{'yes'} ], [ 0, $text{'no'} ] ]));
+
+print &ui_table_row($text{'mail_empty'},
+       &ui_radio("noopen", defined($_[2]->{'empty'}) ? 1 : 0,
+                 [ [ 1, $text{'yes'} ], [ 0, $text{'no'} ] ]));
+
+print &ui_table_row($text{'mail_noenv'},
+       &ui_radio("noopen", defined($_[2]->{'noenv'}) ? 1 : 0,
+                 [ [ 0, $text{'yes'} ], [ 1, $text{'no'} ] ]));
+
+print &ui_table_row($text{'mail_dir'},
+       &ui_opt_textbox("dir", $_[2]->{'dir'}, 50, $text{'default'})." ".
+       &file_chooser_button("dir"), 3);
 }
 
 # parse_module_args(&service, &module, &args)
index 707e096..34cdbf0 100644 (file)
@@ -5,13 +5,9 @@ $module_has_no_args = 1;       # file= arg doesn't seem to work!
 # display_args(&service, &module, &args)
 sub display_module_args
 {
-print "<tr> <td><b>$text{'motd_file'}</b></td>\n";
-printf "<td colspan=3><input type=radio name=file_def value=1 %s> %s\n",
-       $_[2]->{'file'} ? '' : 'checked', $text{'motd_file_def'};
-printf "<input type=radio name=file_def value=0 %s>\n",
-       $_[2]->{'file'} ? 'checked' : '';
-print "<input name=file size=30 value='$_[2]->{'file'}'> ",
-      &file_chooser_button("file"),"</td> </tr>\n";
+print &ui_table_row($text{'motd_file'},
+       &ui_opt_textbox("file", $_[2]->{'file'}, 40, $text{'motd_file_def'}).
+       " ".&file_chooser_button("file"), 3);
 }
 
 # parse_module_args(&service, &module, &args)
index c38b7f8..f5d6436 100644 (file)
@@ -3,29 +3,18 @@
 # display_args(&service, &module, &args)
 sub display_module_args
 {
-print "<tr> <td><b>$text{'pwdb_shadow'}</b></td>\n";
-printf "<td><input type=radio name=shadow value=1 %s> %s\n",
-       defined($_[2]->{'shadow'}) ? 'checked' : '', $text{'yes'};
-printf "<input type=radio name=shadow value=0 %s> %s</td>\n",
-       defined($_[2]->{'shadow'}) ? '' : 'checked', $text{'no'};
-
-print "<td><b>$text{'pwdb_nullok'}</b></td>\n";
-printf "<td><input type=radio name=nullok value=1 %s> %s\n",
-       defined($_[2]->{'nullok'}) ? 'checked' : '', $text{'yes'};
-printf "<input type=radio name=nullok value=0 %s> %s</td> </tr>\n",
-       defined($_[2]->{'nullok'}) ? '' : 'checked', $text{'no'};
-
-print "<tr> <td><b>$text{'pwdb_md5'}</b></td>\n";
-printf "<td><input type=radio name=md5 value=1 %s> %s\n",
-       defined($_[2]->{'md5'}) ? 'checked' : '', $text{'yes'};
-printf "<input type=radio name=md5 value=0 %s> %s</td>\n",
-       defined($_[2]->{'md5'}) ? '' : 'checked', $text{'no'};
-
-print "<td><b>$text{'pwdb_nodelay'}</b></td>\n";
-printf "<td><input type=radio name=nodelay value=0 %s> %s\n",
-       defined($_[2]->{'nodelay'}) ? '' : 'checked', $text{'yes'};
-printf "<input type=radio name=nodelay value=1 %s> %s</td> </tr>\n",
-       defined($_[2]->{'nodelay'}) ? 'checked' : '', $text{'no'};
+print &ui_table_row($text{'pwdb_shadow'},
+       &ui_yesno_radio("shadow", defined($_[2]->{'shadow'}) ? 1 : 0));
+
+print &ui_table_row($text{'pwdb_nullok'},
+       &ui_yesno_radio("nullok", defined($_[2]->{'nullok'}) ? 1 : 0));
+
+print &ui_table_row($text{'pwdb_md5'},
+       &ui_yesno_radio("md5", defined($_[2]->{'md5'}) ? 1 : 0));
+
+print &ui_table_row($text{'pwdb_nodelay'},
+       &ui_radio("md5", defined($_[2]->{'nodelay'}) ? 1 : 0,
+                 [ [ 0, $text{'yes'} ], [ 1, $text{'no'} ] ]));
 }
 
 # parse_module_args(&service, &module, &args)
index ac4c844..a0d1fa2 100644 (file)
@@ -3,29 +3,20 @@
 # display_args(&service, &module, &args)
 sub display_module_args
 {
-print "<tr> <td><b>$text{'rhosts_equiv'}</b></td>\n";
-printf "<td><input type=radio name=equiv value=0 %s> $text{'yes'}\n",
-       defined($_[2]->{'no_hosts_equiv'}) ? '' : 'checked';
-printf "<input type=radio name=equiv value=1 %s> $text{'no'}</td>\n",
-       defined($_[2]->{'no_hosts_equiv'}) ? 'checked' : '';
-
-print "<td><b>$text{'rhosts_rhosts'}</b></td>\n";
-printf "<td><input type=radio name=rhosts value=0 %s> $text{'yes'}\n",
-       defined($_[2]->{'no_rhosts'}) ? '' : 'checked';
-printf "<input type=radio name=rhosts value=1 %s> $text{'no'}</td> </tr>\n",
-       defined($_[2]->{'no_rhosts'}) ? 'checked' : '';
-
-print "<tr> <td><b>$text{'rhosts_promiscuous'}</b></td>\n";
-printf "<td><input type=radio name=promiscuous value=1 %s> $text{'yes'}\n",
-       defined($_[2]->{'promiscuous'}) ? 'checked' : '';
-printf "<input type=radio name=promiscuous value=0 %s> $text{'no'}</td>\n",
-       defined($_[2]->{'promiscuous'}) ? '' : 'checked';
-
-print "<td><b>$text{'rhosts_suppress'}</b></td>\n";
-printf "<td><input type=radio name=suppress value=0 %s> $text{'yes'}\n",
-       defined($_[2]->{'suppress'}) ? '' : 'checked';
-printf "<input type=radio name=suppress value=1 %s> $text{'no'}</td> </tr>\n",
-       defined($_[2]->{'suppress'}) ? 'checked' : '';
+print &ui_table_row($text{'rhosts_equiv'},
+       &ui_radio("equiv", defined($_[2]->{'no_hosts_equiv'}) ? 1 : 0,
+                 [ [ 0, $text{'yes'} ], [ 1, $text{'no'} ] ]));
+
+print &ui_table_row($text{'rhosts_rhosts'},
+       &ui_radio("rhosts", defined($_[2]->{'no_hosts'}) ? 1 : 0,
+                 [ [ 0, $text{'yes'} ], [ 1, $text{'no'} ] ]));
+
+print &ui_table_row($text{'rhosts_promiscuous'},
+       &ui_yesno_radio("promiscuous",defined($_[2]->{'promiscuous'}) ? 1 : 0));
+
+print &ui_table_row($text{'rhosts_suppress'},
+       &ui_radio("suppress", defined($_[2]->{'supress'}) ? 1 : 0,
+                 [ [ 0, $text{'yes'} ], [ 1, $text{'no'} ] ]));
 }
 
 # parse_module_args(&service, &module, &args)