X-Git-Url: https://git.tokkee.org/?a=blobdiff_plain;f=gosa-plugins%2Ffai%2Fadmin%2Ffai%2Fclass_faiProfile.inc;h=db587ac06f055f69019b88dab17e8760664771e2;hb=cb773874cb502bc0f01aeefc43849e0522e1a4d9;hp=9465d1e4b94be81f6388a1845a35e3b246743320;hpb=bc145d1c1e9fce5246aecec2e3d5d243b34951ba;p=gosa.git diff --git a/gosa-plugins/fai/admin/fai/class_faiProfile.inc b/gosa-plugins/fai/admin/fai/class_faiProfile.inc index 9465d1e4b..db587ac06 100644 --- a/gosa-plugins/fai/admin/fai/class_faiProfile.inc +++ b/gosa-plugins/fai/admin/fai/class_faiProfile.inc @@ -23,6 +23,8 @@ class faiProfile extends plugin var $FAIstate = ""; var $view_logged = FALSE; + var $classSelect; + function faiProfile(&$config, $dn= NULL) { /* Load Attributes */ @@ -32,7 +34,7 @@ class faiProfile extends plugin $this->ui = get_userinfo(); /* Parse ldap attribute to get all assigned classes */ - $tmp = split(" ",$this->FAIclass); + $tmp = explode(" ",$this->FAIclass); $tmp2 = array(); foreach($tmp as $class){ if(!empty($class)){ @@ -118,9 +120,9 @@ class faiProfile extends plugin function acl_base_for_current_object($dn) { - if($dn == "new"){ + if($dn == "new" || $dn == ""){ if($this->dn == "new"){ - $dn = session::get('CurrentMainBase'); + $dn= $this->parent->parent->acl_base; }else{ $dn = $this->dn; } @@ -250,51 +252,44 @@ class faiProfile extends plugin } if($s_action == "add" && $this->acl_is_writeable("FAIclass")){ - $this->dialog = new faiProfileEntry($this->config,$this->dn,$this->FAIclasses,$this->parent->parent->fai_release); - $this->is_dialog =true; + $this->classSelect = new classSelect($this->config, get_userinfo()); + $this->dialog =true; } /* Save Dialog */ - if(isset($_POST['SaveSubObject'])){ - $this->dialog->save_object(); - $msgs= $this->dialog->check(); - if(count($msgs)){ - msg_dialog::display(_("Error"), $msgs, ERROR_DIALOG); - }else{ - $ret = $this->dialog->save(); - foreach($ret as $class){ - $this->FAIclasses[$class] =$class; - } - $this->is_dialog=false; - unset($this->dialog); - $this->dialog=FALSE; - //ksort($this->FAIclasses); + if(isset($_POST['classSelect_save']) && $this->classSelect instanceOf classSelect){ + $list = $this->classSelect->save(); + foreach($list as $entry){ + $class = $entry['cn'][0]; + $this->FAIclasses[$class] =$class; } + $this->dialog=false; + $this->classSelect=FALSE; } } /* Cancel Dialog */ - if(isset($_POST['CancelSubObject'])){ - $this->is_dialog=false; - unset($this->dialog); - $this->dialog=FALSE; + if(isset($_POST['classSelect_cancel']) && $this->classSelect instanceOf classSelect){ + $this->dialog=false; + $this->classSelect=FALSE; } - if(is_object($this->dialog)){ - $this->dialog->save_object(); - return($this->dialog->execute()); + if($this->classSelect instanceOf classSelect){ + session::set('filterFAIClass_base',$this->parent->parent->fai_release); + session::set('filterBlacklist', array('cn' => array_values($this->FAIclasses))); + return($this->classSelect->execute()); } $divlist =new divSelectBox("Profile"); $divlist->SetSummary(_("This list displays all assigned class names for this profile.")); /* item images */ - $objTypes['FAIhook'] = ""; - $objTypes['FAItemplate'] = ""; - $objTypes['FAIscript'] = ""; - $objTypes['FAIvariable'] = ""; - $objTypes['FAIpackageList'] = ""; - $objTypes['FAIpartitionTable'] = ""; + $objTypes['FAIhook'] = ""; + $objTypes['FAItemplate'] = ""; + $objTypes['FAIscript'] = ""; + $objTypes['FAIvariable'] = ""; + $objTypes['FAIpackageList'] = ""; + $objTypes['FAIpartitionTable'] = ""; /* Delete button */ $actions = ""; @@ -364,7 +359,7 @@ class faiProfile extends plugin $ldap = $this->config->get_ldap_link(); $ldap->cd ($this->dn); $release = $this->parent->parent->fai_release; - $use_dn = preg_replace("/".normalizePreg(FAI::get_release_dn($this->dn))."/i", $release, $this->dn); + $use_dn = preg_replace("/".preg_quote(FAI::get_release_dn($this->dn), '/')."/i", $release, $this->dn); new log("remove","fai/".get_class($this),$use_dn,$this->attributes); FAI::prepare_to_save_FAI_object($use_dn,array(),true); $this->handle_post_events("remove"); @@ -391,15 +386,15 @@ class faiProfile extends plugin $message[]=_("No class specified for this profile!"); } - if(empty($this->cn)){ - $message[]= msgPool::invalid(_("Name")); + if($this->cn == ""){ + $message[]= msgPool::required(_("Name")); } /* Ensure that we do not overwrite an allready existing entry */ if($this->dn == "new" || $this->cn != $this->old_cn){ $release = $this->parent->parent->fai_release; - $new_dn= 'cn='.$this->cn.",".get_ou('faiprofileou').get_ou('faiou').$release; + $new_dn= 'cn='.$this->cn.",".get_ou('faiProfileRDN').get_ou('faiBaseRDN').$release; $res = faiManagement::check_class_name("FAIprofile",$this->cn,$new_dn); if(isset($res[$this->cn])){ $message[] = msgPool::duplicated(_("Name")); @@ -446,7 +441,7 @@ class faiProfile extends plugin plugin::PrepareForCopyPaste($source); /* Parse ldap attribute to get all assigned classes */ - $tmp = split(" ",$this->FAIclass); + $tmp = explode(" ",$this->FAIclass); $tmp2 = array(); foreach($tmp as $class){ if(!empty($class)){