コード例 #1
0
 /**
  * Returns the form definitions for the step
  *
  * @param \TYPO3\Form\Core\Model\FormDefinition $formDefinition
  * @return void
  */
 protected function buildForm(\TYPO3\Form\Core\Model\FormDefinition $formDefinition)
 {
     $page1 = $formDefinition->createPage('page1');
     $page1->setRenderingOption('header', 'Setup complete');
     $congratulations = $page1->createElement('congratulationsSection', 'TYPO3.Form:Section');
     $congratulations->setLabel('Congratulations');
     $success = $congratulations->createElement('success', 'TYPO3.Form:StaticText');
     $success->setProperty('text', 'You have successfully installed Neos! If you need help getting started, please refer to the Neos documentation.');
     $success->setProperty('elementClassAttribute', 'alert alert-success');
     $docs = $congratulations->createElement('docsLink', 'TYPO3.Setup:LinkElement');
     $docs->setLabel('Read the documentation');
     $docs->setProperty('href', 'http://docs.typo3.org/neos/');
     $docs->setProperty('target', '_blank');
     $frontend = $page1->createElement('frontendSection', 'TYPO3.Form:Section');
     $frontend->setLabel('View the site');
     $link = $frontend->createElement('link', 'TYPO3.Setup:LinkElement');
     $link->setLabel('Go to the frontend');
     $link->setProperty('href', '/');
     $link->setProperty('elementClassAttribute', 'btn btn-large btn-primary');
     $backend = $page1->createElement('backendSection', 'TYPO3.Form:Section');
     $backend->setLabel('Start editing');
     $backendLink = $backend->createElement('backendLink', 'TYPO3.Setup:LinkElement');
     $backendLink->setLabel('Go to the backend');
     $backendLink->setProperty('href', '/neos');
     $backendLink->setProperty('elementClassAttribute', 'btn btn-large btn-primary');
     $loggedOut = $page1->createElement('loggedOut', 'TYPO3.Form:StaticText');
     $loggedOut->setProperty('text', 'You have automatically been logged out for security reasons since this is the final step. Refresh the page to log in again if you missed something.');
     $loggedOut->setProperty('elementClassAttribute', 'alert alert-info');
 }
コード例 #2
0
 /**
  * Returns the form definitions for the step
  *
  * @param \TYPO3\Form\Core\Model\FormDefinition $formDefinition
  * @return void
  */
 protected function buildForm(\TYPO3\Form\Core\Model\FormDefinition $formDefinition)
 {
     $page1 = $formDefinition->createPage('page1');
     $introduction = $page1->createElement('introduction', 'TYPO3.Form:StaticText');
     $introduction->setProperty('text', 'Create an administrator account:');
     $personalSection = $page1->createElement('personalSection', 'TYPO3.Form:Section');
     $personalSection->setLabel('Personal Data');
     $firstName = $personalSection->createElement('firstName', 'TYPO3.Form:SingleLineText');
     $firstName->setLabel('First name');
     $firstName->addValidator(new \TYPO3\FLOW3\Validation\Validator\NotEmptyValidator());
     $firstName->addValidator(new \TYPO3\FLOW3\Validation\Validator\StringLengthValidator(array('minimum' => 1, 'maximum' => 255)));
     $lastName = $personalSection->createElement('lastName', 'TYPO3.Form:SingleLineText');
     $lastName->setLabel('Last name');
     $lastName->addValidator(new \TYPO3\FLOW3\Validation\Validator\NotEmptyValidator());
     $lastName->addValidator(new \TYPO3\FLOW3\Validation\Validator\StringLengthValidator(array('minimum' => 1, 'maximum' => 255)));
     $credentialsSection = $page1->createElement('credentialsSection', 'TYPO3.Form:Section');
     $credentialsSection->setLabel('Credentials');
     $username = $credentialsSection->createElement('username', 'TYPO3.Form:SingleLineText');
     $username->setLabel('Username');
     $username->addValidator(new \TYPO3\FLOW3\Validation\Validator\NotEmptyValidator());
     $username->addValidator(new \TYPO3\FLOW3\Validation\Validator\AlphanumericValidator());
     $username->addValidator(new \TYPO3\TYPO3\Validation\Validator\AccountExistsValidator(array('authenticationProviderName' => 'Typo3BackendProvider')));
     $password = $credentialsSection->createElement('password', 'TYPO3.Form:PasswordWithConfirmation');
     $password->addValidator(new \TYPO3\FLOW3\Validation\Validator\NotEmptyValidator());
     $password->addValidator(new \TYPO3\FLOW3\Validation\Validator\StringLengthValidator(array('minimum' => 6, 'maximum' => 255)));
     $password->setLabel('Password');
 }
