cocoon-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Derek Hohls" <DHo...@csir.co.za>
Subject RE: Authentication - accessing user info in JXTemplateGenerator?
Date Wed, 14 Jul 2004 09:31:36 GMT
Helma

In the flowscript you suggest:

cocoon.session.getContext()

Cocoon does not seem to recognise the getContext 
function??

Derek

>>> H.vanderLinden@MI.unimaas.nl 2004/07/14 11:03:52 AM >>>
Hi,

I remember I've tried this too, but I can't remember I succeeded. What
I now
do is include the info using a CInclude transformer and generating the
necessary info in another pipeline. A final XSL transformer cleans up
the
resulting XML before it is transformed to HTML.

mypage.jx:

<cinclude:include src="cocoon:/getUser"/>

pipeline:

<map:match pattern="getUser">
	<map:generate src="system/authentication.xml">
		<map:parameter name="use-request-parameters"
value="true"/>
	</map:generate>
	<map:transform type="session"/>
	<map:serialize type="xml"/>
</map:match>

authentication.xml:

<?xml version="1.0" encoding="UTF-8"?>
<authentication xmlns:session="http://apache.org/cocoon/session/1.0" 
>
<session:getxml context="authentication" path="/"/>
</authentication>

Maybe not the most elegant/fastest solution, but it works.


Some random thoughts:

- get the info in a flowscript and add it to the template using the
bizData
construction:

function showInfo() {
 var userid =
cocoon.session.getContext("/authentication/authentication/ID"); //
making up
the syntax ;-)
 var viewData = { ID: userid };
 cocoon.sendPage("myJXpipeline", viewData);
}

mypage.jx includes a reference to ${ID}.

HTH.

Bye, Helma

> -----Original Message-----
> From: Derek Hohls [mailto:DHohls@csir.co.za] 
> Sent: Wednesday, 14 July 2004 10:31
> To: users@cocoon.apache.org 
> Subject: Authentication - accessing user info in
JXTemplateGenerator?
> 
> 
> I am trying to access the user information, after login,
> in a JXTemplate Generator page, which is *not* called
> by any flow...
> 
> I have tried:
>   #{cocoon/session/context/authentication/authentication/ID}
> and
>  #{cocoon/session-context/authentication/authentication/ID}
> 
> I have also tried passing the info, from within the sitemap,
> as parameters:
> 
>   <map:generate  type="jx" src="docs/mypage.jx">
>      <map:parameter name="userID" 
> value="{session-context:authentication/authentication/ID}"/>
>   </map:generate>
> 
> And then accessing the parameter as follows:
> 
>   #{cocoon/parameters/userID}
> and
>   ${cocoon.parameters.getAttribute('userID')}
> 
> But without any success... if anyone can point me
> to the right syntax, or appropriate method, I would
> appreciate it!
> 
> Thanks
> Derek
> 
> -- 
> This message has been scanned for viruses and
> dangerous content by MailScanner, and is
> believed to be clean.
> MailScanner thanks transtec Computers for their support.
> 
> 
>
---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org 
> For additional commands, e-mail: users-help@cocoon.apache.org 
> 

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


-- 
This message has been scanned for viruses and
dangerous content by MailScanner, and is
believed to be clean.
MailScanner thanks transtec Computers for their support.


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


Mime
View raw message