Question

I am upgrading to Plone 4.2 (from 4.0.1) and moving my theme product from XDV to Diazo.

A bug has presented where when i submit a form from an overlay to a custom page template, the resulting page is 'plain'. By 'plain' I mean the only visible content is the main content area, there is no plone nav, logo, none of the style sheets are present etc. There is an 'info' message passed to this page and that does get rendered at the top of the page (nothing is styled with any plone or theme styles though). It's like the target page is rendered outside of the Plone space altogether.

I have tried adding to my rules.xml and adding the corresponding ajax_load = python: request.form.get('ajax_load') to the parameters in the theming control panel 'advanced settings' section. The overlay is still themed however, and the form target page is still 'plain' (I wont say 'unthemed' as even an unthemed Plone page still has the basic logo, nav etc).

I also tried add a and sticking an item with this id in my overlay template - the overlay still gets themed.

I am using the theme rule

Not sure why the overlays remain themed and if this is part of the problem? Also not sure why the form target page template is rendered 'plain'.

If i submit the same form normally (not from an overlay) the target page renders properly themed...

Any tips to debug this would be great thanks.

Am using Plone 4.2.0.1 and plone.app.theming 1.1a2, my theme is file system based.


Edit: OK some of my overlay forms are working properly. The difference seems to be where the form action is:

form tal:attributes="action request/URL" - works OK

form tal:attributes="action string:${context/absolute_url}/@@view" - gives me the 'plain' page at first render when called from an overlay form (as discussed above is fine when called from the same form not in an overlay)

Note that the 'plain' page html goes like this (note no base Plone or Theme head inclusions):

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en"><head><meta http-equiv="Content-Type" content="text/html; charset=utf-8" /><base href="http://localhost:8080/Plone/sectionfoo/sectionbar/mypage" /><!--[if lt IE7]></base><![endif]--></head>
<body class="template-view portaltype-myCustomType site-Plone section-sectionfoo icons-on havePortlets haveLeftPortlets haveRightPortlets" dir="ltr">
<h1 class="documentFirstHeading">Why is this page plain?</h1>
...

I also tried completely uninstalling my theme product - i still see the same behaviour from these particular overlay forms in vanilla plone...

Was it helpful?

Solution

If you're using a JavaScript .prepOverlay() call to set up the ajax overlay, then it will automatically append the ajax_load flag as part of the query string used via AJAX to get the code that's displayed in the overlay.

See http://pypi.python.org/pypi/plone.app.jquerytools/1.5#ajax for an explanation of what ajax_load does. In brief, it causes the server to strip everything but the content area off. The purpose is to avoid loading unnecessary page parts into an overlay, which is already displayed inside a page.

If the form you load is posting to itself (a very common Zope/Plone practice), then the ajax_load parameter may be in the form action URL. So, you get only the content area returned.

So, you'll need to do some work in your custom form template to make sure you strip "ajax_load" off the query string of the URL before you set the form action. Also, strip any "ajax_load" hidden input out of the form.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top