Fixed bug #11899: Make resizable and flexible textareas configurable, set default...
authorSteffen Kamper <info@sk-typo3.de>
Wed, 16 Sep 2009 10:44:48 +0000 (10:44 +0000)
committerSteffen Kamper <info@sk-typo3.de>
Wed, 16 Sep 2009 10:44:48 +0000 (10:44 +0000)
git-svn-id: https://svn.typo3.org/TYPO3v4/Core/trunk@5941 709f56b5-9817-0410-a4d7-c38de5d9e867

ChangeLog
t3lib/class.t3lib_tceforms.php
t3lib/js/extjs/tceforms.js
t3lib/js/extjs/ux/ext.resizable.js
typo3/sysext/setup/ext_tables.php
typo3/sysext/setup/locallang_csh_mod.xml
typo3/sysext/setup/mod/locallang.xml

index aa992b5..97aa280 100755 (executable)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,6 @@
 2009-09-16  Steffen Kamper  <info@sk-typo3.de>
 
+       * 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
 
index 5de957b..9be12fe 100644 (file)
@@ -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[] = '<script type="text/javascript" src="'.$this->backPath.'jsfunc.tbe_editor.js"></script>';
 
@@ -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');
 
index 819ea4a..88155f3 100644 (file)
@@ -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
+                               });
+                       }
                });
        }
        
index ec18442..23bac0b 100644 (file)
@@ -956,7 +956,7 @@ Ext.ux.elasticTextArea = function(){
         return {\r
             minHeight : 0\r
             ,maxHeight : 0\r
-            ,growBy: 20\r
+            ,growBy: 12\r
         }\r
     }\r
     \r
@@ -1003,7 +1003,11 @@ Ext.ux.elasticTextArea = function(){
                                 .replace(/\n/g, '<br />&nbsp;') \r
                     );\r
             \r
-            var textHeight = this.div.getHeight() + 12;\r
+                       var growBy = parseInt(el.getStyle('line-height')) + 1;\r
+                       if (growBy === 1) {\r
+                               growBy = options.growBy;\r
+                       }\r
+                       var textHeight = this.div.getHeight() + growBy;\r
             \r
             if ( (textHeight > options.maxHeight ) && (options.maxHeight > 0) ){\r
                 textHeight = options.maxHeight ;\r
@@ -1014,7 +1018,7 @@ Ext.ux.elasticTextArea = function(){
                 el.setStyle('overflow', 'auto');\r
             }\r
             \r
-            el.setHeight(textHeight + options.growBy , true);\r
+            el.setHeight(textHeight , true);\r
         }\r
     }\r
 }\r
index 86d3323..9d58deb 100755 (executable)
@@ -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'
 
 );
index 0937502..ea39d51 100755 (executable)
@@ -73,6 +73,12 @@ The default module is &quot;About Modules&quot;.</label>
                        <label index="option_enableFlashUploader.alttitle">Enable Flash Uploader</label>
                        <label index="option_enableFlashUploader.description">This option will enable a flash-based uploader that allows you to select multiple files at once when uploading files. If you enable this option, make sure that your browser has the latest Flash plugin (Flash 9 or higher) installed in order to make this feature work.</label>
                        <label index="option_edit_showFieldHelp.alttitle">Context Sensitive Help mode</label>
+                       <label index="option_resizeTextareas.alttitle">Make Textareas Resizable</label>
+                       <label index="option_resizeTextareas.description">This option will make textareas resizable. You will see the resize mouse cursor if you move mouse to the outer border of textarea.</label>
+                       <label index="option_resizeTextareas_MaxHeight.alttitle">Maximal Height of Textarea</label>
+                       <label index="option_resizeTextareas_MaxHeight.description">Define the maximal height of textarea (in Pixel).</label>
+                       <label index="option_resizeTextareas_Flexible.alttitle">Make Textareas Flexible</label>
+                       <label index="option_resizeTextareas_Flexible.description">This option will make textareas flexible. The height will grow automatically while typing. Limit is the maximal height set (default 600).</label>
                        <label index="option_edit_showFieldHelp.description">Defines the mode of Context Sensitive Help (CSH) in TYPO3. The default is that small help icons are shown everywhere a help item is available. You can click the icon and help will appear in a window for you.</label>
                        <label index="option_edit_showFieldHelp.details">Alternatively you can select that descriptions are shown inline. This is useful for people who are still learning how TYPO3 works and want to browse the backend with descriptions shown directly.
 Finally experienced users will want to totally disable the help icons if they seem to just bloat the backend interface.
index c451298..6b58387 100755 (executable)
@@ -79,6 +79,9 @@
                        <label index="edit_RTE">Enable Rich Text Editor (if available)</label>
                        <label index="edit_docModuleUpload">File upload directly in Doc-module</label>
                        <label index="enableFlashUploader">Enable Flash Uploader (requires Flash 9+)</label>
+                       <label index="resizeTextareas">Make Textareas resizable</label>
+                       <label index="resizeTextareas_MaxHeight">Maximal Height of resizable Textarea in Pixel</label>
+                       <label index="resizeTextareas_Flexible">Make Textareas flexible</label>
                        <label index="editFunctionsTab">Edit &amp; Advanced functions</label>
                        <label index="edit_functions">Edit</label>
                        <label index="disableCMlayers">Disable Popup Context Menus</label>