Code

Updated acls
[gosa.git] / plugins / personal / connectivity / class_kolabAccount.inc
index abe802ab30f088ce2bdadc869d157f38d85db3a7..9f08ea9110e4bdad8c1c550f80f08d79ec042c9e 100644 (file)
@@ -5,11 +5,6 @@ class kolabAccount extends plugin
   var $plHeadline       = "Kolab";
   var $plDescription    = "This does something";
 
-  /* CLI vars */
-  var $cli_summary      = "Manage users Kolab account";
-  var $cli_description  = "Some longer text\nfor help";
-  var $cli_parameters   = array("eins" => "Eins ist toll", "zwei" => "Zwei ist noch besser");
-
   /* Kolab attributes */
   var $kolabInvitationPolicy  = array();
   var $kolabFreeBusyFuture    = 60;
@@ -32,9 +27,11 @@ class kolabAccount extends plugin
     /* Pull arrays */
     foreach(array("kolabDelegate", "kolabInvitationPolicy") as $attr){
       if (isset($this->attrs["$attr"]["count"])){
+        $tmp = array();
         for ($i= 0; $i<$this->attrs["$attr"]["count"]; $i++){
-          array_push($this->$attr, $this->attrs["$attr"][$i]);
+          $tmp[]=$this->attrs["$attr"][$i];
         }
+        $this->$attr = $tmp;
       }
     }
 
@@ -72,6 +69,7 @@ class kolabAccount extends plugin
       $smarty->assign("$val", $this->$val);
       $smarty->assign($val."ACL", chkacl($this->acl, "$val"));
     }
+    $smarty->assign("kolabAccountACL", chkacl($this->acl, "kolabAccountACL"));
 
     /* Check for invitation action */
     $nr= 0;
@@ -94,9 +92,6 @@ class kolabAccount extends plugin
     /* Unify addresses */
     $new= array();
     foreach($this->kolabInvitationPolicy as $value){
-      if (preg_match('/^:/', $value)){
-        continue;
-      }
       $address= preg_replace('/^([^:]+:).*$/', '\1', $value);
       $new[$address]= $value;
     }
@@ -166,7 +161,9 @@ class kolabAccount extends plugin
     /* Transfer account states for this union */
     if (isset($this->parent) && $this->parent->by_object['mailAccount']->is_account){
       $smarty->assign('mail_account', 'true');
-    } else {
+    } elseif($this-> initially_was_account && (isset($this->attrs['objectClass']) && (in_array("kolabInetOrgPerson",$this->attrs['objectClass'])))){
+      $smarty->assign('mail_account', 'true');
+    }else{
       $smarty->assign('mail_account', '');
     }
 
@@ -184,8 +181,19 @@ class kolabAccount extends plugin
     $this->imapping= array();
     $nr= 0;
     $acl= chkacl($this->acl, "kolabInvitationPolicy");
+    $changeState = "";
     foreach ($this->kolabInvitationPolicy as $entry){
+
+      $changeState .= "changeState('address".$nr."'); \n changeState('policy".$nr."'); \n
+                         changeState('add".$nr."'); \n changeState('remove".$nr."'); \n";
+
       $invitation.= "<tr><td>";
+      if($this->is_account){
+        $dis = " ";
+      }else{
+        $dis = " disabled ";
+      }
+    
 
       /* The default entry does not have colons... */
       if (!preg_match('/:/', $entry)){
@@ -195,12 +203,12 @@ class kolabAccount extends plugin
       } else {
         $name= preg_replace('/:.*$/', '', $entry);
         $mode= preg_replace('/^[^:]*: */', '', $entry);
-        $invitation.= "<input name=\"address$nr\" size=16 maxlength=60 $acl value=\"$name\">";
+        $invitation.= "<input name=\"address$nr\" size=16 maxlength=60 $acl value=\"$name\" id='address".$nr."' ".$dis.">";
       }
       $invitation.= "</td>";
 
       /* Add mode switch */
-      $invitation.= "<td><select size=\"1\" name=\"policy$nr\" $acl>";
+      $invitation.= "<td><select size=\"1\" name=\"policy$nr\" $acl  id='policy".$nr."' ".$dis.">";
       foreach($policies as $key => $value){
         if ($key == $mode){
           $invitation.= "<option value=\"$key\" selected>$value</option>";
@@ -212,10 +220,10 @@ class kolabAccount extends plugin
       /* Assign buttons */
       $button= "";
       if ($nr == count($this->kolabInvitationPolicy)-1){
-        $button= "<input type=submit name=\"add$nr\" value=\""._("Add")."\">";
+        $button= "<input type=submit name=\"add$nr\" value=\""._("Add")."\" id='add".$nr."' ".$dis.">";
       }
       if ($nr != 0) {
-        $button.= "<input type=submit name=\"remove$nr\" value=\""._("Remove")."\">";
+        $button.= "<input type=submit name=\"remove$nr\" value=\""._("Remove")."\" id='remove".$nr."' ".$dis.">";
       }
       
       $invitation.= "</select>&nbsp;$button</td></tr>\n";
@@ -223,7 +231,7 @@ class kolabAccount extends plugin
       $nr++;
     }
     $smarty->assign("invitation", $invitation);
-
+    $smarty->assign("changeState", $changeState);
     $smarty->assign("kolabState",$this->is_account);
     $display.= $smarty->fetch (get_template_path('kolab.tpl', TRUE, dirname(__FILE__)));
 
@@ -350,6 +358,13 @@ class kolabAccount extends plugin
     $this->attrs['kolabDelegate']= $this->kolabDelegate;
     $this->attrs['kolabInvitationPolicy']= $this->kolabInvitationPolicy;
 
+    /* unrestrictedMailSize is boolean */
+    if($this->attrs['unrestrictedMailSize']){
+      $this->attrs['unrestrictedMailSize'] = "TRUE";
+    }else{
+      $this->attrs['unrestrictedMailSize'] = "FALSE";
+    }
+  
     /* Write back to ldap */
     $ldap= $this->config->get_ldap_link();
     $ldap->cd($this->dn);
@@ -386,6 +401,19 @@ class kolabAccount extends plugin
     $this->is_modified= TRUE;
   }
 
+
+  /* Return plugin informations for acl handling  */
+  function plInfo()
+  {
+    return (array(     
+          "plDescription"         => _("Koalb account settings"),
+          "plSelfModify"          => TRUE,
+          "plDepends"             => array("objectClass" => "gosaAccount"),
+          "kolabFreeBusyFuture"   => _("Free busy future"),
+          "unrestrictedMailSize"  => _("Mail size restriction"),
+          "calFBURL"              => _("Free busy information"),
+          "kolabDelegate"         => _("Delegations")));
+  }
 }
 
 // vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler: