add ability to load local (online) packets
This commit is contained in:
@@ -736,3 +736,31 @@ select option:disabled {
|
||||
.feedback {
|
||||
padding-top: 0.8rem;
|
||||
}
|
||||
|
||||
#localFileloader {
|
||||
padding: 20px;
|
||||
}
|
||||
|
||||
#packet-list {
|
||||
padding: 20px;
|
||||
}
|
||||
|
||||
.packet-button {
|
||||
display:inline-block;
|
||||
padding:0.35em 1.2em;
|
||||
border:0.1em solid #FFFFFF;
|
||||
margin:0 0.3em 0.3em 0;
|
||||
border-radius:0.12em;
|
||||
box-sizing: border-box;
|
||||
text-decoration:none;
|
||||
font-family:'Roboto',sans-serif;
|
||||
font-weight:300;
|
||||
color:#FFFFFF;
|
||||
text-align:center;
|
||||
transition: all 0.2s;
|
||||
}
|
||||
|
||||
.packet-button:hover{
|
||||
color:lightblue;
|
||||
border-color:blue;
|
||||
}
|
||||
+8
-3
@@ -4,7 +4,8 @@
|
||||
<head>
|
||||
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1, minimum-scale=1, maximum-scale=1, user-scalable=no">
|
||||
<meta name="viewport"
|
||||
content="width=device-width, initial-scale=1, minimum-scale=1, maximum-scale=1, user-scalable=no">
|
||||
<meta name="viewport" content="initial-scale=1.0, maximum-scale=1.0, width=device-width, height=device-height">
|
||||
<link type="text/css" rel="stylesheet" href="lib/jquery.modal.min.css">
|
||||
<link type="text/css" rel="stylesheet" href="lib/cornerstone.min.css">
|
||||
@@ -63,10 +64,14 @@
|
||||
<fieldset>
|
||||
<h2>Load local question set</h2>
|
||||
<input type='file' id='fileinput'>
|
||||
<input type='button' id='btn-local-file-load' value='Load' onclick='loadLocalQuestionSet();'>
|
||||
<input type='button' id='btn-local-file-load' value='Load'
|
||||
onclick='loadLocalQuestionSet();'>
|
||||
</fieldset>
|
||||
</form>
|
||||
</div>
|
||||
<div id="packet-list">
|
||||
<p>Available Packets:</p>
|
||||
</div>
|
||||
</div>
|
||||
<div id="review-overlay" class="fullscreen-overlay">
|
||||
<a href="#" id="review-overlay-close" class="close"></a>
|
||||
@@ -103,7 +108,7 @@
|
||||
<script src="lib/cornerstone-base64-image-loader.umd.js"></script>
|
||||
<script src="lib/dexie.js"></script>
|
||||
<script src="lib/jquery.modal.min.js"></script>
|
||||
<script src="packets/rr1" defer="defer"></script>
|
||||
<!-- <script src="packets/rr1" defer="defer"></script> -->
|
||||
<script src="js/main.js" defer="defer"></script>
|
||||
|
||||
</body>
|
||||
|
||||
+43
-2
@@ -4,6 +4,8 @@ var eid = 5678;
|
||||
|
||||
var exam_mode = false;
|
||||
|
||||
var packet_list = [];
|
||||
|
||||
//var questions = null
|
||||
var question_order = [];
|
||||
var number_of_questions = null;
|
||||
@@ -18,7 +20,47 @@ var dfile = null;
|
||||
var a = null;
|
||||
var b = null;
|
||||
|
||||
loadPacketList();
|
||||
|
||||
function loadPacketList() {
|
||||
var jqxhr = $.getJSON("packets/packets.json", function (data) {
|
||||
packet_list = data.packets;
|
||||
packet_list.forEach(function (packet) {
|
||||
$("#packet-list").append($("<div class='packet-button'>" + packet + "</div>").click(function () {
|
||||
loadPacketFromAjax("packets/" + packet);
|
||||
}));
|
||||
})
|
||||
$("#options-panel").show();
|
||||
})
|
||||
.done(function () {
|
||||
})
|
||||
.fail(function () {
|
||||
console.log("No packet list available");
|
||||
showLoginDialog();
|
||||
})
|
||||
.always(function () {
|
||||
});
|
||||
|
||||
//setUpPacket(questions);
|
||||
|
||||
}
|
||||
|
||||
function loadPacketFromAjax(path) {
|
||||
console.log("loading packet from " + path)
|
||||
var jqxhr = $.getJSON(path, function (data) {
|
||||
setUpPacket(data);
|
||||
$("#options-panel").hide();
|
||||
})
|
||||
.done(function () {
|
||||
})
|
||||
.fail(function () {
|
||||
console.log("Unable to load packet at: " + path);
|
||||
})
|
||||
}
|
||||
|
||||
function setUpQuestions() {
|
||||
|
||||
if (questions == undefined) { return }
|
||||
// Set an order for the questions
|
||||
question_order = [];
|
||||
Object.keys(questions).forEach(function (e) {
|
||||
@@ -33,6 +75,7 @@ function setUpQuestions() {
|
||||
question_order = shuffleArray(question_order);
|
||||
number_of_questions = Object.keys(questions).length;
|
||||
review = false;
|
||||
console.log(question_order)
|
||||
|
||||
// Horrible way to get type of questions
|
||||
// We assume they are all of the same type....
|
||||
@@ -126,7 +169,6 @@ function setUpPacket(data) {
|
||||
setUpQuestions();
|
||||
}
|
||||
|
||||
setUpPacket(questions);
|
||||
|
||||
function loadQuestion(n, section = 1, force_reload = false) {
|
||||
// Make sure we have an integer
|
||||
@@ -1554,7 +1596,6 @@ $("#start-exam-button").click(function(evt) {
|
||||
$.modal.close();
|
||||
});
|
||||
|
||||
showLoginDialog();
|
||||
|
||||
function manualPanDicom(x, y) {
|
||||
dicom_element = document.getElementById("dicom-image");
|
||||
|
||||
Reference in New Issue
Block a user