[opencms-dev] Re: Direct edit

mahesh babu ksmaheshbabu at yahoo.com
Sat Mar 4 16:21:24 CET 2006


hi,

i just want to know how to read the preference of user
from the workplace. without hard coding the offline
project name in the code.

simply if i pass offline to a login method in
cmsjsplogin beane i am able to do direct edit. This
parameter i want to make it has dynamic reading from
user workplace project preferecne.

I used cmspreference class and method getwpparammethod
something to get the preference setting.

I am not able to succeed

can anybody tell me what needs to be done to get the
project name dynamically.

thanks
mahesh

--- Christian Steinert <christian_steinert at web.de>
wrote:

> Uhlig, Roman wrote:
> >> 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
> >
> >
> >
> > _______________________________________________
> > This mail is sent to you from the opencms-dev
> mailing list
> > To change your list options, or to unsubscribe
> from the list, please visit
> >
>
http://lists.opencms.org/mailman/listinfo/opencms-dev
> >
> >   
> Dear Roman,
> 
> Looks as if the session gets lost. Of course your
> browser needs to 
> accept cookies, but that will probably not be the
> reason.
> 
> But did you write a
>     <%@ page session="true" %>
> at the beginning of your jsp page?
> 
> 
> Christian
> 
> _______________________________________________
> This mail is sent to you from the opencms-dev
> mailing list
> To change your list options, or to unsubscribe from
> the list, please visit
>
http://lists.opencms.org/mailman/listinfo/opencms-dev
> 


__________________________________________________
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 



More information about the opencms-dev mailing list