From 15237002aa808fd7836284c5301f8b0bb92f7e8f Mon Sep 17 00:00:00 2001 From: Quitta Date: Sat, 13 Jul 2013 18:04:40 +0200 Subject: [PATCH] show time elapsed as tooltip, which could be handy, started making the show_reply.tpl --- .../ryzom_ams/ams_lib/autoload/helpers.php | 66 +++++++++++-------- .../ryzom_ams/ams_lib/autoload/ticket_log.php | 27 +------- .../www/html/inc/show_ticket_log.php | 3 +- .../www/html/templates/show_reply.tpl | 20 ++++++ .../www/html/templates/show_ticket_log.tpl | 2 +- 5 files changed, 61 insertions(+), 57 deletions(-) create mode 100644 code/ryzom/tools/server/ryzom_ams/www/html/templates/show_reply.tpl diff --git a/code/ryzom/tools/server/ryzom_ams/ams_lib/autoload/helpers.php b/code/ryzom/tools/server/ryzom_ams/ams_lib/autoload/helpers.php index 0bc4197b3..f259b85e4 100644 --- a/code/ryzom/tools/server/ryzom_ams/ams_lib/autoload/helpers.php +++ b/code/ryzom/tools/server/ryzom_ams/ams_lib/autoload/helpers.php @@ -29,31 +29,8 @@ class Helpers{ $smarty -> assign( $key, $value ); } - global $DEFAULT_LANGUAGE; - //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 ); + + $variables = Helpers::handle_language(); foreach ( $variables[$template] as $key => $value ){ $smarty -> assign( $key, $value ); } @@ -91,11 +68,42 @@ class Helpers{ static public function check_if_game_client() { // if HTTP_USER_AGENT is not set then its ryzom core - if ( !isset( $_SERVER['HTTP_USER_AGENT'] ) ){ + if ( !isset( $_SERVER['HTTP_USER_AGENT'] ) ){ return true; - }else{ + }else{ return false; } - } } - + + static public function handle_language(){ + 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; + } + } + + return parse_ini_file( $AMS_TRANS . '/' . $language . '.ini', true ); + + + } +} 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 8ae822a0b..89bd9763c 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 @@ -143,32 +143,7 @@ class Ticket_Log{ } 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 ); + $variables = Helpers::handle_language(); $result = array(); foreach ( $variables['ticket_log'] as $key => $value ){ $result[$key] = $value; 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 b4112f937..3d988b26d 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 @@ -23,7 +23,7 @@ function show_ticket_log(){ if($log['action'] == 2){ $query_backpart = WebUsers::getUsername($log['argument']); }else if($log['action'] == 4){ - $query_backpart = "" . $log['argument'] . ""; + $query_backpart = "ID#" . $log['argument'] . ""; }else if($log['action'] == 5){ $statusArray = Ticket::getStatusArray(); $query_backpart = $statusArray[$log['argument'] ]; @@ -32,6 +32,7 @@ function show_ticket_log(){ $query_backpart = $priorityArray[$log['argument'] ]; } $result['ticket_logs'][$i]['query'] = $author . " " . $log_action_array[$log['action']] . " " . $query_backpart; + $result['ticket_logs'][$i]['timestamp_elapsed'] = Gui_Elements::time_elapsed_string($log['timestamp']); $i++; } if(WebUsers::isAdmin()){ 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 new file mode 100644 index 000000000..b85cfca05 --- /dev/null +++ b/code/ryzom/tools/server/ryzom_ams/www/html/templates/show_reply.tpl @@ -0,0 +1,20 @@ +{block name=content} +
+
+
+

Reply ID# of Ticket #

+
+ + +
+
+
+
+ Info + +
+
+
+
+{/block} + 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 10752f55a..7ae92b732 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}