diff --git a/forms/MoreLessField.php b/forms/MoreLessField.php new file mode 100755 index 000000000..c1ad8670e --- /dev/null +++ b/forms/MoreLessField.php @@ -0,0 +1,60 @@ +moreText = $moreText; + $this->lessText = $lessText; + $this->charNum = $chars; + parent::__construct($name, $title, $value); + } + + function Field() { + $valforInput = $this->value ? Convert::raw2att($this->value) : ""; + $rawInput = Convert::html2raw($valforInput); + if ($this->charNum) $reducedVal = substr($rawInput,0,$this->charNum); + else $reducedVal = ereg_replace('([^\.]\.)[[:space:]].*','\\1',$rawInput); + if (strlen($reducedVal) < strlen($rawInput)) { + return <<$reducedVal + $this->moreText + + +
+HTML; + } else { + $this->dontEscape = true; + return parent::Field(); + } + } + + function setMoreText($moreText) { + $this->moreText = $moreText; + } + + function setLessText($lessText) { + $this->lessText = $lessText; + } + +} + +?> \ No newline at end of file