Code

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

plugins/gofon/macro/class_gofonMacro.inc
plugins/gofon/macro/class_gofonMacroManagement.inc

index c549a62c15fdee2aa99ca4a662f735b92b2b508e..0e0d556c81f3f47e335054b22cafaa9836db1795 100755 (executable)
@@ -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);
index a88498d72c1075afe2761161b4d67b2a2b51b91c..75680383939fc956bad49780b4aba1097bb7f429 100755 (executable)
@@ -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.= "<option selected='selected' value='$key'>$value</option>";
             } else {
                     $options.= "<option value='$key'>$value</option>";
@@ -328,7 +333,7 @@ class gofonMacro extends plugin
             " <img class='center' src='images/list_seperator.png' align='middle' alt='' height='16' width='1'>&nbsp;".
             " <input class='center' type='image' align='middle' src='images/list_new_macro.png' title='"._("Create new phone macro")."' alt='"._("New")."' name='user_new'>&nbsp;".
             " <img class='center' src='images/list_seperator.png' align='middle' alt='' height='16' width='1'>&nbsp;".
-            _("Base")."&nbsp;<select name='depselect' onChange='mainform.submit()' class='center'>$options</select>".
+            _("Base")."&nbsp;<select name='CurrentMainBase' onChange='mainform.submit()' class='center'>$options</select>".
             " <input class='center' type='image' src='images/list_submit.png' align='middle' title='"._("Submit department")."' name='submit_department' alt='"._("Submit")."'>&nbsp;".
             "</div>";
 
@@ -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'] != ""){