diff --git a/include/class.thread.php b/include/class.thread.php index 0636df348a0d3a990a5778f1793ef80f165e762b..7e94e08d794274e2d49bbeb63f3213626743c44b 100644 --- a/include/class.thread.php +++ b/include/class.thread.php @@ -1818,7 +1818,10 @@ class CloseEvent extends ThreadEvent { static $state = 'closed'; function getDescription($mode=self::MODE_STAFF) { - return $this->template(__('Closed by <b>{somebody}</b> with status of {<TicketStatus>data.status} {timestamp}')); + if ($this->getData('status')) + return $this->template(__('Closed by <b>{somebody}</b> with status of {<TicketStatus>data.status} {timestamp}')); + else + return $this->template(__('Closed by <b>{somebody}</b> {timestamp}')); } } diff --git a/include/staff/tasks.inc.php b/include/staff/tasks.inc.php index 49cdd5e22ac9ece74a17b58a9c7f6d3a8c1ecaa9..f5406c5c5c1c8f8ebe3361a0a7a6bba7e3e627d5 100644 --- a/include/staff/tasks.inc.php +++ b/include/staff/tasks.inc.php @@ -24,11 +24,14 @@ $sort_options = array( 'relevance' => __('Relevance'), ); -$queue_name = strtolower($_GET['status'] ?: $_GET['a']); //Status is overloaded +// Queue we're viewing +$queue_key = sprintf('::Q:%s', ObjectModel::OBJECT_TYPE_TASK); +$queue_name = $_SESSION[$queue_key] ?: ''; + switch ($queue_name) { case 'closed': $status='closed'; - $results_type=__('Closed Tasks'); + $results_type=__('Completed Tasks'); $showassigned=true; //closed by. $queue_sort_options = array('closed', 'updated', 'created', 'number', 'hot'); @@ -56,6 +59,7 @@ case 'search': 'number__startswith' => $_REQUEST['query'], 'cdata__title__contains' => $_REQUEST['query'], ))); + unset($_SESSION[$queue_key]); break; } elseif (isset($_SESSION['advsearch:tasks'])) { // XXX: De-duplicate and simplify this code @@ -430,8 +434,12 @@ $(function() { +$(this).attr('href').substr(1) +'?count='+count +'&_uid='+new Date().getTime(); + var $redirect = $(this).data('redirect'); $.dialog(url, [201], function (xhr) { - $.pjax.reload('#pjax-container'); + if (!!$redirect) + $.pjax({url: $redirect, container:'#pjax-container'}); + else + $.pjax.reload('#pjax-container'); }); } return false; @@ -445,7 +453,7 @@ $(function() { var $options = $(this).data('dialogConfig'); var $redirect = $(this).data('redirect'); $.dialog(url, [201], function (xhr) { - if ($redirect) + if (!!$redirect) window.location.href = $redirect; else $.pjax.reload('#pjax-container'); diff --git a/include/staff/templates/status-options.tmpl.php b/include/staff/templates/status-options.tmpl.php index 71e05981f349a83830ab8c980f5f5daaa7e8beab..1f9918f26ca44c70df7cd72e2af925d598cc84fe 100644 --- a/include/staff/templates/status-options.tmpl.php +++ b/include/staff/templates/status-options.tmpl.php @@ -55,7 +55,7 @@ if (!$nextStatuses) $status->getId()); ?>" <?php if (isset($actions[$status->getState()]['href'])) - echo sprintf('data-href="%s"', + echo sprintf('data-redirect="%s"', $actions[$status->getState()]['href']); ?> diff --git a/include/staff/templates/task-view.tmpl.php b/include/staff/templates/task-view.tmpl.php index 326576acf91db6f991bcb776c44ec69563e3c271..7130c655dff4ba6fb4c04b94ec12090112452041 100644 --- a/include/staff/templates/task-view.tmpl.php +++ b/include/staff/templates/task-view.tmpl.php @@ -32,7 +32,8 @@ if ($role->hasPerm(Task::PERM_ASSIGN)) { 'assign' => array( 'href' => sprintf('#tasks/%d/assign', $task->getId()), 'icon' => 'icon-user', - 'label' => $task->isAssigned() ? __('Reassign') : __('Assign') + 'label' => $task->isAssigned() ? __('Reassign') : __('Assign'), + 'redirect' => 'tasks.php' )); } @@ -41,7 +42,8 @@ if ($role->hasPerm(Task::PERM_TRANSFER)) { 'transfer' => array( 'href' => sprintf('#tasks/%d/transfer', $task->getId()), 'icon' => 'icon-share', - 'label' => __('Transfer') + 'label' => __('Transfer'), + 'redirect' => 'tasks.php' )); } @@ -52,7 +54,8 @@ if ($role->hasPerm(Task::PERM_DELETE)) { 'href' => sprintf('#tasks/%d/delete', $task->getId()), 'icon' => 'icon-trash', 'class' => 'red button task-action', - 'label' => __('Delete') + 'label' => __('Delete'), + 'redirect' => 'tasks.php' )); } @@ -152,6 +155,8 @@ if ($task->isOverdue()) <?php if ($action['dialog']) echo sprintf("data-dialog-config='%s'", $action['dialog']); + if ($action['redirect']) + echo sprintf("data-redirect='%s'", $action['redirect']); ?> href="<?php echo $action['href']; ?>"><i class="<?php @@ -504,7 +509,7 @@ $(function() { var $options = $(this).data('dialogConfig'); var $redirect = $(this).data('redirect'); $.dialog(url, [201], function (xhr) { - if ($redirect) + if (!!$redirect) window.location.href = $redirect; else $.pjax.reload('#pjax-container'); diff --git a/include/staff/templates/tasks-actions.tmpl.php b/include/staff/templates/tasks-actions.tmpl.php index fcf6192a42b6289ca7b45ff529292f93ff14a694..04696a7714499e87b20aa35f0e3140d79921d17e 100644 --- a/include/staff/templates/tasks-actions.tmpl.php +++ b/include/staff/templates/tasks-actions.tmpl.php @@ -71,6 +71,7 @@ if ($agent->hasPerm(Task::PERM_TRANSFER, false)) { $actions += array( 'transfer' => array( 'icon' => 'icon-share', + 'redirect' => 'tickets.php', 'action' => __('Transfer') )); } diff --git a/include/staff/ticket-view.inc.php b/include/staff/ticket-view.inc.php index ea79bc6c1ecfa7dbda2356ee5d4c6a7d70843282..5bf1a6e5c988d9b94a3549eeb474508cab34669c 100644 --- a/include/staff/ticket-view.inc.php +++ b/include/staff/ticket-view.inc.php @@ -76,6 +76,7 @@ if($ticket->isOverdue()) // Transfer if ($role->hasPerm(TicketModel::PERM_TRANSFER)) {?> <a class="ticket-action action-button pull-right" id="ticket-transfer" + data-redirect="tickets.php" href="#tickets/<?php echo $ticket->getId(); ?>/transfer"><i class="icon-share"></i> <?php echo __('Transfer'); ?></a> <?php @@ -86,16 +87,24 @@ if($ticket->isOverdue()) if ($role->hasPerm(TicketModel::PERM_ASSIGN)) {?> <span class="action-button pull-right" data-dropdown="#action-dropdown-assign"> <i class="icon-caret-down pull-right"></i> - <a class="ticket-action" id="ticket-assign" href="#tickets/<?php echo $ticket->getId(); ?>/assign"><i class="icon-user"></i> <?php + <a class="ticket-action" id="ticket-assign" + data-redirect="tickets.php" + href="#tickets/<?php echo $ticket->getId(); ?>/assign"><i class="icon-user"></i> <?php echo $ticket->isAssigned() ? __('Assign') : __('Reassign'); ?></a> </span> <div id="action-dropdown-assign" class="action-dropdown anchor-right"> <ul> - <li><a class="no-pjax ticket-action" href="#tickets/<?php echo $ticket->getId(); ?>/assign/<?php echo $thisstaff->getId(); ?>"><i + <li><a class="no-pjax ticket-action" + data-redirect="tickets.php" + href="#tickets/<?php echo $ticket->getId(); ?>/assign/<?php echo $thisstaff->getId(); ?>"><i class="icon-chevron-sign-down"></i> <?php echo __('Claim'); ?></a> - <li><a class="no-pjax ticket-action" href="#tickets/<?php echo $ticket->getId(); ?>/assign/agents"><i + <li><a class="no-pjax ticket-action" + data-redirect="tickets.php" + href="#tickets/<?php echo $ticket->getId(); ?>/assign/agents"><i class="icon-user"></i> <?php echo __('Agent'); ?></a> - <li><a class="no-pjax ticket-action" href="#tickets/<?php echo $ticket->getId(); ?>/assign/teams"><i + <li><a class="no-pjax ticket-action" + data-redirect="tickets.php" + href="#tickets/<?php echo $ticket->getId(); ?>/assign/teams"><i class="icon-group"></i> <?php echo __('Team'); ?></a> </ul> </div> @@ -173,7 +182,7 @@ if($ticket->isOverdue()) ?> <li class="danger"><a class="ticket-action" href="#tickets/<?php echo $ticket->getId(); ?>/status/delete" - data-href="tickets.php"><i class="icon-trash"></i> <?php + data-redirect="tickets.php"><i class="icon-trash"></i> <?php echo __('Delete Ticket'); ?></a></li> <?php } diff --git a/include/staff/tickets.inc.php b/include/staff/tickets.inc.php index db70a46699ad191833dd3b2d83c1993080a6ab5d..27378bacf1abe9d63f037fafb4e86f32afd6e745 100644 --- a/include/staff/tickets.inc.php +++ b/include/staff/tickets.inc.php @@ -33,10 +33,9 @@ $sort_options = array( ); $use_subquery = true; -$queue_name = strtolower($_GET['a'] ?: $_GET['status']); //Status is overloaded - -// Stash current queue view -$_SESSION['::Q'] = $queue_name; +// Figure out the queue we're viewing +$queue_key = sprintf('::Q:%s', ObjectModel::OBJECT_TYPE_TICKET); +$queue_name = $_SESSION[$queue_key] ?: ''; switch ($queue_name) { case 'closed': @@ -106,6 +105,8 @@ case 'search': } $tickets->filter($basic_search); } + // Clear sticky search queue + unset($_SESSION[$queue_key]); break; } elseif (isset($_SESSION['advsearch'])) { $form = $search->getFormFromSession('advsearch'); diff --git a/scp/js/ticket.js b/scp/js/ticket.js index 21ed2f415ba93a720603cab01cb17b2f1f222211..61ba8c7b84f9364b1863042dd32a4986dacbf598 100644 --- a/scp/js/ticket.js +++ b/scp/js/ticket.js @@ -328,10 +328,13 @@ var ticket_onload = function($) { var url = 'ajax.php/' +$(this).attr('href').substr(1) +'?_uid='+new Date().getTime(); - var $redirect = $(this).data('href'); + var $redirect = $(this).data('redirect'); var $options = $(this).data('dialog'); $.dialog(url, [201], function (xhr) { - window.location.href = $redirect ? $redirect : window.location.href; + if (!!$redirect) + window.location.href = $redirect; + else + $.pjax.reload('#pjax-container'); }, $options); return false; diff --git a/scp/tasks.php b/scp/tasks.php index ced34f872ad4bd73cd9e75af307393f5c31b84ef..f33018f3252569cd9ace6f0de58115d1e7ee7a26 100644 --- a/scp/tasks.php +++ b/scp/tasks.php @@ -118,6 +118,24 @@ $stats= $thisstaff->getTasksStats(); if (isset($_GET['clear_filter'])) unset($_SESSION['advsearch:tasks']); + +if (!$task) { + $queue_key = sprintf('::Q:%s', ObjectModel::OBJECT_TYPE_TASK); + $queue_name = strtolower($_GET['status'] ?: $_GET['a']); + if (!$queue_name && isset($_SESSION[$queue_key])) + $queue_name = $_SESSION[$queue_key]; + + // Stash current queue view + $_SESSION[$queue_key] = $queue_name; + + // Set queue as status + if (@!isset($_REQUEST['advanced']) + && @$_REQUEST['a'] != 'search' + && !isset($_GET['status']) + && $queue_name) + $_GET['status'] = $_REQUEST['status'] = $queue_name; +} + //Navigation $nav->setTabActive('tasks'); $open_name = _P('queue-name', diff --git a/scp/tickets.php b/scp/tickets.php index fadaf9730c037c6a04dbfe1c717f1f118e55981e..e5e03aa2ea37dbe603e5e53f916bc9c4b35db038 100644 --- a/scp/tickets.php +++ b/scp/tickets.php @@ -35,13 +35,25 @@ if($_REQUEST['id']) { } } -//Lookup user if id is available. if ($_REQUEST['uid']) { $user = User::lookup($_REQUEST['uid']); +} elseif (!$ticket) { + $queue_key = sprintf('::Q:%s', ObjectModel::OBJECT_TYPE_TICKET); + $queue_name = strtolower($_GET['status'] ?: $_GET['a']); //Status is overloaded + if (!$queue_name && isset($_SESSION[$queue_key])) + $queue_name = $_SESSION[$queue_key]; + + // Stash current queue view + $_SESSION[$queue_key] = $queue_name; + + // Set queue as status + if (@!isset($_REQUEST['advanced']) + && @$_REQUEST['a'] != 'search' + && !isset($_GET['status']) + && $queue_name) + $_GET['status'] = $_REQUEST['status'] = $queue_name; } -elseif (@!isset($_REQUEST['advanced']) && @$_REQUEST['a'] != 'search' && !isset($_GET['status']) && isset($_SESSION['::Q'])) { - $_GET['status'] = $_REQUEST['status'] = $_SESSION['::Q']; -} + // Configure form for file uploads $response_form = new SimpleForm(array( 'attachments' => new FileUploadField(array('id'=>'attach',