diff --git a/plugins/admin/systems/class_divListSystem.inc b/plugins/admin/systems/class_divListSystem.inc
index d926756144f1d6637dd1f6b027070efa8e0d4971..fe125e2aa7090e760c6afafae5d23041836084b5 100644 (file)
$this->EnableCloseButton(false);
$this->EnableSaveButton (false);
+ /* Dynamic action col, depending on snapshot icons */
+ $action_col_size = 50;
+ if($this->parent->snapshotEnabled()){
+ $action_col_size += 38;
+ }
+
/* set Page header */
$this->AddHeader(array("string"=>" ","attach"=>"style='width:20px;'"));
$this->AddHeader(array("string"=>_("System / Department")));
- $this->AddHeader(array("string"=>_("Actions"),"attach"=>"style='width:90px;border-right:0px;'"));
+ $this->AddHeader(array("string"=>_("Actions"),"attach"=>"style='width:".$action_col_size."px;border-right:0px;'"));
/* Text ,Value ,Name ,Is selected */
$this->AddCheckBox("ShowServers", _("Select to see servers"), _("Show servers"), true);
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' align='middle' alt='' height='16' width='1'> ";
-
- if($this->parent->snapshotEnabled()){
- $listhead .= " <input class='center' type='image' align='middle' src='images/restore.png'
- title='"._("Restore objects")."' alt='"._("Up")."' name='RestoreDeletedSnapShot'>".
- " <img class='center' src='images/list_seperator.png' align='middle' alt='' height='16' width='1'> ";
- }
-
+ $listhead .= $this->get_snapshot_header($this->selectedBase);
$listhead .= " <input class='center' type='image' align='middle' src='images/select_new_terminal.png'
name='newsystem_terminal' alt='"._("New Terminal template")."' title='"._("New Terminal")."'>".
" <input class='center' type='image' align='middle' src='images/select_new_workstation.png'
}
- 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 snapshot")."'> ";
-
- 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 setEntries($terminals)
{
$img1 = "<img class='center' src='images/printer.png' alt='C' title='"._("Cups Server") ."'>";
$empty =" ";
+ /* Dynamic action col, depending on snapshot icons */
+ $action_col_size = 50;
+ if($this->parent->snapshotEnabled()){
+ $action_col_size += 38;
+ }
+
// 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($terminals as $key => $val){
- $action = $this->GetSnapShotActions($val['dn']);
- $action.= "<input class='center' type='image' src='images/edit.png' alt='"._("edit")."' name='user_edit_%KEY%' title='"._("Edit system")."'>";
+ $action= "<input class='center' type='image' src='images/edit.png' alt='"._("edit")."' name='user_edit_%KEY%' title='"._("Edit system")."'>";
+ $action.= $this->GetSnapShotActions($val['dn']);
$action.= "<input class='center' type='image' src='images/edittrash.png' alt='"._("delete")."' name='user_del_%KEY%' title='"._("Delete system")."'>";
/* Generate picture list, which is currently disabled */
$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:90px;border-right:0px;text-align:right;'");
+ $field3 = array("string" => preg_replace("/%KEY%/", "$key", $action2.$action), "attach" => "style='width:".$action_col_size."px;border-right:0px;text-align:right;'");
$this->AddElement( array($field1,$field2,$field3));
}
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: