[MGNLUI-1902] cmsfn.isPreviewMode() is always false Created: 24/Jun/13  Updated: 13/Sep/21  Resolved: 09/Aug/13

Status: Closed
Project: Magnolia UI
Component/s: page editor
Affects Version/s: 5.0
Fix Version/s: 5.0.2, 5.1

Type: Bug Priority: Critical
Reporter: Maik Jablonski Assignee: Federico Grilli
Resolution: Fixed Votes: 3
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
causality
is causing MAGNOLIA-5242 cmsfn.isEditMode() is true when acces... Closed
relation
is related to MAGNOLIA-5236 Optional area not added on author ins... Closed
Template:
Acceptance criteria:
Empty
Task DoD:
[ ]* Doc/release notes changes? Comment present?
[ ]* Downstream builds green?
[ ]* Solution information and context easily available?
[ ]* Tests
[ ]* FixVersion filled and not yet released
[ ]  Architecture Decision Record (ADR)
Bug DoR:
[ ]* Steps to reproduce, expected, and actual results filled
[ ]* Affected version filled
Date of First Response:

 Description   

cmsfn.isPreviewMode() returns always false, accordingly cmsfn.isEditMode() is always true, so there's no way to decide if in preview mode or not at the moment. Same for JSP and FTL templating.

Tested against Magnolia 5.0 from bundled tomcat download.



 Comments   
Comment by Federico Grilli [ 31/Jul/13 ]

Thanks for reporting it. Confirmed on 5.0.1 too

Comment by Federico Grilli [ 31/Jul/13 ]

After a quick investigation it turned out that the preview mode is set here info.magnolia.cms.filters.InterceptFilter.doFilter(HttpServletRequest, HttpServletResponse, FilterChain) but the mgnlPreview request parameter which used to be sent to the server in Magnolia 4.x now is no longer there (hence null which converted into a boolean gives false), the edited page being currently in an iframe which only sends the mgnlChannel param.

Comment by Roman Kovařík [ 14/Aug/13 ]

Shouldn't cmsfn.isPreviewMode() be true also for accessing the page without editor (http://demoauthor.magnolia-cms.com/demo-project.html)?
Shouldn't this page behave same as beeing in page editor preview?
If not, pages in preview/direct access don't have to be always the same, for example empty optional areas won't be rendered in page editor preview or on public, but will be rendered with direct page access on author (http://demoauthor.magnolia-cms.com/demo-project.html).

Comment by Cedric Reichenbach [ 28/Sep/13 ]

It's back in 5.1-rc!

Comment by Hugo Ferreira [ 27/Apr/15 ]

I was dealing with this function now and I just realised that cmsfn.isPreviewMode() == !cmsfn.isEditMode() (I mean, the result is the same)
I was expecting cmsfn.isPreviewMode() to be true accessing the page via admincentral (localhost:8080/.magnolia/admincentral#app:pages:detail;/somepage*:view* ) instead of getting it true all the times that we are not in edit mode ( both localhost:8080/somepage/ and localhost:8080/.magnolia/admincentral#app:pages:detail;/somepage*:view* ) because it makes sense to have a different status for when previewing the page inside of the admincentral.

Generated at Mon Feb 12 08:51:14 CET 2024 using Jira 9.4.2#940002-sha1:46d1a51de284217efdcb32434eab47a99af2938b.