Code

Added new ListBox to FaxAccount Blocklists
authorhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Thu, 10 Nov 2005 13:22:42 +0000 (13:22 +0000)
committerhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Thu, 10 Nov 2005 13:22:42 +0000 (13:22 +0000)
git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@1907 594d385d-05f5-0310-b6e9-bd551577e9d8

plugins/gofax/faxaccount/class_gofaxAccount.inc
plugins/gofax/faxaccount/lists.tpl

index 2ec35c9ea3efb75b856c260b4f407fa13c7bf87f..69f71772dc2349bff6d0f1229745a11f12f8cfab 100644 (file)
@@ -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"=>"<a href='?plug=".$_GET['plug']."&add=".base64_encode($entry)."'>
+                                            <img src='images/back.png' border=0 alt='<'>"._("Add")."</a>"),
+                            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"=>"<a href='?plug=".$_GET['plug']."&add=".base64_encode($entry)."'>
+                                            <img src='images/back.png' border=0 alt='<'>"._("Add")."</a>"),
+                            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 {
index 8b07df75308e054baf396e04f6f86d4dac2a645c..293cd3db1e74b2c35cc613f6f627467cd7081ea4 100644 (file)
@@ -1,3 +1,4 @@
+
 <table summary="" style="width:100%; vertical-align:top; text-align:left;" cellpadding=4 border=0>
  <tr>
   <td> 
    <input type=submit value="{t}Add{/t}" name="add_blocklist_number" {$goFaxBlockListACL}>&nbsp;
    <input type=submit value="{t}Delete{/t}" name="delete_blocklist_number" {$goFaxBlockListACL}>
   </td>
-  <td style="vertical-align:middle; text-align:center;">
-   <input type=submit value="< {t}Add{/t}" name="add_blocklist" {$goFaxBlockListACL}>
-  </td>
-  <td style="vertical-align:top;">
-   <b>{t}Select a specific department{/t}</b><br>
-   <select name="department" size=1 onChange="mainform.submit()">
-    {html_options options=$departments selected=$department}
-   </select>
-   <br>
-   <br>
-   <input type=submit name="goButton" value="{t}Choose{/t}">
-
-   <b>{t}List of predefined blocklists{/t}</b>
-   <select style="width:350px; height:250px;" name="predefined_list[]" size=15 multiple>
-        {html_options values=$list}
-               <option disabled>&nbsp;</option>
-   </select>
+  <td>
+       <b>{t}List of predefined blocklists{/t}</b><br>
+       <table height="300" width="300">
+               <tr>
+                       <td>
+                                       {$divSelectPredefined}
+                       </td>
+               </tr>
+       </table>
+   <input type=submit value="{t}Add the list to the blocklists{/t}" name="add_blocklist" {$goFaxBlockListACL}><br>
   </td>
  </tr>
 </table>