X-Git-Url: https://git.tokkee.org/?a=blobdiff_plain;f=gosa-plugins%2Ffai%2Fadmin%2Ffai%2Fclass_faiManagement.inc;h=72031cfd93868a7ad1b093cc8cfdd541170052f9;hb=8f7080e4d548a1257a13753c0881a2baf4ff45ed;hp=e3de7caaac3daa2241ee61d7eea795013c78ac4d;hpb=0da46ae13ec43b291ad66df73edd7c6f019057b4;p=gosa.git diff --git a/gosa-plugins/fai/admin/fai/class_faiManagement.inc b/gosa-plugins/fai/admin/fai/class_faiManagement.inc index e3de7caaa..72031cfd9 100644 --- a/gosa-plugins/fai/admin/fai/class_faiManagement.inc +++ b/gosa-plugins/fai/admin/fai/class_faiManagement.inc @@ -3,7 +3,7 @@ * This code is part of GOsa (http://www.gosa-project.org) * Copyright (C) 2003-2008 GONICUS GmbH * - * ID: $$Id: class_roleManagement.inc 14742 2009-11-04 13:18:33Z hickert $$ + * ID: $$Id: class_faiManagement.inc 14742 2009-11-04 13:18:33Z 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 @@ -27,14 +27,14 @@ class faiManagement extends management var $plIcon = "plugins/fai/images/plugin.png"; // Tab definition - protected $tabClass = "roletabs"; - protected $tabType = "ROLETABS"; - protected $aclCategory = "roles"; - protected $aclPlugin = "role"; - protected $objectName = "role"; + protected $tabClass = ""; + protected $tabType = ""; + protected $aclCategory = ""; + protected $aclPlugin = ""; + protected $objectName = "FAI object"; // Attributes Managed by this plugin can be used in post events - protected $attributes = array("lock_type","lock_name","lock_dn"); + public $attributes = array("lock_type","lock_name","lock_dn"); var $dispNewBranch=false; var $dispNewFreeze=false; @@ -68,6 +68,11 @@ class faiManagement extends management $this->fai_release = $this->fai_base; } + $releases = $this->getReleaseList(); + if(!isset($releases[$this->fai_release])){ + $this->fai_release = $this->fai_base; + } + $this->acl_base = $this->config->current['BASE']; $this->ui = $ui; $this->storagePoints = array( @@ -86,6 +91,7 @@ class faiManagement extends management $filter = new filter(get_template_path("fai-filter.xml", true)); $filter->setObjectStorage($this->storagePoints); } + $filter->elementValues['RELEASE'] = $this->fai_release; $this->setFilter($filter); // Build headpage @@ -117,7 +123,7 @@ class faiManagement extends management $this->registerAction("saveBranch","saveBranch"); $this->registerAction("PerformBranch","PerformBranch"); - parent::__construct($config, $ui, "roles", $headpage); + parent::__construct($config, $ui, "FAI object", $headpage); } @@ -176,7 +182,7 @@ class faiManagement extends management } // Automatically disable pasting process since there is no entry left to paste. - if(!$this->cpHandler->entries_queued()){ + if(isset($this->cpHandler) && !$this->cpHandler->entries_queued()){ $this->cpPastingStarted = FALSE; } return(""); @@ -368,6 +374,9 @@ class faiManagement extends management */ function removeFAIObjects($to_delete) { + // Close dialogs and remove locks for currently handled dns + $this->cancelEdit(); + // Do not allow to remove objects with state freeezed $errors = $disallowed = array(); @@ -391,20 +400,35 @@ class faiManagement extends management } // Check entry locking + $smarty = get_smarty(); if(count($this->dns)){ if ($user= get_multiple_locks($this->dns)){ return(gen_locked_message($user,$this->dns)); } if(count($this->dns)){ - $smarty = get_smarty(); + + // Add locks $dns_names = array(); + $types = array(); + $h = $this->getHeadpage(); + + // Build list of object -labels + foreach($h->objectTypes as $type){ + $map[$type['objectClass']]= $type['label']; + } + foreach($this->dns as $dn){ - add_lock ($dn, $this->ui->dn); - $dns_names[] = LDAP::fix($dn); + $tmp = $h->getType($dn); + if(isset($map[$tmp])){ + $dns_names[] = '('._($map[$tmp]).') - '.LDAP::fix($dn); + }else{ + $dns_names[] =LDAP::fix($dn); + } } - $smarty->assign("info",msgPool::deleteInfo($dns_names,_("FAI object"))); - $smarty->assign("multiple", true); - return($smarty->fetch(get_template_path('remove.tpl', TRUE))); + add_lock ($this->dns, $this->ui->dn); + + $smarty->assign("info",msgPool::deleteInfo($dns_names)); + return($smarty->fetch(get_template_path('removeEntries.tpl', TRUE))); } } } @@ -429,7 +453,8 @@ class faiManagement extends management if(preg_match("/d/",$acl)){ // Now save changes - management::removeEntryConfirmed($action,array($dn),$all,$type[0],$type[2],$type[1]); + $str = management::removeEntryConfirmed($action,array($dn),$all,$type[0],$type[2],$type[1]); + if(!empty($str)) return($str); FAI::save_release_changes_now(); $to_del = FAI::clean_up_releases($dn); foreach($to_del as $dn){ @@ -497,6 +522,7 @@ class faiManagement extends management // Now save changes FAI::save_release_changes_now(); $to_del = FAI::clean_up_releases($this->last_dn); + $ldap= $this->config->get_ldap_link(); foreach($to_del as $dn){ $ldap->rmdir_recursive($dn); } @@ -610,7 +636,7 @@ class faiManagement extends management $this->fai_release = $this->fai_base; $this->lock_name = $name; $this->lock_dn = $bb; - $this->postremove(); + $this->handle_post_events('remove'); $fai_filter = session::get("fai_filter"); $fai_filter['fai_release'] = $this->fai_release; @@ -628,7 +654,7 @@ class faiManagement extends management function createBranch() { if($this->config->search("faiManagement", "POSTCREATE",array('menu','tabs')) == ""){ - msg_dialog::display(_("Configuration"), msgPool::cmdnotfound(_("POSTCREATE"), get_class()), ERROR_DIALOG); + msg_dialog::display(_("Configuration"), msgPool::cmdnotfound("POSTCREATE", get_class()), ERROR_DIALOG); }elseif(!preg_match("/c/",$this->ui->get_permissions($this->acl_base,"fai/faiManagement"))){ msg_dialog::display(_("Permission error"), msgPool::permCreate(_("Branch")), ERROR_DIALOG); }else{ @@ -651,7 +677,7 @@ class faiManagement extends management function createFreeze() { if($this->config->search("faiManagement", "POSTCREATE",array('menu','tabs')) == ""){ - msg_dialog::display(_("Configuration"), msgPool::cmdnotfound(_("POSTCREATE"), get_class()), ERROR_DIALOG); + msg_dialog::display(_("Configuration"), msgPool::cmdnotfound("POSTCREATE", get_class()), ERROR_DIALOG); }elseif(!preg_match("/c/",$this->ui->get_permissions($this->acl_base,"fai/faiManagement"))){ msg_dialog::display(_("Permission error"), msgPool::permCreate(_("Branch")), ERROR_DIALOG); }else{ @@ -791,13 +817,11 @@ class faiManagement extends management $this->dispNewFreeze = false; - /* Postcreate */ - /* Assign possible attributes */ $this->lock_type = $type; $this->lock_name = $name; $this->lock_dn = $baseToUse; - $this->postcreate(); + $this->handle_post_events('add'); /* Send daemon event to reload the fai release database */ @@ -1056,7 +1080,7 @@ class faiManagement extends management $headpage->update(); $smarty = get_smarty(); $smarty->assign("fai_release", $this->fai_release); - $smarty->assign("opsi_available", is_object($this->opsi)); + $smarty->assign("opsi_available", (is_object($this->opsi) && $this->opsi->enabled())); $smarty->assign("fai_base", $this->fai_base); $r = $this->config->search("faiManagement", "POSTREMOVE",array('menu','tabs')); $c = $this->config->search("faiManagement", "POSTCREATE",array('menu','tabs'));