[IMP] adding sample controllers

bzr revid: fp@tinyerp.com-20120507085036-i3z2blu1d1nus4ir
This commit is contained in:
Fabien Pinckaers 2012-05-07 10:50:36 +02:00
parent 7b0a381091
commit 7463466695
3 changed files with 33 additions and 0 deletions

View File

@ -0,0 +1 @@
import controllers

View File

@ -0,0 +1 @@
import graph

View File

@ -0,0 +1,31 @@
# -*- coding: utf-8 -*-
try:
import openerp.addons.web.common.http as openerpweb
except ImportError:
import web.common.http as openerpweb
WIDGET_CONTENT_PATTERN = """<!DOCTYPE html>
<html>
<head><title>[[Widget %(id)d]]</title></head>
<body>
%(content)s
<script type="text/javascript">
var load = window.onload;
window.onload = function () {
if (load) {
load();
}
window.frameElement.style.height = document.height + 'px';
}
</script>
</body>
</html>
"""
class Widgets(openerpweb.Controller):
_cp_path = '/web_dashboard/widgets'
@openerpweb.httprequest
def content(self, request, widget_id):
return WIDGET_CONTENT_PATTERN % request.session.model('res.widget').read(
[int(widget_id)], ['content'], request.session.eval_context(request.context)
)[0]