From: cajus Date: Fri, 24 Jun 2005 13:42:42 +0000 (+0000) Subject: Added mail functionality to support kolab distribution lists. X-Git-Url: https://git.tokkee.org/?a=commitdiff_plain;h=80ddd3991dd84b50ff87a05f26eae3b6e32a52a2;p=gosa.git Added mail functionality to support kolab distribution lists. TODO: Check if mail method is set to "kolab" before displaying this tab! git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@854 594d385d-05f5-0310-b6e9-bd551577e9d8 --- diff --git a/plugins/admin/ogroups/class_mailogroup.inc b/plugins/admin/ogroups/class_mailogroup.inc new file mode 100644 index 000000000..699934f3f --- /dev/null +++ b/plugins/admin/ogroups/class_mailogroup.inc @@ -0,0 +1,62 @@ +config= $config; + } + + function execute() + { + /* Initialize templating engine */ + $smarty= get_smarty(); + + /* Assign mail attribute */ + $smarty->assign("mail", $this->mail); + $smarty->assign("mailACL", chkacl($this->acl, "mail")); + + /* Show main page */ + return ($smarty->fetch (get_template_path('mail.tpl', TRUE))); + } + + /* Check formular input */ + function check() + { + $ldap= $this->config->get_ldap_link(); + + $message= array(); + + /* Check if mail address is valid */ + if (!is_email($this->mail)){ + $message[]= _("Please enter a valid email address in 'Primary address' field."); + } + + /* Check if mail address is already in use */ + $ldap->cd($this->config->current['BASE']); + $ldap->search ("(&(!(objectClass=gosaUserTemplate))(|(mail=".$this->mail. ")(gosaMailAlternateAddress=".$this->mail."))(!(cn=".$this->cn.")))", array("uid")); + if ($ldap->count() != 0){ + $message[]= _("The primary address you've entered is already in use."); + } + + + return ($message); + } + +} + +// vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler: +?> diff --git a/plugins/admin/ogroups/class_termgroup.inc b/plugins/admin/ogroups/class_termgroup.inc index 76b54705a..fe7b1611f 100644 --- a/plugins/admin/ogroups/class_termgroup.inc +++ b/plugins/admin/ogroups/class_termgroup.inc @@ -36,6 +36,10 @@ class termgroup extends plugin $this->config= $config; } + function check() + { + } + function execute() { diff --git a/plugins/admin/ogroups/mail.tpl b/plugins/admin/ogroups/mail.tpl new file mode 100644 index 000000000..18c0e1831 --- /dev/null +++ b/plugins/admin/ogroups/mail.tpl @@ -0,0 +1,23 @@ + + + + + + + +
+

{t}Mail distribution list{/t}

+ + + + + +
{t}Primary address{/t}{$must}
+
+ + + diff --git a/plugins/admin/ogroups/tabs_ogroups.inc b/plugins/admin/ogroups/tabs_ogroups.inc index 96c190d34..348e316d7 100644 --- a/plugins/admin/ogroups/tabs_ogroups.inc +++ b/plugins/admin/ogroups/tabs_ogroups.inc @@ -20,6 +20,15 @@ class ogrouptabs extends tabs $this->by_object['termgroup']= new termgroup($this->config, $this->dn); $this->by_object['termgroup']->parent= &$this; + break; + + case "U": + /* Add a user tab used for mail distribution lists */ + require_once("class_mailogroup.inc"); + $this->by_name['mailogroup']= _("Mail"); + $this->by_object['mailogroup']= new mailogroup($this->config, $this->dn); + $this->by_object['mailogroup']->parent= &$this; + break; } } @@ -31,6 +40,29 @@ class ogrouptabs extends tabs } + function save_object($save_current= FALSE) + { + tabs::save_object($save_current); + + /* Update reference, transfer variables */ + $baseobject= $this->by_object['ogroup']; + foreach ($this->by_object as $name => $obj){ + + /* Don't touch base object */ + if ($name != 'ogroup'){ + $obj->parent= &$this; + $obj->uid= $baseobject->uid; + $obj->sn= $baseobject->uid; + $obj->givenName= $baseobject->uid; + $this->by_object[$name]= $obj; + } + + /* Update parent in base object */ + $this->by_object['ogroup']->parent= &$this; + } + } + + function save() { $baseobject= $this->by_object['ogroup']; @@ -55,6 +87,7 @@ class ogrouptabs extends tabs if ($this->dn == "new"){ $this->dn= 'cn='.$baseobject->cn.','.get_groups_ou().$baseobject->base; } + tabs::save(TRUE); }