[TASK] Add default page setup on new installations 76/44276/8
authorBenjamin Mack <benni@typo3.org>
Mon, 26 Oct 2015 06:11:01 +0000 (07:11 +0100)
committerFrank Nägler <frank.naegler@typo3.org>
Fri, 30 Oct 2015 19:03:58 +0000 (20:03 +0100)
Adds a page and a sys_template to the system
after installation, using Fluid Styled Content
by default.

Resolves: #70579
Releases: master
Change-Id: I318d0a6f4d03d617417a9cb3b1dde93e90f49934
Reviewed-on: https://review.typo3.org/44276
Reviewed-by: Wouter Wolters <typo3@wouterwolters.nl>
Reviewed-by: Gernot Schulmeister <gernotschulmeister@gmx.at>
Tested-by: Gernot Schulmeister <gernotschulmeister@gmx.at>
Reviewed-by: Frank Nägler <frank.naegler@typo3.org>
Tested-by: Frank Nägler <frank.naegler@typo3.org>
typo3/sysext/install/Classes/Controller/Action/Step/DefaultConfiguration.php
typo3/sysext/install/Resources/Private/Templates/Action/Step/DefaultConfiguration.html

index 00d69ab..dcb6942 100644 (file)
@@ -34,18 +34,73 @@ class DefaultConfiguration extends AbstractStepAction
         $configurationValues = $featureManager->getBestMatchingConfigurationForAllFeatures();
 
         // let the admin user redirect to the distributions page on first login
