X-Git-Url: https://git.tokkee.org/?a=blobdiff_plain;f=plugins%2Fpersonal%2Fconnectivity%2Fclass_kolabAccount.inc;h=9f08ea9110e4bdad8c1c550f80f08d79ec042c9e;hb=e7b70ce242b052c5e0d0dfd45dfac5e6f9f36ba3;hp=09c3e83330410a2c1685a5c968918f85aef8c7fc;hpb=95dcb0034d73afb2a24aae9567522104f9178c32;p=gosa.git diff --git a/plugins/personal/connectivity/class_kolabAccount.inc b/plugins/personal/connectivity/class_kolabAccount.inc index 09c3e8333..9f08ea911 100644 --- a/plugins/personal/connectivity/class_kolabAccount.inc +++ b/plugins/personal/connectivity/class_kolabAccount.inc @@ -2,28 +2,24 @@ class kolabAccount extends plugin { /* Definitions */ - 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"); + var $plHeadline = "Kolab"; + var $plDescription = "This does something"; /* Kolab attributes */ - var $kolabInvitationPolicy= array(); - var $kolabFreeBusyFuture= 60; - var $unrestrictedMailSize= 0; - var $calFBURL= ""; - var $kolabDelegate= array(); + var $kolabInvitationPolicy = array(); + var $kolabFreeBusyFuture = 60; + var $unrestrictedMailSize = 0; + var $calFBURL = ""; + var $kolabDelegate = array(); /* attribute list for save action */ - var $attributes= array( "kolabFreeBusyFuture", "unrestrictedMailSize", "calFBURL"); - var $objectclasses= array(); + var $attributes = array("kolabFreeBusyFuture", "unrestrictedMailSize", "calFBURL","kolabDelegate"); + var $objectclasses = array("kolabInetOrgPerson"); /* Helper */ var $imapping= array(); + function kolabAccount ($config, $dn= NULL) { plugin::plugin ($config, $dn); @@ -31,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; } } @@ -42,10 +40,24 @@ class kolabAccount extends plugin $this->kolabInvitationPolicy= array("ACT_MANUAL"); } + /* Check is account state */ + $this->is_account = false; + if(count($this->kolabDelegate)){ + $this->is_account = true; + } + foreach(array("calFBURL","unrestrictedMailSize") as $attr){ + if(!empty($this->$attr)){ + $this->is_account = true; + } + } } + function execute() { + /* Call parent execute */ + plugin::execute(); + /* Show tab dialog headers */ $display= ""; @@ -57,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; @@ -79,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; } @@ -105,7 +115,7 @@ class kolabAccount extends plugin $ldap= $this->config->get_ldap_link(); $ldap->cd ($this->config->current['BASE']); - $ldap->search('(mail='.$address.')'); + $ldap->search('(mail='.$address.')',array("mail")); if ($ldap->count() == 0){ print_red (_("The mail address you're trying to add is no primary mail address of an existing user.")); } else { @@ -149,15 +159,18 @@ class kolabAccount extends plugin } /* Transfer account states for this union */ - if ($this->parent->by_object['mailAccount']->is_account){ - $smarty->assign('is_account', 'true'); - } else { - $smarty->assign('is_account', ''); + if (isset($this->parent) && $this->parent->by_object['mailAccount']->is_account){ + $smarty->assign('mail_account', 'true'); + } 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', ''); } /* Transfer delegation list */ if (!count($this->kolabDelegate)){ - $smarty->assign("kolabDelegate", array("")); + /* Smarty will produce and tidy don't like that, so tell smarty to create no option (array();)*/ + $smarty->assign("kolabDelegate", array()); } else { $smarty->assign("kolabDelegate", $this->kolabDelegate); } @@ -168,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.= "