summaryrefslogtreecommitdiff
path: root/addons/web_dashboard/controllers.py
diff options
context:
space:
mode:
Diffstat (limited to 'addons/web_dashboard/controllers.py')
-rw-r--r--addons/web_dashboard/controllers.py28
1 files changed, 28 insertions, 0 deletions
diff --git a/addons/web_dashboard/controllers.py b/addons/web_dashboard/controllers.py
new file mode 100644
index 00000000000..80235492c0f
--- /dev/null
+++ b/addons/web_dashboard/controllers.py
@@ -0,0 +1,28 @@
+# -*- coding: utf-8 -*-
+import web.common 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(
+ [widget_id], ['content'], request.session.eval_context(request.context)
+ )[0]