Code

Global Base
authorhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Tue, 11 Apr 2006 05:19:28 +0000 (05:19 +0000)
committerhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Tue, 11 Apr 2006 05:19:28 +0000 (05:19 +0000)
git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@3021 594d385d-05f5-0310-b6e9-bd551577e9d8

12 files changed:
plugins/admin/fai/class_askClassName.inc
plugins/admin/fai/class_faiManagement.inc
plugins/admin/fai/class_faiPackage.inc
plugins/admin/fai/class_faiProfile.inc
plugins/admin/fai/class_faiProfileEntry.inc
plugins/admin/fai/tabsHook.inc
plugins/admin/fai/tabsPackage.inc
plugins/admin/fai/tabsPartition.inc
plugins/admin/fai/tabsProfile.inc
plugins/admin/fai/tabsScript.inc
plugins/admin/fai/tabsTemplate.inc
plugins/admin/fai/tabsVariable.inc

index df59a0f97ea34a1320967588e22ab3e1a6075d0b..afae3ad9047ef83199c6ac052835b0875cd8abf9 100644 (file)
@@ -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'];
     }
index 7852b06fd88dc27ab109c4068590336cf2874951..df5c0465e2de71b259087a780f7b0903285dcbb3 100644 (file)
@@ -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.= "<option selected='selected' value='$key'>$value</option>";
                        } else {
                                $options.= "<option value='$key'>$value</option>";
@@ -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))) {
index 8d7f326b6e30317c570c434cb43810c9278148b6..2e30084b7e5ae67c05f41466ec2177bb96eac2f3 100644 (file)
@@ -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);
     }
 
 
-    
+
 
   }
 }
index 373a8147a39159d0bd1fe05a3f0ca3f938a99319..2afb1e596a85c6dde715c32a05502e9fbee04f5f 100644 (file)
@@ -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()){
index dcda988af192eb197be0ba4b731c951293d61425..3729141b80d197f34de51cbec317eb935df0a277 100644 (file)
@@ -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;
index cae153ef2956f11b8b608cc5340836421dc4bfec..c16313fe22f23de96f3554959d8533c68e7f7293 100644 (file)
@@ -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'];
index 1ac6ab563ba4c6ce83c24d59368016263676c10f..21b2fb48bd299c8d753b0d6d844fff0d1d55c19a 100644 (file)
@@ -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'];
        }
index c8c622210a3a32364b811e4ec7ccc14e376be2a7..c18779abe68b661eecf0b171680ee804a4efba94 100644 (file)
@@ -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'];
index 599f6772c877714dec37fa5b77a2ab664bb5af3c..3131a1dbe63c4c791e5802e7e86107e11b2c3ab0 100644 (file)
@@ -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'];
index f85bde58798775f5cfcbd5aea1bab1ef0d0c8628..22a34d2c9690ceac786eca76a8caa68a85773dc6 100644 (file)
@@ -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'];
index 1363b09bc873bb5612f81e65cde9209046490e29..28851dbaf6f0b45d6fcced868a68ba6fa0bfe052 100644 (file)
@@ -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'];
index b526884dfee468993c1b30d85884f1d672ba275b..c41a7f78c307c4fe012b238f00a7df70b3df376b 100644 (file)
@@ -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'];