"static/src/css/data_export.css",
"static/src/css/data_import.css",
],
+ 'qweb' : [
+ "static/src/xml/*.xml",
+ ],
}
# OpenERP Web web Controllers
#----------------------------------------------------------
+
+def concat_xml(file_list):
+ """Concatenate xml files
+ return (concat,timestamp)
+ concat: concatenation of file content
+ timestamp: max(os.path.getmtime of file_list)
+ """
+ root = None
+ files_timestamp = 0
+ for fname in file_list:
+ ftime = os.path.getmtime(fname)
+ if ftime > files_timestamp:
+ files_timestamp = ftime
+
+ xml = ElementTree.parse(fname).getroot()
+
+ if root is None:
+ root = ElementTree.Element(xml.tag)
+ #elif root.tag != xml.tag:
+ # raise ValueError("Root tags missmatch: %r != %r" % (root.tag, xml.tag))
+
+ for child in xml.getchildren():
+ root.append(child)
+ return ElementTree.tostring(root, 'utf-8'), files_timestamp
+
+
def concat_files(file_list):
""" Concatenate file content
return (concat,timestamp)
def jslist(self, req, mods=None):
return self.manifest_list(req, mods, 'js')
+ @openerpweb.jsonrequest
+ def qweblist(self, req, mods=None):
+ return self.manifest_list(req, mods, 'qweb')
+
@openerpweb.httprequest
def css(self, req, mods=None):
files = [f[0] for f in self.manifest_glob(req, mods, 'css')]
return req.make_response(content, [('Content-Type', 'application/javascript')])
@openerpweb.httprequest
+ def qweb(self, req, mods=None):
+ files = [f[0] for f in self.manifest_glob(req, mods, 'qweb')]
+ content,timestamp = concat_xml(files)
+ # TODO use timestamp to set Last mofified date and E-tag
+ return req.make_response(content, [('Content-Type', 'text/xml')])
+
+
+ @openerpweb.httprequest
def home(self, req, s_action=None, **kw):
js = "\n ".join('<script type="text/javascript" src="%s"></script>'%i for i in self.manifest_list(req, None, 'js'))
css = "\n ".join('<link rel="stylesheet" href="%s">'%i for i in self.manifest_list(req, None, 'css'))
this._super(null, element_id);
openerp.webclient = this;
- QWeb.add_template("/web/static/src/xml/base.xml");
var params = {};
if(jQuery.param != undefined && jQuery.deparam(jQuery.param.querystring()).kitten != undefined) {
this.$element.addClass("kitten-mode-activated");
}
this.$element.html(QWeb.render("Interface", params));
- this.notification = new openerp.web.Notification();
+ this.notification = new openerp.web.Notification(this);
this.loading = new openerp.web.Loading(this,"oe_loading");
this.crashmanager = new openerp.web.CrashManager();
// TODO: session should have an optional name indicating that they'll
// be saved to (and revived from) cookies
this.name = 'session';
+ this.do_load_qweb(['/web/webclient/qweb']);
},
+
start: function() {
this.session_restore();
},
self.user_context = result.context;
self.db = result.db;
self.session_save();
+ self.on_session_valid();
return true;
}).then(success_callback);
},
self.rpc('/web/webclient/jslist', {"mods": modules}, function(files) {
self.do_load_js(file_list.concat(files));
});
+ self.rpc('/web/webclient/qweblist', {"mods": modules}, self.do_load_qweb);
openerp._modules_loaded = true;
});
});
this.on_modules_loaded();
}
},
+ do_load_qweb: function(files) {
+ var self = this;
+ _.each(files, function(file) {
+ $.ajax({
+ url: file,
+ type: 'get',
+ async: false,
+ dataType: 'text',
+ }).then(function(xml) {
+ openerp.web.qweb.add_template(_(xml).trim());
+ });
+ });
+ },
on_modules_loaded: function() {
for(var j=0; j<this.module_list.length; j++) {
var mod = this.module_list[j];
* @param view the ancestor view of this widget
*/
init: function (view) {
+ this._super(view);
this.view = view;
},
/**
this._super();
},
render: function (defaults) {
- return QWeb.render(
- this.template, _.extend(this, {
- defaults: defaults
- }));
+ // FIXME
+ return this._super(_.extend(this, {defaults: defaults}));
}
});
openerp.web.search.add_expand_listener = function($root) {
"css": ['static/lib/dhtmlxScheduler/codebase/dhtmlxscheduler.css',
'static/lib/dhtmlxScheduler/codebase/ext/dhtmlxscheduler_ext.css'
],
+ 'qweb' : [
+ "static/src/xml/*.xml",
+ ],
'active': True
}
openerp.web_calendar = function(openerp) {
var _t = openerp.web._t;
var QWeb = openerp.web.qweb;
-QWeb.add_template('/web_calendar/static/src/xml/web_calendar.xml');
openerp.web.views.add('calendar', 'openerp.web_calendar.CalendarView');
openerp.web_calendar.CalendarView = openerp.web.View.extend({
// Dhtmlx scheduler ?
'static/src/js/dashboard.js'
],
"css": ['static/src/css/dashboard.css'],
+ 'qweb' : [
+ "static/src/xml/*.xml",
+ ],
'active': True
}
openerp.web_dashboard = function(openerp) {
var QWeb = openerp.web.qweb;
-QWeb.add_template('/web_dashboard/static/src/xml/web_dashboard.xml');
if (!openerp.web_dashboard) {
/** @namespace */
'css' : [
"static/src/css/base_diagram.css",
],
+ 'qweb' : [
+ "static/src/xml/*.xml",
+ ],
'active': True,
}
openerp.web_diagram = function (openerp) {
var QWeb = openerp.web.qweb;
-QWeb.add_template('/web_diagram/static/src/xml/base_diagram.xml');
openerp.web.views.add('diagram', 'openerp.web.DiagramView');
openerp.web.DiagramView = openerp.web.View.extend({
searchable: false,
'static/src/js/gantt.js'
],
"css": ['static/lib/dhtmlxGantt/codebase/dhtmlxgantt.css'],
+ 'qweb' : [
+ "static/src/xml/*.xml",
+ ],
'active': True
}
*---------------------------------------------------------*/
openerp.web_gantt = function (openerp) {
var QWeb = openerp.web.qweb;
-QWeb.add_template('/web_gantt/static/src/xml/web_gantt.xml');
openerp.web.views.add('gantt', 'openerp.web_gantt.GanttView');
openerp.web_gantt.GanttView = openerp.web.View.extend({
"static/lib/dhtmlxGraph/codebase/dhtmlxchart_debug.js",
"static/src/js/graph.js"],
"css": ["static/lib/dhtmlxGraph/codebase/dhtmlxchart.css"],
+ 'qweb' : [
+ "static/src/xml/*.xml",
+ ],
"active": True
}
'#cc0000', '#d400a8'];
var QWeb = openerp.web.qweb;
-QWeb.add_template('/web_graph/static/src/xml/web_graph.xml');
openerp.web.views.add('graph', 'openerp.web_graph.GraphView');
openerp.web_graph.GraphView = openerp.web.View.extend({
"css": [
"static/src/css/kanban.css"
],
+ 'qweb' : [
+ "static/src/xml/*.xml",
+ ],
'active': True
}
this.all_display_data = false;
this.groups = [];
this.qweb = new QWeb2.Engine();
- this.qweb.debug = (window.location.search.indexOf('?debug') !== -1);
+ this.qweb.debug = openerp.connector.debug;
this.aggregates = {};
this.NO_OF_COLUMNS = 3;
this.form_dialog = new openerp.web.FormDialog(this, {}, this.options.action_views_ids.form, dataset).start();