コード例 #3
0
 /**
  * Returns the form definitions for the step
  *
  * @param \TYPO3\Form\Core\Model\FormDefinition $formDefinition
  * @return void
  */
 protected function buildForm(\TYPO3\Form\Core\Model\FormDefinition $formDefinition)
 {
     $page1 = $formDefinition->createPage('page1');
     $page1->setRenderingOption('header', 'Create administrator account');
     $introduction = $page1->createElement('introduction', 'TYPO3.Form:StaticText');
     $introduction->setProperty('text', 'Enter the personal data and credentials for your backend account:');
     $personalSection = $page1->createElement('personalSection', 'TYPO3.Form:Section');
     $personalSection->setLabel('Personal Data');
     $firstName = $personalSection->createElement('firstName', 'TYPO3.Form:SingleLineText');
     $firstName->setLabel('First name');
     $firstName->addValidator(new NotEmptyValidator());
     $firstName->addValidator(new StringLengthValidator(array('minimum' => 1, 'maximum' => 255)));
     $lastName = $personalSection->createElement('lastName', 'TYPO3.Form:SingleLineText');
     $lastName->setLabel('Last name');
     $lastName->addValidator(new NotEmptyValidator());
     $lastName->addValidator(new StringLengthValidator(array('minimum' => 1, 'maximum' => 255)));
     $credentialsSection = $page1->createElement('credentialsSection', 'TYPO3.Form:Section');
     $credentialsSection->setLabel('Credentials');
     $username = $credentialsSection->createElement('username', 'TYPO3.Form:SingleLineText');
     $username->setLabel('Username');
     $username->addValidator(new NotEmptyValidator());
     $username->addValidator(new UserDoesNotExistValidator());
     $password = $credentialsSection->createElement('password', 'TYPO3.Form:PasswordWithConfirmation');
     $password->addValidator(new NotEmptyValidator());
     $password->addValidator(new StringLengthValidator(array('minimum' => 6, 'maximum' => 255)));
     $password->setLabel('Password');
     $password->setProperty('passwordDescription', 'At least 6 characters');
     $formDefinition->setRenderingOption('skipStepNotice', 'If you skip this step make sure that you have an existing user or create one with the user:create command');
 }
コード例 #4
0
 /**
  * @param JobConfigurationInterface $jobConfiguration
  * @param FormDefinition $formDefinition
  */
 protected function postProcessFormDefinition(JobConfigurationInterface $jobConfiguration, FormDefinition $formDefinition)
 {
     $redirectFinisher = new ExecuteJobFinisher();
     $redirectFinisher->setOptions(['path' => 'management/jobsbutler', 'action' => 'index']);
     $formDefinition->addFinisher($redirectFinisher);
     /** @var Page $firstPage */
     $page = $formDefinition->getPages()[0];
     $jobIdentifier = $page->createElement('jobIdentifier', 'TYPO3.Form:HiddenField');
     $jobIdentifier->setDefaultValue($jobConfiguration->getIdentifier());
     $jobIdentifier->addValidator(new NotEmptyValidator());
 }
コード例 #5
0
 /**
  * Returns the form definitions for the step
  *
  * @param \TYPO3\Form\Core\Model\FormDefinition $formDefinition
  * @return void
  */
 protected function buildForm(\TYPO3\Form\Core\Model\FormDefinition $formDefinition)
 {
     $page1 = $formDefinition->createPage('page1');
     $page1->setRenderingOption('header', 'Select your Git Driver');
     $driverSection = $page1->createElement('driverSection', 'TYPO3.Form:Section');
     $gitDriver = $driverSection->createElement('gitDriver', 'TYPO3.Form:SingleSelectDropdown');
     $gitDriver->setLabel('Git Driver');
     $gitDriver->setProperty('options', array('GitHub' => 'Git Hub', 'GitLab' => 'Git Lab', 'BitBucket' => 'Bit Bucket'));
     $gitDriver->addValidator(new NotEmptyValidator());
     $gitDriver->setDefaultValue(Arrays::getValueByPath($this->distributionSettings, 'Lightwerk.SurfCaptain.sources.default.driver'));
     $formDefinition->setRenderingOption('skipStepNotice', 'If you skip this step make sure that you have configured your Git Repositories in Settings.yaml');
 }
コード例 #6
0
 /**
  * Returns the form definitions for the step
  *
  * @param \TYPO3\Form\Core\Model\FormDefinition $formDefinition
  * @return void
  */
 protected function buildForm(\TYPO3\Form\Core\Model\FormDefinition $formDefinition)
 {
     $page1 = $formDefinition->createPage('page1');
     $page1->setRenderingOption('header', 'Deployment Settings');
     $deploymentSection = $page1->createElement('deploymentSection', 'TYPO3.Form:Section');
     $user = $deploymentSection->createElement('defaultUser', 'TYPO3.Form:SingleLineText');
     $user->setLabel('Deployment user. Default SSH user for deployment on target systems (optional, will be configurable per target system later on).');
     $user->setDefaultValue(Arrays::getValueByPath($this->distributionSettings, 'Lightwerk.SurfCaptain.frontendSettings.defaultUser'));
     $path = $deploymentSection->createElement('defaultDeploymentPath', 'TYPO3.Form:SingleLineText');
     $path->setLabel('Deployment Path. Default target path for deployments, e.g. "/var/www/{{project}}/{{suffix}}/htdocs/" (optional, will be configurable per target system later on	).');
     $path->setDefaultValue(Arrays::getValueByPath($this->distributionSettings, 'Lightwerk.SurfCaptain.frontendSettings.defaultDeploymentPath'));
     $formDefinition->setRenderingOption('skipStepNotice', 'You can always configure your frontend settings later in Settings.yaml');
 }
