From 39446f979b52dd0acd75d5d243f352397a0410f6 Mon Sep 17 00:00:00 2001
From: wei <>
Date: Sat, 7 Apr 2007 10:35:16 +0000
Subject: add TClientScriptLoader quickstart docs.
---
.../protected/pages/Advanced/Scripts3.page | 64 ++++++++++-
.../protected/pages/Controls/ClientScript.page | 9 +-
.../pages/Controls/ClientScriptLoader.page | 123 +++++++++++++++++++++
.../protected/pages/Controls/Standard.page | 4 +
.../protected/pages/Database/ActiveRecord.page | 1 +
demos/quickstart/protected/pages/Database/DAO.page | 1 +
.../protected/pages/Database/Scaffold.page | 1 +
.../protected/pages/Database/SqlMap.page | 1 +
.../protected/pages/Tutorial/AjaxChat.page | 1 +
.../pages/Tutorial/CurrencyConverter.page | 3 +
10 files changed, 202 insertions(+), 6 deletions(-)
create mode 100644 demos/quickstart/protected/pages/Controls/ClientScriptLoader.page
(limited to 'demos/quickstart/protected/pages')
diff --git a/demos/quickstart/protected/pages/Advanced/Scripts3.page b/demos/quickstart/protected/pages/Advanced/Scripts3.page
index d535d170..86e8bab9 100644
--- a/demos/quickstart/protected/pages/Advanced/Scripts3.page
+++ b/demos/quickstart/protected/pages/Advanced/Scripts3.page
@@ -1,9 +1,14 @@
The javascript libraries distributed with Prado can be found in the
+framework/Web/Javascripts/source directory. The packages.php
+file in that directory defines a list of available package names available
+to be loaded. They can be loaded as follows.
+ The dependencies for each library are automatically resolved. Components
that require a particular library will also automatically load the necessary libraries.
-For example, if you add a TDatePicker component on the page, the datepicker
+For example, if you add a TDatePicker component on the page, the datepicker
and its dependencies will be automatically included on the page. See TClientScript for options of adding
your custom Javascript code to the page. Use TClientScriptLoader to publish and combine multiple existing javascript files (e.g. javascript libraries distributed with Prado or otherwise)
+as packages.Javascript in PRADO, Questions and Answers
-How do I include the predefined Javascript libraries?
+How do I include the Javascript libraries distributed with Prado?
+Publishing Javascript Libraries as Assets
+
The dependencies for each library are automatically resolved. That is, +
+Many of the libraries, such as validator and datepicker will automatically +when controls that uses these libraries are visible on the page. For example, all the +validators +if they have their EnableClientScript set to true will include both the prado +and validator javascript libraries. +The dependencies for each library are automatically resolved. That is, specifying, say the "ajax", will also include the "prado" library.
+The TClientScriptLoader publish a collection of javascript files as assets. +For example, suppose we have a directory name "mylib" in +the protected/pages directory of our application.
+The PackagePath property can be an existing asset directory +or a namespace path to the directory containing javascript files. +For example, to publish the javascript files in the mylib +directory, we can specify the PackagePath as follows. +The first tag TClientScriptLoader relies on the asset template tag and +assumes that the page template containing the TClientScriptLoader tag instance +is in the protected/pages directory. +The second TClientScriptLoader tag uses the namespace notation to +specify the path. +
+ ++When the files in the PackagePath are published as assets, a script loader + php file "clientscripts.php" is automatically copied + to that asset directory. + The script loader, combines multiple javascript files and serve up as gzip if possible. +
++Allowable scripts and script dependencies can be grouped by using a "packages.php" file +with the following format. This "packages.php" is optional, if absent the file names +without ".js" extension are used. The "packages.php" must be in the directory given by +PackagePath. +
+ +The first element of the array returned by the packages.php should +contain an array of javascripts files relative to the packages.php +that corresponds to a particular grouping. For example, in the above packages.php, +the grouping 'package1' combines two javascript files, namely, 'file1.js' +and 'file2.js'. +
+ +The second element of the array returned by the packages.php should +contain an array of grouping dependencies ordered in the way that the groups should be combined. +For example, grouping 'package1' only depends on the 'package1' grouping files +(i.e. 'file1.js' and 'file2.js'). While 'package2' depends +on both 'package1' and 'package2' groupings. That is, 'package2' +will combine, in order, 'file1.js', 'file2.js', 'file3.js', and 'file4.js'. +
+ +To load a particular javascript file or package, set the PackageScripts +property with value 'package1' to load the 'package1' scripts. +A maximum of 25 packages separated by commas is allowed. +Dependencies of the packages are automatically resolved by the script loader php file. +
+ +Each <com:TClientScriptLoader> generates an HTML <script> +element to load the required javascript files.
+ +The DebugMode property when false +removes comments and white spaces from the published javascript files. If +the DebugMode property is not set, the debug mode is determined from the +application mode. +
++The EnableGzip property (default is true) enables the +published javascripts to be served as zipped if the browser and php server allows it. +
+Active Records are objects that wrap a row in a database table or view,
encapsulates the database access and adds domain logic on that data.
The basics of an Active Record is a business object class, e.g., a
diff --git a/demos/quickstart/protected/pages/Database/DAO.page b/demos/quickstart/protected/pages/Database/DAO.page
index ab522090..f7b969a2 100644
--- a/demos/quickstart/protected/pages/Database/DAO.page
+++ b/demos/quickstart/protected/pages/Database/DAO.page
@@ -1,6 +1,7 @@
Data Access Objects (DAO) separates a data resource's client interface from its data access mechanisms. It adapts a specific data resource's access API to a generic client interface. As a result, data access mechanisms can be changed independently of the code that uses the data.
Active Record classes can be used together with
Data Mappers moves data between objects and a database while keeping them
independent of each other and the mapper itself. If you started with
Active Records, you may eventually
diff --git a/demos/quickstart/protected/pages/Tutorial/AjaxChat.page b/demos/quickstart/protected/pages/Tutorial/AjaxChat.page
index 4e40b33a..b4784116 100644
--- a/demos/quickstart/protected/pages/Tutorial/AjaxChat.page
+++ b/demos/quickstart/protected/pages/Tutorial/AjaxChat.page
@@ -1,5 +1,6 @@
This tutorial introduces the Prado web application framework's
ActiveRecord
and Active Controls to build a Chat
diff --git a/demos/quickstart/protected/pages/Tutorial/CurrencyConverter.page b/demos/quickstart/protected/pages/Tutorial/CurrencyConverter.page
index 7f552ae1..43e3bfe5 100644
--- a/demos/quickstart/protected/pages/Tutorial/CurrencyConverter.page
+++ b/demos/quickstart/protected/pages/Tutorial/CurrencyConverter.page
@@ -298,6 +298,9 @@ public function convert_clicked($sender, $param)
In this simple application we may further improve the user experience
by increasing the responsiveness of the application. One way to achieve
a faster response is calculate and present the results without reloading
--
cgit v1.2.3
Data Access Objects (DAO)
+Active Record Scaffold Views
+Data Mapper
+Building an AJAX Chat Application
+ Improve User Experience With Active Controls
+
+