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 06f958a65..bdf772b6d 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 @@ -57,18 +57,7 @@ class Ticket{ $ticket->set($title,0,0,$category,$author); $ticket->create(); $ticket_id = $ticket->getTId(); - - - $ticket_content = new Ticket_Content(); - $ticket_content->setContent($content); - $ticket_content->create(); - $content_id = $ticket_content->getTContentId(); - - - $ticket_reply = new Ticket_Reply(); - $ticket_reply->set($ticket_id, $content_id, $author); - $ticket_reply->create(); - + Ticket_Reply::createReply($content, $author, $ticket_id); return $ticket_id; } diff --git a/code/ryzom/tools/server/ryzom_ams/ams_lib/autoload/ticket_reply.php b/code/ryzom/tools/server/ryzom_ams/ams_lib/autoload/ticket_reply.php index 66d98da3c..e58484a06 100644 --- a/code/ryzom/tools/server/ryzom_ams/ams_lib/autoload/ticket_reply.php +++ b/code/ryzom/tools/server/ryzom_ams/ams_lib/autoload/ticket_reply.php @@ -39,6 +39,17 @@ class Ticket_Reply{ return $result; } + public static function createReply($content, $author, $ticket_id){ + $ticket_content = new Ticket_Content(); + $ticket_content->setContent($content); + $ticket_content->create(); + $content_id = $ticket_content->getTContentId(); + + $ticket_reply = new Ticket_Reply(); + $ticket_reply->set($ticket_id, $content_id, $author); + $ticket_reply->create(); + } + ////////////////////////////////////////////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 f29098be5..518cbfea0 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 @@ -21,6 +21,12 @@ email = "Email" action = "Action" [show_ticket] +t_title = "Ticket" +title = "Title" +t_reply = "Reply on ticket" +t_fill = "Fill in your reply" +t_send = "Send reply" + [show_user] [createticket] 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 35aaad5e5..7104840d1 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 @@ -20,10 +20,18 @@ name = "Nom" email = "Email" action = "Action" -[createticket] [show_ticket] +t_title = "Billet" +title = "Titre" +t_reply = "Repondre a billet" +t_fill = "Remplissez votre reponse" +t_send = "Envoyer la reponse" + [show_user] +[createticket] + + [error] title404 = "Pas
trouvez!" title403 = "Interdit!" 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 new file mode 100644 index 000000000..e7eebb375 --- /dev/null +++ b/code/ryzom/tools/server/ryzom_ams/www/html/func/reply_on_ticket.php @@ -0,0 +1,40 @@ +load_With_TId($ticket_id); + + if(($target_ticket->getAuthor() == $_SESSION['ticket_user']->getTUserId()) || WebUsers::isAdmin() ){ + + try{ + + $content = filter_var($_POST['Content'], FILTER_SANITIZE_STRING); + $author = $_SESSION['ticket_user']->getTUserId(); + Ticket_Reply::createReply($content, $author, $ticket_id); + header("Location: index.php?page=show_ticket&id=".$ticket_id); + exit; + + }catch (PDOException $e) { + //ERROR: LIB DB is not online! + header("Location: index.php"); + exit; + } + + }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_ticket.tpl b/code/ryzom/tools/server/ryzom_ams/www/html/templates/show_ticket.tpl index a6f0680da..09967552b 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 @@ -2,7 +2,7 @@
-

Ticket [ID#{$ticket_tId}]

+

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

@@ -10,7 +10,7 @@
- Title: {$ticket_title} + {$title}: {$ticket_title} {foreach from=$ticket_replies item=reply} @@ -24,20 +24,21 @@
- Reply on the ticket: + {$t_reply}:
- +
- + +
- +