#!/usr/bin/perl

print "Content-Type: Text/HTML\n\n";

use CGI ':standard';
use Vpanel 1.00;
require $header;
require $accountinfo;

$domainname = find_domain ($mainuser);
@validusers = find_valid_users($domainname);

# Catch variables passwd by theconfirm script when an item has been left out
$emailbody = param ('emailbody');
$fromaddress = param ('fromaddress');
$vacationuser = param ('vacationuser');
$subject = param ('subject');

# Define the tab which appears to the front
$tab_section = $tabnum_email;

# Output the content associated with this tab
print "<body class=section-$tab_section>";

# display tabs
require $tabdisplay;

print_header ("Creation of an 'Out of Office' reply for $domainname");

print "Please select the user you wish to set up an 'Out of Office' reply for:<BR>";

print "<form method=post action=/$script_bin/$confirm_create_out_of_office class=text>";
print "<B>User:</B><BR><select name=vacationuser class=text> ";
for $validuser ( @validusers )
{
        $ftpstring = "^ftp";
	$spamstring = "^spam";
        if ( ( ! ( $validuser =~ /$ftpstring/ ) ) && ( ! ($validuser =~ /$spamstring/ ) ) )
        {
		print "<option value=$validuser>$validuser";
        }
}
print qq!

	</select>
	<BR><br><br>Please enter the email address from which the automatic response will come from:<br>
	<br><b>Address:</b><BR><input type=text name=fromaddress value=$fromaddress></input> \@$domainname

	<BR><br><br>Please enter the subject of the email:<br>
	<br><b>Subject:</b><BR><input type=text size=45 name=subject value=$subject></input>

	<BR><br><br>Please enter the reply you wish to be sent to those who email you:<br><br>
	<b>Reply:</b><BR> <textarea rows="6" cols="49" class=text name=emailbody>$emailbody</textarea>

!;

print_end_of_form();

require $footer;
