diff options
-rw-r--r-- | .gitattributes | 1 | ||||
-rw-r--r-- | HISTORY | 1 | ||||
-rw-r--r-- | UPGRADE | 4 | ||||
-rw-r--r-- | demos/quickstart/protected/pages/Advanced/Scripts3.page | 66 | ||||
-rw-r--r-- | demos/quickstart/protected/pages/Advanced/es/Scripts3.page | 52 | ||||
-rw-r--r-- | demos/quickstart/protected/pages/Advanced/id/Scripts3.page | 49 | ||||
-rw-r--r-- | framework/Web/UI/WebControls/TClientScriptLoader.php | 170 |
7 files changed, 16 insertions, 327 deletions
diff --git a/.gitattributes b/.gitattributes index d517e514..bfd82010 100644 --- a/.gitattributes +++ b/.gitattributes @@ -2935,7 +2935,6 @@ framework/Web/UI/WebControls/TCheckBox.php -text framework/Web/UI/WebControls/TCheckBoxColumn.php -text framework/Web/UI/WebControls/TCheckBoxList.php -text framework/Web/UI/WebControls/TClientScript.php -text -framework/Web/UI/WebControls/TClientScriptLoader.php -text framework/Web/UI/WebControls/TColorPicker.php -text framework/Web/UI/WebControls/TCompareValidator.php -text framework/Web/UI/WebControls/TConditional.php -text @@ -34,6 +34,7 @@ BUG: Issue #361 - TActiveListBox multiple selection bug (ctrlaltca) BUG: Issue #366 - Use divs instead of spans around tables in TActiveDataGrid (ctrlaltca) BUG: Issue #365 - [Runtime Notice] Declaration of T${DriverName}MetaData::quoteTableName() should be compatible with that of TDbMetaData::quoteTableName() (Yves) BUG: Issue #367 - Parameterized RegularExpression property in UrlMapping raise TPhpErrorException in DOMDocument::loadXML() (Yves) +BUG: Issue #368 - Clearing selection of a TActiveDropDownList in callback should select its prompt (ctrlaltca) ENH: Performance (micro)optimization in TUrlMapping::loadUrlMappings - invoke `getDefaultMappingClass` outside of loop (Yves) Version 3.1.10 Jul 17, 2011 @@ -16,6 +16,10 @@ Upgrading from v3.1.x If you were relying (linking directly) to that script to get some js file, you'll need to re-adapt your scripts. Remember, linking directly a file in the assets/ directory is always a bad idea, let Prado do it for you using publishAssets(). +- The removal of clientscripts.php lead to the removal of TClientScriptManager::registerJavascriptPackages() + and the entire TClientScriptLoader class. These two were used to publish multiple javascript files at once + and to compress/minify them. While the compression is something that is probably better done at the + webserver/processor level, you can still get your scripts minified using TJavaScript::JSMin(); - Ticket #325 enabled pregressive rendering inside Prado. Previously, all the output of Prado was buffered and sent to the client all at once. Now, you decide to render smaller parts of the page and send them to client right after completed, one after the other (see TFlushOutput documentation). diff --git a/demos/quickstart/protected/pages/Advanced/Scripts3.page b/demos/quickstart/protected/pages/Advanced/Scripts3.page index 416df4f8..3f41abe1 100644 --- a/demos/quickstart/protected/pages/Advanced/Scripts3.page +++ b/demos/quickstart/protected/pages/Advanced/Scripts3.page @@ -24,8 +24,17 @@ The available packaged libraries included in Prado are <li><tt>ajax</tt> : ajax and callback related based on Prototype</li>
<li><tt>validator</tt> : validation</li>
<li><tt>logger</tt> : javascript logger and object browser</li>
- <li><tt>datepicker</tt> : datepicker</li>
- <li><tt>colorpicker</tt> : colorpicker</li>
+ <li><tt>datepicker</tt> : datepicker control</li>
+ <li><tt>colorpicker</tt> : colorpicker control</li>
+ <li><tt>dragdrop</tt> : basic support for "drag and drop" control</li>
+ <li><tt>dragdropextra</tt> : extra support for "drag and drop" controls</li>
+ <li><tt>slider</tt> : slider control</li>
+ <li><tt>keyboard</tt> : software keyboard control</li>
+ <li><tt>tabpanel</tt> : tabpanel control</li>
+ <li><tt>activedatepicker</tt> : ajax version of the datepicker control</li>
+ <li><tt>activefileupload</tt> : ajax version of the fileupload control</li>
+ <li><tt>accordion</tt> : accordion control</li>
+ <li><tt>htmlarea</tt> : tinymce control</li>
</ul>
<p id="850761" class="block-content">The dependencies for each library are automatically resolved. Components
@@ -35,57 +44,4 @@ and its dependencies will be automatically included on the page.</p> <p id="850762" class="block-content">See <a href="?page=Controls.ClientScript">TClientScript</a> for options of adding
your custom Javascript code to the page.</p>
-
-<h2 id="176028">Publishing Javascript Libraries as Assets</h2>
-<com:SinceVersion Version="3.1b" />
-<p class="block-content">Use <a href="?page=Controls.ClientScriptLoader">TClientScriptLoader</a> to publish and combine multiple existing javascript files (e.g. javascript libraries distributed with Prado or otherwise)
-as packages.</p> For greater control on what and when to publish, use the
-<tt>registerJavascriptPackages($base, $packages, $debug=null, $gzip=true)</tt>
-method in the <tt>TClientScriptManager</tt> class, which an instance can be obtained
-using <tt>$this->getPage()->getClientScript()</tt> or its equivalents.
-For example, if multiple controls will use the same set of javascript libraries,
-write a class to handle the registration of packages required by those controls.
-</p>
-<com:TTextHighlighter Language="php" CssClass="source block-content">
-class MyJavascriptLib extends TComponent
-{
- private $_packages=array(); //keep track of all registrations
-
- private $_manager;
-
- protected function __construct(TPage $owner)
- {
- $this->_manager = $owner->getClientScript();
- $owner->onPreRenderComplete = array($this, 'registerScriptLoader');
- }
-
- public static function registerPackage(TControl $control, $name)
- {
- static $instance;
- if($instance===null)
- $instance=new self($control->getPage());
- $instance->_packages[$name]=true;
- }
-
- protected function registerScriptLoader()
- {
- $dir = dirname(__FILE__).'/myscripts'; //contains my javascript files
- $scripts = array_keys($this->_packages);
- $url = $this->_manager->registerJavascriptPackages($dir, $scripts);
- $this->_manager->registerScriptFile($url,$url);
- }
-}
-
-// example control class using the javascript packages
-class TestComp extends TControl
-{
- public function onPreRender($param)
- {
- parent::onPreRender($param);
- MyJavascriptLib::registerPackage($this,'package1');
- }
-}
-</com:TTextHighlighter>
-
-
</com:TContent>
diff --git a/demos/quickstart/protected/pages/Advanced/es/Scripts3.page b/demos/quickstart/protected/pages/Advanced/es/Scripts3.page index 416df4f8..37885abb 100644 --- a/demos/quickstart/protected/pages/Advanced/es/Scripts3.page +++ b/demos/quickstart/protected/pages/Advanced/es/Scripts3.page @@ -36,56 +36,4 @@ and its dependencies will be automatically included on the page.</p> <p id="850762" class="block-content">See <a href="?page=Controls.ClientScript">TClientScript</a> for options of adding
your custom Javascript code to the page.</p>
-<h2 id="176028">Publishing Javascript Libraries as Assets</h2>
-<com:SinceVersion Version="3.1b" />
-<p class="block-content">Use <a href="?page=Controls.ClientScriptLoader">TClientScriptLoader</a> to publish and combine multiple existing javascript files (e.g. javascript libraries distributed with Prado or otherwise)
-as packages.</p> For greater control on what and when to publish, use the
-<tt>registerJavascriptPackages($base, $packages, $debug=null, $gzip=true)</tt>
-method in the <tt>TClientScriptManager</tt> class, which an instance can be obtained
-using <tt>$this->getPage()->getClientScript()</tt> or its equivalents.
-For example, if multiple controls will use the same set of javascript libraries,
-write a class to handle the registration of packages required by those controls.
-</p>
-<com:TTextHighlighter Language="php" CssClass="source block-content">
-class MyJavascriptLib extends TComponent
-{
- private $_packages=array(); //keep track of all registrations
-
- private $_manager;
-
- protected function __construct(TPage $owner)
- {
- $this->_manager = $owner->getClientScript();
- $owner->onPreRenderComplete = array($this, 'registerScriptLoader');
- }
-
- public static function registerPackage(TControl $control, $name)
- {
- static $instance;
- if($instance===null)
- $instance=new self($control->getPage());
- $instance->_packages[$name]=true;
- }
-
- protected function registerScriptLoader()
- {
- $dir = dirname(__FILE__).'/myscripts'; //contains my javascript files
- $scripts = array_keys($this->_packages);
- $url = $this->_manager->registerJavascriptPackages($dir, $scripts);
- $this->_manager->registerScriptFile($url,$url);
- }
-}
-
-// example control class using the javascript packages
-class TestComp extends TControl
-{
- public function onPreRender($param)
- {
- parent::onPreRender($param);
- MyJavascriptLib::registerPackage($this,'package1');
- }
-}
-</com:TTextHighlighter>
-
-
</com:TContent>
diff --git a/demos/quickstart/protected/pages/Advanced/id/Scripts3.page b/demos/quickstart/protected/pages/Advanced/id/Scripts3.page index d2ce269b..b313e7fc 100644 --- a/demos/quickstart/protected/pages/Advanced/id/Scripts3.page +++ b/demos/quickstart/protected/pages/Advanced/id/Scripts3.page @@ -32,53 +32,4 @@ Sebagai contoh, jika Anda menambah komponen <tt>TDatePicker</tt> pada halaman, < <p id="850762" class="block-content">Lihat <a href="?page=Controls.ClientScript">TClientScript</a> untuk opsi penambahan kode Javascript kustom Anda ke halaman.</p>
-<h2 id="176028">Menerbitkan Librari Javascript sebagai Assets</h2>
-<com:SinceVersion Version="3.1b" />
-<p class="block-content">Gunakan <a href="?page=Controls.ClientScriptLoader">TClientScriptLoader</a> untuk menerbitkan dan menggabung file javascript yang sudah ada (misalnya librari javascript yang didistribusikan dengan Prado atau sebaliknya) sebagai paket.</p> Untuk kontrol yang lebih besar pada apa dan kapan untuk menerbitkan, gunakan metode
-<tt>registerJavascriptPackages($base, $packages, $debug=null, $gzip=true)</tt>
-dalam kelas <tt>TClientScriptManager</tt>, yang turunannya bisa diperoleh dengan <tt>$this->getPage()->getClientScript()</tt> atau persamaannya.
-Sebagai contoh, jika multipel kontrol akan memakai set librari javascript yang sama, tulis sebuah kelas untuk menangani registrasi paket yang diperlukan oleh kontrol tersebut.
-</p>
-<com:TTextHighlighter Language="php" CssClass="source block-content">
-class MyJavascriptLib extends TComponent
-{
- private $_packages=array(); //perlihara seluruh registrasi
-
- private $_manager;
-
- protected function __construct(TPage $owner)
- {
- $this->_manager = $owner->getClientScript();
- $owner->onPreRenderComplete = array($this, 'registerScriptLoader');
- }
-
- public static function registerPackage(TControl $control, $name)
- {
- static $instance;
- if($instance===null)
- $instance=new self($control->getPage());
- $instance->_packages[$name]=true;
- }
-
- protected function registerScriptLoader()
- {
- $dir = dirname(__FILE__).'/myscripts'; //berisi file javascript
- $scripts = array_keys($this->_packages);
- $url = $this->_manager->registerJavascriptPackages($dir, $scripts);
- $this->_manager->registerScriptFile($url,$url);
- }
-}
-
-// contoh kelas kontrol menggunakan paket javascript
-class TestComp extends TControl
-{
- public function onPreRender($param)
- {
- parent::onPreRender($param);
- MyJavascriptLib::registerPackage($this,'package1');
- }
-}
-</com:TTextHighlighter>
-
-
</com:TContent>
diff --git a/framework/Web/UI/WebControls/TClientScriptLoader.php b/framework/Web/UI/WebControls/TClientScriptLoader.php deleted file mode 100644 index 11e677c2..00000000 --- a/framework/Web/UI/WebControls/TClientScriptLoader.php +++ /dev/null @@ -1,170 +0,0 @@ -<?php -/** - * TClientScriptLoader class file. - * - * @author Wei Zhuo <weizhuo[at]gmail[dot]com> - * @link http://www.pradosoft.com/ - * @copyright Copyright © 2005-2011 PradoSoft - * @license http://www.pradosoft.com/license/ - * @version $Id: TClientScriptLoader.php 1827 2007-04-02 06:19:55Z wei $ - * @package System.Web.UI.WebControls - */ - -/** - * The TClientScriptLoader publish a collection of javascript files as assets. - * The {@link PackagePath setPackagePath} property can be an existing asset directory - * or a namespace path to the directory containing javascript files. E.g. - * <code> - * <com:TClientScriptLoader PackagePath=<%~ mylib/js %> /> - * <com:TClientScriptLoader PackagePath="Application.myscripts" /> - * </code> - * - * When the files in the {@link PackagePath setPackagePath} are published as assets, a script loader - * php file corresponding to TClientScriptManager::SCRIPT_LOADER is also 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 specified in a "packages.php" file - * with the following format. This "packages.php" is optional, if absent the filenames - * without ".js" extension are used. The "packages.php" must be in the directory given by - * {@link PackagePath setPackagePath}. - * - * <code> - * <?php - * $packages = array( - * 'package1' => array('file1.js', 'file2.js'), - * 'package2' => array('file3.js', 'file4.js')); - * - * $deps = array( - * 'package1' => array('package1'), - * 'package2' => array('package1', 'package2')); //package2 requires package1 first. - * - * return array($packages,$deps); //must return $packages and $deps in an array - * </code> - * - * Set the {@link PackageScripts setPackageScripts} property with value 'package1' to serve - * up the 'package1' scripts. A maxium of 25 packages separated by commas is allowed. - * - * Dependencies of the packages are automatically resolved by the script loader php file. - * E.g. - * <code> - * <com:TClientScriptLoader PackagePath=<%~ mylib/js %> PackageScripts="package2" /> - * </code> - * - * The {@link setDebugMode DebugMode} property when false - * removes comments and whitespaces from the published javascript files. If - * the DebugMode property is not set, the debug mode is determined from the application mode. - * - * The {@link setEnableGzip EnableGzip} property (default is true) enables the - * published javascripts to be served as zipped if the browser and php server allows it. - * - * If the DebugMode is false either explicitly or when the application mode is non-debug, - * then cache headers are also sent to inform the browser and proxies to cache the file. - * Moreover, the post-processed (comments removed and zipped) are saved in the assets - * directory for the next requests. That is, in non-debug mode the scripts are cached - * in the assets directory until they are deleted. - * - * @author Wei Zhuo<weizhuo[at]gmail[dot]com> - * @version $Id$ - * @package System.Web.UI.WebControls - * @since 3.1 - */ -class TClientScriptLoader extends TWebControl -{ - /** - * @return string tag name of the script element - */ - protected function getTagName() - { - return 'script'; - } - - /** - * Adds attribute name-value pairs to renderer. - * This overrides the parent implementation with additional button specific attributes. - * @param THtmlWriter the writer used for the rendering purpose - */ - protected function addAttributesToRender($writer) - { - $writer->addAttribute('type','text/javascript'); - $writer->addAttribute('src',$this->getClientScriptUrl()); - parent::addAttributesToRender($writer); - } - - /** - * @return string clientscript.php url. - */ - protected function getClientScriptUrl() - { - $scripts = preg_split('/\s*[, ]+\s*/', $this->getPackageScripts()); - $cs = $this->getPage()->getClientScript(); - return $cs->registerJavascriptPackages($this->getPackagePath(), - $scripts, $this->getDebugMode(), $this->getEnableGzip()); - } - - /** - * @param string custom javascript library directory. - */ - public function setPackagePath($value) - { - $this->setViewState('PackagePath', $value); - } - - /** - * @return string custom javascript library directory. - */ - public function getPackagePath() - { - return $this->getViewState('PackagePath'); - } - - /** - * @param string load specific packages from the javascript library in the PackagePath, - * comma delimited package names. A maximum of 25 packages is allowed. - */ - public function setPackageScripts($value) - { - $this->setViewState('PackageScripts', $value,''); - } - - /** - * @return string comma delimited list of javascript library packages to load. - */ - public function getPackageScripts() - { - return $this->getViewState('PackageScripts',''); - } - - /** - * @param boolean enables gzip compression of the javascript. - */ - public function setEnableGzip($value) - { - $this->setViewState('EnableGzip', TPropertyValue::ensureBoolean($value), true); - } - - /** - * @return boolean enables gzip compression of the javascript if possible, default is true. - */ - public function getEnableGzip() - { - return $this->getViewState('EnableGzip', true); - } - - /** - * @return boolean javascript comments stripped in non-debug mode. - * Debug mode will depend on the application mode if null. - */ - public function getDebugMode() - { - return $this->getViewState('DebugMode'); - } - - /** - * @param boolean true to enable debug mode, default is null thus dependent on the application mode. - */ - public function setDebugMode($value) - { - $this->setViewState('DebugMode', TPropertyValue::ensureBoolean($value), null); - } -} - |