From 9101cd2f6ef0883cbe5b8046fd6e95d6b0be1989 Mon Sep 17 00:00:00 2001 From: Quitta Date: Wed, 4 Sep 2013 17:44:43 +0200 Subject: [PATCH] can display the dashboard html atm --HG-- branch : quitta-gsoc-2013 --- .../drupal_module/ryzommanage/config.php | 4 +- .../ryzommanage/inc/dashboard.php | 35 +++++ .../ryzommanage/ryzommanage.module | 30 ++-- .../ryzommanage/templates/dashboard.tpl | 77 ++++++++++ .../ryzommanage/templates/layout.tpl | 2 + .../ryzommanage/templates/layout_admin.tpl | 2 + .../ryzommanage/templates/layout_mod.tpl | 3 + .../ryzommanage/templates/layout_user.tpl | 1 + .../ryzommanage/templates/show_user.tpl | 142 ++++++++++++++++++ .../drupal_module/ryzommanage/todo.txt | 2 + 10 files changed, 285 insertions(+), 13 deletions(-) create mode 100644 code/ryzom/tools/server/ryzom_ams/drupal_module/ryzommanage/inc/dashboard.php create mode 100644 code/ryzom/tools/server/ryzom_ams/drupal_module/ryzommanage/templates/dashboard.tpl create mode 100644 code/ryzom/tools/server/ryzom_ams/drupal_module/ryzommanage/templates/layout.tpl create mode 100644 code/ryzom/tools/server/ryzom_ams/drupal_module/ryzommanage/templates/layout_admin.tpl create mode 100644 code/ryzom/tools/server/ryzom_ams/drupal_module/ryzommanage/templates/layout_mod.tpl create mode 100644 code/ryzom/tools/server/ryzom_ams/drupal_module/ryzommanage/templates/layout_user.tpl create mode 100644 code/ryzom/tools/server/ryzom_ams/drupal_module/ryzommanage/templates/show_user.tpl create mode 100644 code/ryzom/tools/server/ryzom_ams/drupal_module/ryzommanage/todo.txt 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 a2bf18c20..0037eef30 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 @@ -69,10 +69,10 @@ $ALLOW_UNKNOWN = true ; $CREATE_RING = true ; // site paths definitions -$AMS_LIB = dirname( dirname( __FILE__ ) ) . '/ams_lib'; +$AMS_LIB = dirname( __FILE__ ) . '/ams_lib'; $AMS_TRANS = $AMS_LIB . '/translations'; $AMS_CACHEDIR = $AMS_LIB . '/cache'; -$SITEBASE = dirname( __FILE__ ) . '/html/' ; +$SITEBASE = dirname( __FILE__ ); $WEBPATH ='http://localhost:40917' ; //defines the default language diff --git a/code/ryzom/tools/server/ryzom_ams/drupal_module/ryzommanage/inc/dashboard.php b/code/ryzom/tools/server/ryzom_ams/drupal_module/ryzommanage/inc/dashboard.php new file mode 100644 index 000000000..6d0ef5faf --- /dev/null +++ b/code/ryzom/tools/server/ryzom_ams/drupal_module/ryzommanage/inc/dashboard.php @@ -0,0 +1,35 @@ +getTUserId(); + $result['nrToDo'] = Ticket_Queue_Handler::getNrOfTicketsToDo(unserialize($_SESSION['ticket_user'])->getTUserId()); + $result['nrAssignedWaiting'] = Ticket_Queue_Handler::getNrOfTicketsAssignedWaiting(unserialize($_SESSION['ticket_user'])->getTUserId()); + $result['nrTotalTickets'] = Ticket_Queue_Handler::getNrOfTickets(); + $ticket = Ticket_Queue_Handler::getNewestTicket(); + $result['newestTicketId'] = $ticket->getTId(); + $result['newestTicketTitle'] = $ticket->getTitle(); + $result['newestTicketAuthor'] = Ticket_User::get_username_from_id($ticket->getAuthor()); + 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 e4ff17005..e935828fd 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 @@ -14,6 +14,10 @@ ini_set('display_errors', 'on'); ini_set('display_startup_errors', TRUE); global $TOS_URL; +global $AMS_LIB; +global $SITEBASE; +global $AMS_TRANS; +global $DEFAULT_LANGUAGE; global $cfg; require 'ams_lib/libinclude.php'; @@ -257,7 +261,8 @@ function _ams_handler() } }else{ //default page - $page = 'login'; + header("Location: user/login"); + exit; } }else{ $page = $_GET["page"]; @@ -266,14 +271,17 @@ function _ams_handler() //perform an action in case one is specified //else check if a php page is included in the inc folder, else just set page to the get param if ( isset( $_POST["function"] ) ){ - require( "func/" . $_POST["function"] . ".php" ); - $return = $_POST["function"](); + $filename = dirname( __FILE__ ).'/func/' . $_POST["function"] . '.php'; + if(is_file($filename)){ + require($filename); + $return = $_POST["function"](); + } }else{ - $filename = 'inc/' . $page . '.php'; - if(is_file($filename)){ - require_once($filename); - $return = $page(); - } + $filename = dirname( __FILE__ ).'/inc/' . $page . '.php'; + if(is_file($filename)){ + require_once($filename); + $return = $page(); + } } //add username to the return array in case logged in. @@ -295,8 +303,8 @@ function _ams_handler() $return['no_visible_elements'] = 'FALSE'; } - return $page; - //helpers :: loadTemplate( $page , $return ); + //return $page; + return helpers :: loadTemplate( $page , $return, true); } @@ -341,7 +349,7 @@ function _collect_login($nids, $collection) //handle successful ingame login $_SESSION['user'] = $result['name']; $_SESSION['id'] = WebUsers::getId($result['name']); - $_SESSION['ticket_user'] = Ticket_User::constr_ExternId($_SESSION['id']); + $_SESSION['ticket_user'] = serialize(Ticket_User::constr_ExternId($_SESSION['id'])); if ($account = user_load( $_SESSION['id'])) { global $user; diff --git a/code/ryzom/tools/server/ryzom_ams/drupal_module/ryzommanage/templates/dashboard.tpl b/code/ryzom/tools/server/ryzom_ams/drupal_module/ryzommanage/templates/dashboard.tpl new file mode 100644 index 000000000..ea53b1665 --- /dev/null +++ b/code/ryzom/tools/server/ryzom_ams/drupal_module/ryzommanage/templates/dashboard.tpl @@ -0,0 +1,77 @@ +{block name=content} + + + + + + + + + + + +
+ +
Tickets Waiting for Direct Action: + {$nrAssignedWaiting}
+
+
+ +
Tickets Todo: + {$nrToDo}
+
+
+ + +
Newest Ticket: + {$newestTicketTitle}
+
+
+ + +
Total amount of Tickets: + {$nrTotalTickets}
+
+
+ +
+
+
+

