summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorxue <>2006-03-26 23:47:19 +0000
committerxue <>2006-03-26 23:47:19 +0000
commit27578bac69d64900e8b252bd5a61a2c5d2b13ee8 (patch)
tree15b934238c20467a257b88d72a4df2f3beeefdd3
parentb1323f31af5dea42c99385c2c50d9e664fbce847 (diff)
Added tutorial for TTextHighlighter.
-rw-r--r--demos/quickstart/protected/pages/Controls/TextHighlighter.page30
-rw-r--r--framework/Exceptions/messages.txt4
-rw-r--r--framework/Web/UI/WebControls/TColorPicker.php2
-rw-r--r--framework/Web/UI/WebControls/TTextHighlighter.php11
4 files changed, 41 insertions, 6 deletions
diff --git a/demos/quickstart/protected/pages/Controls/TextHighlighter.page b/demos/quickstart/protected/pages/Controls/TextHighlighter.page
index 8ef30c71..23c33b75 100644
--- a/demos/quickstart/protected/pages/Controls/TextHighlighter.page
+++ b/demos/quickstart/protected/pages/Controls/TextHighlighter.page
@@ -3,4 +3,34 @@
<h1>TTextHighlighter</h1>
<com:DocLink ClassPath="System.Web.UI.WebControls.TTextHighlighter" />
+<p>
+<tt>TTextHighlighter</tt> does syntax highlighting for its body content, including both static text and the rendering results of its child controls. The text being highlighted follows the syntax of the specified <tt>Language</tt>, which can be 'php' (default), 'prado', 'css', 'html', etc. Here, 'prado' stands for the syntax of PRADO control templates.
+</p>
+<p>
+If line numbers are desired in front of each line, set <tt>ShowLineNumbers</tt> to true.
+</p>
+<p>
+To use <tt>TTextHighlighter</tt>, simply enclose the contents to be syntax highlighted within the body of a <tt>TTextHighlighter</tt> control. The following example highlights a piece of PHP code,
+</p>
+<com:TTextHighlighter Language="prado" CssClass="source">
+&lt;com:TTextHighlighter ShowLineNumbers="true"&gt;
+<?php
+$str = 'one|two|three|four';
+print_r(explode('|', $str, 2)); // will output an array
+?>
+&lt;/com:TTextHighlighter&gt;
+</com:TTextHighlighter>
+
+<p>
+The output will look as follows,
+</p>
+<div style="border:1px solid silver">
+<com:TTextHighlighter ShowLineNumbers="true">
+<?php
+$str = 'one|two|three|four';
+print_r(explode('|', $str, 2)); // will output an array
+?>
+</com:TTextHighlighter>
+</div>
+
</com:TContent> \ No newline at end of file
diff --git a/framework/Exceptions/messages.txt b/framework/Exceptions/messages.txt
index a60230bd..c65ba3f6 100644
--- a/framework/Exceptions/messages.txt
+++ b/framework/Exceptions/messages.txt
@@ -266,4 +266,6 @@ wizard_command_invalid = Invalid wizard navigation command '{0}'.
completewizardstep_steptype_readonly = TCompleteWizardStep.StepType is read-only.
-wizardstepcollection_wizardstep_required = TWizardStepCollection can only accept objects of TWizardStep or its derived classes. \ No newline at end of file
+wizardstepcollection_wizardstep_required = TWizardStepCollection can only accept objects of TWizardStep or its derived classes.
+
+texthighlighter_stylesheet_invalid = Unable to find the stylesheet file for TTextHighlighter. \ No newline at end of file
diff --git a/framework/Web/UI/WebControls/TColorPicker.php b/framework/Web/UI/WebControls/TColorPicker.php
index 3488c912..f222e4ce 100644
--- a/framework/Web/UI/WebControls/TColorPicker.php
+++ b/framework/Web/UI/WebControls/TColorPicker.php
@@ -13,6 +13,8 @@
/**
* TColorPicker class.
*
+ * Be aware, this control is EXPERIMENTAL and may have significant change in future versions.
+ *
* @author Wei Zhuo <weizhuo[at]gmail[dot]com>
* @version $Revision: $ $Date: $
* @package System.Web.UI.WebControls
diff --git a/framework/Web/UI/WebControls/TTextHighlighter.php b/framework/Web/UI/WebControls/TTextHighlighter.php
index 4aa01dc4..6fb1ddbb 100644
--- a/framework/Web/UI/WebControls/TTextHighlighter.php
+++ b/framework/Web/UI/WebControls/TTextHighlighter.php
@@ -84,8 +84,7 @@ class TTextHighlighter extends TWebControl
public function onPreRender($writer)
{
parent::onPreRender($writer);
- $this->registerHighlightStyleSheet();
- $this->getPage()->getClientScript()->registerPradoScript('prado');
+ $this->registerHighlightScripts();
}
/**
@@ -114,11 +113,12 @@ class TTextHighlighter extends TWebControl
}
/**
- * Register CSS style sheet file.
+ * Register CSS stylesheet file and javascript file.
+ * @throws TConfigurationException if highlight.css file cannot be found
*/
- protected function registerHighlightStyleSheet()
+ protected function registerHighlightScripts()
{
- $cs = $this->getPage()->getClientScript();
+ $cs=$this->getPage()->getClientScript();
$cssKey='prado:TTextHighlighter';
if(!$cs->isStyleSheetFileRegistered($cssKey))
{
@@ -127,6 +127,7 @@ class TTextHighlighter extends TWebControl
$styleSheet = $this->publishFilePath($cssFile);
$cs->registerStyleSheetFile($cssKey, $styleSheet);
}
+ $cs->registerPradoScript('prado');
}
/**