Skip to content

Commit

Permalink
break out examples into url fields, add file size limit
Browse files Browse the repository at this point in the history
  • Loading branch information
catsoup11789 committed Jun 5, 2024
1 parent 9778a4b commit 9736274
Show file tree
Hide file tree
Showing 2 changed files with 62 additions and 15 deletions.
29 changes: 17 additions & 12 deletions code/web/interface/themes/responsive/Admin/submitTicket.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -19,45 +19,50 @@
<div class="form-group">
<label class="control-label" for="subject">{translate text="Subject" isAdminFacing=true} <span class="label label-danger" style="margin-right: .5em;">{translate text="Required" isAdminFacing=true}</span></label>
<span class="help-block" style="margin-bottom:.5em; margin-top: 0">{translate text="Please use descriptive keywords, i.e. Creating lists in LiDA" isAdminFacing=true}</span>
<input type="text" class="form-control required" name="subject" id="subject">
<input type="text" class="form-control required" name="subject" id="subject" {if !empty($subject)}value="{$subject}"{/if}>
</div>
<div class="form-group">
<label class="control-label" for="reason">{translate text="Reason" isAdminFacing=true}</label>
<select class="form-control" name="reason" id="reason">
<option value="Something is not appearing or working as expected">{translate text="Something is not appearing or working as expected" isAdminFacing=true inAttribute=true}</option>
<option value="Question about setting or workflow">{translate text="Question about setting or workflow" isAdminFacing=true inAttribute=true}</option>
<option value="Request for a new feature or integration">{translate text="Request for a new feature or integration" isAdminFacing=true inAttribute=true}</option>
<option value="Other">{translate text="Other" isAdminFacing=true inAttribute=true}</option>
<option value="Something is not appearing or working as expected" {if !empty($reason) && $reason == 'Something is not appearing or working as expected'}selected{/if}>{translate text="Something is not appearing or working as expected" isAdminFacing=true inAttribute=true}</option>
<option value="Question about setting or workflow" {if !empty($reason) && $reason == 'Question about setting or workflow'}selected{/if}>{translate text="Question about setting or workflow" isAdminFacing=true inAttribute=true}</option>
<option value="Request for a new feature or integration" {if !empty($reason) && $reason == 'Request for a new feature or integration'}selected{/if}>{translate text="Request for a new feature or integration" isAdminFacing=true inAttribute=true}</option>
<option value="Other" {if !empty($reason) && $reason == 'Other'}selected{/if}>{translate text="Other" isAdminFacing=true inAttribute=true}</option>
</select>
</div>
<div class="form-group">
<label class="control-label" for="product">{translate text="Product" isAdminFacing=true}</label>
<select class="form-control" name="product" id="product">
<option value="Aspen Discovery Only">{translate text="Aspen Discovery Only" isAdminFacing=true inAttribute=true}</option>
<option value="Aspen LiDA Only">{translate text="Aspen LiDA Only" isAdminFacing=true inAttribute=true}</option>
<option value="Both Aspen Discovery and Aspen LiDA">{translate text="Both Aspen Discovery and Aspen LiDA" isAdminFacing=true inAttribute=true}</option>
<option value="Aspen Discovery Only" {if !empty($product) && $product == 'Aspen Discovery Only'}selected{/if}>{translate text="Aspen Discovery Only" isAdminFacing=true inAttribute=true}</option>
<option value="Aspen LiDA Only" {if !empty($product) && $product == 'Aspen LiDA Only'}selected{/if}>{translate text="Aspen LiDA Only" isAdminFacing=true inAttribute=true}</option>
<option value="Both Aspen Discovery and Aspen LiDA" {if !empty($product) && $product == 'Both Aspen Discovery and Aspen LiDA'}selected{/if}>{translate text="Both Aspen Discovery and Aspen LiDA" isAdminFacing=true inAttribute=true}</option>
</select>
</div>
<div class="form-group">
<label class="control-label" for="description">{translate text="Description" isAdminFacing=true} <span class="label label-danger" style="margin-right: .5em;">{translate text="Required" isAdminFacing=true}</span></label>
<span class="help-block" style="margin-bottom:.5em; margin-top: 0">{translate text="Include detailed steps to replicate the problem, account number for impacted user(s), device information, etc. Please do not include sensitive information like login credentials." isAdminFacing=true}</span>
<textarea class="form-control required" name="description" id="description"></textarea>
<textarea class="form-control required" name="description" id="description">{if !empty($description)}{$description}{/if}</textarea>
</div>
{if $supportingCompany == 'ByWater Solutions'}
<div class="form-group">
<label class="control-label" for="sharepass">{translate text="Sharepass Url" isAdminFacing=true}</label>
<span class="help-block" style="margin-bottom:.5em; margin-top: 0">{translate text="Use Sharepass to send sensitive information to us such as login credentials we can use to replicate the behavior reported." isAdminFacing=true} <a href="https://app.tango.us/app/workflow/Share-sensitive-information-with-ByWater-SharePass-ea39fbda64f24949a1a8a80a1be8223b" target="_blank"><u>{translate text="Learn how to use Sharepass." isAdminFacing=true}</u></a></span>
<input type="url" class="form-control" name="sharepass" id="sharepass">
<input type="url" class="form-control" name="sharepass" placeholder="https://" id="sharepass" {if !empty($sharepass)}value="{$sharepass}"{/if}>
</div>
{/if}
<div class="form-group">
<label class="control-label" for="examples">{translate text="Url(s) to Records or Search Results" isAdminFacing=true}</label>
<textarea class="form-control" name="examples" id="examples"></textarea>
<label class="control-label" id="examples">{translate text="Url(s) to example records" isAdminFacing=true}</label>
<fieldset>
<input style="margin-bottom: .5em" aria-labelledby="examples" type="url" class="form-control" placeholder="http://" name="example1" id="example1" {if !empty($example1)}value="{$example1}"{/if}>
<input style="margin-bottom: .5em" aria-labelledby="examples" type="url" class="form-control" placeholder="http://" name="example2" id="example2" {if !empty($example2)}value="{$example2}"{/if}>
<input aria-labelledby="examples" type="url" class="form-control" placeholder="http://" name="example3" id="example3" {if !empty($example3)}value="{$example3}"{/if}>
</fieldset>
</div>
<div class="form-group">
<label class="control-label" for="attachments">{translate text="Attachment(s)" isAdminFacing=true}</label>
<span class="help-block" style="margin-bottom:.5em; margin-top: 0">{translate text="Attach any screenshots or recordings that display the reported behavior or to help us replicate it. To select multiple files, hold down the CTRL or SHIFT key while selecting." isAdminFacing=true}</span>
<input type="file" name="attachments[]" id="attachments" multiple>
<span class="help-block small">{translate text="10MB size limit per attachment." isAdminFacing=true}</span>
</div>
<div class="form-group">
<button type="submit" name="submitTicket" class="btn btn-primary">{translate text="Submit Ticket" isAdminFacing=true}</button>
Expand Down
48 changes: 45 additions & 3 deletions code/web/services/Admin/SubmitTicket.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,9 @@ function launch() {
$reason = $_REQUEST['reason'];
$product = $_REQUEST['product'];
$sharepass = $_REQUEST['sharepass'] ?? null;
$examples = $_REQUEST['examples'];
$example1 = $_REQUEST['example1'];
$example2 = $_REQUEST['example2'];
$example3 = $_REQUEST['example3'];
$attachments = $_FILES['attachments'] ?? [];

global $serverName;
Expand All @@ -28,14 +30,54 @@ function launch() {
$description .= 'Reason: ' . $reason . "\n";
$description .= 'Product: ' . $product . "\n";

if($examples) {
$description .= 'Examples: ' . $examples . "\n";
if($example1) {
$description .= 'Example 1: ' . $example1 . "\n";
}

if($example2) {
$description .= 'Example 2: ' . $example2 . "\n";
}

if($example3) {
$description .= 'Example 3: ' . $example3 . "\n";
}

if($sharepass) {
$description .= 'Sharepass: ' . $sharepass . "\n";
}

$fileTooBig = false;
if($_FILES) {
$i = 0;
foreach ($_FILES as $file) {
$fileSize = $file['size'][$i];
$maxFileSize = 10 * 1048576; // 10MB for RT limitations
if($fileSize > $maxFileSize) {
$fileTooBig = true;
}
$i++;

}
}

// don't lose already entered in data if something goes wrong on the form
$interface->assign('name', $name);
$interface->assign('email', $email);
$interface->assign('subject', $subject);
$interface->assign('description', $_REQUEST['description']);
$interface->assign('reason', $reason);
$interface->assign('product', $product);
$interface->assign('sharepass', $sharepass);
$interface->assign('example1', $example1);
$interface->assign('example2', $example2);
$interface->assign('example3', $example3);

if($fileTooBig) {
$interface->assign('error', 'One or more of your files was larger than the 10MB file size limit.');
$this->display('submitTicket.tpl', 'Submit Ticket');
return;
}


$message = '';
try {
Expand Down

0 comments on commit 9736274

Please sign in to comment.