summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: b130a46)
raw | patch | inline | side by side (parent: b130a46)
author | hickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8> | |
Tue, 13 Jun 2006 09:30:24 +0000 (09:30 +0000) | ||
committer | hickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8> | |
Tue, 13 Jun 2006 09:30:24 +0000 (09:30 +0000) |
git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@3798 594d385d-05f5-0310-b6e9-bd551577e9d8
diff --git a/plugins/admin/groups/class_divListGroup.inc b/plugins/admin/groups/class_divListGroup.inc
index f8139ab5870acaf79d020f998003092cc33ca9ea..30b1df8a439aac22d4beb18a85b0c19bf7189c4c 100644 (file)
$this->AddHeader(array("string"=>" ","attach"=>"style='width:20px;'"));
$this->AddHeader(array("string"=>_("Groupname / Department")));
$this->AddHeader(array("string"=>_("Properties"),"attach"=>"style='width:136px;'"));
- $this->AddHeader(array("string"=>_("Actions"),"attach"=>"style='width:80px;border-right:0px;'"));
+ $this->AddHeader(array("string"=>_("Actions"),"attach"=>"style='width:110px;border-right:0px;'"));
/* Text ,Value ,Name ,Is selected */
$this->AddCheckBox("ShowPrimaryGroups", _("Select to see groups that are primary groups of users"), _("Show primary groups"), true);
}
+ function GetSnapShotActions($dn)
+ {
+ $str = "";
+
+ if($this->parent->snapshotEnabled()){
+
+ $str .="<input class='center' type='image' src='images/snapshot.png'
+ alt='"._("Create snapshot")."' name='CreateSnapShot_".base64_encode($dn)."' title='"._("Create a new snapshot from this object")."'> ";
+
+ if(count($this->parent->Available_SnapsShots($dn))){
+ $str .="<input class='center' type='image' src='images/restore.png'
+ alt='"._("Restore snapshot")."' name='RestoreSnapShot_".base64_encode($dn)."' title='"._("Restore snapshot")."'> ";
+ }else{
+ $str.= "<img src='images/empty.png' style='width:16px;' class='center'> ";
+ }
+ }
+ return($str);
+ }
+
+
function GenHeader()
{
/* Prepare departments,
" <input type='image' class='center' src='images/list_back.png' title='"._("Go up one department")."' alt='"._("Up")."' name='dep_back'> ".
" <input type='image' class='center' src='images/list_home.png' title='"._("Go to users department")."' alt='"._("Home")."' name='dep_home'> ".
" <input class='center' type='image' src='images/list_reload.png' align='middle' title='"._("Reload list")."' name='submit_department' alt='". _("Submit")."'> ".
- " <img class='center' src='images/list_seperator.png' alt='' height='16' width='1'> ".
- " <input type='image' class='center' src='images/list_new_group.png' title='"._("Create new group")."' alt='"._("New")."' name='group_new'> ".
+ " <img class='center' src='images/list_seperator.png' alt='' height='16' width='1'> ";
+
+
+ if($this->parent->snapshotEnabled()){
+ $listhead .= " <input class='center' type='image' align='middle' src='images/restore.png'
+ title='"._("Restore snapshopts of already deleted objects")."' alt='"._("Restore")."' name='RestoreDeletedSnapShot'>".
+ " <img class='center' src='images/list_seperator.png' align='middle' alt='' height='16' width='1'> ";
+ }
+
+ $listhead.=" <input type='image' class='center' src='images/list_new_group.png' title='"._("Create new group")."' alt='"._("New")."' name='group_new'> ".
$Copy_Paste.
" <img class='center' src='images/list_seperator.png' alt='' height='16' width='1'> ".
_("Base")." <select name='CurrentMainBase' onChange='mainform.submit()' class='center'>$options</select>".
- " <input type='image' class='center' src='images/list_submit.png' title='"._("Submit department")."' name='submit_department' alt='"._("Submit").
-"'> ".
+ " <input type='image' class='center' src='images/list_submit.png' title='"._("Submit department")."' name='submit_department' alt='"._("Submit").
+ "'> ".
"</div>";
$this->SetListHeader($listhead);
// Space
$empty = "<img class='center' src='images/empty.png' style='width:16px;height:16px;' alt=''>";
- /* Create action icons - copy & paste icons */
- $actions = "";
- if($this->parent->CopyPasteHandler){
- $actions.= "<input class='center' type='image'
- src='images/editcut.png' alt='"._("cut")."' name='cut_%KEY%' title='"._("Cut this entry")."'> ";
- $actions.= "<input class='center' type='image'
- src='images/editcopy.png' alt='"._("copy")."' name='copy_%KEY%' title='"._("Copy this entry")."'> ";
- }
- $actions.= "<input class='center' type='image'
- src='images/edit.png' alt='"._("edit")."' name='group_edit_%KEY%' title='"._("Edit this entry")."'>";
- $actions.= "<input class='center' type='image'
- src='images/edittrash.png' alt='"._("delete")."' name='group_del_%KEY%' title='"._("Delete this entry")."'>";
-
// User and Template Images
$editlink = "<a href='?plug=".$_GET['plug']."&id=%s&act=edit_entry'>%s</a>";
// Test Every Entry and generate divlist Array
foreach($groups as $key => $val){
+
+ /* Create action icons - copy & paste icons */
+ $actions = $this->GetSnapShotActions($val['dn']);
+ if($this->parent->CopyPasteHandler){
+ $actions.= "<input class='center' type='image'
+ src='images/editcut.png' alt='"._("cut")."' name='cut_%KEY%' title='"._("Cut this entry")."'> ";
+ $actions.= "<input class='center' type='image'
+ src='images/editcopy.png' alt='"._("copy")."' name='copy_%KEY%' title='"._("Copy this entry")."'> ";
+ }
+ $actions.= "<input class='center' type='image'
+ src='images/edit.png' alt='"._("edit")."' name='group_edit_%KEY%' title='"._("Edit this entry")."'>";
+ $actions.= "<input class='center' type='image'
+ src='images/edittrash.png' alt='"._("delete")."' name='group_del_%KEY%' title='"._("Delete this entry")."'>";
+
$posix=$mail=$samba=$appl=$phone=$enviro=$empty;
$field1 = array("string" => sprintf($userimg,$val['dn']), "attach" => "style='text-align:center;width:20px;'");
$field2 = array("string" => sprintf($editlink,$key,($val['cn']['0'].$desc)), "attach" => "style='' ".$title);
$field3 = array("string" => preg_replace("/%KEY%/", $key, $posix." ".$enviro." ".$mail." ".$samba." ".$appl." ".$phone), "attach" => "style='width:136px;'");
- $field4 = array("string" => preg_replace("/%KEY%/", $key, $actions), "attach" => "style='width:80px;border-right:0px;text-align:right;'");
+ $field4 = array("string" => preg_replace("/%KEY%/", $key, $actions), "attach" => "style='width:110px;border-right:0px;text-align:right;'");
$this->AddElement(array($field1,$field2,$field3,$field4));
}
diff --git a/plugins/admin/groups/class_groupManagement.inc b/plugins/admin/groups/class_groupManagement.inc
index 30309740d75196d112843b707cab8be5088c7e9a..305fd6a9c82657f959ec9aabbd9b922856d9f7bc 100644 (file)
/* Cancel dialogs */
if (isset($_POST['edit_cancel']) || isset($_POST['password_cancel'])){
- del_lock ($this->grouptab->dn);
+ if(isset($this->grouptab->dn)){
+ del_lock ($this->grouptab->dn);
+ }
unset ($this->grouptab);
$this->grouptab= NULL;
unset($_SESSION['objectinfo']);
$display= $this->grouptab->execute();
/* Don't show buttons if tab dialog requests this */
- if (!$this->grouptab->by_object[$this->grouptab->current]->dialog){
- $display.= "<p style=\"text-align:right\">\n";
- $display.= "<input type=submit name=\"edit_finish\" style=\"width:80px\" value=\""._("Ok")."\">\n";
- $display.= " \n";
- if ($this->dn != "new"){
- $display.= "<input type=submit name=\"edit_apply\" value=\""._("Apply")."\">\n";
+ if(isset($this->grouptab->by_object)){
+ if (!$this->grouptab->by_object[$this->grouptab->current]->dialog){
+ $display.= "<p style=\"text-align:right\">\n";
+ $display.= "<input type=submit name=\"edit_finish\" style=\"width:80px\" value=\""._("Ok")."\">\n";
$display.= " \n";
+ if ($this->dn != "new"){
+ $display.= "<input type=submit name=\"edit_apply\" value=\""._("Apply")."\">\n";
+ $display.= " \n";
+ }
+ $display.= "<input type=submit name=\"edit_cancel\" value=\""._("Cancel")."\">\n";
+ $display.= "</p>";
}
- $display.= "<input type=submit name=\"edit_cancel\" value=\""._("Cancel")."\">\n";
- $display.= "</p>";
}
return ($display);
}
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 0720d70810653e78acade689f69398630f201c43..213bde0aeffd1d8eb738ab59dbb707cf311d2e56 100755 (executable)
$res[base64_encode($entry['dn'])] = $date." - ".$data;
}
$smarty->assign("SnapShots",$res);
+ $smarty->assign("CountSnapShots",count($res));
}
$smarty->assign("RestoreMode",$this->Restore);
index 3495d77cb99d0f3a54cbb71e4a5ad22b5abd7660..e3d1035599c2a181786041ac8c956a3f9cc5863a 100755 (executable)
</p>
<p class="seperator">
<br>
-<b>{t}You will be able to restore from{/t}</b>
+
+ {if $CountSnapShots!=0}
+ <b>{t}You will be able to restore from{/t}</b>
+ {else}
+ <b>{t}There are no available snapshots.{/t}</b>
+ {/if}
<br>
<br>
</p>
<br>
<table summary="">
<tr>
- <td>{t}Choose a snapshot and click continue, to restore the snapshot.{/t}
+ <td>
+ {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}
</td>
</tr>
<tr>
<td>
- <select name="SnapShot">
- <option value=""> </option>
- {html_options options=$SnapShots}
+ <select name="SnapShot" {if $CountSnapShots==0} disabled {/if}>
+ {if $CountSnapShots==0} disabled
+ <option value=""> {t}none{/t} </option>
+ {else}
+ <option value=""> </option>
+ {html_options options=$SnapShots}
+ {/if}
</select>
</td>
</tr>
<p class="seperator"> </p>
<p>
<div style="width:100%; text-align:right;">
- <input type='submit' name='RestoreSnapshot' value='{t}Save{/t}'>
+ <input type='submit' name='RestoreSnapshot' value='{t}Save{/t}' {if $CountSnapShots==0} disabled {/if}>
<input type='submit' name='edit_cancel' value='{t}Cancel{/t}'>
</div></p>