summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: c762a33)
raw | patch | inline | side by side (parent: c762a33)
author | hickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8> | |
Tue, 19 Apr 2011 13:42:55 +0000 (13:42 +0000) | ||
committer | hickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8> | |
Tue, 19 Apr 2011 13:42:55 +0000 (13:42 +0000) |
git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@20750 594d385d-05f5-0310-b6e9-bd551577e9d8
gosa-plugins/goto-ng/admin/newConfigManagement/class_newConfigManagement.inc | patch | blob | history | |
gosa-plugins/goto-ng/admin/newConfigManagement/rpcError.tpl | [new file with mode: 0644] | patch | blob |
diff --git a/gosa-plugins/goto-ng/admin/newConfigManagement/class_newConfigManagement.inc b/gosa-plugins/goto-ng/admin/newConfigManagement/class_newConfigManagement.inc
index 8ef7d6a9edb3d86da2cdd61418c0039d1288c86a..aa241cd32847faea3a8e471cb71c5c39cefa4716 100644 (file)
var $currentObject = NULL;
var $itemsPerMethod = NULL;
+
+ var $initFailed = TRUE;
+ var $initialized = FALSE;
+ var $errorMessage = "";
+
/*! \brief Initialize the plugin and finally update the data model.
*/
function __construct($config, $dn)
$this->installationMethods['root']['items']['Distribution'] = &$items['Distribution'];
$this->installationMethods['root']['items']['Release'] = &$items['Release'];
$this->installationMethods['root']['items']['root'] = &$items['root'];
+ }
- // Request an update of the data model
- $this->loadInstallationMethods();
- $this->updateDataModel();
- $this->listing->setListingTypes($this->getListingTypes());
+
+ function init()
+ {
+ $success = TRUE;
+ $success &= $this->loadInstallationMethods();
+ $success &= $this->updateDataModel();
+ $this->initFailed = !$success;
+ if($success){
+ $this->initialized = TRUE;
+ $this->listing->setListingTypes($this->getListingTypes());
+ }
}
*/
function loadInstallationMethods()
{
- // Reset erros
- $this->rpcError = $this->initFailed = FALSE;
-
// Load configuration via rpc.
$rpc = $this->config->getRpcHandle();
$res = $rpc->getSupportedInstallMethods();
if(!$rpc->success()){
- $this->rpcError = TRUE;
$this->errorMessage = $rpc->get_error();;
- return;
+ return(FALSE);
}
// Populate install methods on success.
if(!count($res)){
$this->errorMessage = _("No selectable install methods returned!");
- msg_dialog::display(_("Setup"), $this->errorMessage , ERROR_DIALOG);
- $this->initFailed = TRUE;
- return;
+ return(FALSE);
}else{
// Merge result with hard coded methods
}
}
}
+ return(TRUE);
}
$rpc = $this->config->getRpcHandle();
$res = $rpc->getDistributions();
if(!$rpc->success()){
- msg_dialog::display(_("Error"), sprintf(_("Failed to load distributions: %s"), $rpc->get_error()),ERROR_DIALOG);
- return(NULL);
+ $this->errorMessage = sprintf(_("Failed to load distributions: %s"), $rpc->get_error());
+ return(FALSE);
}else{
foreach($res as $dist){
$this->dataModel->addItem('Distribution','/root', $dist['name'], $dist);
}
}
}
+ return(TRUE);
}
// Only releases can contain config-items.
if($data['type'] == 'Release' && $data['status'] != "fetched"){
-
// Request all config items for the selected release via rpc.
$rpc = $this->config->getRpcHandle();
$releasePath = $this->getReleasePart($path);
$res = $rpc->listConfigItems($releasePath);
if(!$rpc->success()){
msg_dialog::display(_("Error"),sprintf(_("Failed to load distributions: %s"),$rpc->get_error()),ERROR_DIALOG);
+ return;
}else{
if(!$res) return;
*/
function setCurrentContainer($cont)
{
+ // Do nothing while the service wasn't initialized.
+ if(!$this->initialized) return;
+
$this->selectedContainer = $cont;
// Update list of items within the selected container.
*/
function execute()
{
- // Get the selected release and store it in a session variable
- // to allow the configFilter to access it and display the
- // packages and items.
- $res = $this->listing->execute();
- $this->listing->setListingTypes($this->getListingTypes());
- return($res);
+ // Request an update of the data model
+ if(!$this->initialized){
+ $this->init();
+ }
+
+ // Act on init fails
+ if($this->initFailed){
+ $smarty = get_smarty();
+ $smarty->assign('error', $this->errorMessage);
+ return($smarty->fetch(get_template_path('rpcError.tpl', TRUE)));
+ }else{
+
+ // Get the selected release and store it in a session variable
+ // to allow the configFilter to access it and display the
+ // packages and items.
+ $res = $this->listing->execute();
+ $this->listing->setListingTypes($this->getListingTypes());
+ return($res);
+ }
}
diff --git a/gosa-plugins/goto-ng/admin/newConfigManagement/rpcError.tpl b/gosa-plugins/goto-ng/admin/newConfigManagement/rpcError.tpl
--- /dev/null
@@ -0,0 +1,8 @@
+<h3>{t}Communication with backend failed, please check the rpc connection and try again!{/t}</h3>
+
+<p>
+ {$error}
+</p>
+
+<hr>
+<button type='submit' name='retry_rpc'>{t}retry{/t}</button>