* Installer: improved the look of the login screen
authorThomas Hempel <thomas.hempel@typo3.org>
Tue, 22 Jan 2008 20:12:29 +0000 (20:12 +0000)
committerThomas Hempel <thomas.hempel@typo3.org>
Tue, 22 Jan 2008 20:12:29 +0000 (20:12 +0000)
* Installer: Smaller bugfixes and enhancements in error handling

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

ChangeLog
typo3/sysext/install/mod/class.tx_install.php
typo3/sysext/install/mod/class.tx_install_view.php
typo3/sysext/install/mod/locallang_mod.xml
typo3/sysext/install/modules/setup/class.tx_install_module_setup.php
typo3/sysext/install/modules/setup/res/styles.css

index 01a6c7a..62fa01a 100755 (executable)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2008-01-22     Thomas Hempel  <thomas@typo3-unleashed.net>
+
+       * Installer: improved the look of the login screen
+       * Installer: Smaller bugfixes and enhancements in error handling
+
 2008-01-22  Ingo Renner  <ingo@typo3.org>
 
        * added feature: #7223: update prototype and scriptaculous to their most recent versions
index 61e796b..88658a9 100644 (file)
@@ -206,7 +206,7 @@ class tx_install {
                        if(md5($GLOBALS['TYPO3_CONF_VARS']['BE']['installToolPassword'].'|'.$randomKey) == $combinedKey || $this->checkPassword($randomKey)) {
                                $this->passwordOK = true;
                        } else {
-                               $this->viewObj->addContent($this->basicsObj->getLabel('label_login'), $this->loginForm());
+                               $this->viewObj->addContent('', $this->loginForm());
                                echo $this->viewObj->getDocCode();
                        }
                }
@@ -314,7 +314,7 @@ class tx_install {
                                        );
                                }
 
-                               $this->basicsObj->addError(sprintf($this->basicsObj->getLabel('msg_error_login_not_sucessful_message'), md5($password)), FATAL, 'fields', 'password');
+                               $this->basicsObj->addError(sprintf($this->basicsObj->getLabel('msg_error_login_not_sucessful_message'), md5($password)), FATAL, 'fields', 'typo3_install_password');
                        }
                }
                
@@ -333,21 +333,32 @@ class tx_install {
                                'options'  => array(
                                        'name'   => 'form_setuplogin',
                                        'submit' => $this->basicsObj->getLabel('label_login'),
+                                       'id' => 'formLogin'
                                ),
                                'elements' => array(
+                                       array (
+                                               'type' => 'plain',
+                                               'value' => $this->viewObj->renderTag('h4', $this->basicsObj->getLabel('label_login'))
+                                       ),
                                        array(
                                                'type'  => 'formelement',
                                                'value' => array(
                                                        'label'       => 'label_setup_password',
+                                                       'label_align' => 'top',
                                                        'elementType' => 'password',
                                                        'options'     => array(
-                                                               'name' => 'typo3_install_password'
+                                                               'name' => 'typo3_install_password',
+                                                               'id' => 'typo3_install_password',
+                                                               'class' => 'bg'
                                                        )
                                                )
                                        ),
                                        array(
-                                               'type'  => 'plain',
-                                               'value' => $this->basicsObj->getLabel('msg_login_passwordhint')
+                                               'type'  => 'message',
+                                               'value' => array(
+                                                       'message' => $this->basicsObj->getLabel('msg_login_passwordhint'),
+                                                       'addBR' => false
+                                               )
                                        )
                                )
                        )
