Code

Reenabled snapshots.
authorhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Tue, 2 Dec 2008 13:31:05 +0000 (13:31 +0000)
committerhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Tue, 2 Dec 2008 13:31:05 +0000 (13:31 +0000)
git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@13112 594d385d-05f5-0310-b6e9-bd551577e9d8

gosa-core/include/class_SnapShotDialog.inc
gosa-core/include/class_plugin.inc

index af18ab6ce8669a526b0da76f2909a466cdb5c345..b13f1cdbec430e5c0552ed634eedd552287668e7 100644 (file)
@@ -153,7 +153,7 @@ class SnapShotDialog extends plugin
 
                                $field0 = array("string"=> $time_stamp , "attach"=> "style='vertical-align:top;width:120px;'");
                                $field1 = array("string"=> htmlentities (utf8_decode($display_data)), "attach"=> "");
-                               $field2 = array("string"=> str_replace("/%KEY/",base64_encode($entry['dn']),$actions) , 
+                               $field2 = array("string"=> str_replace("%KEY",base64_encode($entry['dn']),$actions) , 
                                                                "attach"=> "style='border-right:0px;vertical-align:top;width:40px;text-align:right;'");
                                $DivListSnapShots->AddEntry(array($field0,$field1,$field2));
                        }               
index f834f454ac70c79219cd82a9a1920fca61ffc6dd..5fcbf559736d555af0b2e5700337b6296c33af80 100644 (file)
@@ -1303,7 +1303,8 @@ class plugin
     $this->dn = $dn;
     $ldap = $this->config->get_ldap_link();
     $ldap->cd($this->config->current['BASE']);
-    $ldap->rmdir_recursive($dn);
+    $ldap->rmdir_recursive($this->dn);
+    msg_dialog::display(_("LDAP error"), msgPool::ldaperror($ldap->get_error(), $this->dn));
     $this->dn = $old_dn;
   }
 
@@ -1513,10 +1514,51 @@ class plugin
     $this->parent = $parent;
 
     foreach($_POST as $name => $value){
-                       $entry = base64_decode(preg_replace("/_[xy]$/","",$name));
+
+##   foreach($_POST as $name => $value){
+## +           $entry = base64_decode(preg_replace("/_[xy]$/","",$name));
+##
+##        /* Create a new snapshot, display a dialog */
+##        if(preg_match("/^CreateSnapShotDialog_/",$name) && $once){
+##          $once = false;
+## -        $entry = preg_replace("/^CreateSnapShotDialog_/","",$name);
+## -        $entry = base64_decode(preg_replace("/_[xy]$/","",$entry));
+## +        $entry = preg_replace("/^CreateSnapShotDialog_/","",$entry);
+##
+##          if(!empty($entry) && $ui->allow_snapshot_create($entry,$this->parent->acl_module)){
+##            $this->snapDialog = new SnapShotDialog($this->config,$entry,$this);
+## @@ -1538,8 +1530,7 @@
+##        /* Restore a snapshot, display a dialog with all snapshots of the current object */
+##        if(preg_match("/^RestoreSnapShotDialog_/",$name) && $once){
+##          $once = false;
+## -        $entry = preg_replace("/^RestoreSnapShotDialog_/","",$name);
+## -        $entry = base64_decode(preg_replace("/_[xy]$/","",$entry));
+## +        $entry = preg_replace("/^RestoreSnapShotDialog_/","",$entry);
+##          if(!empty($entry) && $ui->allow_snapshot_restore($entry,$this->parent->acl_module)){
+##            $this->snapDialog = new SnapShotDialog($this->config,$entry,$this);
+##            $this->snapDialog->display_restore_dialog = true;
+## @@ -1566,8 +1557,7 @@
+##        /* Restore selected snapshot */
+##        if(preg_match("/^RestoreSnapShot_/",$name) && $once){
+##          $once = false;
+## -        $entry = preg_replace("/^RestoreSnapShot_/","",$name);
+## -        $entry = base64_decode(trim(preg_replace("/_[xy]$/","",$entry)));
+## +        $entry = preg_replace("/^RestoreSnapShot_/","",$entry);
+##          if(!empty($entry) && $ui->allow_snapshot_restore($entry,$this->parent->acl_module)){
+##            $this->restore_snapshot($entry);
+##            $this->snapDialog = NULL;
+## @@ -1628,6 +1618,7 @@
+## */
+##
+##
+##
+
+
 
       /* Create a new snapshot, display a dialog */
-      if(preg_match("/^CreateSnapShotDialog_/",$name) && $once){
+      if(preg_match("/^CreateSnapShotDialog_[^_]*_[xy]$/",$name) && $once){
+
+                         $entry = base64_decode(preg_replace("/^CreateSnapShotDialog_([^_]*)_[xy]$/","\\1",$name));
         $once = false;
         $entry = preg_replace("/^CreateSnapShotDialog_/","",$entry);
 
@@ -1530,8 +1572,8 @@ class plugin
       /* Restore a snapshot, display a dialog with all snapshots of the current object */
       if(preg_match("/^RestoreSnapShotDialog_/",$name) && $once){
         $once = false;
-        $entry = preg_replace("/^RestoreSnapShotDialog_/","",$entry);
-        if(!empty($entry) && $ui->allow_snapshot_restore($entry,$this->parent->acl_module)){
+        $entry = base64_decode(preg_replace("/^RestoreSnapShotDialog_([^_]*)_[xy]$/i","\\1",$name));
+        if(!empty($entry) && $ui->allow_snapshot_restore($this->dn,$this->parent->acl_module)){
           $this->snapDialog = new SnapShotDialog($this->config,$entry,$this);
           $this->snapDialog->display_restore_dialog = true;
         }else{
@@ -1544,7 +1586,7 @@ class plugin
           || preg_match("/^RestoreDeletedSnapShot_/",$name)) && $once){
         $once = false;
 
-        if($ui->allow_snapshot_restore($base,$this->parent->acl_module)){
+        if($ui->allow_snapshot_restore($this->dn,$this->parent->acl_module)){
           $this->snapDialog = new SnapShotDialog($this->config,"",$this);
           $this->snapDialog->set_snapshot_bases($baseSuffixe);
           $this->snapDialog->display_restore_dialog      = true;
@@ -1557,8 +1599,9 @@ class plugin
       /* Restore selected snapshot */
       if(preg_match("/^RestoreSnapShot_/",$name) && $once){
         $once = false;
-        $entry = preg_replace("/^RestoreSnapShot_/","",$entry);
-        if(!empty($entry) && $ui->allow_snapshot_restore($entry,$this->parent->acl_module)){
+        $entry = base64_decode(preg_replace("/^RestoreSnapShot_([^_]*)_[xy]$/i","\\1",$name));
+
+        if(!empty($entry) && $ui->allow_snapshot_restore($this->dn,$this->parent->acl_module)){
           $this->restore_snapshot($entry);
           $this->snapDialog = NULL;
         }else{