Christophe (OpenERP) has proposed merging 
lp:~openerp-dev/openobject-addons/trunk-web_uservoice-chs into 
lp:openobject-addons.

Requested reviews:
  OpenERP Core Team (openerp)

For more details, see:
https://code.launchpad.net/~openerp-dev/openobject-addons/trunk-web_uservoice-chs/+merge/77942
-- 
https://code.launchpad.net/~openerp-dev/openobject-addons/trunk-web_uservoice-chs/+merge/77942
Your team OpenERP R&D Team is subscribed to branch 
lp:~openerp-dev/openobject-addons/trunk-web_uservoice-chs.
=== modified file 'web_uservoice/LICENSE'
--- web_uservoice/LICENSE	2011-01-14 00:11:01 +0000
+++ web_uservoice/LICENSE	2011-10-03 13:59:32 +0000
@@ -1,5 +1,5 @@
 OpenERP, Open Source Management Solution
-Copyright © 2010 OpenERP SA (<http://openerp.com>).
+Copyright © 2010-2011 OpenERP SA (<http://openerp.com>).
 
 This program is free software: you can redistribute it and/or modify
 it under the terms of the GNU Affero General Public License as

=== modified file 'web_uservoice/__init__.py'
--- web_uservoice/__init__.py	2011-01-14 00:11:01 +0000
+++ web_uservoice/__init__.py	2011-10-03 13:59:32 +0000
@@ -1,7 +1,7 @@
 ##############################################################################
 #    
 #    OpenERP, Open Source Management Solution
-#    Copyright (C) 2010 OpenERP s.a. (<http://openerp.com>).
+#    Copyright (C) 2010-2011 OpenERP s.a. (<http://openerp.com>).
 #
 #    This program is free software: you can redistribute it and/or modify
 #    it under the terms of the GNU Affero General Public License as
@@ -17,3 +17,5 @@
 #    along with this program.  If not, see <http://www.gnu.org/licenses/>.     
 #
 ##############################################################################
+
+import controllers

=== modified file 'web_uservoice/__openerp__.py'
--- web_uservoice/__openerp__.py	2011-09-30 18:58:42 +0000
+++ web_uservoice/__openerp__.py	2011-10-03 13:59:32 +0000
@@ -2,7 +2,7 @@
 ##############################################################################
 #
 #    OpenERP, Open Source Management Solution
-#    Copyright (C) 2010 OpenERP s.a. (<http://openerp.com>).
+#    Copyright (C) 2010-2011 OpenERP s.a. (<http://openerp.com>).
 #
 #    This program is free software: you can redistribute it and/or modify
 #    it under the terms of the GNU Affero General Public License as
@@ -20,7 +20,7 @@
 ##############################################################################
 {
     'name': 'Receive User Feedback',
-    'version': '1.0',
+    'version': '2.0',
     'category': 'Tools',
     'complexity': "easy",
     'description': """
@@ -36,5 +36,8 @@
     'installable': True,
     'active': False,
     'certificate': '0040452504963885',
-    'images': ['images/submit_an_idea.jpeg','images/web_uservoice_feedback.jpeg'],
+
+    'js': ['static/src/js/web_uservoice.js'],
+    'css': ['static/src/css/uservoice.css'],
+    'images': ['static/src/img/submit_an_idea.jpeg', 'static/src/img/web_uservoice_feedback.jpeg'],
 }

=== added directory 'web_uservoice/controllers'
=== added file 'web_uservoice/controllers/__init__.py'
--- web_uservoice/controllers/__init__.py	1970-01-01 00:00:00 +0000
+++ web_uservoice/controllers/__init__.py	2011-10-03 13:59:32 +0000
@@ -0,0 +1,21 @@
+##############################################################################
+#
+#    OpenERP, Open Source Management Solution
+#    Copyright (C) 2011 OpenERP SA (<http://openerp.com>).
+#
+#    This program is free software: you can redistribute it and/or modify
+#    it under the terms of the GNU Affero General Public License as
+#    published by the Free Software Foundation, either version 3 of the
+#    License, or (at your option) any later version.
+#
+#    This program is distributed in the hope that it will be useful,
+#    but WITHOUT ANY WARRANTY; without even the implied warranty of
+#    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+#    GNU Affero General Public License for more details.
+#
+#    You should have received a copy of the GNU Affero General Public License
+#    along with this program.  If not, see <http://www.gnu.org/licenses/>.
+#
+##############################################################################
+
+import main

=== added file 'web_uservoice/controllers/main.py'
--- web_uservoice/controllers/main.py	1970-01-01 00:00:00 +0000
+++ web_uservoice/controllers/main.py	2011-10-03 13:59:32 +0000
@@ -0,0 +1,61 @@
+# -*- coding: utf-8 -*-
+#############################################################################
+#
+#    OpenERP, Open Source Management Solution
+#    Copyright (C) 2011 OpenERP SA (<http://openerp.com>).
+#
+#    This program is free software: you can redistribute it and/or modify
+#    it under the terms of the GNU Affero General Public License as
+#    published by the Free Software Foundation, either version 3 of the
+#    License, or (at your option) any later version.
+#
+#    This program is distributed in the hope that it will be useful,
+#    but WITHOUT ANY WARRANTY; without even the implied warranty of
+#    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+#    GNU Affero General Public License for more details.
+#
+#    You should have received a copy of the GNU Affero General Public License
+#    along with this program.  If not, see <http://www.gnu.org/licenses/>.
+#
+##############################################################################
+
+import web.common.dispatch as openerpweb
+
+
+class UserVoiceController(openerpweb.Controller):
+    _cp_path = '/web_uservoice/uv'
+
+    @openerpweb.jsonrequest
+    def forum(self, req, menu_id):
+        menu = ''
+        if menu_id:
+            try:
+                menu_id = int(menu_id)
+            except ValueError:
+                pass
+            else:
+                ctx = dict(lang='NO_LANG')  # force loading original string even if the english have been translated...
+                menus = req.session.model('ir.ui.menu')
+                try:
+                    menu = menus.read([menu_id], ['name'], ctx)[0]['name'] or ''
+                except KeyError:
+                    pass
+
+        general_forum = '77459'
+        forum = {
+            'accounting': '87921',
+            'administration': '87935',
+            'human resources': '87923',
+            'knowledge': '87927',
+            'manufacturing': '87915',
+            'marketing': '87925',
+            'point of sale': '87929',
+            'project': '87919',
+            'purchases': '87911',
+            'sales': '87907',
+            'tools': '87933',
+            'warehouse': '87913',
+        }.get(menu.lower().strip(), general_forum)
+
+        return {'forum': forum}
+

=== removed directory 'web_uservoice/images'
=== added directory 'web_uservoice/static'
=== added directory 'web_uservoice/static/src'
=== added directory 'web_uservoice/static/src/css'
=== renamed file 'web_uservoice/web/static/css/uservoice.css' => 'web_uservoice/static/src/css/uservoice.css'
--- web_uservoice/web/static/css/uservoice.css	2011-01-14 00:11:01 +0000
+++ web_uservoice/static/src/css/uservoice.css	2011-10-03 13:59:32 +0000
@@ -1,7 +1,7 @@
-#corner p.feedback a {
+div.header_corner div.feedback a {
     /*color: #9a0404;*/
 }
-#corner p.feedback img {
+div.header_corner div.feedback img {
     vertical-align: middle;
     margin-right: 0.5em;
 }

=== added directory 'web_uservoice/static/src/img'
=== renamed file 'web_uservoice/images/submit_an_idea.jpeg' => 'web_uservoice/static/src/img/submit_an_idea.jpeg'
=== renamed file 'web_uservoice/web/static/images/uv_favicon.png' => 'web_uservoice/static/src/img/uv_favicon.png'
=== renamed file 'web_uservoice/images/web_uservoice_feedback.jpeg' => 'web_uservoice/static/src/img/web_uservoice_feedback.jpeg'
=== added directory 'web_uservoice/static/src/js'
=== added file 'web_uservoice/static/src/js/web_uservoice.js'
--- web_uservoice/static/src/js/web_uservoice.js	1970-01-01 00:00:00 +0000
+++ web_uservoice/static/src/js/web_uservoice.js	2011-10-03 13:59:32 +0000
@@ -0,0 +1,59 @@
+
+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',
+
+    init: function() {
+        this._super.apply(this, arguments);
+        this.uservoiceOptions = {
+            key: 'openerpsa',
+            host: 'feedback.openerp.com',
+            forum: this.default_forum,
+            lang: 'en',
+            showTab: false
+        };
+
+        instance.webclient.menu.do_menu_click.add_last(this.do_menu_click);
+    },
+
+    start: function() {
+        this._super();
+
+        var self = this;
+        this.$element.find('a').click(function(e) {
+            e.preventDefault();
+            UserVoice.Popin.show(self.uservoiceOptions);
+            return false;
+        });
+    },
+
+
+    do_menu_click: function($clicked_menu, manual) {
+        var id = $clicked_menu.attr('data-menu');
+        if (id) {
+            var self = this;
+            this.rpc('/web_uservoice/uv/forum', {menu_id: id}, function(result) {
+                self.uservoiceOptions.forum = result.forum || self.default_forum;
+            });
+        }
+    },
+
+});
+
+
+instance.webclient.uservoice = new instance.web_uservoice.UserVoice(instance.webclient);
+instance.webclient.uservoice.prependTo('div.header_corner');
+
+};
+

=== added directory 'web_uservoice/static/src/xml'
=== added file 'web_uservoice/static/src/xml/web_uservoice.xml'
--- web_uservoice/static/src/xml/web_uservoice.xml	1970-01-01 00:00:00 +0000
+++ web_uservoice/static/src/xml/web_uservoice.xml	2011-10-03 13:59:32 +0000
@@ -0,0 +1,8 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!-- vim:fdl=1:
+-->
+<templates id="template" xml:space="preserve">
+    <t t-name="Header-UserVoice">
+        <div class="block logout feedback"><a href="#"><img src="/web_uservoice/static/src/img/uv_favicon.png" />feedback</a></div>
+    </t> 
+</templates>

=== removed directory 'web_uservoice/web'
=== removed file 'web_uservoice/web/__init__.py'
--- web_uservoice/web/__init__.py	2011-01-14 00:11:01 +0000
+++ web_uservoice/web/__init__.py	1970-01-01 00:00:00 +0000
@@ -1,22 +0,0 @@
-##############################################################################
-#    
-#    OpenERP, Open Source Management Solution
-#    Copyright (C) 2010 OpenERP s.a. (<http://openerp.com>).
-#
-#    This program is free software: you can redistribute it and/or modify
-#    it under the terms of the GNU Affero General Public License as
-#    published by the Free Software Foundation, either version 3 of the
-#    License, or (at your option) any later version.
-#
-#    This program is distributed in the hope that it will be useful,
-#    but WITHOUT ANY WARRANTY; without even the implied warranty of
-#    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-#    GNU Affero General Public License for more details.
-#
-#    You should have received a copy of the GNU Affero General Public License
-#    along with this program.  If not, see <http://www.gnu.org/licenses/>.     
-#
-##############################################################################
-import editors
-import controllers
-

=== removed file 'web_uservoice/web/controllers.py'
--- web_uservoice/web/controllers.py	2011-02-11 12:25:06 +0000
+++ web_uservoice/web/controllers.py	1970-01-01 00:00:00 +0000
@@ -1,68 +0,0 @@
-# -*- coding: utf-8 -*-
-##############################################################################
-#    
-#    OpenERP, Open Source Management Solution
-#    Copyright (C) 2010 OpenERP s.a. (<http://openerp.com>).
-#
-#    This program is free software: you can redistribute it and/or modify
-#    it under the terms of the GNU Affero General Public License as
-#    published by the Free Software Foundation, either version 3 of the
-#    License, or (at your option) any later version.
-#
-#    This program is distributed in the hope that it will be useful,
-#    but WITHOUT ANY WARRANTY; without even the implied warranty of
-#    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-#    GNU Affero General Public License for more details.
-#
-#    You should have received a copy of the GNU Affero General Public License
-#    along with this program.  If not, see <http://www.gnu.org/licenses/>.     
-#
-##############################################################################
-
-from openerp.controllers import SecuredController
-from openobject import rpc
-from openobject.tools import expose
-import cherrypy
-
-class Root(SecuredController):
-
-    _cp_path = "/openerp"
-
-    @expose(mark_only=True)
-    def menu(self, active=None, next=None):
-        try:
-            menu_id = int(active)
-        except (TypeError, ValueError):
-            menu_id = False
-
-        menus = rpc.RPCProxy("ir.ui.menu")
-        ids = menus.search([('parent_id', '=', False)])
-        if next or active:
-            if not menu_id and ids:
-                menu_id = ids[0]
-
-        menu = ''
-        if menu_id:
-            ctx = dict(lang='NO_LANG')  # force loading original string even if the english have been translated...
-            menu = menus.read([menu_id], ['name'], ctx)[0]['name'] or ''
-
-        general_forum = 77459
-        forum = {
-            'accounting': 87921,
-            'administration': 87935,
-            'human resources': 87923,
-            'knowledge': 87927,
-            'manufacturing': 87915,
-            'marketing': 87925,
-            'point of sale': 87929,
-            'project': 87919,
-            'purchases': 87911,
-            'sales': 87907,
-            'tools': 87933,
-            'warehouse': 87913,
-        }.get(menu.lower().strip(), general_forum)
-
-        cherrypy.request.uservoice_forum = forum
-        return super(Root, self).menu(active, next)
-
-

=== removed file 'web_uservoice/web/editors.py'
--- web_uservoice/web/editors.py	2011-01-18 14:34:52 +0000
+++ web_uservoice/web/editors.py	1970-01-01 00:00:00 +0000
@@ -1,76 +0,0 @@
-# -*- coding: utf-8 -*-
-##############################################################################
-#    
-#    OpenERP, Open Source Management Solution
-#    Copyright (C) 2010-2011 OpenERP s.a. (<http://openerp.com>).
-#
-#    This program is free software: you can redistribute it and/or modify
-#    it under the terms of the GNU Affero General Public License as
-#    published by the Free Software Foundation, either version 3 of the
-#    License, or (at your option) any later version.
-#
-#    This program is distributed in the hope that it will be useful,
-#    but WITHOUT ANY WARRANTY; without even the implied warranty of
-#    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-#    GNU Affero General Public License for more details.
-#
-#    You should have received a copy of the GNU Affero General Public License
-#    along with this program.  If not, see <http://www.gnu.org/licenses/>.     
-#
-##############################################################################
-import openobject.templating
-
-class BaseTemplateEditor(openobject.templating.TemplateEditor):
-    templates = ['/openobject/controllers/templates/base.mako']
-
-    def edit(self, template, template_text):
-        output = super(BaseTemplateEditor, self).edit(template, template_text)
-
-        end_head = output.index('</head>')
-
-        output = output[:end_head] + """
-<link rel="stylesheet" type="text/css" href="/web_uservoice/static/css/uservoice.css"/>
-        """ + output[end_head:]
-
-
-        end_body = output.index('</body>')
-
-        # testing forum: 84397
-        output = output[:end_body] + """
-<script type="text/javascript">
-  var uservoiceOptions = {
-    key: 'openerpsa',
-    host: 'feedback.openerp.com',
-    forum: '${getattr(cp.request, 'uservoice_forum', 77459)}',
-    lang: 'en',
-    showTab: false
-  };
-  function _loadUserVoice() {
-    var s = document.createElement('script');
-    s.src = ("https:" == document.location.protocol ? "https://"; : "http://";) + "cdn.uservoice.com/javascripts/widgets/tab.js";
-    document.getElementsByTagName('head')[0].appendChild(s);
-  }
-  _loadSuper = window.onload;
-  window.onload = (typeof window.onload != 'function') ? _loadUserVoice : function() { _loadSuper(); _loadUserVoice(); };
-</script>
-        """ + output[end_body:]
-
-        return output
-
-
-class HeaderTemplateEditor(openobject.templating.TemplateEditor):
-    templates = ['/openerp/controllers/templates/header.mako']
-
-    def edit(self, template, template_text):
-        output = super(HeaderTemplateEditor, self).edit(template, template_text)
-
-        PAT = '<ul class="tools">'
-
-        ul = output.index(PAT)
-        output = output[:ul] + ("""
-            <p class="logout feedback"><a href="#" onclick="UserVoice.Popin.show(uservoiceOptions); return false;"><img src="/web_uservoice/static/images/uv_favicon.png" />%s</a></p>
-        """ % _('feedback')) + output[ul:]
-
-
-        return output
-

=== removed directory 'web_uservoice/web/static'
=== removed directory 'web_uservoice/web/static/css'
=== removed directory 'web_uservoice/web/static/images'
_______________________________________________
Mailing list: https://launchpad.net/~openerp-dev-gtk
Post to     : [email protected]
Unsubscribe : https://launchpad.net/~openerp-dev-gtk
More help   : https://help.launchpad.net/ListHelp

Reply via email to