From e3aaed2c7109d4d6fcd14fa87c1d4c27b638097e Mon Sep 17 00:00:00 2001 From: hickert Date: Thu, 10 Nov 2005 13:22:42 +0000 Subject: [PATCH] Added new ListBox to FaxAccount Blocklists git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@1907 594d385d-05f5-0310-b6e9-bd551577e9d8 --- .../gofax/faxaccount/class_gofaxAccount.inc | 91 ++++++++++++++----- plugins/gofax/faxaccount/lists.tpl | 28 +++--- 2 files changed, 81 insertions(+), 38 deletions(-) diff --git a/plugins/gofax/faxaccount/class_gofaxAccount.inc b/plugins/gofax/faxaccount/class_gofaxAccount.inc index 2ec35c9ea..69f71772d 100644 --- a/plugins/gofax/faxaccount/class_gofaxAccount.inc +++ b/plugins/gofax/faxaccount/class_gofaxAccount.inc @@ -210,6 +210,15 @@ class gofaxAccount extends plugin reset($this->current_blocklist); } + /* Add list to blocklist */ + if (isset($_GET['add'])){ + if(!is_array($this->current_blocklist)) $this->current_blocklist=array(); + $this->current_blocklist= array_merge($this->current_blocklist, array( base64_decode($_GET['add']))); + $this->current_blocklist= array_unique($this->current_blocklist); + sort($this->current_blocklist); + reset($this->current_blocklist); + } + /* Delete from blocklist */ if (isset($_POST['delete_blocklist_number']) && isset($_POST['block_list'])){ $tmp= array(); @@ -221,33 +230,39 @@ class gofaxAccount extends plugin $this->current_blocklist= $tmp; } - /* Blocklist edit finished */ + + /* Blocklist edit finished */ if (isset($_POST['edit_blocklists_finish'])){ /* Incoming or outgoing? */ if ($this->in_blocklist_dialog){ - $destlist="goFaxRBlocklist"; - $destgroup="goFaxRBlockgroups"; + $this->goFaxRBlocklist = array(); + $this->goFaxRBlockgroups = array(); + + foreach ($this->current_blocklist as $val){ + if (is_phone_nr($val)){ + $this->goFaxRBlocklist[]=$val; + } else { + $this->goFaxRBlockgroups[]= $val; + } + } } else { - $destlist="goFaxSBlocklist"; - $destgroup="goFaxSBlockgroups"; - } - - /* Transfer values to ourself */ - $this->$destlist= array(); - $this->$destgroup= array(); - - foreach ($this->current_blocklist as $val){ - if (is_phone_nr($val)){ - array_push($this->$destlist, $val); - } else { - array_push($this->$destgroups, $val); + $this->goFaxSBlocklist = array(); + $this->goFaxSBlockgroups = array(); + + /* Transfer values to ourself */ + foreach ($this->current_blocklist as $val){ + if (is_phone_nr($val)){ + $this->goFaxSBlocklist[]=$val; + } else { + $this->goFaxSBlockgroups[]= $val; + } } } - $this->is_modified= TRUE; } + /* Set departments */ if ($this->locals_dialog || $this->in_blocklist_dialog || @@ -304,6 +319,7 @@ class gofaxAccount extends plugin $base= $faxfilter['depselect']; $acl= array($this->config->current['BASE'] => ":all"); + print "(&(objectClass=goFaxAccount)$filter)"; $res= get_list($acl, "(&(objectClass=goFaxAccount)$filter)", TRUE, $base, array("sn", "givenName", "facsimileTelephoneNumber"), TRUE); foreach ($res as $attrs){ @@ -313,6 +329,9 @@ class gofaxAccount extends plugin $attrs['facsimileTelephoneNumber'][0]."]"; } + + + /* Show dialog */ $smarty->assign("search_image", get_template_path('images/search.png')); $smarty->assign("usearch_image", get_template_path('images/search_user.png')); @@ -336,21 +355,37 @@ class gofaxAccount extends plugin $display.= $smarty->fetch (get_template_path('locals.tpl', TRUE, dirname(__FILE__))); return ($display); } - + + /* Manage incoming blocklists */ if ($this->in_blocklist_dialog){ - $ldap->search ("(objectClass=goFaxRBlock)"); + $ldap->search ("(objectClass=goFaxRBlock)",array("cn","description")); while ($attrs= $ldap->fetch()){ $list[$attrs['cn'][0]]= $attrs['description'][0]. " [".$attrs['cn'][0]."]"; } + $divSel = new divSelectBox("divSelectPredefined"); + $divSel->setHeight(300); + $divSel->setWidth(350); + + foreach($list as $entry => $value){ + $divSel->AddEntry(array( + array("string"=>" + <"._("Add").""), + array("string"=>$entry), + array("string"=>$value,"attach"=>"style='border:0px;'") + )); + } + + + /* Show dialog */ $smarty->assign("cblocklist", $this->current_blocklist); $smarty->assign("goFaxBlockListACL", chkacl($this->acl, "goFaxBlockList")); $smarty->assign("departments", $this->config->idepartments); - $smarty->assign("list", $list); + $smarty->assign("divSelectPredefined", $divSel->DrawList()); if (isset($_POST['department'])){ $smarty->assign("department", $_POST['department']); @@ -376,11 +411,25 @@ class gofaxAccount extends plugin } } + $divSel = new divSelectBox("divSelectPredefined"); + $divSel->setHeight(300); + $divSel->setWidth(350); + + foreach($list as $entry => $value){ + $divSel->AddEntry(array( + array("string"=>" + <"._("Add").""), + array("string"=>$entry), + array("string"=>$value,"attach"=>"style='border:0px;'") + )); + } + + /* Show dialog */ $smarty->assign("cblocklist", $this->current_blocklist); $smarty->assign("goFaxBlockListACL", chkacl($this->acl, "goFaxBlockList")); $smarty->assign("departments", $this->config->idepartments); - $smarty->assign("list", $list); + $smarty->assign("divSelectPredefined", $divSel->DrawList()); if (isset($_POST['department'])){ $smarty->assign("department", $_POST['department']); } else { diff --git a/plugins/gofax/faxaccount/lists.tpl b/plugins/gofax/faxaccount/lists.tpl index 8b07df753..293cd3db1 100644 --- a/plugins/gofax/faxaccount/lists.tpl +++ b/plugins/gofax/faxaccount/lists.tpl @@ -1,3 +1,4 @@ + - -
@@ -12,23 +13,16 @@   - - - {t}Select a specific department{/t}
- -
-
- - - {t}List of predefined blocklists{/t} - +
+ {t}List of predefined blocklists{/t}
+ + + + +
+ {$divSelectPredefined} +
+
-- 2.30.2