{$home_title}

+
+ + + + +
+
+
+

{$home_info}

+

This is the GSOC project of Daan Janssens mentored by Matthew Lagoe.

+

The features as admin covered in this project are:

+
    +
  • Manage user accounts
  • +
  • Make users moderator or admin
  • +
  • browse user's tickets
  • +
  • Create a new ticket for a specific user as admin
  • +
  • Create a new support group (and link an email to it)
  • +
  • Add mods to support groups
  • +
  • Assign ticket to you
  • +
  • Forward ticket to a support group
  • +
  • Add hidden messages to a ticket only viewable by other mods
  • +
  • Browse ticket queues or create one dynamically
  • +
  • Sync changes after the game server is back up after being down for a while
  • +
  • Browse the log of a ticket
  • +
  • Browse additional info sent along when a ticket is created ingame
  • +
  • All the above can be done while ingame too
  • +
+ +
+
+
+
+ + +{/block} + diff --git a/code/ryzom/tools/server/ryzom_ams/drupal_module/ryzommanage/templates/layout.tpl b/code/ryzom/tools/server/ryzom_ams/drupal_module/ryzommanage/templates/layout.tpl new file mode 100644 index 000000000..f889a43a6 --- /dev/null +++ b/code/ryzom/tools/server/ryzom_ams/drupal_module/ryzommanage/templates/layout.tpl @@ -0,0 +1,2 @@ +{block name=content}{/block} + \ No newline at end of file diff --git a/code/ryzom/tools/server/ryzom_ams/drupal_module/ryzommanage/templates/layout_admin.tpl b/code/ryzom/tools/server/ryzom_ams/drupal_module/ryzommanage/templates/layout_admin.tpl new file mode 100644 index 000000000..881ccb18a --- /dev/null +++ b/code/ryzom/tools/server/ryzom_ams/drupal_module/ryzommanage/templates/layout_admin.tpl @@ -0,0 +1,2 @@ +{extends file="layout.tpl"} + diff --git a/code/ryzom/tools/server/ryzom_ams/drupal_module/ryzommanage/templates/layout_mod.tpl b/code/ryzom/tools/server/ryzom_ams/drupal_module/ryzommanage/templates/layout_mod.tpl new file mode 100644 index 000000000..c5ed6c10b --- /dev/null +++ b/code/ryzom/tools/server/ryzom_ams/drupal_module/ryzommanage/templates/layout_mod.tpl @@ -0,0 +1,3 @@ +{extends file="layout.tpl"} + + diff --git a/code/ryzom/tools/server/ryzom_ams/drupal_module/ryzommanage/templates/layout_user.tpl b/code/ryzom/tools/server/ryzom_ams/drupal_module/ryzommanage/templates/layout_user.tpl new file mode 100644 index 000000000..62185e613 --- /dev/null +++ b/code/ryzom/tools/server/ryzom_ams/drupal_module/ryzommanage/templates/layout_user.tpl @@ -0,0 +1 @@ +{extends file="layout.tpl"} 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 new file mode 100644 index 000000000..91bdc683f --- /dev/null +++ b/code/ryzom/tools/server/ryzom_ams/drupal_module/ryzommanage/templates/show_user.tpl @@ -0,0 +1,142 @@ +{block name=content} +
+
+
+

