From fd4ecb1e6be0350e66a1db2e4fcd68394fc2584b Mon Sep 17 00:00:00 2001 From: hickert Date: Tue, 11 Apr 2006 04:14:55 +0000 Subject: [PATCH] Global base git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@3019 594d385d-05f5-0310-b6e9-bd551577e9d8 --- plugins/gofon/macro/class_gofonMacro.inc | 6 +-- .../macro/class_gofonMacroManagement.inc | 37 +++++++++++-------- 2 files changed, 25 insertions(+), 18 deletions(-) diff --git a/plugins/gofon/macro/class_gofonMacro.inc b/plugins/gofon/macro/class_gofonMacro.inc index c549a62c1..0e0d556c8 100755 --- a/plugins/gofon/macro/class_gofonMacro.inc +++ b/plugins/gofon/macro/class_gofonMacro.inc @@ -64,8 +64,8 @@ class macro extends plugin /* Edit or new one ?*/ if ($this->dn == "new"){ - if(isset($_SESSION['macrofilter']['depselect'])){ - $this->base = $_SESSION['macrofilter']['depselect']; + if(isset($_SESSION['CurrentMainBase'])){ + $this->base = $_SESSION['CurrentMainBase']; $this->is_new = true; }else{ $this->is_new = true; @@ -75,7 +75,7 @@ class macro extends plugin } else { $this->is_new = false; $this->orig_cn=$this->cn; - $this->base= dn2base($this->dn); + $this->base= preg_replace("/ou=macros,ou=asterisk,ou=configs,ou=systems,/","",dn2base($this->dn)); } $ui= get_userinfo(); $acl= get_permissions ($ui->dn, $ui->subtreeACL); diff --git a/plugins/gofon/macro/class_gofonMacroManagement.inc b/plugins/gofon/macro/class_gofonMacroManagement.inc index a88498d72..756803839 100755 --- a/plugins/gofon/macro/class_gofonMacroManagement.inc +++ b/plugins/gofon/macro/class_gofonMacroManagement.inc @@ -40,10 +40,14 @@ class gofonMacro extends plugin /* Get global filter config */ if (!is_global("macrofilter")){ $base= get_base_from_people($ui->dn); - $macrofilter= array("depselect" => $base, "regex" => "*"); + $macrofilter= array("regex" => "*"); register_global("macrofilter", $macrofilter); } + if(!isset($_SESSION['CurrentMainBase'])){ + $_SESSION['CurrentMainBase'] = $base= get_base_from_people($ui->dn); + } + $acl= get_permissions ($ui->dn, $ui->subtreeACL); $this->acl= get_module_permission($acl, "goFonMacro", $ui->dn); } @@ -55,7 +59,7 @@ class gofonMacro extends plugin /* Save data */ $macrofilter= get_global("macrofilter"); - foreach( array("depselect", "regex") as $type){ + foreach( array("regex") as $type){ if (isset($_POST[$type])){ $macrofilter[$type]= $_POST[$type]; } @@ -76,7 +80,8 @@ class gofonMacro extends plugin if(isset($_GET['act'])&&($_GET['act']=="dep_open")){ $s_action="open"; $s_entry = base64_decode($_GET['dep_id']); - $macrofilter['depselect']= "".$this->config->departments[trim($s_entry)]; + $_SESSION['CurrentMainBase'] = $this->config->departments[trim($s_entry)]; + } /* Test Posts */ @@ -111,30 +116,30 @@ class gofonMacro extends plugin $s_entry = preg_replace("/_.$/","",$s_entry); /* Department changed? */ - if(isset($_POST['depselect']) && $_POST['depselect']){ - $macrofilter['depselect']= $_POST['depselect']; + if(isset($_POST['CurrentMainBase']) && $_POST['CurrentMainBase']){ + $_SESSION['CurrentMainBase']= $_POST['CurrentMainBase']; } /* Homebutton is posted */ if($s_action=="home"){ - $macrofilter['depselect']=(preg_replace("/^[^,]+,/","",$this->ui->dn)); - $macrofilter['depselect']=(preg_replace("/^[^,]+,/","",$macrofilter['depselect'])); + $_SESSION['CurrentMainBase'] = preg_replace("/^[^,]+,/","",$this->ui->dn); + $_SESSION['CurrentMainBase'] = preg_replace("/^[^,]+,/","", $_SESSION['CurrentMainBase']); } if($s_action=="root"){ - $macrofilter['depselect']=($this->config->current['BASE']); + $_SESSION['CurrentMainBase'] = $this->config->current['BASE'] ; } /* If Backbutton is Posted */ if($s_action=="back"){ - $base_back = preg_replace("/^[^,]+,/","",$macrofilter['depselect']); + $base_back = preg_replace("/^[^,]+,/","", $_SESSION['CurrentMainBase']); $base_back = convert_department_dn($base_back); if(isset($this->config->departments[trim($base_back)])){ - $macrofilter['depselect']= $this->config->departments[trim($base_back)]; + $_SESSION['CurrentMainBase'] = $this->config->departments[trim($base_back)]; }else{ - $macrofilter['depselect']= $this->config->departments["/"]; + $_SESSION['CurrentMainBase'] = $this->config->departments["/"]; } } @@ -311,7 +316,7 @@ class gofonMacro extends plugin /* Prepare departments */ $options= ""; foreach ($this->config->idepartments as $key => $value){ - if ($macrofilter['depselect'] == $key){ + if ($_SESSION['CurrentMainBase'] == $key){ $options.= ""; } else { $options.= ""; @@ -328,7 +333,7 @@ class gofonMacro extends plugin "  ". "  ". "  ". - _("Base")." ". + _("Base")." ". "  ". ""; @@ -411,10 +416,12 @@ class gofonMacro extends plugin $smarty->assign("infoimage", get_template_path('images/info.png')); $smarty->assign("launchimage", get_template_path('images/launch.png')); $smarty->assign("deplist", $this->config->idepartments); - foreach( array("depselect", "regex") as $type){ + foreach( array("regex") as $type){ $smarty->assign("$type", $macrofilter[$type]); } + $smarty->assign("CurrentMainBase" , $_SESSION['CurrentMainBase']); + /* Extend if we are not using javascript */ $smarty->assign("apply", apply_filter()); $smarty->assign("alphabet", generate_alphabet()); @@ -430,7 +437,7 @@ class gofonMacro extends plugin $macrofilter= get_global('macrofilter'); /* Set base for all searches */ - $base= $macrofilter['depselect']; + $base= $_SESSION['CurrentMainBase']; /* Regex filter? */ if ($macrofilter['regex'] != ""){ -- 2.30.2