Code

Updated Snapshot handling
authorhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Mon, 26 Apr 2010 12:12:05 +0000 (12:12 +0000)
committerhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Mon, 26 Apr 2010 12:12:05 +0000 (12:12 +0000)
-Removed several duplicate methods

git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@17838 594d385d-05f5-0310-b6e9-bd551577e9d8

gosa-core/include/class_SnapShotDialog.inc
gosa-core/include/class_ldap.inc
gosa-core/include/class_management.inc

index 0c56e49bdbf9b3c358aaab7475f83e8b09c502ef..eca00222e5c659292037d028efc6488eeaf6386a 100644 (file)
@@ -91,17 +91,11 @@ class SnapShotDialog extends plugin
                     $this->del_dn      = $entry;
                     $smarty= get_smarty();
                     $smarty->assign("info", sprintf(_("You are about to delete the snapshot %s."), bold(LDAP::fix($this->del_dn))));
-                    return($smarty->fetch (get_template_path('removeEntries.tpl')));
+                    return($smarty->fetch (get_template_path('removeSnapshots.tpl')));
                 }
             }
         }
 
-        /* Remove snapshot */
-        if(isset($_POST['delete_confirm']) && !empty($this->del_dn)){
-            $this->remove_snapshot($this->del_dn);
-            $this->del_dn = "";
-        }
-
         /* We must restore a snapshot */
 
         if($this->display_restore_dialog){
index f888d84448df0e784076bc619191821e800e62b2..1a991f1b6e122ba7466593abe2bd1ec1336cda9a 100644 (file)
@@ -866,7 +866,6 @@ class LDAP{
     $cmd = "ldapsearch -x -LLLL '{$filter}' {$limit} {$scope} -H '{$host}' -b '{$dn}' $attrs";
     exec($cmd, $ret,$code);
     $res = implode($ret,"\n");
-    print_a(array($res,$cmd, $ret,$code));
     return($res);
   }
 
index 4bfc64edf4e8baa31daa129608b4bbd8a1f9fdb0..2e42c572eca2fd1fd97b342d2064e1a900a9775a 100644 (file)
@@ -118,6 +118,7 @@ class management
     $this->registerAction("restore",     "restoreSnapshotDialog");
     $this->registerAction("saveSnapshot","saveSnapshot");
     $this->registerAction("restoreSnapshot","restoreSnapshot");
+    $this->registerAction("removeSnapshotConfirmed","removeSnapshotConfirmed");
     $this->registerAction("cancelSnapshot","closeDialogs");
 
     $this->registerAction("config-filter","editFilter");
@@ -406,6 +407,7 @@ class management
     if(isset($_POST['edit_finish'])) $action['action'] = "save";    
     if(isset($_POST['edit_cancel'])) $action['action'] = "cancel";    
     if(isset($_POST['delete_confirmed'])) $action['action'] = "removeConfirmed";   
+    if(isset($_POST['delete_snapshot_confirm'])) $action['action'] = "removeSnapshotConfirmed";   
     if(isset($_POST['delete_cancel'])) $action['action'] = "cancelDelete";   
     if(isset($_POST['saveFilter'])) $action['action'] = "saveFilter";   
     if(isset($_POST['cancelFilter'])) $action['action'] = "cancelFilter";   
@@ -510,6 +512,21 @@ class management
   }
 
 
+  /*! \brief  Removes a snapshot object.
+   */
+  function removeSnapshotConfirmed($action="",$target=array(),$all=array())
+  {
+    $entry = $this->dialogObject->del_dn;
+    if(!empty($entry) && $this->ui->allow_snapshot_create($entry,$this->aclCategory)){
+      $this->snapHandler->remove_snapshot($entry);
+      @DEBUG (DEBUG_TRACE, __LINE__, __FUNCTION__, __FILE__,$entry,"Snaptshot removed!");
+    }else{
+      msg_dialog::display(_("Permission"),sprintf(_("You are not allowed to remove a snapshot for %s!"), bold($entry)),
+          ERROR_DIALOG);
+    }
+  }
+
+
   /*! \brief  Displays the "Restore snapshot dialog" for a given target. 
    *          If no target is specified, open the restore removed object 
    *           dialog.