cocoon-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Marcus Crafter <craft...@fztig938.bank.dresdner.net>
Subject Re: Flow Scoping, was: JavaScriptInterpreter: bug or feature?
Date Thu, 20 Mar 2003 18:02:17 GMT
On Thu, Mar 20, 2003 at 09:43:06AM -0800, Christopher Oliver wrote:
> Marcus Crafter wrote:
> >On Wed, Mar 19, 2003 at 11:44:07PM -0500, Vadim Gritsenko wrote:
> >
> >>I would suggest behaviour similar to the rest of sitemap components: 
> >>flows defined in parent sitemap should be available in the subsitemaps.
> >>Is it possible from JavaScript POV - hierarchical organization of scopes?
> >
> >
> >	I tend to agree Vadim. Allowing the hierarchical organisation of flow
> >	scripts and variables would solve the cross-sitemap issues I 
> >	outlined in my previous email.
> >	
> >	For the cases where subsitemaps represent new applications, perhaps 
> >	this 'inheritence' behaviour could be made configurable at each
> >	sitemap level ?
> >
> 
> OK. Can you describe an example application that is organized this way, 
> so I can picture what this would look like?

	Ok, thinking out loud here:

	Let's say that our sitemaps (for a single application) are 
	arranged like this:

        root
         |
   |-----------|
 sub #1      sub #2

	Then JavaScript methods and globals defined in the 'root' flow (if
	configured to be inheritable) would be available in the lower
	level sub #1/#2 sitemaps.
	
	ie. using the example I had before:

root.js:
	
var currentUser = null;

function login()
{
	// assume valid user
	cocoon.createSession();
	currentUser = new User(usename);
	
	// continue and send Page.
}

sub-1.js:

function someProcessing()
{
	// currentUser already set by login()
	
	if (currentUser.someCheck())
	{
		// do the processing
	}
}

	That allows common script methods to be placed in the root.js
	(reuse), and globals to be valid across subsitemaps (cross sitemap
	communication).
	
	For systems where a subsitemap represents a new application,
	behaviour would be configured to be as it currently is.
	
	Thoughts ?
	
	Cheers,
	
	Marcus
	
-- 
        .....
     ,,$$$$$$$$$,      Marcus Crafter
    ;$'      '$$$$:    Computer Systems Engineer
    $:         $$$$:   ManageSoft GmbH
     $       o_)$$$:   82-84 Mainzer Landstrasse
     ;$,    _/\ &&:'   60327 Frankfurt Germany
       '     /( &&&
           \_&&&&'
          &&&&.
    &&&&&&&:

Mime
View raw message