";
}
return ($display);
}
@@ -518,6 +522,61 @@ class groupManagement extends plugin
function save_object()
{
$this->DivListGroup->save_object();
+ $once = true;
+ foreach($_POST as $name => $value){
+
+ /* Create a new snapshot, display a dialog */
+ if(preg_match("/^CreateSnapShot_/",$name) && $once){
+ $once = false;
+ $entry = preg_replace("/^CreateSnapShot_/","",$name);
+ $entry = base64_decode(preg_replace("/_[xy]$/","",$entry));
+ $this->grouptab = new SnapShotDialog($this->config,$entry,$this);
+ }
+
+ /* Restore a snapshot, display a dialog with all snapshots of the current object */
+ if(preg_match("/^RestoreSnapShot_/",$name) && $once){
+ $once = false;
+ $entry = preg_replace("/^RestoreSnapShot_/","",$name);
+ $entry = base64_decode(preg_replace("/_[xy]$/","",$entry));
+ $this->grouptab = new SnapShotDialog($this->config,$entry,$this);
+ $this->grouptab->Restore = true;
+ }
+
+ /* Restore one of the already deleted objects */
+ if(preg_match("/^RestoreDeletedSnapShot_/",$name) && $once){
+ $once = false;
+ $entry = get_groups_ou().$this->DivListGroup->selectedBase;
+ $this->grouptab = new SnapShotDialog($this->config,$entry,$this);
+ $this->grouptab->Restore = true;
+ $this->grouptab->DeletedOnes = true;
+ }
+ }
+
+ /* Create a new snapshot requested, check
+ the given attributes and create the snapshot*/
+ if(isset($_POST['CreateSnapshot'])){
+ $this->grouptab->save_object();
+ $msgs = $this->grouptab->check();
+ if(count($msgs)){
+ foreach($msgs as $msg){
+ print_red($msg);
+ }
+ }else{
+ $this->dn = $this->grouptab->dn;
+ $this->create_snapshot("snapshot",$this->grouptab->CurrentDescription);
+ $this->grouptab = NULL;
+ }
+ }
+
+ /* Restore is requested, restore the object with the posted dn .*/
+ if((isset($_POST['RestoreSnapshot'])) && (isset($_POST['SnapShot']))){
+ $entry =trim($_POST['SnapShot']);
+ if(!empty($entry)){
+ $entry = base64_decode($entry);
+ $this->restore_snapshot($entry);
+ $this->grouptab = NULL;
+ }
+ }
}
diff --git a/plugins/admin/systems/class_SnapShotDialog.inc b/plugins/admin/systems/class_SnapShotDialog.inc
index 0720d7081..213bde0ae 100755
--- a/plugins/admin/systems/class_SnapShotDialog.inc
+++ b/plugins/admin/systems/class_SnapShotDialog.inc
@@ -52,6 +52,7 @@ class SnapShotDialog extends plugin
$res[base64_encode($entry['dn'])] = $date." - ".$data;
}
$smarty->assign("SnapShots",$res);
+ $smarty->assign("CountSnapShots",count($res));
}
$smarty->assign("RestoreMode",$this->Restore);
diff --git a/plugins/admin/systems/snapshotdialog.tpl b/plugins/admin/systems/snapshotdialog.tpl
index 3495d77cb..e3d103559 100755
--- a/plugins/admin/systems/snapshotdialog.tpl
+++ b/plugins/admin/systems/snapshotdialog.tpl
@@ -8,21 +8,35 @@
-{t}You will be able to restore from{/t}
+
+ {if $CountSnapShots!=0}
+ {t}You will be able to restore from{/t}
+ {else}
+ {t}There are no available snapshots.{/t}
+ {/if}
-
{t}Choose a snapshot and click continue, to restore the snapshot.{/t}
+
+ {if $CountSnapShots==0}
+ {t}There is no snapshot available that could be restored.{/t}
+ {else}
+ {t}Choose a snapshot and click continue, to restore the snapshot.{/t}
+ {/if}