コード例 #7
0
ファイル: FinalStep.php プロジェクト: radmiraal/TYPO3.TYPO3
 /**
  * Returns the form definitions for the step
  *
  * @param \TYPO3\Form\Core\Model\FormDefinition $formDefinition
  * @return void
  */
 protected function buildForm(\TYPO3\Form\Core\Model\FormDefinition $formDefinition)
 {
     $page1 = $formDefinition->createPage('page1');
     $title = $page1->createElement('connectionSection', 'TYPO3.Form:Section');
     $title->setLabel('Congratulations');
     $success = $title->createElement('success', 'TYPO3.Form:StaticText');
     $success->setProperty('text', 'You successfully completed the setup');
     $success->setProperty('class', 'alert alert-success');
     $link = $title->createElement('link', 'TYPO3.Setup:LinkElement');
     $link->setLabel('Go to the homepage');
     $link->setProperty('href', '/');
     $link->setProperty('class', 'btn btn-large btn-primary');
     $backendLink = $title->createElement('backendLink', 'TYPO3.Setup:LinkElement');
     $backendLink->setLabel('Go to the backend');
     $backendLink->setProperty('href', '/typo3');
     $backendLink->setProperty('class', 'btn btn-large');
 }
コード例 #8
0
ファイル: FinalStep.php プロジェクト: lightwerk/surfcaptain
 /**
  * Returns the form definitions for the step
  *
  * @param \TYPO3\Form\Core\Model\FormDefinition $formDefinition
  * @return void
  */
 protected function buildForm(\TYPO3\Form\Core\Model\FormDefinition $formDefinition)
 {
     $page1 = $formDefinition->createPage('page1');
     $page1->setRenderingOption('header', 'Setup complete');
     $congratulations = $page1->createElement('congratulationsSection', 'TYPO3.Form:Section');
     $congratulations->setLabel('Congratulations');
     $success = $congratulations->createElement('success', 'TYPO3.Form:StaticText');
     $success->setProperty('text', 'You have successfully installed Lightwerk SurfCaptain!');
     $success->setProperty('elementClassAttribute', 'alert alert-success');
     $frontend = $page1->createElement('frontendSection', 'TYPO3.Form:Section');
     $frontend->setLabel('View the site');
     $link = $frontend->createElement('link', 'TYPO3.Setup:LinkElement');
     $link->setLabel('Go to the frontend');
     $link->setProperty('href', '/');
     $link->setProperty('elementClassAttribute', 'btn btn-large btn-primary');
     $loggedOut = $page1->createElement('loggedOut', 'TYPO3.Form:StaticText');
     $loggedOut->setProperty('text', 'You have automatically been logged out for security reasons since this is the final step. Refresh the page to log in again if you missed something.');
     $loggedOut->setProperty('elementClassAttribute', 'alert alert-info');
 }
コード例 #9
0
 /**
  * Returns the form definitions for the step
  *
  * @param \TYPO3\Form\Core\Model\FormDefinition $formDefinition
  * @return void
  */
 protected function buildForm(\TYPO3\Form\Core\Model\FormDefinition $formDefinition)
 {
     $page1 = $formDefinition->createPage('page1');
     $page1->setRenderingOption('header', 'Verification Git Configuration');
     $verificationSection = $page1->createElement('verificationSection', 'TYPO3.Form:Section');
     $verificationSection->setLabel('Tried to fetch your git repositories.');
     $result = $verificationSection->createElement('result', 'TYPO3.Form:StaticText');
     try {
         $repositories = $this->driverComposite->getRepositories();
         $result->setProperty('text', 'Success: found ' . count($repositories) . ' repositories');
         $result->setProperty('elementClassAttribute', 'alert alert-success');
     } catch (\Lightwerk\SurfCaptain\Exception $e) {
         $result->setProperty('text', 'Failed with error ' . $e->getMessage() . ' - ' . $e->getCode());
         $result->setProperty('elementClassAttribute', 'alert alert-error');
     } catch (\TYPO3\Flow\Http\Exception $e) {
         $result->setProperty('text', 'Failed with error ' . $e->getMessage() . ' - ' . $e->getCode());
         $result->setProperty('elementClassAttribute', 'alert alert-error');
     }
 }
