summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 6b7bfc1)
raw | patch | inline | side by side (parent: 6b7bfc1)
author | hickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8> | |
Thu, 7 Oct 2010 07:40:55 +0000 (07:40 +0000) | ||
committer | hickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8> | |
Thu, 7 Oct 2010 07:40:55 +0000 (07:40 +0000) |
-Fixed problems with item configration loading
git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@19929 594d385d-05f5-0310-b6e9-bd551577e9d8
git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@19929 594d385d-05f5-0310-b6e9-bd551577e9d8
gosa-plugins/goto/admin/systems/goto/Config/class_DeviceConfig.inc | patch | blob | history | |
gosa-plugins/goto/admin/systems/goto/Config/failed.tpl | patch | blob | history |
diff --git a/gosa-plugins/goto/admin/systems/goto/Config/class_DeviceConfig.inc b/gosa-plugins/goto/admin/systems/goto/Config/class_DeviceConfig.inc
index 0455eac7cb028c571cc7ebf3ff07353fab50519b..19f1a37b3b13b1682df02dfb83abe3ec157f0201 100644 (file)
private $mappingBaseToID = array();
private $rootItemID;
+ private $itemConfig = array();
private $lastItemID = 1;
private $rpcError = FALSE;
private $initFailed = FALSE;
+ private $invalidInstallMethod = FALSE;
private $errorMessage = "";
// Some plugin related memebers which are not member of
// Try to initialize
$this->init();
+ $this->rebuildListing();
}
function setInstallMethod($str)
{
+ $this->is_account = FALSE;
if(!isset($this->allItemConfigurations[$str])){
trigger_error("Invalid install method '{$str}'!");
+ $this->itemConfig = array();
+ $this->invalidInstallMethod =TRUE;
+ $this->errorMessage = sprintf(_("Invalid installation method selected '%s'!"), $str);
}else{
+
$this->itemConfig = $this->allItemConfigurations[$str]['items'];
+ $this->invalidInstallMethod =FALSE;
+
+ // Load the template
+ $this->TemplateEngine->load($this->itemConfig);
+
+ // Detect root item, its name is /
+ $root = NULL;
+ foreach($this->itemConfig as $key => $item){
+ if($item['name'] == '/') {
+ $root = $key;
+ break;
+ }
+ }
+ if(!$root){
+ $this->errorMessage = _("No valid install methods returned, missing root object!");
+ msg_dialog::display(_("Setup"), $this->errorMessage , ERROR_DIALOG);
+ $this->initFailed = TRUE;
+ $this->itemConfig = array();
+ return;
+ }
+
+ // Set current item to 'root', this is the minimum to get things running.
+ $idRoot = $this->addItem($root,'root',array());
+ $this->rootItemID = $idRoot;
+ $this->setCurrentItem($idRoot);
+ $this->setSelectedListItemID($idRoot);
+ $this->is_account = TRUE;
+ $this->rebuildListing();
}
}
$this->initFailed = TRUE;
return;
}
-
- // As default select the first entry
- $this->setInstallMethod(key($this->allItemConfigurations));
-
- // Load the template
- $this->TemplateEngine->load($this->itemConfig);
-
- // Detect root item, its name is /
- $root = NULL;
- foreach($this->itemConfig as $key => $item){
- if($item['name'] == '/') {
- $root = $key;
- break;
- }
- }
- if(!$root){
- $this->errorMessage = _("No valid install methods returned, missing root object!");
- msg_dialog::display(_("Setup"), $this->errorMessage , ERROR_DIALOG);
- $this->initFailed = TRUE;
- return;
- }
-
- $this->is_account = TRUE;
-
- // Set current item to 'root', this is the minimum to get things running.
- $idRoot = $this->addItem($root,'root',array());
- $this->rootItemID = $idRoot;
- $this->setCurrentItem($idRoot);
- $this->setSelectedListItemID($idRoot);
-
- // Add some dummy entries for testing.
- $id = $this->addItem('PuppetModule','test1',
- array(
- 'dependency' => array('stulle','Wurst'),
- 'version' => '2.4-f',
- 'name' => 'Thundebird',
- 'description' => 'Mozilla mail client')
- );
- $id = $this->addItem('PuppetModule','test2',
- array(
- 'dependency' => array('Leipnitz','Dose'),
- 'version' => 1,
- 'name' => 'Firefox',
- 'description' => 'Test Module')
- );
- $this->setCurrentItem($id);
- $id = $this->addItem('PuppetTemplate','temp1',
- array(
- 'name' => 'temp1',
- 'data' => 'kekse.tpl')
- );
- $this->setCurrentItem($id);
- $id = $this->addItem('PuppetTemplate','tep1',
- array(
- 'name' => 'tep1',
- 'data' => 'kekse.tpl')
- );
-
- $this->setCurrentItem($idRoot);
- $this->rebuildListing();
}
function renderList()
{
// In case of an error abort here.
- if($this->rpcError){
+ if($this->rpcError || $this->initFailed || $this->invalidInstallMethod){
$smarty = get_smarty();
$smarty->assign('initFailed', $this->initFailed);
$smarty->assign('rpcError', $this->rpcError);
+ $smarty->assign('invalidInstallMethod', $this->invalidInstallMethod);
$smarty->assign('error', $this->errorMessage);
return($smarty->fetch(get_template_path('goto/Config/failed.tpl', TRUE)));
}
}
// Get the selected item-id from the item list and populate it.
- $this->itemContainerSelector->update();
- $id = $this->mappingBaseToID[$this->itemContainerSelector->getBase()];
- $this->setSelectedListItemID($id);
+ if($this->itemContainerSelector){
+ $this->itemContainerSelector->update();
+ $id = $this->mappingBaseToID[$this->itemContainerSelector->getBase()];
+ $this->setSelectedListItemID($id);
+ }
}
{
return(array());
}
+
+ function getRootItemId()
+ {
+ return($this->rootItemID);
+ }
}
?>
diff --git a/gosa-plugins/goto/admin/systems/goto/Config/failed.tpl b/gosa-plugins/goto/admin/systems/goto/Config/failed.tpl
index fa91207c04695619546ba19e45edb7edac301446..6a65bc3981cc62d8d9bb07a34af3b0257e6ae47b 100644 (file)
<h3>{t}Communication failed{/t}</h3>
{msgPool type=rpcError p1=$error}
<button name='retryInit'>{t}Retry{/t}</button>
+{elseif $invalidInstallMethod}
+ <h3>{t}Configuration error {/t}</h3>
+ {msgPool type=rpcError p1=$error}
{/if}