[IMP] survey: add help message and add a bridge module between portal_anonymous and portal

bzr revid: chm@openerp.com-20130308105242-k01oh3g4j59jcgsg
This commit is contained in:
Christophe Matthieu
2013-03-08 11:52:42 +01:00
parent 89bef3e26a
commit d087d7c690
7 changed files with 90 additions and 13 deletions
@@ -0,0 +1 @@
import portal_anonymous_survey
@@ -0,0 +1,18 @@
{
'name': 'Anonymous portal for Survey',
'version': '0.1',
'category': 'Tools',
'complexity': 'easy',
'description': """
This module adds authenticate options to survey and portal anonymous are installed.
===================================================================================
""",
'author': 'OpenERP SA',
'depends': ['survey','portal_anonymous'],
'data': [
'portal_anonymous_survey_view.xml',
],
'installable': True,
'auto_install': True,
'category': 'Hidden',
}
@@ -0,0 +1,30 @@
# -*- encoding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# Copyright (C) 2004-TODAY OpenERP S.A. <http: //www.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/>.
#
##############################################################################
class portal_anonymous_survey(osv.osv):
_inherit = "survey"
_defaults = {
'authenticate': False,
}
portal_anonymous_survey()
# vim: exp and tab: smartindent: tabstop=4: softtabstop=4: shiftwidth=4:
@@ -0,0 +1,15 @@
<?xml version="1.0" encoding="utf-8"?>
<openerp>
<data>
<record id="portal_anonymous_survey_view_form" model="ir.ui.view">
<field name="name">portal.anonymous.survey</field>
<field name="model">survey</field>
<field name="inherit_id" ref="survey.survey_form"/>
<field name="arch" type="xml">
<xpath expr="//div[@name='authenticate']" position="replace">
<field name="authenticate"/>
</xpath>
</field>
</record>
</data>
</openerp>
+14 -4
View File
@@ -58,16 +58,26 @@
}
.openerp .oe_survey_button {
background-color: #c02c2c;
color: #fff !important;
padding: 3px 4px 4px 4px;
background-image: -webkit-linear-gradient(top, #df3f3f, #a21a1a);
border-radius: 4px;
padding: 3px 8px 4px 8px;
border: 1px solid #000;
border-width: 1px 1px 0 0;
text-shadow: none;
text-decoration: none !important;
}
.openerp .oe_survey_button, .openerp .oe_form .oe_survey button.oe_highlight {
color: #fff !important;
background-color: #c02c2c;
background-image: -webkit-gradient(linear, left top, left bottom, from(#df3f3f), to(#a21a1a));
background-image: -webkit-linear-gradient(top, #df3f3f, #a21a1a);
background-image: -moz-linear-gradient(top, #df3f3f, #a21a1a);
background-image: -ms-linear-gradient(top, #df3f3f, #a21a1a);
background-image: -o-linear-gradient(top, #df3f3f, #a21a1a);
background-image: linear-gradient(to bottom, #df3f3f, #a21a1a);
-moz-box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1), 0 1px 1px rgba(155, 155, 155, 0.4) inset;
-webkit-box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1), 0 1px 1px rgba(155, 155, 155, 0.4) inset;
box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1), 0 1px 1px rgba(155, 155, 155, 0.4) inset;
}
.openerp .oe_form .oe_survey_answer .oe_form_sheet label {
max-width: 280px;
+2 -2
View File
@@ -90,7 +90,7 @@ class survey(osv.osv):
'date_close': fields.datetime('Survey Close Date', readonly=1),
'max_response_limit': fields.integer('Maximum Answer Limit', help="Set to one if survey is answerable only once"),
'state': fields.selection([('draft', 'Draft'), ('open', 'Open'), ('close', 'Close'), ('cancel', 'Cancelled')], 'Status', required=1),
'authenticate': fields.boolean('User must be authentified'),
'authenticate': fields.boolean('User must be authentified', help="If the user must be authenticate, when the user click on the link, it's redirected to the login page if not authenticated. In otherwise, it may complete the survey directly."),
'tot_start_survey': fields.function(_get_tot_start_survey, string="Total Started Survey", type="integer"),
'tot_comp_survey': fields.function(_get_tot_comp_survey, string="Total Completed Survey", type="integer"),
'note': fields.text('Description', size=128, translate=True),
@@ -102,7 +102,7 @@ class survey(osv.osv):
}
_defaults = {
'state': "draft",
'authenticate': False,
'authenticate': True,
'date_open': fields.datetime.now,
'token': lambda s, cr, uid, c: uuid.uuid4(),
}
+10 -7
View File
@@ -22,10 +22,9 @@
<field name="arch" type="xml">
<form string="Survey" version="7.0">
<header>
<button name="edit_survey" states="draft,open,close,cancel" string="Edit Survey" type="object" class="oe_highlight"/>
<button name="survey_draft" string="Draft" states="cancel,close" type="object"/>
<button name="survey_open" class="oe_highlight" string="Open" states="draft,close" type="object"/>
<button name="survey_close" string="Close" states="open" type="object" class="oe_highlight"/>
<button name="survey_close" string="Close" states="open" type="object"/>
<button name="survey_cancel" string="Cancel" states="draft" type="object"/>
<field name="state" widget="statusbar" nolabel="1" attrs="{'invisible':[('state','=','cancel')]}" statusbar_visible="draft,open,close"/>
</header>
@@ -43,9 +42,13 @@
<group>
<group colspan="4">
<field name="type" attrs="{'readonly':[('state','in',['close','cancel'])]}" class="oe_inline"/>
<field name="authenticate"/>
<field name="max_response_limit" attrs="{'readonly':[('state','=','close')]}"/>
<field name="public_url" widget="url"/>
<div name="authenticate" colspan="4">
<small>
The Public Portal is not activated; your audience must be authenticated to answer the survey. If you want to make the survey available to everyone, please activate the Public Portal : Settings > General Settings > Activate the public portal
</small>
</div>
</group>
</group>
<field name="page_ids" colspan="4" mode="tree" attrs="{'readonly':[('state','=','close')]}" context="{'default_survey_id': active_id}">
@@ -123,7 +126,7 @@
<div class="oe_dropdown_toggle oe_dropdown_kanban">
<span class="oe_e">i</span>
<ul class="oe_dropdown_menu">
<t t-if="widget.view.is_action_enabled('edit')"><li><a type="edit">Edit...</a></li></t>
<t t-if="widget.view.is_action_enabled('edit')"><li><a type="edit">Survey Settings...</a></li></t>
<t t-if="widget.view.is_action_enabled('delete')"><li><a type="delete">Delete</a></li></t>
<li><ul class="oe_kanban_colorpicker" data-field="color"/></li>
</ul>
@@ -144,8 +147,8 @@
<ul>
<li t-if="widget.view.is_action_enabled('edit')"><a name="edit_survey" type="object">Edit Survey</a></li>
<li t-if="widget.view.is_action_enabled('edit')"><a name="action_print_survey" type="object">Print Survey</a></li>
<li t-if="record.state.raw_value === 'open' and widget.view.is_action_enabled('edit')"><a name="action_survey_sent" type="object">Collect responses</a></li>
<li><a t-if="record.state.raw_value === 'open'" name="fill_survey" type="object">Fill in survey</a></li>
<li t-if="record.state.raw_value === 'open' and widget.view.is_action_enabled('edit')"><a name="action_survey_sent" type="object">Collect Answers</a></li>
<li><a t-if="record.state.raw_value === 'open'" name="fill_survey" type="object">Fill in Survey</a></li>
<li t-if="record.tot_comp_survey.raw_value and widget.view.is_action_enabled('edit')"><a name="print_statistics" type="object">Print Statistics</a></li>
</ul>
</div>
@@ -631,7 +634,7 @@
</record>
<record model="ir.actions.act_window" id="action_survey_response">
<field name="name">Survey Type</field>
<field name="name">Survey Response</field>
<field name="res_model">survey.response</field>
<field name="view_type">form</field>
<field name="view_mode">tree,form</field>