Skip to content
Snippets Groups Projects
Commit b64a1904 authored by Jared Hancock's avatar Jared Hancock
Browse files

forms: Use new file upload field for staff response

parent 232d85eb
No related branches found
No related tags found
No related merge requests found
......@@ -59,6 +59,7 @@ class Form {
function getTitle() { return $this->title; }
function getInstructions() { return $this->instructions; }
function getSource() { return $this->_source; }
function setSource($source) { $this->_source = $source; }
/**
* Validate the form and indicate if there no errors.
......
......@@ -591,7 +591,9 @@ $tcount+= $ticket->getNumNotes();
<div class="uploads">
</div>
<div class="file_input">
<input type="file" class="multifile" name="attachments[]" size="30" value="" />
<?php
print $response_form->getField('attachments')->render();
?>
</div>
</td>
</tr>
......
......@@ -39,6 +39,11 @@ if($_REQUEST['id']) {
if ($_REQUEST['uid'])
$user = User::lookup($_REQUEST['uid']);
// Configure form for file uploads
$response_form = new Form(array(
'attachments' => new FileUploadField(array('id'=>'attach'))
));
//At this stage we know the access status. we can process the post.
if($_POST && !$errors):
......@@ -65,8 +70,10 @@ if($_POST && !$errors):
//If no error...do the do.
$vars = $_POST;
if(!$errors && $_FILES['attachments'])
$vars['files'] = AttachmentFile::format($_FILES['attachments']);
$attachments = $response_form->getField('attachments')->getClean();
if(!$errors && $attachments)
$vars['cannedattachments'] = array_merge(
$vars['cannedattachments'] ?: array(), $attachments);
if(!$errors && ($response=$ticket->postReply($vars, $errors, $_POST['emailreply']))) {
$msg = sprintf(__('%s: Reply posted successfully'),
......@@ -75,6 +82,10 @@ if($_POST && !$errors):
$ticket->getId(), $ticket->getNumber()))
);
// Clear attachment list
$response_form->setSource(array());
$response_form->getField('attachments')->reset();
// Remove staff's locks
TicketLock::removeStaffLocks($thisstaff->getId(),
$ticket->getId());
......@@ -465,4 +476,5 @@ if($ticket) {
require_once(STAFFINC_DIR.'header.inc.php');
require_once(STAFFINC_DIR.$inc);
print $response_form->getMedia();
require_once(STAFFINC_DIR.'footer.inc.php');
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment