1 <?php
3 class divListBlocklist extends MultiSelectWindow
4 {
6 /* Current base */
7 var $selectedBase = "";
8 var $departments = array();
10 /* Regex */
11 var $Regex = "*";
13 /* checkboxes */
14 var $ShowSendBocklists ;
15 var $ShowReceiveBlocklists ;
17 /* Subsearch checkbox */
18 var $SubSearch;
20 var $parent ;
21 var $ui ;
23 function divListBlocklist ($config,$parent)
24 {
25 MultiSelectWindow::MultiSelectWindow($config,"Blocklists");
27 $this->parent = $parent;
28 $this->ui = get_userinfo();
30 /* Set list strings */
31 $this->SetTitle(_("List of blocklists"));
32 $this->SetSummary(_("List of blocklists"));
34 /* Result page will look like a headpage */
35 $this->SetHeadpageMode();
36 $this->SetInformation(_("This menu allows you to create, delete and edit selected blocklists. ".
37 "Having a large size of lists, you might prefer the range selectors on top of the select box."));
39 $this->EnableAplhabet (true);
41 /* Disable buttonsm */
42 $this->EnableCloseButton(false);
43 $this->EnableSaveButton (false);
45 /* set Page header */
46 $this->AddHeader(array("string" => " ", "attach" => "style='text-align:center;width:20px;'"));
47 $this->AddHeader(array("string" => _("Blocklist name")." / "._("Department"), "attach" => "style=''"));
48 $this->AddHeader(array("string" => _("Actions"), "attach" => "style='width:60px;border-right:0px;text-align:right;'" ));
50 /* Add Checkboxes / SubSearch checkbox */
51 $this->AddCheckBox("ShowSendBocklists" , _("Select to see send blocklists"), _("Show send blocklists"),true);
52 $this->AddCheckBox("ShowReceiveBlocklists" , _("Select to see receive blocklists"), _("Show receive blocklists"),true);
54 $this->AddCheckBox(SEPERATOR);
55 $this->AddCheckBox("SubSearch", _("Select to search within subtrees"), _("Ignore subtrees"), false);
57 /* Name ,Text ,Default , Connect with alphabet */
58 $this->AddRegex ("Regex", _("Regular expression for matching list names"),"*" , true);
59 }
61 function GenHeader()
62 {
63 /* Prepare departments,
64 which are shown in the listbox on top of the listbox
65 */
66 $options= "";
67 foreach ($this->config->idepartments as $key => $value){
68 if ($this->selectedBase == $key){
69 $options.= "<option selected='selected' value='$key'>$value</option>";
70 } else {
71 $options.= "<option value='$key'>$value</option>";
72 }
73 }
75 /* NEW LIST MANAGMENT */
76 $listhead = "<div style='background:#F0F0F9;padding:5px;'>".
77 " <input class='center' type='image' src='images/list_root.png' align='middle'
78 title='"._("Go to root department")."' name='dep_root' alt='". _("Root")."'> ".
79 " <input class='center' type='image' align='middle' src='images/list_back.png'
80 title='"._("Go up one department")."' alt='"._("Up")."' name='dep_back'> ".
81 " <input class='center' type='image' align='middle' src='images/list_home.png'
82 title='"._("Go to users department")."' alt='"._("Home")."' name='dep_home'> ".
83 " <input class='center' type='image' src='images/list_reload.png' align='middle'
84 title='"._("Reload list")."' name='submit_department' alt='". _("Submit")."'> ".
85 " <img class='center' src='images/list_seperator.png' align='middle' alt='' height='16' width='1'> ".
86 " <input class='center' type='image' align='middle' src='images/list_new_blocklist.png'
87 title='"._("Create new blocklist")."' alt='"._("New Blocklist")."' name='user_new'> ".
88 " <img class='center' src='images/list_seperator.png' align='middle' alt='' height='16' width='1'>".
89 " "._("Base")." <select name='CurrentMainBase' onChange='mainform.submit()' class='center'>$options</select>".
90 " <input class='center' type='image' src='images/list_submit.png' align='middle'
91 title='"._("Submit department")."' name='submit_department' alt='"._("Submit")."'> ".
92 "</div>";
94 $this->SetListHeader($listhead);
95 }
97 function execute()
98 {
99 $this->ClearElementsList();
100 $this->GenHeader();
101 }
103 function setEntries($list)
104 {
105 $action= "<input class='center' type='image' src='images/edit.png' alt='"._("edit")."' name='user_edit_%KEY%' title='"._("Edit user")."'>";
106 $action.= "<input class='center' type='image' src='images/edittrash.png' alt='"._("delete")."' name='user_del_%KEY%' title='"._("Delete user")."'>";
108 // User and Template Images
109 $blockimg = "<img class='center' src='images/list_blocklist.png' alt='User' title='%s'>";
110 $editlink = "<a href='?plug=".$_GET['plug']."&id=%s&act=edit_entry'>%s</a>";
112 /* Append to list */
113 foreach($list as $key => $val){
114 // Generate Array to Add
115 $display= "[".$val["cn"][0]."]";
116 $field1 = array("string" => sprintf($blockimg,$val['dn']), "attach" => "style='text-align:center;width:20px;'");
117 $field2 = array("string" => sprintf($editlink,$key,$display), "attach" => "style='' title='dn: ".@LDAP::fix($val['dn'])."'");
118 $field3 = array("string" => preg_replace("/%KEY%/", "$key", $action), "attach" => "style='width:60px;border-right:0px;text-align:right;'");
119 $this->AddElement( array($field1,$field2,$field3));
120 }
121 }
123 function Save()
124 {
125 MultiSelectWindow :: Save();
126 }
128 function save_object()
129 {
130 /* Save automatic created POSTs like regex, checkboxes */
131 MultiSelectWindow :: save_object();
132 }
133 }
134 // vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
135 ?>