Ver código fonte

edit mailinglists

andre 2 anos atrás
pai
commit
e7035d45eb

+ 55 - 51
app/UI/Client/DistributionList/Providers/EditListDataProvider.php

@@ -30,6 +30,13 @@ class EditListDataProvider extends AddListDataProvider
     public function read()
     {
 
+        logModuleCall(
+            'kerioEmail',
+            __FUNCTION__,
+            $this->formData,
+            'Debug Error',
+            $this->data
+        );
         /**
          * load hosting
          */
@@ -38,47 +45,44 @@ class EditListDataProvider extends AddListDataProvider
         /**
          * load api
          */
-        $api = (new KerioManager())->getApiByServer($hosting->server);
 
-        $repository = new Repository($api->soap);
+//        $list             = $repository->lists()->getDistributionListBydId($this->actionElementId);
+//        $this->data['id'] = $list->getId();
 
-        $list             = $repository->lists()->getDistributionListBydId($this->actionElementId);
-        $this->data['id'] = $list->getId();
+//        $res                    = explode('@', $list->getName());
+//        $this->data['listmail'] = $res[0];
+//        $this->data['domain']   = $res[1];
 
-        $res                    = explode('@', $list->getName());
-        $this->data['listmail'] = $res[0];
-        $this->data['domain']   = $res[1];
-
-        $this->data['emailAliases']  = implode(',', $list->getResourceAliases());
-        $this->data['owners']        = implode(',', $list->getResourceOwners());
+//        $this->data['emailAliases']  = implode(',', $list->getResourceAliases());
+//        $this->data['owners']        = implode(',', $list->getResourceOwners());
 
         /**
          * allow to check which should be removed
          */
-        $this->availableValues['memberListActually']   = $this->data['memberListActually']      = $list->getResourceMembers();
-        $this->availableValues['emailAliasesActually'] = $this->data['emailAliasesActually']    = $list->getResourceAliases();
-        $this->availableValues['ownersActually']       = $this->data['ownersActually']          = $list->getResourceOwners();
-
-        $this->data['displayName']           = $list->getDataResourceA(DistributionList::ATTR_DISPLAY_NAME);
-        $this->data['description']           = $list->getDataResourceA(DistributionList::ATTR_DESCRIPTION);
-        $this->data['subscriptionRequest']   = $list->getDataResourceA(DistributionList::ATTR_SUBSCRIPTION_REQUEST);
-        $this->data['unsubscriptionRequest'] = $list->getDataResourceA(DistributionList::ATTR_UNSUBSCRIPTION_REQUEST);
-        $this->data['replyDisplayName']      = $list->getDataResourceA(DistributionList::REPLY_TO_DISPLAY);
-        $this->data['replyEmailAddress']     = $list->getDataResourceA(DistributionList::REPLY_TO_ADDRESS);
-        $this->data['sharesNotify']          = $list->getDataResourceA(DistributionList::ATTR_NOTIFY_SHARES) === Kerio::ATTR_ENABLED ? ProductParams::SWITCHER_ENABLED : ProductParams::SWITCHER_DISABLED;
-        $this->data['hideGal']               = $list->getDataResourceA(DistributionList::ATTR_HIDE_IN_GAL) === Kerio::ATTR_ENABLED ? ProductParams::SWITCHER_ENABLED : ProductParams::SWITCHER_DISABLED;
-        $this->data['receiveMail']           = $list->getDataResourceA(DistributionList::ATTR_MAIL_STATUS) === Kerio::ENABLED ? ProductParams::SWITCHER_ENABLED : ProductParams::SWITCHER_DISABLED;
-        $this->data['replyEmail']            = $list->getDataResourceA(DistributionList::REPLY_TO_ENABLED) === Kerio::ATTR_ENABLED ? ProductParams::SWITCHER_ENABLED : ProductParams::SWITCHER_DISABLED;
+//        $this->availableValues['memberListActually']   = $this->data['memberListActually']      = $list->getResourceMembers();
+//        $this->availableValues['emailAliasesActually'] = $this->data['emailAliasesActually']    = $list->getResourceAliases();
+//        $this->availableValues['ownersActually']       = $this->data['ownersActually']          = $list->getResourceOwners();
+
+//        $this->data['displayName']           = $list->getDataResourceA(DistributionList::ATTR_DISPLAY_NAME);
+//        $this->data['description']           = $list->getDataResourceA(DistributionList::ATTR_DESCRIPTION);
+//        $this->data['subscriptionRequest']   = $list->getDataResourceA(DistributionList::ATTR_SUBSCRIPTION_REQUEST);
+//        $this->data['unsubscriptionRequest'] = $list->getDataResourceA(DistributionList::ATTR_UNSUBSCRIPTION_REQUEST);
+//        $this->data['replyDisplayName']      = $list->getDataResourceA(DistributionList::REPLY_TO_DISPLAY);
+//        $this->data['replyEmailAddress']     = $list->getDataResourceA(DistributionList::REPLY_TO_ADDRESS);
+//        $this->data['sharesNotify']          = $list->getDataResourceA(DistributionList::ATTR_NOTIFY_SHARES) === Kerio::ATTR_ENABLED ? ProductParams::SWITCHER_ENABLED : ProductParams::SWITCHER_DISABLED;
+//        $this->data['hideGal']               = $list->getDataResourceA(DistributionList::ATTR_HIDE_IN_GAL) === Kerio::ATTR_ENABLED ? ProductParams::SWITCHER_ENABLED : ProductParams::SWITCHER_DISABLED;
+//        $this->data['receiveMail']           = $list->getDataResourceA(DistributionList::ATTR_MAIL_STATUS) === Kerio::ENABLED ? ProductParams::SWITCHER_ENABLED : ProductParams::SWITCHER_DISABLED;
+//        $this->data['replyEmail']            = $list->getDataResourceA(DistributionList::REPLY_TO_ENABLED) === Kerio::ATTR_ENABLED ? ProductParams::SWITCHER_ENABLED : ProductParams::SWITCHER_DISABLED;
         /**
          * is dynamic group
          */
-        $this->data['dynamicGroup']          = (int)$list->isDynamic() === Kerio::ENABLED_AS_INT ? ProductParams::SWITCHER_ENABLED : ProductParams::SWITCHER_DISABLED;
+//       $this->data['dynamicGroup']          = (int)$list->isDynamic() === Kerio::ENABLED_AS_INT ? ProductParams::SWITCHER_ENABLED : ProductParams::SWITCHER_DISABLED;
 
 
         /**
          * available members
          */
-        $accounts = $repository->accounts->getByDomainName($hosting->domain);
+//        $accounts = $repository->accounts->getByDomainName($hosting->domain);
 
         /**
          * load lang
@@ -88,46 +92,46 @@ class EditListDataProvider extends AddListDataProvider
         /**
          * subscription requests
          */
-        $this->availableValues['subscriptionRequest'] = [
-            Kerio::STATUS_ACCEPT   => $lang->absoluteT('Automatically accept'),
-            Kerio::STATUS_APPROVAL => $lang->absoluteT('Require list owner approval'),
-            Kerio::STATUS_REJECT   => $lang->absoluteT('Automatically reject')
-        ];
+//        $this->availableValues['subscriptionRequest'] = [
+//            Kerio::STATUS_ACCEPT   => $lang->absoluteT('Automatically accept'),
+//            Kerio::STATUS_APPROVAL => $lang->absoluteT('Require list owner approval'),
+ //           Kerio::STATUS_REJECT   => $lang->absoluteT('Automatically reject')
+//        ];
 
         /**
          * unsubscription requests
          */
-        $this->availableValues['unsubscriptionRequest'] = [
-            Kerio::STATUS_ACCEPT   => $lang->absoluteT('Automatically accept'),
-            Kerio::STATUS_APPROVAL => $lang->absoluteT('Require list owner approval'),
-            Kerio::STATUS_REJECT   => $lang->absoluteT('Automatically reject')
-        ];
+//        $this->availableValues['unsubscriptionRequest'] = [
+//           Kerio::STATUS_ACCEPT   => $lang->absoluteT('Automatically accept'),
+//            Kerio::STATUS_APPROVAL => $lang->absoluteT('Require list owner approval'),
+//            Kerio::STATUS_REJECT   => $lang->absoluteT('Automatically reject')
+//        ];
 
-        $members = $list->getResourceMembers();
+//        $members = $list->getResourceMembers();
 
         /**
          *
          */
-        foreach ($accounts as $account)
-        {
-            if(in_array($account->getName(),$members))
-            {
-                $this->data['memberList'][] = $account->getName();
-            }
+//        foreach ($accounts as $account)
+//        {
+//            if(in_array($account->getName(),$members))
+//           {
+//               $this->data['memberList'][] = $account->getName();
+//             }
 
-            $this->availableValues['memberList'][$account->getName()] = $account->getName();
-        }
+//            $this->availableValues['memberList'][$account->getName()] = $account->getName();
+//        }
 
         /**
          * add custom members to array
          */
-        $ownMembers = $this->data['memberList'] ? $this->data['memberList'] : [];
-        $this->data['customMember'] = implode(',',array_diff($members, $ownMembers));
+//        $ownMembers = $this->data['memberList'] ? $this->data['memberList'] : [];
+//        $this->data['customMember'] = implode(',',array_diff($members, $ownMembers));
 
-        if($this->formData)
-        {
-            $this->loadReloadedData();
-        }
+//        if($this->formData)
+//        {
+//            $this->loadReloadedData();
+//        }
 
     }