diff options
author | xue <> | 2005-12-29 13:01:04 +0000 |
---|---|---|
committer | xue <> | 2005-12-29 13:01:04 +0000 |
commit | c38c1e6f271f73e5d9474e63bca227e2b7a30db8 (patch) | |
tree | af07fb99f0853194aab5664124b68a19e618a0e1 | |
parent | 3126610fdab66c4e83de00d36a762af30199238d (diff) |
Added line numbers to source view.
-rw-r--r-- | demos/quickstart/protected/controls/TTextHighlighter.php | 19 | ||||
-rw-r--r-- | demos/quickstart/protected/pages/ViewSource.page | 2 |
2 files changed, 8 insertions, 13 deletions
diff --git a/demos/quickstart/protected/controls/TTextHighlighter.php b/demos/quickstart/protected/controls/TTextHighlighter.php index b89e5274..bc74b5af 100644 --- a/demos/quickstart/protected/controls/TTextHighlighter.php +++ b/demos/quickstart/protected/controls/TTextHighlighter.php @@ -43,22 +43,19 @@ class TTextHighlighter extends TWebControl return $this->getViewState('LineNumbers', false);
}
- public function getEnableEntities()
- {
- return $this->getViewState('Entities', false);
- }
-
- public function setEnableEntities($value)
- {
- $this->setViewState('Entities', TPropertyValue::ensureBoolean($value), false);
- }
-
protected function onPreRender($writer)
{
parent::onPreRender($writer);
$this->registerTextHighlightStyleSheet();
}
+ public function addParsedObject($object)
+ {
+ if(is_string($object))
+ $object=html_entity_decode($object);
+ parent::addParsedObject($object);
+ }
+
protected function renderContents($writer)
{
$textWriter=new TTextWriter;
@@ -86,8 +83,6 @@ class TTextHighlighter extends TWebControl */
protected function highlightText($text)
{
- if(!$this->getEnableEntities())
- $text = html_entity_decode($text);
$geshi = new GeSHi(trim($text), $this->getLanguage());
if($this->getEnableLineNumbers())
$geshi->enable_line_numbers(GESHI_NORMAL_LINE_NUMBERS);
diff --git a/demos/quickstart/protected/pages/ViewSource.page b/demos/quickstart/protected/pages/ViewSource.page index 21ddafa8..c17d35af 100644 --- a/demos/quickstart/protected/pages/ViewSource.page +++ b/demos/quickstart/protected/pages/ViewSource.page @@ -10,7 +10,7 @@ <com:TLiteral ID="SourceList" />
</div>
<div id="sourceView">
-<com:TTextHighlighter ID="Highlighter" CssClass="source">
+<com:TTextHighlighter ID="Highlighter" EnableLineNumbers="true" CssClass="source">
<com:TLiteral ID="SourceView" />
</com:TTextHighlighter>
</div>
|