From 86cb8b55f80ea295e154226b20a568170f104ea6 Mon Sep 17 00:00:00 2001
From: hickert
+{t}This procedure will create a working snapshot of the selected object.{/t}
+
+
+
".
- " ".
- " ".
- " ".
- " ".
- " ".
- " ".
- "
"._("Base")." ".
- " ".
- " ".
- "
".
+ " ".
+ "
".
+ " ".
+ " ".
+ " ".
+ " ".
+ " ".
+ " ".
+ "
"._("Base")." ".
+ " ".
+ " ".
+ "";
$this->SetListHeader($listhead);
}
@@ -118,6 +121,22 @@ class divListSystem extends MultiSelectWindow
$this->GenHeader();
}
+
+ function GetSnapShotActions($dn)
+ {
+ $str = "";
+ $str .=" ";
+
+ if(count($this->parent->Available_SnapsShots($dn))){
+ $str .=" ";
+ }else{
+ $str.= "
";
+ }
+ return($str);
+ }
+
function setEntries($terminals)
{
$img1 = "
";
@@ -132,15 +151,17 @@ class divListSystem extends MultiSelectWindow
$img10 = "
";
$empty =" ";
- $action= "";
- $action.= "";
// User and Template Images
$editlink = "%s";
// Test Every Entry and generate divlist Array
foreach($terminals as $key => $val){
-
+
+ $action = $this->GetSnapShotActions($val['dn']);
+ $action.= "";
+ $action.= "";
+
/* Generate picture list, which is currently disabled */
if(in_array("goCupsServer" ,$val['objectClass'])) $cups = $img1; else $cups =$empty;
if(in_array("goLogDBServer" ,$val['objectClass'])) $logdb = $img2; else $logdb =$empty;
@@ -152,7 +173,7 @@ class divListSystem extends MultiSelectWindow
if(in_array("goFonServer" ,$val['objectClass'])) $fon = $img8; else $fon =$empty;
if(in_array("goFaxServer" ,$val['objectClass'])) $fax = $img9; else $fax =$empty;
if(in_array("goLdapServer" ,$val['objectClass'])) $ldap = $img10; else $ldap =$empty;
-
+
$pics = $cups.$logdb.$syslog.$imap.$samba.$nfs.$krb.$fon.$fax.$ldap;
$pics = ""; // Pictures currently hidden
@@ -182,21 +203,78 @@ class divListSystem extends MultiSelectWindow
$img = $this->parent->convert_list($val);
$field1 = array("string" => sprintf($img['img'],$val['dn']), "attach" => "style='text-align:center;width:20px;'");
$field2 = array("string" => sprintf($editlink,$key,$display), "attach" => "style='' title='".preg_replace('/ /', ' ', @LDAP::fix($val['dn']))."'");
- $field3 = array("string" => preg_replace("/%KEY%/", "$key", $action2.$action), "attach" => "style='width:60px;border-right:0px;text-align:right;'");
+ $field3 = array("string" => preg_replace("/%KEY%/", "$key", $action2.$action), "attach" => "style='width:90px;border-right:0px;text-align:right;'");
$this->AddElement( array($field1,$field2,$field3));
}
}
+
function Save()
{
MultiSelectWindow :: Save();
}
+
function save_object()
{
/* Save automatic created POSTs like regex, checkboxes */
- MultiSelectWindow :: save_object();
+ MultiSelectWindow :: save_object();
+
+
+ /* check for posts */
+ $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->parent->systab = new SnapShotDialog($this->config,$entry,$this->parent);
+ }
+
+ /* 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->parent->systab = new SnapShotDialog($this->config,$entry,$this->parent);
+ $this->parent->systab->Restore = true;
+ }
+
+ /* Restore one of the already deleted objects */
+ if(preg_match("/^RestoreDeletedSnapShot_/",$name) && $once){
+ $once = false;
+ $entry = "ou=systems,".$this->selectedBase;
+ $this->parent->systab = new SnapShotDialog($this->config,$entry,$this->parent);
+ $this->parent->systab->Restore = true;
+ $this->parent->systab->DeletedOnes = true;
+ }
+ }
+
+ /* Create a new snapshot requested, check
+ the given attributes and create the snapshot*/
+ if(isset($_POST['CreateSnapshot'])){
+ $this->parent->systab->save_object();
+ $msgs = $this->parent->systab->check();
+ if(count($msgs)){
+ foreach($msgs as $msg){
+ print_red($msg);
+ }
+ }else{
+ $this->parent->dn = $this->parent->systab->dn;
+ $this->parent->create_snapshot("snapshot",$this->parent->systab->CurrentDescription);
+ $this->parent->systab = NULL;
+ }
+ }
+
+ /* Restore is requested, restore the object with the posted dn .*/
+ if((isset($_POST['RestoreSnapshot'])) && (isset($_POST['SnapShot']))){
+ $entry = base64_decode($_POST['SnapShot']);
+ $this->parent->restore_snapshot($entry);
+ $this->parent->systab = NULL;
+ }
}
}
// vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
diff --git a/plugins/admin/systems/snapshotdialog.tpl b/plugins/admin/systems/snapshotdialog.tpl
new file mode 100755
index 000000000..d81c53518
--- /dev/null
+++ b/plugins/admin/systems/snapshotdialog.tpl
@@ -0,0 +1,85 @@
+{if $RestoreMode}
+
+{t}Restoring an object snapshot{/t}
+
+
+
+{t}You will be able to restore from{/t}
+
+
+
+
+
+
+
+
+ {t}Choose a snapshot and click continue, to restore the snapshot.{/t}
+
+
+
+
+
+
+
+{t}This procedure will create a working snapshot of the selected object.{/t}
+
+
+
+{t}You will be able to restore from{/t}
+
+
+
| + {t}Object{/t} + | ++ {$CurrentDN} + | +
| + {t}Date{/t} + | ++ {$CurrentDate} + | +
|
+ {t}Description{/t} + + |
+ |
+
+