* Installer: Renamed the tab back from "Setup" to "Installer" to avoid problems in...
authorThomas Hempel <thomas.hempel@typo3.org>
Sun, 20 Jan 2008 12:22:09 +0000 (12:22 +0000)
committerThomas Hempel <thomas.hempel@typo3.org>
Sun, 20 Jan 2008 12:22:09 +0000 (12:22 +0000)
* Installer: reorganized installer module (rewrite)
* Installer: implemeted some features for setup module to make it usable for most cases
* Installer: added database checks (big thanks to Francois Suter!!!)
* Installer: started implementation of image checks
* Installer: prepared codebase for third party patches

git-svn-id: https://svn.typo3.org/TYPO3v4/Core/trunk@2929 709f56b5-9817-0410-a4d7-c38de5d9e867

21 files changed:
ChangeLog
typo3/sysext/install/mod/class.tx_install.php
typo3/sysext/install/mod/class.tx_install_basics.php
typo3/sysext/install/mod/class.tx_install_view.php
typo3/sysext/install/mod/locallang_mod.xml
typo3/sysext/install/mod/scripts.js
typo3/sysext/install/modules/class.tx_install_module_base.php
typo3/sysext/install/modules/database/class.tx_install_module_database.php
typo3/sysext/install/modules/database/conf.php
typo3/sysext/install/modules/database/locallang.xml
typo3/sysext/install/modules/gfx/class.tx_install_module_gfx.php
typo3/sysext/install/modules/gfx/conf.php
typo3/sysext/install/modules/gfx/locallang.xml
typo3/sysext/install/modules/installer/class.tx_install_module_installer.php
typo3/sysext/install/modules/installer/conf.php
typo3/sysext/install/modules/installer/locallang.xml
typo3/sysext/install/modules/installer/res/tpl_step.html
typo3/sysext/install/modules/setup/class.tx_install_module_setup.php
typo3/sysext/install/modules/setup/res/search_bubble.png [deleted file]
typo3/sysext/install/modules/setup/res/search_reset.png [deleted file]
typo3/sysext/install/modules/setup/res/styles.css

index 85605e6..3db59d4 100755 (executable)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,12 @@
+2008-01-20     Thomas Hempel  ²thomas@typo3-unleashed.net>
+
+       * Installer: Renamed the tab back from "Setup" to "Installer" to avoid problems in translation tool
+       * Installer: reorganized installer module (rewrite)
+       * Installer: implemeted some features for setup module to make it usable for most cases
+       * Installer: added database checks (big thanks to Francois Suter!!!)
+       * Installer: started implementation of image checks
+       * Installer: prepared codebase for third party patches
+
 2008-01-20  Ingo Renner  <ingo@typo3.org>
 
        * fixed bug #7211: "Start in Module" does not work anymore
index 82c4813..61e796b 100644 (file)
@@ -174,7 +174,7 @@ class tx_install {
                        $this->viewObj->addContent('', 'Install Tool deactivated.<br />You must enable it by setting a password in typo3conf/localconf.php. If you insert the line below, the password will be "joh316":<br /><br />$TYPO3_CONF_VARS[\'BE\'][\'installToolPassword\'] = \'bacb98acf97e0b6112b1d1b650b84971\';');
                        echo $this->viewObj->getDocCode();
                        die();
-               }       
+               }
                
                        // set some default module if nothing was set
                if (empty($this->env['module']))        {
@@ -211,6 +211,7 @@ class tx_install {
                        }
                }
                
