diff options
| author | Harry (OpenERP) <hmo@tinyerp.com> | 2011-12-14 17:59:24 +0530 |
|---|---|---|
| committer | Harry (OpenERP) <hmo@tinyerp.com> | 2011-12-14 17:59:24 +0530 |
| commit | 092f97b32b35af6a40b9d2ae70c3159da2fb235f (patch) | |
| tree | 2974d3719af9338cd0b1814da900d7e9ca8d4779 /addons/web_livechat | |
| parent | 593f5f571bbc49673975afc405e9345ef3457b92 (diff) | |
| parent | e36dc8c5e3ca3da1474747bae5ec87fea19b23b8 (diff) | |
[MERGE] merged with trunk-development-branch
bzr revid: hmo@tinyerp.com-20111214122924-izzibrz1yz67rt7g
Diffstat (limited to 'addons/web_livechat')
| -rw-r--r-- | addons/web_livechat/__openerp__.py | 2 | ||||
| -rw-r--r-- | addons/web_livechat/i18n/hr.po | 41 | ||||
| -rw-r--r-- | addons/web_livechat/publisher_warranty.py | 4 | ||||
| -rw-r--r-- | addons/web_livechat/static/src/js/web_livechat.js | 53 |
4 files changed, 85 insertions, 15 deletions
diff --git a/addons/web_livechat/__openerp__.py b/addons/web_livechat/__openerp__.py index 66d365b5636..c8ef0fe0b23 100644 --- a/addons/web_livechat/__openerp__.py +++ b/addons/web_livechat/__openerp__.py @@ -21,7 +21,7 @@ { 'name': 'Live Chat Support', 'version': '2.0', - 'category': 'Hidden', + 'category': 'Tools', 'complexity': "easy", 'description': """ Enable live chat support for those who have a maintenance contract. diff --git a/addons/web_livechat/i18n/hr.po b/addons/web_livechat/i18n/hr.po new file mode 100644 index 00000000000..7899f56b8d5 --- /dev/null +++ b/addons/web_livechat/i18n/hr.po @@ -0,0 +1,41 @@ +# Croatian translation for openobject-addons +# Copyright (c) 2011 Rosetta Contributors and Canonical Ltd 2011 +# This file is distributed under the same license as the openobject-addons package. +# FIRST AUTHOR <EMAIL@ADDRESS>, 2011. +# +msgid "" +msgstr "" +"Project-Id-Version: openobject-addons\n" +"Report-Msgid-Bugs-To: FULL NAME <EMAIL@ADDRESS>\n" +"POT-Creation-Date: 2011-01-11 11:16+0000\n" +"PO-Revision-Date: 2011-12-08 15:20+0000\n" +"Last-Translator: Tomislav Bosnjakovic <Unknown>\n" +"Language-Team: Croatian <hr@li.org>\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" +"X-Launchpad-Export-Date: 2011-12-09 04:46+0000\n" +"X-Generator: Launchpad (build 14450)\n" + +#. module: web_livechat +#: sql_constraint:publisher_warranty.contract:0 +msgid "" +"Your publisher warranty contract is already subscribed in the system !" +msgstr "" +"Your publisher warranty contract is already subscribed in the system !\r\n" +"Vaš garancijski ugovor je već unesen u sustav!" + +#. module: web_livechat +#: model:ir.module.module,shortdesc:web_livechat.module_meta_information +msgid "Live Chat Support" +msgstr "Podrška za Live Chat" + +#. module: web_livechat +#: model:ir.model,name:web_livechat.model_publisher_warranty_contract +msgid "publisher_warranty.contract" +msgstr "garancijski ugovor" + +#. module: web_livechat +#: model:ir.module.module,description:web_livechat.module_meta_information +msgid "Enable live chat support for whom have a maintenance contract" +msgstr "Omogući podršku za Live Chat za one koji imaju ugovor o održavanju" diff --git a/addons/web_livechat/publisher_warranty.py b/addons/web_livechat/publisher_warranty.py index b0a7e793ecf..a3b59811ff8 100644 --- a/addons/web_livechat/publisher_warranty.py +++ b/addons/web_livechat/publisher_warranty.py @@ -26,7 +26,7 @@ def _gen_cache_clear(method): def func(self, cr, *args, **kwargs): s = super(publisher_warranty_contract, self) r = getattr(s, method)(cr, *args, **kwargs) - self.is_livechat_enable.clear_cache(cr.dbname) + self.is_livechat_enable.clear_cache(self) return r return func @@ -44,7 +44,7 @@ class publisher_warranty_contract(osv.osv): @cache(skiparg=3) def get_default_livechat_text(self, cr, uid): - return '<a href="http://www.openerp.com/support-or-publisher-warranty-contract" target="_blank"><img src="/web_livechat/static/src/img/busy.png"/>Support</a>' + return '<a href="#" target="_blank"><img src="/web_livechat/static/src/img/busy.png"/>Support</a>' publisher_warranty_contract() diff --git a/addons/web_livechat/static/src/js/web_livechat.js b/addons/web_livechat/static/src/js/web_livechat.js index 13c4bbe28d4..e35b726ef77 100644 --- a/addons/web_livechat/static/src/js/web_livechat.js +++ b/addons/web_livechat/static/src/js/web_livechat.js @@ -33,7 +33,16 @@ openerp.web_livechat.Livechat = openerp.web.Widget.extend({ var pwc = new openerp.web.Model(self.session, "publisher_warranty.contract"); pwc.get_func('get_default_livechat_text')().then(function(text) { self.$element.html(text); + console.log('receiving text', text); self.do_update(); + pwc.get_func('is_livechat_enable')().then(function(res) { + console.log('result', res); + if(res) { + self.$element.click(self.do_load_livechat); + } else { + self.do_action({type: 'ir.act.url', url: 'http://www.openerp.com/support-or-publisher-warranty-contract'}); + } + }) }); openerp.webclient.header.do_update.add_last(this.do_update); @@ -45,7 +54,14 @@ openerp.web_livechat.Livechat = openerp.web.Widget.extend({ self.$element.remove(); return; } - + }, + + do_load_livechat: function(evt) { + evt.preventDefault(); + var self = this; + + this.$element.unbind('click', this.do_load_livechat); + var lc_id = _.uniqueId('livechat_'); this.$element.attr('id', lc_id); @@ -56,6 +72,8 @@ openerp.web_livechat.Livechat = openerp.web.Widget.extend({ if(!res) { //return; } + // connect to LiveChat + __lc_load(); __lc_buttons.push({ elementId: lc_id, //'livechat_status', @@ -77,17 +95,28 @@ if (openerp.webclient) { 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(); + __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)); + } // and add widget to webclient openerp.webclient.livechat = new openerp.web_livechat.Livechat(openerp.webclient); |
