diff options
author | ctrlaltca <ctrlaltca@gmail.com> | 2014-04-12 09:28:04 +0200 |
---|---|---|
committer | ctrlaltca <ctrlaltca@gmail.com> | 2014-04-12 09:28:04 +0200 |
commit | f2eea0f9210a61a1a8944bbf58afcef809a9c5b1 (patch) | |
tree | 03d85e5813d248d66867ab8d4bdb0a0c75a6b92a | |
parent | 3fd4d5524cdfdc85a0f48671b14629053f7593f0 (diff) | |
parent | 67df5f61adc904798056a8281e17da7e52fcd5cb (diff) |
Merge pull request #517 from gnits/master
Recaptcha jQuery fix & TXmlDocument adjustment
-rw-r--r-- | framework/Web/UI/WebControls/TReCaptcha.php | 6 | ||||
-rw-r--r-- | framework/Web/UI/WebControls/TReCaptchaValidator.php | 7 | ||||
-rw-r--r-- | framework/Xml/TXmlDocument.php | 2 |
3 files changed, 7 insertions, 8 deletions
diff --git a/framework/Web/UI/WebControls/TReCaptcha.php b/framework/Web/UI/WebControls/TReCaptcha.php index 31fcf1ca..a5a360c3 100644 --- a/framework/Web/UI/WebControls/TReCaptcha.php +++ b/framework/Web/UI/WebControls/TReCaptcha.php @@ -227,7 +227,7 @@ class TReCaptcha extends TWebControl implements IValidatable public function renderContents($writer) { - $readyscript = 'Event.fire(document, '.TJavaScript::quoteString('captchaready:'.$this->getClientID()).')'; + $readyscript = 'jQuery(document).trigger('.TJavaScript::quoteString('captchaready:'.$this->getClientID()).')'; $cs = $this->Page->ClientScript; $id = $this->getClientID(); $divid = $id.'_1_recaptchadiv'; @@ -250,7 +250,7 @@ class TReCaptcha extends TWebControl implements IValidatable */ $writer->write($html); - $cs->registerEndScript('ReCaptcha::EventScript', 'Event.observe(document, "dom:loaded", function() { '.$readyscript.'; } );'); + $cs->registerEndScript('ReCaptcha::EventScript', 'jQuery(document).ready(function() { '.$readyscript.'; } );'); } else { @@ -258,7 +258,7 @@ class TReCaptcha extends TWebControl implements IValidatable $options['callback'] = new TJavaScriptLiteral('function() { '.$readyscript.'; '.$this->getCallbackScript().'; }'); $cs->registerScriptFile('ReCaptcha::AjaxScript', 'http://www.google.com/recaptcha/api/js/recaptcha_ajax.js'); $cs->registerEndScript('ReCaptcha::CreateScript::'.$id, implode(' ', array( - 'if (!$('.TJavaScript::quoteString($this->getResponseFieldName()).'))', + 'if (!jQuery('.TJavaScript::quoteString('#'.$this->getResponseFieldName()).'))', '{', 'Recaptcha.destroy();', 'Recaptcha.create(', diff --git a/framework/Web/UI/WebControls/TReCaptchaValidator.php b/framework/Web/UI/WebControls/TReCaptchaValidator.php index bba356b8..e25d0f84 100644 --- a/framework/Web/UI/WebControls/TReCaptchaValidator.php +++ b/framework/Web/UI/WebControls/TReCaptchaValidator.php @@ -116,8 +116,7 @@ class TReCaptchaValidator extends TBaseValidator // this function will be used to update the validator 'function '.$fn.'(valid)', '{', - ' var v = $('.TJavaScript::quoteString($this->getClientID()).');', - ' $('.TJavaScript::quoteString($this->getClientID().'_1').').value = valid;', + ' jQuery('.TJavaScript::quoteString('#'.$this->getClientID().'_1').').val(valid);', ' Prado.Validation.validateControl('.TJavaScript::quoteString($control->ClientID).'); ', '}', '', @@ -126,9 +125,9 @@ class TReCaptchaValidator extends TBaseValidator $this->Page->IsCallback ? $fn.'('.$value.');' : '', '', // wait for the captcha to be constructed - 'Event.observe(document,"captchaready:'.$control->getClientID().'",function() { ', + 'jQuery(document).on("captchaready:'.$control->getClientID().'",function() { ', // install event handler that clears the validation error when user changes the captcha response field - 'Event.observe('.TJavaScript::quoteString($control->getResponseFieldName()).',"keyup",function() { ', + 'jQuery('.TJavaScript::quoteString('#'.$control->getResponseFieldName()).').on("keyup",function() { ', $fn.'("1");', '});', '});', diff --git a/framework/Xml/TXmlDocument.php b/framework/Xml/TXmlDocument.php index 74e971bb..69017660 100644 --- a/framework/Xml/TXmlDocument.php +++ b/framework/Xml/TXmlDocument.php @@ -475,7 +475,7 @@ class TXmlDocument extends TXmlElement * @param DOMXmlNode the node to be converted * @return TXmlElement the converted TXmlElement */ - private function buildElement($node) + protected function buildElement($node) { $element=new TXmlElement($node->tagName); $element->setValue($node->nodeValue); |