Profile of {$target_name}

+
+ + +
+
+
+
+ Info + + + + + + + + + + + + {if $firstName neq ""} + + + + + {/if} + {if $lastName neq ""} + + + + + {/if} + {if $country neq ""} + + + + + {/if} + {if $gender neq 0} + + + {if $gender eq 1} + + {else if $gender eq 2} + + {/if} + + {/if} + +
Email:{$mail}
Role: + {if $userPermission eq 1}User{/if} + {if $userPermission eq 2}Moderator{/if} + {if $userPermission eq 3}Admin{/if} +
Firstname:{$firstName}
LastName:{$lastName}
Country:{$country}
Gender:
+
+
+
+ +
+
+

Actions

+
+ + +
+
+
+
+
+ + +
+
+
+
+
+ +
+
+
+

Tickets of {$target_name}

+
+ + +
+
+
+
+ Tickets + + + + + + + + + + + + {foreach from=$ticketlist item=ticket} + + + + + + + + + {/foreach} + + +
IDTitleTimestampCategoryStatus
{$ticket.tId}{$ticket.title}{$ticket.timestamp}{$ticket.category}{if $ticket.status eq 0} {/if} {$ticket.statusText}
+
+
+
+
+{/block} + diff --git a/code/ryzom/tools/server/ryzom_ams/drupal_module/ryzommanage/todo.txt b/code/ryzom/tools/server/ryzom_ams/drupal_module/ryzommanage/todo.txt new file mode 100644 index 000000000..539cf76cd --- /dev/null +++ b/code/ryzom/tools/server/ryzom_ams/drupal_module/ryzommanage/todo.txt @@ -0,0 +1,2 @@ +-Remove full path in autoload functions +-Make Permission www dependend, so it can be implemented in drupal with hook_permission(); \ No newline at end of file