Code

Updated css und div framework.
[gosa.git] / plugins / admin / ogroups / class_mailogroup.inc
index b111909422cd8d26f39e86327aed189c067b218a..769b913cf4193170f7bb0a6a862065c0996f2980 100644 (file)
@@ -12,9 +12,9 @@ class mailogroup extends plugin
   var $members= array();
 
 
-  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,25 @@ class mailogroup extends plugin
 
   function execute()
   {
-       /* Call parent execute */
-       plugin::execute();
+    /* Call parent execute */
+    plugin::execute();
 
     /* 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 +52,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)));
@@ -73,7 +81,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.");
       }
@@ -100,7 +108,7 @@ class mailogroup extends plugin
     /* 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");
@@ -134,10 +142,14 @@ class mailogroup extends plugin
 
   function getCopyDialog()
   {
-    $str  = "";
-    $str .= _("Phone number");
-    $str .= "&nbsp;<input type='text' name='mail' value='".$this->mail."'>";
-    return($str);
+    $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);
   }
 
 
@@ -149,14 +161,14 @@ class mailogroup extends plugin
   }
 
 
-     function plInfo()
+   function plInfo()
   {
     return (array(
           "plShortName"   => _("Mail"),
           "plDescription" => _("Mail group"),
           "plSelfModify"  => FALSE,
           "plDepends"     => array(),
-          "plPriority"    => 0,
+          "plPriority"    => 4,
           "plSection"     => array("administration"),
           "plCategory"    => array("ogroups"),
           "plProvidedAcls"=> array(