From d25d2c186d7b23f1c5d17fc844d43daebf42d1e6 Mon Sep 17 00:00:00 2001 From: hickert Date: Tue, 2 Aug 2005 07:24:19 +0000 Subject: [PATCH] Current base will be used to create new entries git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@1041 594d385d-05f5-0310-b6e9-bd551577e9d8 --- .../applications/class_applicationGeneric.inc | 8 +++- .../departments/class_departmentGeneric.inc | 2 +- .../blocklists/class_blocklistManagement.inc | 9 ++-- plugins/gofon/macro/class_gofonMacro.inc | 43 +++++++++++-------- 4 files changed, 37 insertions(+), 25 deletions(-) diff --git a/plugins/admin/applications/class_applicationGeneric.inc b/plugins/admin/applications/class_applicationGeneric.inc index 8ef8bb24e..351d6e458 100644 --- a/plugins/admin/applications/class_applicationGeneric.inc +++ b/plugins/admin/applications/class_applicationGeneric.inc @@ -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); } diff --git a/plugins/admin/departments/class_departmentGeneric.inc b/plugins/admin/departments/class_departmentGeneric.inc index 243d1e921..d7f709f80 100644 --- a/plugins/admin/departments/class_departmentGeneric.inc +++ b/plugins/admin/departments/class_departmentGeneric.inc @@ -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']; diff --git a/plugins/gofax/blocklists/class_blocklistManagement.inc b/plugins/gofax/blocklists/class_blocklistManagement.inc index bc42936f2..bd8f9a7a8 100644 --- a/plugins/gofax/blocklists/class_blocklistManagement.inc +++ b/plugins/gofax/blocklists/class_blocklistManagement.inc @@ -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", ""); diff --git a/plugins/gofon/macro/class_gofonMacro.inc b/plugins/gofon/macro/class_gofonMacro.inc index 0db4da659..7be9c1a28 100755 --- a/plugins/gofon/macro/class_gofonMacro.inc +++ b/plugins/gofon/macro/class_gofonMacro.inc @@ -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']); -- 2.30.2