From a8ee2f46f686632b97c5a0d87ae8b875ca5f4943 Mon Sep 17 00:00:00 2001 From: Quitta Date: Fri, 12 Jul 2013 20:10:17 +0200 Subject: [PATCH] started working on the show_ticket_log and encapsulated the createReply of ticket_reply into a ticket class function --HG-- branch : quitta-gsoc-2013 --- .../ryzom_ams/ams_lib/autoload/ticket.php | 17 +++++++- .../ryzom_ams/ams_lib/translations/en.ini | 2 + .../ryzom_ams/ams_lib/translations/fr.ini | 1 + .../www/html/func/reply_on_ticket.php | 7 ++- .../www/html/inc/show_ticket_log.php | 6 +++ .../www/html/templates/show_ticket_log.tpl | 43 +++++++++++++++++++ 6 files changed, 71 insertions(+), 5 deletions(-) create mode 100644 code/ryzom/tools/server/ryzom_ams/www/html/inc/show_ticket_log.php create mode 100644 code/ryzom/tools/server/ryzom_ams/www/html/templates/show_ticket_log.tpl 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 bd9000652..3594818aa 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 @@ -106,7 +106,7 @@ class Ticket{ } - //return constructed element based on TCategoryId + //return the latest reply. public static function getLatestReply( $ticket_id) { $dbl = new DBLayer("lib"); $statement = $dbl->execute("SELECT * FROM ticket_reply WHERE Ticket =:id ORDER BY TReplyId DESC LIMIT 1 ", array('id' => $ticket_id)); @@ -115,6 +115,21 @@ class Ticket{ return $reply; } + public static function createReply($content, $author, $ticket_id){ + if($content != ""){ + $ticket = new Ticket(); + $ticket->load_With_TId($ticket_id); + //if status is not closed + if($ticket->getStatus() != 3){ + Ticket_Reply::createReply($content, $author, $ticket_id); + }else{ + //TODO: Show error message that ticket is closed + } + }else{ + //TODO: Show error content is empty + } + } + ////////////////////////////////////////////Methods//////////////////////////////////////////////////// public function __construct() { diff --git a/code/ryzom/tools/server/ryzom_ams/ams_lib/translations/en.ini b/code/ryzom/tools/server/ryzom_ams/ams_lib/translations/en.ini index 518cbfea0..aeacbeb05 100644 --- a/code/ryzom/tools/server/ryzom_ams/ams_lib/translations/en.ini +++ b/code/ryzom/tools/server/ryzom_ams/ams_lib/translations/en.ini @@ -31,6 +31,8 @@ t_send = "Send reply" [createticket] +[show_ticket_log] + [error] title404 = "Not
Found!" title403 = "Forbidden!" diff --git a/code/ryzom/tools/server/ryzom_ams/ams_lib/translations/fr.ini b/code/ryzom/tools/server/ryzom_ams/ams_lib/translations/fr.ini index 7104840d1..8125fb969 100644 --- a/code/ryzom/tools/server/ryzom_ams/ams_lib/translations/fr.ini +++ b/code/ryzom/tools/server/ryzom_ams/ams_lib/translations/fr.ini @@ -31,6 +31,7 @@ t_send = "Envoyer la reponse" [createticket] +[show_ticket_log] [error] title404 = "Pas
trouvez!" 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 c5aa27862..08188340f 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 @@ -13,10 +13,9 @@ function reply_on_ticket(){ try{ $author = $_SESSION['ticket_user']->getTUserId(); - if(isset($_POST['ChangeStatus']) && $_POST['Content'] != ""){ - $content = filter_var($_POST['Content'], FILTER_SANITIZE_STRING); - Ticket_Reply::createReply($content, $author, $ticket_id); - } + $content = filter_var($_POST['Content'], FILTER_SANITIZE_STRING); + Ticket::createReply($content, $author, $ticket_id); + if(isset($_POST['ChangeStatus']) && isset($_POST['ChangePriority']) && WebUsers::isAdmin()){ $newStatus = filter_var($_POST['ChangeStatus'], FILTER_SANITIZE_NUMBER_INT); $newPriority = filter_var($_POST['ChangePriority'], FILTER_SANITIZE_NUMBER_INT); diff --git a/code/ryzom/tools/server/ryzom_ams/www/html/inc/show_ticket_log.php b/code/ryzom/tools/server/ryzom_ams/www/html/inc/show_ticket_log.php new file mode 100644 index 000000000..470543802 --- /dev/null +++ b/code/ryzom/tools/server/ryzom_ams/www/html/inc/show_ticket_log.php @@ -0,0 +1,6 @@ + +
+
+

Tickets of {$target_name}

+
+ + +
+
+
+
+ Tickets + + + + + + + + + + + + {foreach from=$ticketlist item=ticket} + + + + + + + + + {/foreach} + + +
IDTitleTimestampCategoryStatus
{$ticket.tId}{$ticket.title}{$ticket.timestamp}{$ticket.category}{if $ticket.status eq 0} {/if} {$ticket.statusText}
+
+
+
+ +{/block} + \ No newline at end of file