Code

Replaced "mofify" in handle_post_events(mofify) with "modify".
[gosa.git] / plugins / admin / systems / class_servKolab.inc
index 8c4d86192eae82b05af5ab33fc15f3e91e30fcc6..a2c9ffef71e4fad997bed7878304d7396d16268a 100644 (file)
@@ -104,27 +104,6 @@ class servkolab extends plugin {
                     chkacl($this->acl, 'cyrus_quotawarn'));
     $quotastr   = sprintf(_("Warn users when using more than %s%% of their mail quota"), $edit);
 
-
-    /***************  
-      Handle Account is_account state
-     ***************/  
-  
-    /* Do we need to flip is_account state? */
-    if (isset($_POST['modify_state'])) {
-      $this->is_account = !$this->is_account;
-    }
-
-    /* Show tab dialog headers */
-    if ($this->is_account) {
-      /* call Add Acoount to add account */
-      $display = $this->show_header(_("Remove Kolab extension"), _("This server has kolab features enabled. You can disable them by clicking below."));
-    } else {
-      /* call remove Account */
-      $display = $this->show_header(_("Add Kolab service"), _("This server has kolab features disabled. You can enable them by clicking below."));
-      return ($display);
-    }
-
-
     /***************
       Assign informations to smarty 
      ***************/
@@ -160,6 +139,14 @@ class servkolab extends plugin {
 
   function remove_from_parent() 
   {
+
+     /* Remove status flag, it is not a memeber of
+        this->attributes, so ensure that it is deleted too */
+    if(!empty($this->StatusFlag)){
+      $this->attrs[$this->StatusFlag] = array();
+    }
+
+
     /* Only walk through following code, if this host 
        was a member of the kolab hosts, else skip this */
     if(!$this->initially_was_account){
@@ -201,7 +188,7 @@ class servkolab extends plugin {
 
       /* Remove complete entry */
       $ldap->rmdir ($this->dn);
-      show_ldap_error($ldap->get_error(), _("Removing kolab host entry failed"));
+      show_ldap_error($ldap->get_error(), sprintf(_("Removing host entry from system server/kolab with dn '%s' failed."),$this->dn));
       gosa_log("k=kolab entry removed, ".$this->hostname." was the last kolabHost entry.");
 
     } else {
@@ -217,7 +204,7 @@ class servkolab extends plugin {
       $ldap->cd($this->dn);
       $this->cleanup();
       $ldap->modify ($attrs); 
-      show_ldap_error($ldap->get_error(), _("Removing server from kolab object failed"));
+      show_ldap_error($ldap->get_error(), sprintf(_("Removing host entry from system server/kolab with dn '%s' failed."),$this->dn));
       gosa_log("Removing ".$this->hostname." from list of kolabHosts");
     }
 
@@ -342,12 +329,12 @@ class servkolab extends plugin {
     $ldap->cd($this->dn);
     $this->cleanup();;
     $ldap->$mode($this->attrs);
-    show_ldap_error($ldap->get_error(), _("Saving server to kolab object failed"));
+    show_ldap_error($ldap->get_error(), sprintf(_("Saving system server/kolab 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");
@@ -357,6 +344,7 @@ class servkolab extends plugin {
 
   function getListEntry()
   {
+    $this->updateStatusState();
     $flag = $this->StatusFlag;
     if(empty($flag)){
       $fields['Status']       = "";
@@ -375,7 +363,6 @@ class servkolab extends plugin {
     /* Directly save new status flag */
   function setStatus($value)
   { 
-    echo "Status flag isn't set .... ";
     return;
   
     if($value == "none") return;
@@ -393,11 +380,62 @@ class servkolab extends plugin {
       $attrs[$flag] = $value;
       $this->$flag = $value;
       $ldap->modify($attrs);
-      show_ldap_error($ldap->get_error());
+      show_ldap_error($ldap->get_error(), sprintf(_("Set status flag for system server/kolab with dn '%s' failed."),$this->dn)); 
       $this->action_hook();
     }
   }
 
+
+  /* Get updates for status flag */
+  function updateStatusState()
+  {
+    if(empty($this->StatusFlag)) return;
+
+    $attrs = array();
+    $flag = $this->StatusFlag;
+    $ldap = $this->config->get_ldap_link();
+    $ldap->cd($this->cn);
+    $ldap->cat($this->dn,array($flag));
+    if($ldap->count()){
+      $attrs = $ldap->fetch();
+    }
+    if(isset($attrs[$flag][0])){
+      $this->$flag = $attrs[$flag][0];
+    }
+  }
+
+
+
+  /* Return plugin informations for acl handling */
+  function plInfo()
+  {
+    return (array(
+          "plShortName"   => _("Kolab"),
+          "plDescription" => _("Kolab service"),
+          "plSelfModify"  => FALSE,
+          "plDepends"     => array(),
+          "plPriority"    => 0,
+          "plSection"     => array("administration"),
+          "plCategory"    => array("server"),
+
+          "plProvidedAcls"=> array(
+            "postfix_mydomain"                => _("Postfix mydomain") ,
+            "postfix_mydestination"           => _("My destination") ,
+            "proftpd_ftp"                     => _("FTP FreeBusy service") ,
+            "postfix_mynetworks"              => _("SMTP privileged networks") ,
+            "postfix_enable_virus_scan"       => _("Enable virus scan") ,
+            "postfix_relayhost"               => _("Relayhost") ,
+            "apache_http"                     => _("HTTP FreeBusy service") ,
+            "postfix_allow_unauthenticated"   => _("Accept Internet Mail") ,
+            "cyrus_imap"                      => _("IMAP service") ,
+            "kolabFreeBusyFuture"             => _("kolabFreeBusyFuture") ,
+            "cyrus_pop3"                      => _("POP3 service") ,
+            "cyrus_imaps"                     => _("IMAP/SSL service") ,
+            "cyrus_pop3s"                     => _("POP3/SSL service") ,
+            "cyrus_sieve"                     => _("Sieve service") ,
+            "cyrus_quotawarn"                 => _("Quota settings")) 
+            ));
+  }
 }
 
 // vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler: