diff --git a/addons/web_chat/__init__.py b/addons/web_chat/__init__.py deleted file mode 100644 index 24f94d24ec0..00000000000 --- a/addons/web_chat/__init__.py +++ /dev/null @@ -1,3 +0,0 @@ - -import chat -import chat_controller diff --git a/addons/web_chat/static/src/xml/chat.xml b/addons/web_chat/static/src/xml/chat.xml deleted file mode 100644 index c6f0499b2b1..00000000000 --- a/addons/web_chat/static/src/xml/chat.xml +++ /dev/null @@ -1,16 +0,0 @@ - - - - -
-
- -
-
- -
- -
-
-
\ No newline at end of file diff --git a/addons/web_im/__init__.py b/addons/web_im/__init__.py new file mode 100644 index 00000000000..399ad665c23 --- /dev/null +++ b/addons/web_im/__init__.py @@ -0,0 +1,3 @@ + +import im +import im_controller diff --git a/addons/web_chat/__openerp__.py b/addons/web_im/__openerp__.py similarity index 92% rename from addons/web_chat/__openerp__.py rename to addons/web_im/__openerp__.py index dd3f3cd0a07..438c33c3e2c 100644 --- a/addons/web_chat/__openerp__.py +++ b/addons/web_im/__openerp__.py @@ -1,5 +1,5 @@ { - 'name' : 'Chat', + 'name' : 'Instant Messaging', 'version': '1.0', 'category': 'Tools', 'complexity': 'easy', diff --git a/addons/web_chat/chat.py b/addons/web_im/im.py similarity index 98% rename from addons/web_chat/chat.py rename to addons/web_im/im.py index 8290fb64bc0..2bf83dbc7d4 100644 --- a/addons/web_chat/chat.py +++ b/addons/web_im/im.py @@ -85,8 +85,8 @@ if openerp.tools.config.options["gevent"]: -class chat_message(osv.osv): - _name = 'chat.message' +class im_message(osv.osv): + _name = 'im.message' _columns = { 'message': fields.char(string="Message", size=200), } diff --git a/addons/web_chat/chat_controller.py b/addons/web_im/im_controller.py similarity index 71% rename from addons/web_chat/chat_controller.py rename to addons/web_im/im_controller.py index 8f22c460fa1..8cd5fe4505e 100644 --- a/addons/web_chat/chat_controller.py +++ b/addons/web_im/im_controller.py @@ -2,10 +2,10 @@ import openerp import openerp.tools.config -import chat +import im class ImportController(openerp.addons.web.http.Controller): - _cp_path = '/chat' + _cp_path = '/im' @openerp.addons.web.http.jsonrequest def poll(self, req, last=None): @@ -13,10 +13,10 @@ class ImportController(openerp.addons.web.http.Controller): raise Exception("Not usable in a server not running gevent") num = 0 while True: - res = req.session.model('chat.message').get_messages(last, req.session.eval_context(req.context)) + res = req.session.model('im.message').get_messages(last, req.session.eval_context(req.context)) if num >= 1 or len(res["res"]) > 0: return res last = res["last"] num += 1 print "waiting" - chat.Watcher.get_watcher(res["dbname"]).stop(30) + im.Watcher.get_watcher(res["dbname"]).stop(30) diff --git a/addons/web_chat/static/src/css/chat.css b/addons/web_im/static/src/css/im.css similarity index 68% rename from addons/web_chat/static/src/css/chat.css rename to addons/web_im/static/src/css/im.css index 887d8b2fef2..e804679cbfc 100644 --- a/addons/web_chat/static/src/css/chat.css +++ b/addons/web_im/static/src/css/im.css @@ -1,11 +1,11 @@ -.openerp .oe_chat { +.openerp .oe_im { position: fixed; background-color: #E8EBEF; width: 220px; border-left: 1px solid #AEB9BD; } -.openerp .oe_topbar_chatbutton{ +.openerp .oe_topbar_imbutton{ } \ No newline at end of file diff --git a/addons/web_chat/static/src/js/chat.js b/addons/web_im/static/src/js/im.js similarity index 75% rename from addons/web_chat/static/src/js/chat.js rename to addons/web_im/static/src/js/im.js index cc3b756931e..dd88d0a611e 100644 --- a/addons/web_chat/static/src/js/chat.js +++ b/addons/web_im/static/src/js/im.js @@ -1,32 +1,32 @@ -openerp.web_chat = function(instance) { +openerp.web_im = function(instance) { instance.web.UserMenu.include({ do_update: function(){ var self = this; this.update_promise.then(function() { - var chat = new instance.web_chat.Chat(self); - chat.appendTo(instance.client.$el); - var button = new instance.web.ChatTopButton(self); - button.chat = chat; + var im = new instance.web_im.InstantMessaging(self); + im.appendTo(instance.client.$el); + var button = new instance.web.IMTopButton(self); + button.im = im; button.appendTo(instance.webclient.$el.find('.oe_systray')); }); return this._super.apply(this, arguments); }, }); - instance.web.ChatTopButton = instance.web.Widget.extend({ - template:'ChatTopButton', + instance.web.IMTopButton = instance.web.Widget.extend({ + template:'IMTopButton', events: { "click button": "clicked", }, clicked: function() { - this.chat.switch_display(); + this.im.switch_display(); }, }); - instance.web_chat.Chat = instance.web.Widget.extend({ - template: "Chat", + instance.web_im.InstantMessaging = instance.web.Widget.extend({ + template: "InstantMessaging", init: function(parent) { this._super(parent); this.shown = false; @@ -40,13 +40,13 @@ openerp.web_chat = function(instance) { $(window).scroll(_.bind(this.calc_box, this)); $(window).resize(_.bind(this.calc_box, this)); self.calc_box(); - self.$(".oe_chat_input").keypress(function(e) { + self.$(".oe_im_input").keypress(function(e) { if(e.which != 13) { return; } - var mes = self.$(".oe_chat_input").val(); - self.$(".oe_chat_input").val(""); - var model = new instance.web.Model("chat.message"); + var mes = self.$(".oe_im_input").val(); + self.$(".oe_im_input").val(""); + var model = new instance.web.Model("im.message"); model.call("post", [mes], {context: new instance.web.CompoundContext()}); }).focus(); }, @@ -78,13 +78,13 @@ openerp.web_chat = function(instance) { }, poll: function() { var self = this; - this.rpc("/chat/poll", { + this.rpc("/im/poll", { last: this.last, context: new instance.web.CompoundContext() }, {shadow: true}).then(function(result) { self.last = result.last; _.each(result.res, function(mes) { - $("
").text(mes).appendTo(self.$(".oe_chat_content")); + $("
").text(mes).appendTo(self.$(".oe_im_content")); }); self.poll(); }, function(unused, e) { diff --git a/addons/web_im/static/src/xml/im.xml b/addons/web_im/static/src/xml/im.xml new file mode 100644 index 00000000000..f87a0c1c531 --- /dev/null +++ b/addons/web_im/static/src/xml/im.xml @@ -0,0 +1,16 @@ + + + + +
+
+ +
+
+ +
+ +
+
+
\ No newline at end of file