[TASK] Move buttons in user setting into advanced functions
authorSusanne Moog <typo3@susannemoog.de>
Sun, 1 Jul 2012 15:59:10 +0000 (17:59 +0200)
committerChristian Kuhn <lolli@schwarzbu.ch>
Sun, 29 Jul 2012 14:21:21 +0000 (16:21 +0200)
The buttons "clear configuration" and "reset
temporary data" are advanced functions and should
therefore be moved to the advanced tab.

Additionally the buttons divert the attention, so that
it is very hard to notice the save button on the
top.

The patch moves the buttons to the advanced tab and
additionally aligns the select box(es) with the
input and button fields.

Change-Id: I5c5552d3a20b68e458b6523bfb5e939000cd4f9a
Related: #632
Releases: 6.0
Resolves: #38523
Reviewed-on: http://review.typo3.org/12504
Reviewed-by: Wouter Wolters
Tested-by: Wouter Wolters
Reviewed-by: Georg Ringer
Tested-by: Georg Ringer
Reviewed-by: Christian Kuhn
Tested-by: Christian Kuhn
typo3/sysext/setup/ext_tables.php
typo3/sysext/setup/mod/index.php
typo3/sysext/setup/mod/locallang.xlf

index c07b450..94b2a57 100755 (executable)
@@ -99,10 +99,30 @@ $GLOBALS['TYPO3_USER_SETTINGS'] = array(
                'simulate' => array(
                        'type' => 'select',
                        'itemsProcFunc' => 'SC_mod_user_setup_index->renderSimulateUserSelect',
-                       'access' => 'admin',
                        'label' => 'LLL:EXT:setup/mod/locallang.xml:simulate',
                        'csh' => 'simuser'
                ),
+               'resetConfiguration' => array(
+                       'type' => 'button',
+                       'label' => 'LLL:EXT:setup/mod/locallang.xml:resetConfiguration',
+                       'buttonlabel' => 'LLL:EXT:setup/mod/locallang.xml:resetConfigurationShort',
+                       'csh' => 'reset',
+                       'onClick' => 'if (confirm(\'%s\')) { document.getElementById(\'setValuesToDefault\').value = 1; this.form.submit(); }',
+                       'onClickLabels' => array(
+                               'LLL:EXT:setup/mod/locallang.xml:setToStandardQuestion'
+                       )
+               ),
+               'clearSessionVars' => array(
+                       'type' => 'button',
+                       'access' => 'admin',
+                       'label' => 'LLL:EXT:setup/mod/locallang.xml:clearSessionVars',
+                       'buttonlabel' => 'LLL:EXT:setup/mod/locallang.xml:clearSessionVarsShort',
+                       'csh' => 'reset',
+                       'onClick' => 'if (confirm(\'%s\')) { document.getElementById(\'clearSessionVars\').value = 1; this.form.submit(); }',
+                       'onClickLabels' => array(
+                               'LLL:EXT:setup/mod/locallang.xml:clearSessionVarsQuestion'
+                       )
+               ),
                'enableFlashUploader' => array(
                        'type' => 'check',
                        'label' => 'LLL:EXT:setup/mod/locallang.xml:enableFlashUploader',
@@ -131,7 +151,7 @@ $GLOBALS['TYPO3_USER_SETTINGS'] = array(
        ),
        'showitem' => '--div--;LLL:EXT:setup/mod/locallang.xml:personal_data,realName,email,emailMeAtLogin,password,password2,lang,
                        --div--;LLL:EXT:setup/mod/locallang.xml:opening,startModule,thumbnailsByDefault,titleLen,
-                       --div--;LLL:EXT:setup/mod/locallang.xml:editFunctionsTab,edit_RTE,edit_wideDocument,edit_docModuleUpload,showHiddenFilesAndFolders,enableFlashUploader,resizeTextareas,resizeTextareas_Flexible,resizeTextareas_MaxHeight,copyLevels,recursiveDelete,
+                       --div--;LLL:EXT:setup/mod/locallang.xml:editFunctionsTab,edit_RTE,edit_wideDocument,edit_docModuleUpload,showHiddenFilesAndFolders,enableFlashUploader,resizeTextareas,resizeTextareas_Flexible,resizeTextareas_MaxHeight,copyLevels,recursiveDelete,resetConfiguration,clearSessionVars,
                        --div--;LLL:EXT:setup/mod/locallang.xml:adminFunctions,simulate,debugInWindow'
 
 );
index 3f5a58b..fdcdc0d 100755 (executable)
@@ -410,19 +410,6 @@ class SC_mod_user_setup_index {
                        <input type="hidden" name="data[clearSessionVars]" value="0" id="clearSessionVars" />'
                );
 
-                       // Section: Reset settings
-               $this->content .= $this->doc->spacer(20);
-               $this->content .= $this->doc->section($LANG->getLL('resetSectionHeader') . ' ' . t3lib_BEfunc::cshItem('_MOD_user_setup', 'reset', $GLOBALS['BACK_PATH']),
-                       '<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(); }" />',
-                       FALSE,
-                       FALSE,
-                       0,
-                       TRUE
-               );
-
                        // End of wrapper div
                $this->content .= '</div>';
 
@@ -495,7 +482,6 @@ class SC_mod_user_setup_index {
                $i = 0;
 
                $fieldArray = $this->getFieldsFromShowItem();
-
                $this->dividers2tabs = isset($GLOBALS['TYPO3_USER_SETTINGS']['ctrl']['dividers2tabs']) ? intval($GLOBALS['TYPO3_USER_SETTINGS']['ctrl']['dividers2tabs']) : 0;
                $tabLabel = '';
 
@@ -593,7 +579,7 @@ class SC_mod_user_setup_index {
                                        if ($config['itemsProcFunc']) {
                                                $html = t3lib_div::callUserFunction($config['itemsProcFunc'], $config, $this, '');
                                        } else {
-                                               $html = '<select id="field_' . $fieldName . '" name="data[' . $fieldName . ']"' . $more . '>' . LF;
+                                               $html = '<select ' . $GLOBALS['TBE_TEMPLATE']->formWidth(20) . ' id="field_' . $fieldName . '" name="data[' . $fieldName . ']"' . $more . '>' . LF;
                                                foreach ($config['items'] as $key => $optionLabel) {
                                                        $html .= '<option value="' . $key . '"' .
                                                                ($value == $key ? ' selected="selected"' : '') .
@@ -606,6 +592,19 @@ class SC_mod_user_setup_index {
                                case 'user':
                                        $html = t3lib_div::callUserFunction($config['userFunc'], $config, $this, '');
                                break;
+                               case 'button':
+                                       if ($config['onClick']) {
+                                               $onClick = $config['onClick'];
+                                               if ($config['onClickLabels']) {
+                                                       foreach ($config['onClickLabels'] as $key => $labelclick) {
+                                                               $config['onClickLabels'][$key] = $this->getLabel($labelclick, '', FALSE);
+                                                       }
+                                                       $onClick = vsprintf($onClick, $config['onClickLabels']);
+                                               }
+                                               $html = '<input ' . $GLOBALS['TBE_TEMPLATE']->formWidth(20) . ' type="button" value="' . $this->getLabel($config['buttonlabel'], '', FALSE) .
+                                                       '" onclick="' . $onClick . '" />';
+                                       }
+                                       break;
                                default:
                                        $html = '';
                        }
@@ -680,7 +679,7 @@ class SC_mod_user_setup_index {
                ksort($languageOptions);
 
                $languageCode = '
-                               <select id="field_lang" name="data[lang]" class="select">' .
+                               <select ' . $GLOBALS['TBE_TEMPLATE']->formWidth(20) . ' id="field_lang" name="data[lang]" class="select">' .
                                        implode('', $languageOptions) . '
                                </select>';
                if ( $GLOBALS['BE_USER']->uc['lang'] && !@is_dir(PATH_typo3conf . 'l10n/' . $GLOBALS['BE_USER']->uc['lang'])) {
@@ -726,7 +725,7 @@ class SC_mod_user_setup_index {
                        }
                }
 
-               return '<select id="field_startModule" name="data[startModule]" class="select">' . $startModuleSelect . '</select>';
+               return '<select ' . $GLOBALS['TBE_TEMPLATE']->formWidth(20) . 'id="field_startModule" name="data[startModule]" class="select">' . $startModuleSelect . '</select>';
        }
 
        /**
@@ -753,7 +752,7 @@ class SC_mod_user_setup_index {
                                }
                        }
                        if (count($opt)) {
-                               $this->simulateSelector = '<select id="field_simulate" name="simulateUser" onchange="window.location.href=\'' . t3lib_BEfunc::getModuleUrl('user_setup') . '&simUser=\'+this.options[this.selectedIndex].value;"><option></option>' . implode('', $opt) . '</select>';
+                               $this->simulateSelector = '<select ' . $GLOBALS['TBE_TEMPLATE']->formWidth(20) . ' id="field_simulate" name="simulateUser" onchange="window.location.href=\'' . t3lib_BEfunc::getModuleUrl('user_setup') . '&simUser=\'+this.options[this.selectedIndex].value;"><option></option>' . implode('', $opt) . '</select>';
                        }
                }
 
@@ -841,7 +840,7 @@ class SC_mod_user_setup_index {
                                // Setting comes from another extension
                        $context = $strParts[0];
                        $field = $strParts[1];
-               } elseif (!t3lib_div::inList('language,simuser', $str)) {
+               } elseif (!t3lib_div::inList('language,simuser,reset', $str)) {
                        $field = 'option_' . $str;
                }
                return t3lib_BEfunc::wrapInHelp($context, $field, $label);
@@ -875,4 +874,4 @@ $LANG->includeLLFile('EXT:setup/mod/locallang.xml');
 $SOBE->init();
 $SOBE->main();
 $SOBE->printContent();
-?>
\ No newline at end of file
+?>
index 357ca33..590efff 100644 (file)
                        <trans-unit id="resetConfiguration" xml:space="preserve">
                                <source>Reset Configuration and Clear Temporary Data</source>
                        </trans-unit>
+                       <trans-unit id="resetConfigurationShort" xml:space="preserve">
+                               <source>Reset</source>
+                       </trans-unit>
                        <trans-unit id="setToStandardQuestion" xml:space="preserve">
                                <source>Are you sure you want to reset all values to default?</source>
                        </trans-unit>
                        <trans-unit id="clearSessionVars" xml:space="preserve">
                                <source>Clear Temporary Data</source>
                        </trans-unit>
+                       <trans-unit id="clearSessionVarsShort" xml:space="preserve">
+                               <source>Clear</source>
+                       </trans-unit>
                        <trans-unit id="clearSessionVarsQuestion" xml:space="preserve">
                                <source>Are you sure you want to clear the temporary data?</source>
                        </trans-unit>