appypod-rattail/gen/ui/ajax.pt

34 lines
1.9 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;
2011-11-25 11:01:20 -06:00
user contextObj/getUser;
2011-09-18 08:00:05 -05:00
app tool/getApp;
appUrl app/absolute_url;
2011-11-25 11:01:20 -06:00
template python: contextObj.getPageTemplate(app.ui, page);
lang tool/getUserLanguage;
dir python: tool.getLanguageDirection(lang);
dleft python: (dir == 'ltr') and 'left' or 'right';
dright python: (dir == 'ltr') and 'right' or 'left';
2011-09-18 08:00:05 -05:00
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', lang);
2011-09-18 08:00:05 -05:00
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>