Commit fb9eea93d5f6498de2f97a1a2b2f74da914d06c9

Authored by Megan Watson
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 944 $global_required_default = true;
945 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 959 $this->aOptions['field'] = KTUtil::arrayGet($aOptions, 'field');
950 960 }
951 961  
952 962 function render() {
953 963 // very simple, general purpose passthrough. Chances are this is sufficient,
954 964 // just override the template being used.
955   - $bHasErrors = false;
  965 + $bHasErrors = false;
956 966 if (count($this->aErrors) != 0) { $bHasErrors = true; }
957 967 //var_dump($this->aErrors);
958   - $oTemplating =& KTTemplating::getSingleton();
  968 + $oTemplating =& KTTemplating::getSingleton();
959 969 $oTemplate = $oTemplating->loadTemplate('ktcore/forms/widgets/base');
960 970  
961 971 $this->aJavascript[] = 'thirdpartyjs/tinymce/jscripts/tiny_mce/tiny_mce.js';
962 972 $this->aJavascript[] = 'resources/js/kt_tinymce_init.js';
963   -
  973 +
964 974 if (!empty($this->aJavascript)) {
965 975 // grab our inner page.
966   - $oPage =& $GLOBALS['main'];
  976 + $oPage =& $GLOBALS['main'];
967 977 $oPage->requireJSResources($this->aJavascript);
968 978 }
969 979 if (!empty($this->aCSS)) {
970 980 // grab our inner page.
971   - $oPage =& $GLOBALS['main'];
  981 + $oPage =& $GLOBALS['main'];
972 982 $oPage->requireCSSResources($this->aCSS);
973 983 }
974   -
  984 +
975 985 $widget_content = $this->getWidget();
976   -
  986 +
977 987 $aTemplateData = array(
978 988 "context" => $this,
979 989 "label" => $this->sLabel,
... ...