Beispiel #1
0
 /**
  * Entry point of the patch execution.
  */
 public function execute()
 {
     // Update forms.
     $this->executeSQLQuery("create table m_form_doc_baseform  select * from m_form_doc_form");
     $this->executeSQLQuery("create table m_form_doc_baseform_i18n  select * from m_form_doc_form_i18n");
     $this->executeSQLQuery("RENAME TABLE `m_form_doc_form` TO `m_form_doc_form_todelete`;");
     $this->executeSQLQuery("RENAME TABLE `m_form_doc_form_i18n` TO `m_form_doc_form_i18n_todelete`;");
     $newPath = f_util_FileUtils::buildWebeditPath('modules/form/persistentdocument/mail.xml');
     $newModel = generator_PersistentModel::loadModelFromString(f_util_FileUtils::read($newPath), 'form', 'mail');
     $newProp = $newModel->getPropertyByName('acknowledgmentReceiver');
     f_persistentdocument_PersistentProvider::getInstance()->addProperty('form', 'mail', $newProp);
     $newPath = f_util_FileUtils::buildWebeditPath('modules/form/persistentdocument/form.xml');
     $newModel = generator_PersistentModel::loadModelFromString(f_util_FileUtils::read($newPath), 'form', 'form');
     $newProp = $newModel->getPropertyByName('saveResponse');
     f_persistentdocument_PersistentProvider::getInstance()->addProperty('form', 'baseform', $newProp);
     $newPath = f_util_FileUtils::buildWebeditPath('modules/form/persistentdocument/baseform.xml');
     $newModel = generator_PersistentModel::loadModelFromString(f_util_FileUtils::read($newPath), 'form', 'baseform');
     $newProp = $newModel->getPropertyByName('acknowledgment');
     f_persistentdocument_PersistentProvider::getInstance()->addProperty('form', 'baseform', $newProp);
     $newProp = $newModel->getPropertyByName('acknowledgmentNotification');
     f_persistentdocument_PersistentProvider::getInstance()->addProperty('form', 'baseform', $newProp);
     $this->execChangeCommand('compile-documents');
     foreach (form_FormService::getInstance()->createQuery()->find() as $form) {
         $form->setSaveResponse(true);
         $form->save();
     }
     // Update mail fields.
     $newPath = f_util_FileUtils::buildWebeditPath('modules/form/persistentdocument/mail.xml');
     $newModel = generator_PersistentModel::loadModelFromString(f_util_FileUtils::read($newPath), 'form', 'mail');
     $newProp = $newModel->getPropertyByName('initializeWithCurrentUserEmail');
     f_persistentdocument_PersistentProvider::getInstance()->addProperty('form', 'mail', $newProp);
     // Update text fields.
     $newPath = f_util_FileUtils::buildWebeditPath('modules/form/persistentdocument/text.xml');
     $newModel = generator_PersistentModel::loadModelFromString(f_util_FileUtils::read($newPath), 'form', 'text');
     $newProp = $newModel->getPropertyByName('disableAutocorrect');
     f_persistentdocument_PersistentProvider::getInstance()->addProperty('form', 'text', $newProp);
     $newProp = $newModel->getPropertyByName('disableAutocapitalize');
     f_persistentdocument_PersistentProvider::getInstance()->addProperty('form', 'text', $newProp);
     $newProp = $newModel->getPropertyByName('disableAutocomplete');
     f_persistentdocument_PersistentProvider::getInstance()->addProperty('form', 'text', $newProp);
     foreach (form_MailService::getInstance()->createQuery()->find() as $field) {
         $field->setDisableAutocorrect(true);
         $field->setDisableAutocapitalize(true);
         $field->save();
     }
     // Republish all forms.
     $bfs = form_BaseformService::getInstance();
     foreach ($bfs->createQuery()->find() as $form) {
         $bfs->publishIfPossible($form->getId());
     }
     // Create recipientGroupFolder and move all groups in it.
     $folder = form_RecipientGroupFolderService::getInstance()->getFolder();
     $folderId = $folder->getId();
     $rgs = form_RecipientGroupService::getInstance();
     foreach ($rgs->createQuery()->find() as $group) {
         $rgs->moveTo($group, $folderId);
     }
     $this->executeLocalXmlScript('newlist.xml');
     $this->log('If all went OK, you can delete m_form_doc_form_todelete and m_form_doc_form_i18n_todelete tables!');
 }
 /**
  * Mandatory execute method...
  *
  * @param block_BlockContext $context
  * @param block_BlockRequest $request
  */
 public function execute($context, $request)
 {
     FormHelper::addScriptsAndStyles($context);
     $form = $this->getParameter('form');
     $this->setTemplateName('markup/' . $form->getMarkup() . '/Form');
     $this->setAttribute('form', $form);
     $contents = array();
     form_FormService::getInstance()->buildContentsFromRequest($form->getDocumentNode()->getChildren(), $contents, $request, $form);
     $this->setAttribute('elements', $contents);
     if ($this->hasParameter('errors')) {
         $this->setAttribute('errors', $this->getParameter('errors'));
     }
     $this->setAttribute('selfUrl', $_SERVER['REQUEST_URI']);
     if ($request->getParameter(form_FormConstants::BACK_URL_PARAMETER)) {
         $backUrl = $request->getParameter(form_FormConstants::BACK_URL_PARAMETER);
     } else {
         if (isset($_SERVER['HTTP_REFERER'])) {
             $backUrl = $_SERVER['HTTP_REFERER'];
         } else {
             $backUrl = website_WebsiteModuleService::getInstance()->getCurrentWebsite()->getUrl();
         }
     }
     $this->setAttribute("receiverLabels", $this->getParameter("receiverLabels"));
     $this->setAttribute('requestParameters', $request->getParameters());
     $this->setAttribute('backUrl', $backUrl);
     $this->setAttribute('useCaptcha', $form->getDocumentService()->hasToUseCaptcha($form));
     $this->setAttribute('jQueryConditionalElement', $form->getDocumentService()->getJQueryForConditionalElementsOf($form));
 }
 /**
  * @param Context $context
  * @param Request $request
  */
 public function _execute($context, $request)
 {
     $forms = $this->getDocumentInstanceArrayFromRequest($request);
     $responseArchivedCount = 0;
     foreach ($forms as $form) {
         $responseArchivedCount += form_FormService::getInstance()->fileResponses($form);
     }
     if (Framework::isInfoEnabled()) {
         Framework::info('form/ArchiveResponse -> Filed responses : ' . $responseArchivedCount);
     }
     $request->setAttribute('message', $responseArchivedCount);
     return self::getSuccessView();
 }
 /**
  * @return form_persistentdocument_form
  */
 protected function initPersistentDocument()
 {
     return form_FormService::getInstance()->getNewDocumentInstance();
 }
 /**
  * @param block_BlockRequest $request
  */
 protected final function isFormPosted($request)
 {
     return form_FormService::getInstance()->isPostedFormId($this->getFormId(), $request);
 }