diff --git a/include/class.forms.php b/include/class.forms.php index 9c5bafebd3c94aa616ce8c3597d5e60ca6fb9f09..980f67c56ea9b991e67de2cc7c9cfaf5afb3539b 100644 --- a/include/class.forms.php +++ b/include/class.forms.php @@ -4395,7 +4395,6 @@ class FileUploadWidget extends Widget { $config = $this->field->getConfiguration(); $name = $this->field->getFormName(); $id = substr(md5(spl_object_hash($this)), 10); - $attachments = $this->field->getAttachments(); $mimetypes = array_filter($config['__mimetypes'], function($t) { return strpos($t, '/') !== false; } ); @@ -4404,23 +4403,13 @@ class FileUploadWidget extends Widget { $new = array_flip($this->field->getClean()); //get file ids stored in session when creating tickets/tasks from thread + //XXX: This shouldn't be here!! if (!$new && is_array($_SESSION[':form-data']) && array_key_exists($this->field->get('name'), $_SESSION[':form-data'])) $new = $_SESSION[':form-data'][$this->field->get('name')]; - foreach ($attachments as $a) { - unset($new[$a->file_id]); - } - // Add in newly added files not yet saved (if redisplaying after an - // error) - if ($new) { - $attachments = array_merge($attachments, GenericAttachment::objects() - ->filter(array('file_id__in' => array_keys($new))) - ->all() - ); - } - - foreach ($attachments as $att) { + foreach ($this->field->getAttachments() as $att) { + unset($new[$att->file_id]); $files[] = array( 'id' => $att->file->getId(), 'name' => $att->getFilename(), @@ -4429,6 +4418,25 @@ class FileUploadWidget extends Widget { 'download_url' => $att->file->getDownloadUrl(), ); } + + // Add in newly added files not yet saved (if redisplaying after an + // error) + if ($new) { + $F = AttachmentFile::objects() + ->filter(array('id__in' => array_keys($new))) + ->all(); + foreach ($F as $f) { + $f->tmp_name = $new[$f->getId()]; + $files[] = array( + 'id' => $f->getId(), + 'name' => $f->getName(), + 'type' => $f->getType(), + 'size' => $f->getSize(), + 'download_url' => $f->getDownloadUrl(), + ); + } + } + ?><div id="<?php echo $id; ?>" class="filedrop"><div class="files"></div> <div class="dropzone"><i class="icon-upload"></i> diff --git a/include/staff/tasks.inc.php b/include/staff/tasks.inc.php index 8fc2b0534807a8a48386a33cd45f7f4de266dc48..7bdc4a3d9e176cc167c6f78aa64c4a7a18e99ecc 100644 --- a/include/staff/tasks.inc.php +++ b/include/staff/tasks.inc.php @@ -122,6 +122,11 @@ if ($filters) $visibility = Q::any( new Q(array('flags__hasbit' => TaskModel::ISOPEN, 'staff_id' => $thisstaff->getId())) ); +// -- Task for tickets assigned to me +$visibility->add(new Q( array( + 'ticket__staff_id' => $thisstaff->getId(), + 'ticket__status__state' => 'open')) + ); // -- Routed to a department of mine if (!$thisstaff->showAssignedOnly() && ($depts=$thisstaff->getDepts())) $visibility->add(new Q(array('dept_id__in' => $depts))); diff --git a/include/staff/templates/status-options.tmpl.php b/include/staff/templates/status-options.tmpl.php index 16d0f885bf3bb4813865d8ebbdc3171cf5be49b1..1aee4879007fd77f571e5efeeb90b15dd3ff9483 100644 --- a/include/staff/templates/status-options.tmpl.php +++ b/include/staff/templates/status-options.tmpl.php @@ -41,6 +41,7 @@ if (!$nextStatuses) data-dropdown="#action-dropdown-statuses" data-placement="bottom" data-toggle="tooltip" title="<?php echo __('Change Status'); ?>"> <i class="icon-caret-down pull-right"></i> <a class="tickets-action" + aria-label="<?php echo __('Change Status'); ?>" href="#statuses"><i class="icon-flag"></i></a> </span> diff --git a/include/staff/templates/tickets-actions.tmpl.php b/include/staff/templates/tickets-actions.tmpl.php index 2735fc70ea690421fd24aa066e927829cd8792fa..ff186a4be2d858884c6943c0f91ab1d7be957234 100644 --- a/include/staff/templates/tickets-actions.tmpl.php +++ b/include/staff/templates/tickets-actions.tmpl.php @@ -14,6 +14,7 @@ if ($agent->hasPerm(Ticket::PERM_ASSIGN, false)) {?> echo __('Assign'); ?>"> <i class="icon-caret-down pull-right"></i> <a class="tickets-action" id="tickets-assign" + aria-label="<?php echo __('Assign'); ?>" href="#tickets/mass/assign"><i class="icon-user"></i></a> </span> <div id="action-dropdown-assign" class="action-dropdown anchor-right"> diff --git a/include/staff/ticket-view.inc.php b/include/staff/ticket-view.inc.php index a9752bd7492c27ed8a2479556b2f39a6ef0c8324..9fd5835b562c73b6ec5ce5e7e9f8b42b5cfc93f5 100644 --- a/include/staff/ticket-view.inc.php +++ b/include/staff/ticket-view.inc.php @@ -76,7 +76,7 @@ if($ticket->isOverdue()) } ?> <span class="action-button pull-right" data-placement="bottom" data-dropdown="#action-dropdown-print" data-toggle="tooltip" title="<?php echo __('Print'); ?>"> <i class="icon-caret-down pull-right"></i> - <a id="ticket-print" href="tickets.php?id=<?php echo $ticket->getId(); ?>&a=print"><i class="icon-print"></i></a> + <a id="ticket-print" aria-label="<?php echo __('Print'); ?>" href="tickets.php?id=<?php echo $ticket->getId(); ?>&a=print"><i class="icon-print"></i></a> </span> <div id="action-dropdown-print" class="action-dropdown anchor-right"> <ul> diff --git a/js/osticket.js b/js/osticket.js index 3d82e2ba1152960450a75e0f2c3ccdd428af7edb..4e0d512de80aaa87a35deb5a0165b4da86ce3b82 100644 --- a/js/osticket.js +++ b/js/osticket.js @@ -45,6 +45,9 @@ $(document).ready(function(){ $('form').submit(function() { $(window).unbind('beforeunload'); + // Disable client-side Post Reply/Create Ticket buttons to help + // prevent duplicate POST + $(':submit', $(this)).attr('disabled', true); $('#overlay, #loading').show(); return true; }); diff --git a/scp/forms.php b/scp/forms.php index da5663a817df06f5068a69e083ddaca6e172a653..46bd619315ad9e55dfc91b4a39f4bbcb6d8fd826 100644 --- a/scp/forms.php +++ b/scp/forms.php @@ -8,6 +8,7 @@ if($_REQUEST['id'] && !($form=DynamicForm::lookup($_REQUEST['id']))) if($_POST) { $_POST = Format::htmlchars($_POST, true); + $_POST['instructions'] = Format::htmldecode($_POST['instructions']); $fields = array('title', 'notes', 'instructions'); $required = array('title'); $max_sort = 0; diff --git a/scp/js/scp.js b/scp/js/scp.js index 6f30efe1e371ac4f59d66d980c7723b2a1c71fee..c83673cd3ce944df8139dcef8f3561e7f6707b0c 100644 --- a/scp/js/scp.js +++ b/scp/js/scp.js @@ -164,7 +164,11 @@ var scp_prep = function() { $('form.save, form:has(table.list)').submit(function() { $(window).unbind('beforeunload'); $.toggleOverlay(true); - $('#loading').show(); + // Disable staff-side Post Reply/Open buttons to help prevent + // duplicate POST + $(':submit', $(this)).attr('disabled', true); + $('#overlay, #loading').show(); + return true; }); $('select#tpl_options').change(function() {