38 require_once realpath(dirname(__FILE__)).
"/../field_renderers.inc";
71 $this->annotateBefore =
true;
72 if ($config[
"encoding"]) $this->encoding = $config[
"encoding"];
80 <script type=
'text/javascript'>
82 function <?echo $field ?>_keyup(event)
84 var form = document.getElementById(
'<?echo $this->parent->id ?>');
85 var ctrl = form[
'<?echo $field ?>'];
86 var len = ctrl.value.length;
87 if (len >= <?echo $this->limit?>)
89 ctrl.value = ctrl.value.substring(0, <?echo $this->limit ?>);
90 len = <?echo $this->limit ?>;
93 var count = document.getElementById(
'<?echo $field ?>_length');
94 count.innerHTML = len;
108 $onkeypress =
" onkeyup='{$field}_keyup(event);'";
112 if ($this->style)
$style =
"style='{$this->style}'";
116 echo
"<textarea id='{$this->parent->id}_$field' name='$field' rows='{$this->rows}' cols='{$this->columns}'{$placeholder} $style $disable $onkeypress>";
123 echo
"<br /><div class='character_count' style='clear: left; float: right'><span id='{$field}_length'>";
124 echo strlen(trim($this->parent->data->get($field)));
125 echo
"</span> of $this->limit characters</div></div>";
135 $text = htmlspecialchars($this->parent->data->get($field), ENT_QUOTES | ENT_IGNORE,
'UTF-8');
136 $text = str_replace(
"\n",
"<br/>", $text);
147 if ($mode ==
"range")
149 $from = htmlspecialchars($this->parent->params->get($field,
"from"), ENT_QUOTES,
'UTF-8');
150 $to = htmlspecialchars($this->parent->params->get($field,
"to"), ENT_QUOTES,
'UTF-8');
154 echo
"<td>From <input type='text' name='$field:from' value='{$from}' size='25'> to <input type='text' name='$field:to' value='{$to}' size='25'></td>\n";
159 $value = htmlspecialchars($this->parent->params->get($field, $mode), ENT_QUOTES,
'UTF-8');
164 echo
"<td><input type='text' name='$field:$mode' value='{$value}'{$placeholder} size='50'></td>\n";
FieldRenderer is the abstract base class for all FieldRenderers.
_startField($field, $styles="")
Internal method to generate the starting HTML for the field (including the label)
_endField($field)
Internal method to generate the closing HTML for the field.
_printLabel($field, $colspan=1, $styles="", $annotation="")
Internal method to generate the HTML for the field label.
FieldRenderer($parent)
Constructor.
Field renderer for text data fields.
TextFieldRenderer(&$parent)
Constructs a new TextFieldRenderer object.
$columns
The number of columns to display in the text area.
$rows
The number of rows to display in the text area.
$colspan
The number of table columns to display across.
renderField($field)
FieldRenderers must override this method to provide the HTML implementation of the control used to ed...
$style
Inline styles for the text area element.
$placeholder
Placeholder text to display when field is empty.
$disable
Alternative to readonly; field can be reenabled thru javascript.
$encoding
Overrides the default text encoding.
renderScript($field)
FieldRenderers can override this method to provide any Javascript that their control requires for an ...
renderSearchField($field, $mode="like")
FieldRenderers must override this method to provide the HTML implementation of the control displayed ...
$limit
Optional limit on the number of characters allowed to be entered (enforced by Javascript)....