コード例 #10
0
 /**
  * Returns the form definitions for the step
  *
  * @param \TYPO3\Form\Core\Model\FormDefinition $formDefinition
  * @return void
  */
 protected function buildForm(\TYPO3\Form\Core\Model\FormDefinition $formDefinition)
 {
     $page1 = $formDefinition->createPage('page1');
     $title = $page1->createElement('connectionSection', 'TYPO3.Form:Section');
     $title->setLabel('Import a site');
     $sitePackages = array();
     foreach ($this->packageManager->getActivePackages() as $package) {
         $packageMetaData = $package->getPackageMetaData();
         if (in_array('Site', $packageMetaData->getCategories())) {
             $sitePackages[$package->getPackageKey()] = $packageMetaData->getTitle();
         }
     }
     if (count($sitePackages) > 0) {
         $site = $title->createElement('site', 'TYPO3.Form:SingleSelectDropdown');
         $site->setLabel('Select a site');
         $site->setProperty('options', $sitePackages);
         $site->addValidator(new \TYPO3\FLOW3\Validation\Validator\NotEmptyValidator());
         $sites = $this->siteRepository->findAll();
         if ($sites->count() > 0) {
             $prune = $title->createElement('prune', 'TYPO3.Form:Checkbox');
             $prune->setLabel('Delete existing sites');
         }
     } else {
         $error = $title->createElement('error', 'TYPO3.Form:StaticText');
         $error->setProperty('text', 'No site packages were available, make sure you have an active site package');
         $error->setProperty('class', 'alert alert-warning');
     }
     $newPackageSection = $page1->createElement('newPackageSection', 'TYPO3.Form:Section');
     $newPackageSection->setLabel('Create a new site');
     $packageName = $newPackageSection->createElement('packageKey', 'TYPO3.Form:SingleLineText');
     $packageName->setLabel('Package Name (in form "Vendor.MyPackageName")');
     $packageName->addValidator(new \TYPO3\FLOW3\Validation\Validator\RegularExpressionValidator(array('regularExpression' => \TYPO3\FLOW3\Package\PackageInterface::PATTERN_MATCH_PACKAGEKEY)));
     $siteName = $newPackageSection->createElement('siteName', 'TYPO3.Form:SingleLineText');
     $siteName->setLabel('Site Name');
     $step = $this;
     $callback = function (\TYPO3\Form\Core\Model\FinisherContext $finisherContext) use($step) {
         $step->importSite($finisherContext);
     };
     $this->closureFinisher = new \TYPO3\Form\Finishers\ClosureFinisher();
     $this->closureFinisher->setOption('closure', $callback);
     $formDefinition->addFinisher($this->closureFinisher);
 }
