Use new module in top-level CGIs
[webmin.git] / feedback_form.cgi
1 #!/usr/local/bin/perl
2 # feedback_form.cgi
3 # Display a form so that the user can send in a webmin bug report
4
5 BEGIN { push(@INC, ".."); };
6 use WebminCore;
7
8 &init_config();
9 &ReadParse();
10 &error_setup($text{'feedback_err'});
11 %access = &get_module_acl();
12 $access{'feedback'} || &error($text{'feedback_ecannot'});
13 &ui_print_header(undef, $text{'feedback_title'}, "", undef, 0, 1);
14
15 %minfo = &get_module_info($in{'module'}) if ($in{'module'});
16 $fb = $gconfig{'feedback_to'} ||
17       $minfo{'feedback'} ||
18       $webmin_feedback_address;
19 print &text('feedback_desc', "<tt>$fb</tt>"),"<p>\n";
20 print "<b>$text{'feedback_desc2'}</b><p>\n" if (!$gconfig{'feedback_to'});
21
22 print "<form action=feedback.cgi method=post enctype=multipart/form-data>\n";
23 print "<table border width=100%>\n";
24 print "<tr $tb> <td><b>$text{'feedback_header'}</b></td> </tr>\n";
25 print "<tr $cb> <td><table width=100%>\n";
26
27 print "<tr> <td><b>$text{'feedback_name'}</b></td>\n";
28 print "<td><input name=name size=25 value='$gconfig{'feedback_name'}'></td>\n";
29
30 print "<td><b>$text{'feedback_email'}</b></td>\n";
31 print "<td><input name=email size=25 value='$gconfig{'feedback_email'}'></td> </tr>\n";
32
33 print "<tr> <td><b>$text{'feedback_module'}</b></td>\n";
34 print "<td><select name=module>\n";
35 printf "<option value='' %s>%s\n",
36         $in{'module'} ? "" : "selected", $text{'feedback_all'};
37 @modules = ( );
38 foreach $minfo (&get_all_module_infos()) {
39         if (&check_os_support($minfo) &&
40             ($minfo->{'longdesc'} || $minfo->{'feedback'})) {
41                 push(@modules, $minfo);
42                 }
43         }
44 foreach $m (sort { $a->{'desc'} cmp $b->{'desc'} } @modules) {
45         printf "<option %s value=%s>%s\n",
46                 $in{'module'} eq $m->{'dir'} ? "selected" : "",
47                 $m->{'dir'}, $m->{'desc'};
48         }
49 print "</select></td>\n";
50
51 print "<td><b>$text{'feedback_mailserver'}</b></td>\n";
52 printf "<td><input type=radio name=mailserver_def value=1 %s> %s\n",
53         $gconfig{'feedback_mailserver'} ? "" : "checked",
54         $text{'feedback_mailserver_def'};
55 printf "<input type=radio name=mailserver_def value=0 %s>\n",
56         $gconfig{'feedback_mailserver'} ? "checked" : "";
57 printf "<input name=mailserver size=15 value='%s'></td> </tr>\n",
58         $gconfig{'feedback_mailserver'};
59
60 if (!$gconfig{'nofeedbackcc'}) {
61         print "<tr> <td valign=top><b>$text{'feedback_to'}</b></td>\n";
62         print "<td colspan=3><textarea name=to rows=4 cols=50>",
63                 $fb,"</textarea></td> </tr>\n";
64         }
65
66 print "<tr> <td valign=top><b>$text{'feedback_text'}</b></td>\n";
67 print "<td colspan=3><textarea name=text rows=6 cols=70 wrap=on>",
68       "</textarea></td> </tr>\n";
69
70 print "<tr> <td colspan=2 nowrap><b>$text{'feedback_os'}</b>&nbsp;&nbsp;\n";
71 printf "<input type=radio name=os value=1> $text{'yes'}\n";
72 printf "<input type=radio name=os value=0 checked> $text{'no'}</td>\n";
73 print "<td colspan=2>($text{'feedback_osdesc'})</td> </tr>\n";
74
75 if (!$gconfig{'nofeedbackconfig'}) {
76         print "<tr> <td colspan=2 nowrap><b>$text{'feedback_config'}</b>&nbsp;&nbsp;\n";
77         printf "<input type=radio name=config value=1> $text{'yes'}\n";
78         printf "<input type=radio name=config value=0 checked> $text{'no'}</td>\n";
79         print "<td colspan=2>($text{'feedback_configdesc'})</td> </tr>\n";
80         }
81
82 print "<tr> <td><b>$text{'feedback_attach'}</b></td>\n";
83 print "<td><input type=file name=attach0></td>",
84       "<td colspan=2><input type=file name=attach1></td> </tr>\n";
85
86 print "</table></td></tr></table>\n";
87 print "<input type=submit value='$text{'feedback_send'}'></form>\n";
88
89 &ui_print_footer("/?cat=$minfo{'category'}", $text{'index'});
90