create_poll.tpl 18.7 KB
Newer Older
1
2
{extends file='page.tpl'}

3
{block name="header"}
Antonin's avatar
Antonin committed
4
    <script src="{"js/simplemde.min.js"|resource}" type="text/javascript"></script>
Antonin's avatar
Antonin committed
5
    <script src="{"js/mde-wrapper.js"|resource}" type="text/javascript"></script>
6
    <script src="{"js/app/create_poll.js"|resource}" type="text/javascript"></script>
7
    <link rel="stylesheet" href="{"css/app/create_poll.css"|resource}">
Antonin's avatar
Antonin committed
8
    <link rel="stylesheet" href="{"css/simplemde.min.css"|resource}">
Antonin's avatar
Antonin committed
9

10
11
{/block}

12
13
14
15
16
17
18
19
20
21
22
{block name=main}
    <div class="row" style="display:none" id="form-block">
        <div class="col-md-8 col-md-offset-2">
            <form name="formulaire" id="formulaire" action="" method="POST" class="form-horizontal" role="form">

                <div class="alert alert-info">
                    <p>
                        {__('Step 1', 'You are in the poll creation section.')}<br/>
                        {__('Step 1', 'Required fields cannot be left blank.')}
                    </p>
                </div>
23

24
25
                <div class="form-group {$errors['name']['class']}">
                    <label for="yourname" class="col-sm-4 control-label">{__('Generic', 'Your name')} *</label>
26
27

                    <div class="col-sm-8">
28
29
30
                        {if $useRemoteUser}
                            <input type="hidden" name="name" value="{$form->admin_name}" />{$form->admin_name}
                        {else}
31
                            <input id="yourname" type="text" required name="name" class="form-control" {$errors['name']['aria']} value="{$poll_name|html}" />
32
                        {/if}
33
34
                    </div>
                </div>
35
                {if !empty($errors['name']['msg'])}
36
37
                    <div class="alert alert-danger">
                        <p id="poll_title_error">
38
                            {$errors['name']['msg']}
39
40
41
42
                        </p>
                    </div>
                {/if}

43
                {if $use_smtp}
Thomas Citharel's avatar
Thomas Citharel committed
44
45
46
47
48
49
50
51
52
53
                <div class="form-group {$errors['email']['class']}">
                    <label for="email" class="col-sm-4 control-label">
                        {__('Generic', 'Your email address')} *<br/>
                        <span class="small">{__('Generic', '(in the format name@mail.com)')}</span>
                    </label>

                    <div class="col-sm-8">
                        {if $useRemoteUser}
                            <input type="hidden" name="mail" value="{$form->admin_mail}">{$form->admin_mail}
                        {else}
54
                            <input id="email" required type="email" name="mail" class="form-control" {$errors['email']['aria']} value="{$poll_mail|html}" />
Thomas Citharel's avatar
Thomas Citharel committed
55
                        {/if}
56
                    </div>
Thomas Citharel's avatar
Thomas Citharel committed
57
58
59
60
61
62
63
64
                </div>
                {if !empty($errors['email']['msg'])}
                <div class="alert alert-danger">
                    <p id="poll_title_error">
                        {$errors['email']['msg']}
                    </p>
                </div>
                {/if}
65
66
67
68
69
70
71

                {/if}

                <div class="form-group {$errors['title']['class']}">
                    <label for="poll_title" class="col-sm-4 control-label">{__('Step 1', 'Poll title')} *</label>

                    <div class="col-sm-8">
72
                        <input id="poll_title" type="text" name="title" class="form-control" required {$errors['title']['aria']}
73
                               value="{$poll_title|html}"/>
74
75
                    </div>
                </div>
76
                {if !empty($errors['title']['msg'])}
77
78
                    <div class="alert alert-danger">
                        <p id="poll_title_error">
79
                            {$errors['title']['msg']}
80
81
82
83
                        </p>
                    </div>
                {/if}

Olivier PEREZ's avatar
Olivier PEREZ committed
84
                <div class="form-group {$errors['description']['class']}">
85
86
87
                    <label for="poll_comments" class="col-sm-4 control-label">{__('Generic', 'Description')}</label>

                    <div class="col-sm-8">
88
                        {include 'part/description_markdown.tpl'}
