Nested Module Issue

15 views
Skip to first unread message

Brett

unread,
Jun 14, 2010, 3:56:04 PM6/14/10
to ColdBox Platform
I'm playing with nested modules and noticed that when you call a
module B from within module A, event.getCurrentModule() returns Module
A from within Module A.

ModuleA->runEvent("moduleB:default.index")->ModuleB-
>event.getCurrentModule() returns "ModuleA"

Seems like this should return "ModuleB".

thanks,

.brett

Brett

unread,
Jun 14, 2010, 10:32:35 PM6/14/10
to ColdBox Platform
Another thought... Right now when you call a module with runEvent()
the view the module sets is the view that is requested from the host
application (meaning the runEvent returns the event, THEN the view is
rendered on the host application and the path doesn't match the
module's).

It would be kickass if the runEvent() on a module called the view in
the context of the module that set the view. I can post a test case
if needed, this would be a big feature. Without the view rendering I
think modules act too much like what I would expect plugins to do.

This would be a really cool feature, let me know if I need to
elaborate on it.

What I am working towards is building modules as widgets, and saving
the output as a partial that is rendered in the host app's layout. So
for example one page might have 3 RSS readers widgets on it. Each one
has different settings, url to the feed, how many items to display,
etc... Each saves the output to a webpart and the host app renders
that web parts in the app's template.

Thoughts?

thanks,

.brett

Luis Majano

unread,
Jun 15, 2010, 1:11:54 PM6/15/10
to col...@googlegroups.com
Not necessarily, remember that the event.getCurrentModule() reacts via the event object which models a user's request not internal event chains.  If not, it would be like switching context.  


Luis F. Majano
President
Ortus Solutions, Corp

ColdBox Platform: http://www.coldbox.org
Linked In: http://www.linkedin.com/pub/3/731/483
Blog: http://www.luismajano.com
IECFUG Manager: http://www.iecfug.com



--
You received this message because you are subscribed to the Google Groups "ColdBox Platform" group.
To post to this group, send email to col...@googlegroups.com
To unsubscribe from this group, send email to coldbox-u...@googlegroups.com
For more options, visit this group at http://groups-beta.google.com/group/coldbox
For News, visit http://blog.coldbox.org
For Documentation, visit http://wiki.coldbox.org

Luis Majano

unread,
Jun 15, 2010, 1:13:15 PM6/15/10
to col...@googlegroups.com
Can you elaborate, I am not following.

Luis F. Majano
President
Ortus Solutions, Corp

ColdBox Platform: http://www.coldbox.org
Linked In: http://www.linkedin.com/pub/3/731/483
Blog: http://www.luismajano.com
IECFUG Manager: http://www.iecfug.com


Brett

unread,
Jun 15, 2010, 2:13:35 PM6/15/10
to ColdBox Platform
The module I am calling with runEvent() sets the event view but the
renderer tries to find the view relative to the host application and
not from the module that set it. Still getting up to speed with
modules and trying to figure out the best way to call multiple modules
in a single request. As you mentioned before, there is only a single
request context in ColdBox so this is going to be difficult.

.brett


On Jun 15, 1:13 pm, Luis Majano <lmaj...@gmail.com> wrote:
> Can you elaborate, I am not following.
>
> Luis F. Majano
> President
> Ortus Solutions, Corp
>
> ColdBox Platform:http://www.coldbox.org
> Linked In:http://www.linkedin.com/pub/3/731/483
> Blog:http://www.luismajano.com
> IECFUG Manager:http://www.iecfug.com
>

Aaron Roberson

unread,
Jun 15, 2010, 2:15:42 PM6/15/10
to col...@googlegroups.com
Brett, would a combination of Modules and Viewlets solve your problem?

http://wiki.coldbox.org/wiki/Layouts-Views.cfm#Viewlets

Brett

unread,
Jun 15, 2010, 2:31:07 PM6/15/10
to ColdBox Platform
Oooo, it just might. I'll take a look and see.

thanks,

.brett

On Jun 15, 2:15 pm, Aaron Roberson <aaronarober...@gmail.com> wrote:
> Brett, would a combination of Modules and Viewlets solve your problem?
>
> http://wiki.coldbox.org/wiki/Layouts-Views.cfm#Viewlets
>

Luis Majano

unread,
Jun 15, 2010, 5:43:34 PM6/15/10
to col...@googlegroups.com
That guy Aaron is smart :) !!

If you want to do just that, I suggest doing viewlets, however, do it by calling the runEvent like so:


//Anywhere
#runEvent('module:myevent.disp")#


Then the event:

function disp(event){

// any logic here

// render it out
return renderView("mymodule/view");
}



Then the event is encapsulated and can return the rendered content so you can put it anywhere.

Luis F. Majano
President
Ortus Solutions, Corp

ColdBox Platform: http://www.coldbox.org
Linked In: http://www.linkedin.com/pub/3/731/483
Blog: http://www.luismajano.com
IECFUG Manager: http://www.iecfug.com


Aaron Roberson

unread,
Jun 15, 2010, 5:59:49 PM6/15/10
to col...@googlegroups.com
Thanks :D
Reply all
Reply to author
Forward
0 new messages