[FIX] adpat web modules to changes in webclient
authorChristophe Simonis <chs@openerp.com>
Thu, 10 Nov 2011 10:21:53 +0000 (11:21 +0100)
committerChristophe Simonis <chs@openerp.com>
Thu, 10 Nov 2011 10:21:53 +0000 (11:21 +0100)
[FIX] enable some web module only when there is a webclient (prepare embed)

bzr revid: chs@openerp.com-20111110102153-pgktyws0gdgyq4f5

addons/pad/__openerp__.py
addons/pad/static/src/js/pad.js
addons/share/__openerp__.py
addons/share/static/src/js/share.js
addons/web_livechat/__openerp__.py
addons/web_livechat/static/src/js/web_livechat.js
addons/web_uservoice/__openerp__.py
addons/web_uservoice/static/src/js/web_uservoice.js

index 9bbeb55..1abf8f0 100644 (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'],
 }
index d6f2c1d..acc91f2 100644 (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);
index 954f915..b907710 100644 (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'],
 }
 
index 6d02a39..b2abc18 100644 (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 {
index 0731b00..750c4ca 100644 (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',
index 6fed859..13c4bbe 100644 (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');
+}
 
 };
index 65f953e..64b443b 100644 (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'],
 }
index a574652..4110f14 100644 (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');
+}
 
 };