summaryrefslogtreecommitdiff
path: root/framework
diff options
context:
space:
mode:
authorwei <>2006-01-16 05:24:58 +0000
committerwei <>2006-01-16 05:24:58 +0000
commit6da2f379b1b4ddd0c27db2185ca7408b43a9a97a (patch)
tree22bf32c844fa78987c1c37ff2ff9d328156dfd29 /framework
parent443d8a9de12f1feb7bc6a3275ad3e09cb6e28640 (diff)
Diffstat (limited to 'framework')
-rw-r--r--framework/Web/Javascripts/extended/event.js2
-rw-r--r--framework/Web/UI/TClientScriptManager.php10
-rw-r--r--framework/Web/UI/WebControls/TPanel.php6
3 files changed, 11 insertions, 7 deletions
diff --git a/framework/Web/Javascripts/extended/event.js b/framework/Web/Javascripts/extended/event.js
index 4a35ba78..dd72d60e 100644
--- a/framework/Web/Javascripts/extended/event.js
+++ b/framework/Web/Javascripts/extended/event.js
@@ -16,7 +16,7 @@ Object.extend(Event, {
if (name == 'keypress' &&
((navigator.appVersion.indexOf('AppleWebKit') > 0)
- || element.attachEvent))
+ || (element && element.attachEvent)))
name = 'keydown';
this._observeAndCache(element, name, observer, useCapture);
diff --git a/framework/Web/UI/TClientScriptManager.php b/framework/Web/UI/TClientScriptManager.php
index acbe7f20..c5b828dc 100644
--- a/framework/Web/UI/TClientScriptManager.php
+++ b/framework/Web/UI/TClientScriptManager.php
@@ -249,7 +249,7 @@ class TClientScriptManager extends TComponent
$this->_postBackScriptRegistered=true;
$this->registerHiddenField(TPage::FIELD_POSTBACK_TARGET,'');
$this->registerHiddenField(TPage::FIELD_POSTBACK_PARAMETER,'');
- $this->registerPradoScript('base');
+ $this->registerPradoScript('prado');
}
}
@@ -258,7 +258,7 @@ class TClientScriptManager extends TComponent
if(!$this->_focusScriptRegistered)
{
$this->_focusScriptRegistered=true;
- $this->registerPradoScript('base');
+ $this->registerPradoScript('prado');
$this->registerEndScript('prado:focus','Prado.Focus.setFocus("'.THttpUtility::quoteJavaScriptString($target).'");');
}
}
@@ -274,10 +274,12 @@ class TClientScriptManager extends TComponent
}
}
- public function registerDefaultButtonScript($button)
+ public function registerDefaultButtonScript($source, $target)
{
$this->registerPradoScript('prado');
- return 'return Prado.Button.fireButton(event,\''.$button->getClientID().'\')';
+ $button = $target->getClientID();
+ $panel = $source->getClientID();
+ return "Event.observe('{$panel}', 'keypress', Prado.Button.fireButton.bindEvent($('{$panel}'), '$button'));";
}
public function registerValidationScript()
diff --git a/framework/Web/UI/WebControls/TPanel.php b/framework/Web/UI/WebControls/TPanel.php
index c7464c7c..5065aa61 100644
--- a/framework/Web/UI/WebControls/TPanel.php
+++ b/framework/Web/UI/WebControls/TPanel.php
@@ -72,8 +72,10 @@ class TPanel extends TWebControl
throw new TInvalidDataValueException('panel_defaultbutton_invalid',$butt);
else
{
- $onkeypress=$this->getPage()->getClientScript()->registerDefaultButtonScript($button);
- $writer->addAttribute('onkeypress',$onkeypress);
+ $scripts = $this->getPage()->getClientScript();
+ $js = $scripts->registerDefaultButtonScript($this,$button);
+ $scripts->registerEndScript($this->ClientID.'defaultButton', $js);
+ $writer->addAttribute('id',$this->getClientID());
}
}
}