2013-11-05 10:36:54 +00:00
|
|
|
<?xml version="1.0" encoding="utf-8"?>
|
|
|
|
<openerp>
|
|
|
|
<data>
|
|
|
|
<!-- List of all the surveys -->
|
|
|
|
<template id="list" name="Survey List">
|
|
|
|
<t t-call="website.layout">
|
|
|
|
<div class="wrap">
|
|
|
|
<div class="container">
|
|
|
|
<h1>Open surveys</h1>
|
|
|
|
<div class="table-responsive">
|
|
|
|
<table class="table table-hover">
|
|
|
|
<tr><th>Title</th><th>Category</th><th>Description</th><th>Public URL</th></tr>
|
|
|
|
<t t-foreach="surveys" t-as="survey">
|
|
|
|
<tr>
|
2013-11-08 14:24:06 +00:00
|
|
|
<td><span t-field="survey.title" /></td>
|
|
|
|
<td><span t-field="survey.category"/></td>
|
|
|
|
<td><t t-if="survey.description is not False"><span t-field="survey.description"/></t></td>
|
2013-11-05 10:36:54 +00:00
|
|
|
<td><a t-att-href="survey.public_url"><t t-esc="survey.id" /></a></td>
|
|
|
|
</tr>
|
|
|
|
</t>
|
|
|
|
</table>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</t>
|
|
|
|
</template>
|
|
|
|
|
2013-11-08 07:53:47 +00:00
|
|
|
<!-- List of all the surveys -->
|
|
|
|
<template id="finished" name="Survey Finished">
|
|
|
|
<t t-call="website.layout">
|
|
|
|
<div class="wrap">
|
|
|
|
<div class="container">
|
|
|
|
<div class="jumbotron">
|
|
|
|
<h1>Thank you!<br/><small>Your answers have been recorded.</small></h1>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</t>
|
|
|
|
</template>
|
|
|
|
|
|
|
|
|
2013-11-05 10:36:54 +00:00
|
|
|
<!-- A survey -->
|
|
|
|
<template id="survey" name="Survey">
|
|
|
|
<t t-call="website.layout">
|
2013-11-08 16:14:14 +00:00
|
|
|
<t t-set="head">
|
|
|
|
<script type="text/javascript" src="/survey/static/src/js/survey.js" />
|
|
|
|
</t>
|
2013-11-05 10:36:54 +00:00
|
|
|
<div class="wrap">
|
|
|
|
<div class="container">
|
2013-11-05 15:28:21 +00:00
|
|
|
<div class="row">
|
2013-11-08 14:24:06 +00:00
|
|
|
<div class="col-md-12">
|
2013-11-06 15:24:06 +00:00
|
|
|
<t t-if="pagination['current'] == -1">
|
|
|
|
<div class='jumbotron'>
|
|
|
|
<h1>
|
2013-11-08 14:24:06 +00:00
|
|
|
<span t-field='survey.title'/>
|
2013-11-06 15:24:06 +00:00
|
|
|
<t t-if="survey.description is not False">
|
|
|
|
<br/>
|
2013-11-08 14:24:06 +00:00
|
|
|
<small><span t-field='survey.description'/></small>
|
2013-11-06 15:24:06 +00:00
|
|
|
</t>
|
|
|
|
</h1>
|
|
|
|
</div>
|
2013-11-08 07:53:47 +00:00
|
|
|
<div class="text-center">
|
2013-11-08 16:14:14 +00:00
|
|
|
<form role="form" method="post" t-att-name="survey.id.__str__() + '---1'" t-att-action="'/survey/fill/' + survey.id.__str__()" target="">
|
2013-11-08 07:53:47 +00:00
|
|
|
<input type="hidden" name="current" t-att-value="pagination['current'].__str__()" />
|
|
|
|
<input type="hidden" name="next" t-att-value="pagination['next'].__str__()" />
|
|
|
|
<input type="submit" class="btn btn-primary active" value="Take survey"/>
|
|
|
|
</form>
|
|
|
|
</div>
|
2013-11-06 07:33:53 +00:00
|
|
|
</t>
|
2013-11-06 15:24:06 +00:00
|
|
|
<t t-if="pagination['current'] != -1">
|
|
|
|
<div class='page-header'>
|
|
|
|
<h1>
|
2013-11-08 14:24:06 +00:00
|
|
|
<span t-field='survey.title'/>
|
|
|
|
<t t-if="survey.description is not False">
|
|
|
|
<br/>
|
|
|
|
<small><span t-field='survey.description'/></small>
|
|
|
|
</t>
|
2013-11-06 15:24:06 +00:00
|
|
|
</h1>
|
|
|
|
</div>
|
|
|
|
<t t-set='page' t-value="survey.page_ids[pagination['current']]" />
|
|
|
|
<t t-call="survey.page" />
|
2013-11-05 15:28:21 +00:00
|
|
|
</t>
|
2013-11-06 15:24:06 +00:00
|
|
|
|
2013-11-06 07:33:53 +00:00
|
|
|
|
2013-11-05 15:28:21 +00:00
|
|
|
</div>
|
2013-11-05 10:36:54 +00:00
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</t>
|
|
|
|
</template>
|
2013-11-05 15:28:21 +00:00
|
|
|
|
2013-11-06 07:33:53 +00:00
|
|
|
|
|
|
|
<!-- Navigation & Submission -->
|
|
|
|
<template id="navsub" name="Footer for navigation and submission">
|
|
|
|
<div class="text-center">
|
2013-11-08 16:14:14 +00:00
|
|
|
<t t-if="pagination['current'] != -1 and pagination['next'] != 'finished'"><input type="submit" class="btn btn-primary active survey-btn" value="Next page"/></t>
|
|
|
|
<t t-if="pagination['next'] == 'finished'"><input type="submit" class="btn btn-success active survey-btn" value="Submit survey"/></t>
|
2013-11-06 07:33:53 +00:00
|
|
|
</div>
|
|
|
|
</template>
|
|
|
|
|
2013-11-06 15:24:06 +00:00
|
|
|
|
2013-11-05 15:28:21 +00:00
|
|
|
<!-- A page -->
|
|
|
|
<template id="page" name="Page">
|
|
|
|
<div>
|
2013-11-08 14:24:06 +00:00
|
|
|
<h2><span t-field='page.title' /></h2>
|
|
|
|
<p><t t-if="page.description"><span t-field='page.description'/></t></p>
|
2013-11-06 15:24:06 +00:00
|
|
|
<p class="text-info text-right">Questions marked with <span class="glyphicon glyphicon-exclamation-sign"></span> are mandatory.</p>
|
2013-11-05 15:28:21 +00:00
|
|
|
</div>
|
2013-11-06 15:24:06 +00:00
|
|
|
<hr/>
|
|
|
|
|
|
|
|
<!-- Panel to display input errors -->
|
2013-11-08 07:53:47 +00:00
|
|
|
<t t-if="problems">
|
2013-11-06 15:24:06 +00:00
|
|
|
<div class="panel panel-danger">
|
|
|
|
<div class="panel-heading">
|
|
|
|
<h3 class="panel-title">Errors on this page</h3>
|
|
|
|
</div>
|
|
|
|
<div class="panel-body text-danger">
|
2013-11-08 07:53:47 +00:00
|
|
|
<ul>
|
2013-11-08 14:24:06 +00:00
|
|
|
<t t-foreach="problems" t-as='problem'>
|
|
|
|
<li><strong><t t-esc="problem['qlabel']"/> :</strong> <t t-esc="problem['errmsg']"/></li>
|
|
|
|
</t>
|
2013-11-08 07:53:47 +00:00
|
|
|
</ul>
|
2013-11-06 15:24:06 +00:00
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</t>
|
|
|
|
|
2013-11-08 16:14:14 +00:00
|
|
|
<form role="form" method="post" t-att-name="survey.id.__str__() + '--' + pagination['current'].__str__()" t-att-action="'/survey/fill/' + survey.id.__str__()" target="">
|
2013-11-08 07:53:47 +00:00
|
|
|
<input type="hidden" name="current" t-att-value="pagination['current'].__str__()" />
|
|
|
|
<input type="hidden" name="next" t-att-value="pagination['next'].__str__()" />
|
2013-11-05 15:28:21 +00:00
|
|
|
<t t-foreach='page.question_ids' t-as='question'>
|
|
|
|
<t t-call='survey.question'/>
|
|
|
|
</t>
|
2013-11-08 07:53:47 +00:00
|
|
|
<t t-call='survey.navsub' />
|
2013-11-05 15:28:21 +00:00
|
|
|
</form>
|
|
|
|
|
|
|
|
</template>
|
|
|
|
|
2013-11-06 15:24:06 +00:00
|
|
|
|
2013-11-05 15:28:21 +00:00
|
|
|
<!-- A question -->
|
|
|
|
<template id='question' name='Question'>
|
|
|
|
|
2013-11-06 15:24:06 +00:00
|
|
|
<!-- Detection of matrix/vector elements and creating flags for easy use -->
|
|
|
|
<t t-if="question.parent_id and question.children_ids"><t t-set="is_matrix_vector" t-value="True" /></t>
|
|
|
|
<t t-if="question.parent_id"><t t-set="is_vector_element" t-value="True" /></t>
|
|
|
|
|
2013-11-05 15:28:21 +00:00
|
|
|
|
2013-11-06 15:24:06 +00:00
|
|
|
<t t-if="not is_vector_element"> <!-- if -->
|
|
|
|
<h3>
|
2013-11-05 15:28:21 +00:00
|
|
|
<t t-if="question.constr_mandatory"><span class="glyphicon glyphicon-exclamation-sign"></span></t>
|
2013-11-08 16:14:14 +00:00
|
|
|
<span t-field='question.question' t-att-id="'survey_' + survey.id.__str__() + '--' + pagination['current'].__str__() + '--' + question.id.__str__()"/><br/>
|
2013-11-08 14:24:06 +00:00
|
|
|
<small><t t-if="question.description"><span t-field='question.description'/></t></small>
|
2013-11-06 15:24:06 +00:00
|
|
|
</h3>
|
|
|
|
</t>
|
|
|
|
<t t-if="is_vector_element"> <!-- else -->
|
|
|
|
<t t-if="question.type == 'simple_choice_scale'">
|
2013-11-08 16:14:14 +00:00
|
|
|
<span t-field='question.question' t-att-id="'survey_' + survey.id.__str__() + '--' + pagination['current'].__str__() + '--' + question.id.__str__()"/><t t-raw="'</td><td>'" />
|
2013-11-06 15:24:06 +00:00
|
|
|
</t>
|
|
|
|
</t> <!-- endif -->
|
2013-11-05 15:28:21 +00:00
|
|
|
|
2013-11-06 15:24:06 +00:00
|
|
|
<!-- instanciating different types of questions -->
|
|
|
|
<t t-if="question.type in ['free_text']">
|
2013-11-08 16:14:14 +00:00
|
|
|
<textarea class="form-control" rows="3" t-att-name="survey.id.__str__() + '--' + pagination['current'].__str__() + '--' + question.id.__str__()"></textarea>
|
2013-11-06 15:24:06 +00:00
|
|
|
</t>
|
2013-11-05 15:28:21 +00:00
|
|
|
|
2013-11-06 15:24:06 +00:00
|
|
|
<t t-if="question.type in ['textbox']">
|
2013-11-08 16:14:14 +00:00
|
|
|
<input type="text" class="form-control" t-att-name="survey.id.__str__() + '--' + pagination['current'].__str__() + '--' + question.id.__str__()"/>
|
2013-11-06 15:24:06 +00:00
|
|
|
</t>
|
2013-11-05 15:28:21 +00:00
|
|
|
|
2013-11-06 15:24:06 +00:00
|
|
|
<t t-if="question.type in ['numerical_box']">
|
2013-11-08 16:14:14 +00:00
|
|
|
<input type="number" class="form-control" t-att-name="survey.id.__str__() + '--' + pagination['current'].__str__() + '--' + question.id.__str__()"/>
|
2013-11-06 15:24:06 +00:00
|
|
|
</t>
|
2013-11-05 15:28:21 +00:00
|
|
|
|
2013-11-08 07:53:47 +00:00
|
|
|
<t t-if="question.type in ['datetime']" >
|
2013-11-08 16:14:14 +00:00
|
|
|
<input type="datetime-local" class="form-control" t-att-name="survey.id.__str__() + '--' + pagination['current'].__str__() + '--' + question.id.__str__()"/>
|
2013-11-06 15:24:06 +00:00
|
|
|
TODO: replace html5 datetime widget by OpenERP-CMS datetime widget
|
|
|
|
</t>
|
2013-11-05 15:28:21 +00:00
|
|
|
|
2013-11-06 15:24:06 +00:00
|
|
|
<t t-if="question.type in ['simple_choice_scale']">
|
|
|
|
<t t-foreach='question.suggested_answers_ids' t-as='suggestion'>
|
|
|
|
<div class="radio-inline">
|
|
|
|
<label>
|
2013-11-08 16:14:14 +00:00
|
|
|
<input type="radio" t-att-name="survey.id.__str__() + '--' + pagination['current'].__str__() + '--' + question.id.__str__()" t-att-value='suggestion.value' />
|
2013-11-08 14:24:06 +00:00
|
|
|
<span t-field='suggestion.value'/>
|
2013-11-06 15:24:06 +00:00
|
|
|
</label>
|
|
|
|
</div>
|
|
|
|
</t>
|
|
|
|
</t>
|
2013-11-05 15:28:21 +00:00
|
|
|
|
2013-11-06 15:24:06 +00:00
|
|
|
<t t-if="question.type in ['simple_choice_dropdown']">
|
2013-11-08 16:14:14 +00:00
|
|
|
<select class="form-control" t-att-name="survey.id.__str__() + '--' + pagination['current'].__str__() + '--' + question.id.__str__()">
|
2013-11-08 14:24:06 +00:00
|
|
|
<option disabled="1" selected="1">Choose...</option>
|
2013-11-06 15:24:06 +00:00
|
|
|
<t t-foreach='question.suggested_answers_ids' t-as='suggestion'>
|
|
|
|
<option><t t-esc='suggestion.value'/></option>
|
2013-11-05 15:28:21 +00:00
|
|
|
</t>
|
2013-11-06 15:24:06 +00:00
|
|
|
</select>
|
|
|
|
</t>
|
2013-11-05 15:28:21 +00:00
|
|
|
|
2013-11-06 15:24:06 +00:00
|
|
|
<t t-if="question.type in ['multiple_choice']">
|
|
|
|
<t t-foreach='question.suggested_answers_ids' t-as='suggestion'>
|
|
|
|
<div class="checkbox">
|
|
|
|
<label>
|
2013-11-08 16:14:14 +00:00
|
|
|
<input type="checkbox" t-att-name="survey.id.__str__() + '--' + pagination['current'].__str__() + '--' + question.id.__str__() + '--' + suggestion.id.__str__()" t-att-value='suggestion.value' />
|
2013-11-08 14:24:06 +00:00
|
|
|
<span t-field='suggestion.value'/>
|
2013-11-06 15:24:06 +00:00
|
|
|
</label>
|
|
|
|
</div>
|
|
|
|
</t>
|
|
|
|
</t>
|
2013-11-05 15:28:21 +00:00
|
|
|
|
2013-11-06 15:24:06 +00:00
|
|
|
<t t-if="question.type in ['vector']">
|
2013-11-05 15:28:21 +00:00
|
|
|
|
2013-11-06 15:24:06 +00:00
|
|
|
<t t-if="not is_matrix_vector">
|
|
|
|
<t t-raw="'<table class="table table-responsive">'" />
|
|
|
|
</t>
|
2013-11-05 15:28:21 +00:00
|
|
|
|
2013-11-06 15:24:06 +00:00
|
|
|
<t t-if="question.children_ids[0].type != 'simple_choice_scale'">
|
|
|
|
<tr>
|
2013-11-06 07:33:53 +00:00
|
|
|
<t t-foreach='question.children_ids' t-as='question'>
|
2013-11-06 15:24:06 +00:00
|
|
|
<td><t t-call='survey.question' /></td>
|
2013-11-06 07:33:53 +00:00
|
|
|
</t>
|
2013-11-06 15:24:06 +00:00
|
|
|
</tr>
|
|
|
|
</t>
|
|
|
|
<t t-if="question.children_ids[0].type == 'simple_choice_scale'">
|
|
|
|
<t t-foreach='question.children_ids' t-as='question'>
|
|
|
|
<tr>
|
|
|
|
<td><t t-call='survey.question' /></td>
|
|
|
|
</tr>
|
2013-11-05 15:28:21 +00:00
|
|
|
</t>
|
2013-11-06 15:24:06 +00:00
|
|
|
</t>
|
|
|
|
<t t-if="not is_matrix_vector">
|
|
|
|
<t t-raw="'</table>'" />
|
|
|
|
</t>
|
2013-11-05 15:28:21 +00:00
|
|
|
|
2013-11-06 15:24:06 +00:00
|
|
|
</t>
|
2013-11-05 15:28:21 +00:00
|
|
|
|
2013-11-06 15:24:06 +00:00
|
|
|
<t t-if="question.type in ['matrix']">
|
|
|
|
<table class="table table-responsive">
|
|
|
|
<t t-foreach='question.children_ids' t-as='question'>
|
|
|
|
<t t-call='survey.question' />
|
2013-11-06 07:33:53 +00:00
|
|
|
</t>
|
2013-11-06 15:24:06 +00:00
|
|
|
</table>
|
|
|
|
</t>
|
|
|
|
|
|
|
|
<!-- Comments -->
|
|
|
|
<t t-if="question.comments_allowed">
|
2013-11-08 16:14:14 +00:00
|
|
|
Other: <input type="text" class="form-control" t-att-name="survey.id.__str__() + '--' + pagination['current'].__str__() + '--' + question."/>
|
2013-11-06 15:24:06 +00:00
|
|
|
</t>
|
|
|
|
|
|
|
|
</template>
|
2013-11-06 16:11:17 +00:00
|
|
|
|
|
|
|
|
|
|
|
<!-- Printable view of a survey (all pages) -->
|
|
|
|
<template id="survey_print" name="Survey">
|
|
|
|
<t t-call="website.layout">
|
|
|
|
<div class="wrap">
|
|
|
|
<div class="container">
|
|
|
|
<div class="row">
|
|
|
|
<div class="col-md-1"> </div>
|
|
|
|
<div class="col-md-1"> </div>
|
|
|
|
<div class="col-md-8">
|
|
|
|
<div class='jumbotron'>
|
|
|
|
<h1>
|
2013-11-08 14:24:06 +00:00
|
|
|
<span t-field='survey.title'/>
|
2013-11-06 16:11:17 +00:00
|
|
|
<t t-if="survey.description is not False">
|
|
|
|
<br/>
|
2013-11-08 14:24:06 +00:00
|
|
|
<small><span t-field='survey.description'/></small>
|
2013-11-06 16:11:17 +00:00
|
|
|
</t>
|
|
|
|
</h1>
|
|
|
|
</div>
|
|
|
|
<t t-foreach="survey.page_ids" t-as="page">
|
|
|
|
<t t-call="survey.page" />
|
|
|
|
<hr/>
|
|
|
|
</t>
|
|
|
|
</div>
|
|
|
|
<div class="col-md-1"> </div>
|
|
|
|
<div class="col-md-1"> </div>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</t>
|
|
|
|
</template>
|
2013-11-06 15:24:06 +00:00
|
|
|
</data>
|
|
|
|
</openerp>
|