Sorry Andreas, I didn't realise
MagnoliaTemplatingUtiltities.getInstance().isEditMode() was just a call to
MgnlContext.getAggregationState().isPreviewMode(), hence the result was the
same.
Looking at the code in InterceptFilter, the preview flag is being set based
on either a "mgnlPreview" parameter or session attribute of the same name.
protected boolean previewMode() {
// first check if its passed as a request parameter
if (MgnlContext.getParameter(MGNL_PREVIEW_ATTRIBUTE) != null) {
return
BooleanUtils.toBoolean(MgnlContext.getParameter(MGNL_PREVIEW_ATTRIBUTE));
}
// then in attributes, i.e the session
final Boolean value = (Boolean)
MgnlContext.getAttribute(MGNL_PREVIEW_ATTRIBUTE);
return BooleanUtils.toBoolean(value);
}
May be try the MgnlContext.getAttribute(...) and see how you go.
Sorry, but I don't currently have a Magnolia instance in front of me to
check this out properly, so I'm just looking at the code. If the above
doesn't work hopefully someone else may be able to step in to help.
Good luck
Brad
-----Original Message-----
From: [email protected]
[mailto:[email protected]] On Behalf Of Andreas Weder
Sent: Tuesday, 29 September 2009 10:15 PM
To: Magnolia User-List
Subject: Re: [magnolia-user] Detecting preview mode in VirtualURIMapping
Hi Brad,
thanks for your reply.
>
> Try:
>
> MgnlContext.getAggregationState().isPreviewMode();
>
Hmm... this doesn't seem to work inside a VirtualURIMapping. It always
returns true.
This is with Magnolia 4.1. Is this maybe a bug, which got fixed in 4.1.1
(please?!)! Or is it just that the preview mode has not been detected yet
before the VirtualURIMapping classes are executed?
Thanks
Andreas
> Von: Brad Kazazes <[email protected]>
> Antworten an: Magnolia User-List <[email protected]>
> Datum: Tue, 29 Sep 2009 20:11:04 +1000
> An: 'Magnolia User-List' <[email protected]>
> Betreff: RE: [magnolia-user] Detecting preview mode in VirtualURIMapping
>
>
> Hi Andreas,
>
> Try:
>
> MgnlContext.getAggregationState().isPreviewMode();
>
> Cheers,
> Brad
>
> -----Original Message-----
> From: [email protected]
> [mailto:[email protected]] On Behalf Of Andreas Weder
> Sent: Tuesday, 29 September 2009 7:20 PM
> To: Magnolia User-List
> Subject: [magnolia-user] Detecting preview mode in VirtualURIMapping
>
>
> Hi, fellow Magnolians,
>
> how do I properly detect preview mode in a VirtualURIMapping
implementation?
>
> I've implemented my own VirtualURIMapping classs. I'd like to only enable
> the mapping it defines, if I'm either on a public instance or in preview
> mode in an author instance. I've tried using
> MagnoliaTemplatingUtiltities.getInstance().isEditMode() or
> CmsFunctions.isEditMode(), but both always return true on my author
> instance.
>
> So how do I properly do that?
>
> Thanks for your help
> Andreas
>
>
> ----------------------------------------------------------------
> For list details see
> http://www.magnolia-cms.com/home/community/mailing-lists.html
> To unsubscribe, E-mail to: <[email protected]>
> ----------------------------------------------------------------
>
>
> ----------------------------------------------------------------
> For list details see
> http://www.magnolia-cms.com/home/community/mailing-lists.html
> To unsubscribe, E-mail to: <[email protected]>
> ----------------------------------------------------------------
>
----------------------------------------------------------------
For list details see
http://www.magnolia-cms.com/home/community/mailing-lists.html
To unsubscribe, E-mail to: <[email protected]>
----------------------------------------------------------------
----------------------------------------------------------------
For list details see
http://www.magnolia-cms.com/home/community/mailing-lists.html
To unsubscribe, E-mail to: <[email protected]>
----------------------------------------------------------------