Code

Current base will be used to create new entries
authorhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Tue, 2 Aug 2005 07:24:19 +0000 (07:24 +0000)
committerhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Tue, 2 Aug 2005 07:24:19 +0000 (07:24 +0000)
git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@1041 594d385d-05f5-0310-b6e9-bd551577e9d8

plugins/admin/applications/class_applicationGeneric.inc
plugins/admin/departments/class_departmentGeneric.inc
plugins/gofax/blocklists/class_blocklistManagement.inc
plugins/gofon/macro/class_gofonMacro.inc

index 8ef8bb24e0d53f0d4e88025103fb85007ea8a96f..351d6e458cb1234aa8183e055ddd26173d6a8903 100644 (file)
@@ -44,8 +44,12 @@ class application extends plugin
        $this->is_account= TRUE;
 
        if ($this->dn == "new"){
-               $ui= get_userinfo();
-               $this->base= dn2base($ui->dn);
+               if(isset($_SESSION['appfilter']['depselect'])){
+                       $this->base=$_SESSION['appfilter']['depselect'];
+               }else{
+                       $ui= get_userinfo();
+                       $this->base= dn2base($ui->dn);
+               }
        } else {
                $this->base= preg_replace ("/^[^,]+,[^,]+,/", "", $this->dn);
        }
index 243d1e921c3c7ee8845a759f27388bead2f8ce86..d7f709f807c0bba378e15205cedf535a838916bd 100644 (file)
@@ -51,7 +51,7 @@ class department extends plugin
        $this->config= $config;
 
        /* Set base */
-        if ($this->dn == "new"){
+    if ($this->dn == "new"){
                $ui= get_userinfo();
                if(isset($_SESSION['depfilter']['depselect'])){
                        $this->base = $_SESSION['depfilter']['depselect'];
index bc42936f2e5eb81f2c1a6ed9c811c2741e05760c..bd8f9a7a8359d645b0c869fb206a45e298fbb17c 100644 (file)
@@ -32,7 +32,8 @@ class blocklist extends plugin
 
     /* Get global filter config */
     if (!is_global("blockfilter")){
-      $ui= get_userinfo();
+      print_a($_SESSION['blocklist']);
+      $uii= get_userinfo();
       $base= get_base_from_people($ui->dn);
       $blockfilter= array("sendlists" => "checked",
           "receivelists" => "checked",
@@ -40,8 +41,10 @@ class blocklist extends plugin
           "depselect" => $base,
           "regex" => "*");
       register_global("blockfilter", $blockfilter);
+    }else{
+      $blockfilter = $_SESSION["blockfilter"];
+      $this->base = $blockfilter['depselect'];
     }
-
   }
 
   function execute()
@@ -361,7 +364,7 @@ class blocklist extends plugin
 
     /* Fill templating stuff */
     $smarty->assign("bases", $this->config->idepartments);
-    $smarty->assign("base_select", $this->base);
+    $smarty->assign("base_select", $_SESSION['blockfilter']['depselect']);//$this->base);
     $smarty->assign("types", array(0 => _("send"), 1 => _("receive")));
     if ($this->dn == "new" || preg_match ("/,ou=incoming,/", $this->dn)){
       $smarty->assign("selectmode", "");
index 0db4da659d311fea3a417e217f69144c7f9e673d..7be9c1a28ece66aab2b5397810030c1eb455aad3 100755 (executable)
@@ -42,7 +42,7 @@ class macro extends plugin
   var $attributes     = array("cn","base", "description","displayName","goFonMacroContent","goFonMacroVisible");
 
   var $is_new=false;
-  
+  var $orig_cn = ""; 
   /*! Objectclasses that this calls handles */
   var $objectclasses  = array("top", "goFonMacro");
 
@@ -62,9 +62,14 @@ class macro extends plugin
 
     /* Edit or new one ?*/
     if ($this->dn == "new"){
-      $this->is_new = true;
-      $ui= get_userinfo();
-      $this->base= dn2base($ui->dn);
+      if(isset($_SESSION['macrofilter']['depselect'])){
+        $this->base = $_SESSION['macrofilter']['depselect'];
+        $this->is_new = true;
+      }else{
+        $this->is_new = true;
+        $ui= get_userinfo();
+        $this->base= dn2base($ui->dn);
+      }
     } else {
       $this->is_new = false;
       $this->orig_cn=$this->cn;
@@ -120,7 +125,7 @@ class macro extends plugin
       $smarty->assign("cn",$this->orig_cn);
     }else{
       $smarty->assign("disable_cn","  ");
-      $smarty->assign("cn","");
+      $smarty->assign("cn",$this->cn);
     }
     $this->generate_mysql_entension_entries();
     /* Show main page */
@@ -194,7 +199,7 @@ class macro extends plugin
     $context  = "macro-".$this->cn;
 
     // Parse Content if we connected correctly
-    if($db &&  $r_con && $save){
+    if($db &&  $r_con ){
 
       // Split Content into lines 
       $a_contentLines = split ("\n",$this->goFonMacroContent);
@@ -224,20 +229,20 @@ class macro extends plugin
           $tmp  = split(",", preg_replace("/\(.*$/","",$linecontents));
   
           if(!isset($tmp[2])){
-            print_red(sprintf(_("Unable to parse macro contents on line: %s"),$i_linenum));
+            $this->generate_error = sprintf(_("Unable to parse macro contents on line: %s"),$i_linenum);
+            return false;
           }    
-      
-          $exten = $tmp[0];
-          $prio = $tmp[1];
-          $app  = $tmp[2];
-          $para = $linecontents; 
-          $para = preg_replace("/^.*\(/","",$para);
-          $para = preg_replace("/\)$/","",$para);
-
-          // Append SQL syntax
-          $SQL[$i_linenum].="'".$context."','".$exten."','".$prio."','".$app."','".$para."');";
+            $exten = $tmp[0];
+            $prio = $tmp[1];
+            $app  = $tmp[2];
+            $para = $linecontents; 
+            $para = preg_replace("/^.*\(/","",$para);
+            $para = preg_replace("/\)$/","",$para);
+
+            // Append SQL syntax
+            $SQL[$i_linenum].="'".$context."','".$exten."','".$prio."','".$app."','".$para."');";
         }
-      }
+     }
 
       if(($save)||($delete_only)){
         $res = mysql_query("SELECT count(*) FROM ".$a_SETUP['EXT_TABLE']." WHERE context= '".$context."'");
@@ -270,7 +275,7 @@ class macro extends plugin
       }
 
       // We want to save this 
-      if($save){
+      if(($save)&&(isset($SQL))){
         foreach($SQL as $entry){
           if(!mysql_query($entry)){
             $this->generate_error = sprintf(_("Can't perform INSERT query in DB '%s'"),$a_SETUP['DB']);