[imp] refactoring of Session to not inherit Widget anymore
bzr revid: nicolas.vanhoren@openerp.com-20110812101952-qw12p8xhdfa3kmzu
This commit is contained in:
parent
dfaf0bd84e
commit
64571fa4ab
|
@ -53,6 +53,7 @@
|
||||||
*---------------------------------------------------------*/
|
*---------------------------------------------------------*/
|
||||||
|
|
||||||
openerp.base = function(instance) {
|
openerp.base = function(instance) {
|
||||||
|
openerp.base._t = function(x) { return x; };
|
||||||
openerp.base.core(instance);
|
openerp.base.core(instance);
|
||||||
openerp.base.formats(instance);
|
openerp.base.formats(instance);
|
||||||
openerp.base.chrome(instance);
|
openerp.base.chrome(instance);
|
||||||
|
|
|
@ -681,7 +681,7 @@ openerp.base.WebClient = openerp.base.Widget.extend({
|
||||||
}
|
}
|
||||||
this.$element.html(QWeb.render("Interface", params));
|
this.$element.html(QWeb.render("Interface", params));
|
||||||
|
|
||||||
this.session = new openerp.base.Session(this,"oe_errors");
|
this.session = new openerp.base.Session();
|
||||||
this.loading = new openerp.base.Loading(this,"oe_loading");
|
this.loading = new openerp.base.Loading(this,"oe_loading");
|
||||||
this.crashmanager = new openerp.base.CrashManager(this);
|
this.crashmanager = new openerp.base.CrashManager(this);
|
||||||
this.crashmanager.start();
|
this.crashmanager.start();
|
||||||
|
|
|
@ -305,16 +305,8 @@ openerp.base.Registry = openerp.base.Class.extend( /** @lends openerp.base.Regis
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
/**
|
openerp.base.CallbackEnabled = openerp.base.Class.extend({
|
||||||
* Utility class that any class is allowed to extend to easy common manipulations.
|
init: function() {
|
||||||
*
|
|
||||||
* It provides rpc calls, callback on all methods preceded by "on_" or "do_" and a
|
|
||||||
* logging facility.
|
|
||||||
*/
|
|
||||||
openerp.base.SessionAware = openerp.base.Class.extend({
|
|
||||||
init: function(session) {
|
|
||||||
this.session = session;
|
|
||||||
|
|
||||||
// Transform on_* method into openerp.base.callbacks
|
// Transform on_* method into openerp.base.callbacks
|
||||||
for (var name in this) {
|
for (var name in this) {
|
||||||
if(typeof(this[name]) == "function") {
|
if(typeof(this[name]) == "function") {
|
||||||
|
@ -325,6 +317,19 @@ openerp.base.SessionAware = openerp.base.Class.extend({
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Utility class that any class is allowed to extend to easy common manipulations.
|
||||||
|
*
|
||||||
|
* It provides rpc calls, callback on all methods preceded by "on_" or "do_" and a
|
||||||
|
* logging facility.
|
||||||
|
*/
|
||||||
|
openerp.base.SessionAware = openerp.base.CallbackEnabled.extend({
|
||||||
|
init: function(session) {
|
||||||
|
this._super();
|
||||||
|
this.session = session;
|
||||||
},
|
},
|
||||||
/**
|
/**
|
||||||
* Performs a JSON-RPC call
|
* Performs a JSON-RPC call
|
||||||
|
@ -611,15 +616,15 @@ openerp.base.OldWidget = openerp.base.Widget.extend({
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
openerp.base.Session = openerp.base.Widget.extend( /** @lends openerp.base.Session# */{
|
openerp.base.Session = openerp.base.CallbackEnabled.extend( /** @lends openerp.base.Session# */{
|
||||||
/**
|
/**
|
||||||
* @constructs
|
* @constructs
|
||||||
* @param element_id to use for exception reporting
|
* @param element_id to use for exception reporting
|
||||||
* @param server
|
* @param server
|
||||||
* @param port
|
* @param port
|
||||||
*/
|
*/
|
||||||
init: function(parent, element_id, server, port) {
|
init: function(server, port) {
|
||||||
this._super(parent, element_id);
|
this._super();
|
||||||
this.server = (server == undefined) ? location.hostname : server;
|
this.server = (server == undefined) ? location.hostname : server;
|
||||||
this.port = (port == undefined) ? location.port : port;
|
this.port = (port == undefined) ? location.port : port;
|
||||||
this.rpc_mode = (server == location.hostname) ? "ajax" : "jsonp";
|
this.rpc_mode = (server == location.hostname) ? "ajax" : "jsonp";
|
||||||
|
|
Loading…
Reference in New Issue