summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: e95a829)
raw | patch | inline | side by side (parent: e95a829)
author | hickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8> | |
Wed, 1 Dec 2010 14:15:30 +0000 (14:15 +0000) | ||
committer | hickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8> | |
Wed, 1 Dec 2010 14:15:30 +0000 (14:15 +0000) |
git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@20492 594d385d-05f5-0310-b6e9-bd551577e9d8
diff --git a/gosa-plugins/gosa-ng/admin/newConfigManagement/DeviceConfig-filter.xml b/gosa-plugins/gosa-ng/admin/newConfigManagement/DeviceConfig-filter.xml
--- /dev/null
@@ -0,0 +1,26 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<filterdef>
+ <definition>
+ <initial>true</initial>
+ <category>Device</category>
+ <scope>auto</scope>
+ <default>default</default>
+ <attribute>-</attribute>
+ </definition>
+
+ <search>
+ <tag>default</tag>
+ <label>Default filter</label>
+ <query>
+ <backend>ConfigManagement</backend>
+ <filter>$</filter>
+ </query>
+ <autocomplete>
+ <attribute>cn</attribute>
+ <frequency>0.5</frequency>
+ <characters>3</characters>
+ </autocomplete>
+ </search>
+
+</filterdef>
diff --git a/gosa-plugins/gosa-ng/admin/newConfigManagement/DeviceConfig-list.tpl b/gosa-plugins/gosa-ng/admin/newConfigManagement/DeviceConfig-list.tpl
--- /dev/null
@@ -0,0 +1,22 @@
+<div id="mainlist">
+
+ <div class="mainlist-header">
+ <p>{$HEADLINE} {$SIZELIMIT}</p>
+ <div class="mainlist-nav">
+ <table summary="{$HEADLINE}">
+ <tr>
+ <td>{$RELOAD}</td>
+ <td class="left-border">{t}Container{/t} {$CONTAINER}</td>
+ <td class="left-border">{t}Item{/t} {$ITEM}</td>
+ <td class="left-border">{$ACTIONS}</td>
+ <td class="left-border">{$FILTER}</td>
+ </tr>
+ </table>
+ </div>
+ </div>
+
+ {$LIST}
+</div>
+
+<div class="clear"></div>
+
diff --git a/gosa-plugins/gosa-ng/admin/newConfigManagement/DeviceConfig-list.xml b/gosa-plugins/gosa-ng/admin/newConfigManagement/DeviceConfig-list.xml
--- /dev/null
@@ -0,0 +1,87 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<list>
+ <definition>
+ <departmentBrowser>false</departmentBrowser>
+ <departmentRootVisible>false</departmentRootVisible>
+ <baseMode>false</baseMode>
+ <multiSelect>true</multiSelect>
+ <template>DeviceConfig-list.tpl</template>
+ <label>List of items</label>
+ <defaultSortColumn>1</defaultSortColumn>
+
+ %TYPES%
+
+ </definition>
+
+ <table>
+ <layout>|20px;c|||170px;r|</layout>
+
+ <department>
+ <value>%{filter:objectType(dn,objectClass)}</value>
+ </department>
+
+ <department>
+ <value>%{filter:departmentLink(row,dn,description)}</value>
+ <span>2</span>
+ </department>
+
+ <column>
+ <value>%{filter:objectType(dn,objectClass)}</value>
+ </column>
+
+ <column>
+ <label>Name</label>
+ <sortAttribute>cn</sortAttribute>
+ <sortType>string</sortType>
+ <value>%{filter:link(row,dn,"%s",cn,pid)}</value>
+ <export>true</export>
+ </column>
+
+ <column>
+ <label>Description</label>
+ <sortAttribute>description</sortAttribute>
+ <sortType>string</sortType>
+ <value>%{filter:link(row,dn,"%s",description,pid)}</value>
+ <export>true</export>
+ </column>
+
+ <column>
+ <label>Actions</label>
+ <value>%{filter:actions(dn,row,objectClass)}</value>
+ </column>
+
+ </table>
+
+ <actionmenu>
+
+ %ITEMS%
+
+ <action>
+ <name>remove</name>
+ <type>entry</type>
+ <image>images/lists/trash.png</image>
+ <label>Remove</label>
+ </action>
+
+ </actionmenu>
+
+ <actiontriggers snapshot="false" copypaste="false">
+
+ <action>
+ <name>editEntry</name>
+ <type>entry</type>
+ <image>images/lists/edit.png</image>
+ <label>Edit item</label>
+ </action>
+
+ <action>
+ <name>remove</name>
+ <type>entry</type>
+ <image>images/lists/trash.png</image>
+ <label>Remove item</label>
+ </action>
+
+ </actiontriggers>
+
+</list>
diff --git a/gosa-plugins/gosa-ng/admin/newConfigManagement/class_ConfigManagementDataModel.inc b/gosa-plugins/gosa-ng/admin/newConfigManagement/class_ConfigManagementDataModel.inc
--- /dev/null
@@ -0,0 +1,118 @@
+<?php
+
+class ConfigManagementDataModel
+{
+ private $data = array();
+ private $typeToPath = array();
+ private $idToPath = array();
+
+ function __construct()
+ {
+ $this->data = array();
+ $this->data['linear'] = array();
+ $this->data['recursive'] = array();
+ $this->addItem('root', '','root', array());
+ }
+
+ function getDataModel()
+ {
+ return($this->data);
+ }
+
+
+
+
+ function addItem($type, $path, $name, $values = array(), $status = "")
+ {
+ if($path == ""){
+ $parentItem = &$this->data['recursive'];
+ $parentId = NULL;
+ $parentDn = "";
+ }elseif(isset($this->data['linear'][$path])){
+ $parentItem = &$this->data['linear'][$path]['children'];
+ $parentId = $this->data['linear'][$path]['id'];
+ $parentDn = $this->data['linear'][$path]['dn'];
+ }else{
+ echo "No parent";
+ return(FALSE);
+ }
+
+ $this->currentID ++;
+ $entryPath = "{$path}/{$name}";
+ $entryDn = rtrim("cn={$name},{$parentDn}",',');
+ $entryId = $this->currentID;
+
+ $entry['path'] = $entryPath;
+ $entry['dn'] = $entryDn;
+ $entry['id'] = $entryId;
+ $entry['parentId'] = $parentId;
+ $entry['name'] = $name;
+ $entry['path'] = $entryPath;
+ $entry['parentPath'] = $path;
+ $entry['type'] = $type;
+ $entry['status'] = $status;
+ $entry['values'] = $values;
+ $entry['children'] = array();
+
+ $parentItem[$entryPath] = &$entry;
+ $this->data['linear'][$entryPath] = &$parentItem[$entryPath];
+
+ $this->idToPath[$entryId] = $entryPath;
+ $this->typeToPath[$type][$name] = $entryPath;
+
+ return($entryId);
+ }
+
+ function pathToDn($path)
+ {
+
+ }
+
+ function itemExistsByPath($path)
+ {
+ return(isset($this->data['linear'][$path]));
+ }
+
+ function getItemByPath($path)
+ {
+ if(isset($this->data['linear'][$path])){
+ return($this->data['linear'][$path]);
+ }
+ return(NULL);
+ }
+
+ function setItemStatus($path, $status)
+ {
+ if(!$this->itemExistsByPath($path)){
+ trigger_error("Invalid item path '{$path}'!");
+ }else{
+ $this->data['linear'][$path]['status'] = $status;
+ }
+ }
+
+ function getItemsByType($types)
+ {
+ $res = array();
+ foreach($this->data['linear'] as $path => $item){
+ if(in_array($item['type'],$types)) $res[] = $item;
+ }
+ return($res);
+ }
+
+
+ function getItemById($id)
+ {
+ $path = NULL;
+ if(isset($this->idToPath[$id])){
+ $path = $this->idToPath[$id];
+ }else{
+ return(NULL);
+ }
+ if(isset($this->data['linear'][$path])){
+ return($this->data['linear'][$path]);
+ }
+ return(NULL);
+ }
+}
+
+?>
diff --git a/gosa-plugins/gosa-ng/admin/newConfigManagement/class_ConfigManagementListing.inc b/gosa-plugins/gosa-ng/admin/newConfigManagement/class_ConfigManagementListing.inc
--- /dev/null
@@ -0,0 +1,232 @@
+<?php
+
+class ConfigManagementListing extends management
+{
+
+ private $base = "";
+
+ private $containerSelector = NULL;
+ private $itemSelector = NULL;
+ private $objectTypeStr = "";
+
+ function __construct($config, $ui, $parent)
+ {
+ // Set storage points - We do not have any - We just create a fake list which lists all items
+ $this->storagePoints = array("");
+ $this->rebuildListing();
+
+ $this->containerSelector = new ItemSelector(array(),'/root','/root');
+ $this->itemSelector = new ItemSelector(array(),'','');
+
+ $this->parent = &$parent;
+ }
+
+ function save_object()
+ {
+ $this->containerSelector->update();
+ $this->itemSelector->update();
+ }
+
+ function getSelectedContainer()
+ {
+ return($this->containerSelector->getBase());
+ }
+
+ function setContainer($dist)
+ {
+ return($this->containerSelector->setBase($dist));
+ }
+
+ function setItem($rel)
+ {
+ return($this->itemSelector->setBase($rel));
+ }
+
+ function getSelectedItem()
+ {
+ return($this->itemSelector->getBase());
+ }
+
+
+ function setContainers($containers)
+ {
+ $this->containerSelector->setBases($containers);
+ $this->containerSelector->update(TRUE);
+ }
+
+ function setItems($items)
+ {
+ $this->itemSelector->setBases($items);
+ $this->itemSelector->update(TRUE);
+ }
+
+
+ function renderList()
+ {
+ $headpage = $this->getHeadpage();
+ $headpage->update();
+ $smarty = get_smarty();
+ $smarty->assign("CONTAINER", $this->containerSelector->render());
+ $smarty->assign("ITEM", $this->itemSelector->render());
+ $display = $headpage->render();
+ return($this->getHeader().$display);
+ }
+
+
+ function setListingTypes($types)
+ {
+ $str = "";
+ foreach($types as $typeData){
+ $str.= "\n<objectType>";
+ foreach($typeData as $key => $value){
+ $str .= "\n\t<{$key}>{$value}</{$key}>";
+ }
+ $str.= "\n</objectType>\n";
+
+ }
+ $this->objectTypeStr = $str;
+ }
+
+
+ function execute()
+ {
+ // Ensure that html posts and gets are kept even if we see a 'Entry islocked' dialog.
+ $vars = array('/^act$/','/^listing/','/^PID$/','/^FILTER_PID$/');
+ session::set('LOCK_VARS_TO_USE',$vars);
+
+ pathNavigator::registerPlugin($this);
+
+ /* Display the copy & paste dialog, if it is currently open */
+ $ret = $this->copyPasteHandler("",array());
+ if($ret){
+ return($this->getHeader().$ret);
+ }
+
+ // Update filter
+ if ($this->filter) {
+ $this->filter->update();
+ session::global_set(get_class($this)."_filter", $this->filter);
+ session::set('autocomplete', $this->filter);
+ }
+
+ // Handle actions (POSTs and GETs)
+ $str = $this->handleActions($this->detectPostActions());
+ if($str) return($this->getHeader().$str);
+
+ $items = $this->parent->getItemsToBeDisplayed();
+ session::set('CONFIG_ITEM', $items);
+
+ // Open single dialog objects
+ if(is_object($this->dialogObject)){
+ if(method_exists($this->dialogObject,'save_object')) $this->dialogObject->save_object();
+ if(method_exists($this->dialogObject,'execute')){
+ $display = $this->dialogObject->execute();
+ $display.= $this->_getTabFooter();
+ return($this->getHeader().$display);
+ }
+ }
+
+ // Display tab object.
+ if($this->tabObject instanceOf tabs || $this->tabObject instanceOf multi_plug){
+# $this->tabObject->save_object();
+ $display = $this->tabObject->execute();
+ $display.= $this->_getTabFooter();
+ return($this->getHeader().$display);
+ }
+ // Set current restore base for snapshot handling.
+ if(is_object($this->snapHandler)){
+ $bases = array();
+ foreach($this->storagePoints as $sp){
+ $bases[] = $sp.$this->headpage->getBase();
+ }
+
+ // No bases specified? Try base
+ if(!count($bases)) $bases[] = $this->headpage->getBase();
+
+ $this->snapHandler->setSnapshotBases($bases);
+ }
+
+ // Create statistic table entry
+ stats::log('management', $class = get_class($this), $this->getAclCategories(), $action = 'view',
+ $amount = 1, $duration = (microtime(TRUE) - $this->initTime));
+
+ // Display list
+ $this->rebuildListing();
+ $str = $this->renderList();
+ return($str);
+ }
+
+
+
+ function rebuildListing()
+ {
+ // Build filter
+ if (session::global_is_set(get_class($this)."_filter")){
+ $filter= session::global_get(get_class($this)."_filter");
+ } else {
+ $filter = new filter(get_template_path("DeviceConfig-filter.xml", true));
+ $filter->setObjectStorage($this->storagePoints);
+ }
+ $this->setFilter($filter);
+
+ // Load service xml file and fill in placeholders
+ $contents = file_get_contents(get_template_path("DeviceConfig-list.xml", true));
+ $contents = preg_replace("/%TYPES%/", $this->objectTypeStr, $contents);
+ $contents = preg_replace("/%ITEMS%/", "", $contents);
+
+ $headpage = new listing($contents,TRUE);
+ $headpage->setBase($this->base);
+ $headpage->setFilter($filter);
+
+ parent::__construct($this->config, $this->ui, "services", $headpage);
+
+ // Register default actions
+ $this->registerAction("new", "newEntry");
+ $this->registerAction("editEntry", "editEntry");
+ $this->registerAction("edit", "openEntry");
+ $this->registerAction("apply", "applyChanges");
+ $this->registerAction("save", "saveChanges");
+ $this->registerAction("cancel", "cancelEdit");
+ $this->registerAction("cancelDelete", "cancelEdit");
+ $this->registerAction("remove", "removeEntryRequested");
+ $this->registerAction("removeConfirmed", "removeEntryConfirmed");
+
+ $this->registerAction("config-filter","editFilter");
+ $this->registerAction("saveFilter","saveFilter");
+ $this->registerAction("cancelFilter","cancelFilter");
+
+ }
+
+ function removeEntryRequested($action="",$target=array(),$all=array(), $altTabClass ="", $altTabType = "", $altAclCategory="")
+ {
+ $this->parent->removeEntry($target);
+ }
+
+ function openEntry($action="",$target=array(),$all=array(), $altTabClass ="", $altTabType = "", $altAclCategory="")
+ {
+ $this->parent->openEntry($target);
+ }
+
+ function editEntry($action="",$target=array(),$all=array(), $altTabClass ="", $altTabType = "", $altAclCategory="")
+ {
+ $this->parent->editEntry($target);
+ }
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+}
+
+?>
diff --git a/gosa-plugins/gosa-ng/admin/newConfigManagement/class_filterConfigManagement.inc b/gosa-plugins/gosa-ng/admin/newConfigManagement/class_filterConfigManagement.inc
--- /dev/null
@@ -0,0 +1,52 @@
+<?php
+
+class filterConfigManagement {
+
+ static function query($base, $scope, $filter, $attributes, $category, $objectStorage= "")
+ {
+ // Walk through the data array till we reach the correct level, then
+ // create the list of entries.
+ $data = session::get('CONFIG_ITEM');
+ if(!$data) return(array());
+
+ // Prepare filter, strip out regex regex related chars, except for *
+ $filter = preg_replace('/\*/','____STAR____', $filter);
+ $filter = preg_quote($filter,'/');
+ $filter = preg_replace('/____STAR____/','.*', $filter);
+
+ // Add entries
+ $ret = array();
+ foreach($data['children'] as $item){
+ filterDeviceItems::addEntry($ret, $item, $scope == 'sub', $filter);
+ }
+ return($ret);
+ }
+
+ static function addEntry(&$ret, $item, $recursive = FALSE, $filter)
+ {
+ if(preg_match("/".$filter."/",$item['name'])){
+ $entry = array();
+ $entry['dn'] = $item['id'];
+ $entry[] = 'dn';
+ $entry['cn'] = array($item['name'], 'count' => 1);
+ $entry[] = 'cn';
+ $entry['id'] = array($item['id'], 'count' => 1);
+ $entry[] = 'id';
+ $entry['description'] = array($item['type'], 'count' => 1);
+ $entry[] = 'description';
+ $entry['objectClass'] = array($item['type'],'count' => 1);
+ $entry[] = 'objectClass';
+ $entry['count'] = 5;
+ $ret[] = $entry;
+ }
+
+ if($recursive && isset($item['children']) && count($item['children'])){
+ foreach($item['children'] as $item){
+ filterDeviceItems::addEntry($ret, $item, $recursive,$filter);
+ }
+ }
+
+ }
+}
+
+?>
diff --git a/gosa-plugins/gosa-ng/admin/newConfigManagement/class_newConfigManagement.inc b/gosa-plugins/gosa-ng/admin/newConfigManagement/class_newConfigManagement.inc
--- /dev/null
@@ -0,0 +1,376 @@
+<?php
+
+/*! \brief This class allows to manage backend config items and packages.
+ */
+class newConfigManagement extends plugin
+{
+ var $initTime;
+ var $plHeadline = "Config management";
+ var $plDescription = "Config management";
+
+ var $selectedContainer;
+ var $selectedItem;
+
+ var $dataModel = NULL;
+ var $listing = NULL;
+
+
+ /*! \brief Initialize the plugin and finally update the data model.
+ */
+ function __construct($config, $dn)
+ {
+ $this->config = &$config;
+ $this->listing = new ConfigManagementListing($this->config, get_userinfo(), $this);
+
+ // Request an update of the data model
+ $this->updateDataModel();
+ }
+
+
+ /*! \brief Updates all distributions, releases, packages and items in the dataModel
+ * Load information from the backend.
+ */
+ function updateDataModel()
+ {
+ // Recreate the data model, to have a clean and fresh instance.
+ $this->dataModel = new ConfigManagementDataModel();
+
+ // Load distributions
+ $rpc = $this->config->getRpcHandle();
+ $res = $rpc->getDistributions();
+ if(!$rpc->success()){
+ msg_dialog::display(_("Error"), sprintf(_("Failed to load distributions, error was '%s'!"), $rpc->get_error()),ERROR_DIALOG);
+ return(NULL);
+ }
+ foreach($res as $dist){
+ $this->dataModel->addItem('Distribution','/root', $dist['name'], $dist);
+ foreach($dist['releases'] as $release){
+ $distPath = "/root/{$dist['name']}";
+ $this->dataModel->addItem('Release',$distPath, $release['name'], $release);
+
+ foreach($dist['components'] as $component){
+ $comPath = "{$distPath}/{$release['name']}";
+ $this->dataModel->addItem('Component',$comPath, $component['name'], $component);
+ }
+ }
+ }
+ }
+
+
+ /*! \brief Keep track of posted values and populate those
+ * which are interesting for us.
+ * Inspects the _POST and _GET values.
+ */
+ function save_object()
+ {
+ // Update the listing class, this is necessary to get post
+ // actions from it.
+ $this->listing->save_object();
+
+ // Get the selected distribution and release from the listing widget.
+ $cont = $this->listing->getSelectedContainer();
+ $item = $this->listing->getSelectedItem();
+ $this->setCurrentContainer($cont, $item);
+ }
+
+
+ /*! \brief Load extended sub-objecte like 'config items' or 'packages'
+ * for the given release path.
+ * @param String The release path to load sub-objects for.
+ * @return NULL
+ */
+ function updateItemList($path)
+ {
+ // Fist get Item and check if it is an release
+ if($this->dataModel->itemExistsByPath($path)){
+ $data = $this->dataModel->getItemByPath($path);
+
+ // Only releases can contain config-items.
+ if($data['type'] == 'Release' && $data['status'] != "fetched"){
+
+ $rpc = $this->config->getRpcHandle();
+ $res = $rpc->listConfigItems($data['name']);
+ if(!$rpc->success()){
+ msg_dialog::display(_("Error"),
+ sprintf(_("Failed to load distributions, error was '%s'!"),
+ $rpc->get_error()),ERROR_DIALOG);
+ }else{
+ $rpc = $this->config->getRpcHandle();
+ $res = $rpc->getPackages($data['name']);
+
+ return;
+ foreach($res as $itemPath => $type){
+
+ // Make names dataModel conform
+ $itemPath = $path.'/'.preg_replace("/^\//","/root", $itemPath);
+ $name = preg_replace("/^.*\//","",$itemPath);
+ $itemPath = preg_replace("/\/[^\/]*$/","", $itemPath);
+ $this->dataModel->addItem($type, $itemPath, $name);
+ }
+ $this->dataModel->setItemStatus($path, 'fetched');
+ }
+ }
+ }
+ }
+
+
+ /*! \brief Sets the currently selected container and item path.
+ * @param String The path of the container to set.
+ * @param String The path of the item to set.
+ * @return
+ */
+ function setCurrentContainer($cont, $item)
+ {
+ $this->selectedContainer = $cont;
+ $this->selectedItem = $item;
+
+ // Get a list of all available container and items.
+ $distList = $this->getContainerList();
+ $releaseList = $this->getItemList();
+
+ // Ensure that we've valid values selected.
+ if(!isset($releaseList[$this->selectedItem])){
+ if(count($releaseList)){
+ echo "Fallback";
+ $this->selectedItem = key($releaseList);
+ }else{
+ echo "Fallback 2";
+ $this->selectedItem = "";
+ }
+ }
+
+ // Update list of items within the selected container.
+ $this->updateItemList($this->selectedContainer);
+
+ // Transfer checked values back to the listing class.
+ $this->listing->setContainer($this->selectedContainer);
+ $this->listing->setItem($this->selectedItem);
+ $this->listing->setContainers($this->getContainerList());
+ $this->listing->setItems($this->getItemList());
+ }
+
+
+ /*! \brief Generate the HTML content for this plugin.
+ * Actually renders the listing widget..
+ */
+ 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);
+ }
+
+
+ /*! \brief Returns a list of items which will then be displayed
+ * in the management-list.
+ * (The management class calls this method from its execute())
+ * @return Array A list of items/objects for the listing.
+ */
+ function getItemsToBeDisplayed()
+ {
+
+ $path = $this->selectedContainer.$this->selectedItem;
+ $item = $this->dataModel->getItemByPath($path);
+ return($item);
+ }
+
+
+ /*! \brief Returns a simply list of all releases of the CURRENT distribution.
+ * This list will then be used to generate the entries of the
+ * ItemSelectors in the listing class.
+ */
+ function getItemList()
+ {
+ $data = $this->dataModel->getItemByPath($this->selectedContainer);
+ $res = array();
+ $res[""] = array("name" => "/", "desc" => "");
+ $res = array_merge($res,$this->__recurseItem($data, array('Component')));
+ return($res);
+
+
+ if($data['type'] != 'Release'){
+ }else{
+ $res = array_merge($res,$this->__recurseItem($data, array('Component'),$this->selectedContainer));
+ }
+ return($res);
+ }
+
+
+ /*! \brief Returns a simply list of all distributions.
+ * This list will then be used to generate the entries of the
+ * ItemSelectors in the listing class.
+ */
+ function getContainerList()
+ {
+ $data = $this->dataModel->getItemByPath('/root');
+ $res = array();
+ $res["/root"] = array("name" => "/", "desc" => "");
+ $res = array_merge($res,$this->__recurseItem($data, array('Distribution','Release')));
+
+ print_a($res);
+ return($res);
+ }
+
+
+ /*! \brief Recursivly walks through an item and collects all path and name info.
+ * The reult can then be used to fill the ItemSelector.
+ * @param Array The Item to recurse.
+ * @param Array The type of of objects to collect.
+ * @param String The parent path prefix which should be removed.
+ * @return Array An array containing Array[path] = name
+ */
+ function __recurseItem($item, $types, $parent = "")
+ {
+ $res = array();
+ if(in_array($item['type'], $types)){
+ $path = preg_replace("/".preg_quote($parent,'/')."/","",$item['path']);
+ $res[$path] = array('name' => $item['name'],'desc'=>$item['type']);
+ }
+ if(count($item['children'])){
+ foreach($item['children'] as $child){
+ $res = array_merge($res, $this->__recurseItem($child, $types, $parent));
+ }
+ }
+ return($res);
+ }
+
+
+ /*! \brief Intializes this plugin
+ * All available installation methods will be loaded
+ */
+ function loadInstallationMethods()
+ {
+ // Reset erros
+ $this->rpcError = $this->initFailed = FALSE;
+
+ // Load configuration via rpc.
+ $rpc = $this->config->getRpcHandle();
+
+ // Populate install methods on success.
+ $res = $rpc->getSupportedInstallMethods();
+ if(!$rpc->success()){
+ $this->rpcError = TRUE;
+ $this->errorMessage = $rpc->get_error();;
+ return;
+ }
+ $this->installationMethods = $res;
+ if(!count($this->installationMethods)){
+ $this->errorMessage = _("No selectable install methods returned!");
+ msg_dialog::display(_("Setup"), $this->errorMessage , ERROR_DIALOG);
+ $this->initFailed = TRUE;
+ return;
+ }
+ }
+
+
+ /*! \brief Returns a info list about all items we can manage,
+ * this used to fill the listings <objectType> settings.
+ * @return Array An array with item info.
+ */
+ function getListingTypes()
+ {
+ $types= array();
+ $types['Distribution']['objectClass'] = 'Distribution';
+ $types['Distribution']['label'] = _('Distribution');
+ $types['Distribution']['image'] = 'images/lists/edit.png';
+ $types['Distribution']['category'] = 'Device';
+ $types['Distribution']['class'] = 'Device';
+
+ $types['Release']['objectClass'] = 'Release';
+ $types['Release']['label'] = _('Release');
+ $types['Release']['image'] = 'images/lists/delete.png';
+ $types['Release']['category'] = 'Device';
+ $types['Release']['class'] = 'Device';
+
+ $types['Component']['objectClass'] = 'Component';
+ $types['Component']['label'] = _('Component');
+ $types['Component']['image'] = 'plugins/users/images/select_user.png';
+ $types['Component']['category'] = 'Device';
+ $types['Component']['class'] = 'Device';
+ return($types);
+ }
+
+
+ /*! \brief Acts on edit requests and opens an edit dialog for the received item-id.
+ * (This action is received from the ConfigManagementListing class.)
+ * @param Array The items ids. (May contain multiple ids)
+ * @return
+ */
+ function editEntry($ids)
+ {
+ foreach($ids as $id){
+ echo "<br>Edit {$id}";
+ }
+ }
+
+
+ /*! \brief Acts on remove requests.
+ * (This action is received from the ConfigManagementListing class.)
+ * @param Array The items ids. (May contain multiple ids)
+ * @return
+ */
+ function removeEntry($ids)
+ {
+ foreach($ids as $id){
+ echo "<br>Remove {$id}";
+ }
+ }
+
+
+ /*! \brief Acts on open requests.
+ * (This action is received from the ConfigManagementListing class.)
+ * @param Array The items ids. (May contain multiple ids)
+ * @return
+ */
+ function openEntry($ids)
+ {
+ $id = $ids[0];
+ $item = $this->dataModel->getItemById($id);
+ if($item){
+ if(in_array($item['type'], array('Distribution', 'Release'))){
+ $this->setCurrentContainer($item['path'], $this->selectedItem);
+ }elseif(in_array($item['type'], array('Component'))){
+ $next = preg_replace("/".preg_quote($this->selectedContainer,'/')."/","", $item['path']);
+ $this->setCurrentContainer($this->selectedContainer, $next);
+ }else{
+ $this->editEntry(array($id));
+ }
+ }
+ }
+
+
+ /*! \brief The plugins ACL and plugin-property definition.
+ * @return
+ */
+ public static function plInfo()
+ {
+ return (array(
+ "plShortName" => _("Config management"),
+ "plDescription" => _("Config management"),
+ "plSelfModify" => FALSE,
+ "plDepends" => array(),
+ "plPriority" => 0,
+ "plSection" => array("administration"),
+ "plCategory" => array(
+ "newConfigManagement" => array("description" => _("Config management"),
+ "objectClass" => "FAKE_OC_newConfigManagement")),
+ "plProvidedAcls"=> array()
+ ));
+ }
+
+
+ /*! \brief
+ * @param
+ * @return
+ */
+ function remove_lock()
+ {
+ }
+
+
+}
+?>
diff --git a/gosa-plugins/gosa-ng/admin/newConfigManagement/main.inc b/gosa-plugins/gosa-ng/admin/newConfigManagement/main.inc
--- /dev/null
@@ -0,0 +1,34 @@
+<?php
+if ($remove_lock){
+ if(session::is_set('newConfigManagement')){
+ $macl = session::get('newConfigManagement');
+ $macl->remove_lock();
+ }
+}
+
+/* Remove this plugin from session
+ */
+if ( $cleanup ){
+ session::un_set('newConfigManagement');
+}else{
+
+ /* Create newConfigManagement object on demand */
+ if (!session::is_set('newConfigManagement')){
+ $newConfigManagement= new newConfigManagement ($config, $ui);
+ session::set('newConfigManagement',$newConfigManagement);
+ }
+ $newConfigManagement = session::get('newConfigManagement');
+ $display= $newConfigManagement->save_object();
+ $display= $newConfigManagement->execute();
+
+ /* Reset requested? */
+ if (isset($_GET['reset']) && $_GET['reset'] == 1){
+ session::un_set ('newConfigManagement');
+ }
+
+ /* Show and save dialog */
+ session::set('newConfigManagement',$newConfigManagement);
+}
+
+// vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
+?>
diff --git a/gosa-plugins/gosa-ng/contrib/resolutions b/gosa-plugins/gosa-ng/contrib/resolutions
--- /dev/null
@@ -0,0 +1,4 @@
+480x320
+640x480
+1024x768
+1280x1024
diff --git a/gosa-plugins/gosa-ng/plugin.dsc b/gosa-plugins/gosa-ng/plugin.dsc
--- /dev/null
@@ -0,0 +1,8 @@
+[gosa-plugin]
+name = gosa-ng
+description = "GOsa-ng implementations"
+version = 2.7
+author = "Fabian Hickert <hickert@gonicus.de>"
+maintainer = "GOsa packages maintainers group <gosa-pkg@oss.gonicus.de>"
+homepage = https://oss.gonicus.de/labs/gosa/
+depends = goto