Renammed modules

bzr revid: nicolas.vanhoren@openerp.com-20130315112153-ftm3i021erfnqp01
This commit is contained in:
niv-openerp 2013-03-15 12:21:53 +01:00
parent 83eddaef17
commit 296b9fbbb4
43 changed files with 78 additions and 78 deletions

View File

@ -0,0 +1,2 @@
import im_livechat

View File

@ -15,14 +15,14 @@ chat operators.
""",
'data': [
"security/live_support_security.xml",
"security/im_livechat_security.xml",
"security/ir.model.access.csv",
"live_support_view.xml",
"im_livechat_view.xml",
],
'demo': [
"live_support_demo.xml",
"im_livechat_demo.xml",
],
'depends' : ["web_im", "mail", "portal_anonymous"],
'depends' : ["im", "mail", "portal_anonymous"],
'installable': True,
'auto_install': False,
'application': True,

View File

@ -20,7 +20,7 @@
##############################################################################
import openerp
import openerp.addons.web_im.im as im
import openerp.addons.im.im as im
import json
import random
import jinja2
@ -28,13 +28,13 @@ from openerp.osv import osv, fields
from openerp import tools
env = jinja2.Environment(
loader=jinja2.PackageLoader('openerp.addons.live_support', "."),
loader=jinja2.PackageLoader('openerp.addons.im_livechat', "."),
autoescape=False
)
env.filters["json"] = json.dumps
class ImportController(openerp.addons.web.http.Controller):
_cp_path = '/live_support'
_cp_path = '/im_livechat'
@openerp.addons.web.http.httprequest
def loader(self, req, **kwargs):
@ -46,7 +46,7 @@ class ImportController(openerp.addons.web.http.Controller):
req.session._uid = None
req.session._login = "anonymous"
req.session._password = "anonymous"
info = req.session.model('live_support.channel').get_info_for_chat_src(channel)
info = req.session.model('im_livechat.channel').get_info_for_chat_src(channel)
info["db"] = db
info["channel"] = channel
info["userName"] = user_name
@ -62,8 +62,8 @@ class ImportController(openerp.addons.web.http.Controller):
req.session._uid = None
req.session._login = "anonymous"
req.session._password = "anonymous"
script = req.session.model('live_support.channel').read(channel, ["script"])["script"]
info = req.session.model('live_support.channel').get_info_for_chat_src(channel)
script = req.session.model('im_livechat.channel').read(channel, ["script"])["script"]
info = req.session.model('im_livechat.channel').get_info_for_chat_src(channel)
info["script"] = script
return req.make_response(env.get_template("web_page.html").render(info),
headers=[('Content-Type', "text/html")])
@ -74,13 +74,13 @@ class ImportController(openerp.addons.web.http.Controller):
req.session._uid = None
req.session._login = "anonymous"
req.session._password = "anonymous"
return req.session.model('live_support.channel').get_available_user(channel) > 0
return req.session.model('im_livechat.channel').get_available_user(channel) > 0
class live_support_channel(osv.osv):
_name = 'live_support.channel'
class im_livechat_channel(osv.osv):
_name = 'im_livechat.channel'
def _get_default_image(self, cr, uid, context=None):
image_path = openerp.modules.get_module_resource('live_support', 'static/src/img', 'default.png')
image_path = openerp.modules.get_module_resource('im_livechat', 'static/src/img', 'default.png')
return tools.image_resize_image_big(open(image_path, 'rb').read().encode('base64'))
def _get_image(self, cr, uid, ids, name, args, context=None):
result = dict.fromkeys(ids, False)
@ -114,12 +114,12 @@ class live_support_channel(osv.osv):
res = {}
for record in self.browse(cr, uid, ids, context=context):
res[record.id] = self.pool.get('ir.config_parameter').get_param(cr, uid, 'web.base.url') + \
"/live_support/web_page?p=" + json.dumps({"db":cr.dbname, "channel":record.id})
"/im_livechat/web_page?p=" + json.dumps({"db":cr.dbname, "channel":record.id})
return res
_columns = {
'name': fields.char(string="Channel Name", size=200, required=True),
'user_ids': fields.many2many('res.users', 'live_support_channel_im_user', 'channel_id', 'user_id', string="Users"),
'user_ids': fields.many2many('res.users', 'im_livechat_channel_im_user', 'channel_id', 'user_id', string="Users"),
'are_you_inside': fields.function(_are_you_inside, type='boolean', string='Are you inside the matrix?', store=False),
'script': fields.function(_script, type='text', string='Script', store=False),
'web_page': fields.function(_web_page, type='url', string='Web Page', store=False, size="200"),
@ -132,7 +132,7 @@ class live_support_channel(osv.osv):
'image_medium': fields.function(_get_image, fnct_inv=_set_image,
string="Medium-sized photo", type="binary", multi="_get_image",
store={
'live_support.channel': (lambda self, cr, uid, ids, c={}: ids, ['image'], 10),
'im_livechat.channel': (lambda self, cr, uid, ids, c={}: ids, ['image'], 10),
},
help="Medium-sized photo of the group. It is automatically "\
"resized as a 128x128px image, with aspect ratio preserved. "\
@ -140,7 +140,7 @@ class live_support_channel(osv.osv):
'image_small': fields.function(_get_image, fnct_inv=_set_image,
string="Small-sized photo", type="binary", multi="_get_image",
store={
'live_support.channel': (lambda self, cr, uid, ids, c={}: ids, ['image'], 10),
'im_livechat.channel': (lambda self, cr, uid, ids, c={}: ids, ['image'], 10),
},
help="Small-sized photo of the group. It is automatically "\
"resized as a 64x64px image, with aspect ratio preserved. "\

View File

@ -2,12 +2,12 @@
<openerp>
<data>
<record id="channel_website" model="live_support.channel">
<record id="channel_website" model="im_livechat.channel">
<field name="name">YourWebsite.com</field>
<field name="default_message">Hello, how may I help you?</field>
</record>
<record id="group_live_support" model="res.groups">
<record id="group_im_livechat" model="res.groups">
<field name="users" eval="[(4, ref('base.user_demo'))]"/>
</record>

View File

@ -1,11 +1,11 @@
<?xml version="1.0"?>
<openerp>
<data>
<menuitem id="live_support" name="Live Chat" parent="mail.mail_feeds_main" groups="group_live_support"/>
<menuitem id="im_livechat" name="Live Chat" parent="mail.mail_feeds_main" groups="group_im_livechat"/>
<record model="ir.actions.act_window" id="action_support_channels">
<field name="name">Live Chat Channels</field>
<field name="res_model">live_support.channel</field>
<field name="res_model">im_livechat.channel</field>
<field name="view_mode">kanban,form</field>
<field name="help" type="html">
<p class="oe_view_nocontent_create">
@ -20,12 +20,12 @@
</p>
</field>
</record>
<menuitem name="Channels" parent="live_support" id="support_channels" action="action_support_channels" groups="group_live_support"/>
<menuitem name="Channels" parent="im_livechat" id="support_channels" action="action_support_channels" groups="group_im_livechat"/>
<record model="ir.ui.view" id="support_channel_kanban">
<field name="name">support_channel.kanban</field>
<field name="model">live_support.channel</field>
<field name="model">im_livechat.channel</field>
<field name="arch" type="xml">
<kanban>
<field name="name"/>
@ -35,7 +35,7 @@
<templates>
<t t-name="kanban-box">
<div class="oe_group_image">
<a type="open"><img t-att-src="kanban_image('live_support.channel', 'image_medium', record.id.value)" class="oe_group_photo"/></a>
<a type="open"><img t-att-src="kanban_image('im_livechat.channel', 'image_medium', record.id.value)" class="oe_group_photo"/></a>
</div>
<div class="oe_group_details">
<h4><a type="open"><field name="name"/></a></h4>
@ -58,7 +58,7 @@
<record id="support_channel_form" model="ir.ui.view">
<field name="name">support_channel.form</field>
<field name="model">live_support.channel</field>
<field name="model">im_livechat.channel</field>
<field name="arch" type="xml">
<form string="Support Channels" version="7.0">
<sheet>
@ -126,7 +126,7 @@
<field name="view_mode">list</field>
<field name="domain">["|", ('to_id.user', '=', None), ('from_id.user', '=', None)]</field>
</record>
<menuitem name="History" parent="live_support" id="history" action="action_history" groups="group_live_support_manager"/>
<menuitem name="History" parent="im_livechat" id="history" action="action_history" groups="group_im_livechat_manager"/>
<record id="im_message_form" model="ir.ui.view">
<field name="name">im.message.tree</field>

View File

@ -0,0 +1,2 @@
<script type="text/javascript" src="{{url}}/im_livechat/static/ext/static/js/require.js"></script>
<script type="text/javascript" src='{{url}}/im_livechat/loader?p={{parameters | json | escape}}'></script>

View File

@ -1,7 +1,7 @@
require.config({
context: "oelivesupport",
baseUrl: {{url | json}} + "/live_support/static/ext/static/js",
baseUrl: {{url | json}} + "/im_livechat/static/ext/static/js",
shim: {
underscore: {
init: function() {
@ -18,7 +18,7 @@ require.config({
buttonText: {{buttonText | json}},
inputPlaceholder: {{inputPlaceholder | json}},
defaultMessage: {{(defaultMessage or None) | json}},
auto: window.oe_live_support_auto || false,
auto: window.oe_im_livechat_auto || false,
userName: {{userName | json}} || undefined,
});
});

View File

@ -2,29 +2,29 @@
<openerp>
<data>
<record id="module_category_live_support" model="ir.module.category">
<record id="module_category_im_livechat" model="ir.module.category">
<field name="name">Live Support</field>
<field name="sequence" eval="20" />
</record>
<record id="group_live_support" model="res.groups">
<record id="group_im_livechat" model="res.groups">
<field name="name">User</field>
<field name="category_id" ref="module_category_live_support"/>
<field name="category_id" ref="module_category_im_livechat"/>
<field name="comment">The user will be able to join support channels.</field>
</record>
<record id="group_live_support_manager" model="res.groups">
<record id="group_im_livechat_manager" model="res.groups">
<field name="name">Manager</field>
<field name="comment">The user will be able to delete support channels.</field>
<field name="category_id" ref="module_category_live_support"/>
<field name="implied_ids" eval="[(4, ref('live_support.group_live_support'))]"/>
<field name="category_id" ref="module_category_im_livechat"/>
<field name="implied_ids" eval="[(4, ref('im_livechat.group_im_livechat'))]"/>
<field name="users" eval="[(4, ref('base.user_root'))]"/>
</record>
<record id="message_rule_1" model="ir.rule">
<field name="name">Live Support Managers can read messages from live support</field>
<field name="model_id" ref="web_im.model_im_message"/>
<field name="groups" eval="[(6,0,[ref('live_support.group_live_support_manager')])]"/>
<field name="model_id" ref="im.model_im_message"/>
<field name="groups" eval="[(6,0,[ref('im_livechat.group_im_livechat_manager')])]"/>
<field name="domain_force">["|", ('to_id.user', '=', None), ('from_id.user', '=', None)]</field>
<field name="perm_unlink" eval="0"/>
<field name="perm_write" eval="0"/>

View File

@ -0,0 +1,6 @@
id,name,model_id:id,group_id:id,perm_read,perm_write,perm_create,perm_unlink
access_ls_chann1,im_livechat.channel,model_im_livechat_channel,,1,0,0,0
access_ls_chann2,im_livechat.channel,model_im_livechat_channel,group_im_livechat,1,1,1,0
access_ls_chann3,im_livechat.channel,model_im_livechat_channel,group_im_livechat_manager,1,1,1,1
access_ls_message,im_livechat.im.message,im.model_im_message,portal.group_anonymous,0,0,0,0
access_im_user,im_livechat.im.user,im.model_im_user,portal.group_anonymous,1,0,0,0
1 id name model_id:id group_id:id perm_read perm_write perm_create perm_unlink
2 access_ls_chann1 im_livechat.channel model_im_livechat_channel 1 0 0 0
3 access_ls_chann2 im_livechat.channel model_im_livechat_channel group_im_livechat 1 1 1 0
4 access_ls_chann3 im_livechat.channel model_im_livechat_channel group_im_livechat_manager 1 1 1 1
5 access_ls_message im_livechat.im.message im.model_im_message portal.group_anonymous 0 0 0 0
6 access_im_user im_livechat.im.user im.model_im_user portal.group_anonymous 1 0 0 0

View File

Before

Width:  |  Height:  |  Size: 6.3 KiB

After

Width:  |  Height:  |  Size: 6.3 KiB

View File

Before

Width:  |  Height:  |  Size: 74 B

After

Width:  |  Height:  |  Size: 74 B

View File

Before

Width:  |  Height:  |  Size: 12 KiB

After

Width:  |  Height:  |  Size: 12 KiB

View File

Before

Width:  |  Height:  |  Size: 830 B

After

Width:  |  Height:  |  Size: 830 B

View File

Before

Width:  |  Height:  |  Size: 3.5 KiB

After

Width:  |  Height:  |  Size: 3.5 KiB

View File

Before

Width:  |  Height:  |  Size: 100 KiB

After

Width:  |  Height:  |  Size: 100 KiB

View File

@ -37,7 +37,7 @@ define(["nova", "underscore", "oeclient", "require", "jquery",
$.when.apply($, defs).then(function() {
console.log("starting live support customer app");
connection = new oeclient.Connection(new oeclient.JsonpRPCConnector(server_url), db, login, password);
connection.connector.call("/live_support/available", {db: db, channel: channel}).then(function(activated) {
connection.connector.call("/im_livechat/available", {db: db, channel: channel}).then(function(activated) {
if (! activated & ! options.auto)
return;
var button = new livesupport.ChatButton(null, channel, options);
@ -99,7 +99,7 @@ define(["nova", "underscore", "oeclient", "require", "jquery",
var self = this;
if (this.manager.conversations.length > 0)
return;
connection.getModel("live_support.channel").call("get_available_user", [this.channel]).then(function(user_id) {
connection.getModel("im_livechat.channel").call("get_available_user", [this.channel]).then(function(user_id) {
if (! user_id) {
notification("None of our collaborators seems to be available, please try again later.");
return;

View File

@ -0,0 +1,10 @@
<!DOCTYPE html>
<html>
<head>
<script type="text/javascript" src="http://localhost/im_livechat/static/ext/static/js/require.js"></script>
<script type="text/javascript" src='http://localhost/im_livechat/loader?p={"db":"test","channel":1}'></script>
</head>
<body style="height:100%; margin:0; padding:0;">
<iframe src="http://openerp.com" height="100%" width=100%"></iframe>
</body>
</html>

View File

Before

Width:  |  Height:  |  Size: 16 KiB

After

Width:  |  Height:  |  Size: 16 KiB

View File

Before

Width:  |  Height:  |  Size: 16 KiB

After

Width:  |  Height:  |  Size: 16 KiB

View File

@ -2,7 +2,7 @@
<html>
<head>
<script type="text/javascript">
window.oe_live_support_auto = true;
window.oe_im_livechat_auto = true;
</script>
{{script}}
<style type="text/css">

View File

@ -1,2 +0,0 @@
import live_support

View File

@ -1,2 +0,0 @@
<script type="text/javascript" src="{{url}}/live_support/static/ext/static/js/require.js"></script>
<script type="text/javascript" src='{{url}}/live_support/loader?p={{parameters | json | escape}}'></script>

View File

@ -1,6 +0,0 @@
id,name,model_id:id,group_id:id,perm_read,perm_write,perm_create,perm_unlink
access_ls_chann1,live_support.channel,model_live_support_channel,,1,0,0,0
access_ls_chann2,live_support.channel,model_live_support_channel,group_live_support,1,1,1,0
access_ls_chann3,live_support.channel,model_live_support_channel,group_live_support_manager,1,1,1,1
access_ls_message,live_support.im.message,web_im.model_im_message,portal.group_anonymous,0,0,0,0
access_im_user,live_support.im.user,web_im.model_im_user,portal.group_anonymous,1,0,0,0
1 id name model_id:id group_id:id perm_read perm_write perm_create perm_unlink
2 access_ls_chann1 live_support.channel model_live_support_channel 1 0 0 0
3 access_ls_chann2 live_support.channel model_live_support_channel group_live_support 1 1 1 0
4 access_ls_chann3 live_support.channel model_live_support_channel group_live_support_manager 1 1 1 1
5 access_ls_message live_support.im.message web_im.model_im_message portal.group_anonymous 0 0 0 0
6 access_im_user live_support.im.user web_im.model_im_user portal.group_anonymous 1 0 0 0

View File

@ -1,10 +0,0 @@
<!DOCTYPE html>
<html>
<head>
<script type="text/javascript" src="http://localhost/live_support/static/ext/static/js/require.js"></script>
<script type="text/javascript" src='http://localhost/live_support/loader?p={"db":"test","channel":1}'></script>
</head>
<body style="height:100%; margin:0; padding:0;">
<iframe src="http://openerp.com" height="100%" width=100%"></iframe>
</body>
</html>

View File

@ -15,7 +15,7 @@ chat in real time. It support several chats in parallel.
""",
'data': [
'security/ir.model.access.csv',
'security/web_im_security.xml',
'security/im_security.xml',
],
'depends' : ['base'],
'js': ['static/src/js/*.js'],

