Code

Updated regsitration
authorhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Wed, 10 Nov 2010 09:11:50 +0000 (09:11 +0000)
committerhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Wed, 10 Nov 2010 09:11:50 +0000 (09:11 +0000)
git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@20214 594d385d-05f5-0310-b6e9-bd551577e9d8

gosa-core/plugins/generic/dashBoard/Register/class_RegistrationDialog.inc
gosa-core/plugins/generic/statistics/class_statistics.inc
gosa-core/plugins/generic/statistics/statistics.tpl

index c8d0ff71f99abf27f8645e537de307e5a7ca311f..f6add96ccea1a7fb1ed34f5e2922dc32ef0c29b5 100644 (file)
@@ -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;
     }
index 0ee6f35937678f5389664f3a12a0436cc01ba9bc..3caa0f5884580f76be837440f373d5c1779b07f6 100644 (file)
@@ -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)));
index 377d172932f26fb599eb535c3c937ec5e982ba34..42afc4567ad35fc78c503860c4f4095028b26b9e 100644 (file)
@@ -1,9 +1,8 @@
 
 <h3>{t}Usage statistics{/t}</h3>
-{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}
-
     <button type='button' onClick="openPlugin({$dashBoardId});">{t}Dash board{/t}</button>
 
 {else if !$instanceRegistered}
@@ -12,7 +11,7 @@
 
     <button type='button' onClick="openPlugin({$dashBoardId});">{t}Dash board{/t}</button>
 
-{else if !$validRpcHandle || $rpcHandle_Error}
+{else if !$serverAccessible || !$validRpcHandle || $rpcHandle_Error}
 
     {t}Communication with the GOsa-backend failed. Please check the rpc configuration!{/t}