-
Jared Hancock authoredb189b866
open.inc.php 3.52 KiB
<?php
if(!defined('OSTCLIENTINC')) die('Access Denied!');
$info=array();
if($thisclient && $thisclient->isValid()) {
$info=array('name'=>$thisclient->getName(),
'email'=>$thisclient->getEmail(),
'phone'=>$thisclient->getPhoneNumber());
}
$info=($_POST && $errors)?Format::htmlchars($_POST):$info;
$form = null;
if ($info['topicId'] && ($topic=Topic::lookup($info['topicId']))) {
$form = $topic->getForm();
if ($_POST && $form) {
$form = $form->instanciate();
$form->isValidForClient();
}
}
?>
<h1>Open a New Ticket</h1>
<p>Please fill in the form below to open a new ticket.</p>
<form id="ticketForm" method="post" action="open.php" enctype="multipart/form-data">
<?php csrf_token(); ?>
<input type="hidden" name="a" value="open">
<table width="800" cellpadding="1" cellspacing="0" border="0">
<tbody>
<tr>
<td class="required">Help Topic:</td>
<td>
<select id="topicId" name="topicId" onchange="javascript:
$('#dynamic-form').load(
'ajax.php/form/help-topic/' + this.value);
">
<option value="" selected="selected">— Select a Help Topic —</option>
<?php
if($topics=Topic::getPublicHelpTopics()) {
foreach($topics as $id =>$name) {
echo sprintf('<option value="%d" %s>%s</option>',
$id, ($info['topicId']==$id)?'selected="selected"':'', $name);
}
} else { ?>
<option value="0" >General Inquiry</option>
<?php
} ?>
</select>
<font class="error">* <?php echo $errors['topicId']; ?></font>
</td>
</tr>
<?php
if (!$thisclient) {
$uform = UserForm::getUserForm()->getForm($_POST);
if ($_POST) $uform->isValid();
$uform->render(false);
}
else { ?>
<tr><td colspan="2"><hr /></td></tr>
<tr><td>Email:</td><td><?php echo $thisclient->getEmail(); ?></td></tr>
<tr><td>Client:</td><td><?php echo $thisclient->getName(); ?></td></tr>
<?php } ?>
</tbody>
<tbody id="dynamic-form">
<?php if ($form) {
include(CLIENTINC_DIR . 'templates/dynamic-form.tmpl.php');
} ?>
</tbody>
<tbody><?php
$tform = TicketForm::getInstance()->getForm($_POST);
if ($_POST) $tform->isValid();
$tform->render(false); ?>
</tbody>
<tbody>
<?php
if($cfg && $cfg->isCaptchaEnabled() && (!$thisclient || !$thisclient->isValid())) {
if($_POST && $errors && !$errors['captcha'])
$errors['captcha']='Please re-enter the text again';
?>
<tr class="captchaRow">
<td class="required">CAPTCHA Text:</td>
<td>
<span class="captcha"><img src="captcha.php" border="0" align="left"></span>
<input id="captcha" type="text" name="captcha" size="6" autocomplete="off">
<em>Enter the text shown on the image.</em>
<font class="error">* <?php echo $errors['captcha']; ?></font>
</td>
</tr>
<?php
} ?>
<tr><td colspan=2> </td></tr>
</tbody>
</table>
<hr/>
<p style="text-align:center;">
<input type="submit" value="Create Ticket">
<input type="reset" value="Reset">
<input type="button" value="Cancel" onClick='window.location.href="index.php"'>
</p>
</form>