From 8cf16f461cd49b99ad1e81067969e9d1577cb24e Mon Sep 17 00:00:00 2001 From: Jared Hancock <jared@osticket.com> Date: Mon, 21 Sep 2015 13:01:06 -0500 Subject: [PATCH] queue: Add header, footer, export to new ticket queue --- include/ajax.search.php | 2 +- .../staff/templates/queue-tickets.tmpl.php | 109 ++++++++++++++++++ 2 files changed, 110 insertions(+), 1 deletion(-) diff --git a/include/ajax.search.php b/include/ajax.search.php index d433963a3..be38dbf4a 100644 --- a/include/ajax.search.php +++ b/include/ajax.search.php @@ -238,7 +238,7 @@ class SearchAjaxAPI extends AjaxController { $tickets = $queue->getQuery($form); $count = 10; // count($queue->getBasicQuery($form)); - include STAFFINC_DIR . 'templates/queue-tickets.tmpl.php'; + include STAFFINC_DIR . 'templates/queue-preview.tmpl.php'; } function addCondition() { diff --git a/include/staff/templates/queue-tickets.tmpl.php b/include/staff/templates/queue-tickets.tmpl.php index 32d664d90..e3f35a793 100644 --- a/include/staff/templates/queue-tickets.tmpl.php +++ b/include/staff/templates/queue-tickets.tmpl.php @@ -10,10 +10,84 @@ $pageNav = new Pagenate($count, $page, PAGE_LIMIT); $pageNav->setURL('tickets.php', $args); $tickets = $pageNav->paginate($tickets); +// Make sure the cdata materialized view is available +TicketForm::ensureDynamicDataView(); + // Identify columns of output $columns = $queue->getColumns(); +// Figure out REFRESH url — which might not be accurate after posting a +// response +list($path,) = explode('?', $_SERVER['REQUEST_URI'], 2); +$args = array(); +parse_str($_SERVER['QUERY_STRING'], $args); + +// Remove commands from query +unset($args['id']); +if ($args['a'] !== 'search') unset($args['a']); + +$refresh_url = $path . '?' . http_build_query($args); + ?> + +<!-- SEARCH FORM START --> +<div id='basic_search'> + <div class="pull-right" style="height:25px"> + <span class="valign-helper"></span> + <?php + require STAFFINC_DIR.'templates/queue-sort.tmpl.php'; + ?> + </div> + <form action="tickets.php" method="get" onsubmit="javascript: + $.pjax({ + url:$(this).attr('action') + '?' + $(this).serialize(), + container:'#pjax-container', + timeout: 2000 + }); +return false;"> + <input type="hidden" name="a" value="search"> + <input type="hidden" name="search-type" value=""/> + <div class="attached input"> + <input type="text" class="basic-search" data-url="ajax.php/tickets/lookup" name="query" + autofocus size="30" value="<?php echo Format::htmlchars($_REQUEST['query'], true); ?>" + autocomplete="off" autocorrect="off" autocapitalize="off"> + <button type="submit" class="attached button"><i class="icon-search"></i> + </button> + </div> + <a href="#" onclick="javascript: + $.dialog('ajax.php/tickets/search', 201);" + >[<?php echo __('advanced'); ?>]</a> + <i class="help-tip icon-question-sign" href="#advanced"></i> + </form> +</div> +<!-- SEARCH FORM END --> + +<div class="clear"></div> +<div style="margin-bottom:20px; padding-top:5px;"> + <div class="sticky bar opaque"> + <div class="content"> + <div class="pull-left flush-left"> + <h2><a href="<?php echo $refresh_url; ?>" + title="<?php echo __('Refresh'); ?>"><i class="icon-refresh"></i> <?php echo + $queue->getName(); ?></a></h2> + </div> + <div class="pull-right flush-right"> + <?php + // TODO: Respect queue root and corresponding actions + if ($count) { + Ticket::agentActions($thisstaff, array('status' => $status)); + }?> + </div> + </div> + </div> +</div> +<div class="clear"></div> + +<form action="?" method="POST" name='tickets' id="tickets"> +<?php csrf_token(); ?> + <input type="hidden" name="a" value="mass_process" > + <input type="hidden" name="do" id="action" value="" > + <table class="list" border="0" cellspacing="1" cellpadding="2" width="940"> <thead> <tr> @@ -37,4 +111,39 @@ foreach ($tickets as $T) { } ?> </tbody> + <tfoot> + <tr> + <td colspan="7"> + <?php if($total && $thisstaff->canManageTickets()){ ?> + <?php echo __('Select');?>: + <a id="selectAll" href="#ckb"><?php echo __('All');?></a> + <a id="selectNone" href="#ckb"><?php echo __('None');?></a> + <a id="selectToggle" href="#ckb"><?php echo __('Toggle');?></a> + <?php }else{ + echo '<i>'; + echo $ferror?Format::htmlchars($ferror):__('Query returned 0 results.'); + echo '</i>'; + } ?> + </td> + </tr> + </tfoot> </table> + +<?php + if ($count > 0) { //if we actually had any tickets returned. +?> <div> + <span class="faded pull-right"><?php echo $pageNav->showing(); ?></span> +<?php + echo __('Page').':'.$pageNav->getPageLinks().' '; + echo sprintf('<a class="export-csv no-pjax" href="?%s">%s</a>', + Http::build_query(array( + 'a' => 'export', 'queue' => $_REQUEST['queue'], + 'status' => $_REQUEST['status'])), + __('Export')); + ?> + <i class="help-tip icon-question-sign" href="#export"></i> + </div> +<?php + } ?> + +</form> -- GitLab