You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cocoon.apache.org by "Arsen A. Gutsal" <ar...@softsky.com.ua> on 2005/07/04 11:40:41 UTC

what's the best way

What's the best way to handle conditions in sitemap?
I'd prefer sitemap, not flowscipt.

So, I've the script, which store user to database.
After user is successfully stored, email should be sent to him with his
login/password and operation status. Everything works fine except I
can't catch session attribute set to ERROR and do not send email in that
case.

Sitemap looks like:

<map:match pattern="*-success">
	<!-- flow-attribute:customer should be set! -->
	<map:generate type="xquery" src="xq/update_customer.xq">
		<map:parameter name="id" value="{flow-attribute:customer/*/@id}"/>
		<map:parameter name="email"
value="{flow-attribute:customer/*/email}"/>
		<map:parameter name="pin" value="{flow-attribute:customer/@pin}"/>
	</map:generate>
	
	<!-- some condition should be here -->
	<map:call resource="sendMail">
		<map:parameter name="from" value="{global:registrator-email}"/>
		<map:parameter name="to" value="{global:admin-email}"/>
		<map:parameter name="subject" value="New user has been registered"/>
		<map:parameter name="src" value="cocoon:/registration_email.jx"/>
	</map:call>
</map:match>

So, email should *not* be sent if record was not added to DB in xquery
generator (some session attribute was set to ERROR). I tried to put
map:select with parameter-selector-test and check "ERROR" value, but it
does not work.
Of course I can move sendmail action to another pipeline and then call
it from XSLT (when generating the page). So, if error was set I'll not
call this pipeline. But this is an incorrect way I guess (to mix
visualizing with actioning).  

-- 
Sincerely,
Arsen A. Gutsal
SOFTSKY Ltd CEO/Executive
SOFTSKY - Cost effective Software Development



---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org