From 3d61015b63e1ce3bb2e2e08413a34b9601e262e8 Mon Sep 17 00:00:00 2001 From: hickert Date: Wed, 10 Nov 2010 07:27:55 +0000 Subject: [PATCH] Updated registration process - git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@20212 594d385d-05f5-0310-b6e9-bd551577e9d8 --- .../Register/class_RegistrationDialog.inc | 19 ++-- .../generic/dashBoard/class_dashBoard.inc | 75 +++++++++----- .../plugins/generic/dashBoard/dashBoard.tpl | 97 ++++++++++--------- 3 files changed, 116 insertions(+), 75 deletions(-) diff --git a/gosa-core/plugins/generic/dashBoard/Register/class_RegistrationDialog.inc b/gosa-core/plugins/generic/dashBoard/Register/class_RegistrationDialog.inc index be319f2f1..c8d0ff71f 100644 --- a/gosa-core/plugins/generic/dashBoard/Register/class_RegistrationDialog.inc +++ b/gosa-core/plugins/generic/dashBoard/Register/class_RegistrationDialog.inc @@ -36,6 +36,15 @@ 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(); @@ -59,6 +68,9 @@ class RegistrationDialog extends plugin } }else{ $this->step = 2; + $prop = $this->config->configRegistry->getProperty('GOsaRegistration','askForRegistration'); + $prop->setValue(0); + $prop->save(); } } } @@ -83,13 +95,6 @@ class RegistrationDialog extends plugin if(isset($_POST['startRegistration'])) $this->step = 1; if(isset($_POST['registerComplete'])){ $this->finished = TRUE; - - // Tell GOsa not to ask for a regsitration again. - 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/dashBoard/class_dashBoard.inc b/gosa-core/plugins/generic/dashBoard/class_dashBoard.inc index acec1156b..0289b8bca 100644 --- a/gosa-core/plugins/generic/dashBoard/class_dashBoard.inc +++ b/gosa-core/plugins/generic/dashBoard/class_dashBoard.inc @@ -16,22 +16,35 @@ class dashBoard extends plugin { plugin::plugin($config, NULL); - // Instantiate child classes - $this->dbPluginStatus = new dbPluginStatus($config); - $this->dbChannelStatus = new dbChannelStatus($config); - $this->dbNotifications = new dbNotifications($config); - $this->dbInformation = new dbInformation($config); - // Check if we've access to the registration server if($this->config->registration->registrationRequired() && $config->registration->isServerAccessible()){ if(!$config->registration->isInstanceRegistered()){ $this->dialog = new RegistrationDialog($config); } } + + $this->initialized = FALSE; + } + + function init() + { + // Instantiate child classes + if($this->config->registration->isInstanceRegistered()){ + $this->dbPluginStatus = new dbPluginStatus($config); + $this->dbChannelStatus = new dbChannelStatus($config); + $this->dbNotifications = new dbNotifications($config); + $this->dbInformation = new dbInformation($config); + $this->initialized = TRUE; + } } function execute() { + // The wants to registrate his instance of GOsa now! + if(isset($_POST['registerNow']) && $this->config->registration->isServerAccessible()){ + $this->dialog = new RegistrationDialog($this->config); + } + // Seems that we haven't registered our GOsa instance yet. // Ask the user to do so, now. if($this->dialog instanceOf RegistrationDialog){ @@ -44,21 +57,31 @@ class dashBoard extends plugin } } + $this->init(); + $smarty = get_smarty(); - $smarty->assign('dbPluginStatus', $this->dbPluginStatus->execute()); - $smarty->assign('dbChannelStatus', $this->dbChannelStatus->execute()); - $smarty->assign('dbNotifications', $this->dbNotifications->execute()); - $smarty->assign('dbInformation', $this->dbInformation->execute()); + $smarty->assign('instanceRegistered', $this->config->registration->isInstanceRegistered()); + $smarty->assign('registrationServerAvailable', $this->config->registration->isServerAccessible()); + + if($this->initialized){ + $smarty->assign('dbPluginStatus', $this->dbPluginStatus->execute()); + $smarty->assign('dbChannelStatus', $this->dbChannelStatus->execute()); + $smarty->assign('dbNotifications', $this->dbNotifications->execute()); + $smarty->assign('dbInformation', $this->dbInformation->execute()); + } return($smarty->fetch(get_template_path('dashBoard.tpl', TRUE))); } function check() { $messages = plugin::check(); - $messages = array_merge($this->dbPluginStatus->check()); - $messages = array_merge($this->dbChannelStatus->check()); - $messages = array_merge($this->dbNotifications->check()); - $messages = array_merge($this->dbInformation->check()); + + if($this->initialized){ + $messages = array_merge($this->dbPluginStatus->check()); + $messages = array_merge($this->dbChannelStatus->check()); + $messages = array_merge($this->dbNotifications->check()); + $messages = array_merge($this->dbInformation->check()); + } return($messages); } @@ -68,8 +91,8 @@ class dashBoard extends plugin if($this->dialog instanceOf RegistrationDialog){ $this->dialog->save_object(); - }else{ - + } + if($this->initialized){ $this->dbPluginStatus->save_object(); $this->dbChannelStatus->save_object(); $this->dbNotifications->save_object(); @@ -80,19 +103,23 @@ class dashBoard extends plugin function save() { plugin::save(); - $this->dbPluginStatus->save(); - $this->dbChannelStatus->save(); - $this->dbNotifications->save(); - $this->dbInformation->save(); + if($this->initialized){ + $this->dbPluginStatus->save(); + $this->dbChannelStatus->save(); + $this->dbNotifications->save(); + $this->dbInformation->save(); + } } function remove_from_parent() { plugin::remove_from_parent(); - $this->dbPluginStatus->remove_from_parent(); - $this->dbChannelStatus->remove_from_parent(); - $this->dbNotifications->remove_from_parent(); - $this->dbInformation->remove_from_parent(); + if($this->initialized){ + $this->dbPluginStatus->remove_from_parent(); + $this->dbChannelStatus->remove_from_parent(); + $this->dbNotifications->remove_from_parent(); + $this->dbInformation->remove_from_parent(); + } } } diff --git a/gosa-core/plugins/generic/dashBoard/dashBoard.tpl b/gosa-core/plugins/generic/dashBoard/dashBoard.tpl index 018f19f94..972f31679 100644 --- a/gosa-core/plugins/generic/dashBoard/dashBoard.tpl +++ b/gosa-core/plugins/generic/dashBoard/dashBoard.tpl @@ -1,44 +1,53 @@ - - - - - - - - - - - -
- - - - {$dbChannelStatus} - - - - - - - - {$dbPluginStatus} - - - -

- - - - {$dbNotifications} - - - - - - - - {$dbInformation} - - - -
+{if !$instanceRegistered} +

{t}This feature is only accessible for registrated instances of GOsa{/t}

+ + {if $registrationServerAvailable} + + {else} + {t}Unfortunately the registration server cannot be reached, maybe the server is down for maintaince or you've no internet access!{/t} + {/if} +{else} + + + + + + + + + + +
+ + + + {$dbChannelStatus} + + + + + + + + {$dbPluginStatus} + + + +

+ + + + {$dbNotifications} + + + + + + + + {$dbInformation} + + + +
+{/if} -- 2.30.2