View File

@ -1,5 +1,5 @@
openerp.web_im = function(instance) {
openerp.im = function(instance) {
var USERS_LIMIT = 20;
var ERROR_DELAY = 5000;
@ -12,9 +12,9 @@ openerp.web_im = function(instance) {
do_update: function(){
var self = this;
this.update_promise.then(function() {
var im = new instance.web_im.InstantMessaging(self);
var im = new instance.im.InstantMessaging(self);
im.appendTo(instance.client.$el);
var button = new instance.web_im.ImTopButton(this);
var button = new instance.im.ImTopButton(this);
button.on("clicked", im, im.switch_display);
button.appendTo(instance.webclient.$el.find('.oe_systray'));
});
@ -22,7 +22,7 @@ openerp.web_im = function(instance) {
},
});
instance.web_im.ImTopButton = instance.web.Widget.extend({
instance.im.ImTopButton = instance.web.Widget.extend({
template:'ImTopButton',
events: {
"click": "clicked",
@ -32,7 +32,7 @@ openerp.web_im = function(instance) {
},
});
instance.web_im.InstantMessaging = instance.web.Widget.extend({
instance.im.InstantMessaging = instance.web.Widget.extend({
template: "InstantMessaging",
events: {
"keydown .oe_im_searchbox": "input_change",
@ -45,7 +45,7 @@ openerp.web_im = function(instance) {
this.set("right_offset", 0);
this.set("current_search", "");
this.users = [];
this.c_manager = new instance.web_im.ConversationManager(this);
this.c_manager = new instance.im.ConversationManager(this);
this.on("change:right_offset", this.c_manager, _.bind(function() {
this.c_manager.set("right_offset", this.get("right_offset"));
}, this));
@ -85,7 +85,7 @@ openerp.web_im = function(instance) {
var old_users = self.users;
self.users = [];
_.each(result, function(user) {
var widget = new instance.web_im.UserWidget(self, self.c_manager.get_user(user.id));
var widget = new instance.im.UserWidget(self, self.c_manager.get_user(user.id));
widget.appendTo(self.$(".oe_im_users"));
widget.on("activate_user", self, self.activate_user);
self.users.push(widget);
@ -122,7 +122,7 @@ openerp.web_im = function(instance) {
},
});
instance.web_im.UserWidget = instance.web.Widget.extend({
instance.im.UserWidget = instance.web.Widget.extend({
"template": "UserWidget",
events: {
"click": "activate_user",
@ -148,10 +148,10 @@ openerp.web_im = function(instance) {
},
});
instance.web_im.ImUser = instance.web.Class.extend(instance.web.PropertiesMixin, {
instance.im.ImUser = instance.web.Class.extend(instance.web.PropertiesMixin, {
init: function(parent, user_rec) {
instance.web.PropertiesMixin.init.call(this, parent);
user_rec.image_url = instance.session.url("/web_im/static/src/img/avatar/avatar.jpeg");
user_rec.image_url = instance.session.url("/im/static/src/img/avatar/avatar.jpeg");
if (user_rec.user)
user_rec.image_url = instance.session.url('/web/binary/image', {model:'res.users', field: 'image_small', id: user_rec.user[0]});
this.set(user_rec);
@ -173,7 +173,7 @@ openerp.web_im = function(instance) {
},
});
instance.web_im.ConversationManager = instance.web.Controller.extend({
instance.im.ConversationManager = instance.web.Controller.extend({
init: function(parent) {
this._super(parent);
this.set("right_offset", 0);
@ -241,7 +241,7 @@ openerp.web_im = function(instance) {
add_to_user_cache: function(user_recs) {
_.each(user_recs, function(user_rec) {
if (! this.users_cache[user_rec.id]) {
var user = new instance.web_im.ImUser(this, user_rec);
var user = new instance.im.ImUser(this, user_rec);
this.users_cache[user_rec.id] = user;
user.on("destroyed", this, function() {
delete this.users_cache[user_rec.id];
@ -285,7 +285,7 @@ openerp.web_im = function(instance) {
},
create_ting: function() {
var kitten = jQuery.param !== undefined && jQuery.deparam(jQuery.param.querystring()).kitten !== undefined;
this.ting = new Audio(instance.webclient.session.origin + "/web_im/static/src/audio/" + (kitten ? "purr" : "Ting") +
this.ting = new Audio(instance.webclient.session.origin + "/im/static/src/audio/" + (kitten ? "purr" : "Ting") +
(new Audio().canPlayType("audio/ogg; codecs=vorbis") ? ".ogg" : ".mp3"));
},
window_focus_change: function() {
@ -302,7 +302,7 @@ openerp.web_im = function(instance) {
activate_user: function(user, focus) {
var conv = this.users[user.get('id')];
if (! conv) {
conv = new instance.web_im.Conversation(this, user, this.me);
conv = new instance.im.Conversation(this, user, this.me);
conv.appendTo(instance.client.$el);
conv.on("destroyed", this, function() {
this.conversations = _.without(this.conversations, conv);
@ -341,7 +341,7 @@ openerp.web_im = function(instance) {
},
});
instance.web_im.Conversation = instance.web.Widget.extend({
instance.im.Conversation = instance.web.Widget.extend({
"template": "Conversation",
events: {
"keydown input": "send_message",

View File

@ -24,13 +24,13 @@
<img t-att-src='widget.user.get("image_url")' class="oe_im_user_avatar"/>
</span>
<span class="oe_im_user_name"><t t-esc="widget.user.get('name')"/></span>
<img t-att-src="_s +'/web_im/static/src/img/green.png'" class="oe_im_user_online"/>
<img t-att-src="_s +'/im/static/src/img/green.png'" class="oe_im_user_online"/>
</div>
</t>
<t t-name="Conversation">
<div class="oe_im_chatview">
<div class="oe_im_chatview_header">
<img t-att-src="_s +'/web_im/static/src/img/green.png'" class="oe_im_chatview_online"/>
<img t-att-src="_s +'/im/static/src/img/green.png'" class="oe_im_chatview_online"/>
<t t-esc="widget.user.get('name') || 'Anonymous'"/>
<scan class="oe_im_chatview_nbr_messages" />
<button class="oe_im_chatview_close">×</button>