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/Controls/ClientScript.page | 9 +- .../pages/Controls/ClientScriptLoader.page | 123 +++++++++++++++++++++ .../protected/pages/Controls/Standard.page | 4 + 3 files changed, 134 insertions(+), 2 deletions(-) create mode 100644 demos/quickstart/protected/pages/Controls/ClientScriptLoader.page (limited to 'demos/quickstart/protected/pages/Controls') diff --git a/demos/quickstart/protected/pages/Controls/ClientScript.page b/demos/quickstart/protected/pages/Controls/ClientScript.page index 02f83526..5be3863c 100644 --- a/demos/quickstart/protected/pages/Controls/ClientScript.page +++ b/demos/quickstart/protected/pages/Controls/ClientScript.page @@ -25,10 +25,15 @@ to include on the page. For following example will include the "ajax" and "effec
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. +
+