diff --git a/addons/base/static/lib/qweb/qweb-test-foreach.xml b/addons/base/static/lib/qweb/qweb-test-foreach.xml index fa037d72fc2..80749882aaf 100644 --- a/addons/base/static/lib/qweb/qweb-test-foreach.xml +++ b/addons/base/static/lib/qweb/qweb-test-foreach.xml @@ -1,40 +1,17 @@ - - * - - - - - - - + * + + - - - - - - - - - - - - - - - - - - - - - + + + + + + + - - - - - - + + diff --git a/addons/base/static/lib/qweb/qweb-test-trim.xml b/addons/base/static/lib/qweb/qweb-test-trim.xml deleted file mode 100644 index 964aa2733c5..00000000000 --- a/addons/base/static/lib/qweb/qweb-test-trim.xml +++ /dev/null @@ -1,19 +0,0 @@ - - - ok - - ok - ok - ok - - o k - - - - - - [ ] - - - - diff --git a/addons/base/static/lib/qweb/qweb-test.js.html b/addons/base/static/lib/qweb/qweb-test.js.html index a7742cc5142..b39527f0c13 100644 --- a/addons/base/static/lib/qweb/qweb-test.js.html +++ b/addons/base/static/lib/qweb/qweb-test.js.html @@ -5,9 +5,10 @@ - + + + @@ -35,6 +38,7 @@ + + + + + + + + +
+
    +
+ +
+
    +
+
+
+ + +
+
+

Choose dashboard layout

+
    +
+
+
\ No newline at end of file diff --git a/addons/base_dashboard/static/src/js/dashboard.js b/addons/base_dashboard/static/src/js/dashboard.js new file mode 100644 index 00000000000..34d09f80e62 --- /dev/null +++ b/addons/base_dashboard/static/src/js/dashboard.js @@ -0,0 +1,104 @@ +openerp.base_dashboard = function(openerp){ + +QWeb.add_template('/base_dashboard/static/src/xml/base_dashboard.xml'); + +openerp.base.form.Board = openerp.base.form.Widget.extend({ + init: function(view, node) { + + this._super(view, node); + this.template = "Board"; + }, + start: function() { + this._super.apply(this, arguments); + this.$element.html(QWeb.render(this.template)); + }, + + render: function() { + var self = this; + jQuery('body').append( + jQuery('
', {'id': 'dashboard_template'}).load('/base_dashboard/static/src/dashboard_template.html',self.on_loaded).hide() + ) + }, + + on_loaded: function() { + var children = this.node.children; + var board = jQuery('#dashboard').dashboard({ + layoutClass:'layout' + }); + board.init(); + for(var ch = 0; ch < children.length; ch++) { + var ch_widgets = children[ch].children; + for(var chld = 0; chld < ch_widgets.length; chld++) { + var widget_type = ch_widgets[chld].tag; + var child_index = widget_type == 'action' ? chld : ch; + var widget = new (openerp.base.form.widgets.get_object(widget_type)) (this.view, ch_widgets[chld], board, child_index); + widget.start(); + } + } + } +}); + +openerp.base.form.Action = openerp.base.form.Widget.extend({ + init: function(view, node, board, child_index) { + this._super(view, node, board, child_index); + this.board = board; + this.child_index = child_index; + }, + start: function() { + this._super.apply(this, arguments); + this.rpc('/base_dashboard/dashboard/load',{ + node_attrs: this.node.attrs + }, + this.on_load_action); + }, + + on_load_action: function(result) { + var action = result.action; + + action.search_view = false; + action.no_sidebar = true; + action.search_view_id = false; + + var node_attrs = this.node.attrs; + var get_column = ['first', 'second', 'third']; + var board_element = this.board.element.find('[id=column-'+get_column[this.child_index]+']'); + + this.board.addWidget({ + 'id': node_attrs.name, + 'title': node_attrs.string, + }, board_element); + + var content_id = node_attrs.name+'-widgetcontent'; + this.board.getWidget(node_attrs.name).element.find('.widgetcontent').attr('id',content_id) + + action_manager = new openerp.base.ActionManager(this.session, content_id); + action_manager.start(); + this.board.getWidget(node_attrs.name).url = action_manager.do_action(action); + } +}) + +openerp.base.form.Vpaned = openerp.base.form.Widget.extend({ + init: function(view, node, board, child_index) { + + this._super(view, node, board, child_index); + this.board = board; + this.child_index = child_index; + }, + start: function() { + this._super.apply(this, arguments); + var children = this.node.children; + for(var chld=0; chld + +
+ +
+
+
+
+
+
+
+ \ No newline at end of file diff --git a/openerpweb/openerpweb.py b/openerpweb/openerpweb.py index 104394d361d..19d6ec1eeb4 100644 --- a/openerpweb/openerpweb.py +++ b/openerpweb/openerpweb.py @@ -16,7 +16,6 @@ import cherrypy.lib.static import simplejson import nonliterals -import xmlrpctimeout import logging #----------------------------------------------------------- @@ -93,7 +92,7 @@ class OpenERPSession(object): self.client_timezone = False def proxy(self, service): - s = xmlrpctimeout.TimeoutServerProxy('http://%s:%s/xmlrpc/%s' % (self._server, self._port, service), timeout=5) + s = xmlrpclib.ServerProxy('http://%s:%s/xmlrpc/%s' % (self._server, self._port, service)) return s def bind(self, db, uid, password): diff --git a/openerpweb/xmlrpctimeout.py b/openerpweb/xmlrpctimeout.py deleted file mode 100644 index 28f9bcd41bd..00000000000 --- a/openerpweb/xmlrpctimeout.py +++ /dev/null @@ -1,30 +0,0 @@ -import xmlrpclib -import httplib - -class TimeoutHTTPConnection(httplib.HTTPConnection): - def connect(self): - httplib.HTTPConnection.connect(self) - self.sock.settimeout(self.timeout) - -class TimeoutHTTP(httplib.HTTP): - _connection_class = TimeoutHTTPConnection - def set_timeout(self, timeout): - self._conn.timeout = timeout - -class TimeoutTransport(xmlrpclib.Transport): - def __init__(self, timeout=10, *l, **kw): - xmlrpclib.Transport.__init__(self,*l,**kw) - self.timeout=timeout - def make_connection(self, host): - conn = TimeoutHTTP(host) - conn.set_timeout(self.timeout) - return conn - -class TimeoutServerProxy(xmlrpclib.ServerProxy): - def __init__(self,uri,timeout=10,*l,**kw): - kw['transport']=TimeoutTransport(timeout=timeout, use_datetime=kw.get('use_datetime',0)) - xmlrpclib.ServerProxy.__init__(self,uri,*l,**kw) - -if __name__ == "__main__": - s=TimeoutServerProxy('http://127.0.0.1:9090',timeout=2) - s.dummy()