summaryrefslogtreecommitdiff
path: root/framework/Web/UI/TClientScriptManager.php
diff options
context:
space:
mode:
authorwei <>2005-12-13 07:08:30 +0000
committerwei <>2005-12-13 07:08:30 +0000
commit35c7ff28cbc311fba5e394b11fb756a4dc1edcb9 (patch)
tree1ee39944b4cdba1ecc6aeb2a952139b5a3165f67 /framework/Web/UI/TClientScriptManager.php
parent2c383b6050b3d8cc6ac7a9442c999cb903af43ab (diff)
Removed inline javascript from components. Adding TJavascriptLogger and logger.js
Diffstat (limited to 'framework/Web/UI/TClientScriptManager.php')
-rw-r--r--framework/Web/UI/TClientScriptManager.php20
1 files changed, 17 insertions, 3 deletions
diff --git a/framework/Web/UI/TClientScriptManager.php b/framework/Web/UI/TClientScriptManager.php
index ca28751f..6106cfbf 100644
--- a/framework/Web/UI/TClientScriptManager.php
+++ b/framework/Web/UI/TClientScriptManager.php
@@ -165,13 +165,17 @@ class TClientScriptManager extends TComponent
public function registerPradoScript($script)
{
- foreach(TPradoClientScript::getScript($script) as $scriptFile)
+ foreach(TPradoClientScript::getScripts($script) as $scriptFile)
{
if(isset($this->_publishedScriptFiles[$scriptFile]))
$url=$this->_publishedScriptFiles[$scriptFile];
else
{
- $url=$this->_page->getService()->getAssetManager()->publishFilePath(Prado::getFrameworkPath().'/'.self::SCRIPT_DIR.'/'.$scriptFile);
+ $base = Prado::getFrameworkPath();
+ $clientScripts = self::SCRIPT_DIR;
+ $file = "{$base}/{$clientScripts}/{$scriptFile}.js";
+ $assetManager = $this->_page->getService()->getAssetManager();
+ $url= $assetManager->publishFilePath($file);
$this->_publishedScriptFiles[$scriptFile]=$url;
$this->registerScriptFile('prado:'.$scriptFile,$url);
}
@@ -444,6 +448,16 @@ class TClientScriptManager extends TComponent
return count($this->_onSubmitStatements)>0;
}
+ public function registerClientEvent($control, $event, $code)
+ {
+ if(empty($code)) return;
+ $this->registerPradoScript("dom");
+ $script= "Event.observe('{$control->ClientID}', '{$event}', function(e){ {$code} });";
+ $key = "prado:{$control->ClientID}:{$event}";
+ $this->registerEndScript($key, $script);
+ }
+
+
/*
private void EnsureEventValidationFieldLoaded();
@@ -619,7 +633,7 @@ class TPradoClientScript
* @param array list of libraries to load.
* @return array list of libraries including its dependencies.
*/
- protected static function getScripts($scripts)
+ public static function getScripts($scripts)
{
$files = array();
if(!is_array($scripts)) $scripts = array($scripts);