[FIX] adpat web modules to changes in webclient

[FIX] enable some web module only when there is a webclient (prepare embed)

bzr revid: chs@openerp.com-20111110102153-pgktyws0gdgyq4f5
This commit is contained in:
Christophe Simonis 2011-11-10 11:21:53 +01:00
parent a11dfc5e35
commit 4ce75b1f7a
8 changed files with 46 additions and 45 deletions

View File

@ -22,5 +22,8 @@ Lets the company customize which Pad installation should be used to link to new
'web': True,
'certificate' : '001183545978470526509',
'js': ['static/src/js/pad.js'],
'qweb' : [
"static/src/xml/*.xml",
],
'images': ['static/src/img/pad_link_companies.jpeg'],
}

View File

@ -1,8 +1,5 @@
openerp.pad = function(instance) {
var QWeb = instance.web.qweb;
QWeb.add_template('/pad/static/src/xml/pad.xml');
instance.web.form.SidebarAttachments = instance.web.form.SidebarAttachments.extend({
on_attachments_loaded: function(attachments) {
this._super(attachments);

View File

@ -56,6 +56,9 @@ synchronization with other companies, etc.
'certificate' : '001301246528927038493',
'js': ['static/src/js/share.js'],
'css': ['static/src/css/share.css'],
'qweb' : [
"static/src/xml/*.xml",
],
'images': ['images/share_wizard.jpeg','images/sharing_wizard_step1.jpeg', 'images/sharing_wizard_step2.jpeg'],
}

View File

@ -1,7 +1,5 @@
openerp.share = function(instance) {
var QWeb = instance.web.qweb;
QWeb.add_template('/share/static/src/xml/share.xml');
function launch_wizard(self, view) {
var action = view.widget_parent.action;
@ -30,10 +28,9 @@ function if_has_share(yes, no) {
if (!_has_share) {
_has_share = $.Deferred(function() {
var self = this;
var session = instance.webclient.session;
session.on_session_invalid.add_last(function() { _has_share = null; });
var func = new instance.web.Model(session, "share.wizard").get_func("has_share");
func(session.uid).pipe(function(res) {
instance.connection.on_session_invalid.add_last(function() { _has_share = null; });
var func = new instance.web.Model(null, "share.wizard").get_func("has_share");
func(instance.connection.uid).pipe(function(res) {
if(res) {
self.resolve();
} else {

View File

@ -39,6 +39,9 @@ Add "Support" button in header from where you can access OpenERP Support.
'css' : [
'static/src/css/lc.css',
],
'qweb' : [
"static/src/xml/*.xml",
],
'installable': True,
'active': False,
'certificate': '0013762192410413',

View File

@ -22,29 +22,6 @@ var __lc_buttons = [];
openerp.web_livechat = function (openerp) {
var QWeb = openerp.web.qweb;
QWeb.add_template('/web_livechat/static/src/xml/web_livechat.xml');
// tracking code from LiveChat
var license = '1035052',
params = '',
lang = 'en',
skill = '0';
__lc_load = function (p) { if (typeof __lc_loaded != 'function')
if (p) { var d = document, l = d.createElement('script'), s =
d.getElementsByTagName('script')[0], a = unescape('%26'),
h = ('https:' == d.location.protocol ? 'https://' : 'http://'); l.type = 'text/javascript'; l.async = true;
l.src = h + 'gis' + p +'.livechatinc.com/gis.cgi?serverType=control'+a+'licenseID='+license+a+'jsonp=__lc_load';
if (!(typeof p['server'] !== 'string' || typeof __lc_serv === 'string')) {
l.src = h + (__lc_serv = p['server']) + '/licence/'+license+'/script.cgi?lang='+lang+a+'groups='+skill;
l.src += (params == '') ? '' : a+'params='+encodeURIComponent(encodeURIComponent(params)); s.parentNode.insertBefore(l, s);
} else setTimeout(__lc_load, 1000); if(typeof __lc_serv != 'string'){ s.parentNode.insertBefore(l, s);}
} else __lc_load(Math.ceil(Math.random()*5)); }
__lc_load();
openerp.web_livechat.Livechat = openerp.web.Widget.extend({
template: 'Header-LiveChat',
@ -94,7 +71,27 @@ openerp.web_livechat.Livechat = openerp.web.Widget.extend({
}
});
openerp.webclient.livechat = new openerp.web_livechat.Livechat(openerp.webclient);
openerp.webclient.livechat.prependTo('div.header_corner');
if (openerp.webclient) {
// tracking code from LiveChat
var license = '1035052',
params = '',
lang = 'en',
skill = '0';
__lc_load = function (p) { if (typeof __lc_loaded != 'function')
if (p) { var d = document, l = d.createElement('script'), s =
d.getElementsByTagName('script')[0], a = unescape('%26'),
h = ('https:' == d.location.protocol ? 'https://' : 'http://'); l.type = 'text/javascript'; l.async = true;
l.src = h + 'gis' + p +'.livechatinc.com/gis.cgi?serverType=control'+a+'licenseID='+license+a+'jsonp=__lc_load';
if (!(typeof p['server'] !== 'string' || typeof __lc_serv === 'string')) {
l.src = h + (__lc_serv = p['server']) + '/licence/'+license+'/script.cgi?lang='+lang+a+'groups='+skill;
l.src += (params == '') ? '' : a+'params='+encodeURIComponent(encodeURIComponent(params)); s.parentNode.insertBefore(l, s);
} else setTimeout(__lc_load, 1000); if(typeof __lc_serv != 'string'){ s.parentNode.insertBefore(l, s);}
} else __lc_load(Math.ceil(Math.random()*5)); }
__lc_load();
// and add widget to webclient
openerp.webclient.livechat = new openerp.web_livechat.Livechat(openerp.webclient);
openerp.webclient.livechat.prependTo('div.header_corner');
}
};

View File

@ -39,5 +39,8 @@ Invite OpenERP user feedback, powered by uservoice.
'js': ['static/src/js/web_uservoice.js'],
'css': ['static/src/css/uservoice.css'],
'qweb' : [
"static/src/xml/*.xml",
],
'images': ['static/src/img/submit_an_idea.jpeg', 'static/src/img/web_uservoice_feedback.jpeg'],
}

View File

@ -1,15 +1,6 @@
openerp.web_uservoice = function(instance) {
var QWeb = instance.web.qweb;
QWeb.add_template('/web_uservoice/static/src/xml/web_uservoice.xml');
$(function() {
var src = ("https:" == document.location.protocol ? "https://" : "http://") + "cdn.uservoice.com/javascripts/widgets/tab.js";
$.getScript(src);
});
instance.web_uservoice.UserVoice = instance.web.Widget.extend({
template: 'Header-UserVoice',
default_forum: '77459',
@ -73,8 +64,15 @@ instance.web_uservoice.UserVoice = instance.web.Widget.extend({
});
instance.webclient.uservoice = new instance.web_uservoice.UserVoice(instance.webclient);
instance.webclient.uservoice.prependTo('div.header_corner');
if (instance.webclient) {
$(function() {
var src = ("https:" == document.location.protocol ? "https://" : "http://") + "cdn.uservoice.com/javascripts/widgets/tab.js";
$.getScript(src);
});
instance.webclient.uservoice = new instance.web_uservoice.UserVoice(instance.webclient);
instance.webclient.uservoice.prependTo('div.header_corner');
}
};