summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--HISTORY1
-rw-r--r--framework/Web/UI/TClientScriptManager.php35
2 files changed, 32 insertions, 4 deletions
diff --git a/HISTORY b/HISTORY
index 6ef274b5..aa7105ad 100644
--- a/HISTORY
+++ b/HISTORY
@@ -3,6 +3,7 @@ BUG: URL wildcard patterns didn't work with subfolders
BUG: Issue#87 - TinyMCE : empty string disapears after encoding JS, that's a problem! (Christophe)
BUG: Issue#96 - THttpResponse::redirect don't send status code (Christophe)
BUG: Issue#107 - typo in TDbConnection::getCharset() (Christophe)
+CHG: Issue#7 - Clients Scripts are not combined anymore in Debug application mode (Christophe)
ENH: Issue#106 - TJavaScript::jsonEncode and TJavaScript::jsonDecode should use built-in PHP functions (Christophe)
ENH: Issue#115 - Registry for Prado generated clientside counterparts of serverside controls (Yves Berkholz)
ENH: Added caching of message files to TException (Michael)
diff --git a/framework/Web/UI/TClientScriptManager.php b/framework/Web/UI/TClientScriptManager.php
index f0eb6157..09e240c2 100644
--- a/framework/Web/UI/TClientScriptManager.php
+++ b/framework/Web/UI/TClientScriptManager.php
@@ -76,7 +76,12 @@ class TClientScriptManager extends TApplicationComponent
* @var array
*/
private static $_pradoScripts;
-
+ /**
+ * Client-side javascript library packages, loads from SCRIPT_PATH.'/packages.php';
+ * @var array
+ */
+ private static $_pradoPackages;
+
/**
* Constructor.
* @param TPage page that owns this client script manager
@@ -120,6 +125,7 @@ class TClientScriptManager extends TApplicationComponent
$packageFile = Prado::getFrameworkPath().DIRECTORY_SEPARATOR.self::SCRIPT_PATH.'/packages.php';
list($packages,$deps)= include($packageFile);
self::$_pradoScripts = $deps;
+ self::$_pradoPackages = $packages;
}
if(isset(self::$_pradoScripts[$name]))
@@ -147,9 +153,30 @@ class TClientScriptManager extends TApplicationComponent
{
if(($packages=array_keys($this->_registeredPradoScripts))!==array())
{
- $base = Prado::getFrameworkPath().DIRECTORY_SEPARATOR.self::SCRIPT_PATH;
- $url = $this->registerJavascriptPackages($base, $packages);
- $writer->write(TJavaScript::renderScriptFile($url));
+ if (Prado::getApplication()->getMode()!==TApplicationMode::Debug)
+ {
+ $base = Prado::getFrameworkPath().DIRECTORY_SEPARATOR.self::SCRIPT_PATH;
+ $url = $this->registerJavascriptPackages($base, $packages);
+ $writer->write(TJavaScript::renderScriptFile($url));
+ }
+ else
+ {
+ // In debug mode, we add 1 <script> line by file
+ $baseUrl=$this->getPradoScriptAssetUrl();
+ $packagesUrl=array();
+ foreach ($packages as $p)
+ {
+ foreach (self::$_pradoScripts[$p] as $dep)
+ {
+ foreach (self::$_pradoPackages[$dep] as $script)
+ {
+ if (!in_array($url=$baseUrl.'/'.$script,$packagesUrl))
+ $packagesUrl[]=$url;
+ }
+ }
+ }
+ $writer->write(TJavaScript::renderScriptFiles($packagesUrl));
+ }
}
}