.
This commit is contained in:
@@ -7,61 +7,25 @@
|
||||
<a href="{% url 'atlas:collection_delete' pk=collection.pk %}" title="Delete the Collection">Delete</a>
|
||||
</div>
|
||||
{% endif %}
|
||||
|
||||
<a href="{% url 'atlas:collection_update' collection.id %}" title="Edit the Collection">Edit</a>
|
||||
\ <a href="{% url 'atlas:collection:exam_delete' collection.id %}" title="Delete the Collection">Delete</a>
|
||||
\ <a href="{% url 'atlas:collection:exam_clone' collection.id %}" title="Clone the Collection">Clone</a>
|
||||
{% endif %}
|
||||
{% if request.user.is_superuser %}
|
||||
\ <a href="{% url 'admin:atlas_collection_change' collection.id %}" title="Edit the Collection using the admin interface">Admin Edit</a>
|
||||
{% endif %}
|
||||
|
||||
<h2>{{collection.name}}
|
||||
|
||||
{% include 'exam_notes.html' %}
|
||||
<ul>
|
||||
{% for case in collection.cases.all %}
|
||||
<li>{% if collection.collection_type == "REV" %}<a href="{% url 'atlas:collection_case_view' pk=collection.pk case_number=forloop.counter0 %}">Case {{forloop.counter}}</a>{% else %}Case {{forloop.counter}}{% endif %}
|
||||
{% if collection.show_title %}
|
||||
<li><a href="{% url 'atlas:collection_case_view' pk=collection.pk case_number=forloop.counter0 %}">Case {{forloop.counter}}</a>
|
||||
: {{case.title}}
|
||||
{% endif %}
|
||||
</li>
|
||||
|
||||
{% endfor %}
|
||||
</ul>
|
||||
{% if collection.collection_type == "REP" %}
|
||||
<h2>Start: {{exam.name}}</h2>
|
||||
|
||||
Enter your CID and passcode in the below boxes.<br />
|
||||
<p><input id="cid-box" type="text" value="Candidate ID"></p>
|
||||
<p><input id="passcode-box" type="text" value="Passcode"></p>
|
||||
|
||||
<button>Start</button>
|
||||
|
||||
<script type="text/javascript">
|
||||
$(document).ready(function () {
|
||||
window.location.search.substr(1).split("&").forEach((item) =>
|
||||
{
|
||||
s = item.split("=");
|
||||
if (s[0] == "cid") {
|
||||
$("#cid-box").val(s[1]);
|
||||
|
||||
}
|
||||
if (s[0] == "passcode") {
|
||||
$("#passcode-box").val(s[1]);
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
$("#cid-box, #passcode-box").keypress(function(e) {
|
||||
// Enter pressed?
|
||||
console.log(e)
|
||||
if(e.which == 10 || e.which == 13) {
|
||||
$("button").click();
|
||||
}
|
||||
});
|
||||
|
||||
$("button").click(() => {
|
||||
let cid = $("#cid-box").val();
|
||||
let passcode = $("#passcode-box").val();
|
||||
|
||||
if (Number.isInteger(parseInt(cid))) {
|
||||
window.location.replace("{% url 'atlas:collection_case_view_take' pk=collection.pk case_number=0 cid='0000000' passcode='ZZZZZZ' %}".replace("0000000", cid).replace("ZZZZZZ", passcode));
|
||||
} else {
|
||||
alert("Please enter a valid Candidate ID (CID).")
|
||||
}
|
||||
});
|
||||
});
|
||||
</script>
|
||||
{% endif %}
|
||||
|
||||
{% endblock %}
|
||||
@@ -0,0 +1,53 @@
|
||||
{% extends 'atlas/base.html' %}
|
||||
|
||||
{% block content %}
|
||||
<h2>{{collection.name}}
|
||||
<ul>
|
||||
</ul>
|
||||
{% if collection.collection_type == "REP" %}
|
||||
<h2>Start: {{exam.name}}</h2>
|
||||
|
||||
Enter your CID and passcode in the below boxes.<br />
|
||||
<p><input id="cid-box" type="text" value="Candidate ID"></p>
|
||||
<p><input id="passcode-box" type="text" value="Passcode"></p>
|
||||
|
||||
<button>Start</button>
|
||||
|
||||
<script type="text/javascript">
|
||||
$(document).ready(function () {
|
||||
window.location.search.substr(1).split("&").forEach((item) =>
|
||||
{
|
||||
s = item.split("=");
|
||||
if (s[0] == "cid") {
|
||||
$("#cid-box").val(s[1]);
|
||||
|
||||
}
|
||||
if (s[0] == "passcode") {
|
||||
$("#passcode-box").val(s[1]);
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
$("#cid-box, #passcode-box").keypress(function(e) {
|
||||
// Enter pressed?
|
||||
console.log(e)
|
||||
if(e.which == 10 || e.which == 13) {
|
||||
$("button").click();
|
||||
}
|
||||
});
|
||||
|
||||
$("button").click(() => {
|
||||
let cid = $("#cid-box").val();
|
||||
let passcode = $("#passcode-box").val();
|
||||
|
||||
if (Number.isInteger(parseInt(cid))) {
|
||||
window.location.replace("{% url 'atlas:collection_case_view_take' pk=collection.pk case_number=0 cid='0000000' passcode='ZZZZZZ' %}".replace("0000000", cid).replace("ZZZZZZ", passcode));
|
||||
} else {
|
||||
alert("Please enter a valid Candidate ID (CID).")
|
||||
}
|
||||
});
|
||||
});
|
||||
</script>
|
||||
{% endif %}
|
||||
|
||||
{% endblock %}
|
||||
@@ -18,6 +18,7 @@ urlpatterns = [
|
||||
path("collection/<int:pk>/delete", views.CaseCollectionDelete.as_view(), name="collection_delete"),
|
||||
path("collection/<int:pk>/update", views.CaseCollectionUpdate.as_view(), name="collection_update"),
|
||||
path("collection/<int:pk>", views.collection_detail, name="collection_detail"),
|
||||
path("collection/<int:pk>/take", views.collection_take, name="collection_take"),
|
||||
path("collection/<int:pk>/take/<int:cid>/<str:passcode>", views.collection_take_overview, name="collection_take_overview"),
|
||||
path("collection/<int:pk>/<int:case_number>", views.collection_case_view, name="collection_case_view"),
|
||||
path("collection/<int:pk>/<int:case_number>/take/<int:cid>/<str:passcode>", views.collection_case_view_take, name="collection_case_view_take"),
|
||||
|
||||
@@ -1064,6 +1064,13 @@ def collection_detail(request, pk):
|
||||
request, "atlas/collection_detail.html", {"collection": collection}
|
||||
)
|
||||
|
||||
def collection_take(request, pk):
|
||||
collection = get_object_or_404(CaseCollection, pk=pk)
|
||||
|
||||
return render(
|
||||
request, "atlas/collection_take.html", {"collection": collection}
|
||||
)
|
||||
|
||||
def collection_take_overview(request, pk, cid, passcode):
|
||||
collection = get_object_or_404(CaseCollection, pk=pk)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user