[IMP] adding sample controllers
bzr revid: fp@tinyerp.com-20120507085036-i3z2blu1d1nus4ir
This commit is contained in:
parent
7b0a381091
commit
7463466695
|
@ -0,0 +1 @@
|
||||||
|
import controllers
|
|
@ -0,0 +1 @@
|
||||||
|
import graph
|
|
@ -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]
|
Loading…
Reference in New Issue