From 4e36f5575da93535dfe43b66c39304cb647273d2 Mon Sep 17 00:00:00 2001 From: Quitta Date: Thu, 5 Sep 2013 03:29:34 +0200 Subject: [PATCH] show ticket log works + fixed timestamp issue --- .../drupal_module/ryzommanage/config.php | 2 +- .../ryzommanage/func/create_ticket.php | 2 +- .../ryzommanage/inc/show_ticket_log.php | 56 +++++++++++++++++++ .../ryzommanage/ryzommanage.module | 3 + .../ryzommanage/templates/show_ticket.tpl | 2 +- .../ryzommanage/templates/show_ticket_log.tpl | 26 +++++++++ .../ryzommanage/templates/show_user.tpl | 2 +- 7 files changed, 89 insertions(+), 4 deletions(-) create mode 100644 code/ryzom/tools/server/ryzom_ams/drupal_module/ryzommanage/inc/show_ticket_log.php create mode 100644 code/ryzom/tools/server/ryzom_ams/drupal_module/ryzommanage/templates/show_ticket_log.tpl diff --git a/code/ryzom/tools/server/ryzom_ams/drupal_module/ryzommanage/config.php b/code/ryzom/tools/server/ryzom_ams/drupal_module/ryzommanage/config.php index 0037eef30..74651b7fc 100644 --- a/code/ryzom/tools/server/ryzom_ams/drupal_module/ryzommanage/config.php +++ b/code/ryzom/tools/server/ryzom_ams/drupal_module/ryzommanage/config.php @@ -49,7 +49,7 @@ $cfg['mail']['host'] = "ryzomcore.com"; //Defines mailing related stuff $SUPPORT_GROUP_IMAP_CRYPTKEY = "azerty"; -$TICKET_MAILING_SUPPORT = true; +$TICKET_MAILING_SUPPORT = false; //You have to create this dir at first! $MAIL_DIR = "/tmp/mail"; diff --git a/code/ryzom/tools/server/ryzom_ams/drupal_module/ryzommanage/func/create_ticket.php b/code/ryzom/tools/server/ryzom_ams/drupal_module/ryzommanage/func/create_ticket.php index 764bd6931..f50dbdd6a 100644 --- a/code/ryzom/tools/server/ryzom_ams/drupal_module/ryzommanage/func/create_ticket.php +++ b/code/ryzom/tools/server/ryzom_ams/drupal_module/ryzommanage/func/create_ticket.php @@ -19,7 +19,7 @@ function create_ticket(){ $author= Ticket_User::constr_ExternId($_POST['target_id'])->getTUserId(); } $ticket_id = Ticket::create_Ticket($title, $content, $category, $author, unserialize($_SESSION['ticket_user'])->getTUserId(),0, $_POST); - header("Location: index.php?page=show_ticket&id=".$ticket_id); + header("Location: ams?page=show_ticket&id=".$ticket_id); exit; }catch (PDOException $e) { diff --git a/code/ryzom/tools/server/ryzom_ams/drupal_module/ryzommanage/inc/show_ticket_log.php b/code/ryzom/tools/server/ryzom_ams/drupal_module/ryzommanage/inc/show_ticket_log.php new file mode 100644 index 000000000..1974cbc66 --- /dev/null +++ b/code/ryzom/tools/server/ryzom_ams/drupal_module/ryzommanage/inc/show_ticket_log.php @@ -0,0 +1,56 @@ +load_With_TId($result['ticket_id']); + $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){ + $webUser = new WebUsers($log['authorExtern']); + $author = $webUser->getUsername(); + $result['ticket_logs'][$i]['author'] = $author; + $query_backpart = ""; + if($log['action'] == 2){ + $webUser2 = new WebUsers($log['argument']); + $query_backpart = $webUser2->getUsername(); + }else if($log['action'] == 4){ + $query_backpart = "ID#" . $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'] ]; + }else if($log['action'] == 8){ + $query_backpart = "" . Support_Group::getGroup($log['argument'])->getName() . ""; + } + $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(Ticket_User::isMod(unserialize($_SESSION['ticket_user']))){ + $result['isMod'] = "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/drupal_module/ryzommanage/ryzommanage.module b/code/ryzom/tools/server/ryzom_ams/drupal_module/ryzommanage/ryzommanage.module index dbba16531..be5bcbe8c 100644 --- a/code/ryzom/tools/server/ryzom_ams/drupal_module/ryzommanage/ryzommanage.module +++ b/code/ryzom/tools/server/ryzom_ams/drupal_module/ryzommanage/ryzommanage.module @@ -19,6 +19,9 @@ global $SITEBASE; global $AMS_TRANS; global $DEFAULT_LANGUAGE; global $cfg; +global $TICKET_LOGGING; +global $TIME_FORMAT; +global $TICKET_MAILING_SUPPORT; require 'ams_lib/libinclude.php'; spl_autoload_register('__autoload'); diff --git a/code/ryzom/tools/server/ryzom_ams/drupal_module/ryzommanage/templates/show_ticket.tpl b/code/ryzom/tools/server/ryzom_ams/drupal_module/ryzommanage/templates/show_ticket.tpl index be00cfa92..9b83aab09 100644 --- a/code/ryzom/tools/server/ryzom_ams/drupal_module/ryzommanage/templates/show_ticket.tpl +++ b/code/ryzom/tools/server/ryzom_ams/drupal_module/ryzommanage/templates/show_ticket.tpl @@ -86,7 +86,7 @@ Original Submitted: {$ticket_timestamp} Last Updated: {$ticket_lastupdate} - Status: {if $ticket_status neq 3}Open{/if} {$ticket_statustext} + Status: {if $ticket_status neq 3}Open{/if} {$ticket_statustext} Category: {$ticket_category} diff --git a/code/ryzom/tools/server/ryzom_ams/drupal_module/ryzommanage/templates/show_ticket_log.tpl b/code/ryzom/tools/server/ryzom_ams/drupal_module/ryzommanage/templates/show_ticket_log.tpl new file mode 100644 index 000000000..dfd44b11b --- /dev/null +++ b/code/ryzom/tools/server/ryzom_ams/drupal_module/ryzommanage/templates/show_ticket_log.tpl @@ -0,0 +1,26 @@ +{block name=content} + +

Log of Ticket #{$ticket_id}

+ Title: {$ticket_title} + + + + + + + + + + {foreach from=$ticket_logs item=log} + + + + + + {/foreach} + + +
IDTimestampQuery
{$log.tLogId}{$log.timestamp}{$log.query}
+ +{/block} + \ No newline at end of file diff --git a/code/ryzom/tools/server/ryzom_ams/drupal_module/ryzommanage/templates/show_user.tpl b/code/ryzom/tools/server/ryzom_ams/drupal_module/ryzommanage/templates/show_user.tpl index 3c441cb51..0344c11b5 100644 --- a/code/ryzom/tools/server/ryzom_ams/drupal_module/ryzommanage/templates/show_user.tpl +++ b/code/ryzom/tools/server/ryzom_ams/drupal_module/ryzommanage/templates/show_user.tpl @@ -83,7 +83,7 @@ {$ticket.timestamp} {$ticket.category} - {if $ticket.status eq 0} {/if} {$ticket.statusText} + {$ticket.statusText} {/foreach}