From e02459fd6f44d862274628d82f80fc01f22fdfb7 Mon Sep 17 00:00:00 2001 From: hickert Date: Wed, 10 Nov 2010 09:11:50 +0000 Subject: [PATCH] Updated regsitration git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@20214 594d385d-05f5-0310-b6e9-bd551577e9d8 --- .../Register/class_RegistrationDialog.inc | 16 ++++--- .../generic/statistics/class_statistics.inc | 42 ++++++++++++------- .../plugins/generic/statistics/statistics.tpl | 7 ++-- 3 files changed, 38 insertions(+), 27 deletions(-) diff --git a/gosa-core/plugins/generic/dashBoard/Register/class_RegistrationDialog.inc b/gosa-core/plugins/generic/dashBoard/Register/class_RegistrationDialog.inc index c8d0ff71f..f6add96cc 100644 --- a/gosa-core/plugins/generic/dashBoard/Register/class_RegistrationDialog.inc +++ b/gosa-core/plugins/generic/dashBoard/Register/class_RegistrationDialog.inc @@ -36,15 +36,6 @@ class RegistrationDialog extends plugin $smarty = get_smarty(); $smarty->assign("error", ""); - // Tell GOsa not to ask for a regsitration again. - if(isset($_POST['registerComplete'])){ - if($this->selectedRegistrationType == "dontWant"){ - $prop = $this->config->configRegistry->getProperty('GOsaRegistration','askForRegistration'); - $prop->setValue(-1); - $prop->save(); - } - } - // Registration page one filled in, next step requested. if(isset($_POST['registerPage1'])){ $msgs = $this->check(); @@ -93,8 +84,15 @@ class RegistrationDialog extends plugin // Registration type selected and next page choosen. if(isset($_POST['startRegistration'])) $this->step = 1; + + // Tell GOsa not to ask for a regsitration again. if(isset($_POST['registerComplete'])){ $this->finished = TRUE; + if($this->selectedRegistrationType == "dontWant"){ + $prop = $this->config->configRegistry->getProperty('GOsaRegistration','askForRegistration'); + $prop->setValue(-1); + $prop->save(); + } } if(isset($_POST['stepBack'])) $this->step -= 1; } diff --git a/gosa-core/plugins/generic/statistics/class_statistics.inc b/gosa-core/plugins/generic/statistics/class_statistics.inc index 0ee6f3593..3caa0f588 100644 --- a/gosa-core/plugins/generic/statistics/class_statistics.inc +++ b/gosa-core/plugins/generic/statistics/class_statistics.inc @@ -28,26 +28,33 @@ class statistics extends plugin var $serverAccessible = FALSE; var $instanceRegistered = FALSE; + var $registrationNotWanted = FALSE; + + var $initialized = FALSE; function __construct($config) { plugin::plugin($config, NULL); + } + function init() + { // Detect registration status first - $this->serverAccessible = $config->registration->isServerAccessible(); + $this->serverAccessible = $this->config->registration->isServerAccessible(); + $this->registrationNotWanted = $this->config->registration->registrationNotWanted(); $this->instanceRegistered = $this->config->registration->isInstanceRegistered(); + if($this->instanceRegistered){ + $this->graphs[] = new categoryActionsOverTime($this->config); + $this->graphs[] = new memoryUsageChart($this->config); + $this->graphs[] = new cpuLoadChart($this->config); + $this->graphs[] = new renderTimeChart($this->config); + $this->graphs[] = new durationTimeChart($this->config); + $this->graphs[] = new objectCountChart($this->config); + $this->graphs[] = new actionSelectChart($this->config); + $this->graphs[] = new passwordChangeChart($this->config); + $this->staticChart1 = new pieChart1($this->config); + $this->staticChart2 = new pieChart2($this->config); - if(!$this->serverAccessible || !$this->instanceRegistered){ - $this->graphs[] = new categoryActionsOverTime($config); - $this->graphs[] = new memoryUsageChart($config); - $this->graphs[] = new cpuLoadChart($config); - $this->graphs[] = new renderTimeChart($config); - $this->graphs[] = new durationTimeChart($config); - $this->graphs[] = new objectCountChart($config); - $this->graphs[] = new actionSelectChart($config); - $this->graphs[] = new passwordChangeChart($config); - $this->staticChart1 = new pieChart1($config); - $this->staticChart2 = new pieChart2($config); // Init start and stop times for graph 1 $this->graph1DatePicker1 = date('d.m.Y', time() - 28 * 24 * 60 *60); @@ -63,6 +70,7 @@ class statistics extends plugin "WyukwauWoid2", TRUE); } + $this->initialized = TRUE; } } @@ -138,14 +146,20 @@ class statistics extends plugin function execute() { + + if(!$this->initialized) $this->init(); + $smarty = get_smarty(); // Check registration status, we need at least 'registered'. $smarty->assign("instanceRegistered", $this->instanceRegistered); $smarty->assign("serverAccessible", $this->serverAccessible); - if(!$this->serverAccessible || !$this->instanceRegistered){ + $smarty->assign("registrationNotWanted", $this->registrationNotWanted); + + // If we have an unregistered instance of GOsa, display a message which + // allows to registrate GOsa + if(!$this->instanceRegistered){ $plist = session::get('plist'); - $id = array_search('dashBoard', $plist->pluginList); $smarty->assign('dashBoardId', $id); return($smarty->fetch(get_template_path('statistics.tpl', TRUE))); diff --git a/gosa-core/plugins/generic/statistics/statistics.tpl b/gosa-core/plugins/generic/statistics/statistics.tpl index 377d17293..42afc4567 100644 --- a/gosa-core/plugins/generic/statistics/statistics.tpl +++ b/gosa-core/plugins/generic/statistics/statistics.tpl @@ -1,9 +1,8 @@

{t}Usage statistics{/t}

-{if !$serverAccessible} - +{if $registrationNotWanted} + {t}This feature is disabled. To enable it you have to register GOsa, you can initiate a registration using the dash-board plugin.{/t} - {else if !$instanceRegistered} @@ -12,7 +11,7 @@ -{else if !$validRpcHandle || $rpcHandle_Error} +{else if !$serverAccessible || !$validRpcHandle || $rpcHandle_Error} {t}Communication with the GOsa-backend failed. Please check the rpc configuration!{/t} -- 2.30.2