From: hzerres Date: Thu, 9 Sep 2010 11:29:43 +0000 (+0000) Subject: added dao for groupwareaction X-Git-Url: https://git.tokkee.org/?a=commitdiff_plain;h=0fe995069a481fa547f0f28b65fd98d3700ec310;p=gosa.git added dao for groupwareaction git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@19581 594d385d-05f5-0310-b6e9-bd551577e9d8 --- diff --git a/gosa-plugins/groupware/personal/groupware/class_groupware.inc b/gosa-plugins/groupware/personal/groupware/class_groupware.inc index cc3b7b6dc..ee6fda90d 100644 --- a/gosa-plugins/groupware/personal/groupware/class_groupware.inc +++ b/gosa-plugins/groupware/personal/groupware/class_groupware.inc @@ -1,5 +1,22 @@ "; $params = func_get_args(); unset($params[0]); $rpc = $this->config->getRpcHandle(); @@ -108,7 +127,10 @@ class groupware extends plugin function init() { // Detect feature availability and enable/disable services correspondingly. - $features = $this->rpcExec('gwGetCapabilities'); + echo "init Plugin:"; + $this->groupwareDao = new groupware_dao($this); + + $features = array(); $featureReq = array( "quotaUsage" => array( 'acctGetQuota'), @@ -141,14 +163,39 @@ class groupware extends plugin foreach($featureReq as $name => $requires){ $active = TRUE; foreach($requires as $methodName){ - $active &= $features[$methodName]; + $active &= $this->groupwareDao->gwFeatureAvailable($methodName); } $this->enabledFeatures[$name] = $active; } + // Get rpc handle to fetch account info and feature availability. $status = $this->rpcExec('gwAcctExists', $this->uid); if($status !== NULL){ + + var_dump($this->rpcExec('gwAcctGetLocation',$this->uid)); + $User =$this->groupwareDao->getComprehensiverUser($this->uid); + $response = array("mailAddress"=>"hape@exdom.de", + "mailLocation"=>"hape@exdom.de", + "quotaUsage"=>10, + "quotaSize"=>100, + "alternateAddresses"=>"alternateAddresses@exdom.de", + "forwardingAddresses"=>"forwardingAddresses@exdom.de", + "vacationEnabled"=>1, + "vacationStart"=>"09.09.2010", + "vacationStop"=>"08.09.2010", + "vacationMessage"=>"bin in Urlaub message", + "mailBoxWarnLimitEnabled"=>1, + "mailBoxWarnLimitValue"=>99, + "mailBoxSendSizelimitEnabled"=>1, + "mailBoxSendSizelimitValue"=>100, + "mailBoxHardSizelimitEnabled"=>1, + "mailBoxHardSizelimitValue"=>105, + "mailBoxAutomaticRemovalEnabled"=>0, + "mailBoxAutomaticRemovalValue"=>"mailBoxAutomaticRemovalValue", + "localDeliveryOnly"=>0, + "dropOwnMails"=>0 ); + $this->mapComprehensiveUserData($response); $this->initially_was_account = $this->is_account = $status; $this->accountInitialized = TRUE; } @@ -431,7 +478,9 @@ class groupware extends plugin $this->$attr = get_post($attr); } } - + /* + * TODO: ACL check is missing + */ // Detect checkbox states $checkAttrs = array("mailBoxWarnLimit","mailBoxSendSizelimit", "mailBoxHardSizelimit","mailBoxAutomaticRemoval"); @@ -652,7 +701,33 @@ class groupware extends plugin */ function check() { + /* + * TODO: Remove all echo Messages + */ $messages = plugin::check(); + /* + * Check the dates + */ + + /* + * TODO: check only if features are enabled. + */ + //required vacationEnabled + if($this->vacationEnabled){ + if(tests::is_date($this->vacationStart)){ + msgPool::invalid(_("von"),$this->vacationStart , "", _("Example of date : 01.13.2010")); + } + if(tests::is_date($this->vacationStop)){ + msgPool::invalid(_("bis"),$this->vacationStop , "", _("Example of date : 01.13.2010")); + + } + $diff = tests::compareDate($this->vacationStart, $this->vacationStop); + + if($diff>=0){ + echo "Message ... Enddate before Start or the same."; + $messages[] = msgPool::invalid(_("vacation dates"), $this->vacationStart." - ".$this->vacationStop, "", _("Enddate before Start or the same.")); + } + } return($messages); } @@ -700,7 +775,120 @@ class groupware extends plugin ) )); } + function mapComprehensiveUserData($callBackMap){ + $this->mailAddressSelectDialog = $callBackMap["mailAddressSelectDialog"]; + $this->filterManager = $callBackMap["filterManager"]; + $this->filterRules = $callBackMap["filterRules"]; + $this->vacationTemplates = $callBackMap["vacationTemplates"]; + + $this->mailAddress = $callBackMap["mailAddress"]; + $this->mailLocation = $callBackMap["mailLocation"]; + $this->quotaUsage = $callBackMap["quotaUsage"]; + $this->quotaSize = $callBackMap["quotaSize"]; + $this->alternateAddresses = $callBackMap["alternateAddresses"]; + $this->forwardingAddresses = $callBackMap["forwardingAddresses"]; + $this->vacationEnabled = $callBackMap["vacationEnabled"]; + $this->vacationStart = $callBackMap["vacationStart"]; + $this->vacationStop = $callBackMap["vacationStop"]; + $this->vacationMessage = $callBackMap["vacationMessage"]; + $this->mailBoxWarnLimitEnabled = $callBackMap["mailBoxWarnLimitEnabled"]; + $this->mailBoxWarnLimitValue = $callBackMap["mailBoxWarnLimitValue"]; + $this->mailBoxSendSizelimitEnabled = $callBackMap["mailBoxSendSizelimitEnabled"]; + $this->mailBoxSendSizelimitValue = $callBackMap["mailBoxSendSizelimitValue"]; + $this->mailBoxHardSizelimitEnabled = $callBackMap["mailBoxHardSizelimitEnabled"]; + $this->mailBoxHardSizelimitValue = $callBackMap["mailBoxHardSizelimitValue"]; + $this->mailBoxAutomaticRemovalEnabled = $callBackMap["mailBoxAutomaticRemovalEnabled"]; + $this->mailBoxAutomaticRemovalValue = $callBackMap["mailBoxAutomaticRemovalValue"]; + $this->localDeliveryOnly = $callBackMap["localDeliveryOnly"]; + $this->dropOwnMails = $callBackMap["dropOwnMails"]; + + /* + * TODO: Remove the line to check on every call.. + * + * The check will be called on "OK" or "APPLY" + */ + $this->check(); + } } // vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler: +/* + * Data Access Object for groupwares + */ +class groupware_dao{ + private $availableMethods; + private static $gwFeatures = array( + "user" => array("get"=>"acctGetUser", + "save"=>"acctSetUser", + "delete"=>"acctDelUser") + + ); + private $groupwarePluginRef = False; + function __construct(&$pluginRef){ + + echo "init Dao"; + $this->groupwarePluginRef = &$pluginRef; + + + $this->availableMethods = $this->groupwarePluginRef->rpcExec('gwGetCapabilities'); + /* + * TODO: + * Remove all echos + */ + + $this->init(); + } + /* + * gets the capabilities of the server + * builds an array with availbale features and knows how to call get, save, delete functions of + * groupware rpc. + */ + public function init(){ + + } + public function save($feature, $valueArray){ + + /* + * TODO: + * check if feture available + * save and return the result. + */ + return false; + } + public function get($feature, $valueArray){ + + /* + * TODO: + * check if feture available + * get and return the result. + */ + + if($this->gwFeatureAvailable($feature)){ + $result = $this->availableMethods = $this->groupwarePluginRef->rpcExec('gwGetCapabilities'); + return $result; + } + return false; + } + public function del($feature, $valueArray){ + /* + * TODO: + * check if feture available + * del and return the result. + */ + return false; + + } + public function gwFeatureAvailable($methodName){ + return $this->availableMethods[$methodName]; + } + public function getMailboxLocations(){ + echo "acctGetMailboxLocations"; + return $this->groupwarePluginRef->rpcExec("acctGetMailboxLocations"); + } + public function getComprehensiverUser($uid){ + $location = $this->groupwarePluginRef->rpcExec("gwGetLocation"); + + return $location; + } +} ?>