Code

Updated print_red error output, every message is now displayed only once.
[gosa.git] / html / main.php
index 958d826417d8decabce122496c9b9bca1772d49a..8471e3eea3751e21ed743551bfa80a99d85ef8f4 100644 (file)
@@ -54,6 +54,8 @@ if (!isset($_SESSION['config'])){
 
 /* Reset errors */
 $_SESSION['errors']= "";
+$_SESSION['errorsAlreadyPosted']= array();
+$_SESSION['LastError']  ="";
 
 /* Check for uniqe ip address */
 $ui= $_SESSION["ui"];
@@ -229,7 +231,10 @@ if ($_SERVER["REQUEST_METHOD"] == "POST"){
 /* Load department list when plugin has changed. That is some kind of
    compromise between speed and beeing up to date */
 if (isset($_GET['reset'])){
-  $config->departments= get_departments();
+  if (!isset($_SESSION['cached_departments'])){
+    $_SESSION['cached_departments']= get_departments();
+  }
+  $config->departments= $_SESSION['cached_departments'];
   $config->make_idepartments ();
   if (isset($_SESSION['objectinfo'])){
     unset ($_SESSION['objectinfo']);
@@ -285,7 +290,6 @@ $smarty->assign ("plug", "$plug");
 
 $header= "<!-- headers.tpl-->".$smarty->fetch(get_template_path('headers.tpl'));
 
-
 /* React on clicks */
 if ($_SERVER["REQUEST_METHOD"] == "POST"){
 
@@ -293,6 +297,14 @@ if ($_SERVER["REQUEST_METHOD"] == "POST"){
      lock at this point globally. Plugins do not need to remove it. */
   if (isset($_POST['delete_lock']) && isset($_SESSION['dn'])){
     del_lock ($_SESSION['dn']);
+
+    /* Set old Post data */
+    if(isset($_SESSION['LOCK_VARS_USED'])){
+      foreach($_SESSION['LOCK_VARS_USED'] as $name => $value){
+        $_GET[$name]  = $value;
+        $_POST[$name] = $value;
+      } 
+    }
     sess_del ('dn');
   }
 
@@ -325,7 +337,13 @@ if (is_file("$plugin_dir/main.inc")){
 }
 
 /* Close div/tables */
+
+/* Print_out last ErrorMessage repeated string.
+ */
+print_red(NULL);
+
 $smarty->assign("contents", $display);
+
 if (isset($_SESSION['errors'])){
   $smarty->assign("errors", $_SESSION['errors']);
 }