2013-11-05 10:36:54 +00:00
<?xml version="1.0" encoding="utf-8"?>
<openerp >
2013-11-25 08:04:46 +00:00
<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" >
2013-11-26 12:53:03 +00:00
<tr > <th > Title</th> </tr>
2013-11-25 08:04:46 +00:00
<t t-foreach= "surveys" t-as= "survey" >
<tr >
<td > <a t-att-href= "survey.public_url" t-field= "survey.title" /> </td>
</tr>
</t>
</table>
2013-11-05 10:36:54 +00:00
</div>
</div>
2013-11-25 08:04:46 +00:00
</div>
</t>
</template>
2013-11-05 10:36:54 +00:00
2013-12-16 15:32:44 +00:00
<!-- "Thank you" message when the survey is completed -->
2013-11-25 08:04:46 +00:00
<template id= "finished" name= "Survey Finished" >
<t t-call= "website.layout" >
<div class= "wrap" >
<div class= "container" >
2013-11-26 12:53:03 +00:00
<div class= "jumbotron mt32" >
2013-11-25 08:04:46 +00:00
<h1 > Thank you!</h1>
<div t-field= "survey.thank_you_message" />
2013-11-08 07:53:47 +00:00
</div>
</div>
2013-11-25 08:04:46 +00:00
</div>
</t>
</template>
2013-11-08 07:53:47 +00:00
2013-11-25 08:04:46 +00:00
<!-- Message when the survey is not open -->
<template id= "notopen" name= "Survey not open" >
<t t-call= "website.layout" >
<div class= "wrap" >
<div class= "container" >
2013-11-26 12:53:03 +00:00
<div class= "jumbotron mt32" >
2013-11-25 08:04:46 +00:00
<h1 > Not open</h1>
<p > This survey is not open. Thank you for your interest!</p>
2013-11-20 15:13:01 +00:00
</div>
</div>
2013-11-25 08:04:46 +00:00
</div>
</t>
</template>
2013-11-08 07:53:47 +00:00
2013-11-25 08:04:46 +00:00
<!-- First page of a survey -->
<template id= "survey_init" name= "Survey" >
<t t-call= "website.layout" >
<div class= "wrap" >
<div class= "oe_structure" />
<div class= "container" >
<div class= 'jumbotron mt32' >
<h1 t-field= 'survey.title' />
<div t-field= 'survey.description' />
<a class= "btn btn-primary btn-lg" t-att-href= "'/survey/fill/%s/%s' % (survey.id, token)" >
Start Survey
</a>
2013-11-05 10:36:54 +00:00
</div>
</div>
2013-11-25 08:04:46 +00:00
<div class= "oe_structure" />
2013-11-06 07:33:53 +00:00
</div>
2013-11-25 08:04:46 +00:00
</t>
</template>
2013-11-06 07:33:53 +00:00
2013-11-25 08:04:46 +00:00
<!-- A survey -->
<template id= "survey" name= "Survey" >
<t t-call= "website.layout" >
<t t-set= "head" >
<script type= "text/javascript" src= "/survey/static/src/js/survey.js" />
</t>
<div class= "wrap" >
<div class= "oe_structure" />
<div class= "container" >
<t t-call= "survey.page" />
</div>
<div class= "oe_structure" />
2013-11-05 15:28:21 +00:00
</div>
2013-11-25 08:04:46 +00:00
</t>
</template>
2013-11-05 15:28:21 +00:00
2013-11-25 08:04:46 +00:00
<!-- A page -->
<template id= "page" name= "Page" >
<div class= "page-header" >
2013-11-26 12:53:03 +00:00
<p class= "pull-right" > Page <span t-raw= 'page_nr + 1' /> on <span t-raw= "len(survey.page_ids)" /> </p>
2013-11-25 08:04:46 +00:00
<h1 t-field= 'page.title' />
<div t-field= 'page.description' />
</div>
2013-11-06 15:24:06 +00:00
2013-12-16 15:32:44 +00:00
<form role= "form" method= "post" class= "js_surveyform" t-att-name= "'%s_%s' % (survey.id, page.id)" t-att-action= "'/survey/fill/%s/%s' % (survey.id, token)" t-att-data-prefill= "'/survey/prefill/%s/%s/%s' % (survey.id, token, page.id)" t-att-data-validate= "'/survey/validate/%s' % (survey.id)" t-att-data-submit= "'/survey/submit/%s' % (survey.id)" >
2013-11-25 08:04:46 +00:00
<input type= "hidden" name= "page_id" t-att-value= "page.id" />
<input type= "hidden" name= "token" t-att-value= "token" />
<t t-foreach= 'page.question_ids' t-as= 'question' >
<t t-set= "prefix" t-value= "'%s_%s_%s' % (survey.id, page.id, question.id)" />
<div class= "js_question-wrapper" t-att-id= "prefix" >
<h2 >
<span t-field= 'question.question' />
2013-11-26 12:53:03 +00:00
<span t-if= "question.constr_mandatory" class= "text-danger" > *</span>
2013-11-25 08:04:46 +00:00
</h2>
<p class= "text-muted" > <t t-if= "question.description" > <span t-field= 'question.description' /> </t> </p>
2013-11-26 12:53:03 +00:00
<t t-if= "question.type == 'free_text'" > <t t-call= "survey.free_text" /> </t>
<t t-if= "question.type == 'textbox'" > <t t-call= "survey.textbox" /> </t>
<t t-if= "question.type == 'numerical_box'" > <t t-call= "survey.numerical_box" /> </t>
<t t-if= "question.type == 'datetime'" > <t t-call= "survey.datetime" /> </t>
<t t-if= "question.type == 'simple_choice'" > <t t-call= "survey.simple_choice" /> </t>
<t t-if= "question.type == 'multiple_choice'" > <t t-call= "survey.multiple_choice" /> </t>
<t t-if= "question.type == 'matrix'" > <t t-call= "survey.matrix" /> </t>
2013-11-25 08:04:46 +00:00
<div class= "js_errzone alert alert-danger" style= "display:none;" > </div>
</div>
</t>
<div class= "text-center mt16 mb16" >
2013-12-12 11:04:35 +00:00
<button t-if= "survey.users_can_go_back and page_nr > 0" type= "submit" class= "btn btn-default" name= "button_submit" value= "previous" > Previous page</button>
<button t-if= "not last" type= "submit" class= "btn btn-primary" name= "button_submit" value= "next" > Next page</button>
<button t-if= "last" type= "submit" class= "btn btn-primary" name= "button_submit" value= "finish" > Submit survey</button>
2013-11-13 13:55:32 +00:00
</div>
2013-11-25 08:04:46 +00:00
</form>
2013-12-09 13:03:26 +00:00
<!-- Modal used to display error message, i.c.o. ajax error -->
<div class= "modal fade" id= "AJAXErrorModal" role= "dialog" aria-labelledby= "AJAXErrorModal" aria-hidden= "true" >
<div class= "modal-dialog" >
<div class= "modal-content" >
<div class= "modal-header" >
<button type= "button" class= "close" data-dismiss= "modal" aria-hidden= "true" > & times;</button>
<h4 class= "modal-title" > A problem has occured</h4>
</div>
<div class= "modal-body" > <p > Something went wrong while contacting survey server. <strong class= "text-danger" > Your answers have probably not been recorded.</strong> Try refreshing.</p> </div>
<div class= "modal-footer" > <button type= "button" class= "btn btn-primary" data-dismiss= "modal" > Close</button> </div>
</div>
</div>
</div>
2013-11-25 08:04:46 +00:00
</template>
2013-11-06 16:11:17 +00:00
2013-11-25 08:04:46 +00:00
<!-- Question widgets -->
<template id= "free_text" name= "Free text box" >
<textarea class= "form-control" rows= "3" t-att-name= "prefix" > </textarea>
</template>
2013-11-15 07:51:50 +00:00
2013-11-25 08:04:46 +00:00
<template id= "textbox" name= "Text box" >
<input type= "text" class= "form-control" t-att-name= "prefix" />
</template>
2013-11-15 07:51:50 +00:00
2013-11-25 08:04:46 +00:00
<template id= "numerical_box" name= "Numerical box" >
2013-12-16 16:09:08 +00:00
<input type= "number" step= "any" class= "form-control" t-att-name= "prefix" />
2013-11-25 08:04:46 +00:00
</template>
2013-11-15 15:14:35 +00:00
2013-11-25 08:04:46 +00:00
<template id= "datetime" name= "Datetime box" >
<input type= "datetime-local" class= "form-control" t-att-name= "prefix" placeholder= "jj-mm-aaaa hh:mm" />
</template>
2013-11-15 15:14:35 +00:00
2013-11-25 08:04:46 +00:00
<template id= "simple_choice" name= "Simple choice" >
<div t-if= "question.display_mode == 'dropdown'" class= "js_drop row" >
2013-11-26 16:08:42 +00:00
<div class= "col-md-12" >
<select class= "form-control" t-att-name= "prefix" >
<option disabled= "1" selected= "1" value= "" > Choose...</option>
<t t-foreach= 'question.labels_ids' t-as= 'label' >
<option t-att-value= 'label.id' > <t t-esc= 'label.value' /> </option>
</t>
<t t-if= 'question.comments_allowed and question.comment_count_as_answer' >
<option class= "js_other_option" value= "-1" > <span t-esc= "question.comment_children_ids[0].question" /> </option>
</t>
</select>
</div>
<div t-if= 'question.comments_allowed and question.comment_count_as_answer' class= "col-md-6" >
<input type= "text" class= "form-control" t-att-name= "'%s_%s' % (prefix, question.comment_children_ids[0].id)" data-oe-survey-othert= "1" />
</div>
<div t-if= 'question.comments_allowed and not question.comment_count_as_answer' class= "col-md-12 mt16" >
<span t-field= "question.comment_children_ids[0].question" />
<input type= "text" class= "form-control" t-att-name= "'%s_%s' % (prefix, question.comment_children_ids[0].id)" />
</div>
2013-11-25 08:04:46 +00:00
</div>
<div t-if= "question.display_mode == 'columns' " class= "row js_radio" >
<div t-foreach= 'question.labels_ids' t-as= 'label' t-attf-class= "col-md-#{question.column_nb}" >
<label >
2013-11-26 12:53:03 +00:00
<input type= "radio" t-att-name= "prefix" t-att-value= 'label.id' />
2013-11-25 08:04:46 +00:00
<span t-field= 'label.value' />
</label>
</div>
<div t-if= 'question.comments_allowed and question.comment_count_as_answer' class= "js_comments col-md-12" >
<label >
2013-11-26 12:53:03 +00:00
<input type= "radio" t-att-name= "prefix" value= "-1" />
<span t-field= "question.comment_children_ids[0].question" />
2013-11-25 08:04:46 +00:00
</label>
2013-11-26 12:53:03 +00:00
<input type= "text" class= "form-control" t-att-name= "'%s_%s' % (prefix, question.comment_children_ids[0].id)" />
2013-11-25 08:04:46 +00:00
</div>
<div t-if= 'question.comments_allowed and not question.comment_count_as_answer' class= "col-md-12" >
2013-11-26 12:53:03 +00:00
<span t-field= "question.comment_children_ids[0].question" />
<input type= "text" class= "form-control" t-att-name= "'%s_%s' % (prefix, question.comment_children_ids[0].id)" data-oe-survey-othert= "1" />
2013-11-25 08:04:46 +00:00
</div>
</div>
</template>
2013-11-15 15:14:35 +00:00
2013-11-25 08:04:46 +00:00
<template id= "multiple_choice" name= "Multiple choice" >
<div class= "row" >
<div t-foreach= 'question.labels_ids' t-as= 'label' t-attf-class= "col-md-#{question.column_nb}" >
<label >
2013-11-26 12:53:03 +00:00
<input type= "checkbox" t-att-name= "'%s_%s' % (prefix, label.id)" t-att-value= 'label.id' />
2013-11-25 08:04:46 +00:00
<span t-field= 'label.value' />
</label>
</div>
<div t-if= 'question.comments_allowed and question.comment_count_as_answer' class= "js_ck_comments col-md-12" >
<label >
2013-11-26 12:53:03 +00:00
<input type= "checkbox" t-att-name= "'%s_%s' % (prefix, -1)" value= "-1" />
<span t-field= "question.comment_children_ids[0].question" />
2013-11-25 08:04:46 +00:00
</label>
2013-11-26 12:53:03 +00:00
<input type= "text" class= "form-control" t-att-name= "'%s_%s' % (prefix, question.comment_children_ids[0].id)" />
2013-11-25 08:04:46 +00:00
</div>
<div t-if= 'question.comments_allowed and not question.comment_count_as_answer' class= "col-md-12" >
2013-11-26 12:53:03 +00:00
<span t-field= "question.comment_children_ids[0].question" />
<input type= "text" class= "form-control" t-att-name= "'%s_%s' % (prefix, question.comment_children_ids[0].id)" data-oe-survey-othert= "1" />
2013-11-25 08:04:46 +00:00
</div>
</div>
</template>
2013-11-15 15:14:35 +00:00
2013-11-26 12:53:03 +00:00
<template id= "matrix" name= "Matrix" >
<table class= "table table-hover" >
<thead >
<tr >
<th > </th>
<th t-foreach= "question.labels_ids" t-as= "col_label" > <span t-field= "col_label.value" /> </th>
</tr>
</thead>
<tbody >
<tr t-foreach= "question.labels_ids_2" t-as= "row_label" >
<th > <span t-field= "row_label.value" /> </th>
<td t-foreach= "question.labels_ids" t-as= "col_label" >
<input t-if= "question.matrix_subtype == 'simple'" type= "radio" t-att-name= "'%s_%s' % (prefix, row_label.id)" t-att-value= 'col_label.id' />
<input t-if= "question.matrix_subtype == 'multiple'" type= "checkbox" t-att-name= "'%s_%s_%s' % (prefix, row_label.id, col_label.id)" t-att-value= 'col_label.id' />
</td>
</tr>
</tbody>
</table>
<div t-if= 'question.comments_allowed' >
<span t-field= "question.comment_children_ids[0].question" />
<input type= "text" class= "form-control" t-att-name= "'%s_%s' % (prefix, question.comment_children_ids[0].id)" />
</div>
</template>
2013-11-18 16:12:59 +00:00
2013-11-25 08:04:46 +00:00
<!-- Printable view of a survey (all pages) -->
<template id= "survey_print" name= "Survey" >
<t t-call= "website.layout" >
2013-11-26 12:53:03 +00:00
<t t-set= "head" >
<script type= "text/javascript" src= "/survey/static/src/js/survey.js" />
</t>
2013-11-25 08:04:46 +00:00
<div class= "wrap" >
<div class= "container" >
<div class= "row" >
2013-11-26 12:53:03 +00:00
<div class= 'jumbotron mt32' >
2013-11-25 08:04:46 +00:00
<h1 > <span t-field= 'survey.title' /> </h1>
2013-11-26 12:53:03 +00:00
<t t-if= "survey.description is not False" > <div t-field= 'survey.description' /> </t>
2013-11-06 16:11:17 +00:00
</div>
2013-11-25 08:04:46 +00:00
<t t-foreach= "survey.page_ids" t-as= "page" >
<t t-call= "survey.page" />
<hr />
</t>
2013-11-06 16:11:17 +00:00
</div>
</div>
2013-11-25 08:04:46 +00:00
</div>
2013-11-26 16:08:42 +00:00
</t>
2013-11-25 08:04:46 +00:00
</template>
</data>
2013-11-06 15:24:06 +00:00
</openerp>