summaryrefslogtreecommitdiff
path: root/framework/Web/UI/TClientScriptManager.php
diff options
context:
space:
mode:
authorxue <>2005-12-07 03:31:08 +0000
committerxue <>2005-12-07 03:31:08 +0000
commitd2f675e58b1c42c8960907ee20490a391aec0ecc (patch)
treeec37e7019b5ea261b4dde1ac88b2dacbd0675905 /framework/Web/UI/TClientScriptManager.php
parentbd56fe6028fc09d8121f353ac7e33fc11994de9b (diff)
Diffstat (limited to 'framework/Web/UI/TClientScriptManager.php')
-rw-r--r--framework/Web/UI/TClientScriptManager.php37
1 files changed, 20 insertions, 17 deletions
diff --git a/framework/Web/UI/TClientScriptManager.php b/framework/Web/UI/TClientScriptManager.php
index ace11064..c42e664d 100644
--- a/framework/Web/UI/TClientScriptManager.php
+++ b/framework/Web/UI/TClientScriptManager.php
@@ -119,7 +119,7 @@ class TClientScriptManager extends TComponent
$opt.='"'.$options->getValidationGroup().'",';
}
else
- $opt.='"",';
+ $opt.='\'\',';
if($options->getActionUrl()!=='')
{
$flag=true;
@@ -139,10 +139,10 @@ class TClientScriptManager extends TComponent
if($options->getClientSubmit())
{
$flag=true;
- $opt.='true)';
+ $opt.='true';
}
else
- $opt.='false)';
+ $opt.='false';
if(!$flag)
return '';
$this->registerPostBackScript();
@@ -153,25 +153,28 @@ class TClientScriptManager extends TComponent
return $javascriptPrefix?'javascript:'.$postback:$postback;
}
- protected function registerPostBackScript()
+ public function registerPradoScript($scriptFile)
{
- if(!$this->_postBackScriptRegistered)
+ if(isset($this->_publishedScriptFiles[$scriptFile]))
+ $url=$this->_publishedScriptFiles[$scriptFile];
+ else
{
- $this->_postBackScriptRegistered=true;
- $this->registerHiddenField(TPage::FIELD_POSTBACK_TARGET,'');
- $this->registerHiddenField(TPage::FIELD_POSTBACK_PARAMETER,'');
- $this->registerScriptInclude('prado:base',$this->publishScriptFile('base.js'));
+ $url=$this->_page->getService()->getAssetManager()->publishFilePath(Prado::getFrameworkPath().'/'.self::SCRIPT_DIR.'/'.$scriptFile);
+ $this->_publishedScriptFiles[$scriptFile]=$url;
+ $this->registerScriptInclude('prado:'.$scriptFile,$url);
}
+ return $url;
}
- private function publishScriptFile($jsFile)
+ protected function registerPostBackScript()
{
- if(!isset($this->_publishedScriptFiles[$jsFile]))
+ if(!$this->_postBackScriptRegistered)
{
- $am=$this->_page->getService()->getAssetManager();
- $this->_publishedScriptFiles[$jsFile]=$am->publishFilePath(Prado::getFrameworkPath().'/'.self::SCRIPT_DIR.'/'.$jsFile);
+ $this->_postBackScriptRegistered=true;
+ $this->registerHiddenField(TPage::FIELD_POSTBACK_TARGET,'');
+ $this->registerHiddenField(TPage::FIELD_POSTBACK_PARAMETER,'');
+ $this->registerPradoScript('base.js');
}
- return $this->_publishedScriptFiles[$jsFile];
}
public function registerFocusScript($target)
@@ -179,7 +182,7 @@ class TClientScriptManager extends TComponent
if(!$this->_focusScriptRegistered)
{
$this->_focusScriptRegistered=true;
- $this->registerScriptInclude('prado:base',$this->publishScriptFile('base.js'));
+ $this->registerPradoScript('base.js');
$this->registerEndScript('prado:focus','Prado.Focus.setFocus("'.THttpUtility::quoteJavaScriptString($target).'");');
}
}
@@ -197,8 +200,8 @@ class TClientScriptManager extends TComponent
public function registerDefaultButtonScript($button)
{
- $this->registerScriptInclude('prado:base',$this->publishScriptFile('base.js'));
- return 'return Prado.DefaultButton.fire(event,\''.$button->getClientID().'\')';
+ $this->registerPradoScript('base.js');
+ return 'return Prado.Button.fireButton(event,\''.$button->getClientID().'\')';
}
public function registerValidationScript()