From 9d0c4cc18c9ac53e3acbdc59ca81312d8ec085de Mon Sep 17 00:00:00 2001 From: hickert Date: Tue, 13 Apr 2010 10:29:33 +0000 Subject: [PATCH] Removed last occurrence of divSelectDialog git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@17606 594d385d-05f5-0310-b6e9-bd551577e9d8 --- gosa-core/include/class_SnapShotDialog.inc | 40 +++--- gosa-core/include/class_divSelectBox.inc | 141 --------------------- 2 files changed, 21 insertions(+), 160 deletions(-) delete mode 100644 gosa-core/include/class_divSelectBox.inc diff --git a/gosa-core/include/class_SnapShotDialog.inc b/gosa-core/include/class_SnapShotDialog.inc index 88fb6844f..69bef2128 100644 --- a/gosa-core/include/class_SnapShotDialog.inc +++ b/gosa-core/include/class_SnapShotDialog.inc @@ -45,6 +45,17 @@ class SnapShotDialog extends plugin plugin::plugin($config,$dn); $this->parent = &$parent; $this->ui = get_userinfo(); + + // Prepare lists + $this->snapList = new sortableListing(); + $this->snapList->setDeleteable(false); + $this->snapList->setEditable(false); + $this->snapList->setWidth("100%"); + $this->snapList->setHeight("200px"); + $this->snapList->setHeader(array(_("Date"), _("Name") )); + $this->snapList->setColspecs(array('140px','*','60px')); + $this->snapList->setDefaultSortColumn(0); + } @@ -111,8 +122,7 @@ class SnapShotDialog extends plugin $tmp = $this->Available_SnapsShots($this->dn,true); } - $DivListSnapShots = new divSelectBox("SnapShotRestore"); - $DivListSnapShots->SetHeight(180); + $this->snapList->setAcl('rwcdm'); $list_of_elements = array(); @@ -129,28 +139,20 @@ class SnapShotDialog extends plugin /* Add Elements to divlist */ $this->last_list = $list_of_elements; - foreach($list_of_elements as $entry){ - - $actions= " "; - $actions.= " "; + $data = $lData = array(); + foreach($list_of_elements as $entry){ + $actions= image('images/lists/restore.png','RestoreSnapShot_%KEY',_("Restore snapshot")); + $actions.= image('images/lists/trash.png','RemoveSnapShot_%KEY',_("Remove snapshot")); $time_stamp = date(_("Y-m-d, H:i:s"),preg_replace("/\-.*$/","",$entry['gosaSnapshotTimestamp'][0])); $display_data = $entry['description'][0]; - - if($this->display_all_removed_objects){ - $display_data.= " - ".$entry['gosaSnapshotDN'][0]; - } - - $field0 = array("string"=> $time_stamp , "attach"=> "style='vertical-align:top;width:120px;'"); - $field1 = array("string"=> htmlentities (utf8_decode(LDAP::fix($display_data))), "attach"=> ""); - $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)); + $data[$entry['dn']] = $entry; + $lData[$entry['dn']] = array('data'=>array($time_stamp,htmlentities (utf8_decode(LDAP::fix($display_data))),str_replace("%KEY",base64_encode($entry['dn']),$actions))); } - $smarty->assign("SnapShotDivlist",$DivListSnapShots->DrawList()); + $this->snapList->setListData($data, $lData); + $this->snapList->update(); + $smarty->assign("SnapShotDivlist",$this->snapList->render()); $smarty->assign("CountSnapShots",count($list_of_elements)); } diff --git a/gosa-core/include/class_divSelectBox.inc b/gosa-core/include/class_divSelectBox.inc deleted file mode 100644 index 7f7214aec..000000000 --- a/gosa-core/include/class_divSelectBox.inc +++ /dev/null @@ -1,141 +0,0 @@ -s_summary = ""; - $this->a_entries = array(); - $this->cols = 0; - } - - function setHeight($h){ - $this->height=$h; - } - - function AddEntry($a_entriedata) { - $this->a_entries[] = $a_entriedata; - } - - function DrawList(){ - $s_return = ""; - $s_return .= "
\n"; - $s_return .= "
height.";width:100%\">\n"; - $s_return .= "
height)."px;\">\n"; - $s_return .= "\n"; - $s_return.=$this->_generatePage(); - $s_return.= "
"; - return ($s_return); - } - - function _numentries(){ - $cnt = count($this->a_entries); - return $cnt; - } - - function SetSummary($msg){ - $this->s_summary = $msg; - } - - function _generatePage(){ - - $s_value = ""; - $s_key = ""; - $s_return = ""; - $i_alternate=0; - $str = ""; - - /* If divlist is empty, append a single white entry */ - if(count($this->a_entries)==0){ - $str.=" "; - return($str); - } - - $i = $this->_numEntries(); - foreach($this->a_entries as $s_key => $s_value){ - $i--; - - if($i_alternate!=0){ - $i_alternate=0; - } else { - $i_alternate=1; - } - - $s_return .= "\n"; - - $cnt = 0; - - foreach($s_value as $s_key2 => $s_value2 ){ - $this->cols = count($s_value) ; - $cnt++; - - if(!isset($s_value2['class'])){ - $class = "list".$i_alternate; - } else { - $class = $s_value2['class']; - } - - if(!isset($s_value2['attach'])){ - $style = ""; - } else { - $style = " ".$s_value2['attach']." " ; - } - - $s_return .= "\n"; - $s_return .= $s_value2['string']; - $s_return .= ""; - } - $s_return.="\n"; - } - $s_return.="\n"; - for($i = 0 ; $i < ($this->cols) ; $i ++){ - if($i >= ($this->cols-1)){ - $s_return .= "
 
"; - }else{ - $s_return .= "
 
"; - } - - } - $s_return.=""; - return $s_return; - } -} -// vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler: -?> -- 2.30.2