summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 5a9f2e4)
raw | patch | inline | side by side (parent: 5a9f2e4)
author | hickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8> | |
Tue, 28 Sep 2010 13:08:41 +0000 (13:08 +0000) | ||
committer | hickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8> | |
Tue, 28 Sep 2010 13:08:41 +0000 (13:08 +0000) |
git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@19834 594d385d-05f5-0310-b6e9-bd551577e9d8
gosa-plugins/goto/admin/systems/goto/Config/class_DeviceConfig.inc | 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 41b38e42de3b7e84e8f9c74d7ad1447ec9ec1d05..6ccca5b9c3da06fba3e16658cf45e8bf409fed1f 100644 (file)
// Set storage points - We do not have any - We just create a fake list which lists all items
$this->storagePoints = array("");
- $this->itemContainerSelector = new releaseSelector(array('cn=root'=>''), 'cn=root', 'cn=root');
$this->base = "cn=root";
// CREATE Dummy entry
$this->rebuildListing();
$filter = $this->getFilter();
$headpage = $this->getHeadpage();
- $this->itemContainerSelector->update();
+
$headpage->update();
$smarty = get_smarty();
$smarty->assign("RELEASE", $this->itemContainerSelector->render());
/*! \brief Build up a list of items useable for the itemSelector.
*/
- function getContainerList($array = NULL, $base = "")
+ function getContainerList($array = NULL)
{
$array = ($array == NULL)?$this->currentItemValues['root']: $array;
- $ret = array('cn=root' => '');
- $name = $array['name'];
- $ret["cn={$name}{$base}"] = $array['type'];
+ $ret[$array['base']] = $array['type'];
if(count($array['children'])){
- $base = ",cn={$name}{$base}";
foreach($array['children'] as $subItem){
- $ret = array_merge($ret, $this->getContainerList($subItem, $base));
+ $ret = array_merge($ret, $this->getContainerList($subItem));
}
}
return($ret);
function rebuildListing()
{
// Collect item container list to be able to render the fake-base selector
- $this->itemContainerSelector->setBases($this->getContainerList());
+ if(!$this->itemContainerSelector){
+ $this->itemContainerSelector = new releaseSelector($this->getContainerList(), $this->base, 'cn=root');
+ }else{
+ $this->itemContainerSelector->setBases($this->getContainerList());
+ }
$this->itemContainerSelector->update(true);
$this->itemContainerSelector->setBase($this->base);
}
-
- /*! \brief Prepares an item list which can then be used in
- * sortableListings to display the items of this configuration.
- * @return Array Containing 'data' and 'lData' for a sortableListing.
- */
- function getItemList($array=NULL,&$res = NULL, $depth = 0)
- {
- // Prepare values.
- $array = ($array == NULL)? $this->currentItemValues['root']: $array;
- if(!$res){
- $res = array('data' => array(), 'lData' => array());
- }
-
- // Prepare the entry name
- $str = $array['name'];
- if($this->currentItemName == $array['name']){
- $str = "<b>".$array['name']."</b>";
- }
- $add = ' ';
- $str = str_pad('', ($depth*strlen($add)), $add, STR_PAD_LEFT).$str;
-
- // Add the current entry
- $res['data'][] = $array;
- $res['lData'][] = array('data' => array($str, "<i>".$array['type']."</i>"));
-
- // Add sub-entries
- if(count($array['children'])){
- $depth ++;
- foreach($array['children'] as $subItem){
- $this->getItemList($subItem, $res, $depth);
- }
- }
-
- return($res);
- }
-
-
/*! \brief Add a new child-item to the currently selected one.
*
* @param String type The 'type' of the new object, eg. 'KickstartTemplate'
$current = &$this->currentItem;
$this->idToName[] = $name;
+
+ $base = (isset($current['base']))? ",".$current['base'] : '';
+
$new = array(
+ 'base' => "cn={$name}{$base}",
'children' => array(),
'type' => $type,
'name' => $name,
$this->currentItem['values'][$widget->getName()] = $widget->getValue();
}
}
-
+
// Set the new item info.
$this->currentItemName = $item;
$this->currentItem = &$this->currentItemValues[$item];
$this->currentItemType = $this->currentItem['type'];
$this->currentItemDescriptor =&$this->itemConfig[$this->currentItem['type']];
+ $this->base = $this->currentItem['base'];
+
// Update the template engine to use another type of item and
// some other values.
$this->TemplateEngine->setValues($this->currentItemType,$this->currentItem['values']);
}
-
-
/*! \brief Renders the HTML content for the device-config plugin.
* @return String The generated HTML code.
*/
// Get selected Items
$this->itemContainerSelector->update();
$this->base = $this->itemContainerSelector->getBase();
- $list = preg_split("/[,]*cn=/", $this->base,0,PREG_SPLIT_NO_EMPTY);
- $this->setCurrentItem($list[0]);
+ $itemName = "";
+ foreach($this->currentItemValues as $item){
+ if($item['base'] == $this->base){
+ $this->setCurrentItem($item['name']);
+ break;
+ }
+ }
+
}
/*! \brief Forward plugin acls