appypod-rattail/gen/plone25/skin/ajax.pt

30 lines
1.7 KiB
Plaintext
Raw Normal View History

<tal:comment replace="nothing">
This page is called by a XmlHttpRequest object. It requires parameters "page" and "macro":
they are used to call the macro that will render the HTML chunk to be returned to the browser.
It can also have a parameter "action", that refers to a method that will be triggered on
contextObj before returning the result of the macro to the browser.
</tal:comment>
2011-09-18 08:00:05 -05:00
<tal:ajax define="contextObj context/getParentNode;
tool contextObj/getTool;
req python: request;
resp req/RESPONSE;
page req/page;
macro req/macro;
action req/action|nothing;
user contextObj/portal_membership/getAuthenticatedMember;
app tool/getApp;
appUrl app/absolute_url;
template python: contextObj.getPageTemplate(app.skyn, page);
x python: resp.setHeader('Content-Type','text/html;;charset=utf-8');
x python: resp.setHeader('Expires', 'Mon, 11 Dec 1975 12:05:05 GMT');
x python: resp.setHeader('Content-Language', req.get('language', 'en'));
x python: resp.setHeader('CacheControl', 'no-cache')">
<tal:comment replace="nothing">Keys "Expires" and "CacheControl" are used for preventing IE to cache
this page. Indeed, this page is retrieved through an asynchronous XMLHttpRequest by the browser, and
IE caches this by default.</tal:comment>
<tal:executeAction condition="action">
2011-09-18 08:00:05 -05:00
<tal:do define="x python: contextObj.getMethod('on'+action)()" omit-tag=""/>
</tal:executeAction>
<metal:callMacro use-macro="python: template.macros.get(macro)"/>
</tal:ajax>