On Monday, Dec 9, 2002, at 05:21 US/Pacific, Konstantin Piroumian wrote:
In case of the flow script you should place login() function call in everyNot really. You can automate this task by arranging in your sitemap to call a function that checks the login first, instead of your function. The following will do it:
function that needs authorized access, while for the state machine approach
you could create a superstate - AuthorizedState - for all the sub-states
that needs authenticated user.
Sitemap:
<map:match pattern="someUri/checkout">
<map:call function="checkLogin">
<map:parameter name="funarg" value="checkout"/>
</map:call>
</map:match>
Flow:
var user;
function login()
{
// send the necessary pages for the user
// to login. Assigns to the global 'user' variable
// the User object, which is later used throughout
// the script to identify the user. See the prefs.js
// sample in Cocoon for an example of such a function.
}
function checkLogin(funarg)
{
if (user == null)
login();
funarg();
}
The sitemap calls checkLogin() and passes as argument the function to be called when the user has already logged in. The login() function will ask the user to login, and will return only when the user successfully does so. At that moment the original function to be invoked is called.
In the project I'd been working, we'd been generating our state machineHaving to use a tool is exactly what I'm trying to avoid. I'm finding myself in the constant situation of running on an unsupported platform for most of such tools. Writing simple scripts beats any time a verbose XML document.
descriptions directly from a UML modeling tool (it was XMI format), then it
were processed by an XSLT to our (simpler) format. (The source code was not
related to Cocoon neither it was open source, unfortunately)
Best regards,
--
Ovidiu Predescu <[EMAIL PROTECTED]>
http://webweavertech.com/ovidiu/weblog/
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, email: [EMAIL PROTECTED]