.
This commit is contained in:
@@ -2,105 +2,106 @@
|
|||||||
|
|
||||||
{% block content %}
|
{% block content %}
|
||||||
|
|
||||||
{% load thumbnail %}
|
{% load thumbnail %}
|
||||||
<div class="longs">
|
<div class="longs">
|
||||||
<a href="{% url 'longs:exam_update' exam.id %}" title="Edit the Exam">Edit</a>
|
<a href="{% url 'longs:exam_update' exam.id %}" title="Edit the Exam">Edit</a>
|
||||||
<a href="{% url 'longs:exam_delete' exam.id %}" title="Delete the Exam">Delete</a>
|
<a href="{% url 'longs:exam_delete' exam.id %}" title="Delete the Exam">Delete</a>
|
||||||
{% if request.user.is_superuser %}
|
{% if request.user.is_superuser %}
|
||||||
<a href="{% url 'admin:longs_exam_change' exam.id %}" title="Edit the Exam using the admin interface">Admin Edit</a>
|
<a href="{% url 'admin:longs_exam_change' exam.id %}" title="Edit the Exam using the admin interface">Admin Edit</a>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
<h1>Exam: {{ exam.name }}</h1>
|
<h1>Exam: {{ exam.name }}</h1>
|
||||||
|
|
||||||
{% include 'exam_notes.html' %}
|
{% include 'exam_notes.html' %}
|
||||||
|
|
||||||
This exam has {{question_number}} questions. Time limit: {{exam.time_limit}} seconds.<br />
|
This exam has {{question_number}} questions. Time limit: {{exam.time_limit}} seconds.<br />
|
||||||
Exam mode: {{ exam.exam_mode }}
|
Exam mode: {{ exam.exam_mode }}
|
||||||
|
|
||||||
{% if exam.exam_mode %}
|
{% if exam.exam_mode %}
|
||||||
<div class="parent-help" title="Click to enable / disable the exam">
|
<div class="parent-help" title="Click to enable / disable the exam">
|
||||||
Exam active: <input type="checkbox" id="exam-active-switch" {% if exam.active %}checked{% endif %}> <span
|
Exam active: <input type="checkbox" id="exam-active-switch" {% if exam.active %}checked{% endif %}> <span
|
||||||
class="help-text">[When checked the exam will be available to take in the test system]</span>
|
class="help-text">[When checked the exam will be available to take in the test system]</span>
|
||||||
</div>
|
|
||||||
<div class="parent-help" title="Click to enable / disable the exam results">
|
|
||||||
Publish results:
|
|
||||||
<input type="checkbox" id="exam-publish-results-switch" {% if exam.publish_results %}checked{% endif %}> <span
|
|
||||||
class="help-text">[When checked the exam results will
|
|
||||||
be available on this site]</span>
|
|
||||||
</div>
|
|
||||||
{% endif %}
|
|
||||||
<p><a href="{% url 'longs:mark_overview' pk=exam.pk %}"><button>Mark exam</button></a></p>
|
|
||||||
|
|
||||||
<ol id="full-question-list" class="sortable">
|
|
||||||
{% for question in questions.all %}
|
|
||||||
|
|
||||||
<li data-question_pk={{question.pk}}>
|
|
||||||
<span class="flex-col-2">
|
|
||||||
Description: {{ question.description}}
|
|
||||||
<br />
|
|
||||||
History: {{ question.history}}
|
|
||||||
<br />
|
|
||||||
<div>
|
|
||||||
Author(s): {{question.get_authors}}
|
|
||||||
</div>
|
|
||||||
<div>
|
|
||||||
<a href="{% url 'longs:exam_question_detail' exam.id forloop.counter0 %}"
|
|
||||||
title="View the question">View</a> / <a href="{% url 'longs:long_update' question.id %}"
|
|
||||||
title="Edit the question">Edit</a>
|
|
||||||
<span class="id">[id: {{question.pk}}]</span>
|
|
||||||
</div>
|
|
||||||
</span>
|
|
||||||
<span class="flex-col-3">
|
|
||||||
{% for series in question.series.all %}
|
|
||||||
<div class="series-block">
|
|
||||||
Series {{forloop.counter }}:<br />
|
|
||||||
{{series.get_block}}
|
|
||||||
</div>
|
</div>
|
||||||
{% empty %}
|
<div class="parent-help" title="Click to enable / disable the exam results">
|
||||||
No series
|
Publish results:
|
||||||
|
<input type="checkbox" id="exam-publish-results-switch" {% if exam.publish_results %}checked{% endif %}> <span
|
||||||
|
class="help-text">[When checked the exam results will
|
||||||
|
be available on this site]</span>
|
||||||
|
</div>
|
||||||
|
{% endif %}
|
||||||
|
<p><a href="{% url 'longs:mark_overview' pk=exam.pk %}"><button>Mark exam</button></a></p>
|
||||||
|
|
||||||
|
<ol id="full-question-list" class="sortable">
|
||||||
|
{% for question in questions.all %}
|
||||||
|
|
||||||
|
<li data-question_pk={{question.pk}}>
|
||||||
|
<span class="flex-col-2">
|
||||||
|
Description: {{ question.description}}
|
||||||
|
<br />
|
||||||
|
History: {{ question.history}}
|
||||||
|
<br />
|
||||||
|
<div>
|
||||||
|
Author(s): {{question.get_authors}}
|
||||||
|
</div>
|
||||||
|
<div>
|
||||||
|
<a href="{% url 'longs:exam_question_detail' exam.id forloop.counter0 %}"
|
||||||
|
title="View the question">View</a> / <a href="{% url 'longs:long_update' question.id %}"
|
||||||
|
title="Edit the question">Edit</a>
|
||||||
|
<span class="id"><a href="{% url 'longs:question_detail' question.id %}">[id:
|
||||||
|
{{question.pk}}]</a></span>
|
||||||
|
</div>
|
||||||
|
</span>
|
||||||
|
<span class="flex-col-3">
|
||||||
|
{% for series in question.series.all %}
|
||||||
|
<div class="series-block">
|
||||||
|
Series {{forloop.counter }}:<br />
|
||||||
|
{{series.get_block}}
|
||||||
|
</div>
|
||||||
|
{% empty %}
|
||||||
|
No series
|
||||||
|
{% endfor %}
|
||||||
|
</span>
|
||||||
|
</li>
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
</span>
|
</ol>
|
||||||
</li>
|
<div>
|
||||||
{% endfor %}
|
Author: {% for author in exam.author.all %}
|
||||||
</ol>
|
{{ author }},
|
||||||
<div>
|
{% endfor %}
|
||||||
Author: {% for author in exam.author.all %}
|
</div>
|
||||||
{{ author }},
|
|
||||||
{% endfor %}
|
{% if can_edit %}
|
||||||
|
|
||||||
|
<p><button id='button-edit-order'>Edit exam order</button></p>
|
||||||
|
<div>
|
||||||
|
JSON creation time: {{exam.json_creation_time}} ({{exam.json_creation_time|date:"c"}}),
|
||||||
|
JSON creation id: {{exam.exam_json_id}}
|
||||||
|
{% if exam.recreate_json %}[JSON out of date]{% endif %}
|
||||||
|
</div>
|
||||||
|
<a href="{% url 'longs:exam_json' pk=exam.pk %}">JSON</a>
|
||||||
|
<a href="{% url 'longs:exam_json_unbased' pk=exam.pk %}">JSON (unbased)</a>
|
||||||
|
<a href="{% url 'longs:exam_json_recreate' pk=exam.pk %}">Refresh JSON cache</a>
|
||||||
|
<a href="{% url 'longs:refresh_exam_question_json' pk=exam.pk %}">Refresh Question JSON cache</a>
|
||||||
|
|
||||||
|
<button id='button-open-access'>Make questions open access</button>
|
||||||
|
<button id='button-closed-access'>Make questions closed access</button>
|
||||||
|
{% endif %}
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
<script type="text/javascript">
|
||||||
{% if can_edit %}
|
$(document).ready(function () {
|
||||||
|
// send request to change the is_private state on customSwitches toggle
|
||||||
<p><button id='button-edit-order'>Edit exam order</button></p>
|
$("#exam-active-switch").on("change", function () {
|
||||||
<div>
|
$.ajax({
|
||||||
JSON creation time: {{exam.json_creation_time}} ({{exam.json_creation_time|date:"c"}}),
|
url: "{% url 'longs:exam_toggle_active' pk=exam.pk %}",
|
||||||
JSON creation id: {{exam.exam_json_id}}
|
data: {
|
||||||
{% if exam.recreate_json %}[JSON out of date]{% endif %}
|
csrfmiddlewaretoken: "{{ csrf_token }}",
|
||||||
</div>
|
active: this.checked // true if checked else false
|
||||||
<a href="{% url 'longs:exam_json' pk=exam.pk %}">JSON</a>
|
},
|
||||||
<a href="{% url 'longs:exam_json_unbased' pk=exam.pk %}">JSON (unbased)</a>
|
type: "POST",
|
||||||
<a href="{% url 'longs:exam_json_recreate' pk=exam.pk %}">Refresh JSON cache</a>
|
dataType: "json",
|
||||||
<a href="{% url 'longs:refresh_exam_question_json' pk=exam.pk %}">Refresh Question JSON cache</a>
|
})
|
||||||
|
|
||||||
<button id='button-open-access'>Make questions open access</button>
|
|
||||||
<button id='button-closed-access'>Make questions closed access</button>
|
|
||||||
{% endif %}
|
|
||||||
|
|
||||||
</div>
|
|
||||||
<script type="text/javascript">
|
|
||||||
$(document).ready(function () {
|
|
||||||
// send request to change the is_private state on customSwitches toggle
|
|
||||||
$("#exam-active-switch").on("change", function () {
|
|
||||||
$.ajax({
|
|
||||||
url: "{% url 'longs:exam_toggle_active' pk=exam.pk %}",
|
|
||||||
data: {
|
|
||||||
csrfmiddlewaretoken: "{{ csrf_token }}",
|
|
||||||
active: this.checked // true if checked else false
|
|
||||||
},
|
|
||||||
type: "POST",
|
|
||||||
dataType: "json",
|
|
||||||
})
|
|
||||||
// $.ajax().done(), $.ajax().fail(), $ajax().always() are upto you. Add/change accordingly
|
// $.ajax().done(), $.ajax().fail(), $ajax().always() are upto you. Add/change accordingly
|
||||||
.done(function (data) {
|
.done(function (data) {
|
||||||
console.log(data);
|
console.log(data);
|
||||||
|
|
||||||
if (data.status == "success") {
|
if (data.status == "success") {
|
||||||
@@ -109,22 +110,22 @@
|
|||||||
// show some message according to the response.
|
// show some message according to the response.
|
||||||
// For eg. A message box showing that the status has been changed
|
// For eg. A message box showing that the status has been changed
|
||||||
})
|
})
|
||||||
.always(function () {
|
.always(function () {
|
||||||
console.log('[Done]');
|
console.log('[Done]');
|
||||||
})
|
})
|
||||||
})
|
|
||||||
$("#exam-publish-results-switch").on("change", function () {
|
|
||||||
$.ajax({
|
|
||||||
url: "{% url 'longs:exam_toggle_results_published' pk=exam.pk %}",
|
|
||||||
data: {
|
|
||||||
csrfmiddlewaretoken: "{{ csrf_token }}",
|
|
||||||
publish_results: this.checked // true if checked else false
|
|
||||||
},
|
|
||||||
type: "POST",
|
|
||||||
dataType: "json",
|
|
||||||
})
|
})
|
||||||
|
$("#exam-publish-results-switch").on("change", function () {
|
||||||
|
$.ajax({
|
||||||
|
url: "{% url 'longs:exam_toggle_results_published' pk=exam.pk %}",
|
||||||
|
data: {
|
||||||
|
csrfmiddlewaretoken: "{{ csrf_token }}",
|
||||||
|
publish_results: this.checked // true if checked else false
|
||||||
|
},
|
||||||
|
type: "POST",
|
||||||
|
dataType: "json",
|
||||||
|
})
|
||||||
// $.ajax().done(), $.ajax().fail(), $ajax().always() are upto you. Add/change accordingly
|
// $.ajax().done(), $.ajax().fail(), $ajax().always() are upto you. Add/change accordingly
|
||||||
.done(function (data) {
|
.done(function (data) {
|
||||||
console.log(data);
|
console.log(data);
|
||||||
|
|
||||||
if (data.status == "success") {
|
if (data.status == "success") {
|
||||||
@@ -133,85 +134,85 @@
|
|||||||
// show some message according to the response.
|
// show some message according to the response.
|
||||||
// For eg. A message box showing that the status has been changed
|
// For eg. A message box showing that the status has been changed
|
||||||
})
|
})
|
||||||
.always(function () {
|
.always(function () {
|
||||||
console.log('[Done]');
|
console.log('[Done]');
|
||||||
})
|
})
|
||||||
})
|
|
||||||
$("#button-open-access").click(function () {
|
|
||||||
$.ajax({
|
|
||||||
url: "{% url 'longs:exam_json_edit' pk=exam.pk %}",
|
|
||||||
data: {
|
|
||||||
csrfmiddlewaretoken: "{{ csrf_token }}",
|
|
||||||
set_open_access: true,
|
|
||||||
},
|
|
||||||
type: "POST",
|
|
||||||
dataType: "json",
|
|
||||||
})
|
})
|
||||||
// $.ajax().done(), $.ajax().fail(), $ajax().always() are upto you. Add/change accordingly
|
$("#button-open-access").click(function () {
|
||||||
.done(function (data) {
|
|
||||||
console.log(data);
|
|
||||||
|
|
||||||
if (data.status == "success") {
|
|
||||||
toastr.info('Question access state changed.')
|
|
||||||
}
|
|
||||||
})
|
|
||||||
.always(function () {
|
|
||||||
console.log('[Done]');
|
|
||||||
})
|
|
||||||
})
|
|
||||||
$("#button-closed-access").click(function () {
|
|
||||||
$.ajax({
|
|
||||||
url: "{% url 'longs:exam_json_edit' pk=exam.pk %}",
|
|
||||||
data: {
|
|
||||||
csrfmiddlewaretoken: "{{ csrf_token }}",
|
|
||||||
set_open_access: false,
|
|
||||||
},
|
|
||||||
type: "POST",
|
|
||||||
dataType: "json",
|
|
||||||
})
|
|
||||||
// $.ajax().done(), $.ajax().fail(), $ajax().always() are upto you. Add/change accordingly
|
|
||||||
.done(function (data) {
|
|
||||||
console.log(data);
|
|
||||||
|
|
||||||
if (data.status == "success") {
|
|
||||||
toastr.info('Question access state changed.')
|
|
||||||
}
|
|
||||||
})
|
|
||||||
.always(function () {
|
|
||||||
console.log('[Done]');
|
|
||||||
})
|
|
||||||
})
|
|
||||||
$("#button-edit-order").click(function () {
|
|
||||||
$(this).remove();
|
|
||||||
sortable('.sortable');
|
|
||||||
|
|
||||||
$("#full-question-list").append($("<button>Save exam order</button>").click(() => {
|
|
||||||
new_order = [];
|
|
||||||
$("#full-question-list li").each((n, el) => {
|
|
||||||
new_order.push(el.dataset.question_pk)
|
|
||||||
})
|
|
||||||
$.ajax({
|
$.ajax({
|
||||||
url: "{% url 'longs:exam_json_edit' pk=exam.pk %}",
|
url: "{% url 'longs:exam_json_edit' pk=exam.pk %}",
|
||||||
data: {
|
data: {
|
||||||
csrfmiddlewaretoken: "{{ csrf_token }}",
|
csrfmiddlewaretoken: "{{ csrf_token }}",
|
||||||
set_exam_order: JSON.stringify(new_order),
|
set_open_access: true,
|
||||||
},
|
},
|
||||||
type: "POST",
|
type: "POST",
|
||||||
dataType: "json",
|
dataType: "json",
|
||||||
})
|
})
|
||||||
// $.ajax().done(), $.ajax().fail(), $ajax().always() are upto you. Add/change accordingly
|
// $.ajax().done(), $.ajax().fail(), $ajax().always() are upto you. Add/change accordingly
|
||||||
.done(function (data) {
|
.done(function (data) {
|
||||||
|
console.log(data);
|
||||||
|
|
||||||
|
if (data.status == "success") {
|
||||||
|
toastr.info('Question access state changed.')
|
||||||
|
}
|
||||||
|
})
|
||||||
|
.always(function () {
|
||||||
|
console.log('[Done]');
|
||||||
|
})
|
||||||
|
})
|
||||||
|
$("#button-closed-access").click(function () {
|
||||||
|
$.ajax({
|
||||||
|
url: "{% url 'longs:exam_json_edit' pk=exam.pk %}",
|
||||||
|
data: {
|
||||||
|
csrfmiddlewaretoken: "{{ csrf_token }}",
|
||||||
|
set_open_access: false,
|
||||||
|
},
|
||||||
|
type: "POST",
|
||||||
|
dataType: "json",
|
||||||
|
})
|
||||||
|
// $.ajax().done(), $.ajax().fail(), $ajax().always() are upto you. Add/change accordingly
|
||||||
|
.done(function (data) {
|
||||||
|
console.log(data);
|
||||||
|
|
||||||
|
if (data.status == "success") {
|
||||||
|
toastr.info('Question access state changed.')
|
||||||
|
}
|
||||||
|
})
|
||||||
|
.always(function () {
|
||||||
|
console.log('[Done]');
|
||||||
|
})
|
||||||
|
})
|
||||||
|
$("#button-edit-order").click(function () {
|
||||||
|
$(this).remove();
|
||||||
|
sortable('.sortable');
|
||||||
|
|
||||||
|
$("#full-question-list").append($("<button>Save exam order</button>").click(() => {
|
||||||
|
new_order = [];
|
||||||
|
$("#full-question-list li").each((n, el) => {
|
||||||
|
new_order.push(el.dataset.question_pk)
|
||||||
|
})
|
||||||
|
$.ajax({
|
||||||
|
url: "{% url 'longs:exam_json_edit' pk=exam.pk %}",
|
||||||
|
data: {
|
||||||
|
csrfmiddlewaretoken: "{{ csrf_token }}",
|
||||||
|
set_exam_order: JSON.stringify(new_order),
|
||||||
|
},
|
||||||
|
type: "POST",
|
||||||
|
dataType: "json",
|
||||||
|
})
|
||||||
|
// $.ajax().done(), $.ajax().fail(), $ajax().always() are upto you. Add/change accordingly
|
||||||
|
.done(function (data) {
|
||||||
console.log(data);
|
console.log(data);
|
||||||
|
|
||||||
if (data.status == "success") {
|
if (data.status == "success") {
|
||||||
toastr.info('Exam order changed.')
|
toastr.info('Exam order changed.')
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
.always(function () {
|
.always(function () {
|
||||||
console.log('[Done]');
|
console.log('[Done]');
|
||||||
})
|
})
|
||||||
}));
|
}));
|
||||||
|
});
|
||||||
});
|
});
|
||||||
});
|
</script>
|
||||||
</script>
|
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
@@ -59,6 +59,7 @@
|
|||||||
|
|
||||||
{% if view_feedback %}
|
{% if view_feedback %}
|
||||||
{% include 'question_notes.html' %}
|
{% include 'question_notes.html' %}
|
||||||
|
{% if not question.normal %}
|
||||||
<details>
|
<details>
|
||||||
<summary>
|
<summary>
|
||||||
Suggested answers
|
Suggested answers
|
||||||
@@ -70,6 +71,7 @@
|
|||||||
</ul>
|
</ul>
|
||||||
</details>
|
</details>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
{% endif %}
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<details open>
|
<details open>
|
||||||
|
|||||||
@@ -1,10 +1,10 @@
|
|||||||
{% if notes %}
|
{% if notes %}
|
||||||
<div class="alert alert-warning" role="alert">
|
<div class="alert alert-warning" role="alert">
|
||||||
The following questions have active notes
|
The following questions have active notes
|
||||||
<ul>
|
<ul>
|
||||||
{% for note in notes %}
|
{% for note in notes %}
|
||||||
<li>{{note.get_author_str}}: <a href="{{note.get_object_url}}">{{note.get_short_str}}</a></li>
|
<li>{{note.get_author_str}}: <a href="{{note.get_object_url}}">{{note.get_short_str}}</a></li>
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
</ul>
|
</ul>
|
||||||
</div>
|
</div>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
@@ -1,21 +1,21 @@
|
|||||||
Notes:
|
Notes:
|
||||||
<ul class="notes">
|
<ul class="notes">
|
||||||
{% for note in question.notes.all %}
|
{% for note in question.notes.all %}
|
||||||
<li {% if note.complete %}class='complete' {% endif %}>
|
<li {% if note.complete %}class='complete' {% endif %}>
|
||||||
{{ note.created_on }} by
|
{{ note.created_on }} by
|
||||||
{% if note.user_author %}
|
{% if note.user_author %}
|
||||||
{{note.user_author}}
|
{{note.user_author}}
|
||||||
{% else %}
|
{% else %}
|
||||||
{{ note.author }} [unregistered]
|
{{ note.author }} [unregistered]
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{{note.note_type}} / {{ note.note }}
|
{{note.note_type}} / {{ note.note }}
|
||||||
{% if not note.complete %}
|
{% if not note.complete %}
|
||||||
(<a href="{% url 'feedback_mark_complete' pk=note.pk %}">Mark complete</a>)
|
(<a href="{% url 'feedback_mark_complete' pk=note.pk %}">Mark complete</a>)
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{% if request.user.is_superuser %}
|
{% if request.user.is_superuser %}
|
||||||
(<a href="{% url 'feedback_note_delete' pk=note.pk %}">Delete</a>)
|
(<a href="{% url 'feedback_note_delete' pk=note.pk %}">Delete</a>)
|
||||||
{% endif %}
|
{% endif %}
|
||||||
</li>
|
</li>
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
{% if not question.notes.all %}No notes to display.{% endif %}
|
{% if not question.notes.all %}No notes to display.{% endif %}
|
||||||
</ul>
|
</ul>
|
||||||
Reference in New Issue
Block a user