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