fixed dirty error in queue's that didn't allow me to assing/unassign after creating a queue

--HG--
branch : quitta-gsoc-2013
This commit is contained in:
Quitta 2013-08-18 03:39:35 +02:00
parent f8d19762fe
commit f0f08fc374
4 changed files with 48 additions and 35 deletions

View file

@ -5,6 +5,7 @@ class Gui_Elements{
public static function make_table( $inputList, $funcArray ,$fieldArray){ public static function make_table( $inputList, $funcArray ,$fieldArray){
$i = 0; $i = 0;
$result = Array(); $result = Array();
if(!empty($inputList)){
foreach($inputList as $element){ foreach($inputList as $element){
$j = 0; $j = 0;
foreach($funcArray as $function){ foreach($funcArray as $function){
@ -31,6 +32,7 @@ class Gui_Elements{
} }
$i++; $i++;
} }
}
return $result; return $result;
} }

View file

@ -33,8 +33,11 @@ class Ticket_Queue_Handler{
default: default:
return "ERROR"; return "ERROR";
} }
$this->pagination = new Pagination($this->queue->getQuery(),"lib",10,"Ticket",$this->queue->getParams()); $this->pagination = new Pagination($this->queue->getQuery(),"lib",10,"Ticket",$this->queue->getParams());
foreach( $this->pagination->getElements() as $element ){ $elemArray = $this->pagination->getElements();
if(!empty($elemArray)){
foreach( $elemArray as $element ){
$catInstance = new Ticket_Category(); $catInstance = new Ticket_Category();
$catInstance->load_With_TCategoryId($element->getTicket_Category()); $catInstance->load_With_TCategoryId($element->getTicket_Category());
$element->setTicket_Category($catInstance); $element->setTicket_Category($catInstance);
@ -43,6 +46,7 @@ class Ticket_Queue_Handler{
$userInstance->load_With_TUserId($element->getAuthor()); $userInstance->load_With_TUserId($element->getAuthor());
$element->setAuthor($userInstance); $element->setAuthor($userInstance);
} }
}
return $this->pagination->getElements(); return $this->pagination->getElements();
} }

View file

@ -16,6 +16,12 @@ function show_queue(){
//Pagination Base Links //Pagination Base Links
$result['pagination_base_link'] = "index.php?page=show_queue&get=".$result['queue_view'] ; $result['pagination_base_link'] = "index.php?page=show_queue&get=".$result['queue_view'] ;
//form url to keep the getters constant
$result['getURL'] = "index.php?page=show_queue&get=" . $result['queue_view'];
if(isset($_GET['pagenum'])){
$result['getURL'] = $result['getURL'] . "&pagenum=".$_GET['pagenum'];
}
if(isset($_GET['get']) && ($_GET['get'] == "create") && isset($_GET['userid']) && isset($_GET['groupid']) && isset($_GET['what']) && isset($_GET['how']) && isset($_GET['who'])){ if(isset($_GET['get']) && ($_GET['get'] == "create") && isset($_GET['userid']) && isset($_GET['groupid']) && isset($_GET['what']) && isset($_GET['how']) && isset($_GET['who'])){
$userid = filter_var($_GET['userid'], FILTER_SANITIZE_NUMBER_INT); $userid = filter_var($_GET['userid'], FILTER_SANITIZE_NUMBER_INT);
$groupid = filter_var($_GET['groupid'], FILTER_SANITIZE_NUMBER_INT); $groupid = filter_var($_GET['groupid'], FILTER_SANITIZE_NUMBER_INT);
@ -29,6 +35,9 @@ function show_queue(){
$result['prev_created_what'] = $what; $result['prev_created_what'] = $what;
$result['prev_created_how'] = $how; $result['prev_created_how'] = $how;
$result['prev_created_who'] = $who; $result['prev_created_who'] = $who;
$result['getURL'] = $result['getURL'] . "&userid=".$userid."&groupid=".$groupid."&what=".$what."&how=".$how."&who=".$who;
} }
//if an action is set //if an action is set
@ -57,9 +66,7 @@ function show_queue(){
$result['prev_created_what'] = $what; $result['prev_created_what'] = $what;
$result['prev_created_how'] = $how; $result['prev_created_how'] = $how;
$result['prev_created_who'] = $who; $result['prev_created_who'] = $who;
$result['getURL'] = $result['getURL'] . "&userid=".$userid."&groupid=".$groupid."&what=".$what."&how=".$how."&who=".$who;
break; break;

View file

@ -34,7 +34,7 @@
<span id="userList" {if $prev_created_who eq "user"}style="display:inline;"{else if $prev_created_who eq "support_group"}style="display:none;"{else}style="display:inline;"{/if}> <span id="userList" {if $prev_created_who eq "user"}style="display:inline;"{else if $prev_created_who eq "support_group"}style="display:none;"{else}style="display:inline;"{/if}>
<select style="width: 140px;" name="userid"> <select style="width: 140px;" name="userid">
{foreach from=$teamlist item=member} {foreach from=$teamlist item=member}
<option value="{$member.tUserId}" {if $prev_created_userid eq $member.tUserId}selected="selected"{else if $user_id eq $member.tUserId}selected="selected"{/if}>{$member.name}</option> <option value="{$member.tUserId}" {if isset($prev_created_userid)} {if $prev_created_userid eq $member.tUserId}selected="selected"{/if}{else if $user_id eq $member.tUserId}selected="selected"{/if}>{$member.name}</option>
{/foreach} {/foreach}
</select> </select>
</span> </span>
@ -108,13 +108,13 @@
</td> </td>
<td> <td>
{if $ticket.assigned eq 0} {if $ticket.assigned eq 0}
<form id="assign_ticket" class="form-vertical" method="post" action="" style="margin:0px 0px 0px;"> <form id="assign_ticket" class="form-vertical" method="post" action="{$getURL}" style="margin:0px 0px 0px;">
<input type="hidden" name="ticket_id" value="{$ticket.tId}"> <input type="hidden" name="ticket_id" value="{$ticket.tId}">
<input type="hidden" name="action" value="assignTicket"> <input type="hidden" name="action" value="assignTicket">
<button type="submit" class="btn btn-primary" ><i class="icon-flag icon-white"></i> Assign Ticket</button> <button type="submit" class="btn btn-primary" ><i class="icon-flag icon-white"></i> Assign Ticket</button>
</form> </form>
{else if $ticket.assigned eq $user_id} {else if $ticket.assigned eq $user_id}
<form id="assign_ticket" class="form-vertical" method="post" action="" style="margin:0px 0px 0px;"> <form id="assign_ticket" class="form-vertical" method="post" action="{$getURL}" style="margin:0px 0px 0px;">
<input type="hidden" name="ticket_id" value="{$ticket.tId}"> <input type="hidden" name="ticket_id" value="{$ticket.tId}">
<input type="hidden" name="action" value="unAssignTicket"> <input type="hidden" name="action" value="unAssignTicket">
<button type="submit" class="btn btn-warning" ><i class="icon-remove icon-white"></i> Remove Assign</button> <button type="submit" class="btn btn-warning" ><i class="icon-remove icon-white"></i> Remove Assign</button>