summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--.gitattributes2
-rw-r--r--demos/quickstart/protected/controls/Highlighter/geshi/prado.php21
-rw-r--r--demos/quickstart/protected/pages/Controls/Samples/Label.page23
-rw-r--r--demos/quickstart/protected/pages/Controls/Samples/TextBox.page81
-rw-r--r--demos/quickstart/protected/pages/Controls/Samples/TextBox.php16
-rw-r--r--demos/quickstart/protected/pages/Controls/Simple.page6
-rw-r--r--demos/quickstart/protected/pages/Fundamentals/Components.page2
-rw-r--r--demos/quickstart/themes/Simple/style.css7
-rw-r--r--framework/Web/UI/WebControls/TStyle.php2
-rw-r--r--framework/Web/UI/WebControls/TTextBox.php19
10 files changed, 161 insertions, 18 deletions
diff --git a/.gitattributes b/.gitattributes
index 01929f48..964bd457 100644
--- a/.gitattributes
+++ b/.gitattributes
@@ -40,6 +40,8 @@ demos/quickstart/protected/pages/Configurations/Templates3.page -text
demos/quickstart/protected/pages/Construction.page -text
demos/quickstart/protected/pages/Controls/Overview.page -text
demos/quickstart/protected/pages/Controls/Samples/Label.page -text
+demos/quickstart/protected/pages/Controls/Samples/TextBox.page -text
+demos/quickstart/protected/pages/Controls/Samples/TextBox.php -text
demos/quickstart/protected/pages/Controls/Samples/config.xml -text
demos/quickstart/protected/pages/Controls/Simple.page -text
demos/quickstart/protected/pages/Controls/Simple1.page -text
diff --git a/demos/quickstart/protected/controls/Highlighter/geshi/prado.php b/demos/quickstart/protected/controls/Highlighter/geshi/prado.php
index 95759a87..c9d96a35 100644
--- a/demos/quickstart/protected/controls/Highlighter/geshi/prado.php
+++ b/demos/quickstart/protected/controls/Highlighter/geshi/prado.php
@@ -100,26 +100,33 @@ $language_data = array (
),
'REGEXPS' => array(
0 => array(
- GESHI_SEARCH => '((<)(com:)([a-z0-9\\\.]+)(\s*))',
- GESHI_REPLACE => '\\2<a class="api" href="link_to_api?\\4">\\3\\4</a>\\5',
+ GESHI_SEARCH => '&lt;(com:[a-z0-9\\\.]+)',
+ GESHI_REPLACE => '\\1',
GESHI_MODIFIERS => 'i',
- GESHI_BEFORE => '',
+ GESHI_BEFORE => '&lt;',
GESHI_AFTER => ''
),
1 => array(
- GESHI_SEARCH => '(&lt;/com:[a-z0-9\-]+\s*&gt;)',
+ GESHI_SEARCH => '&lt;/(com:[a-z0-9\-]+)',
GESHI_REPLACE => '\\1',
GESHI_MODIFIERS => 'i',
- GESHI_BEFORE => '',
+ GESHI_BEFORE => '&lt;/',
GESHI_AFTER => ''
),
2 => array(
- GESHI_SEARCH => '(&lt;/?prop:?([a-z0-9_]+)&gt;)',
+ GESHI_SEARCH => '(&lt;/?)(prop:[a-z0-9_]+&gt;)',
+ GESHI_REPLACE => '\\2',
+ GESHI_MODIFIERS => 'i',
+ GESHI_BEFORE => '\\1',
+ GESHI_AFTER => ''
+ ),
+ 3 => array(
+ GESHI_SEARCH => '((/)?&gt;)',
GESHI_REPLACE => '\\1',
GESHI_MODIFIERS => 'i',
GESHI_BEFORE => '',
GESHI_AFTER => ''
- ),
+ )
),
'STRICT_MODE_APPLIES' => GESHI_ALWAYS,
'SCRIPT_DELIMITERS' => array(
diff --git a/demos/quickstart/protected/pages/Controls/Samples/Label.page b/demos/quickstart/protected/pages/Controls/Samples/Label.page
index 2fa77988..381541a0 100644
--- a/demos/quickstart/protected/pages/Controls/Samples/Label.page
+++ b/demos/quickstart/protected/pages/Controls/Samples/Label.page
@@ -3,28 +3,43 @@
<h1>TLabel Samples</h1>
<div class="samplepanel">
+
<com:TLabel
Text="This is a label with customized color and font."
ForeColor="yellow"
BackColor="blue"
Font.Name="Arial"
- Font.Size="12pt"
+ Font.Size="14pt"
/>
+
</div>
<div class="samplepanel">
+
<com:TLabel
Text="This is a form label associated with the TTextBox control below."
AssociatedControlID="test"
/>
-<br/>
-<com:TTextBox ID="test" />
+
+<br/><com:TTextBox ID="test" />
+
</div>
<div class="samplepanel">
-<com:TLabel>
+
+<com:TLabel ForeColor="blue" Style="color:red;">
This is a label with empty Text property and <b>nonempty body</b>.
</com:TLabel>
+
+</div>
+
+<div class="samplepanel">
+
+<com:TLabel
+ Text="This is a disabled label."
+ Enabled="false"
+/>
+
</div>
</com:TContent> \ No newline at end of file
diff --git a/demos/quickstart/protected/pages/Controls/Samples/TextBox.page b/demos/quickstart/protected/pages/Controls/Samples/TextBox.page
new file mode 100644
index 00000000..43ab16f7
--- /dev/null
+++ b/demos/quickstart/protected/pages/Controls/Samples/TextBox.page
@@ -0,0 +1,81 @@
+<com:TContent ID="body">
+
+<h1>TTextBox Samples</h1>
+
+<div class="samplepanel">
+<div class="sampletitle">SingleLine and Password Text Boxes</div>
+
+Text box with default settings:
+<com:TTextBox />
+<br/>
+
+Password text box:
+<com:TTextBox TextMode="Password" />
+<br/>
+
+Text box with customized color, font, columns, maximum length:
+<com:TTextBox
+ Text="text"
+ ForeColor="yellow"
+ BackColor="blue"
+ Font.Size="14pt"
+ Columns="4"
+ MaxLength="6"
+/>
+<br/>
+
+Disabled text box:
+<com:TTextBox Text="disabled" Enabled="false" />
+<br/>
+
+Read-only text box:
+<com:TTextBox Text="read only" ReadOnly="true" />
+<br/>
+
+Auto postback text box:
+<com:TTextBox Text="change me" AutoPostBack="true" TextChanged="textChanged" />
+<br/>
+
+Text box's behavior upon postback:
+<com:TTextBox ID="TextBox1" Text="text" />
+<com:TButton Text="Submit" Click="submitText" />
+
+</div>
+
+<div class="samplepanel">
+<div class="sampletitle">MultiLine Text Boxes</div>
+
+Text box with default settings:<br/>
+<com:TTextBox TextMode="MultiLine" />
+<br/>
+
+Text box with customized dimensions, font and content:<br/>
+<com:TTextBox TextMode="MultiLine" Rows="6" Columns="60" Font.Italic="true">
+<prop:Text>
+This is a multiline text box.
+In HTML, it is displayed as a textarea.
+</prop:Text>
+</com:TTextBox>
+<br/>
+
+Disabled text box:<br/>
+<com:TTextBox
+ TextMode="MultiLine"
+ Text="disabled"
+ Enabled="false" />
+<br/>
+
+Read-only text box with text-wrapping disabled:<br/>
+<com:TTextBox
+ TextMode="MultiLine"
+ Text="This is a read-only text box with text-wrapping disabled."
+ ReadOnly="true"
+ Wrap="false"/>
+<br/>
+
+Auto postback text box:<br/>
+<com:TTextBox TextMode="MultiLine" Text="change me" AutoPostBack="true" TextChanged="textChanged" />
+<br/>
+</div>
+
+</com:TContent> \ No newline at end of file
diff --git a/demos/quickstart/protected/pages/Controls/Samples/TextBox.php b/demos/quickstart/protected/pages/Controls/Samples/TextBox.php
new file mode 100644
index 00000000..1e6478de
--- /dev/null
+++ b/demos/quickstart/protected/pages/Controls/Samples/TextBox.php
@@ -0,0 +1,16 @@
+<?php
+
+class TextBox extends TPage
+{
+ public function textChanged($sender,$param)
+ {
+ $sender->Text="text changed";
+ }
+
+ public function submitText($sender,$param)
+ {
+ $this->TextBox1->Text="You just entered '".$this->TextBox1->Text."'.";
+ }
+}
+
+?> \ No newline at end of file
diff --git a/demos/quickstart/protected/pages/Controls/Simple.page b/demos/quickstart/protected/pages/Controls/Simple.page
index 94061711..5a145102 100644
--- a/demos/quickstart/protected/pages/Controls/Simple.page
+++ b/demos/quickstart/protected/pages/Controls/Simple.page
@@ -8,4 +8,10 @@
</p>
<com:RunBar PagePath="Controls.Samples.Label" />
+<h2>TTextBox</h2>
+<p>
+<tt>TTextBox</tt> displays a text box on a Web page. The content in the text box is determined by the <tt>Text</tt> property. You can create a <tt>SingleLine</tt>, a <tt>MultiLine</tt>, or a <tt>Password</tt> text box by setting the <tt>TextMode</tt> property. The <tt>Rows</tt> and <tt>Columns</tt> properties specify their dimensions. If <tt>AutoPostBack</tt> is true, changing the content in the text box and then moving the focus out of it will cause postback action.
+</p>
+<com:RunBar PagePath="Controls.Samples.TextBox" />
+
</com:TContent> \ No newline at end of file
diff --git a/demos/quickstart/protected/pages/Fundamentals/Components.page b/demos/quickstart/protected/pages/Fundamentals/Components.page
index 56cf1671..32d82e1c 100644
--- a/demos/quickstart/protected/pages/Fundamentals/Components.page
+++ b/demos/quickstart/protected/pages/Fundamentals/Components.page
@@ -120,7 +120,7 @@ where <tt>ComponentType</tt> refers to a class name or a type name in namespace
<h3>Static Component Instantiation</h3>
<p>
Static component instantiation is about creating components via <a href="?page=Configurations.Overview">configurations</a>. The actual creation work is done by the PRADO framework. For example, in an <a href="?page=Configurations.AppConfig">application configuration</a>, one can configure a module to be loaded when the application runs. The module is thus a static component created by the framework. Static component instantiation is more commonly used in <a href="?page=Configurations.Templates1">templates</a>. Every component tag in a template specifies a component that will be automatically created by the framework when the template is loaded. For example, in a page template, the following tag will lead to the creation of a <tt>TButton</tt> component on the page,
-<com:TTextHighlighter CssClass="source">
+<com:TTextHighlighter Language="prado" CssClass="source">
&lt;com:TButton Text="Register" /&gt;
</com:TTextHighlighter>
</p>
diff --git a/demos/quickstart/themes/Simple/style.css b/demos/quickstart/themes/Simple/style.css
index 5bbae28b..406384d3 100644
--- a/demos/quickstart/themes/Simple/style.css
+++ b/demos/quickstart/themes/Simple/style.css
@@ -166,4 +166,11 @@ tt {
margin: 10px;
border: 1px solid silver;
padding: 10px;
+}
+
+.sampletitle {
+ width: 100%;
+ border-bottom:1px solid silver;
+ font-weight:bold;
+ margin-bottom:5px;
} \ No newline at end of file
diff --git a/framework/Web/UI/WebControls/TStyle.php b/framework/Web/UI/WebControls/TStyle.php
index bb1d733a..02f0de29 100644
--- a/framework/Web/UI/WebControls/TStyle.php
+++ b/framework/Web/UI/WebControls/TStyle.php
@@ -296,7 +296,7 @@ class TStyle extends TComponent
{
$arr=explode(':',$style);
if(isset($arr[1]) && trim($arr[0])!=='')
- $writer->addStyleAttribute(trim($arr[0]),trim($arry[1]));
+ $writer->addStyleAttribute(trim($arr[0]),trim($arr[1]));
}
}
foreach($this->_data as $name=>$value)
diff --git a/framework/Web/UI/WebControls/TTextBox.php b/framework/Web/UI/WebControls/TTextBox.php
index 905cc1e1..00d75e75 100644
--- a/framework/Web/UI/WebControls/TTextBox.php
+++ b/framework/Web/UI/WebControls/TTextBox.php
@@ -43,6 +43,14 @@
class TTextBox extends TWebControl implements IPostBackDataHandler, IValidatable
{
/**
+ * Default number of rows (for MultiLine text box)
+ */
+ const DEFAULT_ROWS=4;
+ /**
+ * Default number of columns (for MultiLine text box)
+ */
+ const DEFAULT_COLUMNS=20;
+ /**
* @var array list of auto complete types
*/
private static $_autoCompleteTypes=array('BusinessCity','BusinessCountryRegion','BusinessFax','BusinessPhone','BusinessState','BusinessStreetAddress','BusinessUrl','BusinessZipCode','Cellular','Company','Department','Disabled','DisplayName','Email','FirstName','Gender','HomeCity','HomeCountryRegion','HomeFax','Homepage','HomePhone','HomeState','HomeStreetAddress','HomeZipCode','JobTitle','LastName','MiddleName','None','Notes','Office','Pager','Search');
@@ -69,9 +77,9 @@ class TTextBox extends TWebControl implements IPostBackDataHandler, IValidatable
if(($textMode=$this->getTextMode())==='MultiLine')
{
if(($rows=$this->getRows())<=0)
- $rows=2;
+ $rows=self::DEFAULT_ROWS;
if(($cols=$this->getColumns())<=0)
- $cols=20;
+ $cols=self::DEFAULT_COLUMNS;
$writer->addAttribute('rows',"$rows");
$writer->addAttribute('cols',"$cols");
if(!$this->getWrap())
@@ -119,6 +127,7 @@ class TTextBox extends TWebControl implements IPostBackDataHandler, IValidatable
$writer->addAttribute('disabled','disabled');
if($this->getAutoPostBack() && $page->getClientSupportsJavaScript())
{
+ $writer->addAttribute('id',$this->getClientID());
$options = $this->getAutoPostBackOptions();
$scripts = $this->getPage()->getClientScript();
$postback = $scripts->getPostBackEventReference($this,'',$options,false);
@@ -337,16 +346,16 @@ class TTextBox extends TWebControl implements IPostBackDataHandler, IValidatable
*/
public function getRows()
{
- return $this->getViewState('Rows',0);
+ return $this->getViewState('Rows',self::DEFAULT_ROWS);
}
/**
* Sets the number of rows displayed in a multiline text box.
- * @param integer the number of rows, set it 0 to clear the setting
+ * @param integer the number of rows
*/
public function setRows($value)
{
- $this->setViewState('Rows',TPropertyValue::ensureInteger($value),0);
+ $this->setViewState('Rows',TPropertyValue::ensureInteger($value),self::DEFAULT_ROWS);
}
/**