From: hickert Date: Tue, 11 Apr 2006 05:19:28 +0000 (+0000) Subject: Global Base X-Git-Url: https://git.tokkee.org/?a=commitdiff_plain;h=584c4ac82a374aa05189053b06eff066da1e2881;p=gosa.git Global Base git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@3021 594d385d-05f5-0310-b6e9-bd551577e9d8 --- diff --git a/plugins/admin/fai/class_askClassName.inc b/plugins/admin/fai/class_askClassName.inc index df59a0f97..afae3ad90 100644 --- a/plugins/admin/fai/class_askClassName.inc +++ b/plugins/admin/fai/class_askClassName.inc @@ -22,6 +22,9 @@ class askClassName extends plugin $this->ui = $ui; $this->objectClass = $objectClass; plugin::plugin ($config, $dn); + if(!isset($_SESSION['CurrentMainBase'])){ + $_SESSION['CurrentMainBase'] = $this->config->current['BASE']; + } } function execute() @@ -42,7 +45,7 @@ class askClassName extends plugin * With a second search detect all object that belong to the different ous. */ - $base = "ou=fai,ou=configs,ou=systems,".$faifilter['base']; + $base = "ou=fai,ou=configs,ou=systems,".$_SESSION['CurrentMainBase']; if($faifilter['branch'] != "main"){ $base = $faifilter['branch']; } diff --git a/plugins/admin/fai/class_faiManagement.inc b/plugins/admin/fai/class_faiManagement.inc index 7852b06fd..df5c0465e 100644 --- a/plugins/admin/fai/class_faiManagement.inc +++ b/plugins/admin/fai/class_faiManagement.inc @@ -74,8 +74,7 @@ class faiManagement extends plugin /* Get global filter config */ if (!is_global("faifilter")){ - $base = get_base_from_people($ui->dn); - $faifilter= array("base" => $base, + $faifilter= array( "regex" => "*","branch" => "main"); $faifilter['ShowProfiles'] = true; $faifilter['ShowTemplates'] = true; @@ -173,29 +172,28 @@ class faiManagement extends plugin } if($s_action=="root"){ - $faifilter['base']=($this->config->current['BASE']); + $_SESSION['CurrentMainBase']=($this->config->current['BASE']); } if($s_action=="home"){ - $faifilter['base']= get_base_from_people($this->ui->dn); - //$faifilter['base']=(preg_replace("/^[^,]+,/","",$faifilter['base'])); + $_SESSION['CurrentMainBase']= get_base_from_people($this->ui->dn); } if($s_action=="back"){ - $base_back = preg_replace("/^[^,]+,/","",$faifilter['base']); + $base_back = preg_replace("/^[^,]+,/","",$_SESSION['CurrentMainBase']); $base_back = convert_department_dn($base_back); if(isset($this->config->departments[trim($base_back)])){ - $faifilter['base']= $this->config->departments[trim($base_back)]; + $_SESSION['CurrentMainBase']= $this->config->departments[trim($base_back)]; }else{ - $faifilter['base']= $this->config->departments["/"]; + $_SESSION['CurrentMainBase']= $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)]; + $_SESSION['CurrentMainBase']= $this->config->departments[trim($s_entry)]; } if(isset($_GET['edit_entry'])){ @@ -317,7 +315,7 @@ class faiManagement extends plugin $base= $faifilter['branch']; /* Load permissions for selected 'dn' and check if we're allowed to remove this 'dn' */ - $acl= get_permissions ($faifilter['base'], $this->ui->subtreeACL); + $acl= get_permissions ($_SESSION['CurrentMainBase'], $this->ui->subtreeACL); $this->acl= get_module_permission($acl, "FAIclass", $base); if (chkacl($this->acl, "delete") == ""){ $smarty->assign("info", sprintf(_("You're about to delete a fai branch / freeze '%s'."), $faifilter['branch'])); @@ -374,7 +372,7 @@ class faiManagement extends plugin $smarty->assign("BranchName",$name); - $base= "ou=fai,ou=configs,ou=systems,".$faifilter['base']; + $base= "ou=fai,ou=configs,ou=systems,".$_SESSION['CurrentMainBase']; /* Check used characters */ if(preg_match("/[^0-9a-z \ö\ä\ü\.-_:,]/i",$name)){ @@ -542,10 +540,10 @@ class faiManagement extends plugin /* Department select */ if((isset($_POST['base']))&&($s_action=="")){ - $faifilter['base']=$_POST['base']; + $_SESSION['CurrentMainBase']=$_POST['base']; } - $base= "ou=fai,ou=configs,ou=systems,".$faifilter['base']; + $base= "ou=fai,ou=configs,ou=systems,".$_SESSION['CurrentMainBase']; $br = $this->getBranches($base); if(!isset($br[$faifilter['branch']])){ @@ -624,7 +622,7 @@ class faiManagement extends plugin /* Prepare departments */ $options= ""; foreach ($this->config->idepartments as $key => $value){ - if ($faifilter['base'] == $key){ + if ($_SESSION['CurrentMainBase'] == $key){ $options.= ""; } else { $options.= ""; @@ -857,7 +855,7 @@ class faiManagement extends plugin if(!$base){ - $base= "ou=fai,ou=configs,ou=systems,".$faifilter['base']; + $base= "ou=fai,ou=configs,ou=systems,".$_SESSION['CurrentMainBase']; } $ldap->cd($base); $ldap->ls("(objectClass=FAIbranch)",$base); @@ -882,7 +880,7 @@ class faiManagement extends plugin // Added for dirlist function... /* Set base for all searches */ - $base= "ou=fai,ou=configs,ou=systems,".$faifilter['base']; + $base= "ou=fai,ou=configs,ou=systems,".$_SESSION['CurrentMainBase']; if($faifilter['branch'] !="main"){ $base = $faifilter['branch']; @@ -899,7 +897,7 @@ class faiManagement extends plugin * We also need to search for the departments * So we are able to navigate like in konquerer */ - $base2 = $faifilter['base']; + $base2 = $_SESSION['CurrentMainBase']; $res3 = get_list2($this->ui->subtreeACL, "(&(|(ou=$regex)(description=$regex))(objectClass=gosaDepartment))", TRUE, $base2, array("ou", "description"), TRUE); @@ -1040,7 +1038,7 @@ class faiManagement extends plugin } if($f == "main"){ - $f = $_SESSION['faifilter']['base']; + $f = $_SESSION['CurrentMainBase']; } if(in_array($name,$this->getBranches($f))) { diff --git a/plugins/admin/fai/class_faiPackage.inc b/plugins/admin/fai/class_faiPackage.inc index 8d7f326b6..2e30084b7 100644 --- a/plugins/admin/fai/class_faiPackage.inc +++ b/plugins/admin/fai/class_faiPackage.inc @@ -57,10 +57,10 @@ class faiPackage extends plugin var $FAIstate = ""; var $FAIinstallMethods = array( "install", "ninstall", "remove", - "dselect-upgrade", "taskinst", "taskrm", - "hold", "clean", "aptitude", "aptitude-r", - "pending", "dpkgc" ); - + "dselect-upgrade", "taskinst", "taskrm", + "hold", "clean", "aptitude", "aptitude-r", + "pending", "dpkgc" ); + function faiPackage ($config, $dn= NULL) { @@ -99,12 +99,12 @@ class faiPackage extends plugin }else{ $this->usedPackages = array(); } - + $ldap = $this->config->get_ldap_link(); foreach($this->usedPackages as $name){ $ldap->search("(&(objectClass=FAIdebconfInfo)(FAIpackage=".$name."))",array("FAIvariable","FAIvariableType","FAIvariableContent","FAIpackage","FAIdebianSection","")); while($attr = $ldap->fetch()){ - + $tmp =array(); $tmp['Name'] = $attr['FAIvariable'][0]; $tmp['Type'] = $attr['FAIvariableType'][0]; @@ -146,13 +146,18 @@ class faiPackage extends plugin $methods[$method] = $method; } $this->FAIinstallMethods = $methods; + /* Check if we exist already - no need to ask for revisions, etc. then */ + if ($this->dn != "new"){ + $this->newDialogShown= true; + } + } function execute() { - /* Call parent execute */ + /* Call parent execute */ - plugin::execute(); + plugin::execute(); /* Fill templating stuff */ $smarty= get_smarty(); @@ -160,13 +165,8 @@ class faiPackage extends plugin $smarty->assign( "FAIinstallMethods", $this->FAIinstallMethods ); - /* Check if we exist already - no need to ask for revisions, etc. then */ - if ($this->dn != "new"){ - $this->newDialogShown= true; - } - if((!$this->is_account)&&(!$this->newDialogShown)){ - + if($this->dialog==NULL){ $this->dialog = new faiPackageNew($this->config, $this->dn,$this->mirrors,$this->servers,$this->sections,$this->releases); $this->is_dialog =true; @@ -178,14 +178,15 @@ class faiPackage extends plugin /* Assign Repository settings*/ if(isset($_POST['SaveObjectNew'])){ $obj = $this->dialog->save(); - + $this->FAIdebianSection = $obj['FAIdebianSection']; $this->FAIdebianRelease = $obj['FAIdebianRelease']; - + unset($this->dialog); - $this->dialog = false; - $this->is_dialog=false; + $this->dialog = false; + $this->is_dialog = false; $this->newDialogShown = true; + $this->is_account = true; } /* Draw dialog */ @@ -199,7 +200,7 @@ class faiPackage extends plugin foreach($this->attributes as $attrs){ $smarty->assign($attrs,$this->$attrs); } - + /* Generate package list */ $this->list=$this->genPkgs(); @@ -252,16 +253,16 @@ class faiPackage extends plugin $path = "/etc/gosa/fai/".$this->FAIdebianRelease."/debconf.d"; $pkg_config = array(); $pkg = $_POST['usedPackages'][0]; - + if(isset($this->ConfiguredPackages[$pkg])){ $pkg_config = $this->ConfiguredPackages[$pkg]; } - + $this->dialog = new faiPackageConfiguration($this->config, $this->dn,$pkg, $path, $pkg_config); $this->dialog ->acl = $this->acl; $this->is_dialog =true; } - + /* Save Configuration */ if(isset($_POST['SaveObjectConfig'])){ if($this->FAIstate != "freeze"){ @@ -285,7 +286,7 @@ class faiPackage extends plugin /* Assign section to smarty */ $strsec = ""; foreach($this->FAIdebianSection as $sec){ - $strsec .= $sec." "; + $strsec .= $sec." "; } foreach($this->attributes as $attr){ @@ -318,10 +319,10 @@ class faiPackage extends plugin */ function save_object() { - + if($this->FAIstate == "freeze") return; plugin::save_object(); - + foreach($this->attributes as $attrs){ if(isset($_POST[$attrs])){ @@ -336,11 +337,11 @@ class faiPackage extends plugin { /* Call common method to give check the hook */ $message= plugin::check(); - + if(count($this->usedPackages)==0){ $message[]=_("Please select a least one Package."); } - + if((empty($this->FAIdebianRelease))||(empty($this->FAIdebianSection))){ $message[]=_("Please choose a valid combination for your repository setup."); } @@ -352,20 +353,20 @@ class faiPackage extends plugin $a_ret=array(); if(is_array($this->usedPackages)) { foreach($this->usedPackages as $usedName){ - + $config = 0; - + foreach($this->ConfiguredPackages as $name => $value){ if($name == $usedName){ $config ++; } } - + $c_str =""; if($config){ $c_str = " - "._("package is configured"); } - + if(isset($this->list[$usedName][1])){ $a_ret[$usedName] = $usedName." [".$this->list[$usedName][1]."]".$c_str; }else{ @@ -376,7 +377,7 @@ class faiPackage extends plugin return($a_ret); } - function genPkgs(){ + function genPkgs(){ /* Generate a list off available packages for this mirror, section and release */ /* Only read this file if it wasn't read before */ @@ -385,7 +386,7 @@ class faiPackage extends plugin $a_ret = array(); foreach($this->FAIdebianSection as $sec){ $strID= "/etc/gosa/fai/".$this->FAIdebianRelease."/".$sec; - + if(!is_file($strID)){ print_red(sprintf(_("Package file '%s' does not exist."),$strID)); unset($this->buffer); @@ -402,7 +403,7 @@ class faiPackage extends plugin } } fclose($fp); - /* Save our Data, to avoid reading it again */ + /* Save our Data, to avoid reading it again */ } $this->buffer = $a_ret; ksort($a_ret); @@ -417,27 +418,27 @@ class faiPackage extends plugin function save() { plugin::save(); - + $ldap = $this->config->get_ldap_link(); $this->attrs['FAIpackage'] = array(); foreach($this->usedPackages as $pkg => $obj){ $this->attrs['FAIpackage'][] = $pkg; } - + $this->attrs['FAIdebianSection'] = array(); foreach($this->FAIdebianSection as $sec){ $this->attrs['FAIdebianSection'][] = $sec; } -// $this->attrs["FAIinstallMethod"]= "aptitude"; + // $this->attrs["FAIinstallMethod"]= "aptitude"; $ldap->cat($this->dn); if($ldap->count()!=0){ /* Write FAIscript to ldap*/ $ldap->cd($this->dn); $this->cleanup(); -$ldap->modify ($this->attrs); + $ldap->modify ($this->attrs); }else{ /* Write FAIscript to ldap*/ @@ -448,7 +449,7 @@ $ldap->modify ($this->attrs); } show_ldap_error($ldap->get_error()); - /* Save Package configurations */ + /* Save Package configurations */ foreach($this->ConfiguredPackages as $pkgname => $attrs){ foreach($attrs as $name => $attr){ @@ -469,7 +470,7 @@ $ldap->modify ($this->attrs); if($ldap->count()!=0){ $ldap->cd($pkgdn); $this->cleanup(); -$ldap->modify ($pkgattrs); + $ldap->modify ($pkgattrs); }else{ $ldap->cd($this->config->current['BASE']); @@ -482,7 +483,7 @@ $ldap->modify ($pkgattrs); } - + } } diff --git a/plugins/admin/fai/class_faiProfile.inc b/plugins/admin/fai/class_faiProfile.inc index 373a8147a..2afb1e596 100644 --- a/plugins/admin/fai/class_faiProfile.inc +++ b/plugins/admin/fai/class_faiProfile.inc @@ -78,7 +78,7 @@ class faiProfile extends plugin } /* Get ldap connection */ - $base = $_SESSION['faifilter']['base']; + $base = $_SESSION['CurrentMainBase']; $ldap->cd($base); $sort = array(); @@ -387,7 +387,7 @@ class faiProfile extends plugin } $ldap = $this->config->get_ldap_link(); - $ldap->cd($_SESSION['faifilter']['base']); + $ldap->cd($_SESSION['CurrentMainBase']); $ldap->search("(&(objectClass=FAIprofile)(cn=".$this->cn.")(!cn=".$this->old_cn."))",array("*")); if($ldap->count()){ diff --git a/plugins/admin/fai/class_faiProfileEntry.inc b/plugins/admin/fai/class_faiProfileEntry.inc index dcda988af..3729141b8 100644 --- a/plugins/admin/fai/class_faiProfileEntry.inc +++ b/plugins/admin/fai/class_faiProfileEntry.inc @@ -20,7 +20,7 @@ class faiProfileEntry extends plugin plugin::plugin ($config, $dn); /* Search only in fai tree */ - $base = "ou=fai,ou=configs,ou=systems,".$_SESSION['faifilter']['base']; + $base = "ou=fai,ou=configs,ou=systems,".$_SESSION['CurrentMainBase']; /* Create array with categories to be able to sort different types of objects */ $categories = array("FAIscript","FAItemplate","FAIhook","FAIvariable","FAIpartitionTable","FAIpackageList"); @@ -61,7 +61,7 @@ class faiProfileEntry extends plugin /* If no search filter is set, create one */ if (!is_global("SUBfaifilter")){ - $SUBfaifilter= array("base" => "ou=fai,ou=configs,ou=systems,".$base, "Sregex" => "*"); + $SUBfaifilter= array("base" => "ou=fai,ou=configs,ou=systems,".$_SESSION['CurrentMainBase'], "Sregex" => "*"); $SUBfaifilter['SShowTemplates'] = true; $SUBfaifilter['SShowScripts'] = true; $SUBfaifilter['SShowHooks'] = true; diff --git a/plugins/admin/fai/tabsHook.inc b/plugins/admin/fai/tabsHook.inc index cae153ef2..c16313fe2 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['faifilter']['base']; + $new_dn= 'cn='.$baseobject->cn.",ou=hooks,ou=fai,ou=configs,ou=systems,".$_SESSION['CurrentMainBase']; if($_SESSION['faifilter']['branch']!="main"){ $new_dn ='cn='.$baseobject->cn.",ou=hooks,".$_SESSION['faifilter']['branch']; diff --git a/plugins/admin/fai/tabsPackage.inc b/plugins/admin/fai/tabsPackage.inc index 1ac6ab563..21b2fb48b 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['faifilter']['base']; + $new_dn= 'cn='.$baseobject->cn.",ou=packages,ou=fai,ou=configs,ou=systems,".$_SESSION['CurrentMainBase']; if($_SESSION['faifilter']['branch']!="main"){ $new_dn ='cn='.$baseobject->cn.",ou=packages,".$_SESSION['faifilter']['branch']; } diff --git a/plugins/admin/fai/tabsPartition.inc b/plugins/admin/fai/tabsPartition.inc index c8c622210..c18779abe 100644 --- a/plugins/admin/fai/tabsPartition.inc +++ b/plugins/admin/fai/tabsPartition.inc @@ -19,7 +19,7 @@ class tabsPartition extends tabs { $baseobject= $this->by_object['faiPartitionTable']; - $new_dn= 'cn='.$baseobject->cn.",ou=disk,ou=fai,ou=configs,ou=systems,".$_SESSION['faifilter']['base']; + $new_dn= 'cn='.$baseobject->cn.",ou=disk,ou=fai,ou=configs,ou=systems,".$_SESSION['CurrentMainBase']; if($_SESSION['faifilter']['branch']!="main"){ $new_dn ='cn='.$baseobject->cn.",ou=disk,".$_SESSION['faifilter']['branch']; diff --git a/plugins/admin/fai/tabsProfile.inc b/plugins/admin/fai/tabsProfile.inc index 599f6772c..3131a1dbe 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['faifilter']['base']; + $new_dn= 'cn='.$baseobject->cn.",ou=profiles,ou=fai,ou=configs,ou=systems,".$_SESSION['CurrentMainBase']; if($_SESSION['faifilter']['branch']!="main"){ $new_dn ='cn='.$baseobject->cn.",ou=profiles,".$_SESSION['faifilter']['branch']; diff --git a/plugins/admin/fai/tabsScript.inc b/plugins/admin/fai/tabsScript.inc index f85bde587..22a34d2c9 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['faifilter']['base']; + $new_dn= 'cn='.$baseobject->cn.",ou=scripts,ou=fai,ou=configs,ou=systems,".$_SESSION['CurrentMainBase']; if($_SESSION['faifilter']['branch']!="main"){ $new_dn ='cn='.$baseobject->cn.",ou=scripts,".$_SESSION['faifilter']['branch']; diff --git a/plugins/admin/fai/tabsTemplate.inc b/plugins/admin/fai/tabsTemplate.inc index 1363b09bc..28851dbaf 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['faifilter']['base']; + $new_dn= 'cn='.$baseobject->cn.",ou=templates,ou=fai,ou=configs,ou=systems,".$_SESSION['CurrentMainBase']; if($_SESSION['faifilter']['branch']!="main"){ $new_dn ='cn='.$baseobject->cn.",ou=templates,".$_SESSION['faifilter']['branch']; diff --git a/plugins/admin/fai/tabsVariable.inc b/plugins/admin/fai/tabsVariable.inc index b526884df..c41a7f78c 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['faifilter']['base']; + $new_dn= 'cn='.$baseobject->cn.",ou=variables,ou=fai,ou=configs,ou=systems,".$_SESSION['CurrentMainBase']; if($_SESSION['faifilter']['branch']!="main"){ $new_dn ='cn='.$baseobject->cn.",ou=variables,".$_SESSION['faifilter']['branch'];