コード例 #11
0
ファイル: FinalStep.php プロジェクト: kdambekalns/setup
 /**
  * Returns the form definitions for the step
  *
  * @param \TYPO3\Form\Core\Model\FormDefinition $formDefinition
  * @return void
  */
 protected function buildForm(\TYPO3\Form\Core\Model\FormDefinition $formDefinition)
 {
     $page1 = $formDefinition->createPage('page1');
     $page1->setRenderingOption('header', 'Setup complete');
     $title = $page1->createElement('connectionSection', 'TYPO3.Form:Section');
     $title->setLabel('Congratulations');
     $success = $title->createElement('success', 'TYPO3.Form:StaticText');
     $success->setProperty('text', 'You successfully completed the setup');
     $success->setProperty('elementClassAttribute', 'alert alert-success');
     $link = $title->createElement('link', 'TYPO3.Setup:LinkElement');
     $link->setLabel('Go to the homepage');
     $link->setProperty('href', '/');
     $link->setProperty('elementClassAttribute', 'btn btn-large btn-primary');
     $info = $title->createElement('info', 'TYPO3.Form:StaticText');
     $info->setProperty('text', 'If the homepage doesn\'t work, you might need configure routing in Configuration/Routes.yaml');
     $info->setProperty('elementClassAttribute', 'alert alert-info');
     $loggedOut = $page1->createElement('loggedOut', 'TYPO3.Form:StaticText');
     $loggedOut->setProperty('text', 'You have automatically been logged out for security reasons since this is the final step. Refresh the page to log in again if you missed something.');
     $loggedOut->setProperty('elementClassAttribute', 'alert alert-info');
 }
    /**
     * {@inheritdoc}
     */
    protected function buildForm(FormDefinition $formDefinition)
    {
        $page1 = $formDefinition->createPage('page1');
        $page1->setRenderingOption('header', 'Neos requirements check');
        $imageSection = $page1->createElement('connectionSection', 'TYPO3.Form:Section');
        $imageSection->setLabel('Image Manipulation');
        $formElement = $imageSection->createElement('imageLibrariesInfo', 'TYPO3.Form:StaticText');
        $formElement->setProperty('text', 'We checked for supported image manipulation libraries on your server.
		Only one is needed and we select the best one available for you.
		Using GD in production environment is not recommended as it has some issues and can easily lead to blank pages due to memory exhaustion.');
        $formElement->setProperty('elementClassAttribute', 'alert alert-primary');
        $foundImageHandler = false;
        foreach (array('gd', 'gmagick', 'imagick') as $extensionName) {
            $formElement = $imageSection->createElement($extensionName, 'TYPO3.Form:StaticText');
            if (extension_loaded($extensionName)) {
                $unsupportedFormats = $this->findUnsupportedImageFormats($extensionName);
                if (count($unsupportedFormats) === 0) {
                    $formElement->setProperty('text', 'PHP extension "' . $extensionName . '" is installed');
                    $formElement->setProperty('elementClassAttribute', 'alert alert-info');
                    $foundImageHandler = $extensionName;
                } else {
                    $formElement->setProperty('text', 'PHP extension "' . $extensionName . '" is installed but lacks support for ' . implode(', ', $unsupportedFormats));
                    $formElement->setProperty('elementClassAttribute', 'alert alert-default');
                }
            } else {
                $formElement->setProperty('text', 'PHP extension "' . $extensionName . '" is not installed');
                $formElement->setProperty('elementClassAttribute', 'alert alert-default');
            }
        }
        if ($foundImageHandler === false) {
            $formElement = $imageSection->createElement('noImageLibrary', 'TYPO3.Form:StaticText');
            $formElement->setProperty('text', 'No suitable PHP extension for image manipulation was found. You can continue the setup but be aware that Neos might not work correctly without one of these extensions.');
            $formElement->setProperty('elementClassAttribute', 'alert alert-error');
        } else {
            $formElement = $imageSection->createElement('configuredImageLibrary', 'TYPO3.Form:StaticText');
            $formElement->setProperty('text', 'Neos will be configured to use extension "' . $foundImageHandler . '"');
            $formElement->setProperty('elementClassAttribute', 'alert alert-success');
            $hiddenField = $imageSection->createElement('imagineDriver', 'TYPO3.Form:HiddenField');
            $hiddenField->setDefaultValue(ucfirst($foundImageHandler));
        }
    }
コード例 #13
0
 /**
  * Returns the form definitions for the step
  *
  * @param \TYPO3\Form\Core\Model\FormDefinition $formDefinition
  * @return void
  */
 protected function buildForm(\TYPO3\Form\Core\Model\FormDefinition $formDefinition)
 {
     $page1 = $formDefinition->createPage('page1');
     $page1->setRenderingOption('header', 'Setup complete');
     $congratulations = $page1->createElement('congratulationsSection', 'TYPO3.Form:Section');
     $congratulations->setLabel('Congratulations');
     $success = $congratulations->createElement('success', 'TYPO3.Form:StaticText');
     $success->setProperty('text', 'You have successfully installed Neos! If you need help getting started, please refer to the Neos documentation.');
     $success->setProperty('elementClassAttribute', 'alert alert-success');
     $docs = $congratulations->createElement('docsLink', 'TYPO3.Setup:LinkElement');
     $docs->setLabel('Read the documentation');
     $docs->setProperty('href', 'https://neos.readthedocs.org/');
     $docs->setProperty('target', '_blank');
     $contextEnv = \TYPO3\Flow\Core\Bootstrap::getEnvironmentConfigurationSetting('FLOW_CONTEXT') ?: 'Development';
     $applicationContext = new ApplicationContext($contextEnv);
     if (!$applicationContext->isProduction()) {
         $context = $page1->createElement('contextSection', 'TYPO3.Form:Section');
         $context->setLabel('Define application context');
         $contextInfo = $context->createElement('contextInfo', 'TYPO3.Form:StaticText');
         $contextInfo->setProperty('text', 'Your Neos installation is currently not running in "Production" context. If you want to experience Neos with its full speed, you should now change your FLOW_CONTEXT environment variable to "Production".');
         $contextDocs = $context->createElement('contextDocsLink', 'TYPO3.Setup:LinkElement');
         $contextDocs->setLabel('Read about application contexts');
         $contextDocs->setProperty('href', 'http://flowframework.readthedocs.org/en/stable/TheDefinitiveGuide/PartIII/Bootstrapping.html#the-typo3-flow-application-context');
         $contextDocs->setProperty('target', '_blank');
     }
     $frontend = $page1->createElement('frontendSection', 'TYPO3.Form:Section');
     $frontend->setLabel('View the site');
     $link = $frontend->createElement('link', 'TYPO3.Setup:LinkElement');
     $link->setLabel('Go to the frontend');
     $link->setProperty('href', '/');
     $link->setProperty('elementClassAttribute', 'btn btn-large btn-primary');
     $backend = $page1->createElement('backendSection', 'TYPO3.Form:Section');
     $backend->setLabel('Start editing');
     $backendLink = $backend->createElement('backendLink', 'TYPO3.Setup:LinkElement');
     $backendLink->setLabel('Go to the backend');
     $backendLink->setProperty('href', '/neos');
     $backendLink->setProperty('elementClassAttribute', 'btn btn-large btn-primary');
     $loggedOut = $page1->createElement('loggedOut', 'TYPO3.Form:StaticText');
     $loggedOut->setProperty('text', 'You have automatically been logged out for security reasons since this is the final step. Refresh the page to log in again if you missed something.');
     $loggedOut->setProperty('elementClassAttribute', 'alert alert-info');
 }
コード例 #14
0
ファイル: DatabaseStep.php プロジェクト: kdambekalns/setup
 /**
  * Returns the form definitions for the step
  *
  * @param FormDefinition $formDefinition
  * @return void
  */
 protected function buildForm(FormDefinition $formDefinition)
 {
     $page1 = $formDefinition->createPage('page1');
     $page1->setRenderingOption('header', 'Configure database');
     $introduction = $page1->createElement('introduction', 'TYPO3.Form:StaticText');
     $introduction->setProperty('text', 'Please enter database details below:');
     $connectionSection = $page1->createElement('connectionSection', 'TYPO3.Form:Section');
     $connectionSection->setLabel('Connection');
     $databaseDriver = $connectionSection->createElement('driver', 'TYPO3.Form:SingleSelectDropdown');
     $databaseDriver->setLabel('DB Driver');
     $databaseDriver->setProperty('options', $this->getAvailableDrivers());
     $databaseDriver->setDefaultValue(Arrays::getValueByPath($this->distributionSettings, 'TYPO3.Flow.persistence.backendOptions.driver'));
     $databaseDriver->addValidator(new NotEmptyValidator());
     $databaseUser = $connectionSection->createElement('user', 'TYPO3.Form:SingleLineText');
     $databaseUser->setLabel('DB Username');
     $databaseUser->setDefaultValue(Arrays::getValueByPath($this->distributionSettings, 'TYPO3.Flow.persistence.backendOptions.user'));
     $databaseUser->addValidator(new NotEmptyValidator());
     $databasePassword = $connectionSection->createElement('password', 'TYPO3.Form:Password');
     $databasePassword->setLabel('DB Password');
     $databasePassword->setDefaultValue(Arrays::getValueByPath($this->distributionSettings, 'TYPO3.Flow.persistence.backendOptions.password'));
     $databaseHost = $connectionSection->createElement('host', 'TYPO3.Form:SingleLineText');
     $databaseHost->setLabel('DB Host');
     $defaultHost = Arrays::getValueByPath($this->distributionSettings, 'TYPO3.Flow.persistence.backendOptions.host');
     if ($defaultHost === NULL) {
         $defaultHost = '127.0.0.1';
     }
     $databaseHost->setDefaultValue($defaultHost);
     $databaseHost->addValidator(new NotEmptyValidator());
     $databaseSection = $page1->createElement('databaseSection', 'TYPO3.Form:Section');
     $databaseSection->setLabel('Database');
     $databaseName = $databaseSection->createElement('dbname', 'TYPO3.Setup:DatabaseSelector');
     $databaseName->setLabel('DB Name');
     $databaseName->setProperty('driverDropdownFieldId', $databaseDriver->getUniqueIdentifier());
     $databaseName->setProperty('userFieldId', $databaseUser->getUniqueIdentifier());
     $databaseName->setProperty('passwordFieldId', $databasePassword->getUniqueIdentifier());
     $databaseName->setProperty('hostFieldId', $databaseHost->getUniqueIdentifier());
     $databaseName->setDefaultValue(Arrays::getValueByPath($this->distributionSettings, 'TYPO3.Flow.persistence.backendOptions.dbname'));
     $databaseName->addValidator(new NotEmptyValidator());
 }
コード例 #15
0
 /**
  * @test
  * @dataProvider getUniqueIdentifierReplacesSpecialCharactersByUnderscoresProvider
  * @param string $formIdentifier
  * @param string $elementIdentifier
  * @param string $expectedResult
  */
 public function getUniqueIdentifierReplacesSpecialCharactersByUnderscores($formIdentifier, $elementIdentifier, $expectedResult)
 {
     $formDefinition = new FormDefinition($formIdentifier);
     $myFormElement = $this->getFormElement(array($elementIdentifier, 'TYPO3.Form:MyType'));
     $page = new Page('somePage');
     $formDefinition->addPage($page);
     $page->addElement($myFormElement);
     $this->assertSame($expectedResult, $myFormElement->getUniqueIdentifier());
 }
コード例 #16
0
 /**
  * Returns the form definitions for the step
  *
  * @param \TYPO3\Form\Core\Model\FormDefinition $formDefinition
  * @return void
  */
 protected function buildForm(\TYPO3\Form\Core\Model\FormDefinition $formDefinition)
 {
     $page1 = $formDefinition->createPage('page1');
     $page1->setRenderingOption('header', 'Create a new site');
     $introduction = $page1->createElement('introduction', 'TYPO3.Form:StaticText');
     $introduction->setProperty('text', 'There are two ways of creating a site. Choose between the following:');
     $importSection = $page1->createElement('import', 'TYPO3.Form:Section');
     $importSection->setLabel('Import a site from an existing site package');
     $sitePackages = array();
     foreach ($this->packageManager->getFilteredPackages('available', NULL, 'typo3-flow-site') as $package) {
         $sitePackages[$package->getPackageKey()] = $package->getPackageKey();
     }
     if (count($sitePackages) > 0) {
         $site = $importSection->createElement('site', 'TYPO3.Form:SingleSelectDropdown');
         $site->setLabel('Select a site package');
         $site->setProperty('options', $sitePackages);
         $site->addValidator(new \TYPO3\Flow\Validation\Validator\NotEmptyValidator());
         $sites = $this->siteRepository->findAll();
         if ($sites->count() > 0) {
             $prune = $importSection->createElement('prune', 'TYPO3.Form:Checkbox');
             $prune->setLabel('Delete existing sites');
         }
     } else {
         $error = $importSection->createElement('noSitePackagesError', 'TYPO3.Form:StaticText');
         $error->setProperty('text', 'No site packages were available, make sure you have an active site package');
         $error->setProperty('elementClassAttribute', 'alert alert-warning');
     }
     if ($this->packageManager->isPackageActive('TYPO3.Neos.Kickstarter')) {
         $separator = $page1->createElement('separator', 'TYPO3.Form:StaticText');
         $separator->setProperty('elementClassAttribute', 'section-separator');
         $newPackageSection = $page1->createElement('newPackageSection', 'TYPO3.Form:Section');
         $newPackageSection->setLabel('Create a new site package with a dummy site');
         $packageName = $newPackageSection->createElement('packageKey', 'TYPO3.Form:SingleLineText');
         $packageName->setLabel('Package Name (in form "Vendor.DomainCom")');
         $packageName->addValidator(new \TYPO3\Neos\Validation\Validator\PackageKeyValidator());
         $siteName = $newPackageSection->createElement('siteName', 'TYPO3.Form:SingleLineText');
         $siteName->setLabel('Site Name (e.g. "domain.com")');
     } else {
         $error = $importSection->createElement('neosKickstarterUnavailableError', 'TYPO3.Form:StaticText');
         $error->setProperty('text', 'The Neos Kickstarter package (TYPO3.Neos.Kickstarter) is not installed, install it for kickstarting new sites (using "composer require typo3/neos-kickstarter")');
         $error->setProperty('elementClassAttribute', 'alert alert-warning');
     }
     $explanation = $page1->createElement('explanation', 'TYPO3.Form:StaticText');
     $explanation->setProperty('text', 'Notice the difference between a site package and a site. A site package is a Flow package that can be used for creating multiple site instances.');
     $explanation->setProperty('elementClassAttribute', 'alert alert-info');
     $step = $this;
     $callback = function (\TYPO3\Form\Core\Model\FinisherContext $finisherContext) use($step) {
         $step->importSite($finisherContext);
     };
     $this->closureFinisher = new \TYPO3\Form\Finishers\ClosureFinisher();
     $this->closureFinisher->setOption('closure', $callback);
     $formDefinition->addFinisher($this->closureFinisher);
     $formDefinition->setRenderingOption('skipStepNotice', 'You can always import a site using the site:import command');
 }
コード例 #17
0
 /**
  * Returns the form definitions for the step
  *
  * @param \TYPO3\Form\Core\Model\FormDefinition $formDefinition
  * @return void
  */
 protected function buildForm(\TYPO3\Form\Core\Model\FormDefinition $formDefinition)
 {
     $settings = $this->configurationManager->getConfiguration(ConfigurationManager::CONFIGURATION_TYPE_SETTINGS, 'Lightwerk.SurfCaptain');
     $driver = $settings['sources']['default']['driver'];
     $page1 = $formDefinition->createPage('page1');
     $page1->setRenderingOption('header', 'Configure your Git Repository for ' . $driver . ' Driver');
     $generalSection = $page1->createElement('generalSection', 'TYPO3.Form:Section');
     $generalSection->setLabel('General Settings');
     $repositories = $generalSection->createElement('repositories', 'TYPO3.Form:SingleLineText');
     $repositories->setLabel('Repositories (csv) (e.g. ' . $this->exampleData[$driver]['repositories'] . ')');
     $repositories->addValidator(new NotEmptyValidator());
     $existingRepositories = Arrays::getValueByPath($this->distributionSettings, 'Lightwerk.SurfCaptain.sources.default.repositories');
     if (is_array($existingRepositories)) {
         $repositories->setDefaultValue(implode(',', $existingRepositories));
     }
     $driverSection = $page1->createElement('driverSection', 'TYPO3.Form:Section');
     $driverSection->setLabel('Driver Specific Settings');
     switch ($driver) {
         case 'GitHub':
             $privateToken = $driverSection->createElement('privateToken', 'TYPO3.Form:SingleLineText');
             $privateToken->setLabel('Private Token');
             $privateToken->addValidator(new NotEmptyValidator());
             $privateToken->setDefaultValue(Arrays::getValueByPath($this->distributionSettings, 'Lightwerk.SurfCaptain.sources.default.privateToken'));
             break;
         case 'GitLab':
             $privateToken = $driverSection->createElement('privateToken', 'TYPO3.Form:SingleLineText');
             $privateToken->setLabel('Private Token');
             $privateToken->addValidator(new NotEmptyValidator());
             $privateToken->setDefaultValue(Arrays::getValueByPath($this->distributionSettings, 'Lightwerk.SurfCaptain.sources.default.privateToken'));
             $apiUrl = $driverSection->createElement('apiUrl', 'TYPO3.Form:SingleLineText');
             $apiUrl->setLabel('Api Url (e.g. https://git.lightwerk.com/api/v3/)');
             $apiUrl->addValidator(new NotEmptyValidator());
             $apiUrl->setDefaultValue(Arrays::getValueByPath($this->distributionSettings, 'Lightwerk.SurfCaptain.sources.default.apiUrl'));
             $accountName = $driverSection->createElement('accountName', 'TYPO3.Form:SingleLineText');
             $accountName->setLabel('Account Name (e.g. git@git.lightwerk.com)');
             $accountName->addValidator(new NotEmptyValidator());
             $accountName->setDefaultValue(Arrays::getValueByPath($this->distributionSettings, 'Lightwerk.SurfCaptain.sources.default.accountName'));
             break;
         case 'BitBucket':
             $link = $driverSection->createElement('link', 'TYPO3.Setup:LinkElement');
             $link->setLabel('Read about OAuth on Bitbucket');
             $link->setProperty('href', 'https://confluence.atlassian.com/display/BITBUCKET/OAuth+on+Bitbucket');
             $link->setProperty('target', '_blank');
             $link->setProperty('elementClassAttribute', 'alert alert-info');
             $accountName = $driverSection->createElement('accountName', 'TYPO3.Form:SingleLineText');
             $accountName->setLabel('Account Name');
             $accountName->addValidator(new NotEmptyValidator());
             $accountName->setDefaultValue(Arrays::getValueByPath($this->distributionSettings, 'Lightwerk.SurfCaptain.sources.default.accountName'));
             $privateToken = $driverSection->createElement('privateToken', 'TYPO3.Form:SingleLineText');
             $privateToken->setLabel('Private Token');
             $privateToken->addValidator(new NotEmptyValidator());
             $privateToken->setDefaultValue(Arrays::getValueByPath($this->distributionSettings, 'Lightwerk.SurfCaptain.sources.default.privateToken'));
             $privateSecret = $driverSection->createElement('privateSecret', 'TYPO3.Form:SingleLineText');
             $privateSecret->setLabel('Private Secret');
             $privateSecret->addValidator(new NotEmptyValidator());
             $privateSecret->setDefaultValue(Arrays::getValueByPath($this->distributionSettings, 'Lightwerk.SurfCaptain.sources.default.privateSecret'));
             $accessToken = $driverSection->createElement('accessToken', 'TYPO3.Form:SingleLineText');
             $accessToken->setLabel('Access Token');
             $accessToken->addValidator(new NotEmptyValidator());
             $accessToken->setDefaultValue(Arrays::getValueByPath($this->distributionSettings, 'Lightwerk.SurfCaptain.sources.default.accessToken'));
             $accessSecret = $driverSection->createElement('accessSecret', 'TYPO3.Form:SingleLineText');
             $accessSecret->setLabel('Access Secret');
             $accessSecret->addValidator(new NotEmptyValidator());
             $accessSecret->setDefaultValue(Arrays::getValueByPath($this->distributionSettings, 'Lightwerk.SurfCaptain.sources.default.accessSecret'));
             break;
         default:
             throw new SetupException('Unknown driver ' . $driver, 1427623122);
     }
     $formDefinition->setRenderingOption('skipStepNotice', 'If you skip this step make sure that you have configured your Git Repositories in Settings.yaml');
 }
コード例 #18
0
ファイル: FormRuntime.php プロジェクト: sinso/TYPO3.Flow
 /**
  * Get the label which shall be displayed next to the form element
  *
  * @return string
  * @api
  */
 public function getLabel()
 {
     return $this->formDefinition->getLabel();
 }
コード例 #19
0
ファイル: FormRuntimeTest.php プロジェクト: kitsunet/form
 /**
  * @test
  */
 public function arrayAccessReturnsDefaultValuesIfSet()
 {
     $formDefinition = new FormDefinition('foo');
     $page1 = new Page('p1');
     $formDefinition->addPage($page1);
     $element1 = new \TYPO3\Form\FormElements\GenericFormElement('foo', 'Bar');
     $page1->addElement($element1);
     $element1->setDefaultValue('My Default');
     $formRuntime = $this->createFormRuntime($formDefinition);
     $formState = new \TYPO3\Form\Core\Runtime\FormState();
     $formRuntime->_set('formState', $formState);
     $this->assertSame($formState, $formRuntime->getFormState());
     $this->assertSame('My Default', $formRuntime['foo']);
     $formRuntime['foo'] = 'Overridden';
     $this->assertSame('Overridden', $formRuntime['foo']);
     $formRuntime['foo'] = null;
     $this->assertSame('My Default', $formRuntime['foo']);
     $formRuntime['foo'] = 'Overridden2';
     $this->assertSame('Overridden2', $formRuntime['foo']);
     unset($formRuntime['foo']);
     $this->assertSame('My Default', $formRuntime['foo']);
     $this->assertSame(null, $formRuntime['nonExisting']);
 }
コード例 #20
0
 /**
  * Helper to be called by every AbstractFormFactory after everything has been built to trigger the "onBuildingFinished"
  * template method on all form elements.
  *
  * @param \TYPO3\Form\Core\Model\FormDefinition $form
  * @return void
  * @api
  */
 protected function triggerFormBuildingFinished(\TYPO3\Form\Core\Model\FormDefinition $form)
 {
     foreach ($form->getRenderablesRecursively() as $renderable) {
         $renderable->onBuildingFinished();
     }
 }
コード例 #21
0
ファイル: FormDefinitionTest.php プロジェクト: kitsunet/form
 /**
  * @test
  * @expectedException \TYPO3\Form\Exception\FinisherPresetNotFoundException
  */
 public function createFinisherThrowsExceptionIfFinisherPresetNotFound()
 {
     $formDefinition = new FormDefinition('foo1');
     $formDefinition->createFinisher('asdf');
 }