diff --git a/css/base.css b/css/base.css index f984c3f..fa722bb 100644 --- a/css/base.css +++ b/css/base.css @@ -1,3 +1,4 @@ +/* Set some default CSS */ html, body, div, diff --git a/css/loading.css b/css/loading.css index f33324f..bfbc3a6 100644 --- a/css/loading.css +++ b/css/loading.css @@ -1,4 +1,4 @@ - +/* Some fancy loading CSS */ .sk-cube-grid { width: 60px; height: 60px; diff --git a/css/main.css b/css/main.css index 8c36a56..8db139d 100644 --- a/css/main.css +++ b/css/main.css @@ -2,7 +2,7 @@ @import "./base.css"; @import "./loading.css"; @import url("https://fonts.googleapis.com/css?family=Noto+Sans:400,700"); -/* Colourscheme from https://www.materialui.co/colors */ +/* Colourscheme from https://www.materialui.co/colors (as per original) */ * { -webkit-font-smoothing: antialiased; diff --git a/index.html b/index.html index 979c9b8..d7d5a12 100644 --- a/index.html +++ b/index.html @@ -1,210 +1,299 @@ - - - - - - - - - - + + + + + + + + + RTS - + - +
-
- -
-
-
-
-
-
-
1
-
-
-
-
-
-
-
-
Answer
-
-
-
-
-
-
-
-
-
Ready to logout?
-
- - -
-
-
-

RTS

- - - -
-
-

Click buttons below to load an exam / packet

- -

Exams:

- -
- - -

Packets:

- -
-
- -
-
-
-
- -
    -
-
-
-
- Options -
- - - -
-
-
- -
-

Load local question set

- - -
-
-
-

-
-
-
- -
-
-

Performance breakdown:

- Unanswered questions:
- Answered normal:
- Answered abnormal:
-
- Undercall:
- Overcall:
- Incorrect call:
-
-
    -
    -
    +
    + +
    +
    +
    +
    +
    +
    1
    +
    +
    +
    +
    +
    +
    +
    Answer
    +
    +
    +
    +
    +
    +
    +
    +
    Ready to logout?
    +
    + + +
    +
    +
    +

    RTS

    + + + + +
    +
    +
    +

    Click buttons below to load an exam / packet

    + +

    Exams:

    + +
    + + +

    Packets:

    + +
    +
    + +
    +
    +
    + +
      +
      +
      +
      + Options +
      + + + +
      +
      +
      +
      +

      Load local question set

      + + +
      +
      +
      +

      + +

      +
      +
      +
      + +
      +
      +

      Performance breakdown:

      + Unanswered questions:
      + Answered normal:
      + Answered abnormal:
      +
      + Undercall:
      + Overcall:
      + Incorrect call:
      +
      +
        +
        +
        +
        -
        -
        -
        -
        -
        -
        -
        -
        -
        -
        -
        -
        -
        -
        +
        +
        +
        +
        +
        +
        +
        +
        +
        +
        +
        +
        +
        -
        -
        -
        -
        -
        +
        +
        +
        +
        +
        -
        -
        +
        -
        -
        +
        -
        -
        +
        @@ -226,8 +315,6 @@ - - - - \ No newline at end of file + + + diff --git a/js/interact.js b/js/interact.js index 8e37967..ce9576a 100644 --- a/js/interact.js +++ b/js/interact.js @@ -3,7 +3,7 @@ import * as config from "./config.js"; /** * Submits answers */ -export function submitAnswers(exam_details, db, config) { +export function submitAnswers(exam_details, db, URLS) { getJsonAnswers(exam_details, db) .then((a) => { let json = { @@ -12,7 +12,7 @@ export function submitAnswers(exam_details, db, config) { start_time: exam_details.start_time, answers: JSON.stringify(a), }; - postAnswers(json, config, exam_details); + postAnswers(json, URLS, exam_details); }) .catch((e) => { console.debug(e) @@ -44,11 +44,12 @@ export function getJsonAnswers(exam_details, db) { * Posts answers to url * @param {*} ans - json representation of answers */ -export function postAnswers(ans, config, exam_details) { +export function postAnswers(ans, URLS, exam_details) { $("#progress").html("Submitting answers..."); - console.debug("postAnswers", ans, config, exam_details) + console.debug("postAnswers", ans, URLS, exam_details) + console.debug("posturl", URLS.exam_submit_url) - $.post(config.exam_submit_url, ans, null, "json") + $.post(URLS.exam_submit_url, ans, null, "json") .done((data) => { console.debug("returned data", data); if (data.success) { @@ -61,8 +62,8 @@ export function postAnswers(ans, config, exam_details) { if (ret) { $(document).trigger("saveSessionEvent", [true]); - if (config.exam_results_url != "") { - let url = config.exam_results_url; + if (URLS.exam_results_url != "") { + let url = URLS.exam_results_url; if (exam_details.cid != "") { url = url + exam_details.cid; diff --git a/js/main.js b/js/main.js index 9add7b8..da2e16f 100644 --- a/js/main.js +++ b/js/main.js @@ -6,10 +6,25 @@ import * as config from "./config.js"; // const { v4: uuidv4 } = require('uuid'); log.setDefaultLevel("warn") +log.setDefaultLevel("debug") let URLS = {}; +let standalone = false; + +if (config.standalone != "" && config.standalone != undefined) { + standalone = config.standalone +} + +let allow_users = false; + +if (config.allow_users != "" && config.allow_users != undefined) { + allow_users = config.allow_users +} + + + // Generate urls base on base_url if (config.base_url != "" && config.base_url != undefined) { URLS.base_url = config.base_url; @@ -25,7 +40,7 @@ if (config.base_url != "" && config.base_url != undefined) { // Override individual urls let urls_to_check = ["exam_query_url", "exam_submit_url", "exam_results_url", "question_feedback_url", - "quetion_answer_submit_url", "login_url", "logout_url"] + "question_answer_submit_url", "login_url", "logout_url"] for (let url of urls_to_check) { if (config[url] != "" && config[url] != undefined) { @@ -33,6 +48,7 @@ for (let url of urls_to_check) { } } +log.debug("URLS") log.debug(URLS) @@ -47,7 +63,7 @@ let exam_details = { start_time: null, }; -let packet_list = []; +//let packet_list = []; let packet_name = null; let questions = null; let questions_correct = {}; @@ -113,6 +129,10 @@ question_db.version(1).stores({ retrievePacketList(); +if (!allow_users) { + $("#user-details").hide() +} + try { refreshDatabaseSettings(); } @@ -198,7 +218,7 @@ async function retrievePacketList() { url = `${URLS.exam_query_url}/${global_cid}/${global_passcode}`; } } - log.debug(`url: {url}`) + log.debug(`url: ${url}`) } catch (e) { log.debug("Unable to set exam query url", e) log.debug("this will default to packets/packets.json") @@ -525,8 +545,12 @@ async function loadExamList(data) { */ // TODO: remove (data formats should be switched to the exam format) async function loadPacketList(data) { + // NOTE: currently the packet id is not available prior ot downloading the packet + // this severly limits what we can do with it (but to require would limit the utility) + log.debug(`loadPacketList`); + log.debug("Loading saved sessions") let sessions = await db.session.toArray().catch(function(error) { - console.debug("Error loading session", error); + log.debug(`Error loading session ${error}`); $("#database-error").text( "Error loading the database, schema has probably changed and needs updating. You will probably need to delete the local database." ); @@ -539,12 +563,15 @@ async function loadPacketList(data) { $("#database-error").append(delete_button); $("#database-error").show(); }); + log.debug(sessions) // db.session // .where("packet") // .equals() let packets_started = []; let packets_completed = []; + log.debug("Check status of saved packets") sessions.forEach((s) => { + log.debug(`checking status of`, s) if (s.status == "active") { packets_started.push(s.packet); } else { @@ -552,17 +579,29 @@ async function loadPacketList(data) { } }); + log.debug("Packets started") + log.debug(packets_started) + log.debug("Packets completed") + log.debug(packets_completed) + + let packet_list = []; if (data != null) { packet_list = data.packets; + } else { + log.debug("data == null") } + log.debug(packet_list) $("#packet-list").empty(); - if (packet_json_id == undefined) { - $("#options-panel").show(); - return - } - //console.debug(packet_list) + //if (packet_json_id == undefined) { + // $("#options-panel").show(); + // return + //} + + + + packet_list.forEach(function(packet) { // Seperate packet types let list; @@ -1774,7 +1813,7 @@ $("#btn-local-file-load").click(function(evt) { }); $(".submit-button").click(function(evt) { - interact.submitAnswers(exam_details, db, config); + interact.submitAnswers(exam_details, db, URLS); }); $("#btn-review").click(function(evt) { diff --git a/js/viewer.js b/js/viewer.js index 4d5cab0..1d6dd3e 100644 --- a/js/viewer.js +++ b/js/viewer.js @@ -279,6 +279,8 @@ export function debugCornerstone() { /** * Registers the selected dicom tool + * + * This also allows selecting of window levels */ export function changeControlSelection() { // We also duplicate the sel that are available