Antonin's avatar
Antonin committed
89
90
91
92
93
                        <div>
                            <textarea id="poll_comments" name="description"
                                      class="form-control" {$errors['description']['aria']}
                                      rows="5">{$poll_description|escape}</textarea>
                        </div>
94
95
96
97
98
99
100
101
102
103
                    </div>
                </div>
                {if !empty($errors['description']['msg'])}
                    <div class="alert alert-danger">
                        <p id="poll_title_error">
                            {$errors['description']['msg']}
                        </p>
                    </div>
                {/if}

104
105
106
107
108
109
110
111
112
113
                {* Optionnal parameters *}
                <div class="col-sm-offset-3 col-sm-1 hidden-xs">
                    <p class="lead">
                        <i class="glyphicon glyphicon-cog" aria-hidden="true"></i>
                    </p>
                </div>
                <div class="col-sm-8 col-xs-12">
                    <span class="lead visible-xs-inline">
                        <i class="glyphicon glyphicon-cog" aria-hidden="true"></i>
                    </span>
114
                    <a class="optionnal-parameters {if !$advanced_errors}collapsed{/if} lead" role="button" data-toggle="collapse" href="#optionnal" aria-expanded="{if $advanced_errors}false{else}true{/if}" aria-controls="optionnal">
115
                        {__('Step 1', "Optional parameters")}
116
117
118
                        <i class="caret" aria-hidden="true"></i>
                        <i class="caret caret-up" aria-hidden="true"></i>
                    </a>
119
120

                </div>
121
122
123
                <div class="clearfix"></div>


124
                <div class="collapse{if $advanced_errors} in{/if}" id="optionnal" {if $advanced_errors}aria-expanded="true"{/if}>
Thomas Citharel's avatar
Thomas Citharel committed
125
                {* Poll identifier *}
Thomas Citharel's avatar
Thomas Citharel committed
126
127
128

                    <div class="form-group {$errors['customized_url']['class']}">

Thomas Citharel's avatar
Thomas Citharel committed
129
                        {* Value MAX *}
130
                        <div class="form-group {$errors['ValueMax']['class']}">
Thomas Citharel's avatar
Thomas Citharel committed
131
132
133
134
135
136
                                    <label for="use_valueMax" class="col-sm-4 control-label">
                        {__('Step 1', 'Value Max')}<br/>
                                    </label>
                                    <div class="col-sm-8">
                                        <div class="checkbox">
                                            <label>
137
138
                                                <input id="use_ValueMax" name="use_ValueMax" type="checkbox" {if $use_ValueMax}checked{/if}>
                                    {__('Step 1', "Limit the amount of voters per option")}
Thomas Citharel's avatar
Thomas Citharel committed
139
140
141
                                </label>
                                        </div>
                                    </div>
142
143
                        </div>

144
145
                        <div class="form-group {$errors['ValueMax']['class']}">
                            <div id="ValueMax" {if !$use_ValueMax}class="hidden"{/if}>
Thomas Citharel's avatar
Thomas Citharel committed
146

Thomas Citharel's avatar
Thomas Citharel committed
147
148
                                <div class="col-sm-offset-4 col-sm-8">
                                    <label>
149
                                            <input id="ValueMax" type="number" min="0" name="ValueMax" value="{$ValueMax|html}" {$errors['ValueMax']['aria']}>
Thomas Citharel's avatar
Thomas Citharel committed
150

Thomas Citharel's avatar
Thomas Citharel committed
151
                                            {__('Step 1', "ValueMax instructions")}
152
                                    </label>
Thomas Citharel's avatar
Thomas Citharel committed
153

Thomas Citharel's avatar
Thomas Citharel committed
154
155
156
                                </div>
                            </div>
                       </div>
157

158
159
160
161
162
163
164
165
                        {if !empty($errors['ValueMax']['msg'])}
                            <div class="alert alert-danger">
                                <p id="poll_customized_url_error">
                                    {$errors['ValueMax']['msg']}
                                </p>
                            </div>
                        {/if}

166

Thomas Citharel's avatar
Thomas Citharel committed
167
                        {* Poll identifier *}
168
                        <div class="form-group {$errors['customized_url']['class']}">
Thomas Citharel's avatar
Thomas Citharel committed
169
170
                            <label for="poll_id" class="col-sm-4 control-label">
                                {__('Step 1', 'Poll id')}<br/>
171
                            </label>
