Code

Added mail functionality to support kolab distribution lists.
[gosa.git] / plugins / admin / ogroups / class_mailogroup.inc
1 <?php
3 class mailogroup extends plugin
4 {
5   /* plugin specific values */
6   var $mail= "";
7   var $cn= "";
9   /* attribute list for save action */
10   var $attributes= array("mail");
11   var $objectclasses= array("kolabGroupOfNames");
13   var $members= array();
15   function mailogroup ($config, $dn= NULL)
16   {
17     plugin::plugin($config, $dn);
19     /* Include config object */
20     $this->config= $config;
21   }
23   function execute()
24   {
25     /* Initialize templating engine */
26     $smarty= get_smarty();
28     /* Assign mail attribute */
29     $smarty->assign("mail", $this->mail);
30     $smarty->assign("mailACL", chkacl($this->acl, "mail"));
32     /* Show main page */
33     return ($smarty->fetch (get_template_path('mail.tpl', TRUE)));
34   }
36   /* Check formular input */
37   function check()
38   {
39     $ldap= $this->config->get_ldap_link();
41     $message= array();
43     /* Check if mail address is valid */
44     if (!is_email($this->mail)){
45       $message[]= _("Please enter a valid email address in 'Primary address' field.");
46     }
48     /* Check if mail address is already in use */
49     $ldap->cd($this->config->current['BASE']);
50     $ldap->search ("(&(!(objectClass=gosaUserTemplate))(|(mail=".$this->mail.         ")(gosaMailAlternateAddress=".$this->mail."))(!(cn=".$this->cn.")))", array("uid"));
51     if ($ldap->count() != 0){
52       $message[]= _("The primary address you've entered is already in use.");
53     }
54  
56     return ($message);
57   }
59 }
61 // vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
62 ?>