287 lines
13 KiB
XML
287 lines
13 KiB
XML
<?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>
|
|
<td><t t-esc="survey.title" /></td>
|
|
<td><t t-esc="survey.category"/></td>
|
|
<td><t t-if="survey.description is not False"><t t-esc="survey.description"/></t></td>
|
|
<td><a t-att-href="survey.public_url"><t t-esc="survey.id" /></a></td>
|
|
</tr>
|
|
</t>
|
|
</table>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</t>
|
|
</template>
|
|
|
|
<!-- 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>
|
|
|
|
|
|
<!-- A survey -->
|
|
<template id="survey" 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">
|
|
<t t-if="pagination['current'] == -1">
|
|
<div class='jumbotron'>
|
|
<h1>
|
|
<t t-esc='survey.title'/>
|
|
<t t-if="survey.description is not False">
|
|
<br/>
|
|
<small><t t-esc='survey.description'/></small>
|
|
</t>
|
|
</h1>
|
|
</div>
|
|
<div class="text-center">
|
|
<form role="form" method="post" t-att-name="survey.id.__str__() + '*-1'" t-att-action="'/survey/fill/' + survey.id.__str__()" target="">
|
|
<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>
|
|
</t>
|
|
<t t-if="pagination['current'] != -1">
|
|
<div class='page-header'>
|
|
<h1>
|
|
<t t-esc='survey.title'/>
|
|
</h1>
|
|
</div>
|
|
<t t-set='page' t-value="survey.page_ids[pagination['current']]" />
|
|
<t t-call="survey.page" />
|
|
</t>
|
|
|
|
|
|
</div>
|
|
<div class="col-md-1"> </div>
|
|
<div class="col-md-1"> </div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</t>
|
|
</template>
|
|
|
|
|
|
<!-- Navigation & Submission -->
|
|
<template id="navsub" name="Footer for navigation and submission">
|
|
<div class="text-center">
|
|
<t t-if="pagination['current'] != -1 and pagination['next'] != 'finished'"><input type="submit" class="btn btn-primary active" value="Next page"/></t>
|
|
<t t-if="pagination['next'] == 'finished'"><input type="submit" class="btn btn-success active" value="Submit survey"/></t>
|
|
</div>
|
|
</template>
|
|
|
|
|
|
<!-- A page -->
|
|
<template id="page" name="Page">
|
|
<div>
|
|
<h2><t t-esc='page.title' /></h2>
|
|
<p><t t-if="page.description"><t t-esc='page.description'/></t></p>
|
|
<p class="text-info text-right">Questions marked with <span class="glyphicon glyphicon-exclamation-sign"></span> are mandatory.</p>
|
|
</div>
|
|
<hr/>
|
|
|
|
<!-- Panel to display input errors -->
|
|
<t t-if="problems">
|
|
<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">
|
|
<ul>
|
|
<t t-foreach="problems" t-as='problem'>
|
|
<li><strong><t t-esc="problem['qlabel']"/> :</strong> <t t-esc="problem['errmsg']"/></li>
|
|
</t>
|
|
</ul>
|
|
</div>
|
|
</div>
|
|
</t>
|
|
|
|
<form role="form" method="post" t-att-name="survey.id.__str__() + '*' + pagination['current'].__str__()" t-att-action="'/survey/fill/' + survey.id.__str__()" target="">
|
|
<input type="hidden" name="current" t-att-value="pagination['current'].__str__()" />
|
|
<input type="hidden" name="next" t-att-value="pagination['next'].__str__()" />
|
|
<t t-foreach='page.question_ids' t-as='question'>
|
|
<t t-call='survey.question'/>
|
|
</t>
|
|
<t t-call='survey.navsub' />
|
|
</form>
|
|
|
|
</template>
|
|
|
|
|
|
<!-- A question -->
|
|
<template id='question' name='Question'>
|
|
|
|
<!-- 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>
|
|
|
|
|
|
<t t-if="not is_vector_element"> <!-- if -->
|
|
<h3>
|
|
<t t-if="question.constr_mandatory"><span class="glyphicon glyphicon-exclamation-sign"></span></t>
|
|
<span t-field='question.question'/><br/>
|
|
|
|
<small><t t-if="question.description"><t t-esc='question.description'/></t></small>
|
|
</h3>
|
|
</t>
|
|
<t t-if="is_vector_element"> <!-- else -->
|
|
<t t-if="question.type == 'simple_choice_scale'">
|
|
<t t-field='question.question'/><t t-raw="'</td><td>'" />
|
|
</t>
|
|
</t> <!-- endif -->
|
|
|
|
<!-- instanciating different types of questions -->
|
|
<t t-if="question.type in ['free_text']">
|
|
<textarea class="form-control" rows="3" t-att-name="survey.id.__str__() + '*' + pagination['current'].__str__() + '*' + question.id.__str__()"></textarea>
|
|
</t>
|
|
|
|
<t t-if="question.type in ['textbox']">
|
|
<input type="text" class="form-control" t-att-name="survey.id.__str__() + '*' + pagination['current'].__str__() + '*' + question.id.__str__()"/>
|
|
</t>
|
|
|
|
<t t-if="question.type in ['numerical_box']">
|
|
<input type="number" class="form-control" t-att-name="survey.id.__str__() + '*' + pagination['current'].__str__() + '*' + question.id.__str__()"/>
|
|
</t>
|
|
|
|
<t t-if="question.type in ['datetime']" >
|
|
<input type="datetime-local" class="form-control" t-att-name="survey.id.__str__() + '*' + pagination['current'].__str__() + '*' + question.id.__str__()"/>
|
|
TODO: replace html5 datetime widget by OpenERP-CMS datetime widget
|
|
</t>
|
|
|
|
<t t-if="question.type in ['simple_choice_scale']">
|
|
<t t-foreach='question.suggested_answers_ids' t-as='suggestion'>
|
|
<div class="radio-inline">
|
|
<label>
|
|
<input type="radio" t-att-name="survey.id.__str__() + '*' + pagination['current'].__str__() + '*' + question.id.__str__()" t-att-value='suggestion.value' />
|
|
<t t-esc='suggestion.value'/>
|
|
</label>
|
|
</div>
|
|
</t>
|
|
</t>
|
|
|
|
<t t-if="question.type in ['simple_choice_dropdown']">
|
|
<select class="form-control" t-att-name="survey.id.__str__() + '*' + pagination['current'].__str__() + '*' + question.id.__str__()">
|
|
<t t-foreach='question.suggested_answers_ids' t-as='suggestion'>
|
|
<option><t t-esc='suggestion.value'/></option>
|
|
</t>
|
|
</select>
|
|
</t>
|
|
|
|
<t t-if="question.type in ['multiple_choice']">
|
|
<t t-foreach='question.suggested_answers_ids' t-as='suggestion'>
|
|
<div class="checkbox">
|
|
<label>
|
|
<input type="checkbox" t-att-name="survey.id.__str__() + '*' + pagination['current'].__str__() + '*' + question.id.__str__() + '*' + suggestion.id.__str__()" t-att-value='suggestion.value' />
|
|
<t t-esc='suggestion.value'/>
|
|
</label>
|
|
</div>
|
|
</t>
|
|
</t>
|
|
|
|
<t t-if="question.type in ['vector']">
|
|
|
|
<t t-if="not is_matrix_vector">
|
|
<t t-raw="'<table class="table table-responsive">'" />
|
|
</t>
|
|
|
|
<t t-if="question.children_ids[0].type != 'simple_choice_scale'">
|
|
<tr>
|
|
<t t-foreach='question.children_ids' t-as='question'>
|
|
<td><t t-call='survey.question' /></td>
|
|
</t>
|
|
</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>
|
|
</t>
|
|
</t>
|
|
<t t-if="not is_matrix_vector">
|
|
<t t-raw="'</table>'" />
|
|
</t>
|
|
|
|
</t>
|
|
|
|
|
|
<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' />
|
|
</t>
|
|
</table>
|
|
</t>
|
|
|
|
|
|
<!-- Comments -->
|
|
<t t-if="question.comments_allowed">
|
|
<div class="panel panel-default">
|
|
<div class="panel-heading">Any comments ?</div>
|
|
<div class="panel-body">
|
|
TODO: show comments box here
|
|
</div>
|
|
</div>
|
|
</t>
|
|
|
|
</template>
|
|
|
|
|
|
<!-- 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>
|
|
<t t-esc='survey.title'/>
|
|
<t t-if="survey.description is not False">
|
|
<br/>
|
|
<small><t t-esc='survey.description'/></small>
|
|
</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>
|
|
</data>
|
|
</openerp>
|