Code

Updated mailAccount to use new dialogs
authorhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Wed, 27 Jan 2010 13:54:34 +0000 (13:54 +0000)
committerhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Wed, 27 Jan 2010 13:54:34 +0000 (13:54 +0000)
git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@15378 594d385d-05f5-0310-b6e9-bd551577e9d8

gosa-plugins/mail/personal/mail/class_mailAccount.inc
gosa-plugins/mail/personal/mail/mailAddressSelect/class_mailAddressSelect.inc [new file with mode: 0644]
gosa-plugins/mail/personal/mail/mailAddressSelect/selectMailAddress-filter.tpl [new file with mode: 0644]
gosa-plugins/mail/personal/mail/mailAddressSelect/selectMailAddress-filter.xml [new file with mode: 0644]
gosa-plugins/mail/personal/mail/mailAddressSelect/selectMailAddress-list.tpl [new file with mode: 0644]
gosa-plugins/mail/personal/mail/mailAddressSelect/selectMailAddress-list.xml [new file with mode: 0644]

index 7ef9e4171214064871fbb76ed1a8bac1b6fa109a..29f21b8087632f54b3ee7736431b4470b50f0310 100644 (file)
@@ -74,7 +74,7 @@ class mailAccount extends plugin
   var $sieveManagementUsed = FALSE;
   var $vacationTemplates = array();
   var $sieve_management = NULL;
-  var $selectMailAddress = FALSE;
+  var $mailAddressSelect = FALSE;
   var $initial_uid    = "";
   var $mailDomainPart = "";
   var $mailDomainParts = array();
@@ -281,18 +281,18 @@ class mailAccount extends plugin
      ****************/
 
     if (isset($_POST['add_local_forwarder'])){
-      $this->selectMailAddress=  new selectMailAddress($this->config, get_userinfo());
+      $this->mailAddressSelect=  new mailAddressSelect($this->config, get_userinfo());
       $this->dialog= TRUE;
     }
