Commit fb9eea93d5f6498de2f97a1a2b2f74da914d06c9
1 parent
c5c0f6f2
Changed the default values for the rows and columns of the textarea.
PT: 1491622 Jira: KTS-4426 Committed by: Megan Watson
Showing
1 changed file
with
19 additions
and
9 deletions
plugins/ktcore/KTWidgets.php
| @@ -944,36 +944,46 @@ class KTCoreTextAreaWidget extends KTWidget { | @@ -944,36 +944,46 @@ class KTCoreTextAreaWidget extends KTWidget { | ||
| 944 | $global_required_default = true; | 944 | $global_required_default = true; |
| 945 | $this->bRequired = (KTUtil::arrayGet($aOptions, 'required', $global_required_default, false) == true); | 945 | $this->bRequired = (KTUtil::arrayGet($aOptions, 'required', $global_required_default, false) == true); |
| 946 | 946 | ||
| 947 | - $this->aOptions['cols'] = KTUtil::arrayGet($aOptions, 'cols', 60); | ||
| 948 | - $this->aOptions['rows'] = KTUtil::arrayGet($aOptions, 'rows', 3); | 947 | + // Part of the space on the mce editor is taken up by the toolbars, so make the plain text field slightly smaller (if using the default size) |
| 948 | + $default_rows = 20; | ||
| 949 | + if(isset($this->aOptions['field'])){ | ||
| 950 | + $oField = $this->aOptions['field']; | ||
| 951 | + if(!$oField->getIsHTML()){ | ||
| 952 | + $default_rows = 15; | ||
| 953 | + } | ||
| 954 | + } | ||
| 955 | + | ||
| 956 | + | ||
| 957 | + $this->aOptions['cols'] = KTUtil::arrayGet($aOptions, 'cols', 80); | ||
| 958 | + $this->aOptions['rows'] = KTUtil::arrayGet($aOptions, 'rows', $default_rows); | ||
| 949 | $this->aOptions['field'] = KTUtil::arrayGet($aOptions, 'field'); | 959 | $this->aOptions['field'] = KTUtil::arrayGet($aOptions, 'field'); |
| 950 | } | 960 | } |
| 951 | 961 | ||
| 952 | function render() { | 962 | function render() { |
| 953 | // very simple, general purpose passthrough. Chances are this is sufficient, | 963 | // very simple, general purpose passthrough. Chances are this is sufficient, |
| 954 | // just override the template being used. | 964 | // just override the template being used. |
| 955 | - $bHasErrors = false; | 965 | + $bHasErrors = false; |
| 956 | if (count($this->aErrors) != 0) { $bHasErrors = true; } | 966 | if (count($this->aErrors) != 0) { $bHasErrors = true; } |
| 957 | //var_dump($this->aErrors); | 967 | //var_dump($this->aErrors); |
| 958 | - $oTemplating =& KTTemplating::getSingleton(); | 968 | + $oTemplating =& KTTemplating::getSingleton(); |
| 959 | $oTemplate = $oTemplating->loadTemplate('ktcore/forms/widgets/base'); | 969 | $oTemplate = $oTemplating->loadTemplate('ktcore/forms/widgets/base'); |
| 960 | 970 | ||
| 961 | $this->aJavascript[] = 'thirdpartyjs/tinymce/jscripts/tiny_mce/tiny_mce.js'; | 971 | $this->aJavascript[] = 'thirdpartyjs/tinymce/jscripts/tiny_mce/tiny_mce.js'; |
| 962 | $this->aJavascript[] = 'resources/js/kt_tinymce_init.js'; | 972 | $this->aJavascript[] = 'resources/js/kt_tinymce_init.js'; |
| 963 | - | 973 | + |
| 964 | if (!empty($this->aJavascript)) { | 974 | if (!empty($this->aJavascript)) { |
| 965 | // grab our inner page. | 975 | // grab our inner page. |
| 966 | - $oPage =& $GLOBALS['main']; | 976 | + $oPage =& $GLOBALS['main']; |
| 967 | $oPage->requireJSResources($this->aJavascript); | 977 | $oPage->requireJSResources($this->aJavascript); |
| 968 | } | 978 | } |
| 969 | if (!empty($this->aCSS)) { | 979 | if (!empty($this->aCSS)) { |
| 970 | // grab our inner page. | 980 | // grab our inner page. |
| 971 | - $oPage =& $GLOBALS['main']; | 981 | + $oPage =& $GLOBALS['main']; |
| 972 | $oPage->requireCSSResources($this->aCSS); | 982 | $oPage->requireCSSResources($this->aCSS); |
| 973 | } | 983 | } |
| 974 | - | 984 | + |
| 975 | $widget_content = $this->getWidget(); | 985 | $widget_content = $this->getWidget(); |
| 976 | - | 986 | + |
| 977 | $aTemplateData = array( | 987 | $aTemplateData = array( |
| 978 | "context" => $this, | 988 | "context" => $this, |
| 979 | "label" => $this->sLabel, | 989 | "label" => $this->sLabel, |