<?php
// $Id: contactform.php,v 1.1 2004/07/11 10:27:49 Farsus Exp $
// -------------------------------------------------------------------------//
//			                 RUNCMS                                         //
//                                                                          //
//	 reliable - Unique - Nocost &  Simplicity & ease off use                //
//                       < http://www.runcms.org >                          //
// -------------------------------------------------------------------------//
// Original Author: Half-Dead
// Author Website : http://www.e-xoops.com
// License Type   : GPL: See /manual/LICENSES/GPL.txt
// ------------------------------------------------------------------------- //

include_once(XOOPS_ROOT_PATH.'/class/xoopsformloader.php');

$mail_company     = new XoopsFormText(_CT_COMPANY, 'company_name', 30, 60, $company_name);
$mail_location    = new XoopsFormText(_CT_LOCATION, 'company_location', 30, 60, $company_location);
$mail_url         = new XoopsFormText(_CT_URL, 'user_url', 30, 255, $user_url);

$mail_im  = new XoopsFormElementTray(_CT_IM, '&nbsp;');
$mail_im1 = new XoopsFormSelect('', 'user_im', $user_im);
$mail_im1->addOptionArray(array('ICQ'=>'ICQ', 'MSN'=>'MSN', 'AIM'=>'AIM', 'YIM'=>'YIM', 'IRC'=>'IRC', 'Other'=>'Other'));
$mail_im2 = new XoopsFormText('', 'user_im_details', 30, 60, $user_im_details);
$mail_im->addElement($mail_im1);
$mail_im->addElement($mail_im2);

$mail_name        = new XoopsFormText(_CT_NAME.'*', 'user_name', 30, 60, $user_name);
$mail_email       = new XoopsFormText(_CT_EMAIL.'*', 'user_email', 30, 60, $user_email);

$reasonArray = explode('|', $contact_reason);
if (count($reasonArray) > 1) {
	$mail_reason  = new XoopsFormSelect(_CT_REASON.'*', 'contact_reason');
	foreach ($reasonArray as $key) {
		$contact_array[$key] = $key;
	}
	$mail_reason->addOptionArray($contact_array);
	} else {
		$mail_reason = new XoopsFormText(_CT_REASON.'*', 'contact_reason', 50, 60, $contact_reason);
	}

$mail_comments   = new XoopsFormTextArea(_CT_COMMENTS.'*', 'user_comments', $user_comments);

$mail_options  = new XoopsFormElementTray(_CT_OPTIONS, '&nbsp;');
$mail_reciept  = new XoopsFormCheckBox(_CT_RECIEPT, 'mail_reciept', 0);
$mail_reciept->addOption(1, '&nbsp;');
$mail_priority = new XoopsFormSelect(_CT_PRIORITY, 'mail_priority', 3);
$mail_priority->addOptionArray(array(1 => '1 (Highest)', 2 => '2 (High)', 3 => '3 (Normal)', 4 => '4 (Low)', 5 => '5 (Lowest)'));
$mail_options->addElement($mail_reciept);
$mail_options->addElement($mail_priority);

$mail_attachment  = new XoopsFormElementTray(_CT_ATTACH, '&nbsp;');
$mail_file1 = new XoopsFormFile('', 'mail_attachment', intval($contactConfig['max_file_size']));
$mail_file2 = new XoopsFormLabel('<br />'.$contactConfig['max_file_size']." "._BYTES." "._MAX." (".$contactConfig['allowed_extensions'].")", '');
$mail_attachment->addElement($mail_file1);
$mail_attachment->addElement($mail_file2);

$mail_op     = new XoopsFormHidden('op', 'contact');
$mail_submit = new XoopsFormButton('', 'submit', _SUBMIT, 'submit');

// ------------------------------------------------------------------------- //

$contact_form = new XoopsThemeForm(_CT_CONTACT, 'contact', 'index.php');
$contact_form->setExtra("enctype='multipart/form-data'");

$contact_form->addElement($mail_company);
$contact_form->addElement($mail_location);
$contact_form->addElement($mail_url);
$contact_form->addElement($mail_im);

$contact_form->addElement($mail_name);
$contact_form->addElement($mail_email);
$contact_form->addElement($mail_reason);
$contact_form->addElement($mail_comments);


$contact_form->addElement($mail_options);

if ($contactConfig['allow_attachment']) {
	if ($xoopsUser || $contactConfig['annon_attachment']) {
		$contact_form->addElement($mail_attachment);
	}
}

$contact_form->addElement($mail_op);
$contact_form->addElement($mail_submit);

$contact_form->setRequired(array('user_name', 'user_email', 'contact_reason', 'user_comments'));

$contact_form->display();
?>
