2008年12月3日星期三

Re: [fw-mvc] Help Dojo tabContainer

Matthew Weier O'Phinney-3 wrote:
>
> -- barry hembree <gbhembree@comcast.net> wrote
> (on Tuesday, 02 December 2008, 07:25 AM -0800):
>> I don't know if this is a Dojo question or a ZF question or both. I have
>> a
>> page with some tabContainers. One of them is to display an account page.
>> It
>> is defined as follows:
>>
>> <? $this->contentPane()->captureStart('account', array('title' => 'My
>> Account',
>> 'preload' => false,
>> 'href' => $this->url(
>> array(
>> 'controller'=>'account',
>> 'action'=>'index')
>> ),
>> 'class' => 'account-tab')) ?>
>>
>> <?= $this->contentPane()->captureEnd('account') ?>
>
> Since you're defining a ContentPane that will be remoting, there's no
> reason to use capturing here; just echo it out. Modify the above to:
>
> <?= $this->contentPane(
> 'account',
> '',
> array(
> 'title' => 'My Account',
> 'preload' => false,
> 'href' => $this->url(array(
> 'controller' =>'account',
> 'action' =>'index'
> )),
> 'class' => 'account-tab'
> )
> ) ?>
>
>
>> When I select this tab I acces the indexAction of the Account controller.
>> If
>> the user is logged in, I display their account summary in this tab. If
>> they
>> are not logged in I want to display a login page but not in the
>> tabContainer. I would like to re-paint the page with a different layout.
>> I've tried several diiferent things but none of them work. Does anyone
>> have
>> any ideas?
>
> This *is* more of a Dojo than a ZF question. :)
>
> In your tab payload, I'd suggest adding something like this:
>
> <script type="dojo/event" event="onload">
> foo.showLoginDialog();
> </script?
>
> Then, in the JS you load for the original page, define a
> foo.showLoginDialog() function (I namespaced with "foo" -- you can drop
> the namespace, or use something more descriptive to your project). That
> function should create a dijit.Dialog that presents the login form. This
> is probably the easiest way to achieve what you want. Another
> possibility is to use BorderContainer for your application layout, and
> tell the main ContentPane to load from a new URL, which is also a very
> simple solution.
>
> --
> Matthew Weier O'Phinney
> Software Architect | matthew@zend.com
> Zend Framework | http://framework.zend.com/
>
>
Thanks Matthew,

The latter solution sounds like the way I would like to go. I have a
BorderContainer for my main layout that looks like this:

<? $this->borderContainer()->captureStart('layout', array('design' =>
'headline')) ?>
<?= $this->render('_headline.phtml') ?>
<?= $this->render('_mainPane.phtml') ?>
<?= $this->render('_sidebar.phtml') ?>
<?= $this->render('_footer.phtml') ?>
<?= $this->borderContainer()->captureEnd('layout') ?>

The _mainPane script is also quite simple:

<? $this->contentPane()->captureStart('mainPane', array('region' =>
'center'))?>
<?= $this->layout()->content ?>
<?= $this->contentPane()->captureEnd('mainPane') ?>

How would I modify this to do what you suggest?

I guess my real question is, if I select any links or buttons inside a
tabContainer, I get control of the view and the route and can do as I
please. If I select the tab, however, I don't seem to get control. It
executes what i tell it to and brings it back to the tabContainer. That, of
course, is the way I want it to behave most of the time but not always. Is
there any way to have it give back control of the view?

Barry

--
View this message in context: http://www.nabble.com/Help-Dojo-tabContainer-tp20794184p20814981.html
Sent from the Zend MVC mailing list archive at Nabble.com.

没有评论: