[IMP] graphs code

bzr revid: fp@tinyerp.com-20120507095147-qxelcvv2m12t50l4
This commit is contained in:
Fabien Pinckaers 2012-05-07 11:51:47 +02:00
parent 76b1514392
commit 63b583aead
2 changed files with 28 additions and 27 deletions

View File

@ -4,28 +4,28 @@ try:
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]
#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]

View File

@ -262,7 +262,7 @@ instance.web_graph.GraphView = instance.web.View.extend({
schedule_chart: function(results) {
self.graph_render(...)
self.graph_render({})
},
// render the graph using the domain, context and group_by
@ -271,7 +271,8 @@ instance.web_graph.GraphView = instance.web.View.extend({
var self = this;
return $.when(this.is_loaded).pipe(function() {
// todo: find the right syntax to perform an Ajax call
return self.rpc.graph_get_data(self.view_id, domain, context, group_by).then($.proxy(self, 'schedule_chart'));
// return self.rpc.graph_get_data(self.view_id, domain, context, group_by).then($.proxy(self, 'schedule_chart'));
$.proxy(self, "schedule_chart");
});
},