+                       // Let's go on with the content if everything is fine here
                if($this->passwordOK) {
                        
                                // Try to connect to the database
@@ -218,7 +219,7 @@ class tx_install {
                                $moduleContent = $this->basicsObj->executeMethod(array('database', 'checkDatabaseConnect'));
                        }
                        
-                               // load module and execute main method
+                               // get the method to execute
                        $method = 'main';
                        if ($this->env['method'])       {
                                $method = $this->env['method'];
@@ -227,7 +228,7 @@ class tx_install {
                                // execute given method and save the result in a local variable
                                // This method is only be executed if we have database connection
                        $moduleContent = $this->basicsObj->executeMethod(array($this->env['module'], $method));
-                       
+       
                                // check if we have to handle the module content with AJAX
                        if ($this->env['ajax'] == 1)    {
                                header('X-JSON: (true)');
index 0fc9df6..f5d9f9d 100644 (file)
@@ -189,9 +189,8 @@ class tx_install_basics     {
                
                if($moduleClassName) {
                        $modules = $this->pObj->getLoadedModules();
-                       
-                       
-                       if(!is_object($modules[$moduleName])) {
+                       if(!is_object($modules[$moduleName]))   {
+                               $res = $this->loadModuleConfig($moduleName);
                                if($this->loadModuleConfig($moduleName) !== false) {
                                                // try to load the language data before we load the module
                                        $this->loadModuleLocallang($moduleName);
@@ -252,7 +251,7 @@ class tx_install_basics     {
                } else if(!method_exists($moduleObj, $methodName)) {
                        $this->addError(sprintf($this->getLabel('msg_error_methodnotfound'), $methodName, $moduleName), FATAL);
                        $returnValue = false;
-               } else if($args == NULL) {
+               } else if (is_null($args)) {
                        $returnValue = $moduleObj->$methodName();
                } else {
                        $returnValue = $moduleObj->$methodName($args);
@@ -506,6 +505,10 @@ class tx_install_basics    {
                        array_shift($path);
                }
                
+               if ($path[0] == 'db')   {
+                       $this->addDbDataToLocalconf(array($path[1] => $value));
+               }
+               
                $path = t3lib_div::trimExplode('/', $path[0]);
                
                $data = &$this->localconfCache['data'];
@@ -717,9 +720,10 @@ class tx_install_basics    {
         * @param       integer         $errorSeverity: The severity of the error (defined in view object!)
         * @param       string          $errorContext: The context of the error (general or fields)
         * @param       string          $errorField: The field where the error occured if errorContext is field
+        * @param       boolean         $onTop: If true, the error message is inserted on top of the list and not at the end
         * @return      void
         */
-       public function addError($errorMsg, $errorSeverity = WARNING, $errorContext = 'general', $errorField = NULL, $getLL = true) {
+       public function addError($errorMsg, $errorSeverity = WARNING, $errorContext = 'general', $errorField = NULL, $onTop = false) {
                $viewObj = $this->pObj->getViewObject();
                
                if(substr($errorMsg, 0, 4) == 'LLL:') {
@@ -729,11 +733,11 @@ class tx_install_basics   {
                
                switch ($errorContext) {
                        case 'fields':
-                               $viewObj->addError($errorContext, $error, $errorField);
+                               $viewObj->addError($errorContext, $error, $errorField, $onTop);
                                break;
                        case 'general':
                        default:
-                               $viewObj->addError($errorContext, $error);
+                               $viewObj->addError($errorContext, $error, '', $onTop);
                                break;
                }
        }
index 634411d..d2572ca 100644 (file)
@@ -559,13 +559,14 @@ class tx_install_view {
         *              severity => string
         *              label => string
         *              message => string
+        *              addBR => boolean
         * )
         * 
         * @param       array           $data: The content that should be rendered
         * @return      string          HTML output
         */
        private function renderMessage($data) {
-               $out = '<div'.(($data['severity']) ? ' class="severity_'.$data['severity'].'"' : '').'>';
+               $out = '<div'.(($data['severity']) ? ' class="installer-message severity_'.$data['severity'].'"' : '').'>';
                if ($data['label'])     {
                        if (is_array($data['label']))   {
                                $tag = $data['label'][0];
@@ -576,7 +577,7 @@ class tx_install_view {
                                $label = $data['label'];
                                $br = '<br />';
                        }
-                       $out .= $this->renderTag($tag, $label).$br;
+                       $out .= $this->renderTag($tag, $label, array('class' => 'message-header')).(($data['addBR'] === true) ? $br : '');
                }
                $out .= ($data['message']) ? $this->render($data['message']) : '';      
                $out .= '</div>';
@@ -932,12 +933,20 @@ class tx_install_view {
         * @param       string  error type
         * @param       string  error message
         */
-       public function addError($type, $errorMessage, $errorField = '') {
+       public function addError($type, $errorMessage, $errorField = '', $onTop = false) {
                
-               if($type == 'fields') {
-                       $this->errors[$type][$errorField][] = $errorMessage;
+               if ($onTop)     {
+                       if($type == 'fields') {
+                               array_unshift($this->errors[$type][$errorField], $errorMessage);
+                       } else {
+                               array_unshift($this->errors[$type], $errorMessage);
+                       }
                } else {
-                       $this->errors[$type][] = $errorMessage;
+                       if($type == 'fields') {
+                               $this->errors[$type][$errorField][] = $errorMessage;
+                       } else {
+                               $this->errors[$type][] = $errorMessage;
+                       }
                }
        }
        
index 4cff213..303e686 100755 (executable)
@@ -8,7 +8,7 @@
                <languageKey index="default" type="array">
                        <label index="mlang_labels_tablabel">Setup Center</label>
                        <label index="mlang_labels_tabdescr">Provides a simple link to the Setup Center. Notice the Install Tool (in typo3/install/) must be enabled.&lt;br /&gt;&lt;em&gt;Access for 'admin' users only!&lt;/em&gt;</label>
-                       <label index="mlang_tabs_tab">Setup</label>
+                       <label index="mlang_tabs_tab">Installation</label>
 
                        <!-- ERRORS and WARNINGS -->
                        <label index="msg_error_occured">An error occured. Please see details:</label>
@@ -68,6 +68,7 @@ REMOTE_ADDR was "%s" (%s)</label>
                        <label index="label_category_server">Server</label>
                        <label index="label_category_gfx">Graphics</label>
                        <label index="label_category_system">System</label>
+                       <label index="label_category_update">Update-Wizard</label>
 
                        <label index="label_subcategory_connection">Connection</label>
                        <label index="label_subcategory_cleanup">Clean Up</label>
@@ -80,12 +81,12 @@ REMOTE_ADDR was "%s" (%s)</label>
                        <label index="label_subcategory_gd">GD</label>
                        <label index="label_subcategory_igm">Image- GrapicsMagick</label>
                        <label index="label_subcategory_quality">Quality</label>
+                       <label index="label_subcategory_checks">Check</label>
                        <label index="label_subcategory_development">Development</label>
                        
                        <!-- DESCRIPTIONS -->
-                       <label index="descr_database">You are in section "Database". Here you can change and check all settings concerning your database.</label>
-                       <label index="descr_server">You are in section "Server".</label>
-                       <label index="descr_system">You are in section "System".</label>
+                       <label index="description_module_server">You are in section "Server".</label>
+                       <label index="description_module_system">You are in section "System".</label>
                        
                        <!-- MESSAGES -->
                        <label index="msg_setup_firstcall">SECURITY:
index f5b0975..b96fb6a 100644 (file)
@@ -190,6 +190,16 @@ function displayMethodResult(data) {
        }
 }
 
+/**
+ * This function takes a list of checkboxes (identified by their ID)
+ * and toggles them on or off depeding on the value of the flag
+ */
+function toggleCheckboxes(checkboxList, flag) {
+       for (i = 0; i < checkboxList.length; i++) {
+               $(checkboxList[i]).checked = flag;
+       }
+}
+
 allOpen = false;
 
        // add event observers
index 109713a..d2e78f1 100644 (file)
@@ -92,8 +92,22 @@ class tx_install_module_base {
         * 
         * @return      void
         */
-       protected function addError($errorMsg, $errorSeverity = WARNING, $errorContext = 'general', $errorField = NULL, $getLL = true)  {
-               $this->basicsObject->addError($errorMsg, $errorSeverity, $errorContext, $errorField, $getLL);
+       protected function addError($errorMsg, $errorSeverity = WARNING, $errorContext = 'general', $errorField = NULL, $onTop = false) {
+               $this->basicsObject->addError($errorMsg, $errorSeverity, $errorContext, $errorField, $onTop);
+       }
+       
+       /**
+        * Adds an array of errors to the general error-field. This uses the local addError method with default values
+        * for severity, context, field and onTop
+        *
+        * @param       array           $errors: Array with errormessages
+        */
+       protected function addErrors($errors)   {
+               if (is_array($errors))  {
+                       foreach ($errors as $error)     {
+                               $this->addError($error);
+                       }
+               }
        }
 }
 
index bd42915..caceec2 100755 (executable)
@@ -60,6 +60,9 @@ class tx_install_module_database extends tx_install_module_base       {
                        $this->addError('LLL:msg_database_error_cantconnect');
                        return false;
                }
+               
+               $this->pObj->getViewObject()->addMessage($this->get_LL('msg_database_connected'));
+                               
                return true;
        }
        
@@ -71,6 +74,60 @@ class tx_install_module_database extends tx_install_module_base      {
                }
                return true;
        }
+       
+       
+       /*
+        * METHODS
+        */
+       
+       /**
+        * Renders an overview over the most interesting database releated things
+        *
+        */
+       public function renderOverview()        {
+                       // connection possible?
+               $message = $this->get_LL('title_typo_db_host').': '.TYPO3_db_host.'<br />'.
+                       $this->get_LL('title_typo_db_username').': '.TYPO3_db_username.'<br />'.
+                       $this->get_LL('title_typo_db_password').': '.TYPO3_db_password;
+                       
+               $messageConf = array (
+                               'type' => 'message',
+                               'value' => array (
+                                       'message' => '',
+                               )
+                       
+               );
+               
+               if ($this->checkSelectDatabase() == true)       {
+                       $messageConf['value']['severity'] = 'ok';
+                       $messageConf['value']['label'] = $this->get_LL('msg_database_connected');
+                       
+                       $t3lib_install = t3lib_div::makeInstance('t3lib_install');
+                       $whichTables = $t3lib_install->getListOfTables();
+                       
+                       $messageConf['value']['message'] = $message;
+                       
+                       $messageConf = array($messageConf, array(
+                               'type' => 'message',
+                               'value' => array (
+                                       'severity' => 'ok',
+                                       'label' => $this->get_LL('title_module_database'),
+                                       'message' => sprintf($this->get_LL('msg_database_connectedto'), TYPO3_db, count($whichTables))
+                               )
+                       ));
+                       
+               } else {
+                       $messageConf['value']['severity'] = 'error';
+                       $messageConf['value']['label'] = $this->get_LL('msg_database_notconnected');
+                       
+                       $message = $this->get_LL('msg_database_failedwith').'<br />'.$messageConf['value']['message'];
+                       $message .= $this->pObj->getViewObject()->renderErrors(true);
+                       // $messageConf['value']['message'] .= $this->pObj->getViewObject()->renderErrors();
+                       $messageConf['value']['message'] = $message;
+               }
+               
+               return $this->pObj->getViewObject()->render($messageConf);
+       }
 
        
        /*
@@ -116,26 +173,29 @@ class tx_install_module_database extends tx_install_module_base   {
                        // get all options for this step
                
                $elements = array(
+                       
                        'advanced' => array (
                                $this->pObj->getViewObject()->renderOption('typo_db_host', $GLOBALS['MCA']['database']['options']['typo_db_host'])
                        ),
+                       
                        'normal' => array (
-                               $this->pObj->getViewObject('typo_db_username', $GLOBALS['MCA']['database']['options']['typo_db_username'])->renderOption(),
-                               $this->pObj->getViewObject('typo_db_password', $GLOBALS['MCA']['database']['options']['typo_db_password'])->renderOption()
+                               $this->pObj->getViewObject()->renderOption('typo_db_username', $GLOBALS['MCA']['database']['options']['typo_db_username']),
+                               $this->pObj->getViewObject()->renderOption('typo_db_password', $GLOBALS['MCA']['database']['options']['typo_db_password'])
                        )
+                       
                );
                
                return $elements;
        }
        
-       public function connectDatabaseProcess($staticFields)   {
+       public function connectDatabaseProcess()        {
                        // try to connect with the given values
                $connectResult = $this->checkDatabaseConnect($this->env['typo_db_host'], $this->env['typo_db_username'], $this->env['typo_db_password']);
-               if(!$connectResult) {
+               if(!$connectResult)     {
                        return false;
                }
                
-                       // if connection was sucessfull, write to localconf cache aand save it to file
+                       // if connection was sucessfull, write to localconf cache and save it to file
                $this->basicsObject->addDbDataToLocalconf(array(
                        'typo_db_host'     => $this->env['typo_db_host'],
                        'typo_db_username' => $this->env['typo_db_username'],
@@ -150,76 +210,69 @@ class tx_install_module_database extends tx_install_module_base   {
        /**
         * Provides the form for selecting or creating the database
         */
-       public function createDatabase($staticFields)   {
-               global $MCA;
-                       
+       public function selectDatabaseForm()    {
                        // get all options for this step
-               $options = array (
-                       'typo_db' => $MCA['database']['options']['typo_db'],
-                       'typo_db_new' => $MCA['database']['options']['typo_db_new'],
-               );
-               
-               $formConfig = array (
-                       'type' => 'form',
-                       'value' => array (
-                               'options' => array (
-                                       'name' => 'form_createDatabase',
-                                       'submit' => $this->get_LL('label_next_step'),
-                               ),
-                               'hidden' => $staticFields
-                       )
-               );
-               
-               foreach ($options as $optionName => $optionConfig)      {
-                       $elementConfig = $this->pObj->getViewObject()->renderOption($optionName, $optionConfig);
-                       if ($elementConfig !== false)   {
-                               $formConfig['value']['elements'][] = $elementConfig;
-                       } 
-               }
-               
-               return $this->pObj->getViewObject()->render($formConfig);
+               $elements = array ('normal' => array (
+                               'typo_db' => $this->pObj->getViewObject()->renderOption('typo_db', $GLOBALS['MCA']['database']['options']['typo_db']),
+                               'typo_db_new' => $this->pObj->getViewObject()->renderOption('typo_db_new', $GLOBALS['MCA']['database']['options']['typo_db_new']),
+               ));
+               return $elements;
        }
        
        
        /**
         * Does the processing of creating the database
         */
-       public function createDatabaseProcess($staticFields)    {
+       public function createDatabase()        {
                        // check if a database was selected or if a new databse was filled in
-               if (empty($this->env['typo_db']) && empty($this->env['typo_db_new']))   {
+               if (empty($this->env['typo_db']) && empty($this->env['typo_db_new'])) {
                        $this->addError('LLL:msg_database_warning_selectdb');
                        return false;
                }
                
                        // set an existing database or try to create a new one. If a new name was entered, try to create new one
-               if (!empty($this->env['typo_db_new']))  {
+               if (!empty($this->env['typo_db_new'])) {
+                       
                                // check name
-                       if (!ereg('[^[:alnum:]_-]',     $this->env['typo_db_new']))     {
+                       if (!ereg('[^[:alnum:]_-]',     $this->env['typo_db_new'])) {
                                        // try to create the database
-                               if ($this->checkDatabaseConnect())      {
-                                       $GLOBALS['TYPO3_DB']->admin_query('CREATE DATABASE '.$this->env['typo_db_new'].' DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci');
+                               if ($this->checkDatabaseConnect()) {
+                                       $res = $GLOBALS['TYPO3_DB']->admin_query('CREATE DATABASE '.$this->env['typo_db_new'].' DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci');
                                        $res = $GLOBALS['TYPO3_DB']->admin_query('SHOW DATABASES');
-                                       $tables = array();
+                                       $databases = array();
                                        while($row = $GLOBALS['TYPO3_DB']->sql_fetch_row($res)) {
-                                               $tables[] = $row;
+                                               $databases[] = $row[0];
                                        }
                                        
-                                       if(t3lib_div::inArray($tables, $this->env['typo_db_new'])) {
+                                       if(t3lib_div::inArray($databases, $this->env['typo_db_new'])) {
                                                        // db created -> write name to localconf
                                                $this->basicsObject->addDbDataToLocalconf(array('typo_db' => $this->env['typo_db_new']));
                                                if($this->basicsObject->saveLocalconf()) {
                                                        return true;
                                                }
-                                       } else $this->addError(sprintf($this->get_LL('msg_database_error_couldnotcreate'), $this->env['typo_db_new']), WARNING, 'fields', 'typo_db_new');
+                                       } else {
+                                               $this->addError(sprintf($this->get_LL('msg_database_error_couldnotcreate'), $this->env['typo_db_new']), WARNING, 'fields', 'typo_db_new');
+                                       }
                                }
-                       } else $this->addError(sprintf($this->get_LL('msg_database_warning_invalidname'), $this->env['typo_db_new']), WARNING, 'fields', 'typo_db_new');
+                       } else {
+                               $this->addError(sprintf($this->get_LL('msg_database_warning_invalidname'), $this->env['typo_db_new']), WARNING, 'fields', 'typo_db_new');
+                       }
+                       
                                // if we reach this point, something went wrong
                        return false;
                } else {
-                       $this->basicsObject->addDbDataToLocalconf(array('typo_db' => $this->env['typo_db']));
-                       if (!$this->basicsObject->saveLocalconf()) {
+                               // use an existing database
+                               // try to select that database
+                       if ($this->checkSelectDatabase(TYPO3_db_host, TYPO3_db_username, TYPO3_db_password, $this->env['typo3_db'])) {
+                               $this->basicsObject->addDbDataToLocalconf(array('typo_db' => $this->env['typo_db']));
+                               if (!$this->basicsObject->saveLocalconf()) {
+                                       return false;
+                               }
+                       } else {
+                                       // database coul not be selected
                                return false;
                        }
+                       
                }
                
                return true;
@@ -227,9 +280,20 @@ class tx_install_module_database extends tx_install_module_base    {
        
        
        /**
+        * Searches for sql files in typo3conf directory. Returns true or false wether some files where or not.
+        *
+        * @return boolean
+        */
+       public function checkForStaticFiles() {
+               $sFiles = t3lib_div::getFilesInDir(PATH_typo3conf,'sql',1,1);
+               return (count($sFiles) > 0);
+       }
+       
+       
+       /**
         * Provides the form for initial database import.
         */
-       public function createTables($staticFields)     {
+       public function selectStaticFileForm()  {
                $sFiles = t3lib_div::getFilesInDir(PATH_typo3conf,'sql',1,1);
                
                        // Check if default database scheme "database.sql" already exists, otherwise create it
@@ -248,37 +312,27 @@ class tx_install_module_database extends tx_install_module_base   {
                        $elements['import|'.$key] = htmlspecialchars(basename($f));
                }
                
-               $formConfig = array (
-                       'type' => 'form',
-                       'value' => array (
-                               'options' => array (
-                                       'name' => 'form_createTables',
-                                       'submit' => $this->get_LL('label_next_step'),
-                               ),
-                               'hidden' => $staticFields,
-                               'elements' => array (
-                                       array (
-                                               'type' => 'formelement',
-                                               'value' => array (
-                                                       'label' => 'label_selectdump',
-                                                       'elementType' => 'selectbox',
-                                                       'options' => array (
-                                                               'name' => 'L',
-                                                               'elements' => $elements
-                                                       )
-                                               )
+               $elements = array ( 'normal' => array (
+                       array (
+                               'type' => 'formelement',
+                               'value' => array (
+                                       'label' => 'label_selectdump',
+                                       'elementType' => 'selectbox',
+                                       'options' => array (
+                                               'name' => 'action',
+                                               'elements' => $elements
                                        )
                                )
                        )
-               );
+               ));
                
-               return $this->pObj->getViewObject()->render($formConfig);
+               return $elements;
        }
        
        /**
         * Does the processing for initial database import
         */
-       public function createTablesProcess($staticFields)      {
+       public function importTables()  {
                if (!$GLOBALS['TYPO3_DB']->sql_pconnect(TYPO3_db_host, TYPO3_db_username, TYPO3_db_password))   {
                        $this->addError('LLL:msg_database_error_cantconnect', CRITICAL);
                        return false;
@@ -289,13 +343,35 @@ class tx_install_module_database extends tx_install_module_base   {
                        return false;
                }
                
-               $tblFileContent = t3lib_div::getUrl(PATH_t3lib.'stddb/tables.sql');
+               if (!isset($this->env['action'])) $this->env['action'] = 'import|CURRENT_TABLES+STATIC';
+               $actionParts = t3lib_div::trimExplode('|', $this->env['action']);
+               
+               if (preg_match('/^CURRENT_/', $actionParts[1])) {
+                       if (!strcmp($actionParts[1],'CURRENT_TABLES') || !strcmp($actionParts[1],'CURRENT_TABLES+STATIC'))      {
+                               $tblFileContent = t3lib_div::getUrl(PATH_t3lib.'stddb/tables.sql');
 
-               reset($GLOBALS['TYPO3_LOADED_EXT']);
-               foreach ($GLOBALS['TYPO3_LOADED_EXT'] as $loadedExtConf)        {
-                       if (is_array($loadedExtConf) && $loadedExtConf['ext_tables.sql'])       {
-                               $tblFileContent.= chr(10).chr(10).chr(10).chr(10).t3lib_div::getUrl($loadedExtConf['ext_tables.sql']);
+                               reset($GLOBALS['TYPO3_LOADED_EXT']);
+                               while(list(,$loadedExtConf)=each($GLOBALS['TYPO3_LOADED_EXT'])) {
+                                       if (is_array($loadedExtConf) && $loadedExtConf['ext_tables.sql'])       {
+                                               $tblFileContent.= chr(10).chr(10).chr(10).chr(10).t3lib_div::getUrl($loadedExtConf['ext_tables.sql']);
+                                       }
+                               }
                        }
+                       if (!strcmp($actionParts[1],'CURRENT_STATIC') || !strcmp($actionParts[1],'CURRENT_TABLES+STATIC'))      {
+                               reset($GLOBALS['TYPO3_LOADED_EXT']);
+                               while(list(,$loadedExtConf)=each($GLOBALS['TYPO3_LOADED_EXT'])) {
+                                       if (is_array($loadedExtConf) && $loadedExtConf['ext_tables_static+adt.sql'])    {
+                                               $tblFileContent.= chr(10).chr(10).chr(10).chr(10).t3lib_div::getUrl($loadedExtConf['ext_tables_static+adt.sql']);
+                                       }
+                               }
+                       }
+               } elseif (@is_file($actionParts[1]))    {
+                       $tblFileContent = t3lib_div::getUrl($actionParts[1]);
+               }
+       
+               if (empty($tblFileContent))     {
+                       $this->addError($this->get_LL('msg_database_error_emptydump'));
+                       return false;
                }
                
                $t3lib_install = t3lib_div::makeInstance('t3lib_install');
@@ -328,42 +404,32 @@ class tx_install_module_database extends tx_install_module_base   {
        /**
         * Provides a form for creating a new admin user
         */
-       public function createAdmin($staticFields)      {
-               $formConfig = array (
-                       'type' => 'form',
-                       'value' => array (
-                               'options' => array (
-                                       'name' => 'form_getlanguage',
-                                       'submit' => $this->get_LL('label_next_step'),
-                               ),
-                               'hidden' => $staticFields,
-                               'elements' => array (
-                                       array (
-                                               'type' => 'formelement',
-                                               'value' => array (
-                                                       'label' => 'label_admin_username',
-                                                       'elementType' => 'input',
-                                                       'options' => array (
-                                                               'name' => 'createadmin_username',
-                                                       )
-                                               )
-                                       ),
-                                       array (
-                                               'type' => 'formelement',
-                                               'value' => array (
-                                                       'label' => 'label_admin_password',
-                                                       'elementType' => 'password',
-                                                       'renderTwice' => true,
-                                                       'options' => array (
-                                                               'name' => 'createadmin_password'
-                                                       )
-                                               )
+       public function createAdminForm()       {
+               $elements = array ( 'normal' => array (
+                       array (
+                               'type' => 'formelement',
+                               'value' => array (
+                                       'label' => 'label_admin_username',
+                                       'elementType' => 'input',
+                                       'options' => array (
+                                               'name' => 'createadmin_username',
+                                       )
+                               )
+                       ),
+                       array (
+                               'type' => 'formelement',
+                               'value' => array (
+                                       'label' => 'label_admin_password',
+                                       'elementType' => 'password',
+                                       'renderTwice' => true,
+                                       'options' => array (
+                                               'name' => 'createadmin_password'
                                        )
                                )
                        )
-               );
+               ));
                
-               return $this->pObj->getViewObject()->render($formConfig);
+               return $elements;
        }
        
        /**
@@ -372,8 +438,8 @@ class tx_install_module_database extends tx_install_module_base     {
         * @param unknown_type $staticFields
         * @return unknown
         */
-       public function createAdminProcess($staticFields)       {
-               if (ereg('[^[:alnum:]_-]', $this->env['createadmin_username'])) {
+       public function createAdmin()   {
+               if (ereg('[^[:alnum:]_-]', $this->env['createadmin_username'])) {
                        $this->addError(sprintf($this->get_LL('msg_warning_invalidusername'), $this->env['createadmin_username']), FATAL, 'fields', 'createadmin_username');
                        return false;
                }
@@ -479,17 +545,27 @@ class tx_install_module_database extends tx_install_module_base   {
                
                        // Updating database...
                if ($this->env['action'] == 'performUpdate')    {
-                       /*
-                        * Here the script has to perform the update of the database. The code is pasted from old install class.
-                        */
-                       $t3lib_install->performUpdateQueries($update_statements['add'], $this->env);
-                       $t3lib_install->performUpdateQueries($update_statements['change'], $this->env);
-                       $t3lib_install->performUpdateQueries($remove_statements['change'], $this->env);
-                       $t3lib_install->performUpdateQueries($remove_statements['drop'], $this->env);
+                               // Here the script has to perform the update of the database. The code is pasted from old install class.
+                       $errors = $t3lib_install->performUpdateQueries($update_statements['add'], $this->env);
+                       if (is_array($errors))  $this->addErrors($errors);
+                       
+                       $errors = $t3lib_install->performUpdateQueries($update_statements['change'], $this->env);
+                       if (is_array($errors))  $this->addErrors($errors);
+                       
+                       $errors = $t3lib_install->performUpdateQueries($remove_statements['change'], $this->env);
+                       if (is_array($errors))  $this->addErrors($errors);
+                       
+                       $errors = $t3lib_install->performUpdateQueries($remove_statements['drop'], $this->env);
+                       if (is_array($errors))  $this->addErrors($errors);
 
-                       $t3lib_install->performUpdateQueries($update_statements['create_table'], $this->env);
-                       $t3lib_install->performUpdateQueries($remove_statements['change_table'], $this->env);
-                       $t3lib_install->performUpdateQueries($remove_statements['drop_table'], $this->env);
+                       $errors = $t3lib_install->performUpdateQueries($update_statements['create_table'], $this->env);
+                       if (is_array($errors))  $this->addErrors($errors);
+                       
+                       $errors = $t3lib_install->performUpdateQueries($remove_statements['change_table'], $this->env);
+                       if (is_array($errors))  $this->addErrors($errors);
+                       
+                       $errors = $t3lib_install->performUpdateQueries($remove_statements['drop_table'], $this->env);
+                       if (is_array($errors))  $this->addErrors($errors);
                
                                // Init again / first time depending...
                        $FDdb = $t3lib_install->getFieldDefinitions_database();
@@ -501,7 +577,9 @@ class tx_install_module_database extends tx_install_module_base     {
 
                        // render form and / or message depending on result of DB compare
                if ($remove_statements || $update_statements)   {
-                       $formContent = $this->get_LL('msg_database_updateneeded').'<br />'.$this->generateUpdateDatabaseForm($update_statements, $remove_statements);
+                       $errors = $this->pObj->getViewObject()->getErrors();
+                       if (count($errors['general']) > 0) $this->addError($this->get_LL('msg_database_warning_failedstatements'), WARNING, 'general', NULL, true);
+                       $formContent .= $this->pObj->getViewObject()->renderErrors().$this->get_LL('msg_database_updateneeded').'<br />'.$this->generateUpdateDatabaseForm($update_statements, $remove_statements, $allErrors);
                } else {
                        $formContent = $this->get_LL('msg_database_noupdateneeded');
                }
@@ -509,6 +587,8 @@ class tx_install_module_database extends tx_install_module_base     {
                return $formContent;
        }
        
+       
+       
        /**
         * Generates the form for selecting actions that can be performed after a comparison. 
         *
@@ -523,15 +603,15 @@ class tx_install_module_database extends tx_install_module_base   {
                $elements = array();    
                
                        // Fields
-               $elements = array_merge($elements, $this->generateUpdateDatabaseForm_checkboxes($arr_update['add'], 'Add fields'));
-               $elements = array_merge($elements, $this->generateUpdateDatabaseForm_checkboxes($arr_update['change'], 'Changing fields', (t3lib_extMgm::isLoaded('dbal') ? false : true), $arr_update['change_currentValue']));
-               $elements = array_merge($elements, $this->generateUpdateDatabaseForm_checkboxes($arr_remove['change'], 'Remove unused fields (rename with prefix)'));
-               $elements = array_merge($elements, $this->generateUpdateDatabaseForm_checkboxes($arr_remove['drop'], 'Drop fields (really!)'));
+               $elements = array_merge($elements, $this->generateUpdateDatabaseForm_checkboxes($arr_update['add'], $this->get_LL('label_addfields')));
+               $elements = array_merge($elements, $this->generateUpdateDatabaseForm_checkboxes($arr_update['change'], $this->get_LL('label_changefields'), (t3lib_extMgm::isLoaded('dbal') ? false : true), $arr_update['change_currentValue']));
+               $elements = array_merge($elements, $this->generateUpdateDatabaseForm_checkboxes($arr_remove['change'], $this->get_LL('label_removeunusedfields')));
+               $elements = array_merge($elements, $this->generateUpdateDatabaseForm_checkboxes($arr_remove['drop'], $this->get_LL('label_dropfields')));
 
                        // Tables
-               $elements = array_merge($elements, $this->generateUpdateDatabaseForm_checkboxes($arr_update['create_table'], 'Add tables'));
-               $elements = array_merge($elements, $this->generateUpdateDatabaseForm_checkboxes($arr_remove['change_table'], 'Removing tables (rename with prefix)', $this->setAllCheckBoxesByDefault));
-               $elements = array_merge($elements, $this->generateUpdateDatabaseForm_checkboxes($arr_remove['drop_table'], 'Drop tables (really!)', $this->setAllCheckBoxesByDefault));
+               $elements = array_merge($elements, $this->generateUpdateDatabaseForm_checkboxes($arr_update['create_table'], $this->get_LL('label_addtables')));
+               $elements = array_merge($elements, $this->generateUpdateDatabaseForm_checkboxes($arr_remove['change_table'], $this->get_LL('label_removeunusedtables'), $this->setAllCheckBoxesByDefault));
+               $elements = array_merge($elements, $this->generateUpdateDatabaseForm_checkboxes($arr_remove['drop_table'], $this->get_LL('label_removetables'), $this->setAllCheckBoxesByDefault));
 
                        // prepare config for rendering
                $formConfig = array (
@@ -554,7 +634,7 @@ class tx_install_module_database extends tx_install_module_base     {
                
                        // render the form in viewObj
                $content = $this->pObj->getViewObject()->render($formConfig);
-                       
+
                return $content;
        }
        
@@ -576,7 +656,7 @@ class tx_install_module_database extends tx_install_module_base     {
                                        
                                        'value' => array (
                                                'elementType' => 'checkbox',
-                                               'label' => nl2br(htmlspecialchars($statement)).'<br /><br />'.((empty($currentValue[$key]) ? '' : '<em>Current value: '.$currentValue[$key].'</em>')),
+                                               'label' => nl2br(htmlspecialchars($statement)).'<br /><br />'.((empty($currentValue[$key]) ? '' : '<em>Current value: '.$currentValue[$key].'</em><br />')),
                                                'label_align' => 'right',
                                                'options' => array (
                                                        'name' => $key,
@@ -590,6 +670,132 @@ class tx_install_module_database extends tx_install_module_base   {
                
                return $result;
        }
+       
+       /**
+        * Displays a form for loading or reloading data into the so-called static tables
+        */
+       public function analyzeStaticTables() {
+               $content = '<p>'.$this->get_LL('msg_database_reloadstaticdata').'</p>';
+
+                       // Read all table definitions
+               $tblFileContent = '';
+               reset($GLOBALS['TYPO3_LOADED_EXT']);
+               foreach($GLOBALS['TYPO3_LOADED_EXT'] as $loadedExtConf) {
+                       if (is_array($loadedExtConf) && $loadedExtConf['ext_tables_static+adt.sql'])    {
+                               $tblFileContent.= chr(10).chr(10).chr(10).chr(10).t3lib_div::getUrl($loadedExtConf['ext_tables_static+adt.sql']);
+                       }
+               }
+
+                       // Get an instance of the t3lib_install class
+               $t3lib_install = t3lib_div::makeInstance('t3lib_install');
+               
+                       // Transform string of SQL statements into an array
+               $statements = $t3lib_install->getStatementArray($tblFileContent, 1);
+
+                       // Get all the statements indexed for each table
+               list($statements_table, $insertCount) = $t3lib_install->getCreateTables($statements, 1);
+
+                       // Get list of existing tables
+               $whichTables = $t3lib_install->getListOfTables();
+
+                       // Drop/create selected static tables, load corresponding data
+               $actionMessages = array();
+               if ($this->env['action'] == 'performUpdate')    {
+                       foreach ($this->env as $table => $value) {
+                               if ($this->env[$table] && isset($statements_table[$table]))     {
+                                       $res = $GLOBALS['TYPO3_DB']->admin_query('DROP TABLE IF EXISTS '.$table);
+                                       $res = $GLOBALS['TYPO3_DB']->admin_query($statements_table[$table]);
+
+                                               // An error has occurred, issue message
+                                       if ($res === false) {
+                                               $actionMessages[] = '<p class="error error-fatal">'.sprintf($this->get_LL('msg_database_error_createtable'), $table).' ['.$this->get_LL('label_sqlerror').': '.$GLOBALS['TYPO3_DB']->sql_error().']'.'</p>';
+                                       }
+
+                                               // The table was successfully created, load the data
+                                       else {
+                                               if (!empty($insertCount[$table]))       {
+                                                       $statements_insert = $t3lib_install->getTableInsertStatements($statements, $table);
+                                                       $dataErrors = array();
+                                                       $lineCounter = 0;
+                                                       foreach($statements_insert as $sql)     {
+                                                               $lineCounter++;
+                                                               $res = $GLOBALS['TYPO3_DB']->admin_query($sql);
+                                                               if ($res === false)     {
+                                                                       $dataErrors[$lineCounter] = '('.$this->get_LL('label_line').' '.$lineCounter.') '.$GLOBALS['TYPO3_DB']->sql_error();
+                                                               }
+                                                       }
+                                                               // Display result message. If errors occurred, list them after result message
+                                                       $actionMessages[] = '<p>'.sprintf($this->get_LL('msg_database_staticdatareloaded'), $table, $lineCounter).'</p>';
+                                                       if (count($dataErrors) > 0) {
+                                                               $message = '<p class="error error-fatal">'.sprintf($this->get_LL('msg_database_error_insertingdata'), count($dataErrors));
+                                                               foreach ($dataErrors as $sqlError) {
+                                                                       $message .= '<br />'.$sqlError;
+                                                               }
+                                                               $actionMessages[] = $message.'</p>';
+                                                       }
+                                               }
+                                       }
+                               }
+                       }
+               }
+
+                       // Assemble checkboxes for each table that could be updated
+               if (count($statements_table) > 0)       {
+                       $labels = array();
+                       foreach ($statements_table as $table => $definition) {
+                               $label = $table;
+                               if (isset($insertCount[$table])) $label .= ' - '.$this->get_LL('label_rows').': '.$insertCount[$table];
+                               if (isset($whichTables[$table])) $label .= ' - '.$this->get_LL('label_tableexists');
+                               $labels[$table] = $label;
+                       }
+                       $checkboxes = $this->generateUpdateDatabaseForm_checkboxes($labels, $this->get_LL('label_selectimporttables'), false);
+
+                               // prepare config for rendering
+                       $formConfig = array (
+                               'type' => 'form',
+                               'value' => array (
+                                       'options' => array (
+                                               'name' => 'form_analyzeStaticTables',
+                                               'id' => 'form_analyzeStaticTables',
+                                               'submit' => $this->get_LL('label_writechanges'),
+                                               'ajax' => true,
+                                               'action' => 'sendMethodForm(\'form_analyzeStaticTables\', \'database\', \'analyzeStaticTables\', displayMethodResult)',
+                                       ),
+                                       'hidden' => array (
+                                               'action' => 'performUpdate',
+                                               'target' => 'analyze_staticTables_result'
+                                       ),
+                                       'elements' => $checkboxes
+                               )
+                       );
+
+                               // render link to check/uncheck all checkboxes
+                               // first get a list of all checkbox id's
+                       $checkboxesID = array();
+                       foreach ($checkboxes as $elementInfo) {
+                               if ($elementInfo['value']['elementType'] == 'checkbox') {
+                                       $checkboxesID[] = $elementInfo['value']['options']['id'];
+                               }
+                       }
+                               // assemble links with javascript calls to toggle checkboxes function
+                       $checkboxJSArray = "new Array('".implode("','", $checkboxesID)."')";
+                       $jsControl = '<a href="javascript:toggleCheckboxes('.$checkboxJSArray.', true)">'.$this->get_LL('label_selectall').'</a>';
+                       $jsControl .= ' / ';
+                       $jsControl .= '<a href="javascript:toggleCheckboxes('.$checkboxJSArray.', false)">'.$this->get_LL('label_deselectall').'</a>';
+                       $content .= $this->pObj->getViewObject()->renderTag('p', $jsControl);
+               
+                               // render the form in viewObj
+                       $content .= $this->pObj->getViewObject()->render($formConfig);
+               }
+
+                       // If actions were performed, display their messages
+               if (count($actionMessages) > 0) {
+                       foreach ($actionMessages as $aMessage) {
+                               $content .= $aMessage;
+                       }
+               }
+               return $content;
+       }
 
 }
 
index 07eb24d..7b17b3f 100644 (file)
@@ -71,7 +71,14 @@ $GLOBALS['MCA']['database'] = array (
                        'categorySub' => 'analyze',
                        'tags' => array('database', 'db', 'cleanup', 'compare'),
                        'method' => 'database:analyzeCompareFile',
-                       'autostart' => true
+                       'autostart' => false
+               ),
+               'analyze_staticTables' => array (
+                       'categoryMain' => 'database',
+                       'categorySub' => 'analyze',
+                       'tags' => array('database', 'db', 'cleanup', 'compare'),
+                       'method' => 'database:analyzeStaticTables',
+                       'autostart' => false
                ),
                'cleanUp_cachedImageSizes' => array(
                        'title' => 'title_cleanUp_cachedImageSizes',
index 0fda6d9..a7251ce 100755 (executable)
@@ -7,6 +7,8 @@
        <data type="array">
                <languageKey index="default" type="array">
                        <label index="title_module_database">Database</label>
+                       <label index="description_module_database">In this section you can get an overview of your currently selected database compared to sql-files. You can also import sql-data directly into the database or upgrade tables from earlier versions of TYPO3.</label>
+                       
                        <label index="title_typo_db_host">Database host</label>
                        <label index="description_typo_db_host">Enter the hostname where the database server can be reached.</label>
                        <label index="help_typo_db_host">The hostname is a server where the database server is running. In most cases this will be "localhost".</label>
                        <label index="title_typo_db">TYPO3 database</label>
 
                        <label index="title_analyze_compareFile">Compare against default database</label>
+                       <label index="title_analyze_staticTables">Reload static tables</label>
 
                        <label index="label_database_defaulttables">Create default database tables</label>
                        <label index="label_selectdump">Please select a database dump</label>
                        <label index="label_execute">Execute</label>
                        <label index="label_writechanges">Write selected changes to database</label>
+                       <label index="label_addfields">Add fields</label>
+                       <label index="label_changefields">Change fields</label>
+                       <label index="label_removeunusedfields">Remove unused fields (rename with prefix)</label>
+                       <label index="label_dropfields">Drop fields (really!)</label>
+                       <label index="label_addtables">Add tables</label>
+                       <label index="label_removeunusedtables">Remove unused tables (rename with prefix)</label>
+                       <label index="label_droptables">Drop tables (really!)</label>
+                       <label index="label_sqlerror">SQL error</label>
+                       <label index="label_selectimporttables">Select tables to import</label>
+                       <label index="label_rows">Rows</label>
+                       <label index="label_tableexists">Table exists!</label>
+                       <label index="label_line">Line</label>
+                       <label index="label_selectall">Select all</label>
+                       <label index="label_deselectall">Deselect all</label>
 
-                       <label index="msg_database_error_cantconnect">FATAL: Can't connect to database-server!</label>
-                       <label index="msg_database_error_cantselectdb">FATAL: Can't select database "%s"</label>
+                       <label index="msg_database_error_cantconnect">Can't connect to database-server!</label>
+                       <label index="msg_database_error_cantselectdb">Can't select database "%s"</label>
                        <label index="msg_database_error_couldnotcreate">Could not create database with name "%s"</label>
                        <label index="msg_database_error_filenotfound">The compare-file "%s" was not found!</label>
                        <label index="msg_database_error_nocreatedefinitions">There were no "CREATE TABLE" definitions in the provided file: %s</label>
+                       <label index="msg_database_error_createtable">There was an error creating table "%s"</label>
+                       <label index="msg_database_error_insertingdata">However %d error(s) occurred when trying to load the data:</label>
+                       <label index="msg_database_error_emptydump">The selected database dump is empty.</label>
 
                        <label index="msg_database_warning_selectdb">Please select a database or fill in a name for a new database.</label>
                        <label index="msg_database_warning_invalidname">The NEW database name "%s" was not alphanumeric, a-zA-Z0-9_-</label>
+                       <label index="msg_database_warning_failedstatements">Some statements failed to execute due to SQL errors. They are detailed below.</label>
                        
                        <label index="msg_database_updateneeded">Table and field definitions should be updated!&lt;br /&gt; There seems to be a number of differences between the database and the selected SQL-file. Please select which statements you want to execute in order to update your database:</label>
                        <label index="msg_database_noupdateneeded">Table and field definitions are OK.&lt;br /&gt;The tables and fields in the current database correspond perfectly to the database in the selected SQL-file.</label>
+                       <label index="msg_database_reloadstaticdata">Check in the form below for which static table you want to load or reload the data. Be careful if the table already exists: it will be dropped before the data is loaded, so any changes will be lost.</label>
+                       <label index="msg_database_staticdatareloaded">Table "%s" was (re)created successfully and %d rows of data were loaded.</label>
                </languageKey>
        </data>
 </T3locallang>
\ No newline at end of file
index 9d62f77..d003b81 100644 (file)
@@ -3,7 +3,10 @@
  * 
  */
 class tx_install_module_gfx    extends tx_install_module_base  {
-
+       
+       public function overview() {
+               
+       }
 }
 
 ?>
index 4f12b52..6e9b0fb 100644 (file)
@@ -5,17 +5,6 @@ $GLOBALS['MCA']['gfx'] = array (
        ),
        
        'options' => array (
-               /*
-               '' => array (
-                       'categoryMain' => 'gfx',
-                       'categorySub' => 'general',
-                       'tags' => array (),
-                       'elementType' => 'checkbox',
-                       'value' => 'LC:GFX/',
-                       'default' => 1
-               ),
-               */
-       
                /** GENERAL **/
        
                'image_processing' => array (
@@ -257,16 +246,15 @@ $GLOBALS['MCA']['gfx'] = array (
                        'method' => 'php:checkVersion'
                )
        ),
+       */
        
        'methods' => array (
-               'phpinfo' => array (
-                       'title' => 'module_php_method_phpversion_title',
-                       'description' => 'module_php_method_phpversion_description',
-                       'categoryMain' => 'server',
-                       'categorySub' => 'php',
-                       'method' => 'php:getPHPInfo'
+               'gfxOverview' => array (
+                       'categoryMain' => 'gfx',
+                       'categorySub' => 'checks',
+                       'method' => 'gfx:overview',
+                       'autostart' => true
                )
        )
-       */
 );
 ?>
index d90c07d..1f9309f 100644 (file)
@@ -6,12 +6,43 @@
        </meta>
        <data type="array">
                <languageKey index="default" type="array">
-                       <label index="module_gfx_title">Graphics</label>
-                       <label index="module_gfx_description">Let you setup the graphic subsystem of your TYPO3 installation.</label>
-
-                       <label index="title_"></label>
-                       <label index="description_"></label>
-                       <label index="help_"></label>
+                       <label index="title_module_gfx">Graphics</label>
+                       <label index="description_module_gfx">
+&lt;strong&gt;What is it?&lt;/strong&gt;
+TYPO3 is known for its ability to process images on the server.&lt;br/&gt;
+In the backend interface (TBE) thumbnails are automatically generated (by ImageMagick in thumbs.php) as well as icons, menu items and pane tabs (by GDLib).&lt;br/&gt;
+In the TypoScript enabled frontend all kinds of graphical elements are processed. Typically images are scaled down to fit the pages (by ImageMagick) and menu items, graphical headers and such are generated automatically (by GDLib + ImageMagick).&lt;br/&gt;
+In addition TYPO3 is able to handle many file formats (thanks to ImageMagick), for example TIF, BMP, PCX, TGA, AI and PDF in addition to the standard web formats; JPG, GIF, PNG.&lt;br/&gt;
+&lt;br/&gt;
+In order to do this, TYPO3 uses two sets of tools:&lt;br/&gt;
+&lt;br/&gt;
+&lt;strong&gt;ImageMagick:&lt;/strong&gt;&lt;br/&gt;
+For conversion of non-web formats to webformats, combining images with alpha-masks, performing image-effects like blurring and sharpening.&lt;br/&gt;
+ImageMagick is a collection of external programs on the server called by the exec() function in PHP. TYPO3 uses three of these, namely 'convert' (converting fileformats, scaling, effects), 'combine'/'composite' (combining images with masks) and 'identify' (returns image information).&lt;br/&gt;
+Because ImageMagick are external programs, two requirements must be met: 1) The programs must be installed on the server and working and 2) if safe_mode is enabled, the programs must be located in the folder defined by the php.ini setting, &lt;em&gt;safe_mode_exec_dir&lt;/em&gt; (else they are not executed).&lt;br/&gt;
+ImageMagick is available for both Windows and Unix. The current version is 5+, but TYPO3 enthusiasts prefer an old version 4.2.9 because that version has three main advantages: It's faster in some operations, the blur-function works, the sharpen-function works. Anyway you do it, you must tell TYPO3 by configuration whether you're using version 5+ or 4.2.9. (flag: [GFX][im_version_5])&lt;br/&gt;
+ImageMagick homepage is at &lt;a target="_blank" href="http://www.imagemagick.org/"&gt;http://www.imagemagick.org/&lt;/a&gt;&lt;br/&gt;
+&lt;br/&gt;
+&lt;strong&gt;GDLib:&lt;/strong&gt;&lt;br/&gt;
+For drawing boxes and rendering text on images with truetype fonts. Also used for icons, menuitems and generally the TypoScript GIFBUILDER object is based on GDlib, but extensively utilizing ImageMagick to process intermediate results.&lt;br/&gt;
+GDLib is accessed through internal functions in PHP, so in this case, you have no safe_mode problems, but you'll need a version of PHP with GDLib compiled in. Also in order to use TrueType fonts with GDLib you'll need FreeType compiled in as well.&lt;br/&gt;
+You can get GDLib in the PNG version from &lt;a target="_blank" href="http://www.boutell.com/gd/"&gt;http://www.boutell.com/gd/&lt;/a&gt;.&lt;br/&gt;FreeType is for download at &lt;a target="_blank" href="http://www.freetype.org/"&gt;http://www.freetype.org/&lt;/a&gt;.&lt;br/&gt;
+Generally, software for TYPO3 is found at &lt;a target="_blank" href="http://typo3.sunsite.dk/software/"&gt;http://typo3.sunsite.dk/software/&lt;/a&gt; and packages listed at &lt;a target="_blank" href="http://typo3.org/1274.0.html"&gt;http://typo3.org/1274.0.html&lt;/a&gt;.&lt;br/&gt;
+&lt;br/&gt;
+You can disable all image processing options in TYPO3 ([GFX][image_processing]=0), but that would seriously disable TYPO3.                     
+                       </label>
+
+                       <label index="title_gfxOverview">Image Processing</label>
+                       <label index="description_gfxOverview">
+&lt;strong&gt;Verifying the image processing capabilities of your server&lt;/strong&gt;&lt;br/&gt;
+This page performs image processing and displays the result. It's a thorough check that everything you've configured is working correctly.&lt;br/&gt;
+It's quite simple to verify your installation; Just look down the page, the images in pairs should look like each other. If some images are not alike, something is wrong. You may also notice warnings and errors if this tool found signs of any problems.&lt;br/&gt;
+&lt;br/&gt;
+The image to the right is the reference image (how it should be) and to the left the image made by your server.&lt;br/&gt;
+The reference images are made with the classic ImageMagick install based on the 4.2.9 RPM and 5.2.3 RPM. If the version 5 flag is set, the reference images are made by the 5.2.3 RPM.&lt;br/&gt;
+&lt;br/&gt;
+This test will work only if your ImageMagick/GDLib configuration allows it to. The typo3temp/ folder must be writable for all the temporary image files. They are all prefixed 'install_' so they are easy to recognize and delete afterwards.
+                       </label>
 
                        <label index="title_image_processing">Image Processing</label>
                        <label index="description_image_processing">Enables image processing features.</label>
index 9d04572..22e8194 100644 (file)
@@ -30,57 +30,156 @@ class tx_install_module_installer extends tx_install_module_base   {
        
        /**
         * Defines the steps for the installation.
-        * The format is the same as for calling methods: module:method
-        *
+        * 
+        * Each step consists of a set of methods, checks and options in various states of processing.
+        * Each step can have the following states
+        * 
+        *      - pre:  Only checks are allowed here! This checks are executed each time a step is called. If any of
+        *                      the checks return false, the step can't be be processed.
+        * 
+        *      - main: The main method that is executed in this step. In most cases this will be a formconfig for
+        *                      the render engine.
+        * 
+        *      - post: Here are all things located that has to be executed before a step can be finished. This is
+        *                      the right place for processing and checking the input data from the main method.
+        *                      If any of this checks returns false the main state is called again.
+        * 
         * @var array
         */
-       private $steps = array (
+       private $stepConfig = array (
                        // these steps basically reimplements the old 1-2-3 installer with some small improvements
-               // 1 => 'installer:initialChecks',
-               1 => 'installer:selectLanguage',
                
-               2 => 'database:connectDatabase',
-               3 => 'database:createDatabase', 
-               4 => 'database:createTables',
-               5 => 'database:createAdmin',
-               6 => 'installer:getBasicSettingsAndFinish'
+                       // inital checks / no further processing
+               0 => array (
+                       'pre' => array (
+                               0 => 'php:checkVersion',
+                               1 => 'directories:checkDirs'
+                       ),
+                       'main' => array (
+                               0 => array (
+                                       'type' => 'form',
+                                       'module' => 'installer',
+                                       'method' => 'selectLanguage'
+                               )
+                       )
+               ),
+               
+                       // database connection
+               1 => array (
+                       'main' => array (
+                               0 => array (
+                                       'type' => 'form',
+                                       'module' => 'database',
+                                       'method' => 'databaseConnectionData'
+                               )
+                       ),
+                       'post' => array (
+                               'database:connectDatabaseProcess'
+                       ) 
+               ),
+               
+                       // select / create database
+               2 => array (
+                       'main' => array (
+                               array (
+                                       'type' => 'form',
+                                       'module' => 'database',
+                                       'method' => 'selectDatabaseForm'
+                               )
+                       ),
+                       'post' => array (
+                               'database:createDatabase'
+                       )
+               ),
+               
+                       // create / import tables from file
+               3 => array (
+                       'preMode' => 'skipMain',
+                       'pre' => array (
+                               'database:checkForStaticFiles'
+                       ),
+                       'main' => array (
+                               array (
+                                       'type' => 'form',
+                                       'module' => 'database',
+                                       'method' => 'selectStaticFileForm'
+                               )
+                       ),
+                       'post' => array (
+                               'database:importTables'
+                       )
+               ),
+               
+                       // create an admin user
+               4 => array (
+                       'main' => array (
+                               array (
+                                       'type' => 'form',
+                                       'module' => 'database',
+                                       'method' => 'createAdminForm'
+                               )
+                       ),
+                       'post' => array (
+                               'database:createAdmin'
+                       )
+               ),
+               
+               5 => array (
+                       'main' => array (
+                               array (
+                                       'type' => 'label',
+                                       'index' => 'msg_step5_done'
+                               )
+                       )
+               )
                
-                       // here we define some optional steps
        );
        
        /**
-        * Here is a list of all checks that have to be performed at the very beginning of the installation
-        * The format is the same as for calling methods: module:method
+        * Defines which is the last mandatory step
         *
-        * @var array
+        * @var integer
         */
-       private $initialChecks = array (
-               'directories:checkDirs'
-       );
+       private $lastMandatoryStep = 5;
        
        /**
-        * Defines which is the last mandatory step
+        * Holds the current step
         *
         * @var integer
         */
-       private $lastMandatoryStep = 6;
+       private $step = null; 
        
        /**
         * This is the main method
         */
        public function main()  {
-               $this->step = (empty($this->env['step'])) ? 1 : intval($this->env['step']);
+                       // get the current step
+               $this->step = (empty($this->env['step'])) ? 0 : intval($this->env['step']);
                
-                       // do we call first time or do we have to process?
-               if ($this->env['action'] == 'process')  {
-                       $stepResult = $this->executeStep($this->step, true);
-                       if ($stepResult)        {
-                               $this->step++;
-                       }
-               }
+                       // get the state
+               $stepResult = $this->executeStep($this->step);
+               
+                       // render back button if step is bigger than 1
+               if ($this->step > 0)    {
+                       $formConfig = array (
+                               'type'  => 'form',
+                               'value' => array(
+                                       'options' => array(
+                                               'name'   => 'form_stepData',
+                                               'submit' => $this->get_LL('label_prev_step'),
+                                       ),
+                                       'hidden'  => array (
+                                               'step' => $this->step-1,
+                                               'mode' => '123',
+                                               'state' => 'post'
+                                       ),
+                               )
+                       );
 
-                       // call the step (this can be current or next one)
-               $stepContent = $this->executeStep($this->step);
+                       $btnBack = $this->pObj->getViewObject()->render($formConfig);
+               } else {
+                       $btnBack = '';
+               }
                
                        // build-up the output
                $marker = array (
@@ -88,7 +187,8 @@ class tx_install_module_installer extends tx_install_module_base     {
                        '###PROGRESS###' => $this->getProgress(),
                        '###MSG_TITLE###' => $this->get_LL('msg_step'.$this->step.'_title'),
                        '###MSG_DESCRIPTION###' => $this->get_LL('msg_step'.$this->step.'_description'),
-                       '###CONTENT###' => $stepContent
+                       '###BTN_BACK###' => $btnBack,
+                       '###CONTENT###' => $stepResult
                );
                
                if (count($this->pObj->getViewObject()->getErrors('general')) > 0)      {
@@ -111,56 +211,187 @@ class tx_install_module_installer extends tx_install_module_base {
                return $result;
        }
        
-       private function executeStep($stepIndex, $process = false)      {
+       /**
+        * Executes all states of a certain step.
+        */
+       private function executeStep()  {
                        // let's check if the step is defined, die if not
-               if (!isset($this->steps[$stepIndex]))   {
-                       die($this->get_LL('msg_error_stepnotdefined'));
+               if (!isset($this->stepConfig[$this->step]))     {
+                       $this->addError(sprintf($this->get_LL('msg_error_stepnotdefined'), $this->step), FATAL);
+                       return false;
                }
                
-                       // get the information where the step logic is defined
-               list($stepModuleName, $stepMethodName) = t3lib_div::trimExplode(':', $this->steps[$stepIndex]);
-               $stepModule = $this->pObj->getBasicsObject()->loadModule($stepModuleName);
+                       // process pre state
+               if (isset($this->stepConfig[$this->step]['pre']))       {
+                       $preResult = $this->executeStepState('pre');
+               } else {
+                       $preResult = true;
+               }
+               
+                       // exit if pre checks are not sucessfull
+               if ($preResult === false)       {
+                               // depending on preMode we only skip state main or stop here immediately
+                       if (!isset($this->stepConfig[$this->step]['preMode']) &&Ê(!strcmp($this->stepConfig[$this->step]['preMode'], 'skipMain')))      {
+                               return false;
+                       } else {
+                               $this->env['state'] = 'post';
+                       }
+               }
                
-                       // die if the module could not be loaded
-               if (!$stepModule)       {
-                       die(sprintf($this->get_LL('msg_error_modulenotfound'), $stepModuleName));
+                       // if state is post, execute that state
+               $processResult = true;
+               if ($this->env['state'] == 'post')      {
+                               // execute process methods (has to be configured)
+                       $processResult = $this->executeStepState('post');
+                       $this->env['state'] = NULL;
+                       
+                               // go to next step if process was ok
+                       if ($processResult === true)    {
+                               $this->step++;
+                               return $this->executeStep();
+                       }
                }
                
-                       // search for the processMethod if process flag is set
-               if ($process)   {
-                       $stepMethodName .= 'Process';
+                       // execute main state (has to be configured!)
+               $mainResult = $this->executeStepState('main');
+               
+               if ($mainResult === false)      {
+                       return false;
                }
                
-                       // die if method is not defined in module
-               if (!method_exists($stepModule, $stepMethodName))       {
-                       if ($process)   {
+               return $mainResult;
+       }
+       
+       
+       /**
+        * Executes a certain state in a step. It dispatches all the config to the particular handlers.
+        * For example rendering forms, or calling the methods in that specific module.
+        *
+        * @param       integer         $state: The state that has to be executed
+        * @return      The collected results of all given methods (In state pre and post it returns false if any of the methods returns false!) 
+        */
+       private function executeStepState($state)       {
+               $stateConfig = $this->stepConfig[$this->step][$state];
+               
+                       // check if there is any config for this state in this particular step
+               if (!is_array($stateConfig))    {
+                       if ($state == 'pre' || $state == 'post')        {
+                                       // state pre and post don't have to be set, if they are not configured we estimate that everything is ok and return true
                                return true;
                        } else {
-                               die(sprintf($this->get_LL('msg_error_methodnotfound'), $stepMethodName, $stepModuleName));
+                               $this->addError(sprintf($this->get_LL('msg_error_stepstatenotdefined'), $state, $this->step), FATAL);
+                               return false;
                        }
                }
                
-                       // create an array with environment variables that have to be sent via hidden fields
-               $staticFields = array (
-                       'step' => $this->step,
-                       'mode' => '123',
-                       'action' => 'process'
-               );
+                       // prepare result streams
+               $formElements = array('normal' => NULL, 'advanced' => NULL);
+               $stateResult = '';
+               
+                       // cycle through the various methods defined for this state
+               foreach ($stateConfig as $index => $stateMethod)        {
+                       $stateMethodResult = $this->dispatchStateMethod($stateMethod, $formElements);
+                       
+                       if ($state == 'main')   {
+                               if ($stateMethodResult == false)        {
+                                       return false;
+                               }
+                               if (is_string($stateMethodResult))      {
+                                       $stateResult .= $stateMethodResult;
+                               }
+                       } else {
+                               $stateResult = $stateMethodResult;
+                               
+                                       // exit cycle if in pre or post state any state method returned false 
+                               if ($stateResult === false)     {
+                                       break;
+                               }
+                       }
+               }
+               
+                       // render form if any fields are set
+               if ($state == 'main' && (is_array($formElements['normal']) || is_array($formElements['advanced'])))     {
+                       $elements = array(array(
+                               'type' => 'formelement',
+                               'value' => array (
+                                       'elementType' => 'fieldset',
+                                       'label' => $this->get_LL('label_normalFields')
+                               )
+                       ));
+                       
+                       $elements = array_merge($elements, $formElements['normal']);
+                       
+                       if (is_array($formElements['advanced']))        {
+                               $elements[] = array (
+                                       'type' => 'formelement',
+                                       'value' => array (
+                                               'elementType' => 'fieldset',
+                                               'label' => $this->get_LL('label_advancedFields'),
+                                               'class' => 'fieldset-advanced'
+                                       )
+                               );
+                               $elements = array_merge($elements, $formElements['advanced']);
+                       }
+                       
+                       $formConfig = array (
+                               'type'  => 'form',
+                               'value' => array(
+                                       'options' => array(
+                                               'name'   => 'form_stepData',
+                                               'submit' => $this->get_LL('label_next_step'),
+                                       ),
+                                       'hidden'  => array (
+                                               'step' => $this->step,
+                                               'mode' => '123',
+                                               'state' => 'post'
+                                       ),
+                                       'elements' => $elements
+                               )
+                       );
+
+                       $stateResult = $this->pObj->getViewObject()->render($formConfig).$stateResult;
+               }
+               
+               return $stateResult;
+       }
+       
+       private function dispatchStateMethod($stateMethod, &$formElements) {
+               $result = true;
+               if ($stateMethod['type'] == 'label') {
+                       $methodResult = nl2br($this->get_LL($stateMethod['index']));
+               } else {
+                       if (is_string($stateMethod)) {
+                               $methodResult = $this->pObj->getBasicsObject()->executeMethod($stateMethod);
+                       } else {
+                               $methodResult = $this->pObj->getBasicsObject()->executeMethod(array($stateMethod['module'], $stateMethod['method']));
+                       }
+               }
                
-               $environment = $this->pObj->getEnvironment();
-               if (isset($environment['L'])) {
-                       $staticFields['L'] = $environment['L'];
+               if ($methodResult === false) {
+                       return false;
                }
                
-                       // now everything is checked and we can call the method and return the result
-               return $stepModule->$stepMethodName($staticFields);
+               switch ($stateMethod['type']) {
+                       case 'form':
+                               $formElements = array_merge($formElements, $methodResult);
+                               break;
+                       default:
+                               $result = $methodResult;
+                               break;
+               }
+               
+               return $result;
        }
        
        
+       /**
+        * Returns an XHTML fragment with a progressbar, that shows the progress in the installation process.
+        *
+        * @return      string
+        */
        private function getProgress()  {
-               $progressBar = '<div id="progressbar"><div class="';
-               $progressBar .= ($this->step <= $this->lastMandatoryStep) ? 'mandatory' : 'optional';
-               $progressBar .= '" style="width:'.(100 /count($this->steps) *$this->step).'%"></div></div>';
+               $progressBar = '<div id="progressbar"><div class="mandatory" ';
+               $progressBar .= 'style="width:'.(100 /count($this->stepConfig) *$this->step).'%"></div></div>';
                return $progressBar;
        }
        
@@ -168,24 +399,18 @@ class tx_install_module_installer extends tx_install_module_base  {
         * STEP METHODS
         */
        
-       private function initialChecks($staticFields)   {
-               $checkString = '';
-               foreach ($this->initialChecks as $check)        {
-                       $result = $this->pObj->getBasicsObject()->executeMethod($check);
-                       if ($result)    {
-                               $checkString .= $this->pObj->getViewObject()->getLastMessage(true);
-                       } else {
-                               $checkString .= $this->pObj->getViewObject()->renderErrors(true);
-                       }
-               }
-               return $checkString;
-               // t3lib_div::debug(array($this->pObj->getViewObject()->getLastMessage(true)));
+       /**
+        * Shows the welcome screen.
+        *
+        */
+       public function welcomeScreen() {
+               return 'Hi';
        }
-        
+       
        /**
         * provides a selectbox with all available languages
         */
-       private function selectLanguage($staticFields)  {
+       public function selectLanguage()        {
                $languageData = $this->pObj->getLanguageObject()->includeLLFile('EXT:setup/mod/locallang.xml', false);
                $this->pObj->setLocalLang(t3lib_div::array_merge_recursive_overrule($this->pObj->getLocalLang(), $languageData));
                                
@@ -194,35 +419,21 @@ class tx_install_module_installer extends tx_install_module_base  {
                        $opt[$val] = $this->pObj->getBasicsObject()->getLabel('lang_'.$val);
                }
                
-               $formConfig = array (
-                       'type' => 'form',
-                       'value' => array (
-                               'options' => array (
-                                       'name' => 'form_getlanguage',
-                                       'submit' => $this->pObj->getBasicsObject()->getLabel('label_next_step'),
-                               ),
-                               'hidden' => $staticFields,
-                               'elements' => array (
-                                       array (
-                                               'type' => 'formelement',
-                                               'value' => array (
-                                                       'label' => 'label_available_languages',
-                                                       'elementType' => 'selectbox',
-                                                       'options' => array (
-                                                               'name' => 'L',
-                                                               'elements' => $opt
-                                                       )
-                                               )
+               $elements['normal'] = array (
+                       array (
+                               'type' => 'formelement',
+                               'value' => array (
+                                       'label' => 'label_available_languages',
+                                       'elementType' => 'selectbox',
+                                       'options' => array (
+                                               'name' => 'L',
+                                               'elements' => $opt
                                        )
                                )
                        )
                );
                
-               return $this->pObj->getViewObject()->render($formConfig);
-       }
-       
-       private function getBasicSettingsAndFinish($staticFields)       {
-               
+               return $elements;
        }
 }
 
index d7de880..946a6db 100644 (file)
@@ -6,28 +6,43 @@
        </meta>
        <data type="array">
                <languageKey index="default" type="array">
-                       <label index="msg_step1_title">Welcome to TYPO3</label>
-                       <label index="msg_step1_description">This is the installation wizard for the TYPO3 Content Management System. When you click "next" a few initial checks will be performed to test if your server is suitable for TYPO3.</label>
+                       <label index="msg_step0_title">Welcome to TYPO3</label>
+                       <label index="msg_step0_description">This is the installation wizard for the TYPO3 Content Management System. This wizard will guide you trough the complete installation process.&lt;p&gt;Please select the language for the installation process.&lt;/p&gt;</label>
 
-                       <label index="msg_step2_title">Select language</label>
-                       <label index="msg_step2_description">Please select the language for the installation process.</label>
+                       <label index="msg_step1_title">Database connection</label>
+                       <label index="msg_step1_description">Please enter the information for connecting to your prefered database.</label>
 
-                       <label index="msg_step5_title">Create admin user</label>
-                       <label index="msg_step5_description">Your database is set up sucessfully. Now we have to create an admin account for logging into the backend.</label>
+                       <label index="msg_step4_title">Create admin user</label>
+                       <label index="msg_step4_description">Your database is set up sucessfully. Now we have to create an admin account for logging into the backend.</label>
 
-                       <label index="msg_step6_title">Congratulation</label>
-                       <label index="msg_step6_description">You are basically done! You can now use TYPO3 by logging into the backend or go on with some more basic settings.</label>
+                       <label index="msg_step5_title">Congratulation</label>
+                       <label index="msg_step5_description">You're basic setup is ready!</label>
+                       <label index="msg_step5_done">Apparently you have completed the basic setup of the TYPO3 database.
+Now you can choose between these options:
+
+- &lt;a href="../../index.php"&gt;&lt;strong&gt;Go to the frontend pages&lt;/strong&gt;&lt;/a&gt;
+
+- &lt;a href="../index.php"&gt;&lt;strong&gt;Go to the backend login&lt;/strong&gt;&lt;/a&gt;
+
+- &lt;a href="index.php"&gt;&lt;strong&gt;Continue to configure TYPO3&lt;/strong&gt;&lt;/a&gt; (Recommended).
+                                This will let you analyse and verify that everything in your PHP installation is alright. Also if you want to configure TYPO3 to use all the cool features, you &lt;em&gt;must&lt;/em&gt; dig into the this!</label>
 
                        <label index="label_step">Step %d</label>
+                       <label index="label_prev_step">Previous</label>
                        <label index="label_next_step">Next</label>
+                       
+                       <label index="label_normalFields">Normal</label>
+                       <label index="label_advancedFields">Advanced</label>
+                       
                        <label index="label_available_languages">Select your language</label>
 
                        <label index="label_admin_username">Enter username for administrator</label>
                        <label index="label_admin_password">Enter a password for administrator</label>
                        <label index="label_admin_password_2">Retype the password</label>
 
-                       <label index="msg_error_stepnotdefined">FATAL! The requested step is not defined.</label>
-                       <label index="msg_error_methodnotfound">FATAL! The requested method "%s" was not found in module "%s".</label>
+                       <label index="msg_error_stepnotdefined">The requested step (%s) is not defined.</label>
+                       <label index="msg_error_stepstatenotdefined">The requested state (%s) in step (%s) is not defined.</label>
+                       <label index="msg_error_methodnotfound">The requested method "%s" was not found in module "%s".</label>
 
                        <label index="msg_warning_invalidusername">The username "%s" was not alphanumeric, a-zA-Z0-9_-</label>
                        <label index="msg_warning_emptyusername">The username was empty!</label>
index 08ba6c0..feb860b 100644 (file)
@@ -92,6 +92,7 @@ h3    {
                        ###ERRORS_GENERAL###
                        
                        ###CONTENT###
+                       ###BTN_BACK###
                                
                        ###PROGRESS###
                </div>
index d801c83..94ccdc5 100644 (file)
@@ -96,26 +96,24 @@ class tx_install_module_setup extends tx_install_module_base        {
                                        $ajaxContent = $this->pObj->getViewObj()->renderErrors(true);
                                } else {
                                        $filterResults = $this->pObj->getFilterResults();
-                                       
+                                               
                                                // get content from deliverables
                                        $ajaxContent = $this->renderCategoryDeliverables($moduleDeliverables);
-                                                                               
-                                               // try to write the data to localconf
-                                       if (!$this->basicsObject->saveLocalconf())      {
-                                               $ajaxContent = $this->pObj->getViewObject()->renderErrors().$ajaxContent;
-                                       } else {
-                                               $modMessage = '';
-                                               // var_dump($modifiedFields);
-                                               if (count($modifiedFields) > 0) {
-                                                       $modMessage = $this->pObj->getViewObject()->render(array('type' => 'list', 'value' => $modifiedFields));
-                                               }
-                                               $ajaxContent = $aboutBox.$this->pObj->getViewObject()->getLastMessage().$modMessage.$ajaxContent;
-                                       }
-                                       
                                }
                        }
+                       
+                               // try to write the data to localconf
+                       if (!$this->basicsObject->saveLocalconf())      {
+                               $ajaxContent = $this->pObj->getViewObject()->renderErrors().$ajaxContent;
+                       } else {
+                               $modMessage = '';
+                               if (count($modifiedFields) > 0) {
+                                       $modMessage = $this->pObj->getViewObject()->render(array('type' => 'list', 'value' => $modifiedFields));
+                               }
+                               $ajaxContent = $aboutBox.$this->pObj->getViewObject()->getLastMessage().$modMessage.$ajaxContent;
+                       }
                                
-                       $returnValue = $this->pObj->getViewObject()->renderTag('h1', $titleSection).$formWrap[0].$ajaxContent.$formWrap[1];
+                       $returnValue = $this->pObj->getViewObject()->renderTag('h1', $titleSection).$ajaxContent;
                        
                } else {
                                // this is the default... In other words this is only executed on first call. All other requests are done via AJAX see above...
@@ -141,10 +139,17 @@ class tx_install_module_setup extends tx_install_module_base      {
        }
        
        
+       /**
+        * Adds the about box on top of the page.
+        * The box is not displayed if no description was found.
+        *
+        * @param string $category: the category for which the about should be generated
+        */
        private function addAboutBox($category = 'categoryMain')        {
                        // create a about box
-               $categoryDescription = $this->get_LL('descr_'.$this->env[$category]);   
-               if (!empty($categoryDescription))       {
+               $categoryDescription = $this->get_LL('description_module_'.$this->env[$category]);      
+               
+               // if (!empty($categoryDescription))    {
                        $aboutBoxCode = array (
                                'type' => 'box',
                                'value' => array (
@@ -158,7 +163,7 @@ class tx_install_module_setup extends tx_install_module_base        {
                                                ),
                                                array (
                                                        'type' => 'plain',
-                                                       'value' => $this->get_LL('descr_'.$this->env[$category])
+                                                       'value' => $categoryDescription
                                                )
                                        )
                                )
@@ -166,29 +171,34 @@ class tx_install_module_setup extends tx_install_module_base      {
                        
                                // add the about box
                        $this->pObj->getViewObject()->addContent('', $this->pObj->getViewObject()->render($aboutBoxCode));
-               }
+               // }
        }
        
+       
+       /**
+        * This one of the most important methods in setup. Here we render all pages and deliverables. It also
+        * looks for changes and pushes them to the localconf cache.
+        *
+        * @param       array           $deliverables: The deliverable configs
+        * @return      HTML with the rendered deliverables
+        */
        private function renderCategoryDeliverables($deliverables)      {
                $result = '';
+               $this->pObj->getViewObject()->clearLastMessage();
                
                foreach ($deliverables as $deliverable => $names)       {
-                       $result .= $this->pObj->getViewObject()->renderTag('h2', $this->get_LL('label_deliverable_'.$deliverable));
-                       
-                               // add form for saving options
-                       if ($deliverable == 'options')  {
-                               $formWrap = array (
-                                       '<form action="index.php" method="post" id="optionsForm">'.
-                                               '<input type="hidden" name="categoryMain" value="'.$this->env['categoryMain'].'" />'.
-                                               '<input type="hidden" name="categorySub" value="'.$this->env['categorySub'].'" />',
-                                       '<input type="button" onclick="sendForm(\'optionsForm\');" value="'.$this->get_LL('label_save').'" /></form>'
-                               );
-                       } else {
-                               $formWrap = array('', '');
+                       if (!empty($this->env['categorySub']))  {
+                               $result .= $this->pObj->getViewObject()->renderTag('h2', $this->get_LL('label_deliverable_'.$deliverable));
                        }
                        
                        $modifiedFields = array();
                        
+                       if ($deliverable == 'options')  {
+                               $result .= '<form action="index.php" method="post" id="optionsForm">'.
+                                       '<input type="hidden" name="categoryMain" value="'.$this->env['categoryMain'].'" />'.
+                                       '<input type="hidden" name="categorySub" value="'.$this->env['categorySub'].'" />';
+                       }
+                       
                        foreach ($names as $name => $mod)       {
                                $modConfig = $GLOBALS['MCA'][$mod][$deliverable][$name];
                                
@@ -211,15 +221,20 @@ class tx_install_module_setup extends tx_install_module_base      {
                                switch ($deliverable)   {
                                        case 'checks':
                                                        // execute check and print out result in plain
-                                               // $this->pObj->getViewObject()->clearLastMessage();
                                                $checkResult = $this->basicsObject->executeMethod($modConfig['method']);
-                                               $deliverableContent = $this->get_LL('label_'.(($checkResult) ? 'true' : 'false'));
+                                               $messageConfig = array(
+                                                       'type' => 'message',
+                                                       'value' => array (
+                                                               'severity' => (($checkResult) ? 'ok' : 'error'),
+                                                               'label' => (($checkResult) ? $this->pObj->getViewObject()->getLastMessage() : $this->get_LL('label_false'))
+                                               ));
                                                if (!$checkResult)      {
-                                                       $deliverableContent .= $this->pObj->getViewObject()->renderErrors();
+                                                       $messageConfig['value']['message'] = $this->pObj->getViewObject()->renderErrors();
                                                } else {
-                                                       $deliverableContent .= $this->pObj->getViewObject()->getLastMessage();
-                                                       $this->pObj->getViewObject()->clearLastMessage();
+                                                       $messageConfig['value']['message'] = $this->pObj->getViewObject()->clearLastMessage();
                                                }
+                                               $deliverableContent = $this->pObj->getViewObject()->render($messageConfig);
+                                               $this->pObj->getViewObject()->clearLastMessage();
                                                break; 
                                        case 'options':
                                                        // options are rendered as input elements
@@ -261,6 +276,7 @@ class tx_install_module_setup extends tx_install_module_base        {
                                                
                                                $descr .= $this->pObj->getViewObject()->renderTag('span', $this->get_LL('label_path').' '.$this->basicsObject->getLocalconfPath($modConfig['value']).' - '.$this->get_LL('label_default').' '.$modConfig['default'], array('class' => 'description italic'));
                                                $deliverableContent = $this->pObj->getViewObject()->renderFormelement($inputConfig);
+                                               
                                                break;
                                        case 'methods':
                                                        // the result of methods is simply printed out
@@ -297,7 +313,13 @@ class tx_install_module_setup extends tx_install_module_base       {
                                
                                $result .= $this->pObj->getViewObject()->renderTag('div', $deliverableBox, $paramData);
                        }
+                       
+                               // add form for saving options
+                       if ($deliverable == 'options')  {
+                               $result .= '<input type="button" onclick="sendForm(\'optionsForm\');" value="'.$this->get_LL('label_save').'" /></form>';
+                       }
                }
+               
                return $result;
        }
        
@@ -310,7 +332,11 @@ class tx_install_module_setup extends tx_install_module_base       {
        private function renderCategoryTree($data)      {
                        // add the searchbox
                $content = '<div class="categoryTreeContainer">
-                       <input type="text" id="treeFilter" value="" /><br />
+                       <div id="treeOptions">
+                               <div id="treeFilterBox">
+                                       <input type="text" id="treeFilter" value="" />
+                               </div>
+                       </div>
                        <span id="filterStatus"></span>
                        <a href="#" onclick="toggleAllLeafs()" id="collapseExpandToggle">
                                '.$this->get_LL('label_expandAll').'
diff --git a/typo3/sysext/install/modules/setup/res/search_bubble.png b/typo3/sysext/install/modules/setup/res/search_bubble.png
deleted file mode 100644 (file)
index b6c65d2..0000000
Binary files a/typo3/sysext/install/modules/setup/res/search_bubble.png and /dev/null differ
diff --git a/typo3/sysext/install/modules/setup/res/search_reset.png b/typo3/sysext/install/modules/setup/res/search_reset.png
deleted file mode 100644 (file)
index db88ee9..0000000
Binary files a/typo3/sysext/install/modules/setup/res/search_reset.png and /dev/null differ
index b2123eb..ef58167 100644 (file)
@@ -21,7 +21,7 @@ fieldset legend       {
        font-weight: bold;
 }
 
-input, select, button  {
+input.bg, select.bg, button.bg {
        background: #fff url(../../../imgs/icons/bg_input.gif) no-repeat scroll left top;
        border: 1px solid #aaa;
        margin-top: 2px;
@@ -38,10 +38,8 @@ label em     {
        position: fixed;
        top: 5px;
        left: 5px;
-       width: 240px;
+       width: 210px;
        padding: 5px;
-       border: 1px gray solid;
-       background-color: white;
 }
 
 #collapseExpandToggle  {
@@ -52,25 +50,12 @@ label em    {
        margin: 5px 0;
        text-decoration: none;
        border-top: 1px #f0f0f0 solid;
-       display: block;
-}
-
-#treeFilter    {
-       background: url(search_bubble.png) no-repeat top left;
-       border: none;
-       
-       height: 30px;
-       width: 240px;
-       
-       margin-bottom: 2px;
-       padding: 8px 17px 8px 30px;
-       
-       text-align: left;
 }
 
 .categoryTree  {
        padding: 0;
        list-style-type: none;
+       clear: left;
 }
 
 .categoryTree img      {
@@ -123,6 +108,30 @@ label em   {
        margin: 5px;
 }
 
+.installer-message     {
+       margin-bottom: 15px;
+}
+
+.installer-message strong.message-header       {
+       display: block;
+       background-color: #d9d5c9;
+       padding: 3px;
+}
+
+.severity_ok strong.message-header     {
+       background-image: url('../../../imgs/icons/ok.png');
+       background-position: 4px 50%;
+       background-repeat: no-repeat;
+       padding-left: 24px;
+}
+
+.severity_error strong.message-header  {
+       background-image: url('../../../imgs/icons/cancel.png');
+       background-position: 4px 50%;
+       background-repeat: no-repeat;
+       padding-left: 24px;
+}
+
 .error-fatal   {
        color: red;
 }