1 <?php
3 class divListACL extends MultiSelectWindow
4 {
6 /* Current base */
7 var $selectedBase = "";
8 var $departments = array();
10 /* Regex */
11 var $Regex = "*";
13 /* CheckBoxes */
15 /* Subsearch checkbox */
16 var $SubSearch = false;
18 var $parent ;
19 var $ui ;
21 function divListACL ($config,$parent)
22 {
23 MultiSelectWindow::MultiSelectWindow($config,"ACLs");
25 $this->parent = $parent;
26 $this->ui = get_userinfo();
28 /* Set list strings */
29 $this->SetTitle(_("List of acl"));
30 $this->SetSummary(_("List of acls"));
32 /* Result page will look like a headpage */
33 $this->SetHeadpageMode();
34 $this->SetInformation(_("This menu allows you to edit and delete selected acls."));
36 $this->EnableAplhabet (true);
38 /* Disable buttonsm */
39 $this->EnableCloseButton(false);
40 $this->EnableSaveButton (false);
42 /* Dynamic action col, depending on snapshot icons */
43 $action_col_size = 80;
45 /* set Page header */
46 $this->AddHeader(array("string"=>" ", "attach"=>"style='width:20px;'"));
47 $this->AddHeader(array("string"=>_("Summary")));
48 $this->AddHeader(array("string"=>_("Actions"), "attach" => "style='width:".$action_col_size."px;border-right:0px;text-align:right;'"));
50 /* Add SubSearch checkbox */
51 // $this->AddCheckBox(SEPERATOR);
52 $this->AddCheckBox("SubSearch", _("Select to search within subtrees"), _("Ignore subtrees"), false);
54 /* Name ,Text ,Default , Connect with alphabet */
55 $this->AddRegex ("Regex", _("Display acls matching"),"Not implemented yet" , true);
56 }
59 function GenHeader()
60 {
61 /* Prepare departments,
62 which are shown in the listbox on top of the listbox
63 */
64 $options= "";
65 foreach ($this->config->idepartments as $key => $value){
66 if ($this->selectedBase == $key){
67 $options.= "<option selected='selected' value='$key'>$value</option>";
68 } else {
69 $options.= "<option value='$key'>$value</option>";
70 }
71 }
73 /* Create header with selected base */
74 $listhead = "<div style='background:#F0F0F9;padding:5px;'>".
75 " <input class='center' type='image' src='images/list_root.png' align='middle'
76 title='"._("Go to root department")."' name='dep_root' alt='"._("Root")."'> ".
77 " <input class='center' type='image' align='middle' src='images/list_back.png'
78 title='"._("Go up one department")."' alt='"._("Up")."' name='dep_back'> ".
79 " <input class='center' type='image' align='middle' src='images/list_home.png'
80 title='"._("Go to users department")."' alt='"._("Home")."' name='dep_home'> ".
81 " <input class='center' type='image' src='images/list_reload.png' align='middle'
82 title='"._("Reload list")."' name='submit_department' alt='". _("Submit")."'> ".
83 " <img class='center' src='images/list_seperator.png' align='middle' alt='' height='16' width='1'> ";
84 $listhead .= $this->get_snapshot_header($this->selectedBase);
85 $listhead .=
86 _("Base")." <select name='CurrentMainBase' onChange='mainform.submit()' class='center'>$options</select>".
87 " <input class='center' type='image' src='images/list_submit.png' align='middle'
88 title='"._("Submit department")."' name='submit_department' alt='". _("Submit")."'> ".
89 "</div>";
91 $this->SetListHeader($listhead);
92 }
94 /* so some basic settings */
95 function execute()
96 {
97 $this->ClearElementsList();
98 $this->GenHeader();
99 }
101 function setEntries($list)
102 {
103 $list_left_icon = "<img src='images/select_acl.png' alt='"._("Acl")."'>";
105 foreach($list as $key => $acl_entry){
107 $action = "<input class='center' type='image' src='images/edit.png' alt='"._("edit")."' name='acl_edit_%KEY%' title='"._("Edit system")."'>";
108 $action.= $this->GetSnapShotActions($acl_entry['dn']);
109 $action.= "<input class='center' type='image' src='images/edittrash.png' alt='"._("delete")."' name='acl_del_%KEY%' title='"._("Delete system")."'>";
111 $field1 = array("string" => $list_left_icon, "attach"=> "style='text-align:center;width:20px;'");
112 $field2 = array("string" => htmlentities(utf8_decode($acl_entry['dn'])),"attach" => "");
113 $field3 = array("string" => preg_replace("/%KEY%/",$key,$action), "attach"=> "style='text-align:center;width:80px;border-right:0px;'");
115 $this->AddElement(array($field1,$field2,$field3));
116 }
117 }
119 function Save()
120 {
121 MultiSelectWindow :: Save();
122 }
124 function save_object()
125 {
126 /* Save automatic created POSTs like regex, checkboxes */
127 MultiSelectWindow::save_object();
128 }
129 }
130 // vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
131 ?>