From e618638cc4097d452903e73309a0ba65f41eceb6 Mon Sep 17 00:00:00 2001 From: Steffen Kamper Date: Wed, 16 Sep 2009 10:44:48 +0000 Subject: [PATCH] Fixed bug #11899: Make resizable and flexible textareas configurable, set default maxHeight to 600 git-svn-id: https://svn.typo3.org/TYPO3v4/Core/trunk@5941 709f56b5-9817-0410-a4d7-c38de5d9e867 --- ChangeLog | 1 + t3lib/class.t3lib_tceforms.php | 20 +++++++++++++++----- t3lib/js/extjs/tceforms.js | 24 +++++++++++++++--------- t3lib/js/extjs/ux/ext.resizable.js | 10 +++++++--- typo3/sysext/setup/ext_tables.php | 20 ++++++++++++++++++-- typo3/sysext/setup/locallang_csh_mod.xml | 6 ++++++ typo3/sysext/setup/mod/locallang.xml | 3 +++ 7 files changed, 65 insertions(+), 19 deletions(-) diff --git a/ChangeLog b/ChangeLog index aa992b57045c..97aa28076c97 100755 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,6 @@ 2009-09-16 Steffen Kamper + * Fixed bug #11899: Make resizable and flexible textareas configurable, set default maxHeight to 600 * Fixed bug #11965: Content Element Media needs stdWrap to change path (e.g. for DAM) (thanks to Georg Ringer) * Fixed bug #11902: [MediaCE] works only with absRefPrefix and doesn't support flowplayer diff --git a/t3lib/class.t3lib_tceforms.php b/t3lib/class.t3lib_tceforms.php index 5de957b00fd8..9be12fe632e7 100644 --- a/t3lib/class.t3lib_tceforms.php +++ b/t3lib/class.t3lib_tceforms.php @@ -5246,9 +5246,21 @@ class t3lib_TCEforms { $GLOBALS['SOBE']->doc->loadPrototype(); $GLOBALS['SOBE']->doc->loadExtJS(); - $GLOBALS['SOBE']->doc->addStyleSheet('ext.resizable', $this->backPath . '../t3lib/js/extjs/ux/resize.css'); + + // make textareas resizable and flexible + if (!($GLOBALS['BE_USER']->uc['resizeTextareas'] == '0' && $GLOBALS['BE_USER']->uc['resizeTextareas_Flexible'] == '0')) { + $GLOBALS['SOBE']->doc->addStyleSheet('ext.resizable', $this->backPath . '../t3lib/js/extjs/ux/resize.css'); + $this->loadJavascriptLib('../t3lib/js/extjs/ux/ext.resizable.js'); + } + $resizableSettings = array( + 'textareaMaxHeight' => $GLOBALS['BE_USER']->uc['resizeTextareas_MaxHeight'] >0 ? $GLOBALS['BE_USER']->uc['resizeTextareas_MaxHeight'] : '600', + 'textareaFlexible' => (!$GLOBALS['BE_USER']->uc['resizeTextareas_Flexible'] == '0'), + 'textareaResize' => (!$GLOBALS['BE_USER']->uc['resizeTextareas'] == '0'), + ); + $GLOBALS['SOBE']->doc->addInlineSettingArray('', $resizableSettings); + $this->loadJavascriptLib('../t3lib/jsfunc.evalfield.js'); - $this->loadJavascriptLib('../t3lib/js/extjs/ux/ext.resizable.js'); + // @TODO: Change to loadJavascriptLib(), but fix "TS = new typoScript()" issue first - see bug #9494 $jsFile[] = ''; @@ -5258,9 +5270,7 @@ class t3lib_TCEforms { 'dateFormat' => array('j-n-Y', 'G:i j-n-Y'), 'dateFormatUS' => array('n-j-Y', 'G:i n-j-Y'), ); - $out .= ' - Ext.ns("TYPO3"); - TYPO3.settings = ' . json_encode($typo3Settings) . ';'; + $GLOBALS['SOBE']->doc->addInlineSettingArray('', $typo3Settings); $this->loadJavascriptLib('../t3lib/js/extjs/tceforms.js'); diff --git a/t3lib/js/extjs/tceforms.js b/t3lib/js/extjs/tceforms.js index 819ea4a012c6..88155f3091eb 100644 --- a/t3lib/js/extjs/tceforms.js +++ b/t3lib/js/extjs/tceforms.js @@ -75,15 +75,21 @@ TYPO3.TCEFORMS = { convertTextareasResizable: function() { var textAreas = Ext.select("*[id^=tceforms-textarea-]"); textAreas.each(function(element) { - element.addClass('resizable'); - var elasticTextarea = new Ext.ux.elasticTextArea().applyTo(element.dom.id, { - minHeight: 50 - }); - var dwrapped = new Ext.Resizable(element.dom.id, { - minWidth: 300, - minHeight: 50, - dynamic: true - }); + if (TYPO3.settings.textareaFlexible) { + var elasticTextarea = new Ext.ux.elasticTextArea().applyTo(element.dom.id, { + minHeight: 50, + maxHeight: TYPO3.settings.textareaMaxHeight + }); + } + if (TYPO3.settings.textareaResize) { + element.addClass('resizable'); + var dwrapped = new Ext.Resizable(element.dom.id, { + minWidth: 300, + minHeight: 50, + maxHeight: TYPO3.settings.textareaMaxHeight, + dynamic: true + }); + } }); } diff --git a/t3lib/js/extjs/ux/ext.resizable.js b/t3lib/js/extjs/ux/ext.resizable.js index ec18442aafbd..23bac0bd69fc 100644 --- a/t3lib/js/extjs/ux/ext.resizable.js +++ b/t3lib/js/extjs/ux/ext.resizable.js @@ -956,7 +956,7 @@ Ext.ux.elasticTextArea = function(){ return { minHeight : 0 ,maxHeight : 0 - ,growBy: 20 + ,growBy: 12 } } @@ -1003,7 +1003,11 @@ Ext.ux.elasticTextArea = function(){ .replace(/\n/g, '
 ') ); - var textHeight = this.div.getHeight() + 12; + var growBy = parseInt(el.getStyle('line-height')) + 1; + if (growBy === 1) { + growBy = options.growBy; + } + var textHeight = this.div.getHeight() + growBy; if ( (textHeight > options.maxHeight ) && (options.maxHeight > 0) ){ textHeight = options.maxHeight ; @@ -1014,7 +1018,7 @@ Ext.ux.elasticTextArea = function(){ el.setStyle('overflow', 'auto'); } - el.setHeight(textHeight + options.growBy , true); + el.setHeight(textHeight , true); } } } diff --git a/typo3/sysext/setup/ext_tables.php b/typo3/sysext/setup/ext_tables.php index 86d3323c0e5c..9d58debf499c 100755 --- a/typo3/sysext/setup/ext_tables.php +++ b/typo3/sysext/setup/ext_tables.php @@ -138,11 +138,27 @@ $GLOBALS['TYPO3_USER_SETTINGS'] = array( 'type' => 'check', 'label' => 'LLL:EXT:setup/mod/locallang.xml:enableFlashUploader', 'csh' => 'enableFlashUploader', - ) + ), + 'resizeTextareas' => array( + 'type' => 'check', + 'label' => 'LLL:EXT:setup/mod/locallang.xml:resizeTextareas', + 'csh' => 'resizeTextareas', + ), + 'resizeTextareas_MaxHeight' => array( + 'type' => 'text', + 'label' => 'LLL:EXT:setup/mod/locallang.xml:resizeTextareas_MaxHeight', + 'csh' => 'resizeTextareas_MaxHeight', + 'default' => 600, + ), + 'resizeTextareas_Flexible' => array( + 'type' => 'check', + 'label' => 'LLL:EXT:setup/mod/locallang.xml:resizeTextareas_Flexible', + 'csh' => 'resizeTextareas_Flexible', + ), ), 'showitem' => '--div--;LLL:EXT:setup/mod/locallang.xml:personal_data,realName,email,emailMeAtLogin,password,password2,lang, --div--;LLL:EXT:setup/mod/locallang.xml:opening,condensedMode,noMenuMode,startModule,thumbnailsByDefault,helpText,edit_showFieldHelp,titleLen, - --div--;LLL:EXT:setup/mod/locallang.xml:editFunctionsTab,edit_RTE,edit_wideDocument,edit_docModuleUpload,enableFlashUploader,disableCMlayers,copyLevels,recursiveDelete, + --div--;LLL:EXT:setup/mod/locallang.xml:editFunctionsTab,edit_RTE,edit_wideDocument,edit_docModuleUpload,enableFlashUploader,resizeTextareas,resizeTextareas_MaxHeight,resizeTextareas_Flexible,disableCMlayers,copyLevels,recursiveDelete, --div--;LLL:EXT:setup/mod/locallang.xml:adminFunctions,simulate' ); diff --git a/typo3/sysext/setup/locallang_csh_mod.xml b/typo3/sysext/setup/locallang_csh_mod.xml index 0937502c2e28..ea39d51ff5b0 100755 --- a/typo3/sysext/setup/locallang_csh_mod.xml +++ b/typo3/sysext/setup/locallang_csh_mod.xml @@ -73,6 +73,12 @@ The default module is "About Modules". + + + + + +