-        if (isset($this->postValues['values']['loaddistributions'])) {
-
-            // update the admin backend user to show the distribution management on login
-            $adminUserFirstLogin = array(
-                'startModuleOnFirstLogin' => 'tools_ExtensionmanagerExtensionmanager->tx_extensionmanager_tools_extensionmanagerextensionmanager%5Baction%5D=distributions&tx_extensionmanager_tools_extensionmanagerextensionmanager%5Bcontroller%5D=List',
-                'ucSetByInstallTool' => '1',
-            );
-            $this->getDatabaseConnection()->exec_UPDATEquery(
+        switch ($this->postValues['values']['sitesetup']) {
+            // Update the admin backend user to show the distribution management on login
+            case 'loaddistribution':
+                $adminUserFirstLogin = array(
+                    'startModuleOnFirstLogin' => 'tools_ExtensionmanagerExtensionmanager->tx_extensionmanager_tools_extensionmanagerextensionmanager%5Baction%5D=distributions&tx_extensionmanager_tools_extensionmanagerextensionmanager%5Bcontroller%5D=List',
+                    'ucSetByInstallTool' => '1',
+                );
+                $this->getDatabaseConnection()->exec_UPDATEquery(
                     'be_users',
                     'admin=1',
                     array('uc' => serialize($adminUserFirstLogin))
-            );
+                );
+            break;
+
+            // Create a page with UID 1 and PID1 and fluid_styled_content for page TS config, respect ownership
+            case 'createsite':
+                $this->getDatabaseConnection()->exec_INSERTquery(
+                    'pages',
+                    array(
+                        'pid' => 0,
+                        'crdate' => time(),
+                        'cruser_id' => 1,
+                        'tstamp' => time(),
+                        'title' => 'Home',
+                        'doktype' => 1,
+                        'is_siteroot' => 1,
+                        'perms_userid' => 1,
+                        'perms_groupid' => 1,
+                        'perms_user' => 32,
+                        'perms_group' => 32,
+                        'perms_everybody' => 1
+                    )
+                );
+
+                $pageUid = $this->getDatabaseConnection()->sql_insert_id();
+
+                // add a root sys_template with fluid_styled_content and a default PAGE typoscript snippet
+                $this->getDatabaseConnection()->exec_INSERTquery(
+                    'sys_template',
+                    array(
+                        'pid' => $pageUid,
+                        'crdate' => time(),
+                        'cruser_id' => 1,
+                        'tstamp' => time(),
+                        'title' => 'Main TypoScript Rendering',
+                        'sitetitle' => $GLOBALS['TYPO3_CONF_VARS']['SYS']['sitename'],
+                        'root' => 1,
+                        'clear' => 1,
+                        'include_static_file' => 'EXT:fluid_styled_content/Configuration/TypoScript/Static/,EXT:fluid_styled_content/Configuration/TypoScript/Styling/',
+                        'constants' => '',
+                        'config' => 'page = PAGE
+page.10 = TEXT
+page.10.value (
+   <div style="width: 800px; margin: 15% auto;">
+      <div style="width: 300px;">
+        <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 150 42"><path d="M60.2 14.4v27h-3.8v-27h-6.7v-3.3h17.1v3.3h-6.6zm20.2 12.9v14h-3.9v-14l-7.7-16.2h4.1l5.7 12.2 5.7-12.2h3.9l-7.8 16.2zm19.5 2.6h-3.6v11.4h-3.8V11.1s3.7-.3 7.3-.3c6.6 0 8.5 4.1 8.5 9.4 0 6.5-2.3 9.7-8.4 9.7m.4-16c-2.4 0-4.1.3-4.1.3v12.6h4.1c2.4 0 4.1-1.6 4.1-6.3 0-4.4-1-6.6-4.1-6.6m21.5 27.7c-7.1 0-9-5.2-9-15.8 0-10.2 1.9-15.1 9-15.1s9 4.9 9 15.1c.1 10.6-1.8 15.8-9 15.8m0-27.7c-3.9 0-5.2 2.6-5.2 12.1 0 9.3 1.3 12.4 5.2 12.4 3.9 0 5.2-3.1 5.2-12.4 0-9.4-1.3-12.1-5.2-12.1m19.9 27.7c-2.1 0-5.3-.6-5.7-.7v-3.1c1 .2 3.7.7 5.6.7 2.2 0 3.6-1.9 3.6-5.2 0-3.9-.6-6-3.7-6H138V24h3.1c3.5 0 3.7-3.6 3.7-5.3 0-3.4-1.1-4.8-3.2-4.8-1.9 0-4.1.5-5.3.7v-3.2c.5-.1 3-.7 5.2-.7 4.4 0 7 1.9 7 8.3 0 2.9-1 5.5-3.3 6.3 2.6.2 3.8 3.1 3.8 7.3 0 6.6-2.5 9-7.3 9"/><path fill="#FF8700" d="M31.7 28.8c-.6.2-1.1.2-1.7.2-5.2 0-12.9-18.2-12.9-24.3 0-2.2.5-3 1.3-3.6C12 1.9 4.3 4.2 1.9 7.2 1.3 8 1 9.1 1 10.6c0 9.5 10.1 31 17.3 31 3.3 0 8.8-5.4 13.4-12.8M28.4.5c6.6 0 13.2 1.1 13.2 4.8 0 7.6-4.8 16.7-7.2 16.7-4.4 0-9.9-12.1-9.9-18.2C24.5 1 25.6.5 28.4.5"/></svg>
+      </div>
+      <h4 style="font-family: Verdana, Arial, Helvetica, sans-serif;">Welcome to a default website made with <a href="https://typo3.org">TYPO3</a></h4>
+   </div>
+)
+page.100 < styles.content.get',
+                        'description' => 'This is an Empty Site Package TypoScript template.
+
+For each website you need a TypoScript template on the main page of your website (on the top level). For better maintenance all TypoScript should be extracted into external files via <INCLUDE_TYPOSCRIPT: source="FILE:EXT:site_myproject/Configuration/TypoScript/setup.ts">.'
+                    )
+                );
+            break;
         }
 
         // Setting SYS/isInitialInstallationInProgress to FALSE marks this instance installation as complete
index 2a51301..a2434d1 100644 (file)
        <form method="post">
                <f:render partial="Action/Common/HiddenFormFields" arguments="{_all}" />
                <input type="hidden" value="execute" name="install[set]" />
-               <fieldset class="t3-install-form-label-width-21 t3-install-form-label-after">
+               <fieldset class="t3-install-form-label-after">
                        <ol>
                                <li>
-                                       <input type="checkbox" id="load-distributions" name="install[values][loaddistributions]" value="1" checked="checked" />
+                                       <input type="radio" id="load-distributions" name="install[values][sitesetup]" value="loaddistribution" />
                                        <label for="load-distributions">Yes, download the list of distributions.</label>
                                </li>
+                               <li>
+                                       <input type="radio" id="create-site" name="install[values][sitesetup]" value="createsite" />
+                                       <label for="create-site">Yes, create a base empty page to start from.</label>
+                               </li>
+                               <li>
+                                       <input type="radio" id="do-nothing" name="install[values][sitesetup]" value="donothing" checked="checked" />
+                                       <label for="do-nothing">Do nothing, just get me to the Backend.</label>
+                               </li>
                        </ol>
                </fieldset>
                <hr />
@@ -39,4 +47,4 @@
                        Open the backend
                </button>
        </form>
-</f:section>
\ No newline at end of file
+</f:section>