From fb9eea93d5f6498de2f97a1a2b2f74da914d06c9 Mon Sep 17 00:00:00 2001 From: Megan Watson Date: Mon, 19 Oct 2009 09:47:23 +0200 Subject: [PATCH] Changed the default values for the rows and columns of the textarea. PT: 1491622 Jira: KTS-4426 --- plugins/ktcore/KTWidgets.php | 28 +++++++++++++++++++--------- 1 file changed, 19 insertions(+), 9 deletions(-) diff --git a/plugins/ktcore/KTWidgets.php b/plugins/ktcore/KTWidgets.php index e982942..0e26330 100755 --- a/plugins/ktcore/KTWidgets.php +++ b/plugins/ktcore/KTWidgets.php @@ -944,36 +944,46 @@ class KTCoreTextAreaWidget extends KTWidget { $global_required_default = true; $this->bRequired = (KTUtil::arrayGet($aOptions, 'required', $global_required_default, false) == true); - $this->aOptions['cols'] = KTUtil::arrayGet($aOptions, 'cols', 60); - $this->aOptions['rows'] = KTUtil::arrayGet($aOptions, 'rows', 3); + // 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) + $default_rows = 20; + if(isset($this->aOptions['field'])){ + $oField = $this->aOptions['field']; + if(!$oField->getIsHTML()){ + $default_rows = 15; + } + } + + + $this->aOptions['cols'] = KTUtil::arrayGet($aOptions, 'cols', 80); + $this->aOptions['rows'] = KTUtil::arrayGet($aOptions, 'rows', $default_rows); $this->aOptions['field'] = KTUtil::arrayGet($aOptions, 'field'); } function render() { // very simple, general purpose passthrough. Chances are this is sufficient, // just override the template being used. - $bHasErrors = false; + $bHasErrors = false; if (count($this->aErrors) != 0) { $bHasErrors = true; } //var_dump($this->aErrors); - $oTemplating =& KTTemplating::getSingleton(); + $oTemplating =& KTTemplating::getSingleton(); $oTemplate = $oTemplating->loadTemplate('ktcore/forms/widgets/base'); $this->aJavascript[] = 'thirdpartyjs/tinymce/jscripts/tiny_mce/tiny_mce.js'; $this->aJavascript[] = 'resources/js/kt_tinymce_init.js'; - + if (!empty($this->aJavascript)) { // grab our inner page. - $oPage =& $GLOBALS['main']; + $oPage =& $GLOBALS['main']; $oPage->requireJSResources($this->aJavascript); } if (!empty($this->aCSS)) { // grab our inner page. - $oPage =& $GLOBALS['main']; + $oPage =& $GLOBALS['main']; $oPage->requireCSSResources($this->aCSS); } - + $widget_content = $this->getWidget(); - + $aTemplateData = array( "context" => $this, "label" => $this->sLabel, -- libgit2 0.21.4