summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 2874860)
raw | patch | inline | side by side (parent: 2874860)
author | hickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8> | |
Tue, 25 Oct 2011 13:17:22 +0000 (13:17 +0000) | ||
committer | hickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8> | |
Tue, 25 Oct 2011 13:17:22 +0000 (13:17 +0000) |
git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@21032 594d385d-05f5-0310-b6e9-bd551577e9d8
35 files changed:
diff --git a/gosa-plugins/goto/admin/ConfigManagement/AddItemDialog.tpl b/gosa-plugins/goto/admin/ConfigManagement/AddItemDialog.tpl
+++ /dev/null
@@ -1,21 +0,0 @@
-
-<h3>{t}Add item{/t}</h3>
-
-{t}Please specify a name for the item to add. This name has to be unique within the item configuration.{/t}
-<br>
-
-<hr>
-
-<p>
- <b>{$itemCfg.name}</b> - {$itemCfg.description}
-</p>
-
-{t}Name{/t}: <input type='text' name='itemName' value="{$itemName}">
-
-<hr>
-
-<div class='plugin-actions'>
- <button name='saveItemAdd'>{msgPool type=okButton}</button>
- <button name='cancelItemAdd'>{msgPool type=cancelButton}</button>
-</div>
-
diff --git a/gosa-plugins/goto/admin/ConfigManagement/DeviceConfig-filter.xml b/gosa-plugins/goto/admin/ConfigManagement/DeviceConfig-filter.xml
+++ /dev/null
@@ -1,26 +0,0 @@
-<?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-plugins/goto/admin/ConfigManagement/DeviceConfig-list.tpl b/gosa-plugins/goto/admin/ConfigManagement/DeviceConfig-list.tpl
+++ /dev/null
@@ -1,21 +0,0 @@
-<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}Base{/t} {$RELEASE}</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/goto/admin/ConfigManagement/DeviceConfig-list.xml b/gosa-plugins/goto/admin/ConfigManagement/DeviceConfig-list.xml
+++ /dev/null
@@ -1,87 +0,0 @@
-<?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/goto/admin/ConfigManagement/DeviceConfig.tpl b/gosa-plugins/goto/admin/ConfigManagement/DeviceConfig.tpl
+++ /dev/null
@@ -1,12 +0,0 @@
-<h3>{t}Device Config{/t}</h3>
-{$navigationList}
-<button name='addSubModule'>{msgPool type='addButton'}</button>
-
-<hr>
-
-<b>{$containerName}</b> <i>({$containerDescription})</i>
-
-<p>
-{$template}
-</p>
-
diff --git a/gosa-plugins/goto/admin/ConfigManagement/TemplateEngine.tpl b/gosa-plugins/goto/admin/ConfigManagement/TemplateEngine.tpl
+++ /dev/null
@@ -1,11 +0,0 @@
-<h3>Bla</h3>
-
-{$template}
-
-<hr>
-
-<div class='plugin-actions'>
- <button name='saveItemEdit'>{msgPool type=okButton}</button>
- <button name='cancelItemEdit'>{msgPool type=cancelButton}</button>
-</div>
-
diff --git a/gosa-plugins/goto/admin/ConfigManagement/TemplateWidget_textEditor.tpl b/gosa-plugins/goto/admin/ConfigManagement/TemplateWidget_textEditor.tpl
+++ /dev/null
@@ -1,12 +0,0 @@
-{if $write_protect}
- {t}The text is write protected due to its encoding. Editing may break it!{/t}
- <br>
- <button type='submit' name='editAnyway'>{t}Edit anyway{/t}</button>
-{/if}
-<textarea {if $write_protect} disabled {/if} {if !$write_protect} name="{$postName}" {/if}
- style="width:100%;height:300px;" id="{$postName}"
- rows="20" cols="120">{$value}</textarea>
-<div>
- <input type="file" name="ImportFile">
- <button type='submit' name='ImportUpload'>{t}Import text{/t}</button>
-</div>
diff --git a/gosa-plugins/goto/admin/ConfigManagement/class_AddItemDialog.inc b/gosa-plugins/goto/admin/ConfigManagement/class_AddItemDialog.inc
+++ /dev/null
@@ -1,61 +0,0 @@
-<?php
-
-class AddItemDialog
-{
- private $itemCfg = NULL;
- private $config = NULL;
-
- private $itemName = "";
- private $itemType = NULL;
-
- function __construct(&$config, $itemType, $itemCfg)
- {
- $this->config = $config;
- $this->itemCfg = $itemCfg;
- $this->itemType = $itemType;
- }
-
- function execute()
- {
- $smarty = get_smarty();
- $smarty->assign('itemCfg', set_post($this->itemCfg));
- $smarty->assign('itemName', set_post($this->itemName));
- return($smarty->fetch(get_template_path('goto/Config/AddItemDialog.tpl', TRUE)));
- }
-
- function getItemCfg()
- {
- return($this->itemCfg);
- }
-
- function getName()
- {
- return($this->itemName);
- }
-
- function getItemType()
- {
- return($this->itemType);
- }
-
- function save_object()
- {
- if(isset($_POST['itemName'])){
- $this->itemName = get_post('itemName');
- }
- }
-
- function check()
- {
- $message = array();
- if(empty($this->itemName)){
- $message[] = msgPool::required(_("Name"));
- }else
- if(!tests::is_uid($this->itemName)){
- $message[] = msgPool::invalid(_("Name"));
- }
- return($message);
- }
-}
-
-?>
diff --git a/gosa-plugins/goto/admin/ConfigManagement/class_ConfigManagement.inc b/gosa-plugins/goto/admin/ConfigManagement/class_ConfigManagement.inc
+++ /dev/null
@@ -1,638 +0,0 @@
-<?php
-
-/*! \brief A GOsa plugin which generates a device configuration dialog
- */
-class ConfigManagement extends management
-{
-
- // Used to render the item-configuration dialog
- private $TemplateEngine = NULL;
-
- // A list of all configured items for this device.
- private $allConfiguredItems = array();
-
- // The currently active item
- // Add add and remove action will be performed on this item
- private $currentItem = array();
-
- // A baseSelector which will be fed with a simulated
- // department list. All entries will get a fake base
- // which can then be used to fill the baseSelector widget.
- private $itemContainerSelector = NULL;
-
- // The currently selected base within management list.
- private $base ;
-
- // This array contains a list of all item-types we can add
- // to the currently selected item (currentItem)
- private $addableContainerItems = array();
-
- // Due to the fakt that we use a fake 'base/dn' for all items
- // we've to map this 'base/dn' to the items 'id'.
- 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
- // the management class. See class plugin.
- public $initTime;
- public $ignore_account = FALSE;
- public $pl_notify;
- public $read_only;
-
- public $allItemConfigurations = NULL;
-
- /*! \brief Constructs the device configuration plugin
- * @param Config The GOsa configuration object.
- */
- function __construct(&$config, $dn)
- {
- // Load the template engine and tell her what template
- // to use for the HTML it produces.
- $this->TemplateEngine = new TemplateEngine($config);
- $this->TemplateEngine->setTemplate('puppet.tpl');
- $this->config = $config;
-
- // Set storage points - We do not have any - We just create a fake list which lists all items
- $this->storagePoints = array("");
-
- // Try to initialize
- $this->init();
- $this->setInstallMethod('puppet');
- $this->rebuildListing();
- }
-
-
- /*! \brief Sets the installation method to the given method.
- * Updates the template engine and adds the initial root
- * object for the selected method.
- * @param The method to use.
- * @return TRUE on success else FALSE.
- */
- function setInstallMethod($str)
- {
- if(!isset($this->allItemConfigurations[$str])){
- $this->itemConfig = array();
- $this->invalidInstallMethod =TRUE;
- $this->errorMessage = sprintf(_("Invalid installation method %s selected!"), bold($str));
- msg_dialog::display(_("Setup"), $this->errorMessage, ERROR_DIALOG);
- return(FALSE);
- }else{
-
- $this->itemConfig = $this->allItemConfigurations[$str]['items'];
- $this->invalidInstallMethod =FALSE;
- $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 = sprintf(_("Installation method %s is invalid: no root object found!"), bold($str));
- msg_dialog::display(_("Setup"), $this->errorMessage , ERROR_DIALOG);
- $this->initFailed = TRUE;
- $this->itemConfig = array();
- return(FALSE);
- }
-
- // 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->rebuildListing();
- return(TRUE);
- }
- }
-
-
- /*! \brief Intializes this plugin
- * All available installation methods will be loaded
- * and populated.
- */
- function init()
- {
- // 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->allItemConfigurations = $res;
- if(!count($this->allItemConfigurations)){
- $this->errorMessage = _("No selectable install methods available!");
- msg_dialog::display(_("Setup"), $this->errorMessage , ERROR_DIALOG);
- $this->initFailed = TRUE;
- return;
- }
- }
-
-
- /*! \brief Add a new child-item to the currently selected one.
- *
- * @param String type The 'type' of the new object, eg. 'KickstartTemplate'
- * @param String name The 'name' of the new object.
- * @param Array values The initial values for this object.
- * @return
- */
- function addItem($type,$name, $values = array())
- {
- if(!isset($this->itemConfig[$type])){
- echo "Invalid type {$type}, skipping item!<br>";
- return;
- }
-
- // Add missing values with the item-type defaults.
- $allValuesSet = TRUE;
- foreach($this->itemConfig[$type]['options'] as $oName => $oValue){
- if(!isset($values[$oName])){
- $values[$oName] = (isset($oValue['default']))?$oValue['default']:"";
- }
- }
-
- // Get the currently selected entry, its the parent for the newly
- // added one.
- $current = &$this->currentItem;
-
- // Create a FAKE base to be able to use the management lists
- // which are currently ldap and thus dn based.
- $base = (isset($current['base']))? ",".$current['base'] : '';
- $base = "{$type}={$name}{$base}";
-
-
- if(isset($this->mappingBaseToID[$base])){
- echo "Cannot add entry, dn already in use! {$base}<br>";
- return(null);
- }
-
- // Get next free item slot.
- $id = ($this->lastItemID ++);
- $new = array(
- 'base' => $base,
- 'children' => array(),
- 'id' => $id,
- 'type' => $type,
- 'name' => $name,
- 'values' => $values);
-
- // Append the entry to the list of all items.
- $this->allConfiguredItems[$id] = $new;
-
- // Create a child referenc, this creates some kind of entry tree.
- $current['children'][$id] = &$this->allConfiguredItems[$id];
-
- // Add entries to the list of base and id mappings
- // this allows us to easily detect the base for an id and vice versa.
- $this->mappingBaseToID[$id] = $base;
- $this->mappingBaseToID[$base] = $id;
- return($id);
- }
-
-
- /*! \brief Selects an item as active.
- * All further add and remove actions will be performed
- * on the obejcts children.
- * @param String The 'id' of the item we want to select.
- * @return
- */
- function setCurrentItem($item)
- {
- if(!isset($this->allConfiguredItems[$item])){
- echo "Invalid item name {$name}! Skipping selection!";
- return;
- }
-
- // Set the new item info.
- $this->currentItem = &$this->allConfiguredItems[$item];
- $this->currentItemType = $this->currentItem['type'];
- $this->currentItemDescriptor = $this->itemConfig[$this->currentItem['type']];
- }
-
-
- /*! \brief Removes a given item ID.
- * @param String The 'id' of the item we want to remove.
- * @return
- */
- function removeItem($id, &$data = NULL)
- {
- if($data === NULL){
- $data = &$this->allConfiguredItems;
- }
-
- // Remove the item and its children
- if(isset($data[$id])){
- foreach($data[$id]['children'] as $cid => $item){
- $this->removeItem($cid, $data);
- }
- unset($data[$id]);
- }
-
- // Remove to current id from sub entries
- foreach($data as $key => $item){
- $this->removeItem($id, $data[$key]['children']);
- }
- }
-
-
- /*! \brief Initiate item edit.
- * An action send from the management list.
- * @param See management::editEntry
- * @return
- */
- function editEntry($action="",$target=array(),$all=array(),
- $altTabClass ="", $altTabType = "", $altAclCategory="")
- {
- $this->setCurrentItem($target[0]);
- $this->dialogObject = $this->TemplateEngine;
- $this->skipFooter = TRUE;
- $this->dialog = TRUE;
-
- // Update the template engine to use another type of item and
- // some other values.
- $this->TemplateEngine->setValues($this->currentItemType,$this->currentItem['values']);
- }
-
-
- /*! \brief Save changes for the currently edited item.
- */
- function saveItemChanges()
- {
- // Save eventually changed values
- if($this->currentItem){
-
- // Check if everything is fine.
- $msgs = $this->TemplateEngine->save_object();
- $msgs = $this->TemplateEngine->check();
- if(count($msgs)){
- msg_dialog::displayChecks($msgs);
- }else{
- foreach($this->TemplateEngine->getWidgets() as $widget){
- $this->currentItem['values'][$widget->getName()] = $widget->getValue();
- }
- $this->closeDialogs();
- }
- }
- }
-
-
- /*! \brief React on open requests from the management list
- */
- function openEntry($action="",$target=array(),$all=array(),
- $altTabClass ="", $altTabType = "", $altAclCategory="")
- {
- $this->setSelectedListItemID($target[0]);
- }
-
-
- /*! \brief Overridden render method of class mangement.
- * this allows us to add a release selection box.
- */
- function renderList()
- {
- // In case of an error abort here.
- 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('failed.tpl', TRUE)));
- }
-
- // Collect item container list to be able to render the fake-base selector
- if(!$this->itemContainerSelector){
- $this->itemContainerSelector = new releaseSelector(
- $this->getContainerList(),
- $this->base,
- $this->allConfiguredItems[$this->rootItemID]['base']);
- }else{
- $this->itemContainerSelector->setBases($this->getContainerList());
- }
- $this->itemContainerSelector->update(true);
- $this->itemContainerSelector->setBase($this->base);
-
- session::set('DEVICE_ITEMS', $this->allConfiguredItems);
- $this->rebuildListing();
- $filter = $this->getFilter();
- $headpage = $this->getHeadpage();
-
- $headpage->update();
- $smarty = get_smarty();
- $smarty->assign("RELEASE", $this->itemContainerSelector->render());
- $display = $headpage->render();
- return($this->getHeader().$display);
- }
-
-
- /*! \brief Build up a list of items useable for the itemSelector.
- */
- function getContainerList($array = NULL)
- {
- $array = ($array == NULL)?$this->allConfiguredItems[$this->rootItemID]: $array;
- $ret[$array['base']] = $array['type'];
- if(count($array['children'])){
- foreach($array['children'] as $subItem){
- $ret = array_merge($ret, $this->getContainerList($subItem));
- }
- }
- return($ret);
- }
-
-
- /*! \brief Update the management class and tell her which
- * items are available for the itemSelector (baseSelector).
- */
- 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));
-
- // Build up device-list configuration
- $types ="";
- $images = array();
- $images[] = 'images/lists/edit.png';
- $images[] = 'images/caps.png';
- $images[] = 'images/lists/trash.png';
- $images[] = 'images/filter.png';
- $images[] = 'images/find.png';
- $i = 0;
- foreach($this->itemConfig as $type => $item){
- $desc = $item['description'];
- $img = $images[$i++];
- $types .=
- " <objectType>".
- " <label>{$desc}</label>".
- " <objectClass>{$type}</objectClass>".
- " <category>Device</category>".
- " <class>dummy</class>".
- " <image>{$img}</image>".
- " </objectType>";
- }
- $contents = preg_replace("/%TYPES%/", $types, $contents);
-
-
- $items = "";
- $i = 0;
- foreach($this->addableContainerItems as $item){
- $desc = $this->itemConfig[$item]['description'];
- $img = $images[$i++];
- $items .=
- "<action>".
- " <name>add_{$item}</name>".
- " <type>entry</type>".
- " <image>{$img}</image>".
- " <label>{$desc}</label>".
- "</action>";
- }
-
- if(!empty($items)){
- $items =
-
- "<action>".
- " <type>sub</type>".
- " <image>images/lists/element.png[new]</image>".
- " <label>Create</label>".
- " {$items}".
- "</action>";
- }
-
- $contents = preg_replace("/%ITEMS%/", $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");
- foreach($this->itemConfig as $name => $item){
- $this->registerAction("add_{$name}", "newEntry");
- }
- }
-
-
- /*! \brief This method intiates the object creation.
- *
- * @param String 'action' The name of the action which was the used as trigger.
- * @param Array 'target' A list of object dns, which should be affected by this method.
- * @param Array 'all' A combination of both 'action' and 'target'.
- */
- function newEntry($action="",$target=array(),$all=array(),
- $altTabClass ="", $altTabType = "", $altAclCategory="")
- {
- $toAdd = preg_replace("/^add_/", "",$action);
- $itemToAdd = $this->itemConfig[$toAdd];
-
- $this->dialogObject = new AddItemDialog($this->config,$toAdd,$itemToAdd);
- $this->dialog = true;
- }
-
-
- /*! \brief Saves newly created items and adds them as child to
- * the currently selected item.
- */
- function saveItemAdd()
- {
- if(!$this->dialogObject instanceOf AddItemDialog) return;
-
- $msgs = $this->dialogObject->save_object();
- $msgs = $this->dialogObject->check();
- if(count($msgs)){
- msg_dialog::displayChecks($msgs);
- }else{
- $itemName = $this->dialogObject->getName();
- $itemCfg = $this->dialogObject->getItemCfg();
- $itemType = $this->dialogObject->getItemType();
-
- $this->setCurrentItem($this->mappingBaseToID[$this->base]);
-
- $this->addItem($itemType, $itemName);
- $this->closeDialogs();
-
-# $this->setCurrentItem($itemName);
-# $this->dialogObject = $this->TemplateEngine;
-# $this->skipFooter = TRUE;
-# $this->dialog = TRUE;
-
- }
- }
-
-
- /*! \brief Keep track of posted values, some may be interesting for us.
- * Tell the template engine to take care of posted values too.
- * @param String
- * @return
- */
- function save_object()
- {
- if(isset($_POST['retryInit'])){
- $this->init();
- return;
- }
-
- // Do nothing else in case of an error
- if($this->rpcError || $this->initFailed) return;
-
- // Add sub-module requested.
- if(isset($_POST['addSubModule']) && isset($_POST['subModule'])){
- $sub = get_post('subModule');
- if(in_array_strict($sub, $this->currentItemDescriptor['container'])){
-
- // Check if this is a valid item
- if(!isset($this->itemConfig[$sub])) {
- echo "Invalid item type '{$sub}'!";
- $values = array();
- }else{
- $values = $this->itemConfig[$sub]['options'];
- }
- $name = 'test'.rand(0,99999);
- $this->addItem($sub,$name,$values);
- }
- }
-
- // Get the selected item-id from the item list and populate it.
- if($this->itemContainerSelector){
- $this->itemContainerSelector->update();
- $id = $this->mappingBaseToID[$this->itemContainerSelector->getBase()];
- $this->setSelectedListItemID($id);
- }
- }
-
-
- /* \brief Updates the currenlty seleted item in the management list
- */
- function setSelectedListItemID($id)
- {
- $this->base = $this->mappingBaseToID[$id];
- $type = $this->allConfiguredItems[$id]['type'];
- $this->addableContainerItems = $this->itemConfig[$type]['container'];
- }
-
-
- /*! \brief Forward plugin acls
- */
- function set_acl_base($base)
- {
- $this->acl_base = $base;
- }
-
-
- /*! \brief Forward plugin acls
- */
- function set_acl_category($category)
- {
- $this->acl_category = $category;
- }
-
- function save()
- {
- foreach($this->allConfiguredItems as $name => $item){
- foreach($item['values'] as $oName => $oValue){
- if(!is_array($oValue)) $oValue = array($oValue);
- foreach($oValue as $val){
- echo "<br>{$name} -- <i>{$item['type']}</i>: <b>{$oName}</b>: {$val}";
- }
- }
- }
- }
-
-
- /*! \brief Initiates the removal for the given entries
- * and displays a confirmation dialog.
- *
- * @param String 'action' The name of the action which was the used as trigger.
- * @param Array 'target' A list of object dns, which should be affected by this method.
- * @param Array 'all' A combination of both 'action' and 'target'.
- */
- protected function removeEntryRequested($action="",$target=array(),$all=array())
- {
- foreach($target as $id){
- $this->removeItem($id);
- }
- }
-
-
- // Inject user actions
- function detectPostActions()
- {
- if($this->rpcError || $this->initFailed) return(array('action' => ''));
-
- $action = management::detectPostActions();
- if(isset($_POST['saveItemEdit'])) $action['action'] = "saveItemChanges";
- if(isset($_POST['saveItemAdd'])) $action['action'] = "saveItemAdd";
- if(isset($_POST['cancelItemEdit'])) $action['action'] = "cancelItemEdit";
- if(isset($_POST['cancelItemAdd'])) $action['action'] = "cancelItemAdd";
- return($action);
- }
-
-
- function closeDialogs()
- {
- parent::closeDialogs();
- $this->dialog = false;
- }
-
-
- function check()
- {
- return(array());
- }
-
- function getRootItemId()
- {
- return($this->rootItemID);
- }
-
-
- public static function plInfo()
- {
- return (array(
- "plShortName" => _("Config management"),
- "plDescription" => _("Config management"),
- "plSelfModify" => FALSE,
- "plDepends" => array(),
- "plPriority" => 0,
- "plSection" => array("administration"),
- "plCategory" => array(
- "ConfigManagement" => array("description" => _("Config management"),
- "objectClass" => "FAKE_OC_ConfigManagement")),
- "plProvidedAcls"=> array()
- ));
- }
-}
-?>
diff --git a/gosa-plugins/goto/admin/ConfigManagement/class_TemplateEngine.inc b/gosa-plugins/goto/admin/ConfigManagement/class_TemplateEngine.inc
+++ /dev/null
@@ -1,161 +0,0 @@
-<?php
-
-/*! \brief A template engine used to render dynamic template
- * for the GOsa-devices.
- */
-class TemplateEngine
-{
- private $config;
- private $data = array();
- private $template = "";
- private $itemType = '';
- private $widgets = array();
-
-
- /*! \brief Constructs the template engine.
- * @param Config The GOsa configuration object.
- */
- function __construct($config)
- {
- $this->config = &$config;
- }
-
-
- /*! \brief Load/Sets the instruction-set to use for the current
- * device configuration.
- * A device configruation tells us what options
- * an item can have and what children.
- * @param Array The instruction set to use.
- */
- function load($array)
- {
- $this->data = $array;
- }
-
-
- /*! \brief Set the template which will be used to generate
- * the HTML content for this configuration session.
- * @param String A template filename.
- */
- function setTemplate($tmpl)
- {
- $this->template = $tmpl;
- }
-
-
- /*! \brief Returns the list of widgets which are currently used
- * by the template engine to render the plugin.
- * @return Array A list of widgets.
- */
- function getWidgets()
- {
- return($this->widgets);
- }
-
- function getItemType()
- {
- return($this->itemType);
- }
-
-
- /*! \brief Sets the current item type we want to render
- * E.g. 'KickstartTemplate' and the corresponding values.
- *
- * @param String The name of the item we want to render now.
- * @param Array The initial value.
- */
- function setValues($name, $values)
- {
- // Set the current item type and reset the widget list.
- $this->itemType = $name;
- $this->widgets = array();
-
- // Do nothing if something seems to be wrong.
- if(!isset($this->data[$this->itemType])){
- echo "Undefined item type '{$name}'!<br>";
- return;
- }
-
- // Get the options provided by the item and create widget for them.
- $data = $this->data[$this->itemType];
- if(isset($data['options']) && count($data['options'])){
- foreach($data['options'] as $name => $item){
- $widgetClassName = "TemplateWidget_{$item['type']}";
-
- // Check if the widget is available, if it is not, use a default (string).
- if(!class_available($widgetClassName)){
- echo "Unknown widget class {$widgetClassName}! Falling back to default widget.<br>";
- $widgetClassName = "TemplateWidget_string";
- }
-
- // Prepare the value for the widget
- if(!isset($values[$name])) $values[$name] = $item['default'];
-
- $value = $values[$name];
- $syntax = (isset($item['syntax']))? $item['syntax']: "";
- $providedValues = (isset($item['values']))? $item['values']: array();
-
- // Create the new widget.
- $this->widgets[$name] = new $widgetClassName($this->config, $name,
- $value,
- $item['description'],
- $syntax,
- $item['required'],
- $item['type'],
- $item['display'],
- $providedValues);
- }
- }
- }
-
-
- function execute(){
- return($this->render());
- }
-
-
- /*! \brief Creates the HTML content for the given list of widgets
- * @return String The HTML content.
- */
- function render()
- {
- $smarty = get_smarty();
- $smarty->assign("type", $this->itemType);
-
- // Tell smarty the HTML-content for each widget and the name that should be
- // displayed.
- foreach($this->widgets as $widget){
- $smarty->assign($widget->getName(), $widget->render());
- $smarty->assign($widget->getName()."Name", $widget->getDisplayName());
- }
- $template = $smarty->fetch(get_template_path("goto/Config/{$this->template}", TRUE));
-
- $smarty->assign('template', $template);
- return($smarty->fetch(get_template_path("goto/Config/TemplateEngine.tpl", TRUE)));
- }
-
-
- /*! \brief Keep track of posted values.
- */
- function save_object()
- {
- foreach($this->widgets as $widget){
- $widget->save_object();
- }
- }
-
-
- /*! \brief Check widget values and return a list of errors.
- */
- function check()
- {
- $msgs = array();
- foreach($this->widgets as $widget){
- $msgs = array_merge($msgs, $widget->check());
- }
- return($msgs);
- }
-}
-
-
-?>
diff --git a/gosa-plugins/goto/admin/ConfigManagement/class_TemplateWidget.inc b/gosa-plugins/goto/admin/ConfigManagement/class_TemplateWidget.inc
+++ /dev/null
@@ -1,122 +0,0 @@
-<?php
-
-/*! \brief The base class for all template-widgets used by the
- * device-configuration class.
- */
-class TemplateWidget
-{
- protected $name = "unnamed";
- protected $value = "";
-
- protected $description = "";
- protected $required = "";
- protected $type = "";
- protected $display = "";
- protected $syntax = "";
- protected $values = "";
-
- /*! \brief Constructs the template widget and sets the default values.
- * @param Config The GOsa configuration object.
- * @param String A name for the widget.
- * @param String The initial value.
- * @param String A description.
- * @param String True/False Must-Value/Optional-Value.
- * @param String The widget type.
- * @param String A display name for the widget.
- */
- function __construct(&$config, $name, $value, $description,$syntax,$required,$type,$display, $values=array())
- {
- $this->config = &$config;
- $this->name = $name;
- $this->value = $value;
- $this->description = $description;
- $this->required = $required;
- $this->type = $type;
- $this->syntax = $syntax;
- $this->values = $values;
- $this->display = $display;
- $class = get_class();
- $this->postName = "{$class}_{$this->name}";
- }
-
-
- /*! \brief Returns the display-name for the current widget.
- * @return String The display-name for the widget, this
- * name will usually be rendered infront of input fields.
- */
- function getDisplayName()
- {
- $must = ($this->required)?"<span class='required'>*</span>":"";
- return($this->display.$must);
- }
-
-
- /*! \brief Returns the description for the widget.
- */
- function getDescription()
- {
- return($this->description);
- }
-
-
- /*! \brief Generates the HTML code for the widget.
- * @return The HTML content for the widget.
- */
- function render()
- {
- return("");
- }
-
-
- /*! \brief Keep track of posted values.
- */
- function save_object()
- {
- if(isset($_POST[$this->postName])){
- $this->value = get_post($this->postName);
- }
- }
-
-
- /*! \brief Returns the current value.
- * @return Mixed The widgets value.
- */
- function getValue()
- {
- return($this->value);
- }
-
-
- /*! \brief Returns the name of the widget.
- * @param String The widgets name.
- */
- function getName()
- {
- return($this->name);
- }
-
-
- /*! \brief Sets a new value for the widget.
- * @param String The new value.
- */
- function setValue($value)
- {
- $this->value = $value;
- }
-
-
- /*! \brief Check the value entry using the provieded syntax.
- * @return Array Returns a list of errors
- */
- function check()
- {
- if($this->required && empty($this->value)){
- return(array(msgPool::required($this->display)));
- }
- if(!empty($this->value) && !empty($this->syntax) && !preg_match("/".$this->syntax."/", $this->value)){
- return(array(msgPool::invalid($this->display, $this->value, "/".$this->syntax."/")));
- }
- return(array());
- }
-}
-?>
diff --git a/gosa-plugins/goto/admin/ConfigManagement/class_TemplateWidget_checkbox.inc b/gosa-plugins/goto/admin/ConfigManagement/class_TemplateWidget_checkbox.inc
+++ /dev/null
@@ -1,19 +0,0 @@
-<?php
-
-class TemplateWidget_checkbox extends TemplateWidget
-{
- function render()
- {
- $str = "";
- $str .= "<input type='checkbox' value='1' name='{$this->postName}' ";
- if($this->value) $str .= " checked ";
- $str .= ">";
- return($str);
- }
-
- function save_object()
- {
- $this->value = isset($_POST[$this->postName]);
- }
-}
-?>
diff --git a/gosa-plugins/goto/admin/ConfigManagement/class_TemplateWidget_combobox.inc b/gosa-plugins/goto/admin/ConfigManagement/class_TemplateWidget_combobox.inc
+++ /dev/null
@@ -1,22 +0,0 @@
-<?php
-
-class TemplateWidget_combobox extends TemplateWidget
-{
- function render()
- {
- $str = "";
-
- // Build up list data
- $str .= "<select size='1' name='{$this->postName}'>";
- foreach($this->values as $name => $value){
- if($name == $this->value){
- $str .= "<option selected value=\"{$name}\">{$value}</option>\n";
- }else{
- $str .= "<option value=\"{$name}\">{$value}</option>\n";
- }
- }
- $str .= "</select>";
- return($str);
- }
-}
-?>
diff --git a/gosa-plugins/goto/admin/ConfigManagement/class_TemplateWidget_file.inc b/gosa-plugins/goto/admin/ConfigManagement/class_TemplateWidget_file.inc
+++ /dev/null
@@ -1,34 +0,0 @@
-<?php
-
-class TemplateWidget_file extends TemplateWidget
-{
- function render()
- {
- $title = set_post($this->description);
- if(mb_strlen($this->value) == 0){
- $ret = "<i>"._("No file uploaded yet")."</i>";
- $ret.= "<br> <input type=\"hidden\" name=\"MAX_FILE_SIZE\" value=\"2000000\">
- <input id=\"{$this->postName}\"
- name=\"{$this->postName}\"
- type=\"file\"
- size=\"20\"
- maxlength=\"255\"
- accept=\"*.*\"> ";
- $ret.= "<button name='{$this->postName}_Upload'>"._("Upload")."</button>";
- }else{
- $ret = "<i>"._("File uploaded").": ".mb_strlen($this->value)." "._("Bytes");
- $ret.= " <button name='{$this->postName}_Remove'>".msgPool::delButton()."</button>";
- }
- return($ret);
- }
-
- function save_object()
- {
- if(isset($_POST["{$this->postName}_Upload"]) && isset($_FILES[$this->postName]['tmp_name'])){
- $this->value = file_get_contents(gosa_file_name($_FILES[$this->postName]['tmp_name']));
- }
- if(isset($_POST["{$this->postName}_Remove"])) $this->value ="";
- }
-}
-
-?>
diff --git a/gosa-plugins/goto/admin/ConfigManagement/class_TemplateWidget_fixedList.inc b/gosa-plugins/goto/admin/ConfigManagement/class_TemplateWidget_fixedList.inc
+++ /dev/null
@@ -1,86 +0,0 @@
-<?php
-
-class TemplateWidget_fixedList extends TemplateWidget
-{
- protected $value = array();
-
- function __construct(&$config, $name, $value, $description,$syntax,$required,$type,$display,$values)
- {
- parent:: __construct($config, $name, $value, $description,$syntax,$required,$type,$display,$values);
-
- $this->listWidget= new sortableListing($this->value);
- $this->listWidget->setEditable(false);
- $this->listWidget->setDeleteable(true);
- $this->listWidget->setColspecs(array('*'));
- $this->listWidget->setWidth("100%");
- $this->listWidget->setHeight("70px");
- $this->listWidget->setAcl("rwcdm");
- }
-
- function getAvailableOptions()
- {
- $tmp = array();
- foreach($this->values as $key => $name){
- if(!in_array_strict($key, $this->value)){
- $tmp[$key]=$name;
- }
- }
- return($tmp);
- }
-
- function render()
- {
- $str = "";
-
- // Build up list data
- $data = $this->value;
- foreach($this->value as $key => $name){
- $lData[$key] = array('data' => array($this->values[$name]));
- }
- $this->listWidget->setListData($data, $lData);
- $this->listWidget->update();
- $str .= $this->listWidget->render();
- $str .= "<select size='1' name='{$this->postName}_Input'>";
- foreach($this->getAvailableOptions() as $name => $value){
- $str .= "<option value=\"{$name}\">{$value}</option>\n";
- }
- $str .= "</select>";
- $str .= "<button name='{$this->postName}_Add'>".msgPool::addButton()."</button>";
- return($str);
- }
-
- function save_object()
- {
- $this->listWidget->save_object();
- $action = $this->listWidget->getAction();
- if($action['action'] == 'delete'){
- $id = $this->listWidget->getKey($action['targets'][0]);
- unset($this->value[$id]);
- $this->value = array_values($this->value);
- }
-
- if(isset($_POST["{$this->postName}_Add"]) && isset($_POST["{$this->postName}_Input"])){
- $input = get_post("{$this->postName}_Input");
-
- if(!empty($input) && !empty($this->syntax) && !preg_match("/".$this->syntax."/", $input)){
- msg_dialog::displayChecks(array(msgPool::invalid($this->display, $input, "/".$this->syntax."/")));
- }elseif(!empty($input)){
- $this->value[] = $input;
- }
- }
- }
-
- /*! \brief Check the value entry using the provieded syntax.
- * @return Array Returns a list of errors
- */
- function check()
- {
- if($this->required && empty($this->value)){
- return(array(msgPool::required($this->display)));
- }
- return(array());
- }
-}
-
-
-?>
diff --git a/gosa-plugins/goto/admin/ConfigManagement/class_TemplateWidget_list.inc b/gosa-plugins/goto/admin/ConfigManagement/class_TemplateWidget_list.inc
+++ /dev/null
@@ -1,64 +0,0 @@
-<?php
-
-class TemplateWidget_list extends TemplateWidget
-{
- function __construct(&$config, $name, $value, $description,$syntax,$required,$type,$display,$values)
- {
- parent:: __construct($config, $name, $value, $description,$syntax,$required,$type,$display,$values);
-
- $this->listWidget= new sortableListing($this->value);
- $this->listWidget->setEditable(false);
- $this->listWidget->setDeleteable(true);
- $this->listWidget->setColspecs(array('*'));
- $this->listWidget->setWidth("100%");
- $this->listWidget->setHeight("70px");
- $this->listWidget->setAcl("rwcdm");
- }
-
-
- function render()
- {
- $str = "";
- $this->listWidget->setListData($this->value);
- $this->listWidget->update();
- $str .= $this->listWidget->render();
- $str .= "<input type='text' name='{$this->postName}_Input'>";
- $str .= "<button name='{$this->postName}_Add'>".msgPool::addButton()."</button>";
- return($str);
- }
-
- function save_object()
- {
- $this->listWidget->save_object();
- $action = $this->listWidget->getAction();
- if($action['action'] == 'delete'){
- $id = $this->listWidget->getKey($action['targets'][0]);
- unset($this->value[$id]);
- $this->value = array_values($this->value);
- }
-
- if(isset($_POST["{$this->postName}_Add"]) && isset($_POST["{$this->postName}_Input"])){
- $input = get_post("{$this->postName}_Input");
-
- if(!empty($input) && !empty($this->syntax) && !preg_match("/".$this->syntax."/", $input)){
- msg_dialog::displayChecks(array(msgPool::invalid($this->display, $input, "/".$this->syntax."/")));
- }elseif(!empty($input)){
- $this->value[] = $input;
- }
- }
- }
-
- /*! \brief Check the value entry using the provieded syntax.
- * @return Array Returns a list of errors
- */
- function check()
- {
- if($this->required && empty($this->value)){
- return(array(msgPool::required($this->display)));
- }
- return(array());
- }
-}
-
-
-?>
diff --git a/gosa-plugins/goto/admin/ConfigManagement/class_TemplateWidget_string.inc b/gosa-plugins/goto/admin/ConfigManagement/class_TemplateWidget_string.inc
+++ /dev/null
@@ -1,18 +0,0 @@
-<?php
-
-class TemplateWidget_string extends TemplateWidget
-{
- function render()
- {
- $desc = set_post($this->description);
- $value = set_post($this->value);
-
- $name = " name=\"{$this->postName}\" ";
- $value = " value=\"{$value}\" ";
- $title = (empty($this->description))?"": " title=\"{$desc}\"";
-
- return("<input type='text' {$title} {$name} {$value }>");
- }
-}
-
-?>
diff --git a/gosa-plugins/goto/admin/ConfigManagement/class_TemplateWidget_textEditor.inc b/gosa-plugins/goto/admin/ConfigManagement/class_TemplateWidget_textEditor.inc
+++ /dev/null
@@ -1,75 +0,0 @@
-<?php
-
-class TemplateWidget_textEditor extends TemplateWidget
-{
- protected $value = array();
- protected $write_protect = FALSE;
-
- function __construct(&$config, $name, $value, $description,$syntax,$required,$type,$display,$values)
- {
- parent:: __construct($config, $name, $value, $description,$syntax,$required,$type,$display,$values);
-
- // Keep an eye on dangerous encodings, we may break scripts while editing.
- $this->mb_extension = function_exists("mb_detect_encoding");
- if($this->mb_extension){
- $this->enc_before_edit = mb_detect_encoding($this->value);
- if($this->enc_before_edit != "ASCII"){
- $this->write_protect = TRUE;
- }
- }
- }
-
-
- function render()
- {
- $smarty = get_smarty();
- $smarty->assign("postName", set_post($this->postName));
- $smarty->assign("write_protect", set_post($this->write_protect));
- $smarty->assign("value", set_post($this->value));
- return($smarty->fetch(get_template_path("TemplateWidget_textEditor.tpl", TRUE, dirname(__FILE__))));
- }
-
-
- function save_object()
- {
- TemplateWidget::save_object();
- if(isset($_POST['editAnyway'])) $this->write_protect = FALSE;
-
- if(isset($_POST['ImportUpload'])){
- if(($_FILES['ImportFile']['error']!=0)){
- msg_dialog::display(_("Error"), msgPool::incorrectUpload(), ERROR_DIALOG);
- }elseif(($_FILES['ImportFile']['size']==0)){
- msg_dialog::display(_("Error"), msgPool::incorrectUpload(_("file is empty")), ERROR_DIALOG);
- }else{
- $str = file_get_contents(gosa_file_name($_FILES['ImportFile']['tmp_name']));
- $this->value = $str;
-
- // Check encoding again
- if($this->mb_extension){
- $this->enc_before_edit = mb_detect_encoding($this->value);
- if($this->enc_before_edit != "ASCII"){
- $this->write_protect = TRUE;
- }
- }
- }
- }
- $this->enc_after_edit = mb_detect_encoding($this->value);
- }
-
-
- /*! \brief Check the value entry using the provieded syntax.
- * @return Array Returns a list of errors
- */
- function check()
- {
- $msgs = TemplateWidget::check();
- if($this->mb_extension && !$this->write_protect && $this->enc_after_edit !== $this->enc_before_edit ){
- $msg = sprintf(_("The text encoding has changed from %s to %s. Do you really want to save?"),
- bold($this->enc_before_edit),bold($this->enc_after_edit));
- $msgs[] = $msg;
- $this->enc_before_edit = $this->enc_after_edit;
- }
- return($msgs);
- }
-}
-?>
diff --git a/gosa-plugins/goto/admin/ConfigManagement/class_TemplateWidget_textarea.inc b/gosa-plugins/goto/admin/ConfigManagement/class_TemplateWidget_textarea.inc
+++ /dev/null
@@ -1,16 +0,0 @@
-<?php
-
-class TemplateWidget_textarea extends TemplateWidget
-{
- function render()
- {
- $title = set_post($this->description);
- return("<textarea title=\"{$title}\"
- style='width:100%'
- rows=4 type='text'
- name=\"{$this->postName}\">".set_post($this->value)."</textarea>");
- }
-
-}
-
-?>
diff --git a/gosa-plugins/goto/admin/ConfigManagement/class_filterDeviceItems.inc b/gosa-plugins/goto/admin/ConfigManagement/class_filterDeviceItems.inc
+++ /dev/null
@@ -1,57 +0,0 @@
-<?php
-
-class filterDeviceItems {
-
- 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('DEVICE_ITEMS');
- foreach($data as $id => $item){
- if($item['base'] == $base){
- $data = $item['children'];
- break;;
- }
- }
-
- // 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 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/goto/admin/ConfigManagement/failed.tpl b/gosa-plugins/goto/admin/ConfigManagement/failed.tpl
+++ /dev/null
@@ -1,12 +0,0 @@
-{if $rpcError}
- <h3>{t}Error{/t}</h3>
- {msgPool type=rpcError p1=$error}
- <button name='retryInit'>{t}Retry{/t}</button>
-{elseif $initFailed}
- <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}
diff --git a/gosa-plugins/goto/admin/ConfigManagement/main.inc b/gosa-plugins/goto/admin/ConfigManagement/main.inc
+++ /dev/null
@@ -1,56 +0,0 @@
-<?php
-/*
- * This code is part of GOsa (http://www.gosa-project.org)
- * Copyright (C) 2003-2008 GONICUS GmbH
- *
- * ID: $$Id: main.inc 14740 2009-11-04 09:41:16Z hickert $$
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
- */
-
-/* Remove locks created by this plugin
- */
-if ($remove_lock){
- if(session::is_set('ConfigManagement')){
- $macl = session::get('ConfigManagement');
- $macl->remove_lock();
- }
-}
-
-/* Remove this plugin from session
- */
-if ( $cleanup ){
- session::un_set('ConfigManagement');
-}else{
-
- /* Create ConfigManagement object on demand */
- if (!session::is_set('ConfigManagement')){
- $ConfigManagement= new ConfigManagement ($config, $ui);
- session::set('ConfigManagement',$ConfigManagement);
- }
- $ConfigManagement = session::get('ConfigManagement');
- $display= $ConfigManagement->execute();
-
- /* Reset requested? */
- if (isset($_GET['reset']) && $_GET['reset'] == 1){
- session::un_set ('ConfigManagement');
- }
-
- /* Show and save dialog */
- session::set('ConfigManagement',$ConfigManagement);
-}
-
-// vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
-?>
diff --git a/gosa-plugins/goto/admin/ConfigManagement/puppet.tpl b/gosa-plugins/goto/admin/ConfigManagement/puppet.tpl
+++ /dev/null
@@ -1,39 +0,0 @@
-{if $type == 'PuppetModule'}
- <table width="100%">
- <tr>
- <td style="width:50%; vertical-align: top;">
- <table>
- <tr>
- <td>{$nameName}</td>
- <td>{$name}</td>
- </tr>
- <tr>
- <td>{$descriptionName}</td>
- <td>{$description}</td>
- </tr>
- <tr>
- <td>{$versionName}</td>
- <td>{$version}</td>
- </tr>
- </table>
- </td>
- <td style="width:50%; vertical-align: top;">
- {$dependencyName}:<br>
- {$dependency}
- </td>
- </tr>
- </table>
-{/if}
-{if $type == 'PuppetTemplate'}
- <table>
- <tr>
- <td>{$nameName}</td>
- <td>{$name}</td>
- </tr>
- <tr>
- <td>{$dataName}</td>
- <td>{$data}</td>
- </tr>
- </table>
- <input type='submit'>
-{/if}
diff --git a/gosa-plugins/goto/admin/systems/goto/Device/AddPartitionDialog.tpl b/gosa-plugins/goto/admin/systems/goto/Device/AddPartitionDialog.tpl
+++ /dev/null
@@ -1,287 +0,0 @@
-{if $error}
-
- <p>
- {$errorMsg}
- </p>
- <button type='submit' name='retry'>{t}Retry{/t}</button>
-
- <hr>
- <div class="clear"></div>
-
- <div class="plugin-actions">
- <button type='submit' name='cancel_partition_add'>{msgPool type=cancelButton}</button>
- </div>
-
-{else}
-
- <h3>{t}Type{/t}</h3>
-
- <input {if $selected_type==0} checked {/if} onClick="document.mainform.submit();"
- type="radio" value="0" name="selected_type">{t}Disk{/t}<br>
- <input {if $selected_type==1} checked {/if} onClick="document.mainform.submit();"
- {if !count($disks)} disabled {/if}
- type="radio" value="1" name="selected_type">{t}Physical partition{/t}<br>
- <input {if count($freeRaidPartitions) < 1} disabled {/if}
- {if $selected_type==2} checked {/if} onClick="document.mainform.submit();"
- type="radio" value="2" name="selected_type">{t}Raid device{/t}<br>
- <input {if !count($freeLvmPartitions)} disabled {/if}
- {if $selected_type==3} checked {/if} onClick="document.mainform.submit();"
- type="radio" value="3" name="selected_type">{t}LVM Volume group{/t}<br>
- <input {if $selected_type==4} checked {/if} onClick="document.mainform.submit();"
- {if !count($volumeGroupList)} disabled {/if}
- type="radio" value="4" name="selected_type">{t}LVM Volume{/t}<br>
-
- <hr>
-
- {if $selected_type==4}
-
- <h3>{t}LVM Volume{/t}</h3>
- <table>
- <tr>
- <td>{t}Volume name{/t}</td>
- <td>
- <input type="text" name="v_name" value="{$v_name}">
- </td>
- </tr>
- <tr>
- <td>{t}Volume group{/t}</td>
- <td>
- <select name="v_group">
- {foreach from=$volumeGroupList item=item}
- <option value="{$item}"
- {if $item==$v_group} selected {/if}
- >{$item} {if isset($deviceUsage.vg[$item])} - ({$deviceUsage.vg[$item].size - $deviceUsage.vg[$item].usage} {t}MB{/t} {t}free{/t}){/if}</option>
- {/foreach}
- </select>
- </td>
- </tr>
- <tr>
- <td>{t}Mount point{/t}</td>
- <td>
- {if $v_fsType == "swap"}
- <input disabled type="text" name="v_mountPoint" value=" - ">
- {else}
- <input type="text" name="v_mountPoint" value="{$v_mountPoint}">
- {/if}
- </td>
- </tr>
- <tr>
- <td>{t}File system type{/t}</td>
- <td>
- <select name="v_fsType" onChange="document.mainform.submit();">
- {html_options options=$fsTypes selected=$v_fsType}
- </select>
- </td>
- </tr>
- <tr>
- <td>{t}Size{/t}</td>
- <td>
- <input name="v_size" value="{$v_size}">
- </td>
- </tr>
- <tr>
- <td>{t}Encrypt{/t}</td>
- <td><input type="checkbox" name="v_encrypt" {if $v_encrypt_selected} checked {/if}></td>
- </tr>
- </table>
-
- {elseif $selected_type==3}
-
- <h3>{t}LVM Volume group{/t}</h3>
- <table>
- <tr>
- <td>{t}Volume group name{/t}</td>
- <td>
- <input type="text" name="vg_name" value="{$vg_name}">
- </td>
- </tr>
- <tr>
- <td>{t}Use LVM partitions{/t}</td>
- <td>
- {foreach from=$freeLvmPartitions item=item key=key}
- <input type="checkbox" name="vg_partition_{$key}"
- {if in_array($item, $vg_partitions)} checked {/if}> {$item}
- {if isset($deviceUsage.part[$item])} {$deviceUsage.part[$item].size} {t}MB{/t}
- {elseif isset($deviceUsage.raid[$item])} {$deviceUsage.raid[$item].size} {t}MB{/t}{/if}
- <br>
- {/foreach}
- </td>
- </tr>
- </table>
-
- {elseif $selected_type==2}
- <h3>{t}Add raid device{/t}</h3>
-
- <table>
- <tr>
- <td>{t}Mount point{/t}</td>
- <td>
- {if $r_fsType == "swap" || $r_fsType == "pv"}
- <input disabled type="text" name="r_mountPoint" value=" - ">
- {else}
- <input type="text" name="r_mountPoint" value="{$r_mountPoint}">
- {/if}
- </td>
- </tr>
- <tr>
- <td>{t}File system type{/t}</td>
- <td>
- <select name="r_fsType" onChange="document.mainform.submit();">
- {html_options options=$fsTypes selected=$r_fsType}
- </select>
- </td>
- </tr>
- <tr>
- <td>{t}Raid level{/t}</td>
- <td>
- <select name="r_raidLevel">
- {html_options options=$raidLevelList selected=$r_raidLevel}
- </select>
- </td>
- </tr>
- <tr>
- <td>{t}Use raid partitions{/t}</td>
- <td>
- {foreach from=$freeRaidPartitions item=item key=key}
- <input type="checkbox" name="r_partition_{$key}"
- {if in_array($item, $r_partitions)} checked {/if}> {$item}
- {if isset($deviceUsage.part[$item])} {$deviceUsage.part[$item].size} {t}MB{/t}
- {elseif isset($deviceUsage.raid[$item])} {$deviceUsage.raid[$item].size} {t}MB{/t}{/if}
- <br>
- {/foreach}
- </td>
- </tr>
- <tr>
- <td>{t}Number of spares{/t}</td>
- <td>
- <input type="text" value="{$r_spares}" name="r_spares">
- </td>
- </tr>
- <tr>
- <td>{t}Encrypt{/t}</td>
- <td><input type="checkbox" name="r_encrypt" {if $r_encrypt_selected} checked {/if}></td>
- </tr>
- </table>
-
- {elseif $selected_type==1}
-
- <table width="100%">
- <tr>
- <td style="width:50%">
- <h3>{t}Add Partition{/t}</h3>
- <table>
- <tr>
- <td>{t}Mount point{/t}</td>
- <td>
- {if $p_fsType == "raid" || $p_fsType == "swap" || $p_fsType == "pv"}
- <input disabled type="text" name="p_mountPoint" value=" - ">
- {else}
- <input type="text" name="p_mountPoint" value="{$p_mountPoint}">
- {/if}
- </td>
- </tr>
- <tr>
- <td>{t}File system type{/t}</td>
- <td>
- <select name="p_fsType" onChange="document.mainform.submit();">
- {html_options options=$fsTypes selected=$p_fsType}
- </select>
- </td>
- </tr>
- <tr>
- <td>{t}Allowable drives{/t}</td>
- <td>
- <select name="p_used_disk" onChange="document.mainform.submit();">
- {foreach from=$disks item=disk}
- <option value="{$disk}"
- {if $disk==$p_used_disk} selected {/if}
- >{$disk} {if isset($deviceUsage.disk[$p_used_disk])} - ({$deviceUsage.disk[$p_used_disk].size - $deviceUsage.disk[$p_used_disk].usage} {t}MB{/t} {t}free{/t}){/if}</option>
- {/foreach}
- </select>
- </td>
- </tr>
- <tr>
- <td>{t}Size{/t}</td>
- <td>
- <input name="p_size" value="{$p_size}">
- </td>
- </tr>
- <tr>
- <td>{t}Force to be primary partition{/t}</td>
- <td><input type="checkbox" name="p_forcePrimary" {if $p_forcePrimary_selected} checked {/if}></td>
- </tr>
- <tr>
- <td>{t}Bootable{/t}</td>
- <td><input type="checkbox" name="p_bootable" {if $p_bootable_selected} checked {/if}></td>
- </tr>
- <tr>
- <td>{t}Encrypt{/t}</td>
- {if $p_fsType == "raid" || $p_fsType == "swap" || $p_fsType == "pv"}
- <td><input disabled type="checkbox" name="p_encrypt"></td>
- {else}
- <td><input type="checkbox" name="p_encrypt" {if $p_encrypt_selected} checked {/if}></td>
- {/if}
- </tr>
- <tr>
- <td>{t}Format{/t}</td>
- {if $p_fsType == "raid" || $p_fsType == "swap" || $p_fsType == "pv"}
- <td><input disabled type="checkbox" name="p_format"></td>
- {else}
- <td><input type="checkbox" name="p_format" {if $p_format_selected} checked {/if}></td>
- {/if}
- </tr>
- </table>
- </td>
- <td class="left-border"></td>
- <td>
-
- <h3>{t}Additional size options{/t}</h3>
- <table>
- <tr>
- <td><input type="radio" name="p_size_options" value="0"
- onClick="document.mainform.submit();"
- {if $p_size_options==0} checked {/if}></td>
- <td>{t}Fixed size{/t}</td>
- </tr>
- <tr>
- <td><input type="radio" name="p_size_options" value="2"
- onClick="document.mainform.submit();"
- {if $p_size_options==2} checked {/if}></td>
- <td>{t}Fill to maximum allowable size{/t}</td>
- </tr>
- <tr>
- <td><input type="radio" name="p_size_options" value="1"
- onClick="document.mainform.submit();"
- {if $p_size_options==1} checked {/if}></td>
- <td>{t}Fill all space up to{/t}
- <input {if $p_size_options != 1} disabled {/if}
- id="p_size_max_value"
- name="p_size_max_value"
- type="text" value="{$p_size_max_value}"> {t}MB{/t}
- </td>
- </tr>
- </table>
- </td>
- </tr>
- </table>
- {elseif $selected_type==0}
- <h3>{t}Add disk{/t}</h3>
- <table>
- <tr>
- <td>{t}Disk name{/t}</td>
- <td>
- <input type="text" name="d_name" value="{$d_name}">
- </td>
- </tr>
- </table>
- {/if}
-
- <hr>
- <div class="clear"></div>
-
- <div class="plugin-actions">
- <button type='submit' name='save_partition_add'>{msgPool type=addButton}</button>
- <button type='submit' name='cancel_partition_add'>{msgPool type=cancelButton}</button>
- </div>
-
-{/if}
diff --git a/gosa-plugins/goto/admin/systems/goto/Device/Device.tpl b/gosa-plugins/goto/admin/systems/goto/Device/Device.tpl
+++ /dev/null
@@ -1,185 +0,0 @@
-<table width="100%">
- <tr>
- <td style='width:50%;'>
-
- <h3>{t}Device{/t}</h3>
- <table>
- <tr>
- <td><LABEL for='name'>{t}Name{/t}</LABEL>{if $registeredRequired}{$must}{/if}</td>
- <td>
- {render acl=$cnACL}
- <input type="text" name="cn" value="{$cn}" id="cn" value="{$cn}">
- {/render}
- </td>
- </tr>
- <tr>
- <td><LABEL for='description'>{t}Description{/t}</LABEL></td>
- <td>
- {render acl=$descriptionACL}
- <input type="text" name="description" value="{$description}" id="description" value="{$description}">
- {/render}
- </td>
- </tr>
- <tr>
- <td>
- <div style="height:10px;"> </div>
- {t}Base{/t}
- </td>
- <td>
- <div style="height:10px;"> </div>
- {render acl=$baseACL}
- {$base}
- {/render}
- </td>
- </tr>
- </table>
- </td>
- <td class='left-border' style='padding-left:5px;'>
- <h3>{t}Orgaizational data{/t}</h3>
- <table>
- <tr>
- <td><LABEL for='ou'>{t}Organizational Unit{/t}</LABEL></td>
- <td>
- {render acl=$ouACL}
- <input type="text" name="ou" value="{$ou}" id="ou" value="{$ou}">
- {/render}
- </td>
- </tr>
- <tr>
- <td><LABEL for='o'>{t}Organization{/t}</LABEL></td>
- <td>
- {render acl=$oACL}
- <input type="text" name="o" value="{$o}" id="o" value="{$o}">
- {/render}
- </td>
- </tr>
- <tr>
- <td><LABEL for='l'>{t}Location{/t}</LABEL></td>
- <td>
- {render acl=$lACL}
- <input type="text" name="l" value="{$l}" id="l" value="{$l}">
- {/render}
- </td>
- </tr>
- <tr>
- <td><LABEL for='serialNumber'>{t}Serial number{/t}</LABEL></td>
- <td>
- {render acl=$serialNumberACL}
- <input type="text" name="serialNumber" value="{$serialNumber}" id="serialNumber" value="{$serialNumber}">
- {/render}
- </td>
- </tr>
-<!--
- <tr>
- <td><LABEL for='seeAlso'>{t}See also{/t}</LABEL></td>
- <td>
- {render acl=$seeAlsoACL}
- <input type="text" name="seeAlso" value="{$seeAlso}" id="seeAlso" value="{$seeAlso}">
- {/render}
- </td>
- </tr>
--->
-<!--
- <tr>
- <td><LABEL for='owner'>{t}Owner{/t}</LABEL></td>
- <td>
- {render acl=$ownerACL}
- <input type="text" name="owner" value="{$owner_name}" id="owner" value="{$owner_name}"
- title="{$owner}" disabled style="width:120px;">
- {/render}
-
- {image path="images/lists/edit.png" action="editOwner" acl=$ownerACL}
- {if $owner!=""}
- {image path="images/info_small.png" title="{$owner}" acl=$ownerACL}
- {image path="images/lists/trash.png" action="removeOwner" acl=$ownerACL}
- {/if}
- </td>
- </tr>
--->
- </table>
- </td>
- </tr>
- <tr>
- <td colspan="2">
- <hr>
- </td>
- </tr>
- <tr>
- <td style='width:50%;'>
- <h3>{t}Registration{/t}</h3>
- <table>
- <tr>
- <td><LABEL for='deviceUUID'>{t}Device UUID{/t}{if $registeredRequired}{$must}{/if}</LABEL></td>
- <td>
- {render acl=$deviceUUIDACL}
- <input type="text" name="deviceUUID" value="{$deviceUUID}" id="deviceUUID" value="{$deviceUUID}">
- {/render}
- {render acl=$deviceUUIDACL}
- {image path="images/lists/reload.png" action="reloadUUID"}
- {/render}
- </td>
- </tr>
- <tr>
- <td><LABEL for='deviceType'>{t}Type{/t}</LABEL>
- </td>
- <td>
- {render acl=$deviceTypeACL}
- <input type="text" name="deviceType" value="{$deviceType}" id="deviceType" value="{$deviceType}">
- {/render}
- </td>
- </tr>
- </table>
- </td>
- <td class='left-border' style='padding-left:5px; padding-top:10px;'>
- <table>
- <tr>
- <td><LABEL for='deviceStatus'>{t}Status{/t}{if $registeredRequired}{$must}{/if}</LABEL>
- </td>
- <td>
- {render acl=$deviceStatusACL}
- <input type="text" name="deviceStatus" value="{$deviceStatus}" id="deviceStatus" value="{$deviceStatus}">
- {/render}
- </td>
- </tr>
- <tr>
- <td><LABEL for='manager'>{t}Manager{/t}{if $registeredRequired}{$must}{/if}</LABEL>
- </td>
- <td>
- {render acl=$managerACL}
- <input type="text" name="manager" value="{$manager_name}" id="manager" value="{$manager_name}"
- title="{$manager}" disabled style="width:120px;">
- {/render}
-
- {image path="images/lists/edit.png" action="editManager" acl=$managerACL}
- {if $manager!=""}
- {image path="images/info_small.png" title="{$manager}" acl=$managerACL}
- {image path="images/lists/trash.png" action="removeManager" acl=$managerACL}
- {/if}
- </td>
- </tr>
- </table>
- </td>
- </tr>
-</table>
- <hr>
- <h3>{t}Network settings{/t}</h3>
- <table>
- <tr>
- <td><LABEL for='ipHostNumber'>{t}IP address{/t}</LABEL>
- </td>
- <td>
- {render acl=$ipHostNumberACL}
- <input type="text" name="ipHostNumber" value="{$ipHostNumber}" id="ipHostNumber" value="{$ipHostNumber}">
- {/render}
- </td>
- </tr>
- <tr>
- <td><LABEL for='macAddress'>{t}MAC address{/t}</LABEL>
- </td>
- <td>
- {render acl=$macAddressACL}
- <input type="text" name="macAddress" value="{$macAddress}" id="macAddress" value="{$macAddress}">
- {/render}
- </td>
- </tr>
- </table>
diff --git a/gosa-plugins/goto/admin/systems/goto/Device/DeviceConfig.tpl b/gosa-plugins/goto/admin/systems/goto/Device/DeviceConfig.tpl
+++ /dev/null
@@ -1,34 +0,0 @@
-{if $error}
-
- <p>
- {$errorMsg}
- </p>
- <button type='submit' name='retry'>{t}Retry{/t}</button>
-
-{else}
-
- <table width='100%'>
- <tr>
- <td style='width:50%; vertical-align: top;padding-right:5px;'>
- <h3>{t}Assignable items{/t}</h3>
- {$assignableElementsList}
- </td>
- <td style='width:50%; vertical-align: top;padding-left:5px;' class='left-border'>
- <h3>{t}Assigned items{/t}</h3>
- {$usedElementsList}
- </td>
- </tr>
- <tr>
- <td colspan=2>
- <hr>
- </td>
- </tr>
- <tr>
- <td colspan=2>
- <h3>{t}Parameters{/t}</h3>
- {$parameterList}
- </td>
- </tr>
- </table>
-
-{/if}
diff --git a/gosa-plugins/goto/admin/systems/goto/Device/DevicePartition.tpl b/gosa-plugins/goto/admin/systems/goto/Device/DevicePartition.tpl
+++ /dev/null
@@ -1,23 +0,0 @@
-<h3>{t}Device partition{/t}</h3>
-
-{if $error}
-
- <p>
- {$errorMsg}
- </p>
- <button type='submit' name='retry'>{t}Retry{/t}</button>
-
-{else}
-
- {$list}
-
- <button name="create_partition">{msgPool type=addButton}</button>
-
- <hr>
-
- <div class="clear"></div>
- <div class="plugin-actions">
- <button type='submit' name='partition_finish'>{msgPool type=applyButton}</button>
- <button type='submit' name='partition_cancel'>{msgPool type=cancelButton}</button>
- </div>
-{/if}
diff --git a/gosa-plugins/goto/admin/systems/goto/Device/DeviceTab.inc b/gosa-plugins/goto/admin/systems/goto/Device/DeviceTab.inc
+++ /dev/null
@@ -1,56 +0,0 @@
-<?php
-
-class DeviceTab extends tabs
-{
- function save($ignore_account= FALSE)
- {
- // Prepare object DN
- $baseobject= $this->by_object['Device'];
- $uuid = $baseobject->deviceUUID;
- $orig_uuid = $baseobject->orig_deviceUUID;
-
-
- $rdn = get_ou('Device','GOsaDeviceRDN');
- $cn = preg_replace('/,/', '\,', $baseobject->cn);
- $cn = preg_replace('/"/', '\"', $cn);
-
- $dnCn = "cn=".$cn.",".$rdn.$baseobject->base;
- $dnUuid= "deviceUUID=".$uuid.",".$rdn.$baseobject->base;
-
- // Save object using the 'cn' in the dn and then move it to 'uuid';
- $moveToUUID = FALSE;
- if(!empty($uuid) && empty($orig_uuid) && $baseobject->orig_dn != "new"){
- $moveToUUID = TRUE;
- }
-
- // Detect target dn
- $this->dn = (empty($uuid)) ? $dnCn : $dnUuid;
-
- if($moveToUUID) $this->dn = $dnCn;
-
- // Populate values
- foreach ($this->by_object as $key => $obj){
- $this->by_object[$key]->dn= $this->dn;
- $this->by_object[$key]->cn= $baseobject->cn;
- }
-
- // Object moved?
- if($this->dn != $baseobject->orig_dn && $baseobject->orig_dn != "new"){
- $baseobject->update_acls($baseobject->orig_dn,$this->dn);
- $baseobject->move($baseobject->orig_dn,$this->dn);
- $baseobject->orig_dn = $this->dn;
- }
-
- // Save now
- tabs::save();
-
- if($moveToUUID){
- $this->dn = (empty($uuid)) ? $dnCn : $dnUuid;
- $baseobject->update_acls($baseobject->orig_dn,$this->dn);
- $baseobject->move($baseobject->orig_dn,$this->dn);
- }
-
- }
-}
-
-?>
diff --git a/gosa-plugins/goto/admin/systems/goto/Device/InstallRecipe.tpl b/gosa-plugins/goto/admin/systems/goto/Device/InstallRecipe.tpl
+++ /dev/null
@@ -1,188 +0,0 @@
-
-<table width="100%">
- <tr>
- <td style="width:50%">
- <h3>{t}Installation type{/t}</h3>
- <table>
- <tr>
- <td><LABEL for="installTemplate">{t}Template{/t}</LABEL></td>
- <td>
- {render acl=$installTemplateACL}
- <select name="installTemplate" size=1 onChange="document.mainform.submit();">
- {html_options options=$installTemplateList
- selected=$installTemplate}
- </select>
- {/render}
- </td>
- </tr>
- <tr>
- <td><LABEL for="installRelease">{t}Release{/t}</LABEL></td>
- <td>
- {render acl=$installReleaseACL}
- <select name="installRelease" size=1 onChange="document.mainform.submit();">
- {html_options options=$installReleaseList
- selected=$installRelease}
- </select>
- {/render}
- </td>
- </tr>
- <tr>
- <td><LABEL for="installConfigManagement">{t}Config management{/t}</LABEL></td>
- <td>
- {render acl=$installConfigManagementACL}
- <select name="installConfigManagement" size=1 onChange='document.mainform.submit();'>
- {html_options options=$installConfigManagementList
- selected=$installConfigManagement}
- </select>
- {/render}
- </td>
- </tr>
- </table>
- </td>
- <td style='width:50%; vertical-align: top;padding-left:5px;' class='left-border'>
- <h3>{t}Partition table{/t}</h3>
- <table>
- <tr>
- <td><LABEL for="installPartitionTable">{t}Partition table{/t}</LABEL></td>
- <td>
- {render acl=$installPartitionTableACL}
- <input type='submit' name="edit_installPartitionTable" id="edit_installPartitionTable"
- value="{t}Edit partition table{/t}">
- {/render}
- </td>
- </tr>
- </table>
- </td>
- </tr>
-</table>
-
-<hr>
-<table style='width:100%;'>
- <tr>
- <td style='width:50%; vertical-align: top;'>
- <h3>{t}Bootstrap settings{/t}</h3>
-
- <table>
- <tr>
- <td><LABEL for="installMirror">{t}Mirror{/t}</LABEL></td>
- <td>
- {render acl=$installMirrorACL}
- <select name="installMirror" size=1>
- {html_options options=$installMirrorList
- selected=$installMirror}
- </select>
- {/render}
- </td>
- </tr>
- <tr>
- <td><LABEL for="installKernelPackage">{t}Kernel package{/t}</LABEL></td>
- <td>
- {render acl=$installKernelPackageACL}
- <select name="installKernelPackage" size=1>
- {html_options values=$installKernelPackageList output=$installKernelPackageList
- selected=$installKernelPackage}
- </select>
- {/render}
- </td>
- </tr>
- </table>
- </td>
- <td style='width:50%; vertical-align: top;padding-left:5px;' class='left-border'>
- <h3>{t}Login{/t}</h3>
-
- <table>
- <tr>
- <td>
- {render acl=$installRootEnabledACL}
- <input type='checkbox' value='1' {if $installRootEnabled} checked {/if}
- onClick="changeState('setPasswordHash');"
- name="installRootEnabled" id="installRootEnabled"
- >
- {/render}
- <LABEL for="installRootEnabled">{t}Use root user{/t}</LABEL>
- {render acl=$installRootPasswordHashACL}
- <button name='setPasswordHash'
- {if !$installRootEnabled} disabled {/if}
- id="setPasswordHash">{t}Set password{/t}</button>
- {/render}
- </td>
- </tr>
- </table>
- </td>
- </tr>
- <tr>
- <td colspan=2><hr></td>
- </tr>
- <tr>
- <td style='width:50%; vertical-align: top;'>
- <h3>{t}Locale{/t}</h3>
-
- <table>
- <tr>
- <td><LABEL for="installKeyboardlayout">{t}Keyboard layout{/t}</LABEL></td>
- <td>
- {render acl=$installKeyboardlayoutACL}
- <select name="installKeyboardlayout" size=1>
- {html_options options=$installKeyboardlayoutList
- selected=$installKeyboardlayout}
- </select>
- {/render}
- </td>
- </tr>
- <tr>
- <td><LABEL for="installSystemLocale">{t}System locale{/t}</LABEL></td>
- <td>
- {render acl=$installSystemLocaleACL}
- <select name="installSystemLocale" size=1>
- {html_options options=$installSystemLocaleList
- selected=$installSystemLocale}
- </select>
- {/render}
- </td>
- </tr>
- </table>
- </td>
- <td style='width:50%; vertical-align: top;padding-left:5px;' class='left-border'>
- <h3>{t}Time{/t}</h3>
-
- <table>
- <tr>
- <td>
- {render acl=$installTimeUTCACL}
- <input type='checkbox' name="installTimeUTC" id="installTimeUTC"
- {if $installTimeUTC} checked {/if}>
- <LABEL for="installTimeUTC">{t}Use UTC{/t}</LABEL>
- {/render}
- </td>
- </tr>
- <tr>
- <td><LABEL for="installTimezone">{t}Timezone{/t}</LABEL></td>
- <td>
- {render acl=$installTimezoneACL}
- <select size='1' name="installTimezone" id="installTimezone">
- {html_options output=$timezones values=$timezones
- selected=$installTimezone}
- </select>
- {/render}
- </td>
- </tr>
- <tr>
- <td colspan=2>
- {t}NTP server{/t}
- {render acl=$installNTPServerACL}
- {$installNTPServerList}
- {/render}
- {render acl=$installNTPServerACL}
- <input type='text' name="installNTPServer_Input">
- {/render}
- {render acl=$installNTPServerACL}
- <button name='installNTPServer_Add'>{msgPool type=addButton}</button>
- {/render}
- </td>
- </tr>
- </table>
- </td>
- </tr>
-</table>
-
-<input type='hidden' name='InstallRecipePosted' value=1>
diff --git a/gosa-plugins/goto/admin/systems/goto/Device/SetPassword.tpl b/gosa-plugins/goto/admin/systems/goto/Device/SetPassword.tpl
+++ /dev/null
@@ -1,17 +0,0 @@
-<h3>{t}Set root-user password{/t}</h3>
-
-<hr>
-
-<p>
- {t}Password{/t}: <input type="text" name="rootPassword" value="">
- <select name="passwordHash" size=1>
- {html_options options=$hashes selected=$hash}
- </select>
-</p>
-
-<hr>
-
-<div class="plugin-actions">
- <button name="setPassword">{msgPool type=okButton}</button>
- <button name="cancelPassword">{msgPool type=cancelButton}</button>
-</div>
diff --git a/gosa-plugins/goto/admin/systems/goto/Device/class_AddPartitionDialog.inc b/gosa-plugins/goto/admin/systems/goto/Device/class_AddPartitionDialog.inc
+++ /dev/null
@@ -1,482 +0,0 @@
-<?php
-
-
-define('DISK' , 0);
-define('PARTITION' , 1);
-define('RAID_DEVICE' , 2);
-define('VOLUME_GROUP' , 3);
-define('VOLUME' , 4);
-
-class AddPartitionDialog
-{
- public $partitionObject;
- public $disk = array();
- public $diskList = array();
- public $paritions = array();
- public $selected_type = DISK;
- public $errorMsg;
-
- // Disk properties
- public $d_name = "";
-
- // LVM Volume group properties
- public $vg_name = "";
- public $vg_partitions = array();
- public $volumeGroups = array();
- public $freeLvmPartitions = array();
-
- // Volume properties
- public $v_name = "";
- public $v_group = "";
- public $v_mountPoint = "";
- public $v_fsType = "ext3";
- public $v_fsOptions = "";
- public $v_size = 1000;
- public $v_encrypt = FALSE;
- public $volumeGroupList = array();
-
- // Raid device properties
- public $r_fsType = 'ext3';
- public $r_fsOptions = '';
- public $r_mountPoint = '';
- public $r_raidLevel = 0;
- public $raidLevelList = array();
- public $raidDevices = array();
- public $freeRaidPartitions = array();
- public $r_partitions = array();
- public $r_spares = 0;
- public $r_encrypt = FALSE;
-
- // Partition properties
- public $p_size = 1000;
- public $p_format = FALSE;
- public $p_bootable = FALSE;
- public $p_fsType = 'ext3';
- public $p_mountPoint = '';
- public $p_used_disk = array();
- public $p_forcePrimary = FALSE;
- public $p_encrypt = FALSE;
- public $p_size_max_value = 1000;
- public $p_size_options = 0;
-
- // Attributes managed by this plugin.
- public $attributes = array("selected_type");
-
- // Partitions attributes
- public $p_attributes = array("p_size", "p_fsType", "p_mountPoint", "p_forcePrimary", "p_encrypt",
- "p_size_options", "p_size_max_value", "p_used_disk", "p_format", "p_bootable");
-
- // Raid device attributes
- public $r_attributes = array("r_fsType", "r_mountPoint", "r_raidLevel", "r_partitions",
- "r_spares","r_encrypt", "r_fsOptions");
-
- // Volume group attributes
- public $vg_attributes = array("vg_name", "vg_partitions");
-
- // Volume attributes
- public $v_attributes = array("v_name", "v_group", "v_mountPoint", "v_fsType",
- "v_size", "v_encrypt", "v_fsOptions");
-
- // Disk attributes
- public $d_attributes = array("d_name");
-
- public $initialized = FALSE;
-
- /*! \brief Constructs the Dialog and loads all required informations
- * to be able to add partitions, raid devices, volumes groups ...
- * @param Config The GOsa configuration object.
- * @param remoteObject The remote partition object.
- */
- function __construct($config, $partitionObject)
- {
- $this->partitionObject = &$partitionObject;
- $this->config = &$config;
- }
-
- function init()
- {
- // Load remote partition information
- $map = array(
- "fsTypes" => "getFsTypes",
- "raidLevel" => "getRaidLevels",
- "disks" => "getDisks",
- "partitions" => "getPartitions",
- "raidDevices" => "getRaidDevices",
- "volumeGroups" => "getVolumeGroups",
- "freeLvmPartitions" => "getUnassignedPhysicalVolumes",
- "freeRaidPartitions" => "getUnassignedRaidPartitions");
- foreach($map as $target => $func){
- $this->$target = @$this->partitionObject->$func();
- if(!$this->partitionObject->success()){
- $this->errorMsg = $this->partitionObject->getError();
- return;
- }
- }
-
- // Prepare list of filesystem types
- $this->fsTypeList = array();
- foreach($this->partitionObject->getFsTypes() as $type){
- $this->fsTypeList[$type] = $type;
- }
- $this->fsTypeList['pv'] = _('Physical volume (LVM)');
- $this->fsTypeList['raid'] = _('Software raid');
-
- // Prepare list of available raid level
- $this->raidLevelList = array();
- foreach($this->raidLevel as $lvl){
- $this->raidLevelList[$lvl] = sprintf(_("Raid %s"), $lvl);
- }
-
- // Prepare list of volume groups
- $this->volumeGroupList = array();
- foreach($this->volumeGroups as $vg){
- $this->volumeGroupList[$vg['name']] = $vg['name'];
- }
-
- // Prepare list of disks
- $this->diskList = array();
- foreach($this->disks as $disk){
- $this->diskList[$disk['device']] = $disk['device'];
- }
-
- // Select first disk as default.
- $this->p_used_disk = key($this->diskList);
-
- // Preselect partition creation if we've already created a disk
- if(count($this->disks)){
- $this->selected_type = PARTITION;
- }
-
- $this->initialized = TRUE;
- }
-
-
- /*! \brief Generates the HTML output for this plugin.
- * @return String HTML content of the plugin.
- */
- function execute()
- {
- $smarty = get_smarty();
-
- if(!$this->initialized){
- $this->init();
- if(!$this->initialized){
- $smarty->assign("error", TRUE);
- $smarty->assign("errorMsg", $this->errorMsg);
- return($smarty->fetch(get_template_path("goto/Device/AddPartitionDialog.tpl", TRUE)));
- }
- }
-
- // Assign base attributes
- foreach($this->attributes as $attr){
- $smarty->assign($attr, $this->$attr);
- }
-
- // Assign partition attributes.
- $fsTypes = $this->fsTypeList;
- $attrs = $bool_attrs = array();
- switch($this->selected_type){
- case PARTITION: {
- $attrs = $this->p_attributes;
- $bool_attrs = array("p_forcePrimary", "p_encrypt", "p_format", "p_bootable");
- break;
- }
- case RAID_DEVICE: {
- $attrs = $this->r_attributes;
-
- // Do not allow to create raid devices in raid devices.
- unset($fsTypes['raid']);
- $bool_attrs = array("r_encrypt");
- break;
- }
- case VOLUME_GROUP: {
- $attrs = $this->vg_attributes;
- break;
- }
- case VOLUME: {
- $attrs = $this->v_attributes;
- unset($fsTypes['raid']);
- unset($fsTypes['pv']);
- $bool_attrs = array("v_encrypt");
- break;
- }
- case DISK: {
- $attrs = $this->d_attributes;
- break;
- }
- }
-
- // Assign properties to smarty.
- foreach($attrs as $attr){
- $smarty->assign($attr, $this->$attr);
- }
- foreach($bool_attrs as $attr){
- $smarty->assign("{$attr}_selected", $this->$attr != FALSE);
- }
-
- $smarty->assign("deviceUsage", $this->partitionObject->getDeviceUsage());
- $smarty->assign('fsTypes', $fsTypes);
- $smarty->assign('raidLevelList', $this->raidLevelList);
- $smarty->assign('freeRaidPartitions', $this->freeRaidPartitions);
- $smarty->assign('disks', $this->diskList);
- $smarty->assign('volumeGroupList', $this->volumeGroupList);
- $smarty->assign('freeLvmPartitions', $this->freeLvmPartitions);
- $smarty->assign("error", FALSE);
- return($smarty->fetch(get_template_path("goto/Device/AddPartitionDialog.tpl", TRUE)));
- }
-
-
- /*! \brief Saves posted values.
- */
- function save_object()
- {
- // Assign partition attributes.
- $attrs = $bool_attrs = array();
- switch($this->selected_type){
- case PARTITION: {
- $attrs = $this->p_attributes;
- $bool_attrs = array("p_forcePrimary", "p_encrypt", "p_format", "p_bootable");
- break;
- }
- case RAID_DEVICE: {
- $attrs = $this->r_attributes;
- $bool_attrs = array("r_encrypt");
- $this->r_partitions = array();
- foreach($this->freeRaidPartitions as $key => $part){
- if(isset($_POST['r_partition_'.$key])){
- $this->r_partitions[] = $part;
- }
- }
- break;
- }
- case VOLUME_GROUP: {
- $attrs = $this->vg_attributes;
- $this->vg_partitions = array();
- foreach($this->freeLvmPartitions as $key => $part){
- if(isset($_POST['vg_partition_'.$key])){
- $this->vg_partitions[] = $part;
- }
- }
- break;
- }
- case VOLUME: {
- $attrs = $this->v_attributes;
- $bool_attrs = array("v_encrypt");
- break;
- }
- case DISK: {
- $attrs = $this->d_attributes;
- break;
- }
- }
-
- // Get posted string values
- $attrs = array_merge($attrs, $this->attributes);
- foreach($attrs as $attr){
- if(isset($_POST[$attr])){
- $this->$attr = get_post($attr);
- }
- }
-
- // Get boolean values
- foreach($bool_attrs as $attr){
- $this->$attr = isset($_POST[$attr]);
- }
- }
-
-
- /*! \brief Converts a given size string to its size-value in MB.
- * E.g. '200TB' => '209715200' MB
- */
- function convertSize($size)
- {
- $map = array();
- $map['/mb/i'] = 1;
- $map['/m/i'] = 1;
- $map['/gb/i'] = 1024;
- $map['/g/i'] = 1024;
- $map['/tb/i'] = 1024;
- $map['/t/i'] = 1024;
- $map['/pb/i'] = 1024;
- $map['/p/i'] = 1024;
- foreach($map as $key => $multiplicator){
- if(preg_match($key, $size)){
- $size = intval(preg_replace("/[^0-9]/", "", $size));
- return($size * $multiplicator);
- }
- }
- return(intval(preg_replace("/[^0-9]/", "", $size)));
- }
-
-
- /*! \brief Stores the changes back to the remote table model.
- * @return TRUE on success else false.
- */
- function save()
- {
- if($this->selected_type == DISK){
-
- // Get volume group properties
- $name = $this->d_name;
- @$this->partitionObject->addDisk($name);
-
- // Display potential errors
- if(!$this->partitionObject->success()){
- $msg = sprintf(_("Failed to add '%s': %s"), _("Disk"), $this->partitionObject->getError());
- msg_dialog::display(_("Error"), $msg, ERROR_DIALOG);
- }
- return($this->partitionObject->success());
-
- }elseif($this->selected_type == VOLUME_GROUP){
-
- // Get volume group properties
- $devices = $this->vg_partitions;
- $name = $this->vg_name;
- @$this->partitionObject->addVolumeGroup($name, $devices, $format=TRUE, $use_existing=FALSE, NULL);
-
- // Display potential errors
- if(!$this->partitionObject->success()){
- $msg = sprintf(_("Failed to add '%s': %s"), _("Volume group"), $this->partitionObject->getError());
- msg_dialog::display(_("Error"), $msg, ERROR_DIALOG);
- }
- return($this->partitionObject->success());
-
- }elseif($this->selected_type == VOLUME){
-
- // Get volume properties
- $name = $this->v_name;
- $fsType = $this->v_fsType;
- $fsOptions = $this->v_fsOptions;
- $group = $this->v_group;
- $target = $this->v_mountPoint;
- $size = $this->convertSize($this->v_size);
- $encrypt = $this->v_encrypt;
-
- $maxSize = NULL;
- $grow = FALSE;
- $format = TRUE;
- $use_existing = FALSE;
-
- if($fsType == "swap"){
- $target = "swap";
- }
-
- @$this->partitionObject->addVolume($target, $name, $group, $size, $maxSize,
- $grow, $format, $use_existing, $fsType, $fsOptions);
-
- // Display potential errors
- if(!$this->partitionObject->success()){
- $msg = sprintf(_("Failed to add '%s': %s"), _("Volume"), $this->partitionObject->getError());
- msg_dialog::display(_("Error"), $msg, ERROR_DIALOG);
- }
- return($this->partitionObject->success());
-
- }elseif($this->selected_type == RAID_DEVICE){
-
- // Get raid device properties
- $devices = $this->r_partitions;
- $fsType = $this->r_fsType;
- $raidLevel = intval($this->r_raidLevel);
- $spares = $this->r_spares;
- $encrypt = $this->r_encrypt;
-
- $name = $this->partitionObject->getNextRaidDevice();
-
- // Check selected target
- $partitions = $this->partitions;
- $raids = $this->raidDevices;
- $usedTargets = array();
- foreach($partitions as $part){
- $usedTargets[] = $part['target'];
- }
- foreach($raids as $part){
- $usedTargets[] = $part['target'];
- }
- if($fsType == "pv"){
- $target = $this->partitionObject->getNextPhysicalVolumeName();
- $fsType = $fsOptions = NULL;
- }else{
- $target = $this->r_mountPoint;
- $fsType = $this->r_fsType;
- $fsOptions = $this->r_fsOptions;
- }
- if($fsType == "swap"){
- $target = "swap";
- }
-
- @$this->partitionObject->addRaidDevice($target, $name, $raidLevel, $spares, $fsType,$fsOptions,
- TRUE, FALSE, $devices);
-
- // Display potential errors
- if(!$this->partitionObject->success()){
- $msg = sprintf(_("Failed to add '%s': %s"), _("Raid device"), $this->partitionObject->getError());
- msg_dialog::display(_("Error"), $msg, ERROR_DIALOG);
- }
- return($this->partitionObject->success());
-
- }elseif($this->selected_type == PARTITION){
-
- // Get all currently used partitions
- $partitions = $this->partitions;
- $raids = $this->raidDevices;
- $usedTargets = array();
- foreach($partitions as $part){
- $usedTargets[] = $part['target'];
- }
- foreach($raids as $part){
- $usedTargets[] = $part['target'];
- }
-
- // Collect options
- $size = $this->convertSize($this->p_size);
- $maxSize = NULL;
- if($this->p_size_options == 1){
- $maxSize = $this->p_size_max_value;
- }
- $grow = $this->p_size_options == 2;
-
- $format = $this->p_format == 1;
- $boot = $this->p_bootable == 1;
- $primary = $this->p_forcePrimary;
- $fsType = $this->p_fsType;
- $fsOptions = "";
- $encrypt = $this->p_encrypt;
- $passphrase = "";
- $disk = $this->p_used_disk;
-
- // We've to create a raid disk
- if($this->p_fsType == "raid"){
- $target = $this->partitionObject->getNextRaidName();
- $fsType = $fsOptions = NULL;
- $encrypt = $format = FALSE;
- }else
-
- // We've to create a raid disk
- if($this->p_fsType == "pv"){
- $target = $this->partitionObject->getNextPhysicalVolumeName();
- $fsType = $fsOptions = NULL;
- $encrypt = $format = FALSE;
- }else{
-
- // Add normal-physical partition
- $target = $this->p_mountPoint;
- if($fsType == "swap"){
- $target = "swap";
- $encrypt = $format = FALSE;
- }
- }
-
- // Add partition to remote model
- @$this->partitionObject->addPartition($target,$size, $maxSize, $grow, $format, $boot, $primary,
- $fsType, $fsOptions , $encrypt, $passphrase, $disk);
-
- // Display potential errors
- if(!$this->partitionObject->success()){
- $msg = sprintf(_("Failed to add '%s': %s"), _("Partition"), $this->partitionObject->getError());
- msg_dialog::display(_("Error"), $msg, ERROR_DIALOG);
- }
- return($this->partitionObject->success());
- }
- }
-}
-?>
diff --git a/gosa-plugins/goto/admin/systems/goto/Device/class_Device.inc b/gosa-plugins/goto/admin/systems/goto/Device/class_Device.inc
+++ /dev/null
@@ -1,333 +0,0 @@
-<?php
-
-
-class Device extends plugin
-{
-
- public $objectclasses = array('top','device');
- public $attributes = array("cn","serialNumber","seeAlso","owner","ou","o","ipHostNumber",
- "l","description","manager","deviceUUID","deviceStatus","macAddress","deviceType");
-
- public $dynClasses = array(
- 'ieee802Device' => array('macAddress'),
- 'registeredDevice' => array('deviceStatus','deviceUUID','manager','deviceType'),
- 'ipHost' => array('ipHostNumber'));
-
- public $cn = "";
- public $serialNumber = "";
- public $seeAlso = "";
- public $owner = "";
- public $ou = "";
- public $o = "";
- public $l = "";
- public $description = "";
- public $manager = "";
- public $deviceUUID = "";
- public $deviceStatus = "";
- public $deviceType = "";
- public $ipHostNumber = "";
- public $macAddress = "";
-
- public $base = "";
- public $orig_dn ="";
-
- private $resolvedNamesCache = array();
-
- public $ignore_account = TRUE;
-
-
- /*! \brief Constructs the device object and keep some
- * initial values.
- */
- function __construct(&$config, $dn)
- {
- plugin::plugin($config, $dn);
- $this->orig_dn = $this->dn;
-
- // Initialize the object base
- if ($this->dn == "new"){
- $ui= get_userinfo();
- $this->base= dn2base(session::global_is_set("CurrentMainBase")?"cn=dummy,".session::global_get("CurrentMainBase"):$ui->dn);
- } else {
- $this->base= preg_replace ("/^[^,]+,".preg_quote(get_ou("Device", "GOsaDeviceRDN"), '/')."/i", "", $this->dn);
- }
-
- // Prepare the base selector
- $this->baseSelector= new baseSelector($this->get_allowed_bases(), $this->base);
- $this->baseSelector->setSubmitButton(false);
- $this->baseSelector->setHeight(300);
- $this->baseSelector->update(true);
-
- $this->orig_deviceUUID = $this->deviceUUID;
- }
-
-
- /*! \brief Generate a fake uuid, it is not a real uuid.
- * @return String A fake uuid.
- */
- function genFakeUuid()
- {
- $strfmt = "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx";
- for($i=0;$i<strlen($strfmt);$i++)
- if($strfmt[$i] == 'x') $strfmt[$i] = dechex(rand(0,15));
- return($strfmt);
- }
-
-
- /*! \brief Generate the plugins HTML content.
- * @return String HTML content
- */
- function execute()
- {
- plugin::execute();
-
- if($this->dialog instanceOf singleUserSelect) return($this->dialog->execute());
-
- $smarty = get_smarty();
-
- // Assign ACL settings
- $plInfo = $this->plInfo();
- foreach($plInfo['plProvidedAcls'] as $name => $desc){
- $smarty->assign("{$name}ACL", $this->getacl($name));
- }
-
- // Assign just user names instead of the complete dn.
- $smarty->assign("owner_name", $this->getUserName($this->owner));
- $smarty->assign("manager_name", $this->getUserName($this->manager));
- $smarty->assign("base", $this->baseSelector->render());
-
- // Assign attribute values
- foreach($this->attributes as $attr){
- $smarty->assign($attr, set_post($this->$attr));
- }
-
- // If one attribute of the registered device is given, all others are required too.
- $str = $this->manager.$this->deviceUUID.$this->deviceStatus;
- $smarty->assign("registeredRequired", !empty($str));
- return($smarty->fetch(get_template_path('goto/Device/Device.tpl', TRUE)));
- }
-
-
- /*! \brief Validate the user input.
- */
- function check()
- {
- $message = plugin::check();
-
- // If one of the registered user attributes is set,
- // the others have to be set too.
- $str = $this->manager.$this->deviceUUID.$this->deviceStatus;
- if(!empty($str)){
- if(empty($this->deviceStatus)){
- $message[] = msgPool::required(_("Status"));
- }
- if(empty($this->manager)){
- $message[] = msgPool::required(_("Manager"));
- }
- if(empty($this->deviceUUID)){
- $message[] = msgPool::required(_("Device UUID"));
- }
- }
-
- // Check ip-address
- if (!empty($this->ipHostNumber) && !tests::is_ip($this->ipHostNumber)){
- $message[]= msgPool::invalid(_("IP address"), "", "", "192.168.1.10");
- }
-
- // Check if there a cn given
- if (empty($this->cn)){
- $message[]= msgPool::required(_("Name"));
- }
-
- // Check mac-address
- if (!empty($this->macAddress) && !tests::is_mac($this->macAddress)){
- $message[]= msgPool::invalid(_("MAC address"), "", "", "00:0C:7F:31:33:F1");
- }
-
- return($message);
- }
-
-
- /*! \brief Detect an object's name by querying the ldap
- * for the object's cn.
- * @param String The object's dn to query for.
- */
- function getUserName($dn)
- {
- // First asked the cache if we've already queried this name.
- if(isset($this->resolvedNamesCache[$dn])) {
- return($this->resolvedNamesCache[$dn]);
- }
-
- // Try to detect the object's name via ldap search.
- $ldap = $this->config->get_ldap_link();
- $this->resolvedNamesCache[$dn] = "";
- if(!empty($dn)){
- $ldap->cat($dn, array('cn'));
- if($ldap->count()){
- $attrs = $ldap->fetch();
- $this->resolvedNamesCache[$dn] = $attrs['cn'][0];
- return( $attrs['cn'][0]);
- }else{
- $this->resolvedNamesCache[$dn] = "("._("unknown")."!): ".$dn;
- }
- }
- return($this->resolvedNamesCache[$dn]);
- }
-
-
- /*! \brief Detects and stores relevant values which where
- * currently transmitted via $_GET/$_POST.
- */
- function save_object()
- {
- plugin::save_object();
-
- // Change owner requested, initiate a user selection dialog.
- if(isset($_POST['editOwner'])){
- $this->currentUserSelect = "owner";
- $this->dialog = new singleUserSelect($this->config, get_userinfo());
- }
-
- // Change manager requested, initiate a user selection dialog.
- if(isset($_POST['editManager'])){
- $this->currentUserSelect = "manager";
- $this->dialog = new singleUserSelect($this->config, get_userinfo());
- }
-
- // Remove owner initiated
- if(isset($_POST['removeManager'])) $this->manager = "";
- if(isset($_POST['removeOwner'])) $this->owner = "";
-
- // The user selection dialog has send that it has finished its job.
- // Store the posted user-dn as manager or owner.
- if($this->dialog && $this->dialog instanceOf singleUserSelect && count($this->dialog->detectPostActions())){
- $users = $this->dialog->detectPostActions();
- if(isset($users['action']) && $users['action'] == 'userSelected' && isset($users['targets']) && count($users['targets'])){
- $headpage = $this->dialog->getHeadpage();
- $dn = $users['targets'][0];
- $attr = $this->currentUserSelect;
- $this->$attr = $dn;
- $this->dialog = NULL;
- }
- }
-
- // User selection canceled
- if(isset($_POST['add_users_cancel'])){
- $this->dialog = NULL;
- }
-
- // Regenerate a new uuid
- if(isset($_POST['reloadUUID'])) $this->deviceUUID = $this->genFakeUuid();
-
- // Update the base
- if ($this->acl_is_moveable($this->base)){
- if (!$this->baseSelector->update()) {
- msg_dialog::display(_("Error"), msgPool::permMove(), ERROR_DIALOG);
- }
- if ($this->base != $this->baseSelector->getBase()) {
- $this->base= $this->baseSelector->getBase();
- $this->is_modified= TRUE;
- }
- }
-
- }
-
-
- /*! \brief Save the modified object back to the ldap.
- */
- function save()
- {
- plugin::save();
-
- // Append and remove dynmic object classes
- foreach($this->dynClasses as $oc => $attrs){
- $this->attrs['objectClass'] = array_remove_entries(array($oc), $this->attrs['objectClass']);
- foreach($attrs as $attr){
- if(isset($this->attrs[$attr]) && !empty($this->attrs[$attr])){
- $this->attrs['objectClass'][] = $oc;
- break;
- }
- }
- }
-
- $this->cleanup();
- $ldap=$this->config->get_ldap_link();
- $ldap->cd($this->config->current['BASE']);
- $ldap->create_missing_trees(preg_replace("/^[^,]*+,/","",$this->dn));
- $ldap->cd($this->dn);
-
- // Perform action modify/create
- if($this->initially_was_account){
- $ldap->modify($this->attrs);
- new log("modify","Device/".get_class($this),$this->dn,array_keys($this->attrs),$ldap->get_error());
- if (!$ldap->success()){
- msg_dialog::display(_("LDAP error"), msgPool::ldaperror($ldap->get_error(), $this->dn, LDAP_MOD, get_class()));
- }else{
- $this->handle_post_events("modify");
- }
- }else{
- $ldap->add($this->attrs);
- new log("create","Device/".get_class($this),$this->dn,array_keys($this->attrs),$ldap->get_error());
- if (!$ldap->success()){
- msg_dialog::display(_("LDAP error"), msgPool::ldaperror($ldap->get_error(), $this->dn, LDAP_ADD, get_class()));
- }else{
- $this->handle_post_events("add");
- }
- }
- }
-
-
- static function plInfo()
- {
- return (array(
- "plShortName" => _("Device"),
- "plDescription" => _("Device"),
- "plSelfModify" => FALSE,
- "plDepends" => array(),
- "plPriority" => 1,
- "plSection" => array("administration"),
- "plCategory" =>
- array(
- "Device" => array(
- "description" => _("Device"),
- "objectClass" => "Device")
- ),
- "plProvidedAcls" =>
- array(
- "base" => _("Base"),
- "cn" => _("Name"),
- "serialNumber" => _("Serial number"),
- "seeAlso" => _("See also"),
- "owner" => _("Owner"),
- "ou" => _("Organizational Unit"),
- "o" => _("Organization"),
- "l" => _("Location"),
- "description" => _("Description"),
- "manager" => _("Manager"),
- "deviceUUID" => _("UUID"),
- "deviceStatus" => _("Status"),
- "deviceType" => _("Type"),
- "macAddress" => _("MAC address"),
- "ipHostNumber" => _("IP address")
- ),
- "plProperties" =>
- array(
- array(
- "name" => "GOsaDeviceRDN",
- "type" => "rdn",
- "default" => "ou=devices,ou=systems,",
- "description" => _("RDN for device storage."),
- "check" => "gosaProperty::isRdn",
- "migrate" => "migrate_GOsaDeviceRDN",
- "group" => "plugin",
- "mandatory" => FALSE
- ),
-
- )
- )
- );
- }
-}
-
-?>
diff --git a/gosa-plugins/goto/admin/systems/goto/Device/class_DeviceConfig.inc b/gosa-plugins/goto/admin/systems/goto/Device/class_DeviceConfig.inc
+++ /dev/null
@@ -1,335 +0,0 @@
-<?php
-
-class DeviceConfig extends plugin
-{
-
- /* Some plugin management related attributes
- * See class plugin for details.
- */
- public $view_logged = FALSE;
- public $ignore_account = FALSE;
- public $parent = NULL;
-
- public $parameterList = NULL;
- public $usedElementsList = NULL;
- public $assignableElementsList = NULL;
-
- public $usedElements = array();
- public $assignableElements = array();
- public $parameterValues = array();
- public $parameterWidgets = array();
-
- public $initialized = FALSE;
-
-
- /*! \brief Initialize the plugin and its widgets.
- */
- function __construct(&$config, $dn, $parent)
- {
- plugin::plugin($config, $dn);
-
- // Get the account information from the generic class.
- $this->is_account = $this->initially_was_account = FALSE;
- $this->_device = &$parent;
- $this->deviceUUID = $parent->deviceUUID;
-
- // Create assignable Elements list.
- $this->assignableElementsList = new sortableListing();
- $this->assignableElementsList->setDeleteable(FALSE);
- $this->assignableElementsList->setEditable(TRUE);
- $this->assignableElementsList->setWidth("100%");
- $this->assignableElementsList->setHeight("200px");
- $this->assignableElementsList->setHeader(array(_("Name"),_("Description"),_("Add")));
- $this->assignableElementsList->setColspecs(array('*','*','20'));
- $this->assignableElementsList->setAcl($this->getacl(''));
-
- // Create used Elements list.
- $this->usedElementsList = new sortableListing();
- $this->usedElementsList->setDeleteable(TRUE);
- $this->usedElementsList->setInstantDelete(FALSE);
- $this->usedElementsList->setEditable(FALSE);
- $this->usedElementsList->setWidth("100%");
- $this->usedElementsList->setHeight("200px");
- $this->usedElementsList->setHeader(array(_("Name"), _("Description"), _("Remove")));
- $this->usedElementsList->setColspecs(array('*','*','20'));
- $this->usedElementsList->setAcl($this->getacl(''));
-
- // Create parameter Elements list.
- $this->parameterList = new sortableListing();
- $this->parameterList->setDeleteable(FALSE);
- $this->parameterList->setInstantDelete(FALSE);
- $this->parameterList->setEditable(FALSE);
- $this->parameterList->setWidth("100%");
- $this->parameterList->setHeight("200px");
- $this->parameterList->setHeader(array(_("Name"), _("Description"), _("Value")));
- $this->parameterList->setColspecs(array('*','*','350px'));
- $this->parameterList->setAcl($this->getacl(''));
- }
-
-
- function check()
- {
- }
-
-
- /*! \brief Generates the HTML output for the plugin
- */
- function execute()
- {
- // Initialize to plugin
- if(!$this->initialized){
-
- // Load config settings for the current device.
- $rpc = $this->config->getRpcHandle();
- $res = $rpc->systemGetConfigParameters($this->deviceUUID);
- if(!$rpc->success()){
- $smarty = get_smarty();
- $smarty->assign("error", TRUE);
- $smarty->assign("errorMsg", msgPool::rpcError($rpc->get_error()));
- return($smarty->fetch(get_template_path('goto/Device/DeviceConfig.tpl', TRUE)));
- }else{
-
- // Initialization completed.
- $this->initialized = TRUE;
- $this->is_account = $this->initially_was_account = isset($res['item']);
- if(isset($res['var'])) $this->parameterValues = $res['var'];
- if(isset($res['item'])) $this->usedElements = $res['item'];
- }
- }
-
- // Load assignable elements.
- $rpc = $this->config->getRpcHandle();
- $release = $this->parent->by_object['InstallRecipe']->installRelease;
- $release = preg_replace("/^[^\/]+\//","", $release);
- $assignableElements = $rpc->listAssignableElements($release);
- if(!$rpc->success()){
- $smarty = get_smarty();
- $smarty->assign("error", TRUE);
- $smarty->assign("errorMsg", msgPool::rpcError($rpc->get_error()));
- return($smarty->fetch(get_template_path('goto/Device/DeviceConfig.tpl', TRUE)));
- }else{
- $this->assignableElements = $assignableElements;
- }
-
- // Log account access
- if($this->is_account && !$this->view_logged){
- $this->view_logged = TRUE;
- new log("view","Device/".get_class($this),$this->dn);
- }
-
- /***************
- Handle account state
- ***************/
-
- // Allow to add or remove the distribution list extension
- if(isset($_POST['modify_state'])){
- if($this->is_account && $this->acl_is_removeable()){
- $this->is_account= FALSE;
- }elseif(!$this->is_account && $this->acl_is_createable()){
- $this->is_account= TRUE;
- }
- }
-
- // Show account status-changer
- $display = "";
- if ($this->parent !== NULL){
- if ($this->is_account){
- $display= $this->show_disable_header(_("Remove config mangement"),
- msgPool::featuresEnabled(_("Config management")));
- } else {
- $display= $this->show_enable_header(_("Add Config management"),
- msgPool::featuresDisabled(_("Config management")));
- return ($display);
- }
- }
-
- /***************
- Create the HTML content with its lists
- ***************/
-
- // Fill list of assignable elements
- $data = $lData = array();;
- foreach($this->assignableElements as $name => $element){
-
- // skip already assigned elements
- if(in_array_strict($name, $this->usedElements)) continue;
-
- // Create the list elements.
- $data[$name] = $element;
- $desc = (isset($element['description'])) ? $element['description'] : '';
- $lData[$name] = array('data' => array($name, $desc));
-
- }
- $this->assignableElementsList->setListData($data, $lData);
- $this->assignableElementsList->update();
-
- // Build list of assigned Elements
- $data = $lData = array();;
- foreach($this->usedElements as $name){
-
- // check if the assgined element is still available, if not mark it in red.
- if(isset($this->assignableElements[$name])){
- $element = $this->assignableElements[$name];
- $data[$name] = $element;
- $desc = (isset($element['description'])) ? $element['description'] : '';
- }else{
- $element = NULL;
- $data[$name] = $element;
- $desc = "<font color='red'>"._("Unknown config item")."</font>";
- }
- $lData[$name] = array('data' => array($name, $desc));
- }
- $this->usedElementsList->setListData($data, $lData);
- $this->usedElementsList->update();
-
- // Build up parameter list
- $data = $lData = array();;
- foreach($this->usedElements as $name){
-
- // Skip parameters for not existent items.
- if(!isset($this->assignableElements[$name]['parameter'])) continue;
-
- // Build up the parameter list using the 'TemplateWidget_string' class.
- $parameter = $this->assignableElements[$name]['parameter'];
- foreach($parameter as $param => $desc){
- $data[$param] = NULL;
- $value = (isset($this->parameterValues[$param])) ? $this->parameterValues[$param] : "";
-
- // Create template widget on demand.
- if(!isset($this->parameterWidgets[$param])){
- $this->parameterWidgets[$param] = new TemplateWidget_stringLong($this->config, $param, $value,
- $desc, '', FALSE, 'string', $param);
-
- $this->parameterWidgets[$param]->setWriteable(preg_match("/w/",$this->getacl('')));
- $this->parameterWidgets[$param]->setReadable(preg_match("/r/",$this->getacl('')));
- }
- $w = $this->parameterWidgets[$param];
- $lData[$param] = array('data' => array($w->getDisplayName(),$desc, $w->render()));
- }
- }
- $this->parameterList->setListData($data, $lData);
- $this->parameterList->update();
-
- // Build up smarty template.
- $smarty = get_smarty();
- $smarty->assign("error", FALSE);
- $smarty->assign("assignableElementsList", $this->assignableElementsList->render());
- $smarty->assign("usedElementsList", $this->usedElementsList->render());
- $smarty->assign("parameterList", $this->parameterList->render());
- return($display.$smarty->fetch(get_template_path('goto/Device/DeviceConfig.tpl', TRUE)));
- }
-
-
- /*! \brief Act on posted values.
- * And keep track of posted values.
- */
- function save_object()
- {
- // Get posted parameter values
- foreach($this->parameterWidgets as $name => $w){
- if($w->isWriteable()){
- $w->save_object();
- $this->parameterValues[$name] = $w->getValue();
- }
- }
-
- if(preg_match("/w/", $this->getacl(''))){
-
- // Act on Add-Element actions
- $this->assignableElementsList->save_object();
- $action = $this->assignableElementsList->getAction();
- if($action['action'] == 'edit'){
- $this->usedElements[] = $this->assignableElementsList->getKey($action['targets'][0]);
- $this->usedElements = array_unique($this->usedElements);
- }
-
- // Act on Remove-Item actions
- $this->usedElementsList->save_object();
- $action = $this->usedElementsList->getAction();
- if($action['action'] == 'delete'){
- $name = $this->usedElementsList->getKey($action['targets'][0]);
- $this->usedElements = array_remove_entries_ics(array($name), $this->usedElements);
- }
- }
- }
-
-
- /*! \brief Save changes back to the GOsa-ng server.
- */
- function save()
- {
- // If no items are assinged we've to remove the extension.
- if(!count($this->usedElements)) {
- $this->remove_from_parent();
- return;
- }
-
- // Load assignable elements.
- $rpc = $this->config->getRpcHandle();
- $release = $this->parent->by_object['InstallRecipe']->installRelease;
- $release = preg_replace("/^[^\/]+\//","", $release);
- $assignableElements = $rpc->listAssignableElements($release);
- if(!$rpc->success()){
- msg_dialog::display(_("Error"), msgPool::rpcError($rpc->get_error()), ERROR_DIALOG);
- return(NULL);
- }else{
- $this->assignableElements = $assignableElements;
- }
-
- // Collect paramter list.
- $params = array();
- foreach($this->usedElements as $name){
- if(isset($this->assignableElements[$name]['parameter'])){
- $params = array_merge($params, $this->assignableElements[$name]['parameter']);
- }
- }
-
- // Decide whoch parameter has to be saved and which has to be removed.
- $save = array();
- foreach($this->parameterValues as $name => $value){
- if(isset($params[$name])){
- $save[$name] = $value;
- }
- }
-
- // Save changes back to server.
- $rpc = $this->config->getRpcHandle();
- $installConfigManagement = $this->parent->by_object['InstallRecipe']->installConfigManagement;
- $rpc->systemSetConfigParameters($this->deviceUUID, array('method' => $installConfigManagement,
- 'var' => $save, 'item' => array_values($this->usedElements)));
- if(!$rpc->success()){
- msg_dialog::display(_("Error"), msgPool::rpcError($rpc->get_error()), ERROR_DIALOG);
- return(NULL);
- }
- }
-
-
- /*! \brief Removes the account from the device.
- */
- function remove_from_parent()
- {
- // Save changes back to server.
- $rpc = $this->config->getRpcHandle();
- $rpc->removeConfigParameters($this->deviceUUID);
- if(!$rpc->success()){
- msg_dialog::display(_("Error"), msgPool::rpcError($rpc->get_error()), ERROR_DIALOG);
- return(NULL);
- }
- }
-
-
- static function plInfo()
- {
- return (array(
- "plShortName" => _("Device config"),
- "plDescription" => _("Device config"),
- "plSelfModify" => FALSE,
- "plDepends" => array(),
- "plPriority" => 1,
- "plSection" => array("administration"),
- "plCategory" => array("Device"),
- "plProvidedAcls" => array(
- )));
- }
-}
-?>
diff --git a/gosa-plugins/goto/admin/systems/goto/Device/class_DevicePartition.inc b/gosa-plugins/goto/admin/systems/goto/Device/class_DevicePartition.inc
+++ /dev/null
@@ -1,402 +0,0 @@
-<?php
-
-class DevicePartition
-{
- public $object =NULL;
- public $partitionString =NULL;
-
- public $addDialog = NULL;
- public $initialized = FALSE;
-
- function __construct($config, $partitionString)
- {
- $this->config = &$config;
- $this->partitionString = $partitionString;
-
- #$this->partitionString = "disk sda --initlabel --none;
- # part /boot --size 1000 --format --fstype ext3 --ondisk sda;
- # part /test --size 1000 --fstype ext3 --ondisk sda;
- # part pv.00 --size 10 --bootable --ondisk sda;
- # part raid.00 --size 5000 --bootable --ondisk sda;
- # part pv.01 --size 10009 --ondisk sda;
- # part raid.01 --size 1000 --bootable --ondisk sda;
- # part pv.03 --size 1000 --bootable --ondisk sda;
- # part raid.02 --size 981 --bootable --ondisk sda;
- # raid pv.02 --level 0 --name md0 --format raid.01 raid.00;
- # volgroup garnele --format pv.01 pv.00 pv.02;
- # logvol /homejj --size 8978 --format --fstype ext3 --name garnele_home --vgname garnele;
- # logvol /opt --size 7041 --format --fstype ext3 --name garnele_opt --vgname garnele;";
-
- // Prepare lists
- $this->entryList = new sortableListing();
- $this->entryList->setDeleteable(false);
- $this->entryList->setEditable(false);
- $this->entryList->setWidth("100%");
- $this->entryList->setHeight("400px");
- $this->entryList->setHeader(array(_("Type"),_("Target"),_("Size"),_("Uses device")." / "._("Used by"),
- _("Filesystem"), _("Options"), _("Details"), "-"));
- $this->entryList->setColspecs(array('*','*','*', '*'));
- $this->entryList->setAcl('rwcdm');
- $this->entryList->setReorderable(FALSE);
- $this->entryList->sortingEnabled(FALSE);
- }
-
- function execute()
- {
- /*****
- * Handle add-partition dialog
- *****/
-
- // Create button was pressed, show dialog to add new partitions
- if(isset($_POST['create_partition'])){
- $this->addDialog = new AddPartitionDialog($this->config, $this->object);
- }
-
- // Abort partition add
- if(isset($_POST['cancel_partition_add'])){
- $this->addDialog = NULL;
- }
-
- // Save created partitions
- if(isset($_POST['save_partition_add'])){
- $this->addDialog->save_object();
- if($this->addDialog->save()){
- $this->addDialog = NULL;
- }
- }
-
- // Show partition dialog
- if($this->addDialog){
- $this->addDialog->save_object();
- return($this->addDialog->execute());
- }
-
-
- /*****
- * Open partition object on demand
- *****/
-
- // Open remote parition object
- if(!$this->initialized){
- $rpc = $this->config->getRpcHandle();
- $this->object = $rpc->openObject('libinst.preseed.diskdefinition', $this->partitionString);
- if(!$rpc->success()){
- $message = _("An error occured while loading partition information.");
- $message = sprintf(_("An error occured while loading partition information, error was: '%s'."), $rpc->get_error());
- $smarty = get_smarty();
- $smarty->assign('error', TRUE);
- $smarty->assign('errorMsg', $message);
- return($smarty->fetch(get_template_path('goto/Device/DevicePartition.tpl', TRUE)));
- }else{
- $this->initialized = TRUE;
- }
- }
-
-
- /*****
- * Fill listing
- *****/
-
- // Receive list informations
- $map = array();
- $map['disks'] = 'getDisks';
- $map['partitions'] = 'getPartitions';
- $map['raids'] = 'getRaidDevices';
- $map['volumeGroups'] = 'getVolumeGroups';
- $map['volumes'] = 'getVolumes';
- $map['deviceUsage'] = 'getDeviceUsage';
- foreach($map as $target => $func){
- $$target = @$this->object->$func();
- if(!$this->object->success()){
- $message = sprintf(_("An error occured while loading partition information, error was: '%s'."), $this->object->getError());
- $smarty = get_smarty();
- $smarty->assign('error', TRUE);
- $smarty->assign('errorMsg', $message);
- return($smarty->fetch(get_template_path('goto/Device/DevicePartition.tpl', TRUE)));
- }
- }
-
- // Create a mapping that show which partitions was used for which raid.
- $map_partToRaid = array();
- $raidTargets = array();
- foreach($raids as $raid){
- $raidTargets[] = $raid['target'];
- foreach($raid['devices'] as $devName){
- $map_partToRaid[$devName] = $raid['name'];
- }
- }
-
- // Create a mapping that shows which partition was used in which volumeGroup.
- $map_partToVolumeGroup = array();
- foreach($volumeGroups as $vol){
- foreach($vol['partitions'] as $part){
- $map_partToVolumeGroup[$part] = $vol['name'];
- }
- }
-
- // Create partition name map
- $partNames = array();
-
- // Create separators to create a visible indentation
- $seps = array();
- $seps[0] = "";
- $seps[1] = str_pad("", 18, " ");
- $seps[2] = str_pad("", 36, " ");
-
- // Prepare images
- $partitionImg = image('plugins/goto/images/partition.png','',_("Partition"));
- $diskImg = image('plugins/goto/images/disk.png','',_("Disk"));
- $raidImg = image('plugins/goto/images/raid.png', '', _('Raid'));
- $volumeGroupImg = image('plugins/goto/images/volumeGroups.png', '', _('Volume group'));
- $volumeImg = image('plugins/goto/images/volume.png','',_('Volume'));
-
- // Add raid devices
- $lData = array();
- if(count($raids)){
-
- // Add raid header
- $lData[] = array("data" => array("<b>"._("Raid devices")."</b>"));
-
- // Add raids
- foreach($raids as $id => $raid){
- $str = "{$seps[1]}{$raidImg} {$raid['name']} ("._("Raid")."{$raid['level']})";
- $delImg = image('images/lists/trash.png', "delete_raid_{$id}", _("Remove raid device"));
-
- $devsStr = "";
- foreach($raid['devices'] as $devName){
- $devsStr .= $partitionImg." ".$devName.", ";
- }
- $devsStr = rtrim($devsStr, ', ');
-
- $target = $raid['target'];
- if(isset($map_partToVolumeGroup[$target])){
- $target = $volumeGroupImg." ".$target;
- }
-
- $fsType = (isset($raid['fsType'])) ? $raid['fsType'] :"";
- $fsOptions = (isset($raid['fsOptions'])) ? $raid['fsOptions'] :"";
-
- $size = "";
- if(isset($deviceUsage['raid'][$raid['target']])){
- $size = "<i>".$this->__convertPartSize($deviceUsage['raid'][$raid['target']]['size'])."</i>";
- }
-
- $lData[] = array("data" => array($str,
- $target,
- $size,
- $devsStr,
- $fsType,
- $fsOptions,
- '',
- $delImg
- ));
- }
- }
-
- // Add volume groups
- if(count($volumeGroups)){
-
- // Add LVM volume groups header
- $lData[] = array("data" => array("<b>"._("LVM Volume Groups")."</b>"));
-
- // Add volume groups
- foreach($volumeGroups as $id => $vg){
- $str = "{$seps[1]}{$volumeGroupImg} {$vg['name']}";
- $delImg = image('images/lists/trash.png', "delete_vg_{$id}", _("Remove volume group"));
-
- // Build up a list of all used partitions
- $partStr = "";
- foreach($vg['partitions'] as $partName){
- if(in_array_strict($partName, $raidTargets)){
- $img = $raidImg;
- }else{
- $img = $partitionImg;
- }
- $partStr .= "{$img} {$partName}, ";
- }
- $partStr = rtrim($partStr, ", ");
-
- $size = "";
- if(isset($deviceUsage['vg'][$vg['name']])){
- $size = "<b>".$this->__convertPartSize($deviceUsage['vg'][$vg['name']]['size'])."</b>";
- }
-
- // Add entry to the list.
- $lData[] = array("data" => array($str, '', $size, $partStr, '', '','',$delImg));
-
- // Add volumes
- foreach($volumes as $vid => $volume){
- $delImg = image('images/lists/trash.png', "delete_v_{$vid}", _("Remove volume"));
- if($volume['volGroup'] == $vg['name']){
- $str = "{$seps[2]}{$volumeImg} {$volume['name']}";
- $lData[] = array("data" => array(
- $str,
- $volume['target'],
- $this->__convertPartSize($volume['size']),
- '',
- $volume['fsType'],
- $volume['fsOptions'],
- '',
- $delImg
- ));
-
-
-
- }
- }
- }
- }
-
- // Collect all disk devices names
- $diskNames = array();
- foreach($disks as $disk){
- $diskNames[] = $disk['device'];
- }
-
- // Add physical disks to the listing.
- if(count($disks)){
-
- // Add disks
- $lData[] = array("data" => array("<b>"._("Disks")."</b>"));
- foreach($disks as $id => $disk){
- $str = "{$seps[1]}{$diskImg} {$disk['device']}";
-
- $size = "";
- if(isset($deviceUsage['disk'][$disk['device']])){
- $size = "<b>".$this->__convertPartSize($deviceUsage['disk'][$disk['device']]['size'])."</b>";
- }
-
- // Create remove icon
- $delImg = image('images/lists/trash.png', "delete_disk_{$id}", _("Remove disk"));
- $lData[] = array("data" => array($str,"",$size,"","","","", $delImg));
-
- // Add partitions
- foreach($partitions as $pid => $part){
-
- if(!in_array_strict($part['onDisk'], $diskNames)){
-
- echo "Cannot display '{$part['target']}' the given disk '{$part['onDisk']}' does not exists!<br>";
- continue;
- }
-
- if($part['onDisk'] == $disk['device']){
-
- // Prepare columns
- $str = "{$seps[2]}{$partitionImg} {$part['target']}";
- $device = "";
- $fsType = $part['fsType'];
- $target = "";
- if(preg_match("/^(swap|\/)/", $part['target'])){
- $target = $part['target'];
- }
-
- // Do we have a raid here? Then update the device column
- // to point to the raid name
- if(isset($map_partToRaid[$part['target']])){
- $device = sprintf(_("Used by: %s"), $raidImg." ".$map_partToRaid[$part['target']]);
- $fsType.= " "._("Software raid");
- $fsType = trim($fsType);
- }elseif(isset($map_partToVolumeGroup[$part['target']])){
- $device = sprintf(_("Used by: %s"), $volumeGroupImg." ".$map_partToVolumeGroup[$part['target']]);
- $fsType.= " "._("Physical volume LVM");
- $fsType = trim($fsType);
- }
-
- // Create property icons
- $emptyImage = image("images/empty.png");
- $formatImg = ($part['format']) ? image('plugins/goto/images/formatDisk.png','',_("Format partition")) : $emptyImage;
- $primaryImg = ($part['primary']) ? image('plugins/goto/images/primary.png','',_("Primary partition")) : $emptyImage;
- $bootImg = ($part['bootable']) ? image('images/true.png','',_("Bootable")) : $emptyImage;
- $encryptImg = ($part['encrypted']) ? image('images/lists/locked.png','',_("Encrypted")) : $emptyImage;
-
- // Create remove icon
- $delImg = image('images/lists/trash.png', "delete_part_{$pid}", _("Remove partition"));
-
- // Add entry to the listing
- $lData[] = array("data" => array(
- $str,
- $target,
- $this->__convertPartSize($part['size'], $part['grow'], $part['maxSize']),
- $device,
- $fsType,
- $part['fsOptions'],
- "{$primaryImg} {$formatImg} {$bootImg} {$encryptImg}",
- $delImg));
- }
- }
- }
- }
-
- // Updated columns length for all entries to avoid render errors.
- $length = 8;
- foreach($lData as $id => $entry){
- while(count($lData[$id]['data']) < $length){
- $lData[$id]['data'][] = '';
- }
- }
- $this->entryList->setListData($lData, $lData);
- $this->entryList->update();
-
- $smarty = get_smarty();
- $smarty->assign('error', FALSE);
- $smarty->assign('list', $this->entryList->render());
- return($smarty->fetch(get_template_path('goto/Device/DevicePartition.tpl', TRUE)));
- }
-
-
- /*! \brief Keep posted HTML values and acts on remove requests.
- */
- function save_object()
- {
- // Create a map whcih points to the correct remove method for each device.
- $map = array();
- $map['part'] = array('func' => 'delPartition', 'name' => _("Partition"));
- $map['raid'] = array('func' => 'delRaidDevice', 'name' => _("Raid device"));
- $map['disk'] = array('func' => 'delDisk', 'name' => _("Disk"));
- $map['vg'] = array('func' => 'delVolumeGroup', 'name' => _("Volume group"));
- $map['v'] = array('func' => 'delVolume', 'name' => _("Volume"));
-
- // Walk through posts and search for remove requests.
- foreach($_POST as $name => $value){
- foreach($map as $type => $data){
-
- // Remove paritions
- if(preg_match("/^delete_{$type}_[0-9]*$/", $name)){
- $id = preg_replace("/^delete_{$type}_/i", "", $name) + 0;
- $func = $data['func'];
- @$this->object->$func($id);
- if(!$this->object->success()){
- $msg = sprintf(_("Failed to remove '%s': %s"), $data['name'], $this->object->getError());
- msg_dialog::display(_("Error"), $msg, ERROR_DIALOG);
- }
- }
- }
- }
- }
-
-
- /*! \brief Returns to created partition table string, which can then be
- * saved back to the server.
- */
- function save()
- {
- return($this->object->dump());
- }
-
-
- /*! \brief Convert a given size value to a human readable format.
- */
- function __convertPartSize($size, $grow = False, $maxSize = NULL)
- {
- $str = $size." "._("MB");
-
- if($maxSize != NULL){
- $str .= " - ".$this->__convertPartSize($maxSize);
- }elseif($grow){
- $str .= " - ... <i>("._("growing").")</i>";
- }
- return($str);
- }
-}
-
-?>
diff --git a/gosa-plugins/goto/admin/systems/goto/Device/class_InstallRecipe.inc b/gosa-plugins/goto/admin/systems/goto/Device/class_InstallRecipe.inc
+++ /dev/null
@@ -1,753 +0,0 @@
-<?php
-
-class InstallRecipe extends plugin
-{
-
- public $rpcErrorMessage = "";
- public $deviceUUID = "";
-
- // Template options
- public $installTemplate = "";
- public $installationTemplateNames = array();
- public $templateToRelease = array();
- public $installationTemplates = array();
-
- // The selected installation release
- public $installRelease = "";
-
- // Selected config management variant
- public $installConfigManagement = '';
- public $installConfigManagementList = array();
-
- // Bootstrap method
- public $installBaseMethod = '';
- public $installBaseMethodList = array();
-
- // Timezone settings
- public $installTimezone = "";
- public $installTimeUTC = "";
-
- // Kernel packages
- public $installKernelPackage = "";
- public $installKernelPackageList = array();
-
- // System Locale
- public $installSystemLocale = "";
- public $installSystemLocaleList = array();
-
- // Selected NTP Server
- public $installNTPServer = array();
- public $installNTPServerList = NULL;
-
- // Root password
- public $installRootEnabled = "";
- public $installRootPasswordHash = "";
- public $setPasswordHash = FALSE;
-
- // Partition table variables
- public $installPartitionTable = "";
- private $partitionEdit = NULL;
-
- // Keyboard-layout attribute
- public $installKeyboardlayout = "";
- public $installKeyboardlayoutList = array();
-
- // Mirror related attribute
- public $installMirror = "";
- public $installMirrorList = array();
-
- public $objectclasses = array();
- public $attributes = array("installRelease", "installTemplate","installKeyboardlayout","installSystemLocale",
- "installTimezone","installTimeUTC","installNTPServer","installMirror",
- "installRootEnabled","installRootPasswordHash","installKernelPackage",
- "installPartitionTable","installConfigManagement","installBaseMethod");
-
-
- /* Some plugin management related attributes
- * See class plugin for details.
- */
- public $view_logged = FALSE;
- public $ignore_account = FALSE;
- public $parent = NULL;
-
- /*! \brief Initialize the plugin and its widgets.
- * Finally call init() to load values from the backend.
- */
- function __construct(&$config, $dn, $parent)
- {
- plugin::plugin($config, $dn);
-
- $this->is_account = $this->initially_was_account = FALSE;
-
- $this->_device = &$parent;
- $this->deviceUUID = $parent->deviceUUID;
-
- // Set default password hash
- $this->hash = $this->config->get_cfg_value("core","passwordDefaultHash");
-
- // Get list of password hashes
- $tmp = passwordMethod::get_available_methods();
- $this->hashes = array();
- foreach($tmp['name'] as $name){
- $this->hashes[$name] = $name;
- }
-
- // Initialize plugin
- $this->init_static_info();
- $this->init($initially = TRUE);
- }
-
- function init($initially = FALSE)
- {
- // Init the object values.
- $this->init_client_info();
-
- // Prepare NTP servers list
- $this->installNTPServerList= new sortableListing($this->installNTPServer);
- $this->installNTPServerList->setDeleteable(true);
- $this->installNTPServerList->setEditable(false);
- $this->installNTPServerList->setColspecs(array('*'));
- $this->installNTPServerList->setWidth("100%");
- $this->installNTPServerList->setHeight("70px");
-
- // Preset values for new devices
- if(!$this->is_account){
- $this->installTemplate = key($this->installationTemplates);
- $this->installRelease = key($this->templateToRelease[$this->installTemplate]);
- }else{
-
- if(!isset($this->installationTemplates[$this->installTemplate])){
-
- // The selected template is no longer available, select the next selectable template.
- $new = key($this->installationTemplates);
-
- if($initially){
- $message = sprintf(_("The selected template '%s' is no longer available. Selecting '%s' as replacement!"),
- $this->installTemplate, $new);
- msg_dialog::display(_("Warning"), $message, WARNING_DIALOG);
- }
- $this->installTemplate = $new;
- $installRelease = key($this->templateToRelease[$this->installTemplate]);
-
- }elseif(!isset($this->installationTemplates[$this->installTemplate]['method'])){
-
- // Not necessary to warn the user here, the input fields will be empty and thus
- // avoid saving.
-
- }elseif(!in_array_strict($this->installRelease, $this->templateToRelease[$this->installTemplate])){
-
- // The selected release is no longer available for the current template
- // Warn the user and select the next selectable release.
- $new = key($this->templateToRelease[$this->installTemplate]);
- if($initially){
- $message = sprintf(_("The selected release '%s' is no longer available. Selecting '%s' as replacement!"),
- $this->installRelease, $new);
- }
- $this->installRelease = $new;
- msg_dialog::display(_("Warning"), $message, WARNING_DIALOG);
- }
- }
-
- // Update selectable items like kernels and mirrors depending on the current setup (relase)
- $this->installBaseMethod = $this->installationTemplates[$this->installTemplate]['method'];
- $this->reloadInstallationKernelPackages($initially);
- $this->reloadInstallationMirrors($initially);
-
- // Preset the config management method.
- if(!isset($this->installConfigManagementList[$this->installBaseMethod][$this->installConfigManagement])){
- if(isset($this->installConfigManagementList[$this->installBaseMethod]) &&
- count($this->installConfigManagementList[$this->installBaseMethod])){
- $this->installConfigManagement = key($this->installConfigManagementList[$this->installBaseMethod]);
- }
- }
- }
-
-
- /*! \brief Loads client-information values from the GOsa-backend using jsonRPC
- */
- function init_client_info()
- {
- if(empty($this->deviceUUID)){
- return;
- }
-
- // Load base install Method
- $rpc = $this->config->getRpcHandle();
- $bMethod = $rpc->systemGetBaseInstallMethod($this->deviceUUID);
- if(!$rpc->success()){
- $this->rpcErrorMessage = $rpc->get_error();
- msg_dialog::display(_("Error"), msgPool::rpcError($this->rpcErrorMessage), ERROR_DIALOG);
- return(NULL);
- }
-
- // Do nothing while no install method is defined.
- if(!$bMethod){
- return;
- }
-
- // Set the bootstrap method.
- $this->installBaseMethod = $bMethod;
-
- $res = $rpc->systemGetBaseInstallParameters($this->deviceUUID);
-
- // Failed to load backend values, keep reported error and return with FALSE;
- $this->rpcError = !$rpc->success();
- if(!$rpc->success()){
- $this->rpcErrorMessage = $rpc->get_error();
- msg_dialog::display(_("Error"), msgPool::rpcError($this->rpcErrorMessage), ERROR_DIALOG);
- return(NULL);
- }
-
- // Apply received options
- $this->is_account = $res == True;
- if($this->is_account){
-
- $map = array(
- 'ntp-servers' => "installNTPServer",
- 'template' => "installTemplate",
- 'keyboard-layout' => "installKeyboardlayout");
-
- // We receive an array for these attributes, but require a string instead
- // we just use the first element of the array.
- $mapArray = array(
- 'release' => "installRelease",
- 'timezone' => "installTimezone",
- 'utc' => "installTimeUTC",
- 'kernel' => "installKernelPackage",
- 'system-locale' => "installSystemLocale",
- 'root-user' => "installRootEnabled",
- 'root-hash' => "installRootPasswordHash",
- 'disk-setup' => "installPartitionTable");
-
- foreach($res as $name => $data){
- if(isset($map[$name])){
- $target = $map[$name];
- $value = $res[$name];
- }elseif(isset($mapArray[$name])){
- $target = $mapArray[$name];
- $value = $res[$name][0];
- }
- $this->$target = $value;
- }
-
- // Convert Bool values to Bool.
- $boolean = array("installRootEnabled", "installTimeUTC");
- foreach($boolean as $attr){
- $this->$attr = ($this->$attr != FALSE && !preg_match("/false/i", $this->$attr));
- }
- }
-
- return;
- }
-
-
- function init_static_info()
- {
- // Load static values.
- foreach(array(
- "timeozones" => "getTimezones",
- "distributions" => "loadDistributions",
- "keyboardLayouts" => "loadInstallationKeyboardLayouts",
- "installationTemplates" => "loadInstallationTemplates",
- "installationMethods" => "loadInstallationMethods",
- "locales" => "getSystemLocales" ) as $target => $func){
-
- if(!session::is_set("InstallRecipe::{$func}")){
- $tmp = $this->$func();
- if($tmp == NULL){
- $this->initFailed = TRUE;
- msg_dialog::display(_("Error"), msgPool::rpcError($this->rpcErrorMessage), ERROR_DIALOG);
- return;
- }else{
- session::set("InstallRecipe::{$func}", $tmp);
- }
- }
- $$target = session::get("InstallRecipe::{$func}");
- }
-
- // Assign fetchted values
- $this->timezones = $timeozones;
- $this->installBaseMethodList = $installationMethods['installBaseMethodList'];
- $this->installConfigManagementList = $installationMethods['installConfigManagementList'];
- $this->installSystemLocaleList = $locales;
- $this->installKeyboardlayoutList = $keyboardLayouts;
- $this->distributions = $distributions;
-
- # Create template to relase map
- $this->templateToRelease = array();
-
- // Walk through installation templates and use the 'repositories' attribute
- // to supported releases.
- foreach($installationTemplates as $name => $tdata){
-
- $mName = isset($this->installBaseMethodList[$tdata['method']]) ?
- $this->installBaseMethodList[$tdata['method']]: $tdata['method'];
-
- $this->installationTemplateNames[$name] = $tdata['description']." (".$mName.")";
- $this->installationTemplates[$name] = $tdata;
- $this->templateToRelease[$name] = array();
-
- // Check if the 'repository'-category of the template can be found in any
- // received release list.
- if(isset($installationMethods[$tdata['method']]['repositories'])){
- $repos = $installationMethods[$tdata['method']]['repositories'];
- foreach($distributions as $dist){
- if(in_array_strict($dist['type']['name'],$repos) && isset($dist['releases'])){
- foreach($dist['releases'] as $release){
- $rname = $dist['name'].'/'.$release['name'];
- $this->templateToRelease[$name][$rname] = $rname;
- }
- }
- }
- }
- }
- }
-
-
- function check()
- {
- // Check if the parents deviceUUID has changed
- if($this->deviceUUID != $this->_device->deviceUUID){
- $this->deviceUUID = $this->_device->deviceUUID;
- print "The device uuid has changed.";
- }
- }
-
-
- function execute()
- {
- // Log account access
- if($this->is_account && !$this->view_logged){
- $this->view_logged = TRUE;
- new log("view","Device/".get_class($this),$this->dn);
- }
-
- /***************
- Handle account state
- ***************/
-
- // Allow to add or remove the distribution list extension
- if(isset($_POST['modify_state'])){
- if($this->is_account && $this->acl_is_removeable()){
- $this->is_account= FALSE;
- }elseif(!$this->is_account && $this->acl_is_createable()){
- $this->is_account= TRUE;
- }
- }
-
- // Show account status-changer
- $display = "";
- if ($this->parent !== NULL){
- if ($this->is_account){
- $display= $this->show_disable_header(_("Remove base installation"),
- msgPool::featuresEnabled(_("Base installation")));
- } else {
- $display= $this->show_enable_header(_("Add base installation"),
- msgPool::featuresDisabled(_("Base installation")));
- return ($display);
- }
- }
-
- /***************
- Root password hash dialog
- ***************/
-
- $this->dialog = FALSE;
- if($this->setPasswordHash){
- $this->dialog = TRUE;
- $smarty = get_smarty();
- $smarty->assign('hashes', set_post($this->hashes));
- $smarty->assign('hash', set_post($this->hash));
- return($smarty->fetch(get_template_path('goto/Device/SetPassword.tpl', TRUE)));
- }
-
- /***************
- Partition dialog
- ***************/
-
- if(isset($_POST['partition_finish']) && $this->partitionEdit){
- $this->installPartitionTable = $this->partitionEdit->save();
- $this->partitionEdit = NULL;
- }
- if(isset($_POST['partition_cancel']) && $this->partitionEdit){
- $this->partitionEdit = NULL;
- }
- if(isset($_POST['edit_installPartitionTable'])){
- $this->partitionEdit = new DevicePartition($this->config, $this->installPartitionTable);
- }
- if($this->partitionEdit){
- $this->partitionEdit->save_object();
- $this->dialog = TRUE;
- return($this->partitionEdit->execute());
- }
-
-
-
- /***************
- Generate HTML content
- ***************/
-
- $this->installNTPServerList->setAcl($this->getacl('installNTPServer'));
- $this->installNTPServerList->update();
-
- plugin::execute();
- $smarty = get_smarty();
-
- // Assign ACLs
- foreach($this->attributes as $attr){
- $smarty->assign("{$attr}ACL", $this->getacl($attr));
- }
-
- $smarty->assign('installTemplateList', $this->installationTemplateNames);
- $smarty->assign('installReleaseList', $this->templateToRelease[$this->installTemplate]);
- $smarty->assign('timezones', $this->timezones);
- $smarty->assign('installKeyboardlayoutList', $this->installKeyboardlayoutList);
- $smarty->assign('installKernelPackageList', $this->installKernelPackageList);
- $smarty->assign('installMirrorList', $this->installMirrorList);
- $smarty->assign('installSystemLocaleList', $this->installSystemLocaleList);
- $smarty->assign('installNTPServerList', $this->installNTPServerList->render());
-
- $smarty->assign('installBaseMethod', $this->installBaseMethod);
- $smarty->assign('installBaseMethodList', $this->installBaseMethodList);
- $smarty->assign('installConfigManagement', $this->installConfigManagement);
-
- // Assign list of available config-management types.
- if(isset($this->installConfigManagementList[$this->installBaseMethod])){
- $smarty->assign('installConfigManagementList', $this->installConfigManagementList[$this->installBaseMethod]);
- }else{
- $smarty->assign('installConfigManagementList', array());
- }
-
- foreach($this->attributes as $attr){
- $smarty->assign($attr, $this->$attr);
- }
- $this->dialog = false;
- return($display.$smarty->fetch(get_template_path('goto/Device/InstallRecipe.tpl', TRUE)));
- }
-
-
- function save_object()
- {
- if(isset($_POST['InstallRecipePosted'])){
-
- $currentInstallMethod = $this->installConfigManagement;
-
- $oldRelease = $this->installRelease;
- plugin::save_object();
- $this->installRootEnabled = isset($_POST['installRootEnabled']);
- $this->installTimeUTC = isset($_POST['installTimeUTC']);
-
-
- if(isset($_POST['setPasswordHash'])){
- $this->setPasswordHash = true;
- }
-
- $this->installNTPServerList->save_object();
- $this->installNTPServer = $this->installNTPServerList->getMaintainedData();
- if(isset($_POST['installNTPServer_Input']) && isset($_POST['installNTPServer_Add'])){
- $add = get_post('installNTPServer_Input');
- if(!in_array_strict($add, $this->installNTPServer) && !empty($add)){
- $this->installNTPServer[] = $add;
- }
- }
- $this->installNTPServerList->setListData($this->installNTPServer);
- $this->installBaseMethod = $this->installationTemplates[$this->installTemplate]['method'];
-
- // The selected release is no longer available for the current template
- if(!in_array_strict($this->installRelease, $this->templateToRelease[$this->installTemplate])){
- $this->installRelease = key($this->templateToRelease[$this->installTemplate]);
- }
-
- // Reload list of kernel packages and mirrors
- if($oldRelease != $this->installRelease){
- $this->reloadInstallationKernelPackages();
- $this->reloadInstallationMirrors();
- }
- }
-
- if(isset($_POST['cancelPassword'])) $this->setPasswordHash =false;
- if(isset($_POST['setPassword'])) {
- $this->setPasswordHash =false;
- $hash = get_post('passwordHash');
-
- // Not sure, why this is here, but maybe some encryption methods require it.
- mt_srand((double) microtime()*1000000);
-
- // Generate the requested hash
- $methods = new passwordMethod($this->config, $this->dn);
- $available = $methods->get_available_methods();
- $test = new $available[$hash]($this->config,$this->dn);
- $this->installRootPasswordHash = @$test->generate_hash(get_post('rootPassword'));
- }
- }
-
-
- function save()
- {
- if(!$this->installRootEnabled) $this->installRootPasswordHash = "";
-
- $map = array(
- "installTemplate"=>'template',
- "installRelease"=>'release',
- "installTimezone"=>'timezone',
- "installTimeUTC"=>'utc',
- "installKernelPackage"=>'kernel',
- "installSystemLocale"=>'system-locale',
- "installRootEnabled"=>'root-user',
- "installRootPasswordHash"=>'root-hash',
- "installPartitionTable"=>'disk-setup',
- "installKeyboardlayout"=>'keyboard-layout',
- "installBaseMethod"=>'method',
- );
-
- // Collect values to be saved.
- $data = array();
- foreach($map as $source => $dest){
- if(!empty($this->$source)){
- $data[$dest] = $this->$source;
- }
- }
-
- // Enforce an array for ntp-servers
- if(!empty($this->installNTPServer)){
- $data['ntp-servers'] = array_values($this->installNTPServer);
- }
-
- // Save Boolean like a String
- $boolean = array("root-user" => "installRootEnabled", "utc" => "installTimeUTC");
- foreach($boolean as $attr => $source){
- $data[$attr] = ($this->$source) ? $data[$attr] = "TRUE" : $data[$attr] = "FALSE";
- }
-
- // Set the base installation parameters
- $rpc = $this->config->getRpcHandle();
- $res = $rpc->systemSetBaseInstallParameters($this->deviceUUID, $data);
-
- // Handle errors
- $this->rpcError = !$rpc->success();
- if(!$rpc->success()){
- $this->rpcErrorMessage = $rpc->get_error();
- msg_dialog::display(_("Error"), msgPool::rpcError($this->rpcErrorMessage), ERROR_DIALOG);
- return(NULL);
- }
- }
-
-
- function remove_from_parent()
- {
- // Try to remove the base install extension.
- $rpc = $this->config->getRpcHandle();
- $bMethod = $rpc->removeBaseInstallParameters($this->deviceUUID);
- if(!$rpc->success()){
- $this->rpcErrorMessage = $rpc->get_error();
- msg_dialog::display(_("Error"), msgPool::rpcError($this->rpcErrorMessage), ERROR_DIALOG);
- return(NULL);
- }
- }
-
-
- /*! \brief Refreshes the list of selectable kernel packages.
- */
- function reloadInstallationKernelPackages($initially = FALSE)
- {
- // Do nothing if no release is given.
- if(empty($this->installRelease)){
- $this->installKernelPackageList = array();
- return;
- }
-
- $release = preg_replace("/^[^\/]*\//","", $this->installRelease);
- $rpc = $this->config->getRpcHandle();
- $res = $rpc->getKernelPackages($release);
-
- // Failed to load backend values, keep reported error and return with FALSE;
- $this->rpcError = !$rpc->success();
- if(!$rpc->success()){
- $this->rpcErrorMessage = $rpc->get_error();
- msg_dialog::display(_("Error"), msgPool::rpcError($this->rpcErrorMessage), ERROR_DIALOG);
- }else{
- $this->installKernelPackageList = array();
- foreach($res as $data){
- $name = $data['name'];
- $this->installKernelPackageList[$name] = $name;
- }
-
- if(!isset($this->installKernelPackageList[$this->installKernelPackage])){
- $new = key($this->installKernelPackageList);
- if($initially && $this->is_account){
- msg_dialog::display(_("Warning"), sprintf(_("The selected kernel package '%s' is no longer available! The kernel package '%s' was selected as replacement!"), $this->installKernelPackage, $new), WARNING_DIALOG);
- }
- $this->installKernelPackage = $new;
- }
- }
- }
-
-
- /*! \brief Returns a list of distributions on success.
- * In case of an error, it returns NULL.
- */
- function loadDistributions()
- {
- $rpc = $this->config->getRpcHandle();
- $res = $rpc->getDistributions();
-
- // Failed to load backend values, keep reported error and return with FALSE;
- $this->rpcError = !$rpc->success();
- if(!$rpc->success()){
- $this->rpcErrorMessage = $rpc->get_error();
- return(NULL);
- }
- return($res);
- }
-
-
- /*! \brief Returns a list of timezones on success.
- * In case of an error, it returns NULL.
- */
- function getTimezones()
- {
- $rpc = $this->config->getRpcHandle();
- $res = $rpc->getTimezones();
-
- // Failed to load backend values, keep reported error and return with FALSE;
- $this->rpcError = !$rpc->success();
- if(!$rpc->success()){
- $this->rpcErrorMessage = $rpc->get_error();
- return(NULL);
- }
- return($res);
- }
-
-
- /*! \brief Returns a list of installation mirrors on success.
- * In case of an error, it returns NULL.
- */
- function reloadInstallationMirrors($initially = FALSE)
- {
- $res = array(
- 'dc=intranet,dc=gonicus,dc=de' => 'Intranet',
- 'ou=systems,dc=intranet,dc=gonicus,dc=de' => 'System');
- $this->installMirrorList =$res;
- }
-
-
- /*! \brief Returns a list of installation templates on success.
- * In case of an error, it returns NULL.
- */
- function loadInstallationTemplates()
- {
- $rpc = $this->config->getRpcHandle();
- $res = $rpc->installListTemplates();
-
- // Failed to load backend values, keep reported error and return with FALSE;
- $this->rpcError = !$rpc->success();
- if(!$rpc->success()){
- $this->rpcErrorMessage = $rpc->get_error();
- return(NULL);
- }
- return($res);
- }
-
-
- /*! \brief Returns a list of keyboard layouts on success.
- * In case of an error, it returns NULL.
- */
- function loadInstallationKeyboardLayouts()
- {
- $rpc = $this->config->getRpcHandle();
- $res = $rpc->getKeyboardModels();
-
- // Failed to load backend values, keep reported error and return with FALSE;
- $this->rpcError = !$rpc->success();
- if(!$rpc->success()){
- $this->rpcErrorMessage = $rpc->get_error();
- return(NULL);
- }
- $lay = array();
- foreach($res as $key => $data){
- $lay[$key] = "{$data[0]} - {$data[2]}";
- }
- asort($lay);
- return($lay);
- }
-
-
- /*! \brief Returns a list of system locales on success.
- * In case of an error, it returns NULL.
- */
- function getSystemLocales()
- {
- $rpc = $this->config->getRpcHandle();
- $res = $rpc->getSystemLocales();
-
- // Failed to load backend values, keep reported error and return with FALSE;
- $this->rpcError = !$rpc->success();
- if(!$rpc->success()){
- $this->rpcErrorMessage = $rpc->get_error();
- msg_dialog::display(_("Error"), msgPool::rpcError($this->rpcErrorMessage), ERROR_DIALOG);
- return(NULL);
- }
-
- return($res);
- }
-
-
- /*! \brief Try to load install and bootstrap methods from the GOsa-backend
- * This is done via jsonRPC, if calling the backend method fails,
- * this method returns FALSE, in case of success it return TRUE;
- */
- function loadInstallationMethods()
- {
- $rpc = $this->config->getRpcHandle();
- $res = $rpc->getSupportedBaseInstallMethods();
-
- // Failed to load backend values, keep reported error and return with FALSE;
- $this->rpcError = !$rpc->success();
- if(!$rpc->success()){
- $this->rpcErrorMessage = $rpc->get_error();
- return(NULL);
- }
-
- // Walk through result and set bootstrap methods.
- foreach($res as $name => $method){
- $res['installBaseMethodList'][$name] = $method['name'];
- foreach($method['methods'] as $m){
- $res['installConfigManagementList'][$name][$m] = $m;
- }
- }
- return($res);
- }
-
-
- static function plInfo()
- {
- return (array(
- "plShortName" => _("Device"),
- "plDescription" => _("Registered device"),
- "plSelfModify" => FALSE,
- "plDepends" => array(),
- "plPriority" => 1,
- "plSection" => array("administration"),
- "plCategory" => array("Device"),
- "plProvidedAcls" => array(
-
- "installRelease" => _("Release"),
- "installTemplate" => _("Template"),
- "installKeyboardlayout" => _("Keyboard layout"),
- "installSystemLocale" => _("Locale"),
- "installTimezone" => _("Timezone"),
- "installTimeUTC" => _("Utc"),
- "installNTPServer" => _("Ntp server"),
- "installMirror" => _("Mirror"),
- "installRootEnabled" => _("Root login enabled"),
- "installRootPasswordHash" => _("Root password hash"),
- "installKernelPackage" => _("Kernel package"),
- "installConfigManagement" => _("Config mangement"),
- "installBaseMethod" => _("Bootstrap method"),
- "installPartitionTable" => _("Partition table")
- )
- )
- );
- }
-}
-?>