From c912daecae14ed6df869e8227c7902970d8fd93c Mon Sep 17 00:00:00 2001 From: Quitta Date: Sat, 13 Jul 2013 23:18:49 +0200 Subject: [PATCH] Show single replies works, though the code for it is a bit ugly, have to refactor that though --- .../ams_lib/autoload/ticket_user.php | 7 ++- .../ryzom_ams/ams_lib/translations/en.ini | 2 + .../ryzom_ams/ams_lib/translations/fr.ini | 2 + .../ryzom_ams/www/html/inc/show_reply.php | 44 +++++++++++++++++++ .../www/html/templates/show_reply.tpl | 20 +++++++-- .../www/html/templates/show_ticket_log.tpl | 2 +- 6 files changed, 69 insertions(+), 8 deletions(-) create mode 100644 code/ryzom/tools/server/ryzom_ams/www/html/inc/show_reply.php diff --git a/code/ryzom/tools/server/ryzom_ams/ams_lib/autoload/ticket_user.php b/code/ryzom/tools/server/ryzom_ams/ams_lib/autoload/ticket_user.php index 506cc4193..726d98d1f 100644 --- a/code/ryzom/tools/server/ryzom_ams/ams_lib/autoload/ticket_user.php +++ b/code/ryzom/tools/server/ryzom_ams/ams_lib/autoload/ticket_user.php @@ -48,10 +48,9 @@ class Ticket_User{ $dbl = new DBLayer("lib"); $statement = $dbl->execute("SELECT * FROM ticket_user WHERE TUserId=:id", array('id' => $id)); $row = $statement->fetch(); - $instance->tUserId = $row['TUserId']; - $instance->permission = $row['Permission']; - $instance->externId = $row['ExternId']; - return $instance; + $this->tUserId = $row['TUserId']; + $this->permission = $row['Permission']; + $this->externId = $row['ExternId']; } //update private data to DB. 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 5df655096..c82896fa2 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 @@ -33,6 +33,8 @@ t_send = "Send reply" [show_ticket_log] +[show_reply] + [ticket_log] 1 = "created the ticket" 2 = "created the ticket for" 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 621988ea0..d726bdcfa 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,8 @@ t_send = "Envoyer la reponse" [createticket] +[show_reply] + [show_ticket_log] [ticket_log] diff --git a/code/ryzom/tools/server/ryzom_ams/www/html/inc/show_reply.php b/code/ryzom/tools/server/ryzom_ams/www/html/inc/show_reply.php new file mode 100644 index 000000000..f3de64594 --- /dev/null +++ b/code/ryzom/tools/server/ryzom_ams/www/html/inc/show_reply.php @@ -0,0 +1,44 @@ +load_With_TReplyId($result['reply_id']); + + $ticket = new Ticket(); + $ticket->load_With_TId($reply->getTicket()); + + if(($ticket->getAuthor() == $_SESSION['ticket_user']->getTUserId()) || WebUsers::isAdmin() ){ + $content = new Ticket_Content(); + $content->load_With_TContentId($reply->getContent()); + + $author = new Ticket_User(); + $author->load_With_TUserId($reply->getAuthor()); + + + $result['ticket_id'] = $reply->getTicket(); + $result['reply_timestamp'] = $reply->getTimestamp(); + $result['author_permission'] = $author->getPermission(); + $result['reply_content'] = $content->getContent(); + $result['author'] = $author->getExternId(); + $result['authorName'] = WebUsers::getUsername($author->getExternId()); + if(WebUsers::isAdmin()){ + $result['isAdmin'] = "TRUE"; + } + return $result; + + }else{ + //ERROR: No access! + $_SESSION['error_code'] = "403"; + header("Location: index.php?page=error"); + exit; + } + }else{ + //ERROR: not logged in! + header("Location: index.php"); + exit; + } +} \ No newline at end of file diff --git a/code/ryzom/tools/server/ryzom_ams/www/html/templates/show_reply.tpl b/code/ryzom/tools/server/ryzom_ams/www/html/templates/show_reply.tpl index b85cfca05..078136f30 100644 --- a/code/ryzom/tools/server/ryzom_ams/www/html/templates/show_reply.tpl +++ b/code/ryzom/tools/server/ryzom_ams/www/html/templates/show_reply.tpl @@ -2,7 +2,7 @@
-

Reply ID# of Ticket #

+

Show Reply

@@ -10,8 +10,22 @@
- Info - + Reply ID#{$reply_id} of Ticket #{$ticket_id} + + + + +
+

{$reply_timestamp} {$author_permission} + {if $author_permission eq '1'} + + {else if $author_permission eq '2'} + [CSR] + {/if} + {if isset($isAdmin) and $isAdmin eq "TRUE"} {$authorName}{else}{$authorName} {/if}

+ +

{$reply_content}

+
diff --git a/code/ryzom/tools/server/ryzom_ams/www/html/templates/show_ticket_log.tpl b/code/ryzom/tools/server/ryzom_ams/www/html/templates/show_ticket_log.tpl index 7ae92b732..f7d065306 100644 --- a/code/ryzom/tools/server/ryzom_ams/www/html/templates/show_ticket_log.tpl +++ b/code/ryzom/tools/server/ryzom_ams/www/html/templates/show_ticket_log.tpl @@ -23,7 +23,7 @@ {foreach from=$ticket_logs item=log} {$log.tLogId} - {$log.timestamp} + {$log.timestamp} {$log.query} {/foreach}