diff --git a/addons/web_uservoice/LICENSE b/addons/web_uservoice/LICENSE new file mode 100644 index 00000000000..27a1a4cf453 --- /dev/null +++ b/addons/web_uservoice/LICENSE @@ -0,0 +1,15 @@ +OpenERP, Open Source Management Solution +Copyright © 2010 OpenERP SA (). + +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 Lice +along with this program. If not, see . diff --git a/addons/web_uservoice/__init__.py b/addons/web_uservoice/__init__.py new file mode 100644 index 00000000000..723a87ab410 --- /dev/null +++ b/addons/web_uservoice/__init__.py @@ -0,0 +1,19 @@ +############################################################################## +# +# OpenERP, Open Source Management Solution +# Copyright (C) 2010 OpenERP s.a. (). +# +# 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 . +# +############################################################################## diff --git a/addons/web_uservoice/__openerp__.py b/addons/web_uservoice/__openerp__.py new file mode 100644 index 00000000000..974da96ef0d --- /dev/null +++ b/addons/web_uservoice/__openerp__.py @@ -0,0 +1,34 @@ +# -*- coding: utf-8 -*- +############################################################################## +# +# OpenERP, Open Source Management Solution +# Copyright (C) 2010 OpenERP s.a. (). +# +# 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 . +# +############################################################################## +{ + 'name': 'Add uservoice button in header', + 'version': '1.0', + 'category': 'Generic Modules/Others', + 'description': "", + 'author': 'OpenERP s.a.', + 'website': 'http://openerp.com', + 'depends': ['base'], + 'data': [], + 'installable': True, + 'active': False, + 'web': True, + 'certificate': '0040452504963885', +} diff --git a/addons/web_uservoice/web/__init__.py b/addons/web_uservoice/web/__init__.py new file mode 100644 index 00000000000..c651b91f353 --- /dev/null +++ b/addons/web_uservoice/web/__init__.py @@ -0,0 +1,22 @@ +############################################################################## +# +# OpenERP, Open Source Management Solution +# Copyright (C) 2010 OpenERP s.a. (). +# +# 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 . +# +############################################################################## +import editors +import controllers + diff --git a/addons/web_uservoice/web/controllers.py b/addons/web_uservoice/web/controllers.py new file mode 100644 index 00000000000..af3730b07b0 --- /dev/null +++ b/addons/web_uservoice/web/controllers.py @@ -0,0 +1,68 @@ +# -*- coding: utf-8 -*- +############################################################################## +# +# OpenERP, Open Source Management Solution +# Copyright (C) 2010 OpenERP s.a. (). +# +# 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 . +# +############################################################################## + +from openerp.controllers import SecuredController +from openerp.utils 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) + + diff --git a/addons/web_uservoice/web/editors.py b/addons/web_uservoice/web/editors.py new file mode 100644 index 00000000000..36086d5d8b6 --- /dev/null +++ b/addons/web_uservoice/web/editors.py @@ -0,0 +1,75 @@ +# -*- coding: utf-8 -*- +############################################################################## +# +# OpenERP, Open Source Management Solution +# Copyright (C) 2010 OpenERP s.a. (). +# +# 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 . +# +############################################################################## +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('') + + output = output[:end_head] + """ + + """ + output[end_head:] + + + end_body = output.index('') + + # testing forum: 84397 + output = output[:end_body] + """ + + """ + 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 = output.index(PAT) + output = output[:ul] + """ + + """ + output[ul:] + + return output + diff --git a/addons/web_uservoice/web/static/css/uservoice.css b/addons/web_uservoice/web/static/css/uservoice.css new file mode 100644 index 00000000000..9ca2af55678 --- /dev/null +++ b/addons/web_uservoice/web/static/css/uservoice.css @@ -0,0 +1,7 @@ +#corner p.feedback a { + /*color: #9a0404;*/ +} +#corner p.feedback img { + vertical-align: middle; + margin-right: 0.5em; +}