summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: bd0bc97)
raw | patch | inline | side by side (parent: bd0bc97)
author | hickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8> | |
Thu, 21 Oct 2010 09:46:06 +0000 (09:46 +0000) | ||
committer | hickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8> | |
Thu, 21 Oct 2010 09:46:06 +0000 (09:46 +0000) |
-
git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@20109 594d385d-05f5-0310-b6e9-bd551577e9d8
git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@20109 594d385d-05f5-0310-b6e9-bd551577e9d8
gosa-core/plugins/admin/newConfigManagement/DeviceConfig-filter.xml | [new file with mode: 0644] | patch | blob |
gosa-core/plugins/admin/newConfigManagement/DeviceConfig-list.tpl | [new file with mode: 0644] | patch | blob |
gosa-core/plugins/admin/newConfigManagement/DeviceConfig-list.xml | [new file with mode: 0644] | patch | blob |
gosa-core/plugins/admin/newConfigManagement/class_ConfigManagementDataModel.inc | [new file with mode: 0644] | patch | blob |
gosa-core/plugins/admin/newConfigManagement/class_ConfigManagementListing.inc | [new file with mode: 0644] | patch | blob |
gosa-core/plugins/admin/newConfigManagement/class_newConfigManagement.inc | [new file with mode: 0644] | patch | blob |
gosa-core/plugins/admin/newConfigManagement/main.inc | [new file with mode: 0644] | patch | blob |
diff --git a/gosa-core/plugins/admin/newConfigManagement/DeviceConfig-filter.xml b/gosa-core/plugins/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>DeviceItems</backend>
+ <filter>$</filter>
+ </query>
+ <autocomplete>
+ <attribute>cn</attribute>
+ <frequency>0.5</frequency>
+ <characters>3</characters>
+ </autocomplete>
+ </search>
+
+</filterdef>
diff --git a/gosa-core/plugins/admin/newConfigManagement/DeviceConfig-list.tpl b/gosa-core/plugins/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}Release{/t} {$RELEASE}</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-core/plugins/admin/newConfigManagement/DeviceConfig-list.xml b/gosa-core/plugins/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-core/plugins/admin/newConfigManagement/class_ConfigManagementDataModel.inc b/gosa-core/plugins/admin/newConfigManagement/class_ConfigManagementDataModel.inc
--- /dev/null
@@ -0,0 +1,48 @@
+<?php
+
+class ConfigManagementDataModel
+{
+ private $data = array();
+
+ function __construct()
+ {
+ $this->data = array();
+ $this->data['linear'] = array();
+ $this->data['recursive'] = array();
+ $this->addItem('root', '','root', array());
+ }
+
+
+ function addItem($type, $base, $name, $values, $status = "")
+ {
+ if($base == ""){
+ $parentItem = &$this->data['recursive'];
+ $parentId = NULL;
+ }elseif(isset($this->data['linear'][$base])){
+ $parentItem = &$this->data['linear'][$base]['children'];
+ $parentId = $this->data['linear'][$base]['id'];
+ }else{
+ echo "No parent";
+ return(FALSE);
+ }
+
+ $this->currentID ++;
+ $entryBase = "{$base}/{$name}";
+ $entryId = $this->currentID;
+
+ $entry['dn'] = $entryBase;
+ $entry['id'] = $entryId;
+ $entry['parentId'] = $parentId;
+ $entry['name'] = $name;
+ $entry['base'] = $base;
+ $entry['status'] = $status;
+ $entry['values'] = $values;
+ $entry['children'] = array();
+
+ $parentItem[$entryBase] = &$entry;
+ $this->data['linear'][$entryBase] = &$parentItem[$entryBase];
+ return(TRUE);
+ }
+}
+
+?>
diff --git a/gosa-core/plugins/admin/newConfigManagement/class_ConfigManagementListing.inc b/gosa-core/plugins/admin/newConfigManagement/class_ConfigManagementListing.inc
--- /dev/null
@@ -0,0 +1,98 @@
+<?php
+
+class ConfigManagementListing extends management
+{
+
+ private $base = "";
+
+ private $releaseSelector = NULL;
+ private $itemSelector = NULL;
+
+
+ function __construct($config, $ui)
+ {
+ // Set storage points - We do not have any - We just create a fake list which lists all items
+ $this->storagePoints = array("");
+ $this->rebuildListing();
+
+
+ $this->releaseSelector = new ItemSelector(array('cn=/'=>'/'),"cn=/","cn=/");
+ $this->itemSelector = new ItemSelector(array('cn=/'=>'/'),"cn=/","cn=/");
+ }
+
+ function setRelease($base)
+ {
+ $this->releaseSelector->setBase($base);
+ }
+
+ function setReleases ($releases)
+ {
+ $this->releaseSelector->setBases($releases);
+ }
+
+
+ function setItem($base)
+ {
+ $this->itemSelector->setBase($base);
+ }
+
+ function setItems ($items)
+ {
+ $this->itemSelector->setBases($items);
+ }
+ function setAllowedItems() {}
+ function renderList()
+ {
+ session::set('DEVICE_ITEMS', array());
+
+ $filter = $this->getFilter();
+ $headpage = $this->getHeadpage();
+ $headpage->update();
+ $smarty = get_smarty();
+
+ $this->releaseSelector->update(TRUE);
+ $this->itemSelector->update(TRUE);
+
+ $smarty->assign("RELEASE", $this->releaseSelector->render());
+ $smarty->assign("ITEM", $this->itemSelector->render());
+ $display = $headpage->render();
+ return($this->getHeader().$display);
+
+ }
+
+
+ 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("/%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("edit", "openEntry"); // !! We forward 'edit' to 'open' to have a department like navigation.
+ $this->registerAction("editEntry", "editEntry");
+
+ $this->registerAction("saveItemChanges", "saveItemChanges");
+ $this->registerAction("cancelItemEdit", "closeDialogs");
+ $this->registerAction("cancelItemAdd", "closeDialogs");
+ $this->registerAction("saveItemAdd", "saveItemAdd");
+ }
+
+
+}
+
+?>
diff --git a/gosa-core/plugins/admin/newConfigManagement/class_newConfigManagement.inc b/gosa-core/plugins/admin/newConfigManagement/class_newConfigManagement.inc
--- /dev/null
@@ -0,0 +1,138 @@
+<?php
+
+class newConfigManagement extends plugin
+{
+ var $initTime;
+ var $plHeadline = "Config management";
+ var $plDescription = "Config management";
+
+ var $installationMethods = array();
+
+ function __construct($config, $dn)
+ {
+ $this->config = &$config;
+
+ $this->listing = new ConfigManagementListing($this->config, get_userinfo());
+ $this->dataModel = new ConfigManagementDataModel();
+
+
+# $dists = $this->getDistributions();
+# foreach($dists as $name => $dist){
+#
+#
+# $this->dataModel->addItem
+#
+#
+# }
+#
+#
+#
+#
+#
+# // Get installation methods from the backend.
+# $this->loadInstallationMethods();
+ }
+
+
+ function getDistributions()
+ {
+ return(
+ array(
+ 'debian' =>
+ array('type' => 'deb', 'install_method' => 'puppet'),
+ 'suse' =>
+ array('type' => 'rpm', 'install_method' => 'muppet')
+ ));
+ }
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ /*! \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;
+ }
+
+
+ $this->getReleases();
+ }
+
+
+
+
+ function getReleases()
+ {
+ $rpc = $this->config->getRpcHandle();
+ $res = $rpc->getReleases();
+ if(!$rpc->success()){
+ $this->rpcError = TRUE;
+ $this->errorMessage = $rpc->get_error();;
+ return(NULL);
+ }
+ return($res);
+ }
+
+
+ function execute()
+ {
+ return($this->listing->renderList());
+ }
+
+ function remove_lock()
+ {}
+
+ 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()
+ ));
+ }
+
+}
+
+
+?>
diff --git a/gosa-core/plugins/admin/newConfigManagement/main.inc b/gosa-core/plugins/admin/newConfigManagement/main.inc
--- /dev/null
@@ -0,0 +1,33 @@
+<?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->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:
+?>