Thomas Citharel's avatar
Thomas Citharel committed
172

173
                            <div class="col-sm-8">
Thomas Citharel's avatar
Thomas Citharel committed
174
175
176
177
178
                                <div class="checkbox">
                                    <label>
                                        <input id="use_customized_url" name="use_customized_url" type="checkbox" {if $use_customized_url}checked{/if}/>
                                        {__('Step 1', 'Customize the URL')}
                                    </label>
179
                                </div>
Olivier Perez's avatar
Olivier Perez committed
180
                            </div>
181
                        </div>
Thomas Citharel's avatar
Thomas Citharel committed
182
183
184
185
                        <div id="customized_url_options" {if !$use_customized_url}class="hidden"{/if}>
                            <div class="form-group {$errors['customized_url']['class']}">
                                <label for="customized_url" class="col-sm-4 control-label">
                                    <span id="pollUrlDesc" class="small">{__('Step 1', 'Poll id rules')}</span>
186
                                </label>
Thomas Citharel's avatar
Thomas Citharel committed
187
188
189
190
191
192
193
194
195
196
                                <div class="col-sm-8">
                                    <div class="input-group">
                                        <span class="input-group-addon">
                                            {$SERVER_URL}
                                        </span>
                                        <input id="customized_url" type="text" name="customized_url" class="form-control" {$errors['customized_url']['aria']}
                                               value="{$customized_url|html}" aria-describedBy="pollUrlDesc" maxlength="64"
                                               pattern="[A-Za-z0-9-]+"/>
                                    </div>
                                    <span class="help-block text-warning">{__('Step 1', 'Poll id warning')}</span>
197
198
                                </div>
                            </div>
Thomas Citharel's avatar
Thomas Citharel committed
199
                            {if !empty($errors['customized_url']['msg'])}
200
                                <div class="alert alert-danger">
Thomas Citharel's avatar
Thomas Citharel committed
201
202
                                    <p id="poll_customized_url_error">
                                        {$errors['customized_url']['msg']}
203
204
205
                                    </p>
                                </div>
                            {/if}
Thomas Citharel's avatar
Thomas Citharel committed
206
207
208
209
210
211
212
213
214
215
                        </div>

                        {* Password *}

                        <div class="form-group">
                            <label for="poll_id" class="col-sm-4 control-label">
                                {__('Step 1', 'Poll password')}
                            </label>

                            <div class="col-sm-8">
216
217
                                <div class="checkbox">
                                    <label>
Thomas Citharel's avatar
Thomas Citharel committed
218
219
220
                                        <input type="checkbox" name="use_password" {if $poll_use_password}checked{/if}
                                               id="use_password">
                                        {__('Step 1', "Use a password to restrict access")}
221
222
223
                                    </label>
                                </div>
                            </div>
224

Thomas Citharel's avatar
Thomas Citharel committed
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
                            <div id="password_options"{if !$poll_use_password} class="hidden"{/if}>
                                <div class="col-sm-offset-4 col-sm-8">
                                    <div class="input-group">
                                        <input id="poll_password" type="password" name="password" class="form-control" {$errors['password']['aria']}/>
                                        <label for="poll_password" class="input-group-addon">{__('Step 1', 'Password choice')}</label>
                                    </div>
                                </div>
                                {if !empty($errors['password']['msg'])}
                                    <div class="alert alert-danger">
                                        <p id="poll_password_error">
                                            {$errors['password']['msg']}
                                        </p>
                                    </div>
                                {/if}
                                <div class="col-sm-offset-4 col-sm-8">
                                    <div class="input-group">
                                        <input id="poll_password_repeat" type="password" name="password_repeat" class="form-control" {$errors['password_repeat']['aria']}/>
                                        <label for="poll_password_repeat" class="input-group-addon">{__('Step 1', 'Password confirmation')}</label>
                                    </div>
                                </div>
                                {if !empty($errors['password_repeat']['msg'])}
                                    <div class="alert alert-danger">
                                        <p id="poll_password_repeat_error">
                                            {$errors['password_repeat']['msg']}
                                        </p>
                                    </div>
                                {/if}
                                <div class="col-sm-offset-4 col-sm-8">
                                    <div class="checkbox">
                                        <label>
                                            <input type="checkbox" name="results_publicly_visible"
                                                   {if $poll_results_publicly_visible}checked{/if} id="results_publicly_visible"/>
                                            {__('Step 1', "The results are publicly visible")}
                                        </label>
                                    </div>
                                </div>
261
262
                            </div>
                        </div>
263
264

                        <div class="form-group">
Thomas Citharel's avatar
Thomas Citharel committed
265
266
267
268
269
270
271
272
273
274
275
276
277
                            <label for="poll_id" class="col-sm-4 control-label">
                                {__('Step 1', 'Permissions')}
                            </label>
                            <div class="col-sm-8">
                                <div class="radio">
                                    <label>
                                        <input type="radio" name="editable" id="editableByAll" {if $poll_editable==constant("Framadate\Editable::EDITABLE_BY_ALL")}checked{/if} value="{constant("Framadate\Editable::EDITABLE_BY_ALL")}">
                                        {__('Step 1', 'All voters can modify any vote')}
                                    </label>
                                    <label>
                                        <input type="radio" name="editable" {if $poll_editable==constant("Framadate\Editable::EDITABLE_BY_OWN")}checked{/if} value="{constant("Framadate\Editable::EDITABLE_BY_OWN")}">
                                        {__('Step 1', 'Voters can modify their vote themselves')}
                                    </label>
278
                                    <label>
Thomas Citharel's avatar
Thomas Citharel committed
279
280
                                        <input type="radio" name="editable" {if empty($poll_editable) or $poll_editable==constant("Framadate\Editable::NOT_EDITABLE")}checked{/if} value="{constant("Framadate\Editable::NOT_EDITABLE")}">
                                        {__('Step 1', 'Votes cannot be modified')}
281
282
283
284
                                    </label>
                                </div>
                            </div>
                        </div>
Thomas Citharel's avatar
Thomas Citharel committed
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311


                        {if $use_smtp}
                            <div class="form-group">
                                <div class="col-sm-offset-4 col-sm-8">
                                    <div class="checkbox">
                                        <label>
                                            <input type="checkbox" name="receiveNewVotes" {if $poll_receiveNewVotes}checked{/if}
                                            id="receiveNewVotes">
                                            {__('Step 1', 'To receive an email for each new vote')}
                                        </label>
                                    </div>
                                </div>
                            </div>
                            <div class="form-group">
                                <div class="col-sm-offset-4 col-sm-8">
                                    <div class="checkbox">
                                        <label>
                                            <input type="checkbox" name="receiveNewComments" {if $poll_receiveNewComments}checked{/if}
                                            id="receiveNewComments">
                                            {__('Step 1', 'To receive an email for each new comment')}
                                        </label>
                                    </div>
                                </div>
                            </div>
                        {/if}

312
313
314
315
                        <div class="form-group">
                            <div class="col-sm-offset-4 col-sm-8">
                                <div class="checkbox">
                                    <label>
Thomas Citharel's avatar
Thomas Citharel committed
316
317
318
                                        <input type="checkbox" name="hidden" {if $poll_hidden}checked{/if}
                                        id="hidden">
                                        {__('Step 1', "Only the poll maker can see the poll's results")}
319
320
                                    </label>
                                </div>
Thomas Citharel's avatar
Thomas Citharel committed
321
322
323
324
325
                                <div id="hiddenWithBadEditionModeError" class="alert alert-danger hidden">
                                    <p>
                                        {__('Error', "You can't create a poll with hidden results with the following edition option:")}"{__('Step 1', 'All voters can modify any vote')}"
                                    </p>
                                </div>
326
                            </div>
327
328
                        </div>
                    </div>
329
330
                </div>

331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
                <p class="text-right">
                    <input type="hidden" name="type" value="$poll_type"/>
                    <button name="{$goToStep2}" value="{$poll_type}" type="submit"
                            class="btn btn-success">{__('Step 1', 'Go to step 2')}</button>
                </p>

                <script type="text/javascript">document.formulaire.title.focus();</script>

            </form>
        </div>
    </div>
    <noscript>
        <div class="alert alert-danger">
            {__('Step 1', 'Javascript is disabled on your browser. Its activation is required to create a poll.')}
        </div>
    </noscript>
    <div id="cookie-warning" class="alert alert-danger" style="display:none">
        {__('Step 1', 'Cookies are disabled on your browser. Theirs activation is required to create a poll.')}
    </div>
350
{/block}