From 56571f0cd23c88ec39fd7c8f70ffd258870dba79 Mon Sep 17 00:00:00 2001 From: hickert Date: Mon, 26 Apr 2010 12:12:05 +0000 Subject: [PATCH] Updated Snapshot handling -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 | 8 +------- gosa-core/include/class_ldap.inc | 1 - gosa-core/include/class_management.inc | 17 +++++++++++++++++ 3 files changed, 18 insertions(+), 8 deletions(-) diff --git a/gosa-core/include/class_SnapShotDialog.inc b/gosa-core/include/class_SnapShotDialog.inc index 0c56e49bd..eca00222e 100644 --- a/gosa-core/include/class_SnapShotDialog.inc +++ b/gosa-core/include/class_SnapShotDialog.inc @@ -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){ diff --git a/gosa-core/include/class_ldap.inc b/gosa-core/include/class_ldap.inc index f888d8444..1a991f1b6 100644 --- a/gosa-core/include/class_ldap.inc +++ b/gosa-core/include/class_ldap.inc @@ -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); } diff --git a/gosa-core/include/class_management.inc b/gosa-core/include/class_management.inc index 4bfc64edf..2e42c572e 100644 --- a/gosa-core/include/class_management.inc +++ b/gosa-core/include/class_management.inc @@ -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. -- 2.30.2