From: hickert Date: Thu, 21 Oct 2010 09:46:06 +0000 (+0000) Subject: Added new - NOT working config mangement. X-Git-Url: https://git.tokkee.org/?a=commitdiff_plain;h=39b429ea5a1c3dee6cdbef895026184032a5c654;p=gosa.git Added new - NOT working config mangement. - git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@20109 594d385d-05f5-0310-b6e9-bd551577e9d8 --- diff --git a/gosa-core/plugins/admin/newConfigManagement/DeviceConfig-filter.xml b/gosa-core/plugins/admin/newConfigManagement/DeviceConfig-filter.xml new file mode 100644 index 000000000..183ddd4ce --- /dev/null +++ b/gosa-core/plugins/admin/newConfigManagement/DeviceConfig-filter.xml @@ -0,0 +1,26 @@ + + + + + true + Device + auto + default + - + + + + default + + + DeviceItems + $ + + + cn + 0.5 + 3 + + + + diff --git a/gosa-core/plugins/admin/newConfigManagement/DeviceConfig-list.tpl b/gosa-core/plugins/admin/newConfigManagement/DeviceConfig-list.tpl new file mode 100644 index 000000000..5cc4b060b --- /dev/null +++ b/gosa-core/plugins/admin/newConfigManagement/DeviceConfig-list.tpl @@ -0,0 +1,22 @@ +
+ +
+

{$HEADLINE} {$SIZELIMIT}

+
+ + + + + + + + +
{$RELOAD}{t}Release{/t} {$RELEASE}{t}Item{/t} {$ITEM}{$ACTIONS}{$FILTER}
+
+
+ + {$LIST} +
+ +
+ diff --git a/gosa-core/plugins/admin/newConfigManagement/DeviceConfig-list.xml b/gosa-core/plugins/admin/newConfigManagement/DeviceConfig-list.xml new file mode 100644 index 000000000..99bc644f8 --- /dev/null +++ b/gosa-core/plugins/admin/newConfigManagement/DeviceConfig-list.xml @@ -0,0 +1,87 @@ + + + + + false + false + false + true + + + 1 + + %TYPES% + + + + + |20px;c|||170px;r| + + + %{filter:objectType(dn,objectClass)} + + + + %{filter:departmentLink(row,dn,description)} + 2 + + + + %{filter:objectType(dn,objectClass)} + + + + + cn + string + %{filter:link(row,dn,"%s",cn,pid)} + true + + + + + description + string + %{filter:link(row,dn,"%s",description,pid)} + true + + + + + %{filter:actions(dn,row,objectClass)} + + +
+ + + + %ITEMS% + + + remove + entry + images/lists/trash.png + + + + + + + + + editEntry + entry + images/lists/edit.png + + + + + remove + entry + images/lists/trash.png + + + + + +
diff --git a/gosa-core/plugins/admin/newConfigManagement/class_ConfigManagementDataModel.inc b/gosa-core/plugins/admin/newConfigManagement/class_ConfigManagementDataModel.inc new file mode 100644 index 000000000..054ad2e13 --- /dev/null +++ b/gosa-core/plugins/admin/newConfigManagement/class_ConfigManagementDataModel.inc @@ -0,0 +1,48 @@ +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 new file mode 100644 index 000000000..b62e5a60f --- /dev/null +++ b/gosa-core/plugins/admin/newConfigManagement/class_ConfigManagementListing.inc @@ -0,0 +1,98 @@ +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 new file mode 100644 index 000000000..3694b9d38 --- /dev/null +++ b/gosa-core/plugins/admin/newConfigManagement/class_newConfigManagement.inc @@ -0,0 +1,138 @@ +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 new file mode 100644 index 000000000..26ce1e362 --- /dev/null +++ b/gosa-core/plugins/admin/newConfigManagement/main.inc @@ -0,0 +1,33 @@ +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: +?>