index d2572ca..713ec5d 100644 (file)
@@ -256,7 +256,6 @@ class tx_install_view {
                                $renderMethod = 'render'.ucfirst($type);
                                
                                if(method_exists($this, $renderMethod)) {       
-                                       
                                        $content = $this->$renderMethod($data);
                                } else {
                                        $content = sprintf($this->pObj->getBasicsObject()->getLabel('no_method'), $type);
@@ -330,9 +329,9 @@ class tx_install_view {
                        case 'general':
                                if(is_array($this->errors['general'])) {
                                        $hasErrors = true;
-
+                                       
                                        foreach ($this->errors['general'] as $errorItem) {
-                                               $content .= '<li>'.$this->renderError($errorItem).'</li>';
+                                               $content .= $this->renderErrorListItem($errorItem);
                                        }
                                }
                                break;
@@ -341,13 +340,13 @@ class tx_install_view {
                                        $hasErrors = true;
 
                                        foreach ($this->errors['fields'][$reqFieldName] as $errorItem) {
-                                               $content .= '<li>'.$this->renderError($errorItem).'</li>';
+                                               $content .= $this->renderErrorListItem($errorItem);
                                        }
                                }
                                break;
                }
                
-               $content .= '</ul><div>';
+               $content .= '</ul></div>';
                
                $returnValue = $content;
                if(!$hasErrors) {
@@ -358,6 +357,28 @@ class tx_install_view {
        }
        
        /**
+        * Renders a list item for a single error. (<li>error message</li>)
+        *
+        * @param       array   $errorItem: The data of the error item (array('severity', 'message'))
+        * @return      XHTML for a single list item <li>...
+        */
+       private function renderErrorListItem($errorItem) {
+               $result = '<li';
+               
+               switch ($errorItem['severity']) {
+                       case WARNING:
+                               $result .= ' class="severity-warning"';
+                               break;
+                       case FATAL:
+                               $result .= ' class="severity-fatal"';
+                               break;
+               }
+               
+               $result .= '>'.$this->renderError($errorItem).'</li>';
+               return $result;
+       }
+       
+       /**
         * Returns the HTML markup for a single error message, adds CSS class depending on the severity,
         * adds a "FATAL" if we have a fatal error and wraps the message with <span></span>.
         * 
@@ -566,7 +587,7 @@ class tx_install_view {
         * @return      string          HTML output
         */
        private function renderMessage($data) {
-               $out = '<div'.(($data['severity']) ? ' class="installer-message severity_'.$data['severity'].'"' : '').'>';
+               $out = '<div class="installer-message'.(($data['severity']) ? ' severity_'.$data['severity'] : '').'">';
                if ($data['label'])     {
                        if (is_array($data['label']))   {
                                $tag = $data['label'][0];
@@ -644,7 +665,7 @@ class tx_install_view {
                if ($data['options']['ajax'] == true)   {
                        $content .= '<br /><button class="submit" onclick="return '.$data['options']['action'].'">'.$data['options']['submit'].'</button>';
                } else {
-                       $content .= '<br /><input type="submit" class="submit" value="'.$data['options']['submit'].'" />';
+                       $content .= '<br /><input type="submit" class="submit bg" value="'.$data['options']['submit'].'" />';
                }
                
                $content .= '</form>';
@@ -674,7 +695,6 @@ class tx_install_view {
         */
        public function renderFormelement($data) {
                $content   = '';
-               $viewObj   = $this->pObj->getViewObject();
                $basicsObj = $this->pObj->getBasicsObject();
 
                if ($data['elementType'] == 'fieldset') {
@@ -692,7 +712,8 @@ class tx_install_view {
                        if(method_exists($this, $elementRenderMethod)) {
                                        // set the value of the field from the environment if no error is recognized for it
                                        // also set an error string if error was found
-                               $errors = $viewObj->getErrors();
+                               $errors = $this->getErrors();
+                               
                                if(!isset($errors['fields'][$data['options']['name']])) {
                                        $environment = $this->pObj->getEnvironment();
                                        if(!empty($environment[$data['options']['name']])) {
@@ -700,7 +721,7 @@ class tx_install_view {
                                        }
                                        $errorStr = '';
                                } else {
-                                       $errorStr = $viewObj->renderErrors(true, 'fields', $data['options']['name']);
+                                       $errorStr = $this->renderErrors(true, 'fields', $data['options']['name']);
                                }
                                
                                        // render the form element
@@ -712,6 +733,9 @@ class tx_install_view {
                                        
                                                // align the label (default is left)
                                        switch ($data['label_align']) {
+                                               case 'top':
+                                                       $formElementCode = $label.'<br />'.$errorStr.$formElementCode;
+                                                       break;
                                                case 'right':
                                                        $formElementCode = $errorStr.$formElementCode.$label;
                                                        break;
@@ -748,6 +772,7 @@ class tx_install_view {
                        $this->getAttributeString('id',    $data['id']).
                        $this->getAttributeString('size',  $data['size'], 20).  
                        $this->getAttributeString('value', $data['value'], '').
+                       $this->getAttributeString('class', $data['class']).
                        ' />';
 
                return $content;
@@ -771,6 +796,7 @@ class tx_install_view {
                        $this->getAttributeString('name', $data['name']).
                        $this->getAttributeString('id',   $data['id']).
                        $this->getAttributeString('size', $data['size'], 20).
+                       $this->getAttributeString('class', $data['class']).
                        ' />';
 
                return $content;
@@ -869,7 +895,7 @@ class tx_install_view {
         *
         * @param       string  $helpStr
         * @param       string  $id: A unique ID for the container. A random value is appended
-        * @return      array ('button', 'conatiner')
+        * @return      array ('button', 'container')
         */
        public function renderHelp($helpStr, $id)       {
                if (empty($helpStr))    {
index 303e686..b61427d 100755 (executable)
@@ -33,7 +33,7 @@
                        <label index="no_image">No image found</label>
                        
                        <label index="msg_error_login_not_sucessful">Login was not sucessful</label>
-                       <label index="msg_error_login_not_sucessful_message">The submitted password was not correct. Your md5 checksum is "%s"</label>
+                       <label index="msg_error_login_not_sucessful_message">The submitted password was not correct.&lt;br /&gt;Your md5 checksum is "%s"</label>
                        
                        <label index="login_emailwarning_true_subject">Install Tool Login at "%s"</label>
                        <label index="login_emailwarning_true_message">There has been a Install Tool login at TYPO3 site "%s" (%s) from remote address "%s" (%s).</label>
@@ -96,8 +96,8 @@ Better you remove the file "ENABLE_INSTALL_TOOL" in typo3conf/ directory.
 BTW: This Install Tool will only work if cookies are accepted by your web browser. If this dialog pops up over and over again you didn't enable cookies.
                        </label>
                        <label index="msg_login_passwordhint">The Install Tool Password is not the admin password of TYPO3.
-If you don't know the current password, you can set a new one by setting the value of $TYPO3_CONF_VARS['BE']['installToolPassword'] in typo3conf/localconf.php to the md5() hash value of the password you desire.
-                       </label>                        
+                       
+If you don't know the current password, you can set a new one by setting the value of $TYPO3_CONF_VARS['BE']['installToolPassword'] in typo3conf/localconf.php to the md5() hash value of the password you desire.</label>                     
                </languageKey>
        </data>
 </T3locallang>
\ No newline at end of file
index 94ccdc5..3b8c13a 100644 (file)
@@ -270,7 +270,8 @@ class tx_install_module_setup extends tx_install_module_base        {
                                                                'name' => $mod.':'.$name,
                                                                'value' => $this->basicsObject->getLocalconfValue($modConfig['value'], $modConfig['default']),
                                                                'description' => $modConfig['description'],
-                                                               'help' => $modConfig['help']
+                                                               'help' => $modConfig['help'],
+                                                               'class' => 'bg'
                                                        ))
                                                );
                                                
@@ -316,7 +317,7 @@ class tx_install_module_setup extends tx_install_module_base        {
                        
                                // add form for saving options
                        if ($deliverable == 'options')  {
-                               $result .= '<input type="button" onclick="sendForm(\'optionsForm\');" value="'.$this->get_LL('label_save').'" /></form>';
+                               $result .= '<input type="button" class="submit bg" onclick="sendForm(\'optionsForm\');" value="'.$this->get_LL('label_save').'" /></form>';
                        }
                }
                
index ef58167..27c873d 100644 (file)
@@ -28,12 +28,71 @@ input.bg, select.bg, button.bg      {
        padding:3px;
 }
 
+/** styles for login box - start **/
+form#formLogin {
+       width: 400px;
+       position: absolute;
+       left: 50%;
+       margin-left: -200px;
+       
+       background-color: #D7DBE2;
+       border: 1px solid #9BA1A8;
+       padding: 10px;
+}
+
+form#formLogin h4 {
+       font-size: 16px;
+       font-weight: bold;
+       background: none;
+       margin: 0 0 16px 0;     
+}
+
+form#formLogin .formElement {
+       background-color: white;
+       border: 1px silver solid;
+       padding: 10px 5px;
+       text-align: center;
+}
+
+form#formLogin label {
+       font-weight: bold;
+}
+
+form#formLogin .installer-message {
+       margin: 10px 0;
+       font-size: 11px;
+       font-style: italic;     
+}
+
+form#formLogin .submit {
+       font-weight: bold;
+       font-size: 12px;
+       width: 100%;
+       cursor: pointer;        
+}
+
+form#formLogin .submit:hover {
+       color: green;
+}
+
+form#formLogin ul {
+       text-align: left;
+}
+
+/** styles for login box - end **/
+
 label em       {
        font-style: italic;
        display: block;
        margin: 0px 0px 7px 20px;
 }
 
+.error-header {
+       font-weight: bold;
+       color: red;
+       margin: 5px;
+}
+
 .categoryTreeContainer {
        position: fixed;
        top: 5px;
@@ -118,6 +177,8 @@ label em    {
        padding: 3px;
 }
 
+/** error messages **/
+
 .severity_ok strong.message-header     {
        background-image: url('../../../imgs/icons/ok.png');
        background-position: 4px 50%;
@@ -138,4 +199,13 @@ label em   {
 
 .error-warning {
        color: #AA0000;
+}
+
+/* list items */
+li.severity-fatal {
+       list-style-image: url(../../../imgs/icons/cancel.png);
+}
+
+li.severity-warning {
+       list-style-image: url(../../../imgs/icons/warning.png);
 }
\ No newline at end of file