2009年2月24日星期二

[fw-mvc] Re: Re[fw-mvc] captcha within a Contentpane

After lots of tries, I did find a work around for it but also discovered the
real problem.
First, the work around and starting from the point '$this->form'.
In my 'contact.phtml' ; '<?= $this->form ?> '
In my 'pane4.phtml; 'baseUrl()?>/specials/contact" type="text/html">'
Then in my 'index.phtml' (as a remember, contentPanePlus comes from
Dojox/ContentPane ); 'echo $this->contentPanePlus('wwi-pane4','',
array('title' => 'contact', 'class' => '', 'href' =>
$this->url(array('controller' => 'index', 'action' => 'pane4'), 'default',
true)));'
And that's working great =)

Then, the real problem.
To be honest, ZFW has nothing to do with it but... Okay here it is.
Dojox/ContentPane does execute javascript but only this way
'<script></script>' and not '<script type="text/javascript"></script>'. Now
the javascript generated from recaptcha is full of that, like this;
'.javascript .imp {font-weight: bold; color: red;}'. For to work in a
Dojox/ContentPane, it should be '.script .imp {font-weight: bold; color:
red;}'
So that's what the problem is :-/
For sure I did post that on the recaptcha and dojo forums!
Aad Pouw


aad pouw wrote:
>
> Hi Matthew,
>
> I took a few days off, to dig into this a bit further.
> First, running javascript in this contentpane isn't the point.
> Because my 'contentPanePlus' is derived from 'Dojox contentPane', it has
> the 'executeScripts: true' feature and as long as I use
> '<script></script>' tags I can run any javascript like
> '<script>alert('hello world');</script>' within my contentpanes.
> Then,
> At one of my tries it was look like that 'Dojo toString' is falling over
> 'public function __toString()' in 'zend/service/recaptcha.php'?
>
> I say 'was', because today I gave it a try without a contentpane but with
> 'dojo.io.script' and also with a pure 'javascript' script, without using
> 'zend/service/recaptcha.php' but the by using the files provided by
> recaptcha.net. The same results occured, no displaying.
> Then my idea now is that it isn't dojo but the 'recaptcha' service that is
> giving the problem? Any how, I've posted a message about this on there
> forum. As soon as I know more, I will post it here.
> Greetings,
> Aad Pouw
>
>
>
>
>
>
>
> Matthew Weier O'Phinney-3 wrote:
>>
>> -- aad pouw <aad.pouw@gmail.com> wrote
>> (on Sunday, 25 January 2009, 11:14 AM -0800):
>>> It's a bit crossover and therefore I will post it to some other forums
>>> too.
>>>
>>> Foreword,
>>> The contentpane I use for this, is a story on itself.
>>> It's a Dojox Contentpane that I, renamed to "contentPanePlus", adjusted,
>>> copied to the "Dijit/Layout" folder and made a helper for.
>>> It works very well, I've some js running and the 'tooltip' feature in
>>> one of
>>> the panes, I have it wrapped in a tabContainer.
>>> Like this;
>>> <?php $this->TabContainer()->captureStart('xxx', array('class' =>
>>> 'xx'))?>
>>> <?= $this->contentPanePlus('xxx','', array('title' => 'xxx', 'class' =>
>>> '',
>>> 'href' => $this->url(array('controller' => 'xxx', 'action' => 'xxx'),
>>> 'default', true)))?>
>>> <?= $this->TabContainer()->captureEnd('xxx')?>
>>>
>>> Now about of what it is doing not, and that is displaying my form with
>>> the
>>> recapcha service included.
>>> Summery:
>>> -> If I go straight to 'http://xxx.local/tabx' I get my form 'including
>>> the
>>> recaptcha, displayed perfectly.
>>> -> If I go to 'http://xxx.local' and click on tabx, the whole form won't
>>> displayed at all but the form itself is rendered. I can see that in
>>> firebug.
>>> -> If I use 'Figlet' or 'Image', the form will display all.
>>> -> If I comment recaptcha out or set 'executeScripts' => false, the
>>> form
>>> will display but without the recaptcha.
>>>
>>> After some digging this sunday, my idea is 'and I'm just a basic free
>>> time
>>> webdesigner, it's like the contentpane is stumbling over the
>>> Zend/Service/Recaptcha.php.
>>> Perhaps it are the javascript/html lines within the recaptcha.php, I
>>> just
>>> guess?
>>
>> That's exactly the issue. XHR is not allowed to directly execute
>> javascript -- and ContentPane, when you use the href property, is doing
>> an XHR call to the server to grab the content.
>>
>> There are ways around this. IIRC, dojox.layout.ContentPane has some
>> mechanisms for executing JS found within the content. Another way to do
>> it is to include a dojo/event script in the markup being included in the
>> content pane:
>>
>> <script type="dojo/event" event="onload">
>> // js for initializing the ReCaptcha goes here...
>> </script>
>>
>> This will, of course, take some of the ease-of-use of the ReCaptcha
>> adapter away, but it will make it usable in this fashion.
>>
>>> Then the question comes, what is coursing the problem? The
>>> 'recaptcha.php'
>>> or the 'contentpane'?
>>> I don't really know because the form is rendered but just not displayed.
>>>
>>> Any suggestions, ideas, solutions?
>>> Has someone a form with recaptcha running within a contentpane?
>>
>> --
>> Matthew Weier O'Phinney
>> Software Architect | matthew@zend.com
>> Zend Framework | http://framework.zend.com/
>>
>>
>
>

--
View this message in context: http://www.nabble.com/Recaptcha-within-a-Contentpane-tp21655512p22189880.html
Sent from the Zend MVC mailing list archive at Nabble.com.

没有评论: