1{# 2 LimeSurvey 3 Copyright (C) 2007-2017 The LimeSurvey Project Team / Louis Gac 4 All rights reserved. 5 License: GNU/GPL License v2 or later, see LICENSE.php 6 LimeSurvey is free software. This version may have been modified pursuant 7 to the GNU General Public License, and as distributed it includes or 8 is derivative of works licensed under the GNU General Public License or 9 other free or open source software licenses. 10 See COPYRIGHT.php for copyright notices and details. 11 12 (¯`·._.·(¯`·._.· Save page Content ·._.·´¯)·._.·´¯) 13 14 This file displays the page shown to a respondent when they save the survey to complete later. 15 16 Depending on survey config, a navigator allowing the respondent to change their responses can be shown, and a end url. 17 18 Form data are in: aSurveyInfo.aSaveForm (errors, css classes, captcha, etc) 19 To show this data, turn debug mode on and copy the following line to the end of the <body> element in this file: 20 {{ dump(aSurveyInfo.aSaveForm ) }} ) 21 22 (¯`·._.·(¯`·._.· Advanced ·._.·´¯)·._.·´¯) 23 24 The form is generated using the Yii function CHtml::form. You must keep it to get the CRSF token. 25 Inputs are also generated using the Yii function CHtml. Eg: input textField is generated via CHtml::textField 26 You can replace those inputs by pure Html (<input type="text" ... />), just be sure to use the correct options (id, classes, required, etc) 27 @see: http://www.yiiframework.com/wiki/48/by-example-chtml/ , http://www.yiiframework.com/doc/api/1.1/CHtml 28 29 NOTE: This content is included inside mainrow.twig 30 NOTE: see layout_global.twig for more infos 31#} 32 33 34 35 36{# Include the form opening tag #} 37{{ include('./subviews/header/start_form.twig') }} <!-- main form --> 38 39 {# This will display the script and the hidden inputs needed for Expression Manager #} 40 {{ aSurveyInfo.EM.ScriptsAndHiddenInputs }} 41 42 <div class="{{ aSurveyInfo.class.savecontainer }} well clearfix " {{ aSurveyInfo.attr.savecontainer }}> 43 <div class="{{ aSurveyInfo.class.savecontainertitle }} h2" {{ aSurveyInfo.attr.savecontainertitle }}>{{ gT("Save your unfinished survey") }}</div> 44 <div class="{{ aSurveyInfo.class.savecontainertext }} text-info" {{ aSurveyInfo.attr.savecontainertext }}> 45 <p {{ aSurveyInfo.attr.savecontainertextpa }}> {{ gT("Enter a name and password for this survey and click save below.") }} </p> 46 <p {{ aSurveyInfo.attr.savecontainertextpb }}> {{ gT("Your survey will be saved using that name and password, and can be completed later by logging in with the same name and password.") }} </p> 47 <p class='{{ aSurveyInfo.class.savecontainertextpc }}' {{ aSurveyInfo.attr.savecontainertextpc }}> {{ gT("If you give an email address, an email containing the details will be sent to you.") }} </p> 48 <p {{ aSurveyInfo.attr.savecontainertextpd }}> {{ gT("After having clicked the save button you can either close this browser window or continue filling out the survey.") }} </p> 49 </div> 50 <div class="{{ aSurveyInfo.class.savecontainerwarning }} text-warning" {{ aSurveyInfo.attr.savecontainerwarning }}> 51 <p> {{ gT("To remain anonymous please use a pseudonym as your username, also an email address is not required.") }} </p> 52 </div> 53 </div> 54 55 <div class="{{ aSurveyInfo.class.saveformcontainer }}" {{ aSurveyInfo.attr.saveformcontainer }}> 56 57 {% if count(aSurveyInfo.aSaveForm.aErrors) > 0 %} 58 <ul class='{{ aSurveyInfo.aSaveForm.sClass }} {{ aSurveyInfo.class.saveformcontainerul }} alert alert-danger list-unstyled ' > 59 {% for key,error in aSurveyInfo.aSaveForm.aErrors %} 60 <li {{ aSurveyInfo.attr.saveformcontainerli }} >{{ error }}</li> 61 {% endfor %} 62 </ul> 63 {% endif %} 64 65 {# 66 array of attributes of the form tag. 67 To add a new attribute, just add an entry: 68 'attribute' : 'value', 69 #} 70 {% set htmlOptions = { 71 'id' : 'form-save', 72 'name' : 'form-save', 73 'class' : 'ls-form', 74 } 75 %} 76 77 {# 78 This generates the opening form tag and the CRSF token. 79 It uses the Yii fuction CHtml::form. 80 See: http://www.yiiframework.com/doc/api/1.1/CHtml#form-detail 81 #} 82 <!-- Save Form --> 83 {{ 84 C.Html.form( 85 ( aSurveyInfo.surveyUrl ), 86 'post', 87 (htmlOptions) 88 ) 89 }} 90 <!-- Hidden fields --> 91 {{ aSurveyInfo.aSaveForm.sHiddenField }} 92 93 <!-- Name and Password --> 94 <div class='{{ aSurveyInfo.class.saveformsurvey }} form-horizontal' {{ aSurveyInfo.attr.saveformsurvey }}> 95 <div class='{{ aSurveyInfo.class.saveformsurveydiva }} form-group ' {{ aSurveyInfo.attr.saveformsurveydiva }}> 96 97 <!-- Saved name --> 98 <label class='{{ aSurveyInfo.class.saveformsurveydivalabel }} control-label col-sm-3' {{ aSurveyInfo.attr.saveformsurveydivalabel }}> 99 {{ gT("Name:") }} 100 <small class="{{ aSurveyInfo.class.saveformsurveydivalabelsmall }} text-danger asterisk fa fa-asterisk pull-left small " {{ aSurveyInfo.attr.saveformsurveydivalabelsmall }} ></small> 101 <span class="{{ aSurveyInfo.class.saveformsurveydivalabelspan }} sr-only text-danger asterisk" {{ aSurveyInfo.attr.saveformsurveydivalabelspan }}>{{ gT("Mandatory") }}<span> 102 </label> 103 <div class='{{ aSurveyInfo.class.saveformsurveydivb }} col-sm-7 ' {{ aSurveyInfo.attr.saveformsurveydivb }}> 104 105 {% set htmlOptions = { 106 'id' : 'savename', 107 'name' : 'savename', 108 'class' : 'form-control', 109 'required' : true, 110 } 111 %} 112 113 {# using CHtml::textField because it encode (and break XSS) #} 114 {{ C.Html.textField( 115 'savename', 116 getPost('savename'), 117 (htmlOptions) 118 ) }} 119 </div> 120 121 </div> 122 123 <!-- Password --> 124 <div class='{{ aSurveyInfo.class.saveformsurveydivc }} form-group' {{ aSurveyInfo.attr.saveformsurveydivc }}> 125 <label class='{{ aSurveyInfo.class.saveformsurveydivclabel }} control-label col-sm-3 ' {{ aSurveyInfo.attr.saveformsurveydivclabel }}> 126 {{ gT("Password:") }} 127 <small class="{{ aSurveyInfo.class.saveformsurveydivcsmall }} text-danger asterisk fa fa-asterisk pull-left small" {{ aSurveyInfo.attr.saveformsurveydivcsmall }} ></small> 128 <span class="{{ aSurveyInfo.class.saveformsurveydivcspan }} sr-only text-danger asterisk" {{ aSurveyInfo.attr.saveformsurveydivcspan }}>{{ gT("Mandatory") }}<span> 129 </label> 130 131 <div class='{{ aSurveyInfo.class.saveformsurveydivcdiv }} col-sm-7 ' {{ aSurveyInfo.attr.saveformsurveydivcdiv }}> 132 133 {% set htmlOptions = { 134 'id' : 'savepass', 135 'name' : 'savepass', 136 'class' : 'form-control', 137 'required' : true, 138 } 139 %} 140 141 {{ C.Html.passwordField( 142 'savepass', 143 '', 144 (htmlOptions) 145 ) }} 146 </div> 147 </div> 148 149 <!-- Confirm password --> 150 <div class='{{ aSurveyInfo.class.saveformsurveydivd }} form-group ' {{ aSurveyInfo.attr.saveformsurveydivd }}> 151 <label class='{{ aSurveyInfo.class.saveformsurveydivdlabel }} control-label col-sm-3 ' {{ aSurveyInfo.attr.saveformsurveydivdlabel }} > 152 {{ gT("Repeat password:") }} 153 <small class="{{ aSurveyInfo.class.saveformsurveydivdlabelsmall }} text-danger asterisk fa fa-asterisk pull-left small" {{ aSurveyInfo.attr.saveformsurveydivdlabelsmall }}></small> 154 <span class="{{ aSurveyInfo.class.saveformsurveydivdlabelspan }} sr-only text-danger asterisk" {{ aSurveyInfo.attr.saveformsurveydivdlabelspan }}>{{ gT("Mandatory") }}<span> 155 </label> 156 157 <div class='{{ aSurveyInfo.class.saveformsurveydivddiv }} col-sm-7 ' {{ aSurveyInfo.attr.saveformsurveydivddiv }}> 158 {% set htmlOptions = { 159 'id' : 'savepass2', 160 'name' : 'savepass2', 161 'class' : 'form-control', 162 'required' : true, 163 } 164 %} 165 166 {{ C.Html.passwordField( 167 'savepass2', 168 '', 169 (htmlOptions) 170 ) }} 171 </div> 172 </div> 173 174 <!-- Email --> 175 <div class='{{ aSurveyInfo.class.saveformsurveydive }} form-group ' {{ aSurveyInfo.attr.saveformsurveydive }}> 176 <label class='{{ aSurveyInfo.class.saveformsurveydivelabel }} control-label col-sm-3 ' {{ aSurveyInfo.attr.saveformsurveydivelabel }} > 177 {{ gT("Your email address:") }} 178 </label> 179 <div class='{{ aSurveyInfo.class.saveformsurveydivediv }} col-sm-7 ' {{ aSurveyInfo.attr.saveformsurveydivediv }}> 180 181 {% set htmlOptions = { 182 'id' : 'saveemail', 183 'name' : 'saveemail', 184 'class' : 'form-control', 185 } 186 %} 187 188 {{ C.Html.emailField( 189 'saveemail', 190 '', 191 (htmlOptions) 192 ) }} 193 </div> 194 </div> 195 196 197 {% if aSurveyInfo.aSaveForm.aCaptcha.show %} 198 <!-- Captcha --> 199 <div class='{{ aSurveyInfo.class.saveformsurveydivf }} form-group ' {{ aSurveyInfo.attr.saveformsurveydivd }} > 200 <label class='{{ aSurveyInfo.class.saveformsurveydivflabel }} control-label col-sm-3 ' {{ aSurveyInfo.attr.saveformsurveydivdlabel }} > 201 {{ gT("Security question:") }} 202 </label> 203 <div class='{{ aSurveyInfo.class.saveformsurveydivfdiv }} col-sm-7 ' {{ aSurveyInfo.attr.saveformsurveydivddiv }} > 204 <div class='{{ aSurveyInfo.class.saveformsurveydivfdivdiv }} input-group' {{ aSurveyInfo.attr.saveformsurveydivddivdiv }}> 205 <div class='{{ aSurveyInfo.class.saveformsurveydivfdivdivdiv }} ' {{ aSurveyInfo.attr.saveformsurveydivddivdivdiv }} > 206 <img src='{{ aSurveyInfo.aSaveForm.aCaptcha.sImageUrl }}' {{ aSurveyInfo.attr.saveformsurveydivddivdivdivimg }} /> 207 </div> 208 <input class='{{ aSurveyInfo.class.saveformsurveydivfdivdivinput }} form-control' {{ aSurveyInfo.attr.saveformsurveydivfdivdivinput }} /> 209 </div> 210 </div> 211 </div> 212 {% endif %} 213 214 <!-- save button --> 215 <div class='{{ aSurveyInfo.class.saveformsurveydivg }} form-group' {{ aSurveyInfo.attr.saveformsurveydivg }}> 216 <div class='{{ aSurveyInfo.class.saveformsurveydivgdiv }} col-sm-7 col-md-offset-3' {{ aSurveyInfo.attr.saveformsurveydivgdiv }}> 217 <button {{ aSurveyInfo.attr.saveformsurveydivgdivbutton }} class='{{ aSurveyInfo.class.saveformsurveydivgdivbutton }} btn btn-default' > 218 {{ gT("Save Now") }} 219 </button> 220 </div> 221 </div> 222 </div> 223 224 225 <div class='{{ aSurveyInfo.class.saveformsurveydivh }}' {{ aSurveyInfo.attr.saveformsurveydivh }}> 226 <div class="{{ aSurveyInfo.class.saveformsurveydivhdiv }} " {{ aSurveyInfo.attr.saveformsurveydivhdiv }}> 227 <a href="{{ aSurveyInfo.surveyUrl }}" class="{{ aSurveyInfo.class.saveformsurveydivhdiva }}">{{ gT("Return to survey") }}</a> 228 </div> 229 </div> 230 </div> 231 232</form> <!-- main form --> 233