1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
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
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
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
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
|
{% extends "base.html" %}
<!-- question.html -->
{% load extra_tags %}
{% load extra_filters %}
{% load smart_if %}
{% load humanize %}
{% load i18n %}
{% block title %}{% spaceless %}{{ question.get_question_title }}{% endspaceless %}{% endblock %}
{% block forejs %}
<meta name="description" content="{{question.summary}}" />
<meta name="keywords" content="{{question.tagname_meta_generator}}" />
<link rel="canonical" href="{{settings.APP_URL}}{{question.get_absolute_url}}" />
{% if not question.closed %}
<script type='text/javascript' src='{% href "/content/js/com.cnprog.editor.js" %}'></script>
<script type='text/javascript' src='{% href "/content/js/wmd/showdown.js" %}'></script>
<script type='text/javascript' src='{% href "/content/js/wmd/wmd.js" %}'></script>
<link rel="stylesheet" type="text/css" href="{% href "/content/js/wmd/wmd.css" %}" />
{% endif %}
<script type='text/javascript' src='{% href "/content/js/com.cnprog.post.js" %}'></script>
<script type='text/javascript' src='{% href "/content/js/jquery.validate.pack.js" %}'></script>
<script type="text/javascript">
// define reputation needs for comments
var repNeededForComments = 50;
$().ready(function(){
$("#nav_questions").attr('className',"on");
var answer_sort_tab = "{{ tab_id }}";
$("#" + answer_sort_tab).attr('className',"on");
Vote.init({{ question.id }}, '{{ question.author.id }}','{{ request.user.id }}');
{% if not question.closed and request.user.is_authenticated %}initEditor();{% endif %}
lanai.highlightSyntax();
$('#btLogin').bind('click', function(){window.location.href='{% url user_signin %}'; } )
});
function initEditor(){
$('#editor').TextAreaResizer();
//highlight code synctax when editor has new text
$("#editor").typeWatch({highlight: false, wait: 3000,
captureLength: 5, callback: lanai.highlightSyntax});
var display = true;
var txt = "[{% trans "hide preview" %}]";
$('#pre-collapse').text(txt);
$('#pre-collapse').bind('click', function(){
txt = display ? "[{% trans "show preview" %}]" : "[{% trans "hide preview" %}]";
display = !display;
$('#previewer').toggle();
$('#pre-collapse').text(txt);
});
setupFormValidation("#fmanswer", CPValidator.getQuestionFormRules(), CPValidator.getQuestionFormMessages());
}
</script>
{% endblock %}
{% block content %}
<div class="headNormal">
<a href="{{ question.get_absolute_url }}">{{ question.get_question_title }}</a>
</div>
<div id="main-body" class="">
<div id="askform">
<table style="width:100%;" id="question-table" {% if question.deleted %}class="deleted"{%endif%}>
<tr>
<td style="width:30px;vertical-align:top">
<div class="vote-buttons">
{% if question_vote %}
<img id="question-img-upvote-{{ question.id }}" class="question-img-upvote"
{% if question_vote.is_upvote %}
src="{% href "/content/images/vote-arrow-up-on.png" %}"
{% else %}
src="{% href "/content/images/vote-arrow-up.png" %}"
{% endif %}
alt="{% trans "i like this post (click again to cancel)" %}"
title="{% trans "i like this post (click again to cancel)" %}" />
<div id="question-vote-number-{{ question.id }}" class="vote-number"
title="{% trans "current number of votes" %}">
{{ question.score }}
</div>
<img id="question-img-downvote-{{ question.id }}" class="question-img-downvote"
{% if question_vote.is_downvote %}
src="{% href "/content/images/vote-arrow-down-on.png" %}"
{% else %}
src="{% href "/content/images/vote-arrow-down.png" %}"
{% endif %}
alt="{% trans "i dont like this post (click again to cancel)" %}"
title="{% trans "i dont like this post (click again to cancel)" %}" />
{% else %}
<img id="question-img-upvote-{{ question.id }}" class="question-img-upvote"
alt="{% trans "i like this post (click again to cancel)" %}"
src="{% href "/content/images/vote-arrow-up.png" %}"
title="{% trans "i like this post (click again to cancel)" %}" />
<div id="question-vote-number-{{ question.id }}" class="vote-number"
title="{% trans "current number of votes" %}">
{{ question.score }}
</div>
<img id="question-img-downvote-{{ question.id }}" class="question-img-downvote"
src="{% href "/content/images/vote-arrow-down.png" %}"
alt="{% trans "i dont like this post (click again to cancel)" %}"
title="{% trans "i dont like this post (click again to cancel)" %}" />
{% endif %}
{% if favorited %}
<img class="question-img-favorite" src="{% href "/content/images/vote-favorite-on.png" %}"
alt="{% trans "mark this question as favorite (click again to cancel)" %}"
title="{% trans "mark this question as favorite (click again to cancel)" %}" />
<div id="favorite-number" class="favorite-number my-favorite-number">
{{ question.favourite_count }}
</div>
{% else %}
<img class="question-img-favorite" src="{% href "/content/images/vote-favorite-off.png" %}"
alt="{% trans "remove favorite mark from this question (click again to restore mark)" %}"
title="{% trans "remove favorite mark from this question (click again to restore mark)" %}" />
<div id="favorite-number" class="favorite-number">
{% ifnotequal question.favourite_count 0 %}{{ question.favourite_count }}{% endifnotequal %}
</div>
{% endif %}
</div>
</td>
<td>
<div id="item-right">
<div class="question-body">
{{ question.html|safe }}
</div>
<div id="question-controls" class="post-controls">
<div id="question-tags" class="tags">
{% for tag in question.tagname_list %}
<a href="{% url forum.views.tag tag|urlencode %}" class="post-tag"
title="{% blocktrans with tag as tagname %}see questions tagged '{{ tagname }}'{% endblocktrans %}" rel="tag">{{ tag }}</a>
{% endfor %}
</div>
{% joinitems using '<span class="action-link-separator">|</span>' %}
{% if request.user|can_edit_post:question %}
<span class="action-link"><a href="{% url edit_question question.id %}">{% trans 'edit' %}</a></span>
{% endif %}
{% separator %}
<<<<<<< HEAD:templates/question.html
{% if request.user|can_delete_post:question %}
<span class="action-link"><a id="question-delete-link-{{question.id}}">{% trans "delete" %}</a></span>
{% endif %}
{% separator %}
=======
>>>>>>> 82d35490db90878f013523c4d1a5ec3af2df8b23:templates/question.html
{% if question.closed %}
{% if request.user|can_reopen_question:question %}
<span class="action-link"><a href="{% url reopen question.id %}">{% trans "reopen" %}</a></span>
{% endif %}
{% else %}
{% if request.user|can_close_question:question %}
<span class="action-link"><a href="{% url close question.id %}">{% trans "close" %}</a></span>
{% endif %}
{% endif %}
{% separator %}
{% if request.user|can_flag_offensive %}
<span id="question-offensive-flag-{{ question.id }}" class="offensive-flag"
title="{% trans "report as offensive (i.e containing spam, advertising, malicious text, etc.)" %}">
<a>{% trans "flag offensive" %}</a>
{% if request.user|can_view_offensive_flags and question.offensive_flag_count %}
<span class="darkred">({{ question.offensive_flag_count }})</span>
{% endif %}
</span>
{% endif %}
<<<<<<< HEAD:templates/question.html
=======
{% separator %}
{% if request.user|can_delete_post:question %}
<span class="action-link"><a id="question-delete-link-{{question.id}}">{% trans "delete" %}</a></span>
{% endif %}
>>>>>>> 82d35490db90878f013523c4d1a5ec3af2df8b23:templates/question.html
{% endjoinitems %}
</div>
<div class="post-update-info-container">
{% post_contributor_info question "original_author" %}
{% post_contributor_info question "last_updater" %}
</div>
<div class="comments-container" id="comments-container-question-{{question.id}}">
{% for comment in question.get_comments|slice:":5" %}
<p class="comment" id="comment-{{comment.id}}">
{{comment.comment}}
- <a class="comment-user" href="{{comment.user.get_profile_url}}">{{comment.user}}</a>
{% spaceless %}
<span class="comment-age">({% diff_date comment.added_at %})</span>
{% if request.user|can_delete_comment:comment %}
<img class="delete-icon"
src="{% href "/content/images/close-small.png" %}"
title="{% trans "delete this comment" %}"/>
{% endif %}
{% endspaceless %}
</p>
{% endfor %}
</div>
<div class="post-comments" style="margin-bottom:20px">
<input id="can-post-comments-question-{{question.id}}" type="hidden" value="{{ request.user|can_add_comments:question }}"/>
{% if request.user|can_add_comments:question or question.comment_count > 5 %}
<a id="comments-link-question-{{question.id}}" class="comments-link">
{% if request.user|can_add_comments:question %}
{% trans "add comment" %}
{% endif %}
{% if question.comment_count > 5 %}
{% if request.user|can_add_comments:question %}/
{% blocktrans count question.get_comments|slice:"5:"|length as counter %}
see <strong>one</strong> more
{% plural %}
see <strong>{{counter}}</strong> more
{% endblocktrans %}
{% else %}
{% blocktrans count question.get_comments|slice:"5:"|length as counter %}
see <strong>one</strong> more comment
{% plural %}
see <strong>{{counter}}</strong> more comments
{% endblocktrans %}
{% endif %}
{% endif %}</a>
{% endif %}
</div>
</div>
</td>
</tr>
</table>
{% if question.closed %}
<div class="question-status" style="margin-bottom:15px">
<h3>{% blocktrans with question.get_close_reason_display as close_reason %}The question has been closed for the following reason "{{ close_reason }}" by{% endblocktrans %}
<a href="{{ question.closed_by.get_profile_url }}">{{ question.closed_by.username }}</a>
{% blocktrans with question.closed_at as closed_at %}close date {{closed_at}}{% endblocktrans %}</h3>
</div>
{% endif %}
{% if answers %}
<hr/>
<div class="tabBar">
<a name="sort-top"></a>
<div class="headQuestions">
{% blocktrans count answers|length as counter %}
One Answer:
{% plural %}
{{counter}} Answers:
{% endblocktrans %}
</div>
<div class="tabsA">
<a id="oldest" href="{% url question question.id %}?sort=oldest#sort-top"
title="{% trans "oldest answers will be shown first" %}">{% trans "oldest answers" %}</a>
<a id="latest" href="{% url question question.id %}?sort=latest#sort-top"
title="{% trans "newest answers will be shown first" %}">{% trans "newest answers" %}</a>
<a id="votes" href="{% url question question.id %}?sort=votes#sort-top"
title="{% trans "most voted answers will be shown first" %}">{% trans "popular answers" %}</a>
</div>
</div>
{% cnprog_paginator context %}
{% for answer in answers %}
<a name="{{ answer.id }}"></a>
<div id="answer-container-{{ answer.id }}" class="answer {% if answer.accepted %}accepted-answer{% endif %} {% ifequal answer.author_id question.author_id %} answered-by-owner{% endifequal %} {% if answer.deleted %}deleted{% endif %}">
<table style="width:100%;">
<tr>
<td style="width:30px;vertical-align:top">
<div class="vote-buttons">
<img id="answer-img-upvote-{{ answer.id }}" class="answer-img-upvote"
src="{% blockresource %}/content/images/vote-arrow-up{% get_user_vote_image user_answer_votes answer.id 1 %}.png{% endblockresource %}"
alt="{% trans "i like this answer (click again to cancel)" %}"
title="{% trans "i like this answer (click again to cancel)" %}"/>
<div id="answer-vote-number-{{ answer.id }}" class="vote-number" title="{% trans "current number of votes" %}">
{{ answer.score }}
</div>
<img id="answer-img-downvote-{{ answer.id }}" class="answer-img-downvote"
src="{% blockresource %}/content/images/vote-arrow-down{% get_user_vote_image user_answer_votes answer.id -1 %}.png{% endblockresource %}"
alt="{% trans "i dont like this answer (click again to cancel)" %}"
title="{% trans "i dont like this answer (click again to cancel)" %}" />
{% ifequal request.user question.author %}
<img id="answer-img-accept-{{ answer.id }}" class="answer-img-accept"
src="{% blockresource %}/content/images/vote-accepted{% if answer.accepted %}-on{% endif %}.png{% endblockresource %}"
alt="{% trans "mark this answer as favorite (click again to undo)" %}"
title="{% trans "mark this answer as favorite (click again to undo)" %}" />
{% else %}
{% if answer.accepted %}
<img id="answer-img-accept-{{ answer.id }}" class="answer-img-accept"
src="{% blockresource %}/content/images/vote-accepted{% if answer.accepted %}-on{% endif %}.png{% endblockresource %}"
alt="{% trans "the author of the question has selected this answer as correct" %}"
title="{% trans "the author of the question has selected this answer as correct" %}" />
{% endif %}
{% endifequal %}
</div>
</td>
<td>
<div class="item-right">
<div class="answer-body">
{{ answer.html|safe }}
</div>
<div class="answer-controls post-controls">
{% joinitems using '<span class="action-link-separator">|</span>' %}
<span class="linksopt">
<a href="#{{ answer.id }}" title="{% trans "answer permanent link" %}">
{% trans "permanent link" %}
</a>
</span>
{% separator %}
{% if request.user|can_edit_post:answer %}
<span class="action-link"><a href="{% url edit_answer answer.id %}">{% trans 'edit' %}</a></span>
{% endif %}
{% separator %}
<<<<<<< HEAD:templates/question.html
{% if request.user|can_delete_post:answer %}
{% spaceless %}
<span class="action-link">
<a id="answer-delete-link-{{answer.id}}">
{% if answer.deleted %}{% trans "undelete" %}{% else %}{% trans "delete" %}{% endif %}</a>
</span>
{% endspaceless %}
{% endif %}
{% separator %}
=======
>>>>>>> 82d35490db90878f013523c4d1a5ec3af2df8b23:templates/question.html
{% if request.user|can_flag_offensive %}
<span id="answer-offensive-flag-{{ answer.id }}" class="offensive-flag"
title="{% trans "report as offensive (i.e containing spam, advertising, malicious text, etc.)" %}">
<a>{% trans "flag offensive" %}</a>
{% if request.user|can_view_offensive_flags and answer.offensive_flag_count %}
<span class="darkred">({{ answer.offensive_flag_count }})</span>
{% endif %}
</span>
{% endif %}
<<<<<<< HEAD:templates/question.html
=======
{% separator %}
{% if request.user|can_delete_post:answer %}
{% spaceless %}
<span class="action-link">
<a id="answer-delete-link-{{answer.id}}">
{% if answer.deleted %}{% trans "undelete" %}{% else %}{% trans "delete" %}{% endif %}</a>
</span>
{% endspaceless %}
{% endif %}
>>>>>>> 82d35490db90878f013523c4d1a5ec3af2df8b23:templates/question.html
{% endjoinitems %}
</div>
<div class="post-update-info-container">
{% post_contributor_info answer "original_author" %}
{% post_contributor_info answer "last_updater" %}
</div>
<div class="comments-container" id="comments-container-answer-{{answer.id}}">
{% for comment in answer.get_comments|slice:":5" %}
<p id="comment-{{comment.id}}" class="comment">
{{comment.comment}}
- <a class="comment-user" href="{{comment.user.get_profile_url}}">{{comment.user}}</a>
{% spaceless %}
<span class="comment-age">({% diff_date comment.added_at %})</span>
{% if request.user|can_delete_comment:comment %}
<img class="delete-icon"
src="{% href "/content/images/close-small.png" %}"
title="{% trans "delete this comment" %}"/>
{% endif %}
{% endspaceless %}
</p>
{% endfor %}
</div>
<div class="post-comments" style="margin-bottom:20px">
<input id="can-post-comments-answer-{{answer.id}}" type="hidden" value="{{ request.user|can_add_comments:answer}}"/>
{% if request.user|can_add_comments:answer or answer.comment_count > 5 %}
<a id="comments-link-answer-{{answer.id}}" class="comments-link">
{% if request.user|can_add_comments:answer %}
{% trans "add comment" %}
{% endif %}
{% if answer.comment_count > 5 %}
{% if request.user|can_add_comments:answer %}/
{% blocktrans count answer.get_comments|slice:"5:"|length as counter %}
see <strong>one</strong> more
{% plural %}
see <strong>{{counter}}</strong> more
{% endblocktrans %}
{% else %}
{% blocktrans count answer.get_comments|slice:"5:"|length as counter %}
see <strong>one</strong> more comment
{% plural %}
see <strong>{{counter}}</strong> more comments
{% endblocktrans %}
{% endif %}
{% endif %}</a>
{% endif %}
</div>
</div>
</td>
</tr>
</table>
</div>
{% endfor %}
<div class="paginator-container-left">
{% cnprog_paginator context %}
</div>
{% endif %}
<form id="fmanswer" action="{% url answer question.id %}" method="post">
{% if request.user.is_authenticated %}
<p style="padding-left:3px">
{{ answer.email_notify }}
<label for="question-subscribe-updates">
{% ifequal request.user.get_q_sel_email_feed_frequency 'n' %}
{% trans "Notify me once a day when there are any new answers" %}
{% else %}
{% ifequal request.user.get_q_sel_email_feed_frequency 'd' %}
{% trans "Notify me once a day when there are any new answers" %}
{% else %}
{% ifequal request.user.get_q_sel_email_feed_frequency 'w' %}
{% trans "Notify me weekly when there are any new answers" %}
{% endifequal %}
{% endifequal %}
{% endifequal %}
</label>
{% blocktrans with request.user.get_profile_url as profile_url %}
You can always adjust frequency of email updates from your {{profile_url}}
{% endblocktrans %}
</p>
{% else %}
<p style="padding-left:3px">
<input class="nomargin" type="checkbox" disabled="disabled" />
<label>{% trans "once you sign in you will be able to subscribe for any updates here" %}</label>
</p>
{% endif %}
<div style="clear:both">
</div>
{% if not question.closed %}
<div style="padding:10px 0 0 0;">
{% spaceless %}
<div class="headNormal">
{% if answers %}
{% trans "Your answer" %}
{% else %}
{% trans "Be the first one to answer this question!" %}
{% endif %}
</div>
{% endspaceless %}
</div>
{% if not request.user.is_authenticated %}
<div class="message">{% trans "you can answer anonymously and then login" %}</div>
{% else %}
<p class="message">
{% ifequal request.user question.author %}
{% trans "answer your own question only to give an answer" %}
{% else %}
{% trans "please only give an answer, no discussions" %}
{% endifequal %}
</p>
{% endif %}
<div id="description" class="" >
<div id="wmd-button-bar" class="wmd-panel"></div>
{{ answer.text }}
<div class="preview-toggle">
<table width="100%">
<tr>
<td>
<span id="pre-collapse"
title="{% trans "Toggle the real time Markdown editor preview" %}">
{% trans "toggle preview" %}
</span>
</td>
{% if settings.WIKI_ON %}
<td style="text-align:right;">
{{ answer.wiki }}
<span style="font-weight:normal;cursor:help"
title="{{answer.wiki.help_text}}">
{{ answer.wiki.label_tag }}
</span>
</td>
{% endif %}
</tr>
</table>
</div>
<div id="previewer" class="wmd-preview"></div>
{{ answer.text.errors }}
</div>
<p><span class="form-error"></span></p>
<input type="submit"
{% if user.is_anonymous %}
value="{% trans "Login/Signup to Post Your Answer" %}"
{% else %}
{% if user == question.author %}
value="{% trans "Answer Your Own Question" %}"
{% else %}
value="{% trans "Answer the question" %}"
{% endif %}
{% endif %}
class="submit" style="float:left"/>
{% endif %}
</form>
</div>
</div>
{% endblock %}
{% block sidebar %}
<div class="boxC">
<p>
{% trans "Question tags" %}:
</p>
<p class="tags" >
{% for tag in tags %}
<a href="{% url forum.views.tag tag.name|urlencode %}"
title="{% trans "see questions tagged"%}'{{tag.name}}'{% trans "using tags" %}"
rel="tag">{{ tag.name }}</a> <span class="tag-number">×{{ tag.used_count|intcomma }}</span><br/>
{% endfor %}
</p>
<p>
{% trans "question asked" %}: <strong title="{{ question.added_at }}">{% diff_date question.added_at %}</strong>
</p>
<p>
{% trans "question was seen" %}: <strong>{{ question.view_count|intcomma }} {% trans "times" %}</strong>
</p>
<p>
{% trans "last updated" %}: <strong title="{{ question.last_activity_at }}">{% diff_date question.last_activity_at %}</strong>
</p>
</div>
<div class="boxC">
<h3 class="subtitle">{% trans "Related questions" %}</h3>
<div class="questions-related">
{% for question in similar_questions %}
<p>
<a href="{{ question.get_absolute_url }}">{{ question.get_question_title }}</a>
</p>
{% endfor %}
</div>
</div>
{% endblock %}
{% block endjs %}
{% endblock %}
<!-- end question.html -->
|