[opencms-dev] Re: Direct edit

Uhlig, Roman roman.uhlig at knve.de
Thu Mar 2 19:01:51 CET 2006


> Hi Roman,
>
> I must admit, that I have not tried this yet.
>
> What happens, if you do not redirect, but after logging in, etc output
the following:
>
> <cms:user property="name"/> 
> <%=cmsObject.getRequestContext().getCurrentProject().getName() %>
> <%=cmsObject.getRequestContext().getSiteRoot() %>
>
>
> Regards
> Christian


Hi Christian,

I tried what you suggested and additionally changed the usage of
CmsObject from

	CmsObject cmsObject = OpenCms.initCmsObject();

to

	CmsJspActionElement cms = new CmsJspActionElement(pageContext,
request, response);
	cms.getCmsObject().....

so I get this piece of testing code:

	<% CmsJspActionElement cms = new
CmsJspActionElement(pageContext, request, response); %>

	// before user login and project switch
	<cms:user property="name"/>
	<%=
cms.getCmsObject().getRequestContext().currentProject().getName() %>
	<%= cms.getCmsObject().getRequestContext().getSiteRoot() %>

	<%
	cms.getCmsObject().loginUser("xxx","yyy");
	CmsProject cmsproject = cms.getCmsObject().readProject(
"Offline" );
	cms.getCmsObject().getRequestContext().setCurrentProject(
cmsproject );
	cms.getCmsObject().getRequestContext().setSiteRoot(
"/sites/default" );
	%>

	// after user login and project switch
	<cms:user property="name"/>
	<%=
cms.getCmsObject().getRequestContext().currentProject().getName() %>
	<%= cms.getCmsObject().getRequestContext().getSiteRoot() %>

It's giving me an output like this:

	Guest
	Online
	/sites/default

	xxx
	Offline
	/sites/default

So project switching and logging in seems to work, but the odd thing is,
that direct edit features still dont show up. If I reload that test
page, I'm getting the same output again, what means I was guest user
inside the Online project again. Seems like the page has finished
loading, I'm set back to guest user and Online project?

I must confess, I'm a bit confused. It would be great if someone could
clearify that a bit. Again, all I wanna do is providing a custom login
page for granting access to the direct edit features for workplace users
without accessing the workplace.

Thank you in advance,
Roman Uhlig





More information about the opencms-dev mailing list