summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorxue <>2006-04-02 01:48:18 +0000
committerxue <>2006-04-02 01:48:18 +0000
commitf826b0ae6b8f11f8da1a5a6251e9a1fe6e6c1e85 (patch)
tree74d1aa11100d867bebcc94d1d871d896df055087
parent3f003a625159217eddedeaa02c999f76f351525e (diff)
Added TFileUpload and TJavascriptLogger tutorials.
-rw-r--r--.gitattributes2
-rw-r--r--demos/quickstart/protected/pages/Controls/FileUpload.page19
-rw-r--r--demos/quickstart/protected/pages/Controls/JavascriptLogger.page25
-rw-r--r--demos/quickstart/protected/pages/Controls/Samples/TFileUpload/Home.page17
-rw-r--r--demos/quickstart/protected/pages/Controls/Samples/TFileUpload/Home.php21
-rw-r--r--demos/quickstart/protected/pages/Controls/Standard.page4
-rw-r--r--framework/Web/UI/WebControls/TFileUpload.php9
7 files changed, 90 insertions, 7 deletions
diff --git a/.gitattributes b/.gitattributes
index 434deaeb..151ab523 100644
--- a/.gitattributes
+++ b/.gitattributes
@@ -190,6 +190,8 @@ demos/quickstart/protected/pages/Controls/Samples/TDropDownList/Home.php -text
demos/quickstart/protected/pages/Controls/Samples/TEmailAddressValidator/Home.page -text
demos/quickstart/protected/pages/Controls/Samples/TEmailAddressValidator/Home.php -text
demos/quickstart/protected/pages/Controls/Samples/TExpression/Home.page -text
+demos/quickstart/protected/pages/Controls/Samples/TFileUpload/Home.page -text
+demos/quickstart/protected/pages/Controls/Samples/TFileUpload/Home.php -text
demos/quickstart/protected/pages/Controls/Samples/THtmlArea/Home.page -text
demos/quickstart/protected/pages/Controls/Samples/THtmlArea/Home.php -text
demos/quickstart/protected/pages/Controls/Samples/THyperLink/Home.page -text
diff --git a/demos/quickstart/protected/pages/Controls/FileUpload.page b/demos/quickstart/protected/pages/Controls/FileUpload.page
index 873d4bc7..8aa5a0fb 100644
--- a/demos/quickstart/protected/pages/Controls/FileUpload.page
+++ b/demos/quickstart/protected/pages/Controls/FileUpload.page
@@ -4,7 +4,24 @@
<com:DocLink ClassPath="System.Web.UI.WebControls.TFileUpload" />
<p>
-TBD
+<tt>TFileUpload</tt> displays a file upload field on a Web page. Upon postback, the text entered into the field will be treated as the (local) name of the file that is uploaded to the server.
</p>
+<p>
+<tt>TFileUpload</tt> raises an <tt>OnFileUpload</tt> event when it is post back. The property <tt>HasFile</tt> indicates whether the file upload is successful or not. If successful, the uploaded file may be saved on the server by calling <tt>saveAs()</tt> method.
+</p>
+<p>
+The following properties give the information about the uploaded file:
+</p>
+<ul>
+ <li><tt>FileName</tt> - the original client-side file name without directory information.</li>
+ <li><tt>FileType</tt> - the MIME type of the uploaded file.</li>
+ <li><tt>FileSize</tt> - the file size in bytes.</li>
+ <li><tt>LocalName</tt> - the absolute file path of the uploaded file on the server. Note, this file will be deleted after the current page request is completed. Call <tt>saveAs()</tt> to save the uploaded file.</li>
+</ul>
+<p>
+If the file upload is unsuccessful, the property <tt>ErrorCode</tt> gives the error code describing the cause of failure. See <a href="http://www.php.net/manual/en/features.file-upload.errors.php">PHP documentation</a> for a complete explanation of the possible error codes.
+</p>
+
+<com:RunBar PagePath="Controls.Samples.TFileUpload.Home" />
</com:TContent> \ No newline at end of file
diff --git a/demos/quickstart/protected/pages/Controls/JavascriptLogger.page b/demos/quickstart/protected/pages/Controls/JavascriptLogger.page
index 8b3c63c8..cff2b7aa 100644
--- a/demos/quickstart/protected/pages/Controls/JavascriptLogger.page
+++ b/demos/quickstart/protected/pages/Controls/JavascriptLogger.page
@@ -3,4 +3,29 @@
<h1>TJavascriptLogger</h1>
<com:DocLink ClassPath="System.Web.UI.WebControls.TJavascriptLogger" />
+<p>
+<tt>TJavascriptLogger</tt> provides logging for client-side javascript. It is mainly a wrapper of the javascript developed at <a href="http://gleepglop.com/javascripts/logger/">http://gleepglop.com/javascripts/logger/</a>.
+</p>
+
+<p>
+To use <tt>TJavascriptLogger</tt>, simply place the following component tag in a page template.
+</p>
+<com:TTextHighlighter Language="prado" CssClass="source">
+&lt;com:TJavascriptLogger /&gt;
+</com:TTextHighlighter>
+
+<p>
+Then, the client-side javascript may contain the following statements. When they are executed, they will appear in the logger window.
+</p>
+<com:TTextHighlighter Language="js" CssClass="source">
+Logger.info('something happend');
+Logger.warn('A warning');
+Logger.error('This is an error');
+Logger.debug('debug information');
+</com:TTextHighlighter>
+
+<p>
+To toggle the visibility of the logger and console on the browser window, press ALT-D (or CTRL-D on OS X).
+</p>
+
</com:TContent> \ No newline at end of file
diff --git a/demos/quickstart/protected/pages/Controls/Samples/TFileUpload/Home.page b/demos/quickstart/protected/pages/Controls/Samples/TFileUpload/Home.page
new file mode 100644
index 00000000..30168e1a
--- /dev/null
+++ b/demos/quickstart/protected/pages/Controls/Samples/TFileUpload/Home.page
@@ -0,0 +1,17 @@
+<com:TContent ID="body">
+
+<h1>TFileUpload Sample</h1>
+
+<p>
+Please choose a file to upload:
+</p>
+
+<com:TFileUpload OnFileUpload="fileUploaded" />
+
+<com:TButton Text="Upload" />
+
+<br/>
+
+<com:TLabel ID="Result" />
+
+</com:TContent> \ No newline at end of file
diff --git a/demos/quickstart/protected/pages/Controls/Samples/TFileUpload/Home.php b/demos/quickstart/protected/pages/Controls/Samples/TFileUpload/Home.php
new file mode 100644
index 00000000..d5cf990a
--- /dev/null
+++ b/demos/quickstart/protected/pages/Controls/Samples/TFileUpload/Home.php
@@ -0,0 +1,21 @@
+<?php
+
+class Home extends TPage
+{
+ public function fileUploaded($sender,$param)
+ {
+ if($sender->HasFile)
+ {
+ $this->Result->Text="
+ You just uploaded a file:
+ <br/>
+ Name: {$sender->FileName}
+ <br/>
+ Size: {$sender->FileSize}
+ <br/>
+ Type: {$sender->FileType}";
+ }
+ }
+}
+
+?> \ No newline at end of file
diff --git a/demos/quickstart/protected/pages/Controls/Standard.page b/demos/quickstart/protected/pages/Controls/Standard.page
index af4d6877..9580a0d7 100644
--- a/demos/quickstart/protected/pages/Controls/Standard.page
+++ b/demos/quickstart/protected/pages/Controls/Standard.page
@@ -23,7 +23,7 @@
<a href="?page=Controls.Expression">TExpression</a> accepts a PHP expression and displays the evaluation result on a Web page.
</li>
- <li>*
+ <li>
<a href="?page=Controls.FileUpload">TFileUpload</a> represents a file upload field. It allows users to upload a file to server.
</li>
@@ -59,7 +59,7 @@
<a href="?page=Controls.InlineFrame">TInlineFrame</a> represents an &lt;iframe&gt; HTML element on a Web page.
</li>
- <li>*
+ <li>
<a href="?page=Controls.JavascriptLogger">TJavascriptLogger</a> represents a logger on a Web page that can log various JavaScript information.
</li>
diff --git a/framework/Web/UI/WebControls/TFileUpload.php b/framework/Web/UI/WebControls/TFileUpload.php
index ebb1b5ae..41ffaa7f 100644
--- a/framework/Web/UI/WebControls/TFileUpload.php
+++ b/framework/Web/UI/WebControls/TFileUpload.php
@@ -18,10 +18,11 @@
* that will be uploaded to the server. The property {@link getHasFile HasFile}
* indicates whether the file upload is successful. If successful, the file
* may be obtained by calling {@link saveAs} to save it at a specified place.
- * You can use {@link getFileName}, {@link getFileType}, {@link getFileSize}
- * to get the original client-side file name, the file mime type, and the
- * file size information. If the upload is not successful, {@link getErrorCode ErrorCode}
- * contains the error code describing the cause of failure.
+ * You can use {@link getFileName FileName}, {@link getFileType FileType},
+ * {@link getFileSize FileSize} to get the original client-side file name,
+ * the file mime type, and the file size information. If the upload is not
+ * successful, {@link getErrorCode ErrorCode} contains the error code
+ * describing the cause of failure.
*
* TFileUpload raises {@link onFileUpload OnFileUpload} event if a file is uploaded
* (whether it succeeds or not).