Code

Updated application locking
authorhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Thu, 15 May 2008 08:15:58 +0000 (08:15 +0000)
committerhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Thu, 15 May 2008 08:15:58 +0000 (08:15 +0000)
git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@10905 594d385d-05f5-0310-b6e9-bd551577e9d8

gosa-plugins/goto/admin/applications/class_applicationManagement.inc
gosa-plugins/goto/admin/applications/main.inc

index 109847bd36e1047dd48cbe9841ed10c8c8b0dbb0..d93f167fbc143c9554490f780205fe3b417aa97e 100644 (file)
@@ -36,6 +36,8 @@ class applicationManagement extends plugin
   var $app_base     ="";
   var $app_release  ="";
 
+  var $dns = array();
+
   function IsReleaseManagementActivated()
   {
     /* Check if we should enable the release selection */
@@ -127,7 +129,7 @@ class applicationManagement extends plugin
 
     /* These vars will be stored if you try to open a locked app, 
         to be able to perform your last requests after showing a warning message */
-    session::set('LOCK_VARS_TO_USE',array("/^act$/","/^id$/","/^appl_edit_/","/^appl_del_/","/^item_selected/","/^remove_multiple_applications/"));
+    session::set('LOCK_VARS_TO_USE',array("/^act$/","/^id$/","/^appl_edit_/","/^appl_del_/","/^item_selected/","/^remove_multiple_applications/","/^menu_action/"));
 
     $smarty       = get_smarty();             // Smarty instance
     $s_action     = "";                       // Contains the action to proceed
@@ -228,8 +230,7 @@ class applicationManagement extends plugin
 
     /* Cancel dialogs */
     if (isset($_POST['edit_cancel']) || isset($_POST['password_cancel'])){
-      del_lock ($this->apptabs->dn);
-      unset ($this->apptabs);
+      $this->remove_lock();
       $this->apptabs= NULL;
       session::un_set('objectinfo');
     }
@@ -259,9 +260,8 @@ class applicationManagement extends plugin
           /* Application has been saved successfully, remove lock from
              LDAP. */
           if ($this->dn != "new"){
-            del_lock ($this->dn);
+            $this->remove_lock();
           }
-          unset ($this->apptabs);
           $this->apptabs= NULL;
           session::un_set('objectinfo');
         }else{
@@ -367,10 +367,11 @@ class applicationManagement extends plugin
           msg_dialog::display(_("Permission error"), msgPool::permDelete(), INFO_DIALOG);
           new log("security","application/".get_class($this),$dn,array(),"Tried to trick deletion.");
         }
-        /* Remove lock file after successfull deletion */
-        del_lock ($dn);
-        unset($this->dns[$key]);
       }
+
+      /* Remove lock file after successfull deletion */
+      $this->remove_lock();
+      $this->dns = array();
     }
 
 
@@ -380,10 +381,10 @@ class applicationManagement extends plugin
 
     /* Remove lock */
     if(isset($_POST['delete_multiple_application_cancel'])){
-      foreach($this->dns as $key => $dn){
-        del_lock ($dn);
-        unset($this->dns[$key]);
-      }
+
+      /* Remove lock file after successfull deletion */
+      $this->remove_lock();
+      $this->dns = array();
     }
 
     /**************** 
@@ -454,7 +455,7 @@ class applicationManagement extends plugin
       }
 
       /* Remove lock file after successfull deletion */
-      del_lock ($this->dn);
+      $this->remove_lock();
     }
 
 
@@ -464,7 +465,7 @@ class applicationManagement extends plugin
 
     /* Delete application canceled? */
     if (isset($_POST['delete_cancel'])){
-      del_lock ($this->dn);
+      $this->remove_lock();
       session::un_set('objectinfo');
     }
 
@@ -657,13 +658,21 @@ class applicationManagement extends plugin
     $this->postcreate();
   }
 
+
   function remove_lock()
   {
     if (isset($this->apptabs->dn)){
       del_lock ($this->apptabs->dn);
     }
+    if(isset($this->dn) && !empty($this->dn) && $this->dn != "new"){
+      del_lock($this->dn);
+    }
+    if(isset($this->dns) && is_array($this->dns) && count($this->dns)){
+      del_lock($this->dns);
+    }
   }
 
+
   function save_object() 
   {
     $this->DivListApplication->save_object();
index 0dadb0250ed0e4fef3e5f4835673686056ec53b0..8167bd8fdee5f56feb63094fc0707759446ba56b 100644 (file)
@@ -22,7 +22,6 @@ if ($remove_lock){
         if(session::is_set('applicationManagement')){
                 $applicationManagement = session::get('applicationManagement');
                 $applicationManagement->remove_lock();
-                del_lock ($ui->dn);
                 session::un_set ('applicationManagement');
         }
 } else {