From: hickert Date: Wed, 5 Oct 2005 07:16:51 +0000 (+0000) Subject: Added subdepartments for FAI objects X-Git-Url: https://git.tokkee.org/?a=commitdiff_plain;h=1898a278e866af47c87475826b6ac6f6f86a85fa;p=gosa.git Added subdepartments for FAI objects git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@1473 594d385d-05f5-0310-b6e9-bd551577e9d8 --- diff --git a/plugins/admin/fai/class_askClassName.inc b/plugins/admin/fai/class_askClassName.inc index fa1b1ae06..edb9d277d 100644 --- a/plugins/admin/fai/class_askClassName.inc +++ b/plugins/admin/fai/class_askClassName.inc @@ -38,8 +38,9 @@ class askClassName extends plugin /* First search for every ou, in given fai base * With a second search detect all object that belong to the different ous. */ + $base = "ou=fai,ou=configs,ou=systems,".$faifilter['base']; $ldap = $this->config->get_ldap_link(); - $res = get_list($this->ui->subtreeACL, "(objectClass=organizationalUnit)",FALSE, $faifilter['base'], array("cn","description","objectClass"),TRUE); + $res = get_list($this->ui->subtreeACL, "(objectClass=organizationalUnit)",FALSE, $base, array("cn","description","objectClass"),TRUE); $used = array(); $delete = array(); diff --git a/plugins/admin/fai/class_faiManagement.inc b/plugins/admin/fai/class_faiManagement.inc index 9444ed872..7e9dab75d 100644 --- a/plugins/admin/fai/class_faiManagement.inc +++ b/plugins/admin/fai/class_faiManagement.inc @@ -68,7 +68,7 @@ class faiManagement extends plugin /* Get global filter config */ if (!is_global("faifilter")){ $base = get_base_from_people($ui->dn); - $faifilter= array("base" => "ou=fai,ou=configs,ou=systems,".$base, + $faifilter= array("base" => $base, "regex" => "*"); $faifilter['ShowProfiles'] = true; $faifilter['ShowTemplates'] = true; @@ -135,10 +135,42 @@ class faiManagement extends plugin $s_entry = preg_replace("/^entry_delete_/","",$key); $s_entry = preg_replace("/_.*$/","",$s_entry); $s_action = "delete"; + }elseif(preg_match("/dep_back.*/i",$key)){ + $s_action="back"; + }elseif(preg_match("/dep_home.*/i",$key)){ + $s_action="home"; + }elseif(preg_match("/dep_root.*/i",$key)){ + $s_action="root"; } } + if($s_action=="root"){ + $faifilter['base']=($this->config->current['BASE']); + } + + if($s_action=="home"){ + $faifilter['base']=(preg_replace("/^[^,]+,/","",$this->ui->dn)); + $faifilter['base']=(preg_replace("/^[^,]+,/","",$faifilter['base'])); + } + + if($s_action=="back"){ + $base_back = preg_replace("/^[^,]+,/","",$faifilter['base']); + $base_back = convert_department_dn($base_back); + + if(isset($this->config->departments[trim($base_back)])){ + $faifilter['base']= $this->config->departments[trim($base_back)]; + }else{ + $faifilter['base']= $this->config->departments["/"]; + } + } + + if(isset($_GET['act'])&&($_GET['act']=="dep_open")){ + $s_action="open"; + $s_entry = base64_decode($_GET['dep_id']); + $faifilter['base']= $this->config->departments[trim($s_entry)]; + } + if(isset($_GET['edit_entry'])){ $s_entry = $_GET['edit_entry']; $s_action = "edit"; @@ -369,6 +401,17 @@ class faiManagement extends plugin $faihead = "
 ". + " ". + + " ". + + " ". + + "\"\" ". + "  ". @@ -412,6 +455,32 @@ class faiManagement extends plugin $action .= ""; $editlink ="%NAME%"; + $linkopen = "%s"; + + foreach($this->departments as $key => $val) { + if(!isset($this->config->departments[trim($key)])){ + $this->config->departments[trim($key)]=""; + } + + $non_empty=""; + $keys= str_replace("/","\/",$key); + foreach($this->config->departments as $keyd=>$vald ){ + if(preg_match("/".$keys."\/.*/",$keyd)){ + $non_empty="full"; + } + } + + + $title = $this->config->departments[$key]; + $field0 = array("string" => "department", "attach"=>"style='width:20px;'"); + $field1 = array("string" => sprintf($linkopen,base64_encode($key),$val), "attach" => "title='".$title."'"); + $field2 = array("string" => ""); + $field3 = array("string" => "","attach"=>"style='text-align:right'"); + + $divlist->AddEntry( array($field0,$field1,$field2,$field3)); + + } + /* Attach objects */ foreach($this->objects as $key => $value){ @@ -524,7 +593,7 @@ class faiManagement extends plugin // Added for dirlist function... /* Set base for all searches */ - $base= $faifilter['base']; + $base= "ou=fai,ou=configs,ou=systems,".$faifilter['base']; $regex = $faifilter['regex']; /* Array to save objects */ @@ -532,6 +601,33 @@ class faiManagement extends plugin $this->objects=array(); + /* NEW LIST MANAGMENT + * We also need to search for the departments + * So we are able to navigate like in konquerer + */ + $base2 = $faifilter['base']; + + $res3 = get_list2($this->ui->subtreeACL, "(&(|(ou=$regex)(description=$regex))(objectClass=gosaDepartment))", + TRUE, $base2, array("ou", "description"), TRUE); + + $this->departments= array(); + $tmp = array(); + foreach ($res3 as $value){ + $tmp[strtolower($value['dn']).$value['dn']]=$value; + } + ksort($tmp); + foreach($tmp as $value){ + if($value["description"][0]!=".."){ + $this->departments[$value['dn']]=convert_department_dn2($value['dn'])." - [".$value["description"][0]."]"; + }else{ + $this->departments[$value['dn']]=$value["description"][0]; + } + } + + /* END NEW LIST MANAGMENT + */ + + $res= get_list($this->ui->subtreeACL, "(objectClass=organizationalUnit)", FALSE, $base, array("cn","description","objectClass"),TRUE); diff --git a/plugins/admin/fai/class_faiPartitionTable.inc b/plugins/admin/fai/class_faiPartitionTable.inc index 8cedb0f16..3c83b3484 100644 --- a/plugins/admin/fai/class_faiPartitionTable.inc +++ b/plugins/admin/fai/class_faiPartitionTable.inc @@ -370,6 +370,9 @@ class faiPartitionTable extends plugin } } + if((!isset($partition['FAImountPoint']))||(empty($partition['FAImountPoint']))){ + $partition_attrs['FAImountPoint']="swap"; + } if(($partition['status'] == "delete")&&($disk['status']!="new")){ $ldap->cd($partition_dn); diff --git a/plugins/admin/fai/class_faiPartitionTableEntry.inc b/plugins/admin/fai/class_faiPartitionTableEntry.inc index 278b498f6..e8db4d5e4 100644 --- a/plugins/admin/fai/class_faiPartitionTableEntry.inc +++ b/plugins/admin/fai/class_faiPartitionTableEntry.inc @@ -311,19 +311,23 @@ class faiPartitionTableEntry extends plugin foreach($this->partitions as $key => $part){ - if(in_array($part['FAImountPoint'],$alreadyUsed['FAImountPoint'])){ + if((in_array($part['FAImountPoint'],$alreadyUsed['FAImountPoint']))&&($part['FAIfsType']!="swap")){ $message[]=sprintf(_("please enter a unique mount point for partition %s"),($key)); } - if((empty($part['FAImountPoint']))||(!((preg_match("/^\/.*/",$part['FAImountPoint']))||(preg_match("/^swap$/",$part['FAImountPoint']))))){ - $message[]=sprintf(_("Please enter a valid mount point for partition %s." ),($key)); + if($part['FAIfsType']!="swap"){ + if((empty($part['FAImountPoint']))||(!((preg_match("/^\/.*/",$part['FAImountPoint']))||(preg_match("/^swap$/",$part['FAImountPoint']))))){ + $message[]=sprintf(_("Please enter a valid mount point for partition %s." ),($key)); + } } - if($part['FAIfsType'] == "swap"){ if(in_array($part['FAIfsType'],$alreadyUsed['FAIfsType'])){ $message[]=sprintf(_("File system type 'swap' is already used, change file system type for partition %s."),$key); } } + if(($part['FAIfsType'] == "swap")&&(!empty($part['FAImountPoint']))&&($part['FAImountPoint']!="swap")){ + $message[]=_("Please use 'swap' as mount point, if 'swap' is used as fs-type."); + } $tmp = split("-",$part['FAIpartitionSize']); switch (count($tmp)){ diff --git a/plugins/admin/fai/tabsHook.inc b/plugins/admin/fai/tabsHook.inc index f438f8236..1a434eadd 100644 --- a/plugins/admin/fai/tabsHook.inc +++ b/plugins/admin/fai/tabsHook.inc @@ -19,7 +19,7 @@ class tabsHook extends tabs { $baseobject= $this->by_object['faiHook']; - $new_dn= 'cn='.$baseobject->cn.",ou=hooks,ou=fai,ou=configs,ou=systems,".$_SESSION['config']->current['BASE']; + $new_dn= 'cn='.$baseobject->cn.",ou=hooks,ou=fai,ou=configs,ou=systems,".$_SESSION['faifilter']['base']; if ($this->dn != $new_dn && $this->dn != "new"){ diff --git a/plugins/admin/fai/tabsPackage.inc b/plugins/admin/fai/tabsPackage.inc index fdb1cb505..c91455548 100644 --- a/plugins/admin/fai/tabsPackage.inc +++ b/plugins/admin/fai/tabsPackage.inc @@ -19,7 +19,7 @@ class tabsPackage extends tabs { $baseobject= $this->by_object['faiPackage']; - $new_dn= 'cn='.$baseobject->cn.",ou=packages,ou=fai,ou=configs,ou=systems,".$_SESSION['config']->current['BASE']; + $new_dn= 'cn='.$baseobject->cn.",ou=packages,ou=fai,ou=configs,ou=systems,".$_SESSION['faifilter']['base']; if ($this->dn != $new_dn && $this->dn != "new"){ diff --git a/plugins/admin/fai/tabsPartition.inc b/plugins/admin/fai/tabsPartition.inc index d61396d67..df8327117 100644 --- a/plugins/admin/fai/tabsPartition.inc +++ b/plugins/admin/fai/tabsPartition.inc @@ -20,7 +20,7 @@ class tabsPartition extends tabs $baseobject= $this->by_object['faiPartitionTable']; // cn=FAIBASE,ou=disk,ou=fai,ou=configs,ou=systems,dc=gonicus,dc=de - $new_dn= 'cn='.$baseobject->cn.",ou=disk,ou=fai,ou=configs,ou=systems,".$_SESSION['config']->current['BASE']; + $new_dn= 'cn='.$baseobject->cn.",ou=disk,ou=fai,ou=configs,ou=systems,".$_SESSION['faifilter']['base']; // Old .. $new_dn= 'ou='.$baseobject->ou.','.$baseobject->base; diff --git a/plugins/admin/fai/tabsProfile.inc b/plugins/admin/fai/tabsProfile.inc index 97dcdb073..bb42efeb9 100644 --- a/plugins/admin/fai/tabsProfile.inc +++ b/plugins/admin/fai/tabsProfile.inc @@ -19,7 +19,7 @@ class tabsProfile extends tabs { $baseobject= $this->by_object['faiProfile']; - $new_dn= 'cn='.$baseobject->cn.",ou=profiles,ou=fai,ou=configs,ou=systems,".$_SESSION['config']->current['BASE']; + $new_dn= 'cn='.$baseobject->cn.",ou=profiles,ou=fai,ou=configs,ou=systems,".$_SESSION['faifilter']['base']; if ($this->dn != $new_dn && $this->dn != "new"){ diff --git a/plugins/admin/fai/tabsScript.inc b/plugins/admin/fai/tabsScript.inc index cb6dcf302..b9a63d34b 100644 --- a/plugins/admin/fai/tabsScript.inc +++ b/plugins/admin/fai/tabsScript.inc @@ -19,7 +19,7 @@ class tabsScript extends tabs { $baseobject= $this->by_object['faiScript']; - $new_dn= 'cn='.$baseobject->cn.",ou=scripts,ou=fai,ou=configs,ou=systems,".$_SESSION['config']->current['BASE']; + $new_dn= 'cn='.$baseobject->cn.",ou=scripts,ou=fai,ou=configs,ou=systems,".$_SESSION['faifilter']['base']; if ($this->dn != $new_dn && $this->dn != "new"){ diff --git a/plugins/admin/fai/tabsTemplate.inc b/plugins/admin/fai/tabsTemplate.inc index ada68ce91..cc49f0ce6 100644 --- a/plugins/admin/fai/tabsTemplate.inc +++ b/plugins/admin/fai/tabsTemplate.inc @@ -19,7 +19,7 @@ class tabsTemplate extends tabs { $baseobject= $this->by_object['faiTemplate']; - $new_dn= 'cn='.$baseobject->cn.",ou=templates,ou=fai,ou=configs,ou=systems,".$_SESSION['config']->current['BASE']; + $new_dn= 'cn='.$baseobject->cn.",ou=templates,ou=fai,ou=configs,ou=systems,".$_SESSION['faifilter']['base']; if ($this->dn != $new_dn && $this->dn != "new"){ diff --git a/plugins/admin/fai/tabsVariable.inc b/plugins/admin/fai/tabsVariable.inc index 86a8851f0..81e2baccc 100644 --- a/plugins/admin/fai/tabsVariable.inc +++ b/plugins/admin/fai/tabsVariable.inc @@ -19,7 +19,7 @@ class tabsVariable extends tabs { $baseobject= $this->by_object['faiVariable']; - $new_dn= 'cn='.$baseobject->cn.",ou=variables,ou=fai,ou=configs,ou=systems,".$_SESSION['config']->current['BASE']; + $new_dn= 'cn='.$baseobject->cn.",ou=variables,ou=fai,ou=configs,ou=systems,".$_SESSION['faifilter']['base']; if ($this->dn != $new_dn && $this->dn != "new"){