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} + + +
{$home_info}
+This is the GSOC project of Daan Janssens mentored by Matthew Lagoe.
+The features as admin covered in this project are:
+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: | + {if $gender eq 1} +♂ | + {else if $gender eq 2} +♀ | + {/if} +
ID | +Title | +Timestamp | +Category | +Status | +
---|---|---|---|---|
{$ticket.tId} | +{$ticket.title} | +{$ticket.timestamp} | +{$ticket.category} | + +{if $ticket.status eq 0} {/if} {$ticket.statusText} | +