Lots of improvemnets
This commit is contained in:
@@ -26,17 +26,10 @@
|
||||
|
||||
document.addEventListener('drop', function (e) { e.preventDefault(); }, false);
|
||||
|
||||
function add_input_form() {
|
||||
var form_idx = $('#id_answers-TOTAL_FORMS').val();
|
||||
$('#form_set').append($('#empty_form').html().replace(/__prefix__/g, form_idx));
|
||||
$('#id_answers-TOTAL_FORMS').val(parseInt(form_idx) + 1);
|
||||
}
|
||||
|
||||
|
||||
$(document).ready(function () {
|
||||
$("#add_examination").appendTo($("label[for='id_examination']"));
|
||||
$("#add_body_part").appendTo($("label[for='id_body_part']"));
|
||||
$("#add_structure").appendTo($("label[for='id_structure']"));
|
||||
|
||||
|
||||
dropContainer = document.getElementById("drop-container");
|
||||
@@ -221,15 +214,18 @@
|
||||
{{ form.media }}
|
||||
{% endblock %}
|
||||
{% block content %}
|
||||
<h2>Submit Question</h2>
|
||||
|
||||
{% if object %}
|
||||
{% include 'anatomy/question_link_header.html' %}
|
||||
{% endif %}
|
||||
|
||||
<h2>{{object|yesno:"Update,Create"}} Question</h2>
|
||||
<form action="" method="post" enctype="multipart/form-data" id="anatomyquestion-form">
|
||||
{% csrf_token %}
|
||||
<a href="/anatomy/examination/create" id="add_examination" class="add-popup"
|
||||
onclick="return showAddPopup(this);"><img src="{% static '/img/icon-addlink.svg' %}"></a>
|
||||
<a href="/anatomy/body_part/create" id="add_body_part" class="add-popup"
|
||||
onclick="return showAddPopup(this);"><img src="{% static '/img/icon-addlink.svg' %}"></a>
|
||||
<a href="/anatomy/structure/create" id="add_structure" class="add-popup" onclick="return showAddPopup(this);"><img
|
||||
src="{% static '/img/icon-addlink.svg' %}"></a>
|
||||
|
||||
<table>
|
||||
{{ form.as_table }}
|
||||
@@ -237,24 +233,6 @@
|
||||
<div id="drop-container" class="drop-target">Drop image here
|
||||
<div id="drop-filenames"></div>
|
||||
</div>
|
||||
<h3>Answers:</h3>
|
||||
<input type="button" value="Add More Answers" id="add_more">
|
||||
<div id="form_set">
|
||||
{% for form in answer_formset %}
|
||||
<ul class="no-error answer-formset">
|
||||
{{form.non_field_errors}}
|
||||
{{form.errors}}
|
||||
{{ form.as_ul }}
|
||||
</ul>
|
||||
{% endfor %}
|
||||
</div>
|
||||
{{ answer_formset.management_form }}
|
||||
<input type="submit" class="submit-button" value="Submit" name="submit">
|
||||
<input type="submit" class="submit-button" value="Submit and Clone" name="submit-clone">
|
||||
</form>
|
||||
<div id="empty_form" style="display:none">
|
||||
<ul class='no_error answer-formset'>
|
||||
{{ answer_formset.empty_form.as_ul }}
|
||||
</ul>
|
||||
</div>
|
||||
{% endblock %}
|
||||
@@ -0,0 +1,56 @@
|
||||
{% extends "anatomy/base.html" %}
|
||||
|
||||
{% load static %}
|
||||
|
||||
{% block js %}
|
||||
<!--<script type="text/javascript" src="/admin/jsi18n/"></script>-->
|
||||
|
||||
<script type="text/javascript">
|
||||
|
||||
function add_input_form() {
|
||||
var form_idx = $('#id_answers-TOTAL_FORMS').val();
|
||||
$('#form_set').append($('#empty_form').html().replace(/__prefix__/g, form_idx));
|
||||
$('#id_answers-TOTAL_FORMS').val(parseInt(form_idx) + 1);
|
||||
}
|
||||
|
||||
$(document).ready(function () {
|
||||
$('#add_more').click(() => {
|
||||
add_input_form()
|
||||
});
|
||||
});
|
||||
|
||||
</script>
|
||||
|
||||
{{ form.media }}
|
||||
{% endblock %}
|
||||
{% block content %}
|
||||
|
||||
{% if object %}
|
||||
{% include 'anatomy/question_link_header.html' %}
|
||||
{% endif %}
|
||||
<h2>Question Answers</h2>
|
||||
This page can be used to add and modify answers associated with a question. Answers in here will be used for automarking submitted answers so it is best not to remove. Updating an answer here will not automatically update a submitted answers (scores cache would need to be refreshed)
|
||||
<form action="" method="post" enctype="multipart/form-data" id="anatomyquestion-form">
|
||||
{% csrf_token %}
|
||||
<h3>Answers:</h3>
|
||||
<div id="form_set">
|
||||
{% for form in answer_formset %}
|
||||
<ul class="no-error answer-formset">
|
||||
{{form.non_field_errors}}
|
||||
{{form.errors}}
|
||||
{{ form.as_ul }}
|
||||
</ul>
|
||||
{% endfor %}
|
||||
</div>
|
||||
{{ answer_formset.management_form }}
|
||||
<input type="button" value="Add More Answers" id="add_more">
|
||||
<p>
|
||||
<input type="submit" class="submit-button" value="Submit" name="submit">
|
||||
</p>
|
||||
</form>
|
||||
<div id="empty_form" style="display:none">
|
||||
<ul class='no_error answer-formset'>
|
||||
{{ answer_formset.empty_form.as_ul }}
|
||||
</ul>
|
||||
</div>
|
||||
{% endblock %}
|
||||
@@ -1,19 +1,24 @@
|
||||
{% extends 'generic/exam_scores_base.html' %}
|
||||
|
||||
{% block table_answers %}
|
||||
{% for question in questions %}
|
||||
<tr>
|
||||
<td><a href="{% url 'anatomy:mark' exam_pk=exam.pk sk=forloop.counter0 %}">Question {{forloop.counter}}</a>
|
||||
</td>
|
||||
{% for question in questions %}
|
||||
<tr>
|
||||
<td><a href="{% url 'anatomy:mark' exam_pk=exam.pk sk=forloop.counter0 %}">Question {{forloop.counter}}</a>
|
||||
</td>
|
||||
{% comment %} {% for cid in cids %}
|
||||
<td class="anatomy-ans user-answer-score-{{score_by_question|get_item:question|get_item:cid}}" title="answer score: {{score_by_question|get_item:question|get_item:cid}}">{{ans_by_question|get_item:question|get_item:cid}}</td>
|
||||
{% endfor %} {% endcomment %}
|
||||
{% for cid in cids %}
|
||||
{% with by_question|get_item:question|get_item:cid as ans_score %}
|
||||
<td class="anatomy-ans user-answer-score-{{ans_score.1}}" title="answer score: {{ans_score.1}}">{{ans_score.0}}</td>
|
||||
{% endwith %}
|
||||
{% endfor %}
|
||||
</tr>
|
||||
{% for cid in cids %}
|
||||
{% with by_question|get_item:question|get_item:cid as ans_score %}
|
||||
<td class="anatomy-ans user-answer-score-{{ans_score.1}}"
|
||||
title="answer score: {{ans_score.1}}"
|
||||
data-examquestionindex={{forloop.parentloop.counter0}}
|
||||
data-cid={{cid}}
|
||||
>{{ans_score.0}}<a class="show-on-hover" href="{% url 'anatomy:exam_question_user_answer' exam.pk forloop.parentloop.counter0 cid|slice:':1' cid|slice:'2:' %}"><i class="bi bi-pen"></i>
|
||||
</a></td>
|
||||
{% endwith %}
|
||||
{% endfor %}
|
||||
</tr>
|
||||
{% endfor %}
|
||||
{% endblock table_answers %}
|
||||
|
||||
|
||||
@@ -1,45 +1,20 @@
|
||||
{% extends 'anatomy/base.html' %}
|
||||
|
||||
{% block content %}
|
||||
{% load static %}
|
||||
{% load static %}
|
||||
<!-- testing -->
|
||||
<!--<div id="dicom-image" data-url="http://localhost:8000/static/abdoct.jpg"
|
||||
data-annotations='{{question.image_annotations}}' data-edit_annotation=true></div>-->
|
||||
<div class="floating-header">
|
||||
<a href="{% url 'anatomy:anatomy_question_update' question.id %}" title="Edit the Question">Edit</a>
|
||||
<a href="{% url 'anatomy:question_clone' question.id %}" title="Clone the Question">Clone</a>
|
||||
<a href="{% url 'anatomy:question_delete' pk=question.pk %}" title="Delete the Question">Delete</a>
|
||||
<a href="#"
|
||||
onclick="return window.create_popup_window('{% url 'feedback_create' question_type='anatomy' pk=question.pk %}')">
|
||||
Add Note</a>
|
||||
|
||||
{% if request.user.is_superuser %}
|
||||
<a href="{% url 'admin:anatomy_anatomyquestion_change' question.id %}"
|
||||
title="Edit the Question using the admin interface">Admin Edit</a>
|
||||
<a href="{% url 'anatomy:question_user_answers' question.id %}" title="View user answers associated with this question">User answers</a>
|
||||
{% endif %}
|
||||
{% if exam %}
|
||||
<div>
|
||||
|
||||
{% if previous > -1 %}
|
||||
<a href="{% url 'anatomy:exam_question_detail' exam.id previous %}">Previous question</a>
|
||||
{% endif %}
|
||||
Viewing question as part of exam: <a href="{% url 'anatomy:exam_overview' exam.id %}">{{exam.name}}</a> [{{pos}}/{{exam_length}}]
|
||||
{% if next %}
|
||||
<a href="{% url 'anatomy:exam_question_detail' exam.id next %}">Next question</a>
|
||||
{% endif %}
|
||||
</div>
|
||||
{% endif %}
|
||||
</div>
|
||||
<button id="save-annotations">Save Annotations</button>
|
||||
<div id="dicom-image" class="dicom-image" data-url="https://www.penracourses.org.uk{{ question.image.url}}"
|
||||
data-annotations='{{question.image_annotations}}' data-edit_annotation=true></div>
|
||||
<div class="question">
|
||||
<div class="date">
|
||||
Created: {{ question.created_date|date:"d/m/Y" }}
|
||||
</div>
|
||||
<h1>{{ question.get_primary_answer }}</h1>
|
||||
<h2>{{question.question_type}}</h2>
|
||||
{% include 'anatomy/question_link_header.html' %}
|
||||
<button id="save-annotations">Save Annotations</button>
|
||||
<div id="dicom-image" class="dicom-image" data-url="https://www.penracourses.org.uk{{ question.image.url}}"
|
||||
data-annotations='{{question.image_annotations}}' data-edit_annotation=true></div>
|
||||
<div class="question">
|
||||
<div class="date">
|
||||
Created: {{ question.created_date|date:"d/m/Y" }}
|
||||
</div>
|
||||
<h1>{{ question.get_primary_answer }}</h1>
|
||||
<h2>{{question.question_type}}</h2>
|
||||
<details>
|
||||
<summary>
|
||||
Answers:
|
||||
@@ -50,7 +25,7 @@
|
||||
<tr>
|
||||
<td>
|
||||
<span {% if answer.proposed %}class="proposed-answer" data-aid="{{answer.pk}}" data-question-type="anatomy"
|
||||
{% endif %}>
|
||||
{% endif %}>
|
||||
{{ answer }}
|
||||
</span>
|
||||
<td>
|
||||
@@ -59,67 +34,67 @@
|
||||
{% endfor %}
|
||||
</table>
|
||||
</details>
|
||||
<div>
|
||||
Answer help: {{ question.answer_help|safe }}
|
||||
</div>
|
||||
<div>
|
||||
Answer suggest incorrect: {{ question.answer_suggest_incorrect }}
|
||||
</div>
|
||||
<div>
|
||||
Description: {{ question.description }}
|
||||
</div>
|
||||
<div>
|
||||
Exams: {% for exam in question.exams.all %}
|
||||
<a href="{% url 'anatomy:exam_overview' pk=exam.pk %}">{{ exam.name }}</a>
|
||||
{% endfor %}
|
||||
</div>
|
||||
<div>
|
||||
Modality: {{ question.modality }}
|
||||
</div>
|
||||
<div>
|
||||
Region: {{ question.region }}
|
||||
</div>
|
||||
<div>
|
||||
Structure: {{ question.structure }}
|
||||
</div>
|
||||
<div>
|
||||
Body Part: {{ question.body_part }}
|
||||
</div>
|
||||
<div>
|
||||
Author: {% for author in question.author.all %}
|
||||
{{ author }},
|
||||
{% endfor %}
|
||||
</div>
|
||||
<div>
|
||||
Open access: {{ question.open_access }}
|
||||
</div>
|
||||
{% include 'question_notes.html' %}
|
||||
<div>
|
||||
<details>
|
||||
<summary>
|
||||
<span id="annotation-json-toggle">Annotation JSON (+/-):</span> <span id="annotation-json-content">
|
||||
</summary>
|
||||
<div>
|
||||
Answer help: {{ question.answer_help|safe }}
|
||||
</div>
|
||||
<div>
|
||||
Answer suggest incorrect: {{ question.answer_suggest_incorrect }}
|
||||
</div>
|
||||
<div>
|
||||
Description: {{ question.description }}
|
||||
</div>
|
||||
<div>
|
||||
Exams: {% for exam in question.exams.all %}
|
||||
<a href="{% url 'anatomy:exam_overview' pk=exam.pk %}">{{ exam.name }}</a>
|
||||
{% endfor %}
|
||||
</div>
|
||||
<div>
|
||||
Modality: {{ question.modality }}
|
||||
</div>
|
||||
<div>
|
||||
Region: {{ question.region }}
|
||||
</div>
|
||||
<div>
|
||||
Structure: {{ question.structure }}
|
||||
</div>
|
||||
<div>
|
||||
Body Part: {{ question.body_part }}
|
||||
</div>
|
||||
<div>
|
||||
Author: {% for author in question.author.all %}
|
||||
{{ author }},
|
||||
{% endfor %}
|
||||
</div>
|
||||
<div>
|
||||
Open access: {{ question.open_access }}
|
||||
</div>
|
||||
{% include 'question_notes.html' %}
|
||||
<div>
|
||||
<details>
|
||||
<summary>
|
||||
<span id="annotation-json-toggle">Annotation JSON (+/-):</span> <span id="annotation-json-content">
|
||||
</summary>
|
||||
|
||||
{% if question.image_annotations %}
|
||||
{% if question.image_annotations %}
|
||||
<pre>{{ question.image_annotations }}</pre>
|
||||
{% else %}
|
||||
No saved annotations.
|
||||
{% endif %}
|
||||
</span>
|
||||
</details>
|
||||
{% else %}
|
||||
No saved annotations.
|
||||
{% endif %}
|
||||
</span>
|
||||
</details>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<script type="text/javascript">
|
||||
$(document).ready(function () {
|
||||
<script type="text/javascript">
|
||||
$(document).ready(function () {
|
||||
|
||||
//$("#annotation-json-toggle").click(() => {
|
||||
// $("#annotation-json-content").toggle()
|
||||
//});
|
||||
|
||||
// send request to change the is_private state on customSwitches toggle
|
||||
$("#save-annotations").click(function () {
|
||||
json = getJsonToolStateNoId();
|
||||
$.ajax({
|
||||
$("#save-annotations").click(function () {
|
||||
json = getJsonToolStateNoId();
|
||||
$.ajax({
|
||||
url: "{% url 'anatomy:question_save_annotation' pk=question.pk %}",
|
||||
data: {
|
||||
csrfmiddlewaretoken: "{{ csrf_token }}",
|
||||
@@ -134,38 +109,38 @@
|
||||
|
||||
})
|
||||
// $.ajax().done(), $.ajax().fail(), $ajax().always() are upto you. Add/change accordingly
|
||||
.done(function (data) {
|
||||
console.log(data);
|
||||
.done(function (data) {
|
||||
console.log(data);
|
||||
// show some message according to the response.
|
||||
// For eg. A message box showing that the status has been changed
|
||||
if (data.status == "success") {
|
||||
toastr.info('Annotations saved')
|
||||
} else {
|
||||
toastr.warning('Error saving annotations')
|
||||
}
|
||||
})
|
||||
.always(function () {
|
||||
console.log('[Done]');
|
||||
})
|
||||
})
|
||||
});
|
||||
if (data.status == "success") {
|
||||
toastr.info('Annotations saved')
|
||||
} else {
|
||||
toastr.warning('Error saving annotations')
|
||||
}
|
||||
})
|
||||
.always(function () {
|
||||
console.log('[Done]');
|
||||
})
|
||||
})
|
||||
});
|
||||
|
||||
|
||||
function getJsonToolStateNoId() {
|
||||
const el = document.getElementById("dicom-image");
|
||||
function getJsonToolStateNoId() {
|
||||
const el = document.getElementById("dicom-image");
|
||||
|
||||
const c = cornerstone.getEnabledElement(el);
|
||||
const c = cornerstone.getEnabledElement(el);
|
||||
|
||||
const toolStateManager = cornerstoneTools.globalImageIdSpecificToolStateManager;
|
||||
const toolStateManager = cornerstoneTools.globalImageIdSpecificToolStateManager;
|
||||
|
||||
const image_id = c.image.imageId;
|
||||
const image_id = c.image.imageId;
|
||||
|
||||
const state_with_id = toolStateManager.saveToolState()
|
||||
const state_with_id = toolStateManager.saveToolState()
|
||||
|
||||
const json_tool_state = JSON.stringify(state_with_id[image_id]);
|
||||
const json_tool_state = JSON.stringify(state_with_id[image_id]);
|
||||
|
||||
return json_tool_state;
|
||||
return json_tool_state;
|
||||
|
||||
}
|
||||
</script>
|
||||
}
|
||||
</script>
|
||||
{% endblock %}
|
||||
@@ -0,0 +1,28 @@
|
||||
|
||||
<div class="floating-header">
|
||||
<a href="{% url 'anatomy:anatomy_question_update' question.id %}" title="Edit the Question">Edit</a>
|
||||
<a href="{% url 'anatomy:question_clone' question.id %}" title="Clone the Question">Clone</a>
|
||||
<a href="{% url 'anatomy:question_delete' pk=question.pk %}" title="Delete the Question">Delete</a>
|
||||
<a href="{% url 'anatomy:question_answer_update' pk=question.pk %}" title="Update the question answers">Edit Answers</a>
|
||||
<a href="#"
|
||||
onclick="return window.create_popup_window('{% url 'feedback_create' question_type='anatomy' pk=question.pk %}')">
|
||||
Add Note</a>
|
||||
|
||||
{% if request.user.is_superuser %}
|
||||
<a href="{% url 'admin:anatomy_anatomyquestion_change' question.id %}"
|
||||
title="Edit the Question using the admin interface">Admin Edit</a>
|
||||
<a href="{% url 'anatomy:question_user_answers' question.id %}" title="View user answers associated with this question">User answers</a>
|
||||
{% endif %}
|
||||
{% if exam %}
|
||||
<div>
|
||||
|
||||
{% if previous > -1 %}
|
||||
<a href="{% url 'anatomy:exam_question_detail' exam.id previous %}">Previous question</a>
|
||||
{% endif %}
|
||||
Viewing question as part of exam: <a href="{% url 'anatomy:exam_overview' exam.id %}">{{exam.name}}</a> [{{pos}}/{{exam_length}}]
|
||||
{% if next %}
|
||||
<a href="{% url 'anatomy:exam_question_detail' exam.id next %}">Next question</a>
|
||||
{% endif %}
|
||||
</div>
|
||||
{% endif %}
|
||||
</div>
|
||||
@@ -1,6 +1,7 @@
|
||||
{% extends 'anatomy/base.html' %}
|
||||
|
||||
{% block content %}
|
||||
{% include 'anatomy/question_link_header.html' %}
|
||||
<h2>{{question}}</h2>
|
||||
|
||||
{% if answer_compare %}
|
||||
|
||||
Reference in New Issue
Block a user