-    if (isset($_POST['selectMailAddress_cancel'])){
-      $this->selectMailAddress= FALSE;
+    if (isset($_POST['mailAddressSelect_cancel'])){
+      $this->mailAddressSelect= FALSE;
       $this->dialog= FALSE;
     }
 
-    if (isset($_POST['selectMailAddress_save']) && $this->selectMailAddress instanceOf selectMailAddress){
+    if (isset($_POST['mailAddressSelect_save']) && $this->mailAddressSelect instanceOf mailAddressSelect){
 
       if($this->acl_is_writeable("gosaMailForwardingAddress")){
-        $list = $this->selectMailAddress->save();
+        $list = $this->mailAddressSelect->save();
         foreach ($list as $entry){
           $val = $entry['mail'][0];
           if (!in_array ($val, $this->gosaMailAlternateAddress) && $val != $this->mail){
@@ -300,18 +300,18 @@ class mailAccount extends plugin
             $this->is_modified= TRUE;
           }
         }
-        $this->selectMailAddress= FALSE;
+        $this->mailAddressSelect= FALSE;
         $this->dialog= FALSE;
       } else {
         msg_dialog::display(_("Error"), _("Please select an entry!"), ERROR_DIALOG);
       }
     }
 
-    if($this->selectMailAddress instanceOf selectMailAddress){
+    if($this->mailAddressSelect instanceOf mailAddressSelect){
       $used  = array();
       $used['mail'] = array_values($this->gosaMailAlternateAddress);  
       $used['mail'][] = $this->mail;
-      return($this->selectMailAddress->execute());
+      return($this->mailAddressSelect->execute());
     }
 
     if (isset($_POST['add_forwarder'])){
@@ -344,9 +344,9 @@ class mailAccount extends plugin
     if (isset($_POST['delete_forwarder'])){
       $this->delForwarder ($_POST['forwarder_list']);
     }
-    if ($this->selectMailAddress instanceOf selectMailAddress){
+    if ($this->mailAddressSelect instanceOf mailAddressSelect){
     
-      return($this->selectMailAddress->execute());
+      return($this->mailAddressSelect->execute());
     }
 
 
diff --git a/gosa-plugins/mail/personal/mail/mailAddressSelect/class_mailAddressSelect.inc b/gosa-plugins/mail/personal/mail/mailAddressSelect/class_mailAddressSelect.inc
new file mode 100644 (file)
index 0000000..31e92c5
--- /dev/null
@@ -0,0 +1,64 @@
+<?php
+/*
+ * This code is part of GOsa (http://www.gosa-project.org)
+ * Copyright (C) 2003-2008 GONICUS GmbH
+ *
+ * ID: $$Id: class_groupManagement.inc 14766 2009-11-05 14:30:35Z hickert $$
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ */
+
+class mailAddressSelect extends management
+{
+
+  protected $skipFooter = TRUE;
+  protected $skipHeader = TRUE;
+
+  function __construct($config,$ui)
+  {
+    $this->config = $config;
+    $this->ui = $ui;
+
+    $this->storagePoints = array(get_ou("userRDN"));
+
+#   // Build filter
+#   if (session::global_is_set(get_class($this)."_filter")){
+#     $filter= session::global_get(get_class($this)."_filter");
+#   } else {
+  $filter = new filter(get_template_path("selectMailAddress-filter.xml", true, dirname(__FILE__)));
+  $filter->setObjectStorage($this->storagePoints);
+#   }
+  $this->setFilter($filter);
+
+  // Build headpage
+  $headpage = new listing(get_template_path("selectMailAddress-list.xml", true, dirname(__FILE__)));
+  $headpage->setFilter($filter);
+  parent::__construct($config, $ui, "mail", $headpage);
+  }
+
+  function save()
+  {
+    $act = $this->detectPostActions();
+    $headpage = $this->getHeadpage();
+    if(!isset($act['targets'])) return(array());
+    $ret = array();
+    foreach($act['targets'] as $dn){
+      $ret[] = $headpage->getEntry($dn);
+    }
+    return($ret);
+  }
+} 
+// vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
+?>
diff --git a/gosa-plugins/mail/personal/mail/mailAddressSelect/selectMailAddress-filter.tpl b/gosa-plugins/mail/personal/mail/mailAddressSelect/selectMailAddress-filter.tpl
new file mode 100644 (file)
index 0000000..ba7af5c
--- /dev/null
@@ -0,0 +1,33 @@
+<div class="contentboxh">
+ <p class="contentboxh">
+  <img src="images/launch.png" align="right" alt="[F]">{t}Filter{/t}
+ </p>
+</div>
+
+<div class="contentboxb">
+
+<div style="border-top:1px solid #AAAAAA"></div>
+
+ {$SCOPE}
+
+ <table summary="" style="width:100%;border-top:1px solid #B0B0B0;">
+  <tr>
+   <td>
+    <label for="NAME">
+     <img src="images/lists/search.png" align=middle>&nbsp;Name
+    </label>
+   </td>
+   <td>
+    {$NAME}
+   </td>
+  </tr>
+ </table>
+
+ <table summary=""  width="100%"  style="background:#EEEEEE;border-top:1px solid #B0B0B0;">
+  <tr>
+   <td width="100%" align="right">
+    {$APPLY}
+   </td>
+  </tr>
+ </table>
+</div>
diff --git a/gosa-plugins/mail/personal/mail/mailAddressSelect/selectMailAddress-filter.xml b/gosa-plugins/mail/personal/mail/mailAddressSelect/selectMailAddress-filter.xml
new file mode 100644 (file)
index 0000000..4ae62a4
--- /dev/null
@@ -0,0 +1,45 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<filterdef>
+  <definition>
+    <category>users</category>
+    <template>../plugins/personal/mail/mailAddressSelect/selectMailAddress-filter.tpl</template>
+    <initial>true</initial>
+  </definition>
+
+  <search>
+    <query>
+      <backend>LDAPBlacklist</backend>
+      <filter>(&amp;(objectClass=gosaAccount)(mail=*)$NAME)</filter>
+      <attribute>dn</attribute>
+      <attribute>objectClass</attribute>
+      <attribute>cn</attribute>
+      <attribute>description</attribute>
+      <attribute>mail</attribute>
+      <attribute>uid</attribute>
+      <attribute>sn</attribute>
+      <attribute>givenName</attribute>
+      <attribute>gotoHotplugDevice</attribute>
+    </query>
+    <scope>auto</scope>
+  </search>
+
+  <element>
+    <type>textfield</type>
+    <tag>NAME</tag>
+    <size>20</size>
+    <maxlength>60</maxlength>
+    <default></default>
+    <unset></unset>
+    <set>(|(cn=*$*)(description=*$*)(mail=*$*))</set>
+    <alphabet>true</alphabet>
+    <autocomplete>
+      <backend>LDAPBlacklist</backend>
+      <filter>(&amp;(objectClass=gosaAccount)(|(cn=*$NAME*)(description=*$NAME*)(mail=*$NAME*)))</filter>
+      <attribute>cn</attribute>
+      <frequency>0.5</frequency>
+      <characters>3</characters>
+    </autocomplete>
+  </element>
+
+</filterdef>
diff --git a/gosa-plugins/mail/personal/mail/mailAddressSelect/selectMailAddress-list.tpl b/gosa-plugins/mail/personal/mail/mailAddressSelect/selectMailAddress-list.tpl
new file mode 100644 (file)
index 0000000..7a1c920
--- /dev/null
@@ -0,0 +1,39 @@
+<input type='image' src='images/empty.png' name='no_action_posted' value='do_nothing' alt='' style='width:2px;height:2px;'>
+
+<table summary="" style="width:100%; vertical-align:top; text-align:left;" cellpadding=2>
+  <tr>
+    <td style="vertical-align:top; width:50%;">
+      <div class="contentboxh">
+        <p class="contentboxh">&nbsp;{$HEADLINE}&nbsp;{$SIZELIMIT}</p>
+      </div>
+      
+      <div class="contentboxb">
+       <div style='background:white;padding:3px;'>
+        <table><tr>
+          <td>{$ROOT}&nbsp;</td><td>{$BACK}&nbsp;</td><td>{$HOME}&nbsp;</td><td>{$RELOAD}&nbsp;</td><td>{$SEPARATOR}&nbsp;</td><td>{t}Base{/t} {$BASE}&nbsp;<input class='center' type='image' src='images/lists/submit.png' align='middle' title='{t}Update{/t}' name='submit_department' alt='{t}Submit{/t}'>&nbsp;</td><td>{$SEPARATOR}&nbsp;</td><td><img src='images/rocket.png' alt='' class='center'></td><td> {$ACTIONS}</td>
+        </tr></table>
+       </div>
+      </div>
+      
+      <div style='height:4px;'>
+      </div>
+      
+      <input type="hidden" id="d_save" value="450">
+      <input type="hidden" id="d_space" value="760">
+      {$LIST}
+    </td>
+    <td style='vertical-align:top'>
+      {$FILTER}
+    </td>
+  </tr>
+</table>
+
+<input type="hidden" value="1" name="PosixGroupDialogPosted">
+<p class="plugbottom">
+  <input type=submit name="mailAddressSelect_save" value="{msgPool type=addButton}">
+  &nbsp;
+  <input type=submit name="mailAddressSelect_cancel" value="{msgPool type=cancelButton}">
+</p>
+
+
+<input type="hidden" name="ignore">
diff --git a/gosa-plugins/mail/personal/mail/mailAddressSelect/selectMailAddress-list.xml b/gosa-plugins/mail/personal/mail/mailAddressSelect/selectMailAddress-list.xml
new file mode 100644 (file)
index 0000000..205ccff
--- /dev/null
@@ -0,0 +1,72 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<list>
+  <definition>
+    <departmentBrowser>true</departmentBrowser>
+    <departmentRootVisible>false</departmentRootVisible>
+    <baseMode>true</baseMode>
+    <multiSelect>true</multiSelect>
+    <template>../plugins/personal/mail/mailAddressSelect/selectMailAddress-list.tpl</template>
+    <label>Please select the desired entries</label>
+    <defaultSortColumn>1</defaultSortColumn>
+
+    <objectType>
+      <label>User</label>
+      <objectClass>gosaAccount</objectClass>
+      <category>users</category>
+      <class>user</class>
+      <image>plugins/mail/images/envelope.png</image>
+    </objectType>
+
+
+  </definition>
+
+  <table>
+    <layout>|20px;c||||</layout>
+
+    <department>
+      <value>%{filter:objectType(dn,objectClass)}</value>
+    </department>
+
+    <department>
+      <value>%{filter:departmentLink(row,dn,description)}</value>
+      <span>2</span>
+    </department>
+
+    <column>
+      <value>%{filter:objectType(dn,objectClass)}</value>
+    </column>
+
+    <column>
+      <label>givename</label>
+      <sortAttribute>givenName</sortAttribute>
+      <sortType>string</sortType>
+      <value>%{givenName}</value>
+      <export>true</export>
+    </column>
+
+    <column>
+      <label>surename</label>
+      <sortAttribute>sn</sortAttribute>
+      <sortType>string</sortType>
+      <value>%{sn}</value>
+      <export>true</export>
+    </column>
+
+    <column>
+      <label>mail</label>
+      <sortAttribute>mail</sortAttribute>
+      <sortType>string</sortType>
+      <value>%{mail}</value>
+      <export>true</export>
+    </column>
+
+  </table>
+
+  <actionmenu>
+  </actionmenu>
+
+  <actiontriggers snapshot="false" copypaste="false">
+  </actiontriggers>
+
+</list>