From 24b08104f9c98aaeae5812b2487122d1ede1d026 Mon Sep 17 00:00:00 2001 From: Quitta Date: Thu, 11 Jul 2013 02:39:52 +0200 Subject: [PATCH] added admin function to change setting + changed color of admin bg when they reply + some other fixes --HG-- branch : quitta-gsoc-2013 --- .../ryzom_ams/ams_lib/autoload/ticket.php | 21 ++++++++++--------- .../www/html/func/reply_on_ticket.php | 8 +++++++ .../ryzom_ams/www/html/inc/show_ticket.php | 4 ++++ .../ryzom_ams/www/html/inc/show_user.php | 2 +- .../www/html/templates/show_ticket.tpl | 21 +++++++++++++++---- .../www/html/templates/show_user.tpl | 2 +- 6 files changed, 42 insertions(+), 16 deletions(-) diff --git a/code/ryzom/tools/server/ryzom_ams/ams_lib/autoload/ticket.php b/code/ryzom/tools/server/ryzom_ams/ams_lib/autoload/ticket.php index bdf772b6d..5ac6499e5 100644 --- a/code/ryzom/tools/server/ryzom_ams/ams_lib/autoload/ticket.php +++ b/code/ryzom/tools/server/ryzom_ams/ams_lib/autoload/ticket.php @@ -11,6 +11,14 @@ class Ticket{ ////////////////////////////////////////////Functions//////////////////////////////////////////////////// + /*FUNCTION: getStatusArray + * returns all possible statusses + * + */ + public static function getStatusArray() { + return Array("Waiting on user reply","Waiting on support","Waiting on Dev reply","Closed"); + } + /*FUNCTION: getEntireTicket * return all ticket of the given author's id. * @@ -54,7 +62,7 @@ class Ticket{ public static function create_Ticket( $title, $content, $category, $author) { $ticket = new Ticket(); - $ticket->set($title,0,0,$category,$author); + $ticket->set($title,1,0,$category,$author); $ticket->create(); $ticket_id = $ticket->getTId(); Ticket_Reply::createReply($content, $author, $ticket_id); @@ -128,15 +136,8 @@ class Ticket{ } public function getStatusText(){ - $statusId = $this->getStatus(); - if ($statusId == 0){ - return "Waiting on support.."; - }else if($statusId == 1){ - return "Being handled.."; - }else if($statusId == 2){ - return "Closed"; - } - return "Error"; + $statusArray = Ticket::getStatusArray(); + return $statusArray[$this->getStatus()]; } public function getCategoryName(){ diff --git a/code/ryzom/tools/server/ryzom_ams/www/html/func/reply_on_ticket.php b/code/ryzom/tools/server/ryzom_ams/www/html/func/reply_on_ticket.php index e7eebb375..b6017670a 100644 --- a/code/ryzom/tools/server/ryzom_ams/www/html/func/reply_on_ticket.php +++ b/code/ryzom/tools/server/ryzom_ams/www/html/func/reply_on_ticket.php @@ -16,6 +16,14 @@ function reply_on_ticket(){ $content = filter_var($_POST['Content'], FILTER_SANITIZE_STRING); $author = $_SESSION['ticket_user']->getTUserId(); Ticket_Reply::createReply($content, $author, $ticket_id); + + if(isset($_POST['ChangeStatus']) && WebUsers::isAdmin()){ + $newStatus = filter_var($_POST['ChangeStatus'], FILTER_SANITIZE_NUMBER_INT); + $ticket = new Ticket(); + $ticket->load_With_TId($ticket_id); + $ticket->setStatus($newStatus); + $ticket->update(); + } header("Location: index.php?page=show_ticket&id=".$ticket_id); exit; diff --git a/code/ryzom/tools/server/ryzom_ams/www/html/inc/show_ticket.php b/code/ryzom/tools/server/ryzom_ams/www/html/inc/show_ticket.php index 93654d126..f409e2cb0 100644 --- a/code/ryzom/tools/server/ryzom_ams/www/html/inc/show_ticket.php +++ b/code/ryzom/tools/server/ryzom_ams/www/html/inc/show_ticket.php @@ -19,6 +19,10 @@ function show_ticket(){ $result['ticket_replies'][$i]['author'] = WebUsers::getUsername($reply['authorExtern']); $i++; } + if(WebUsers::isAdmin()){ + $result['isAdmin'] = "TRUE"; + $result['statusList'] = Ticket::getStatusArray(); + } return $result; }else{ diff --git a/code/ryzom/tools/server/ryzom_ams/www/html/inc/show_user.php b/code/ryzom/tools/server/ryzom_ams/www/html/inc/show_user.php index 6c13271bc..fee3085c9 100644 --- a/code/ryzom/tools/server/ryzom_ams/www/html/inc/show_user.php +++ b/code/ryzom/tools/server/ryzom_ams/www/html/inc/show_user.php @@ -22,7 +22,7 @@ function show_user(){ $ticket_user = Ticket_User::constr_ExternId($result['target_id']); $ticketlist = Ticket::getTicketsOf($ticket_user->getTUserId()); - $result['ticketlist'] = Gui_Elements::make_table($ticketlist, Array("getTId","getTimestamp","getTitle","getStatus","getStatusText","getCategoryName"), Array("tId","timestamp","title","status","statusText","category")); + $result['ticketlist'] = Gui_Elements::make_table($ticketlist, Array("getTId","getTimestamp","getTitle","getStatus","getStatusText","getStatusText","getCategoryName"), Array("tId","timestamp","title","status","statustext","statusText","category")); return $result; }else{ diff --git a/code/ryzom/tools/server/ryzom_ams/www/html/templates/show_ticket.tpl b/code/ryzom/tools/server/ryzom_ams/www/html/templates/show_ticket.tpl index 22d8f8c46..37444058e 100644 --- a/code/ryzom/tools/server/ryzom_ams/www/html/templates/show_ticket.tpl +++ b/code/ryzom/tools/server/ryzom_ams/www/html/templates/show_ticket.tpl @@ -1,6 +1,6 @@ {block name=content}
-
+

{$t_title}[ID#{$ticket_tId}]

@@ -11,10 +11,10 @@
{$title}: {$ticket_title} - +
{foreach from=$ticket_replies item=reply} - + @@ -39,6 +40,18 @@ + {if isset($isAdmin) and $isAdmin eq "TRUE"} +
+ +
+ +
+
+ {/if}
diff --git a/code/ryzom/tools/server/ryzom_ams/www/html/templates/show_user.tpl b/code/ryzom/tools/server/ryzom_ams/www/html/templates/show_user.tpl index 29e4c1961..1ddd97df7 100644 --- a/code/ryzom/tools/server/ryzom_ams/www/html/templates/show_user.tpl +++ b/code/ryzom/tools/server/ryzom_ams/www/html/templates/show_user.tpl @@ -105,7 +105,7 @@
- + {/foreach}

[ID#{$reply.tReplyId}] {$reply.timestamp} {if $reply.permission eq '1'} @@ -22,7 +22,8 @@ {else if $reply.permission eq '2'} [CSR] {/if} - {$reply.author}

+ {if isset($isAdmin) and $isAdmin eq "TRUE"} {$reply.author}{else}{$reply.author} {/if}

+

{$reply.replyContent}

{$ticket.timestamp} {$ticket.category}{$ticket.statusText}{if $ticket.status eq 0} {/if} {$ticket.statusText}