Project

General

Profile

« Previous | Next » 

Revision c70b6835

Added by Stephen Beaver over 9 years ago

Added support for rows, cols and wrap to Forms_Textarea and to pkg_edit.php

View differences:

src/usr/local/www/classes/Form/Input.class.php
122 122
		return $this;
123 123
	}
124 124

  
125
	public function setCols($size)
126
	{
127
		$this->_attributes['cols'] = $size;
128

  
129
		return $this;
130
	}
131

  
125 132
	public function setReadonly()
126 133
	{
127 134
		$this->_attributes['readonly'] = 'readonly';
src/usr/local/www/classes/Form/Textarea.class.php
42 42
		$this->_value = $value;
43 43
	}
44 44

  
45
	public function setRows($size)
46
	{
47
		$this->_attributes['rows'] = $size;
48

  
49
		return $this;
50
	}
51

  
52
	public function setNoWrap()
53
	{
54
		$this->_attributes['wrap'] = 'none';
55

  
56
		return $this;
57
	}
58

  
45 59
	protected function _getInput()
46 60
	{
47 61
		$element = parent::_getInput();
src/usr/local/www/pkg_edit.php
1015 1015

  
1016 1016
		// Create a textarea element
1017 1017
		case "textarea":
1018
			$rows = $cols = 0;
1019

  
1018 1020
			if ($pkga['rows']) {
1019
				$rows = " rows='{$pkga['rows']}' ";
1021
				$rows = $pkga['rows'];
1020 1022
			}
1021 1023
			if ($pkga['cols']) {
1022
				$cols = " cols='{$pkga['cols']}' ";
1024
				$cols = $pkga['cols'];
1023 1025
			}
1026

  
1024 1027
			if (($pkga['encoding'] == 'base64') && !$get_from_post && !empty($value)) {
1025 1028
				$value = base64_decode($value);
1026 1029
			}
1027 1030

  
1028
			$wrap =($pkga['wrap'] == "off" ? 'wrap="off" style="white-space:nowrap;"' : '');
1029

  
1030
			if ($grouping) {
1031
				$group->add(new Form_Textarea(
1031
			$grp = new Form_Textarea(
1032 1032
					$pkga['fieldname'],
1033 1033
					$pkga['fielddescr'],
1034 1034
					$value
1035
				))->setHelp(fixup_string($pkga['description']));
1035
			);
1036

  
1037
			$grp->setHelp(fixup_string($pkga['description']));
1038

  
1039
			if ($rows > 0) {
1040
				$grp->setRows($rows);
1041
			}
1042

  
1043
			if ($cols > 0) {
1044
				$grp->setCols($cols);
1045
			}
1046

  
1047
			if ($pkga['wrap'] == "off") {
1048
				$grp->setAttribute("wrap", "off");
1049
				$grp->setAttribute("style", "white-space:nowrap;");
1050
			}
1051

  
1052
			if ($grouping) {
1053
				$group->add($grp);
1036 1054
			} else {
1037 1055
				if (isset($pkga['advancedfield']) && isset($advfield_count)) {
1038
					$advanced->addInput(new Form_Textarea(
1039
						$pkga['fieldname'],
1040
						$pkga['fielddescr'],
1041
						$value
1042
					))->setHelp(fixup_string($pkga['description']));
1056
					$advanced->addInput($grp);
1043 1057
				} else {
1044
					$section->addInput(new Form_Textarea(
1045
						$pkga['fieldname'],
1046
						$pkga['fielddescr'],
1047
						$value
1048
					))->setHelp(fixup_string($pkga['description']));
1058
					$section->addInput($grp);
1049 1059
				}
1050 1060
			}
1051 1061

  

Also available in: Unified diff