protected function preFilter($filterChain) { $sendGridPluginEnabled = (bool) ZurmoConfigurationUtil::getByModuleName('SendGridModule', 'enableSendgrid'); try { if ($sendGridPluginEnabled) { SendGridEmailAccount::getByUserAndName(Yii::app()->user->userModel, null); } else { EmailAccount::getByUserAndName(Yii::app()->user->userModel); } } catch (NotFoundException $e) { $redirectUrl = Yii::app()->request->getParam('redirectUrl'); if ($sendGridPluginEnabled) { try { EmailAccount::getByUserAndName(Yii::app()->user->userModel); } catch (NotFoundException $ex) { $messageView = new NoUserEmailConfigurationYetView($redirectUrl); $view = new ModalView($this->controller, $messageView); Yii::app()->getClientScript()->setToAjaxMode(); echo $view->render(); return false; } } else { $messageView = new NoUserEmailConfigurationYetView($redirectUrl); $view = new ModalView($this->controller, $messageView); Yii::app()->getClientScript()->setToAjaxMode(); echo $view->render(); return false; } } return true; }
/** * @return rendered content from view as string. */ public static function renderList(CController $controller, $dataProvider) { assert('$dataProvider instanceof RedBeanModelDataProvider'); $auditEventsListView = new AuditEventsModalListView($controller->getId(), $controller->getModule()->getId(), 'AuditEvent', $dataProvider, 'modal'); $view = new ModalView($controller, $auditEventsListView); return $view->render(); }
/** * @return rendered content from view as string. */ public static function renderList(CController $controller, $dataProvider, $action) { assert('$dataProvider instanceof RedBeanModelDataProvider'); $modalListLinkProvider = new UserDetailsModalListLinkProvider('users', 'default', 'details'); $usersListView = new UsersByModelModalListView($controller->getId(), $controller->getModule()->getId(), $action, 'User', $modalListLinkProvider, $dataProvider, 'modal'); $view = new ModalView($controller, $usersListView); return $view->render(); }
/** * Called using Ajax. Renders a modal popup * of the portlet's configuration view. * Also called on 'save' of the modal popup form * in order to validate form. */ public function actionModalConfigEdit() { if (isset($_POST['ajax']) && $_POST['ajax'] === 'modal-edit-form') { $this->actionModalConfigValidate(); } Yii::app()->getClientScript()->setToAjaxMode(); $portlet = Portlet::getById(intval($_GET['portletId'])); $portlet->params = array('modalConfigSaveAction' => 'modalConfigSave', 'controllerId' => $this->getId(), 'moduleId' => $this->getModule()->getId(), 'uniquePortletPageId' => $portlet->getUniquePortletPageId()); $configurableView = $portlet->getView()->getConfigurationView(); $view = new ModalView($this, $configurableView); echo $view->render(); }
protected function preFilter($filterChain) { try { EmailAccount::getByUserAndName(Yii::app()->user->userModel); } catch (NotFoundException $e) { $redirectUrl = Yii::app()->request->getParam('redirectUrl'); $messageView = new NoUserEmailConfigurationYetView($redirectUrl); $view = new ModalView($this->controller, $messageView); Yii::app()->getClientScript()->setToAjaxMode(); echo $view->render(); return false; } return true; }
public function actionDaysMeetingsFromCalendarModalList($stringTime, $redirectUrl) { if (isset($_GET['ownerOnly'])) { $ownerOnly = true; } else { $ownerOnly = false; } if (isset($_GET['relationModelId'])) { $relationModelClassName = $_GET['relationModelClassName']; $relationModel = $relationModelClassName::getById((int) $_GET['relationModelId']); } else { $relationModel = null; } Yii::app()->getClientScript()->setToAjaxMode(); $meetingsView = new DaysMeetingsFromCalendarModalListView($this->getId(), $this->getModule()->getId(), $stringTime, $redirectUrl, $ownerOnly, $relationModel); $view = new ModalView($this, $meetingsView); echo $view->render(); }
/** * @return rendered content from view as string. */ protected static function renderModalSearchList(CController $controller, $modalListLinkProvider, $stateMetadataAdapterClassName = null) { assert('$modalListLinkProvider instanceof ModalListLinkProvider'); $className = $controller->getModule()->getPluralCamelCasedName() . 'ModalSearchAndListView'; $modelClassName = $controller->getModule()->getPrimaryModelName(); $searchViewClassName = $className::getSearchViewClassName(); if ($searchViewClassName::getModelForMetadataClassName() != null) { $formModelClassName = $searchViewClassName::getModelForMetadataClassName(); $model = new $modelClassName(false); $searchModel = new $formModelClassName($model); } else { throw new NotSupportedException(); } $pageSize = Yii::app()->pagination->resolveActiveForCurrentUserByType('modalListPageSize', get_class($controller->getModule())); $dataProvider = $controller->makeRedBeanDataProviderByDataCollection($searchModel, $pageSize, $stateMetadataAdapterClassName); $searchAndListView = new $className($controller->getId(), $controller->getModule()->getId(), $controller->getAction()->getId(), $modalListLinkProvider, $searchModel, $model, $dataProvider, 'modal'); $view = new ModalView($controller, $searchAndListView); return $view->render(); }
public function actionTestConnection() { $configurationForm = LdapConfigurationFormAdapter::makeFormFromGlobalConfiguration(); $postVariableName = get_class($configurationForm); if (isset($_POST[$postVariableName]) || isset($_POST['LdapConfigurationForm'])) { if (isset($_POST[$postVariableName])) { $configurationForm->setAttributes($_POST[$postVariableName]); } else { $configurationForm->serverType = $_POST['LdapConfigurationForm']['serverType']; $configurationForm->host = $_POST['LdapConfigurationForm']['host']; $configurationForm->port = $_POST['LdapConfigurationForm']['port']; $configurationForm->bindRegisteredDomain = $_POST['LdapConfigurationForm']['bindRegisteredDomain']; $configurationForm->bindPassword = $_POST['LdapConfigurationForm']['bindPassword']; $configurationForm->baseDomain = $_POST['LdapConfigurationForm']['baseDomain']; $configurationForm->enabled = $_POST['LdapConfigurationForm']['enabled']; } if ($configurationForm->host != null && $configurationForm->port != null && $configurationForm->bindRegisteredDomain != null && $configurationForm->bindPassword != null && $configurationForm->baseDomain != null && $configurationForm->serverType != null) { $authenticationHelper = new ZurmoAuthenticationHelper(); $authenticationHelper->ldapServerType = $configurationForm->serverType; $authenticationHelper->ldapHost = $configurationForm->host; $authenticationHelper->ldapPort = $configurationForm->port; $authenticationHelper->ldapBindRegisteredDomain = $configurationForm->bindRegisteredDomain; $authenticationHelper->ldapBindPassword = $configurationForm->bindPassword; $authenticationHelper->ldapBaseDomain = $configurationForm->baseDomain; $authenticationHelper->ldapEnabled = $configurationForm->enabled; $serverType = $configurationForm->serverType; $host = $configurationForm->host; $port = $configurationForm->port; $bindRegisteredDomain = $configurationForm->bindRegisteredDomain; $bindPassword = $configurationForm->bindPassword; $baseDomain = $configurationForm->baseDomain; $testConnectionResults = LdapUtil::establishConnection($serverType, $host, $port, $bindRegisteredDomain, $bindPassword, $baseDomain); if ($testConnectionResults) { $messageContent = Zurmo::t('ZurmoModule', 'Successfully Connected to Ldap Server') . "\n"; } else { $messageContent = Zurmo::t('ZurmoModule', 'Unable to connect to Ldap server') . "\n"; } } else { $messageContent = Zurmo::t('ZurmoModule', 'All fields are required') . "\n"; } Yii::app()->getClientScript()->setToAjaxMode(); $messageView = new TestConnectionView($messageContent); $view = new ModalView($this, $messageView); echo $view->render(); } else { throw new NotSupportedException(); } }
public function actionModalList() { $groupsModalTreeView = new SelectParentGroupModalTreeListView($this->getId(), $this->getModule()->getId(), $_GET['modalTransferInformation']['sourceModelId'], static::getGroupsOrderedByNonDeletablesFirst(false), $_GET['modalTransferInformation']['sourceIdFieldId'], $_GET['modalTransferInformation']['sourceNameFieldId'], $_GET['modalTransferInformation']['modalId']); Yii::app()->getClientScript()->setToAjaxMode(); $pageTitle = Zurmo::t('ZurmoModule', 'Select a Parent Group'); $view = new ModalView($this, $groupsModalTreeView); echo $view->render(); }
public function actionAddList() { Yii::app()->getClientScript()->setToAjaxMode(); $view = new ModalView($this, new DetailsPortletSelectionView($this->getId(), $this->getModule()->getId(), $_GET['modelId'], $_GET['uniqueLayoutId'])); echo $view->render(); }
public function actionMergeTagGuide() { Yii::app()->getClientScript()->setToAjaxMode(); $view = new ModalView($this, new MergeTagGuideView()); echo $view->render(); }
public function actionModalList() { $modalListLinkProvider = $this->getModalListLinkProvider(); Yii::app()->getClientScript()->setToAjaxMode(); $className = 'ImageModalSearchAndListView'; $modelClassName = 'ImageFileModel'; $stateMetadataAdapterClassName = null; $searchViewClassName = $className::getSearchViewClassName(); if ($searchViewClassName::getModelForMetadataClassName() != null) { $formModelClassName = $searchViewClassName::getModelForMetadataClassName(); $model = new $modelClassName(false); $searchModel = new $formModelClassName($model); } else { throw new NotSupportedException(); } $pageSize = Yii::app()->pagination->resolveActiveForCurrentUserByType('modalListPageSize', get_class($this->getModule())); $dataProvider = $this->resolveSearchDataProvider($searchModel, $pageSize, $stateMetadataAdapterClassName, 'ImagesSearchView'); $imageModalSearchAndListAndUploadView = new ImageModalSearchAndListAndUploadView($this, $this->module->id, 'modalList', $modalListLinkProvider, $searchModel, $model, $dataProvider, 'modal'); $view = new ModalView($this, $imageModalSearchAndListAndUploadView); echo $view->render(); }
protected function renderModalList($modalViewName, $pageTitle) { $rolesModalTreeView = new $modalViewName($this->getId(), $this->getModule()->getId(), $_GET['modalTransferInformation']['sourceModelId'], Role::getAll('name'), $_GET['modalTransferInformation']['sourceIdFieldId'], $_GET['modalTransferInformation']['sourceNameFieldId'], $_GET['modalTransferInformation']['modalId']); Yii::app()->getClientScript()->setToAjaxMode(); $view = new ModalView($this, $rolesModalTreeView); return $view->render(); }
/** * @param $controller * @param $modalEditView * @param $model * @return string */ protected static function renderModalDetailsView($controller, $modalEditView, $model) { $editAndDetailsView = new $modalEditView($controller->getId(), $controller->getModule()->getId(), $model); $view = new ModalView($controller, $editAndDetailsView); return $view->render(); }
public function actionChangeAvatar($id) { if (Yii::app()->user->userModel->id == intval($id) || RightsUtil::canUserAccessModule('UsersModule', Yii::app()->user->userModel)) { $user = User::getById(intval($id)); if (UserAccessUtil::resolveCanCurrentUserAccessRootUser($user, false) && UserAccessUtil::resolveAccessingASystemUser($user, false)) { $userAvatarForm = new UserAvatarForm($user); $this->attemptToValidateAjaxFromPost($userAvatarForm, 'UserAvatarForm'); $viewForModal = new UserChangeAvatarView($this->getId(), $this->getModule()->getId(), $userAvatarForm); $this->attemptToSaveModelFromPost($userAvatarForm); } else { $viewForModal = new AccessFailureView(); } } else { $viewForModal = new AccessFailureView(); } $view = new ModalView($this, $viewForModal); Yii::app()->getClientScript()->setToAjaxMode(); echo $view->render(); }
/** * Assumes before calling this, the sendgrid settings have been validated in the form. */ protected function processSendTestMessageForSendGrid() { $configurationForm = SendGridWebApiConfigurationFormAdapter::makeFormFromGlobalConfiguration(); if (isset($_POST['UserSendGridConfigurationForm'])) { $configurationForm->username = $_POST['UserSendGridConfigurationForm']['apiUsername']; $configurationForm->password = $_POST['UserSendGridConfigurationForm']['apiPassword']; $configurationForm->aTestToAddress = $_POST['UserSendGridConfigurationForm']['aTestToAddress']; $fromNameToSendMessagesFrom = $_POST['UserEmailConfigurationForm']['fromName']; $fromAddressToSendMessagesFrom = $_POST['UserEmailConfigurationForm']['fromAddress']; $messageContent = SendGridUtil::sendTestMessage($configurationForm, $fromNameToSendMessagesFrom, $fromAddressToSendMessagesFrom); Yii::app()->getClientScript()->setToAjaxMode(); $messageView = new TestConnectionView($messageContent); $view = new ModalView($this, $messageView); echo $view->render(); Yii::app()->end(); } else { throw new NotSupportedException(); } }
public function actionCreateEmailMessage($toAddress = null, $relatedId = null, $relatedModelClassName = null) { $postData = PostUtil::getData(); $getData = GetUtil::getData(); $personOrAccount = self::resolvePersonOrAccountFromGet($relatedId, $relatedModelClassName); $emailMessage = new EmailMessage(); $emailMessageForm = new CreateEmailMessageForm($emailMessage); $emailMessageForm->setScenario('createNonDraft'); $postVariableName = get_class($emailMessageForm); if ($toAddress == null && $personOrAccount != null && $personOrAccount->primaryEmail->emailAddress != null) { $toAddress = $personOrAccount->primaryEmail->emailAddress; } if (isset($postData[$postVariableName])) { EmailMessageUtil::resolveEmailMessageFromPostData($postData, $emailMessageForm, Yii::app()->user->userModel); $this->actionValidateCreateEmailMessage($postData, $emailMessageForm); $this->attemptToSaveModelFromPost($emailMessageForm, null, false); ZurmoControllerUtil::updatePermissionsWithDefaultForModelByCurrentUser($emailMessageForm->getModel()); Yii::app()->jobQueue->add('ProcessOutboundEmail'); } else { EmailMessageUtil::resolveSignatureToEmailMessage($emailMessage, Yii::app()->user->userModel); EmailMessageUtil::resolvePersonOrAccountToEmailMessage($emailMessage, Yii::app()->user->userModel, $toAddress, $relatedId, $relatedModelClassName); $createEmailMessageModalEditView = new CreateEmailMessageModalEditView($this->getId(), $this->getModule()->getId(), $emailMessageForm); $view = new ModalView($this, $createEmailMessageModalEditView); Yii::app()->getClientScript()->setToAjaxMode(); echo $view->render(); } }
protected function renderSuccessMessage() { $messageContent = Zurmo::t('MarketingModule', 'Test Email was successfully sent'); //$content = ZurmoHtml::tag('div', array('class' => 'modal-result-message'), $message); $messageView = new TestEmailSentView($messageContent); $view = new ModalView($this, $messageView, 'modalContainer', Zurmo::t('EmailMessagesModule', 'Send Test Email Results')); echo $view->render(); }
public function actionPreviewFooter($isHtmlContent, $content) { Yii::app()->getClientScript()->setToAjaxMode(); $view = new AutoresponderOrCampaignFooterTextPreviewView((bool) $isHtmlContent, $content); $modalView = new ModalView($this, $view); echo $modalView->render(); }
/** * Assumes before calling this, the sendgrid settings have been validated in the form. */ public function actionSendTestMessage() { $configurationForm = SendGridWebApiConfigurationFormAdapter::makeFormFromGlobalConfiguration(); $postVariableName = get_class($configurationForm); if (isset($_POST[$postVariableName])) { if (isset($_POST[$postVariableName])) { $configurationForm->setAttributes($_POST[$postVariableName]); } $messageContent = SendGridUtil::sendTestMessage($configurationForm); Yii::app()->getClientScript()->setToAjaxMode(); $messageView = new TestConnectionView($messageContent); $view = new ModalView($this, $messageView); echo $view->render(); } else { throw new NotSupportedException(); } }
/** * Map modal view for map popup.. * @return rendered content from view as string. */ protected function renderModalMapView(CController $controller, $modalMapAddressData, $stateMetadataAdapterClassName = null) { $renderAndMapModalView = new AddressMapModalView($controller->getId(), $controller->getModule()->getId(), $modalMapAddressData, 'modal'); $view = new ModalView($controller, $renderAndMapModalView); return $view->render(); }
public function actionOrgGraph() { $renderOrgGraphModalView = new AccountOrgChartModalView(); $view = new ModalView($this, $renderOrgGraphModalView); return $view->render(); }
public function actionJobLogsModalList($type) { assert('is_string($type) && $type != ""'); $jobClassName = $type . 'Job'; $searchAttributeData = array(); $searchAttributeData['clauses'] = array(1 => array('attributeName' => 'type', 'operatorType' => 'equals', 'value' => $type)); $searchAttributeData['structure'] = '1'; $pageSize = Yii::app()->pagination->resolveActiveForCurrentUserByType('subListPageSize'); $dataProvider = new RedBeanModelDataProvider('JobLog', 'startDateTime', true, $searchAttributeData, array('pagination' => array('pageSize' => $pageSize))); Yii::app()->getClientScript()->setToAjaxMode(); $jobLogsListView = new JobLogsModalListView($this->getId(), $this->getModule()->getId(), 'JobLog', $dataProvider, 'modal'); $view = new ModalView($this, $jobLogsListView); echo $view->render(); }
public function actionPreviewFooter($isHtmlContent, $content) { Yii::app()->getClientScript()->setToAjaxMode(); $view = new GlobalMarketingFooterConfigurationPreviewView((bool) $isHtmlContent, $content); $modalView = new ModalView($this, $view); echo $modalView->render(); }