Fixed bug #17501: User setup - pressing return creates installtool file
authorSteffen Kamper <info@sk-typo3.de>
Wed, 9 Feb 2011 23:59:45 +0000 (23:59 +0000)
committerSteffen Kamper <info@sk-typo3.de>
Wed, 9 Feb 2011 23:59:45 +0000 (23:59 +0000)
git-svn-id: https://svn.typo3.org/TYPO3v4/Core/trunk@10430 709f56b5-9817-0410-a4d7-c38de5d9e867

ChangeLog
typo3/sysext/setup/mod/index.php
typo3/sysext/setup/mod/locallang.xml

index 0f2d53a..5280e21 100755 (executable)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,6 @@
 2011-02-09  Steffen Kamper  <steffen@typo3.org>
 
 2011-02-09  Steffen Kamper  <steffen@typo3.org>
 
+       * Fixed bug #17501: User setup - pressing return creates installtool file
        * Raised CodeMirror to version 0.9.3
 
 2011-02-08  Steffen Kamper  <steffen@typo3.org>
        * Raised CodeMirror to version 0.9.3
 
 2011-02-08  Steffen Kamper  <steffen@typo3.org>
index 6ed8e30..cd4454d 100755 (executable)
@@ -118,6 +118,7 @@ class SC_mod_user_setup_index {
        protected $passwordIsSubmitted = FALSE;
        protected $setupIsUpdated = FALSE;
        protected $tempDataIsCleared = FALSE;
        protected $passwordIsSubmitted = FALSE;
        protected $setupIsUpdated = FALSE;
        protected $tempDataIsCleared = FALSE;
+       protected $settingsAreResetToDefault = FALSE;
        protected $installToolFileExists = FALSE;
        protected $installToolFileKeep = FALSE;
 
        protected $installToolFileExists = FALSE;
        protected $installToolFileKeep = FALSE;
 
@@ -188,6 +189,7 @@ class SC_mod_user_setup_index {
                        if ($d['setValuesToDefault']) {
                                        // If every value should be default
                                $BE_USER->resetUC();
                        if ($d['setValuesToDefault']) {
                                        // If every value should be default
                                $BE_USER->resetUC();
+                               $this->settingsAreResetToDefault = TRUE;
                        } elseif ($d['clearSessionVars']) {
                                foreach ($BE_USER->uc as $key => $value) {
                                        if (!isset($columns[$key])) {
                        } elseif ($d['clearSessionVars']) {
                                foreach ($BE_USER->uc as $key => $value) {
                                        if (!isset($columns[$key])) {
@@ -419,7 +421,7 @@ class SC_mod_user_setup_index {
                $this->content .= $this->doc->header($LANG->getLL('UserSettings').' - '.$BE_USER->user['realName'].' ['.$BE_USER->user['username'].']');
 
                        // show if setup was saved
                $this->content .= $this->doc->header($LANG->getLL('UserSettings').' - '.$BE_USER->user['realName'].' ['.$BE_USER->user['username'].']');
 
                        // show if setup was saved
-               if ($this->setupIsUpdated) {
+               if ($this->setupIsUpdated && !$this->tempDataIsCleared && !$this->settingsAreResetToDefault) {
                        $flashMessage = t3lib_div::makeInstance(
                                't3lib_FlashMessage',
                                $LANG->getLL('setupWasUpdated'),
                        $flashMessage = t3lib_div::makeInstance(
                                't3lib_FlashMessage',
                                $LANG->getLL('setupWasUpdated'),
@@ -436,6 +438,15 @@ class SC_mod_user_setup_index {
                        );
                        $this->content .= $flashMessage->render();
                }
                        );
                        $this->content .= $flashMessage->render();
                }
+                       // Show if temporary data was cleared
+               if ($this->settingsAreResetToDefault) {
+                       $flashMessage = t3lib_div::makeInstance(
+                               't3lib_FlashMessage',
+                               $LANG->getLL('settingsAreReset'),
+                               $LANG->getLL('resetConfiguration')
+                       );
+                       $this->content .= $flashMessage->render();
+               }
                        // If password is updated, output whether it failed or was OK.
                if ($this->passwordIsSubmitted) {
                        if ($this->passwordIsUpdated) {
                        // If password is updated, output whether it failed or was OK.
                if ($this->passwordIsSubmitted) {
                        if ($this->passwordIsUpdated) {
@@ -470,8 +481,12 @@ class SC_mod_user_setup_index {
                        <input type="hidden" name="simUser" value="'.$this->simUser.'" />
                        <input type="hidden" name="formToken" value="' . $formToken . '" />
                        <input type="submit" name="data[save]" value="'.$LANG->getLL('save').'" />
                        <input type="hidden" name="simUser" value="'.$this->simUser.'" />
                        <input type="hidden" name="formToken" value="' . $formToken . '" />
                        <input type="submit" name="data[save]" value="'.$LANG->getLL('save').'" />
-                       <input type="submit" name="data[setValuesToDefault]" value="'.$LANG->getLL('resetConfiguration').'" onclick="return confirm(\''.$LANG->getLL('setToStandardQuestion').'\');" />
-                       <input type="submit" name="data[clearSessionVars]" value="' . $LANG->getLL('clearSessionVars') . '"  onclick="return confirm(\'' . $LANG->getLL('clearSessionVarsQuestion') . '\');" />'
+                       <input type="button" value="' . $LANG->getLL('resetConfiguration') .
+                                       '" onclick="if(confirm(\''.$LANG->getLL('setToStandardQuestion').'\')) {document.getElementById(\'setValuesToDefault\').value=1;this.form.submit();}" />
+                       <input type="button" value="' . $LANG->getLL('clearSessionVars') .
+                                       '"  onclick="if(confirm(\'' . $LANG->getLL('clearSessionVarsQuestion') . '\')){document.getElementById(\'clearSessionVars\').value=1;this.form.submit();}" />
+                       <input type="hidden" name="data[setValuesToDefault]" value="0" id="setValuesToDefault" />
+                       <input type="hidden" name="data[clearSessionVars]" value="0" id="clearSessionVars" />'
                );
 
                        // Notice
                );
 
                        // Notice
@@ -592,6 +607,7 @@ class SC_mod_user_setup_index {
                $fieldArray = $this->getFieldsFromShowItem();
 
                $this->dividers2tabs = isset($GLOBALS['TYPO3_USER_SETTINGS']['ctrl']['dividers2tabs']) ? intval($GLOBALS['TYPO3_USER_SETTINGS']['ctrl']['dividers2tabs']) : 0;
                $fieldArray = $this->getFieldsFromShowItem();
 
                $this->dividers2tabs = isset($GLOBALS['TYPO3_USER_SETTINGS']['ctrl']['dividers2tabs']) ? intval($GLOBALS['TYPO3_USER_SETTINGS']['ctrl']['dividers2tabs']) : 0;
+               $tabLabel = '';
 
                foreach ($fieldArray as $fieldName) {
                        $more = '';
 
                foreach ($fieldArray as $fieldName) {
                        $more = '';
@@ -808,7 +824,7 @@ class SC_mod_user_setup_index {
                if (empty($GLOBALS['BE_USER']->uc['startModule']))      {
                        $GLOBALS['BE_USER']->uc['startModule'] = $GLOBALS['BE_USER']->uc_default['startModule'];
                }
                if (empty($GLOBALS['BE_USER']->uc['startModule']))      {
                        $GLOBALS['BE_USER']->uc['startModule'] = $GLOBALS['BE_USER']->uc_default['startModule'];
                }
-               $startModuleSelect .= '<option value=""></option>';
+               $startModuleSelect = '<option value=""></option>';
                foreach ($pObj->loadModules->modules as $mainMod => $modData) {
                        if (isset($modData['sub']) && is_array($modData['sub'])) {
                                $startModuleSelect .= '<option disabled="disabled">'.$GLOBALS['LANG']->moduleLabels['tabs'][$mainMod.'_tab'].'</option>';
                foreach ($pObj->loadModules->modules as $mainMod => $modData) {
                        if (isset($modData['sub']) && is_array($modData['sub'])) {
                                $startModuleSelect .= '<option disabled="disabled">'.$GLOBALS['LANG']->moduleLabels['tabs'][$mainMod.'_tab'].'</option>';
@@ -842,11 +858,16 @@ class SC_mod_user_setup_index {
                }
 
                if ($parent->getInstallToolFileExists()) {
                }
 
                if ($parent->getInstallToolFileExists()) {
-                       return '<input type="submit" name="deleteInstallToolEnableFile"' .
+                       return '<input type="button" name="deleteInstallToolEnableFile"' .
                                        ($parent->getInstallToolFileKeep() ? ' disabled="disabled"' : '') .
                                        ($parent->getInstallToolFileKeep() ? ' disabled="disabled"' : '') .
-                                       ' value="' . $GLOBALS['LANG']->sL('LLL:EXT:setup/mod/locallang.xml:enableInstallTool.deleteFile') . '" />';
+                                       ' value="' . $GLOBALS['LANG']->sL('LLL:EXT:setup/mod/locallang.xml:enableInstallTool.deleteFile') . '" onclick="document.getElementById(\'deleteInstallToolEnableFile\').value=1;this.form.submit();" />
+                                       <input type="hidden" name="deleteInstallToolEnableFile" value="0" id="deleteInstallToolEnableFile" />
+                                       ';
+
                } else {
                } else {
-                       return '<input type="submit" name="createInstallToolEnableFile" value="' . $GLOBALS['LANG']->sL('LLL:EXT:setup/mod/locallang.xml:enableInstallTool.createFile') . '" />';
+                       return '<input type="button" name="createInstallToolEnableFile" value="' .
+                                       $GLOBALS['LANG']->sL('LLL:EXT:setup/mod/locallang.xml:enableInstallTool.createFile') . '" onclick="document.getElementById(\'createInstallToolEnableFile\').value=1;this.form.submit();" />
+                                       <input type="hidden" name="createInstallToolEnableFile" value="0" id="createInstallToolEnableFile" />';
                }
        }
 
                }
        }
 
index 47c1f2e..ddd41f3 100755 (executable)
                        <label index="tempDataCleared">Temporary data cleared</label>
                        <label index="tempDataClearedFlashMessage">The temporary data has been cleared.</label>
                        <label index="tempDataClearedLog">Temporary data cleared</label>
                        <label index="tempDataCleared">Temporary data cleared</label>
                        <label index="tempDataClearedFlashMessage">The temporary data has been cleared.</label>
                        <label index="tempDataClearedLog">Temporary data cleared</label>
+                       <label index="settingsAreReset">The user settings have been reset to default values and temporary data has been cleared.</label>
                        <label index="debugInWindow">Display debug messages in a new browser window</label>
                </languageKey>
        </data>
                        <label index="debugInWindow">Display debug messages in a new browser window</label>
                </languageKey>
        </data>