From 66cec1fb7a368b78b1441911196317e78ae253b7 Mon Sep 17 00:00:00 2001 From: Quitta Date: Sat, 13 Jul 2013 16:41:52 +0200 Subject: [PATCH] use language ini files to select correct log thing --- .../ryzom_ams/ams_lib/autoload/ticket.php | 2 +- .../ryzom_ams/ams_lib/autoload/ticket_log.php | 34 ++++++++++ .../ryzom_ams/ams_lib/translations/en.ini | 8 +++ .../www/html/inc/show_ticket_log.php | 17 ++++- .../www/html/templates/show_ticket.tpl | 67 ++++--------------- .../www/html/templates/show_ticket_log.tpl | 9 +-- 6 files changed, 73 insertions(+), 64 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 3594818aa..bd78bc241 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 @@ -76,12 +76,12 @@ class Ticket{ $ticket->create(); $ticket_id = $ticket->getTId(); - Ticket_Reply::createReply($content, $author, $ticket_id); if ( $author == $real_author){ Ticket_Log::createLogEntry( $ticket_id, $author, 1); }else{ Ticket_Log::createLogEntry( $ticket_id, $real_author, 2, $author); } + Ticket_Reply::createReply($content, $author, $ticket_id); return $ticket_id; } diff --git a/code/ryzom/tools/server/ryzom_ams/ams_lib/autoload/ticket_log.php b/code/ryzom/tools/server/ryzom_ams/ams_lib/autoload/ticket_log.php index 1f7c03158..8ae822a0b 100644 --- a/code/ryzom/tools/server/ryzom_ams/ams_lib/autoload/ticket_log.php +++ b/code/ryzom/tools/server/ryzom_ams/ams_lib/autoload/ticket_log.php @@ -142,6 +142,40 @@ class Ticket_Log{ return $decodedQuery[1]; } + public function getActionTextArray(){ + global $DEFAULT_LANGUAGE; + global $AMS_TRANS; + //if language get param is given = set cookie + //else if no get param is given and a cookie is set, use that language, else use default. + if ( isset( $_GET['language'] ) ) { + //check if the language is supported + if ( file_exists( $AMS_TRANS . '/' . $_GET['language'] . '.ini' ) ){ + //if it's supported, set cookie! + setcookie( 'language',$_GET['language'], time() + 60*60*24*30 ); + $language = $_GET['language']; + }else{ + //the language is not supported, use the default. + $language = $DEFAULT_LANGUAGE; + } + }else{ + //if no get param is given, check if a cookie value for language is set + if ( isset( $_COOKIE['language'] ) ) { + $language = $_COOKIE['language']; + } + //else use the default + else{ + $language = $DEFAULT_LANGUAGE; + } + } + + $variables = parse_ini_file( $AMS_TRANS . '/' . $language . '.ini', true ); + $result = array(); + foreach ( $variables['ticket_log'] as $key => $value ){ + $result[$key] = $value; + } + return $result; + } + ////////////////////////////////////////////Setters//////////////////////////////////////////////////// public function setTLogId($id){ 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 aeacbeb05..5df655096 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,14 @@ t_send = "Send reply" [show_ticket_log] +[ticket_log] +1 = "created the ticket" +2 = "created the ticket for" +3 = "read the ticket" +4 = "added reply" +5 = "changed the status to" +6 = "changed the priority to" + [error] title404 = "Not
Found!" title403 = "Forbidden!" 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 index 48cd3eff7..b4112f937 100644 --- 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 @@ -13,10 +13,25 @@ function show_ticket_log(){ $result['ticket_title'] = $target_ticket->getTitle(); $ticket_logs = Ticket_Log::getLogsOfTicket( $result['ticket_id']); + $log_action_array = Ticket_Log::getActionTextArray(); $result['ticket_logs'] = Gui_Elements::make_table($ticket_logs, Array("getTLogId","getTimestamp","getAuthor()->getExternId","getAction","getArgument()"), Array("tLogId","timestamp","authorExtern","action","argument")); $i = 0; foreach( $result['ticket_logs'] as $log){ - $result['ticket_logs'][$i]['author'] = WebUsers::getUsername($log['authorExtern']); + $author = WebUsers::getUsername($log['authorExtern']); + $result['ticket_logs'][$i]['author'] = $author; + $query_backpart = ""; + if($log['action'] == 2){ + $query_backpart = WebUsers::getUsername($log['argument']); + }else if($log['action'] == 4){ + $query_backpart = "" . $log['argument'] . ""; + }else if($log['action'] == 5){ + $statusArray = Ticket::getStatusArray(); + $query_backpart = $statusArray[$log['argument'] ]; + }else if($log['action'] == 6){ + $priorityArray = Ticket::getPriorityArray(); + $query_backpart = $priorityArray[$log['argument'] ]; + } + $result['ticket_logs'][$i]['query'] = $author . " " . $log_action_array[$log['action']] . " " . $query_backpart; $i++; } if(WebUsers::isAdmin()){ 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 91c0e0c44..50090aa07 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 @@ -109,7 +109,7 @@
-

Tags

+

Actions

@@ -117,6 +117,7 @@
+
Tags @@ -146,61 +147,7 @@
-
-
- - - -
-
-

Groups

-
- - -
-
-
-
-
- Groups -
- -
-
-
Hacked accounts -
-
-
-
- -
-
- -
-
-
-
- -
- -
-
-
-
-
-
- -
-
-

Associations

-
- - -
-
-
-
Associations @@ -227,6 +174,16 @@
+ Actions +
+ + +
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 a075faf50..10752f55a 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 @@ -16,9 +16,7 @@ ID Timestamp - User - Action - Argument + Query @@ -26,10 +24,7 @@ {$log.tLogId} {$log.timestamp} - {$log.author} - {$log.action} - {$log.argument} - + {$log.query} {/foreach}