From f826b0ae6b8f11f8da1a5a6251e9a1fe6e6c1e85 Mon Sep 17 00:00:00 2001 From: xue <> Date: Sun, 2 Apr 2006 01:48:18 +0000 Subject: Added TFileUpload and TJavascriptLogger tutorials. --- .gitattributes | 2 ++ .../protected/pages/Controls/FileUpload.page | 19 +++++++++++++++- .../protected/pages/Controls/JavascriptLogger.page | 25 ++++++++++++++++++++++ .../pages/Controls/Samples/TFileUpload/Home.page | 17 +++++++++++++++ .../pages/Controls/Samples/TFileUpload/Home.php | 21 ++++++++++++++++++ .../protected/pages/Controls/Standard.page | 4 ++-- framework/Web/UI/WebControls/TFileUpload.php | 9 ++++---- 7 files changed, 90 insertions(+), 7 deletions(-) create mode 100644 demos/quickstart/protected/pages/Controls/Samples/TFileUpload/Home.page create mode 100644 demos/quickstart/protected/pages/Controls/Samples/TFileUpload/Home.php 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 @@

-TBD +TFileUpload 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.

+

+TFileUpload raises an OnFileUpload event when it is post back. The property HasFile indicates whether the file upload is successful or not. If successful, the uploaded file may be saved on the server by calling saveAs() method. +

+

+The following properties give the information about the uploaded file: +

+ +

+If the file upload is unsuccessful, the property ErrorCode gives the error code describing the cause of failure. See PHP documentation for a complete explanation of the possible error codes. +

+ + \ 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 @@

TJavascriptLogger

+

+TJavascriptLogger provides logging for client-side javascript. It is mainly a wrapper of the javascript developed at http://gleepglop.com/javascripts/logger/. +

+ +

+To use TJavascriptLogger, simply place the following component tag in a page template. +

+ +<com:TJavascriptLogger /> + + +

+Then, the client-side javascript may contain the following statements. When they are executed, they will appear in the logger window. +

+ +Logger.info('something happend'); +Logger.warn('A warning'); +Logger.error('This is an error'); +Logger.debug('debug information'); + + +

+To toggle the visibility of the logger and console on the browser window, press ALT-D (or CTRL-D on OS X). +

+ \ 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 @@ + + +

TFileUpload Sample

+ +

+Please choose a file to upload: +

+ + + + + +
+ + + +
\ 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 @@ +HasFile) + { + $this->Result->Text=" + You just uploaded a file: +
+ Name: {$sender->FileName} +
+ Size: {$sender->FileSize} +
+ 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 @@ TExpression accepts a PHP expression and displays the evaluation result on a Web page. -
  • * +
  • TFileUpload represents a file upload field. It allows users to upload a file to server.
  • @@ -59,7 +59,7 @@ TInlineFrame represents an <iframe> HTML element on a Web page. -
  • * +
  • TJavascriptLogger represents a logger on a Web page that can log various JavaScript information.
  • 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). -- cgit v1.2.3