From: hickert Date: Thu, 19 May 2011 07:18:01 +0000 (+0000) Subject: Updated Config Mangement class names X-Git-Url: https://git.tokkee.org/?a=commitdiff_plain;h=a072d3cd4cfd2ec4413a372f74dc4e24533d9ffb;p=gosa.git Updated Config Mangement class names git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@20872 594d385d-05f5-0310-b6e9-bd551577e9d8 --- diff --git a/gosa-plugins/goto-ng/admin/newConfigManagement/DeviceConfig-filter.xml b/gosa-plugins/goto-ng/admin/newConfigManagement/DeviceConfig-filter.xml index 7a0c28d27..d585dbb11 100644 --- a/gosa-plugins/goto-ng/admin/newConfigManagement/DeviceConfig-filter.xml +++ b/gosa-plugins/goto-ng/admin/newConfigManagement/DeviceConfig-filter.xml @@ -3,7 +3,7 @@ true - Device + ConfigMangement auto default - diff --git a/gosa-plugins/goto-ng/admin/newConfigManagement/class_ConfigManagement.inc b/gosa-plugins/goto-ng/admin/newConfigManagement/class_ConfigManagement.inc index 3f9a52595..0b23aaae8 100644 --- a/gosa-plugins/goto-ng/admin/newConfigManagement/class_ConfigManagement.inc +++ b/gosa-plugins/goto-ng/admin/newConfigManagement/class_ConfigManagement.inc @@ -30,7 +30,7 @@ class ConfigManagement extends plugin function __construct($config, $dn) { $this->config = &$config; - $this->listing = new ConfigManagementListing($this->config, get_userinfo(), $this); + $this->listing = new cfgMgmtMangement($this->config, get_userinfo(), $this); // Load the template engine and tell her what template // to use for the HTML it produces. @@ -512,7 +512,7 @@ class ConfigManagement extends plugin /*! \brief Acts on open requests. - * (This action is received from the ConfigManagementListing class.) + * (This action is received from the cfgMgmtMangement class.) * @param Array The items ids. (May contain multiple ids) * @return */ diff --git a/gosa-plugins/goto-ng/admin/newConfigManagement/class_ConfigManagementListing.inc b/gosa-plugins/goto-ng/admin/newConfigManagement/class_ConfigManagementListing.inc deleted file mode 100644 index 1b19ef757..000000000 --- a/gosa-plugins/goto-ng/admin/newConfigManagement/class_ConfigManagementListing.inc +++ /dev/null @@ -1,274 +0,0 @@ -storagePoints = array(""); - $this->rebuildListing(); - $this->containerSelector = new ItemSelector(array(),'/root','/root'); - $this->parent = &$parent; - } - - function save_object() - { - $this->containerSelector->update(); - } - - function getSelectedContainer() - { - return($this->containerSelector->getBase()); - } - - function setContainer($dist) - { - return($this->containerSelector->setBase($dist)); - } - - function setContainers($containers) - { - $this->containerSelector->setBases($containers); - $this->containerSelector->update(TRUE); - } - - function renderList() - { - $headpage = $this->getHeadpage(); - $headpage->update(); - $smarty = get_smarty(); - $smarty->assign("CONTAINER", $this->containerSelector->render()); - $display = $headpage->render(); - return($this->getHeader().$display); - } - - - function setListingTypes($types) - { - $str = ""; - foreach($types as $typeData){ - $str.= "\n"; - foreach($typeData as $key => $value){ - $str .= "\n\t<{$key}>{$value}"; - } - $str.= "\n\n"; - - } - $this->objectTypeStr = $str; - } - - - // Inject user actions - function detectPostActions() - { - $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 execute() - { - // Ensure that html posts and gets are kept even if we see a 'Entry islocked' dialog. - $vars = array('/^act$/','/^listing/','/^PID$/','/^FILTER_PID$/'); - session::set('LOCK_VARS_TO_USE',$vars); - - pathNavigator::registerPlugin($this); - - /* Display the copy & paste dialog, if it is currently open */ - $ret = $this->copyPasteHandler("",array()); - if($ret){ - return($this->getHeader().$ret); - } - - // Update filter - if ($this->filter) { - $this->filter->update(); - session::global_set(get_class($this)."_filter", $this->filter); - session::set('autocomplete', $this->filter); - } - - // Handle actions (POSTs and GETs) - $str = $this->handleActions($this->detectPostActions()); - if($str) return($this->getHeader().$str); - - $items = $this->parent->getItemsToBeDisplayed(); - session::set('CONFIG_ITEM', $items); - - // Open single dialog objects - if(is_object($this->dialogObject)){ - if(method_exists($this->dialogObject,'save_object')) $this->dialogObject->save_object(); - if(method_exists($this->dialogObject,'execute')){ - $display = $this->dialogObject->execute(); - $display.= $this->_getTabFooter(); - return($this->getHeader().$display); - } - } - - // Display tab object. - if($this->tabObject instanceOf tabs || $this->tabObject instanceOf multi_plug){ -# $this->tabObject->save_object(); - $display = $this->tabObject->execute(); - $display.= $this->_getTabFooter(); - return($this->getHeader().$display); - } - // Set current restore base for snapshot handling. - if(is_object($this->snapHandler)){ - $bases = array(); - foreach($this->storagePoints as $sp){ - $bases[] = $sp.$this->headpage->getBase(); - } - - // No bases specified? Try base - if(!count($bases)) $bases[] = $this->headpage->getBase(); - - $this->snapHandler->setSnapshotBases($bases); - } - - // Create statistic table entry - stats::log('management', $class = get_class($this), $this->getAclCategories(), $action = 'view', - $amount = 1, $duration = (microtime(TRUE) - $this->initTime)); - - // Display list - $this->rebuildListing(); - $str = $this->renderList(); - return($str); - } - - - - function rebuildListing() - { - // Build filter - if (session::global_is_set(get_class($this)."_filter")){ - $filter= session::global_get(get_class($this)."_filter"); - } else { - $filter = new filter(get_template_path("DeviceConfig-filter.xml", true)); - $filter->setObjectStorage($this->storagePoints); - } - $this->setFilter($filter); - - // Load service xml file and fill in placeholders - $contents = file_get_contents(get_template_path("DeviceConfig-list.xml", true)); - $contents = preg_replace("/%TYPES%/", $this->objectTypeStr, $contents); - - // A list of dummy images - $images = array(); - $images[] = 'images/lists/edit.png'; - $images[] = 'images/caps.png'; - $images[] = 'images/lists/trash.png'; - $images[] = 'images/filter.png'; - $images[] = 'images/find.png'; - - - $items = ""; - $i = 0; - if($this->parent){ - foreach($this->parent->addableContainerItems as $item){ - $desc = $this->parent->itemConfig[$item]['description']; - $img = $images[$i++]; - $items .= - "". - " new_{$item}". - " entry". - " {$img}". - " ". - ""; - } - } - if(!empty($items)){ - $items = - - "". - " sub". - " images/lists/element.png[new]". - " ". - " {$items}". - ""; - } - - $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("editEntry", "editEntry"); - $this->registerAction("edit", "openEntry"); - $this->registerAction("apply", "applyChanges"); - $this->registerAction("save", "saveChanges"); - $this->registerAction("cancel", "cancelEdit"); - $this->registerAction("cancelDelete", "cancelEdit"); - $this->registerAction("remove", "removeEntryRequested"); - $this->registerAction("removeConfirmed", "removeEntryConfirmed"); - - $this->registerAction("config-filter","editFilter"); - $this->registerAction("saveFilter","saveFilter"); - $this->registerAction("cancelFilter","cancelFilter"); - - $this->registerAction("cancelItemEdit", "closeDialogs"); - $this->registerAction("cancelItemAdd", "closeDialogs"); - $this->registerAction("saveItemChanges", "saveItemChanges"); - - if($this->parent){ - foreach($this->parent->addableContainerItems as $item){ - $this->registerAction("new_{$item}", "newEntry"); - } - } - - } - - function saveItemChanges() - { - $this->parent->saveItemChanges(); - } - - function removeEntryRequested($action="",$target=array(),$all=array(), $altTabClass ="", $altTabType = "", $altAclCategory="") - { - $this->parent->removeEntry($target); - } - - function newEntry($action="",$target=array(),$all=array(), $altTabClass ="", $altTabType = "", $altAclCategory="") - { - $this->parent->newEntry(preg_replace("/^new_/", "", $action)); - } - - function openEntry($action="",$target=array(),$all=array(), $altTabClass ="", $altTabType = "", $altAclCategory="") - { - $this->parent->openEntry($target); - } - - function editEntry($action="",$target=array(),$all=array(), $altTabClass ="", $altTabType = "", $altAclCategory="") - { - $this->parent->editEntry($target); - } - - function setDialogObject($o) - { - $this->dialogObject = &$o; - $this->skipFooter = TRUE; - $this->dialog = TRUE; - - } - function clearDialogObject() - { - $this->closeDialogs(); - } -} - -?> diff --git a/gosa-plugins/goto-ng/admin/newConfigManagement/class_cfgMgmtListing.inc b/gosa-plugins/goto-ng/admin/newConfigManagement/class_cfgMgmtListing.inc new file mode 100644 index 000000000..05f9b9c68 --- /dev/null +++ b/gosa-plugins/goto-ng/admin/newConfigManagement/class_cfgMgmtListing.inc @@ -0,0 +1,8 @@ + diff --git a/gosa-plugins/goto-ng/admin/newConfigManagement/class_cfgMgmtMangement.inc b/gosa-plugins/goto-ng/admin/newConfigManagement/class_cfgMgmtMangement.inc new file mode 100644 index 000000000..7d6f06678 --- /dev/null +++ b/gosa-plugins/goto-ng/admin/newConfigManagement/class_cfgMgmtMangement.inc @@ -0,0 +1,274 @@ +storagePoints = array(""); + $this->rebuildListing(); + $this->containerSelector = new ItemSelector(array(),'/root','/root'); + $this->parent = &$parent; + } + + function save_object() + { + $this->containerSelector->update(); + } + + function getSelectedContainer() + { + return($this->containerSelector->getBase()); + } + + function setContainer($dist) + { + return($this->containerSelector->setBase($dist)); + } + + function setContainers($containers) + { + $this->containerSelector->setBases($containers); + $this->containerSelector->update(TRUE); + } + + function renderList() + { + $headpage = $this->getHeadpage(); + $headpage->update(); + $smarty = get_smarty(); + $smarty->assign("CONTAINER", $this->containerSelector->render()); + $display = $headpage->render(); + return($this->getHeader().$display); + } + + + function setListingTypes($types) + { + $str = ""; + foreach($types as $typeData){ + $str.= "\n"; + foreach($typeData as $key => $value){ + $str .= "\n\t<{$key}>{$value}"; + } + $str.= "\n\n"; + + } + $this->objectTypeStr = $str; + } + + + // Inject user actions + function detectPostActions() + { + $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 execute() + { + // Ensure that html posts and gets are kept even if we see a 'Entry islocked' dialog. + $vars = array('/^act$/','/^listing/','/^PID$/','/^FILTER_PID$/'); + session::set('LOCK_VARS_TO_USE',$vars); + + pathNavigator::registerPlugin($this); + + /* Display the copy & paste dialog, if it is currently open */ + $ret = $this->copyPasteHandler("",array()); + if($ret){ + return($this->getHeader().$ret); + } + + // Update filter + if ($this->filter) { + $this->filter->update(); + session::global_set(get_class($this)."_filter", $this->filter); + session::set('autocomplete', $this->filter); + } + + // Handle actions (POSTs and GETs) + $str = $this->handleActions($this->detectPostActions()); + if($str) return($this->getHeader().$str); + + $items = $this->parent->getItemsToBeDisplayed(); + session::set('CONFIG_ITEM', $items); + + // Open single dialog objects + if(is_object($this->dialogObject)){ + if(method_exists($this->dialogObject,'save_object')) $this->dialogObject->save_object(); + if(method_exists($this->dialogObject,'execute')){ + $display = $this->dialogObject->execute(); + $display.= $this->_getTabFooter(); + return($this->getHeader().$display); + } + } + + // Display tab object. + if($this->tabObject instanceOf tabs || $this->tabObject instanceOf multi_plug){ +# $this->tabObject->save_object(); + $display = $this->tabObject->execute(); + $display.= $this->_getTabFooter(); + return($this->getHeader().$display); + } + // Set current restore base for snapshot handling. + if(is_object($this->snapHandler)){ + $bases = array(); + foreach($this->storagePoints as $sp){ + $bases[] = $sp.$this->headpage->getBase(); + } + + // No bases specified? Try base + if(!count($bases)) $bases[] = $this->headpage->getBase(); + + $this->snapHandler->setSnapshotBases($bases); + } + + // Create statistic table entry + stats::log('management', $class = get_class($this), $this->getAclCategories(), $action = 'view', + $amount = 1, $duration = (microtime(TRUE) - $this->initTime)); + + // Display list + $this->rebuildListing(); + $str = $this->renderList(); + return($str); + } + + + + function rebuildListing() + { + // Build filter + if (session::global_is_set(get_class($this)."_filter")){ + $filter= session::global_get(get_class($this)."_filter"); + } else { + $filter = new filter(get_template_path("DeviceConfig-filter.xml", true)); + $filter->setObjectStorage($this->storagePoints); + } + $this->setFilter($filter); + + // Load service xml file and fill in placeholders + $contents = file_get_contents(get_template_path("DeviceConfig-list.xml", true)); + $contents = preg_replace("/%TYPES%/", $this->objectTypeStr, $contents); + + // A list of dummy images + $images = array(); + $images[] = 'images/lists/edit.png'; + $images[] = 'images/caps.png'; + $images[] = 'images/lists/trash.png'; + $images[] = 'images/filter.png'; + $images[] = 'images/find.png'; + + + $items = ""; + $i = 0; + if($this->parent){ + foreach($this->parent->addableContainerItems as $item){ + $desc = $this->parent->itemConfig[$item]['description']; + $img = $images[$i++]; + $items .= + "". + " new_{$item}". + " entry". + " {$img}". + " ". + ""; + } + } + if(!empty($items)){ + $items = + + "". + " sub". + " images/lists/element.png[new]". + " ". + " {$items}". + ""; + } + + $contents = preg_replace("/%ITEMS%/", $items, $contents); + + $headpage = new cfgMgmtListing($contents,TRUE); + $headpage->setBase($this->base); + $headpage->setFilter($filter); + + parent::__construct($this->config, $this->ui, "services", $headpage); + + // Register default actions + $this->registerAction("new", "newEntry"); + $this->registerAction("editEntry", "editEntry"); + $this->registerAction("edit", "openEntry"); + $this->registerAction("apply", "applyChanges"); + $this->registerAction("save", "saveChanges"); + $this->registerAction("cancel", "cancelEdit"); + $this->registerAction("cancelDelete", "cancelEdit"); + $this->registerAction("remove", "removeEntryRequested"); + $this->registerAction("removeConfirmed", "removeEntryConfirmed"); + + $this->registerAction("config-filter","editFilter"); + $this->registerAction("saveFilter","saveFilter"); + $this->registerAction("cancelFilter","cancelFilter"); + + $this->registerAction("cancelItemEdit", "closeDialogs"); + $this->registerAction("cancelItemAdd", "closeDialogs"); + $this->registerAction("saveItemChanges", "saveItemChanges"); + + if($this->parent){ + foreach($this->parent->addableContainerItems as $item){ + $this->registerAction("new_{$item}", "newEntry"); + } + } + + } + + function saveItemChanges() + { + $this->parent->saveItemChanges(); + } + + function removeEntryRequested($action="",$target=array(),$all=array(), $altTabClass ="", $altTabType = "", $altAclCategory="") + { + $this->parent->removeEntry($target); + } + + function newEntry($action="",$target=array(),$all=array(), $altTabClass ="", $altTabType = "", $altAclCategory="") + { + $this->parent->newEntry(preg_replace("/^new_/", "", $action)); + } + + function openEntry($action="",$target=array(),$all=array(), $altTabClass ="", $altTabType = "", $altAclCategory="") + { + $this->parent->openEntry($target); + } + + function editEntry($action="",$target=array(),$all=array(), $altTabClass ="", $altTabType = "", $altAclCategory="") + { + $this->parent->editEntry($target); + } + + function setDialogObject($o) + { + $this->dialogObject = &$o; + $this->skipFooter = TRUE; + $this->dialog = TRUE; + + } + function clearDialogObject() + { + $this->closeDialogs(); + } +} + +?>