X-Git-Url: https://git.tokkee.org/?a=blobdiff_plain;f=plugins%2Fadmin%2Fogroups%2Fclass_mailogroup.inc;h=1040dc626a0269fb76e3709574f24860acc9f09f;hb=bda4c3aedb1c60fd9945d73a8b589468602bc685;hp=b99206146a930cede0354d27a5708ad654a3ebd4;hpb=2304649c2c57b79131339b8bd6fa6359a87de877;p=gosa.git diff --git a/plugins/admin/ogroups/class_mailogroup.inc b/plugins/admin/ogroups/class_mailogroup.inc index b99206146..1040dc626 100644 --- a/plugins/admin/ogroups/class_mailogroup.inc +++ b/plugins/admin/ogroups/class_mailogroup.inc @@ -10,11 +10,11 @@ class mailogroup extends plugin var $attributes= array("mail"); var $objectclasses= array("kolabGroupOfNames"); var $members= array(); + var $view_logged = FALSE; - - function mailogroup ($config, $dn= NULL) + function mailogroup ($config, $dn= NULL, $parent= NULL) { - plugin::plugin($config, $dn); + plugin::plugin($config, $dn, $parent); /* Include config object */ $this->config= $config; @@ -26,21 +26,31 @@ class mailogroup extends plugin function execute() { - /* Call parent execute */ - plugin::execute(); + /* Call parent execute */ + plugin::execute(); + + if($this->is_account && !$this->view_logged){ + $this->view_logged = TRUE; + new log("view","ogroups/".get_class($this),$this->dn); + } + /* Do we need to flip is_account state? */ - if (isset($_POST['modify_state'])){ - $this->is_account= !$this->is_account; + if(isset($_POST['modify_state'])){ + if($this->is_account && $this->acl_is_removeable()){ + $this->is_account= FALSE; + }elseif(!$this->is_account && $this->acl_is_createable()){ + $this->is_account= TRUE; + } } /* Show tab dialog headers */ if ($this->parent != NULL){ if ($this->is_account){ - $display= $this->show_header(_("Remove mail account"), + $display= $this->show_disable_header(_("Remove mail account"), _("This group has mail features enabled. You can disable them by clicking below.")); } else { - $display= $this->show_header(_("Create mail account"), _("This group has mail features disabled. You can enable them by clicking below.")); + $display= $this->show_enable_header(_("Create mail account"), _("This group has mail features disabled. You can enable them by clicking below.")); return ($display); } } @@ -48,9 +58,13 @@ class mailogroup extends plugin /* Initialize templating engine */ $smarty= get_smarty(); + $tmp = $this->plInfo(); + foreach($tmp['plProvidedAcls'] as $name => $translation){ + $smarty->assign($name."ACL",$this->getacl("mail")); + } + /* Assign mail attribute */ $smarty->assign("mail", $this->mail); - $smarty->assign("mailACL", chkacl($this->acl, "mail")); /* Show main page */ return ($display.$smarty->fetch (get_template_path('mail.tpl', TRUE))); @@ -60,7 +74,8 @@ class mailogroup extends plugin /* Check formular input */ function check() { - $message= array(); + /* Call common method to give check the hook */ + $message= plugin::check(); if ($this->is_account){ $ldap= $this->config->get_ldap_link(); @@ -72,7 +87,7 @@ class mailogroup extends plugin /* 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")); + $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."); } @@ -92,14 +107,20 @@ class mailogroup extends plugin /* Save data to LDAP */ $ldap->cd($this->dn); $this->cleanup(); -$ldap->modify ($this->attrs); + $ldap->modify ($this->attrs); - show_ldap_error($ldap->get_error()); + if($this->initially_was_account){ + new log("modify","ogroups/".get_class($this),$this->dn,array_keys($this->attrs),$ldap->get_error()); + }else{ + new log("create","ogroups/".get_class($this),$this->dn,array_keys($this->attrs),$ldap->get_error()); + } + + show_ldap_error($ldap->get_error(), sprintf(_("Saving of object group/mail with dn '%s' failed."),$this->dn)); /* Optionally execute a command after we're done */ if ($this->initially_was_account == $this->is_account){ if ($this->is_modified){ - $this->handle_post_events("mofify"); + $this->handle_post_events("modify"); } } else { $this->handle_post_events("add"); @@ -125,11 +146,53 @@ $ldap->modify ($this->attrs); $this->attributes, "Save"); $ldap->cd($this->dn); $this->cleanup(); -$ldap->modify ($this->attrs); + $ldap->modify ($this->attrs); + + new log("remove","ogroups/".get_class($this),$this->dn,array_keys($this->attrs),$ldap->get_error()); + + show_ldap_error($ldap->get_error(), sprintf(_("Removing of object group/mail with dn '%s' failed."),$this->dn)); + } + - show_ldap_error($ldap->get_error()); + function getCopyDialog() + { + $str = ""; + $smarty = get_smarty(); + $smarty->assign("mail", $this->mail); + $str = $smarty->fetch(get_template_path("paste_mail.tpl",TRUE,dirname(__FILE__))); + $ret = array(); + $ret['string'] = $str; + $ret['status'] = ""; + return($ret); } + + function saveCopyDialog() + { + if(isset($_POST['mail'])){ + $this->mail = $_POST['mail']; + } + } + + + function plInfo() + { + return (array( + "plShortName" => _("Mail"), + "plDescription" => _("Mail group"), + "plSelfModify" => FALSE, + "plDepends" => array(), + "plPriority" => 4, + "plSection" => array("administration"), + "plCategory" => array("ogroups"), + "plProvidedAcls"=> array( + "mail" => _("Mail address")) + )); + } + + + + } // vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler: