diff --git a/src/adonisjs/.env.example b/src/adonisjs/.env.example index 9d3b92669..a1a6fbe78 100644 --- a/src/adonisjs/.env.example +++ b/src/adonisjs/.env.example @@ -16,5 +16,9 @@ DB_DATABASE=adonis SESSION_DRIVER=cookie HASH_DRIVER=bcrypt +HARENA_SPACE_URL=http://${HOST}:10010 +HARENA_SPACE_API_VERSION=v1 HARENA_MANAGER_URL=http://${HOST}:10020 +HARENA_MANAGER_API_VERSION=v1 HARENA_LOGGER_URL=http://${HOST}:10030 +HARENA_LOGGER_API_VERSION=v1 \ No newline at end of file diff --git a/src/adonisjs/public/author/author.html b/src/adonisjs/public/author/index.html similarity index 98% rename from src/adonisjs/public/author/author.html rename to src/adonisjs/public/author/index.html index 501fb9a51..976475ce6 100644 --- a/src/adonisjs/public/author/author.html +++ b/src/adonisjs/public/author/index.html @@ -11,7 +11,6 @@ - diff --git a/src/adonisjs/public/author/js/author.js b/src/adonisjs/public/author/js/author.js index 6ab13352c..95227d0ce 100644 --- a/src/adonisjs/public/author/js/author.js +++ b/src/adonisjs/public/author/js/author.js @@ -89,12 +89,7 @@ class AuthorManager { const caseId = await DCCNoticeInput.displayNotice( "Select a case to load or start a new case.", "list", "Select", "New", cases.message); - /* - if (this._temporaryCase && saved == "No") - console.log("deleting..." + this._currentCaseId); - */ - console.log("Selected: " + caseId); if (caseId == "New") this.caseNew(); else @@ -122,11 +117,14 @@ class AuthorManager { this._temporaryCase = true; const caseId = await MessageBus.ext.request("data/case//new"); - const blankMd = - await MessageBus.ext.request("data/template/basic.blank/get"); + await this._themeSelect(); + let template = await this._templateSelect(); + + const templateMd = + await MessageBus.ext.request("data/template/" + template.replace("/", ".") + "/get"); const status = await MessageBus.ext.request("data/case/" + caseId.message + "/set", - {format: "markdown", source: blankMd.message}); + {format: "markdown", source: templateMd.message}); this._caseLoad(caseId.message); } @@ -191,10 +189,6 @@ class AuthorManager { * ACTION: control/knot/new */ async knotNew() { - const templates = await MessageBus.ext.request("data/template/*/list"); - const template = await DCCNoticeInput.displayNotice( - "Select a template for your knot.", - "list", "Select", "Cancel", templates.message); const knotId = "Knot_" + this._knotGenerateCounter; let newKnot = {type: "knot", title: "Knot " + this._knotGenerateCounter, @@ -210,6 +204,14 @@ class AuthorManager { await this._navigator.mountPlainCase(this, this._compiledCase.knots); MessageBus.ext.publish("knot/" + this._knotSelected + "/selected"); } + + async _templateSelect() { + const templateList = await MessageBus.ext.request("data/template/*/list"); + const template = await DCCNoticeInput.displayNotice( + "Select a template for your knot.", + "list", "Select", "Cancel", templateList.message); + return template; + } /* * ACTION: control-edit @@ -229,14 +231,6 @@ class AuthorManager { * ACTION: control-play */ async casePlay() { - /* - this._messageSpace.innerHTML = "Preparing..."; - const dirPlay = await MessageBus.ext.request( - "case/" + this._currentCaseId + "/prepare", - this._translator.currentThemeFamily, - "case/" + this._currentCaseId + "/prepare/directory"); - */ - this._translator.newThemeSet(); const htmlSet = Object.assign( @@ -287,6 +281,11 @@ class AuthorManager { * ACTION: config */ async config() { + this._themeSelect(); + } + + + async _themeSelect() { const families = await MessageBus.ext.request("data/theme_family/*/list"); this._translator.currentThemeFamily = await DCCNoticeInput.displayNotice( "Select a theme to be applied.", diff --git a/src/adonisjs/public/author/js/dcc-author-server-proxy.js b/src/adonisjs/public/author/js/dcc-author-server-proxy.js index 39e10a298..5fee35893 100644 --- a/src/adonisjs/public/author/js/dcc-author-server-proxy.js +++ b/src/adonisjs/public/author/js/dcc-author-server-proxy.js @@ -7,8 +7,6 @@ class DCCAuthorServer { constructor() { - this.casesList = this.casesList.bind(this); - MessageBus.ext.subscribe("data/case/*/list", this.casesList); this.loadModule = this.loadModule.bind(this); MessageBus.ext.subscribe("data/module/+/get", this.loadModule); this.loadTemplate = this.loadTemplate.bind(this); @@ -21,10 +19,8 @@ class DCCAuthorServer { this.themeFamiliesList = this.themeFamiliesList.bind(this); MessageBus.ext.subscribe("data/theme_family/*/list", this.themeFamiliesList); - this.modelsList = this.modelsList.bind(this); - MessageBus.ext.subscribe("data/template/*/get", this.modelsList); - // this.renameCase = this.renameCase.bind(this); - // MessageBus.ext.subscribe("case/+/rename", this.renameCase); + this.templatesList = this.templatesList.bind(this); + MessageBus.ext.subscribe("data/template/*/list", this.templatesList); this.prepareCaseHTML = this.prepareCaseHTML.bind(this); MessageBus.ext.subscribe("case/+/prepare", this.prepareCaseHTML); this.saveKnotHTML = this.saveKnotHTML.bind(this); @@ -35,60 +31,48 @@ class DCCAuthorServer { // wrapper of the services - async themeFamiliesList() { - const response = await fetch(DCCCommonServer.serverAddress + "theme-families-list", { - method: "POST", - headers:{ - "Content-Type": "application/json" - } - }); - const jsonResponse = await response.json(); - const families = jsonResponse.themeFamiliesList; - let finalFamiliesList = {}; - for (var f in families) - finalFamiliesList[families[f]] = "icons/mono-slide.svg"; - MessageBus.ext.publish("theme_family/*", finalFamiliesList); - } - - async modelsList() { - const response = await fetch(DCCCommonServer.serverAddress + "models-list", { - method: "POST", - headers:{ - "Content-Type": "application/json" - } - }); - const jsonResponse = await response.json(); - const models = jsonResponse.modelsList; - let finalModelsList = {}; - for (var f in models) - finalModelsList[models[f]] = "icons/mono-slide.svg"; - MessageBus.ext.publish("model/*", finalModelsList); + async themeFamiliesList(topic, message) { + var header = { + "async": true, + "crossDomain": true, + "method": "GET", + "headers": { + "Content-Type": "application/json", + } + } + const response = await fetch("../themes/themes.json", header); + let jsonResponse = await response.json(); + let busResponse = {}; + for (var t in jsonResponse) + busResponse[jsonResponse[t].path] = { + name: t, + icon: "../themes/" + jsonResponse[t].path + "/images/" + jsonResponse[t].icon + }; + MessageBus.ext.publish(MessageBus.buildResponseTopic(topic, message), + busResponse); } - async casesList(topic, message) { + async templatesList(topic, message) { var header = { "async": true, "crossDomain": true, - "method": "POST", + "method": "GET", "headers": { "Content-Type": "application/json", - "Authorization": "Bearer " + DCCCommonServer.instance.token - }, - "body": JSON.stringify({"filterBy": "user", - "filter": message.filter}) + } } - const response = await fetch(DCCCommonServer.serverAddress + "case/list", header); - const jsonResponse = await response.json(); + const response = await fetch("../templates/templates.json", header); + let jsonResponse = await response.json(); let busResponse = {}; - for (var c in jsonResponse) - busResponse[jsonResponse[c].id] = { - name: jsonResponse[c].name, - icon: "icons/mono-slide.svg" + for (var t in jsonResponse) + busResponse[jsonResponse[t].path] = { + name: t, + icon: "../templates/" + jsonResponse[t].path + ".png" }; MessageBus.ext.publish(MessageBus.buildResponseTopic(topic, message), busResponse); } - + async newCase(topic, message) { var header = { "async": true, @@ -100,13 +84,13 @@ class DCCAuthorServer { } }; const response = - await fetch(DCCCommonServer.serverAddress + "case/new", header); + await fetch(DCCCommonServer.managerAddressAPI + "case/new", header); const jsonResponse = await response.json(); MessageBus.ext.publish(MessageBus.buildResponseTopic(topic, message), - jsonResponse.id); + jsonResponse.uuid); /* - const response = await fetch(DCCCommonServer.serverAddress + "new-case", { + const response = await fetch(DCCCommonServer.managerAddressAPI + "new-case", { method: "POST", headers:{ "Content-Type": "application/json" @@ -132,13 +116,13 @@ class DCCAuthorServer { source: message.source}) }; const response = - await fetch(DCCCommonServer.serverAddress + "case/" + caseId, header); + await fetch(DCCCommonServer.managerAddressAPI + "case/" + caseId, header); const jsonResponse = await response.json(); MessageBus.ext.publish(MessageBus.buildResponseTopic(topic, message), jsonResponse.source); /* - const response = await fetch(DCCCommonServer.serverAddress + "save-case", { + const response = await fetch(DCCCommonServer.managerAddressAPI + "save-case", { method: "POST", body: JSON.stringify({"caseName": caseName, "caseText": message.source}), @@ -155,7 +139,7 @@ class DCCAuthorServer { /* async renameCase(topic, message) { const oldName = MessageBus.extractLevel(topic, 2); - const response = await fetch(DCCCommonServer.serverAddress + "rename-case", { + const response = await fetch(DCCCommonServer.managerAddressAPI + "rename-case", { method: "POST", body: JSON.stringify({"oldName": oldName, "newName": message.newName}), @@ -185,10 +169,7 @@ class DCCAuthorServer { } async loadTemplate(topic, message) { - const templateCompleteName = MessageBus.extractLevel(topic, 3); - const separator = templateCompleteName.indexOf("."); - const templateFamily = templateCompleteName.substring(0, separator); - const templateName = templateCompleteName.substring(separator+1); + let templatePath = MessageBus.extractLevel(topic, 3).replace(".", "/"); var header = { "async": true, "crossDomain": true, @@ -197,7 +178,7 @@ class DCCAuthorServer { "Content-Type": "text/plain", } } - const response = await fetch("../templates/" + templateFamily + "/" + templateName + + const response = await fetch("../templates/" + templatePath + ".md", header); let textResponse = await response.text(); MessageBus.ext.publish(MessageBus.buildResponseTopic(topic, message), @@ -206,7 +187,7 @@ class DCCAuthorServer { async prepareCaseHTML(topic, themeFamily) { const caseName = MessageBus.extractLevel(topic, 2); - const response = await fetch(DCCCommonServer.serverAddress + "prepare-case-html", { + const response = await fetch(DCCCommonServer.managerAddressAPI + "prepare-case-html", { method: "POST", body: JSON.stringify({"themeFamily": themeFamily, "caseName": caseName}), @@ -221,7 +202,7 @@ class DCCAuthorServer { async saveKnotHTML(topic, message) { const knotId = MessageBus.extractLevel(topic, 2); - const response = await fetch(DCCCommonServer.serverAddress + "save-knot-html", { + const response = await fetch(DCCCommonServer.managerAddressAPI + "save-knot-html", { method: "POST", body: JSON.stringify({"caseName": message.caseId, "knotFile": knotId + ".js", @@ -239,7 +220,7 @@ class DCCAuthorServer { const caseId = MessageBus.extractLevel(topic, 2); // change the name of the service - const response = await fetch(DCCCommonServer.serverAddress + "save-case-script", { + const response = await fetch(DCCCommonServer.managerAddressAPI + "save-case-script", { method: "POST", body: JSON.stringify({"caseName": caseId, "scriptFile": "case.js", diff --git a/src/adonisjs/public/infra/basic.js b/src/adonisjs/public/infra/basic.js index 519d7cda4..52622a437 100644 --- a/src/adonisjs/public/infra/basic.js +++ b/src/adonisjs/public/infra/basic.js @@ -8,6 +8,7 @@ class Basic { let userid = null; let errorMessage = ""; while (userid == null) { + /* const userEmail = await DCCNoticeInput.displayNotice(errorMessage + "

Signin

inform your email:

", @@ -15,11 +16,10 @@ class Basic { const userPass = await DCCNoticeInput.displayNotice("

Signin

inform your password:

", "password"); + */ - /* let userEmail = "jacinto@example.com"; let userPass = "jacinto"; - */ let loginReturn = await MessageBus.ext.request("data/user/login", {email: userEmail, diff --git a/src/adonisjs/public/infra/bus-server-address.js b/src/adonisjs/public/infra/bus-server-address.js deleted file mode 100644 index f758e2234..000000000 --- a/src/adonisjs/public/infra/bus-server-address.js +++ /dev/null @@ -1,4 +0,0 @@ -(function() { - // MessageBus.serverAddress = "http://cloud.lis.ic.unicamp.br/harena/logger/latest"; - MessageBus.serverAddress = "http://35.247.224.186/harena/logger/latest"; -})(); \ No newline at end of file diff --git a/src/adonisjs/public/infra/bus.js b/src/adonisjs/public/infra/bus.js index 80ef02503..eab9985a5 100644 --- a/src/adonisjs/public/infra/bus.js +++ b/src/adonisjs/public/infra/bus.js @@ -56,7 +56,7 @@ class MessageBus { extTopic = this._runningCase.runningId + "/" + topic; } - const response = await fetch(MessageBus.serverAddress + "/message", { + const response = await fetch(DCCCommonServer.loggerAddressAPI + "message", { method: "POST", body: JSON.stringify({"topic": extTopic, "payload": extMessage @@ -174,7 +174,7 @@ class MessageBus { MessageBus._stamp = 1; MessageBus.int = new MessageBus(false); - MessageBus.ext = new MessageBus(false); + MessageBus.ext = new MessageBus(true); /* window.messageBus = { int: new MessageBus(false), diff --git a/src/adonisjs/public/infra/dcc-common-server-proxy.js b/src/adonisjs/public/infra/dcc-common-server-proxy.js index bc213aa6c..b1cc085ff 100644 --- a/src/adonisjs/public/infra/dcc-common-server-proxy.js +++ b/src/adonisjs/public/infra/dcc-common-server-proxy.js @@ -7,6 +7,8 @@ class DCCCommonServer { constructor() { this.userLogin = this.userLogin.bind(this); MessageBus.ext.subscribe("data/user/login", this.userLogin); + this.casesList = this.casesList.bind(this); + MessageBus.ext.subscribe("data/case/*/list", this.casesList); this.loadCase = this.loadCase.bind(this); MessageBus.ext.subscribe("data/case/+/get", this.loadCase); this.loadTheme = this.loadTheme.bind(this); @@ -34,7 +36,7 @@ class DCCCommonServer { "password": message.password}) } - const response = await fetch(DCCCommonServer.serverAddress + "user/login", header); + const response = await fetch(DCCCommonServer.managerAddressAPI + "user/login", header); const jsonResponse = await response.json(); const busResponse = { userid: jsonResponse.id, @@ -45,6 +47,30 @@ class DCCCommonServer { busResponse); } + async casesList(topic, message) { + var header = { + "async": true, + "crossDomain": true, + "method": "POST", + "headers": { + "Content-Type": "application/json", + "Authorization": "Bearer " + DCCCommonServer.instance.token + }, + "body": JSON.stringify({"filterBy": "user", + "filter": message.filter}) + } + const response = await fetch(DCCCommonServer.managerAddressAPI + "case/list", header); + const jsonResponse = await response.json(); + let busResponse = {}; + for (var c in jsonResponse) + busResponse[jsonResponse[c].uuid] = { + name: jsonResponse[c].name, + icon: "../resources/icons/mono-slide.svg" + }; + MessageBus.ext.publish(MessageBus.buildResponseTopic(topic, message), + busResponse); + } + async loadCase(topic, message) { const caseId = MessageBus.extractLevel(topic, 3); var header = { @@ -57,7 +83,7 @@ class DCCCommonServer { } }; const response = - await fetch(DCCCommonServer.serverAddress + "case/" + caseId, header); + await fetch(DCCCommonServer.managerAddressAPI + "case/" + caseId, header); const jsonResponse = await response.json(); MessageBus.ext.publish(MessageBus.buildResponseTopic(topic, message), {name: jsonResponse.name, diff --git a/src/adonisjs/public/modules/capsule.html b/src/adonisjs/public/modules/capsule.html index e500fa5f8..f5812554a 100644 --- a/src/adonisjs/public/modules/capsule.html +++ b/src/adonisjs/public/modules/capsule.html @@ -4,16 +4,19 @@ Knot Capsule - - - + - + + + + + + + - @@ -34,7 +37,8 @@ - +
{knot} diff --git a/src/adonisjs/public/themes/jacinto/css/player.css b/src/adonisjs/public/player/css/player.css similarity index 100% rename from src/adonisjs/public/themes/jacinto/css/player.css rename to src/adonisjs/public/player/css/player.css diff --git a/src/adonisjs/public/player/images/ampliacao-eletro.gif b/src/adonisjs/public/player/images/ampliacao-eletro.gif new file mode 100644 index 000000000..d1e8a47a1 Binary files /dev/null and b/src/adonisjs/public/player/images/ampliacao-eletro.gif differ diff --git a/src/adonisjs/public/player/images/bubble-landscape.png b/src/adonisjs/public/player/images/bubble-landscape.png new file mode 100644 index 000000000..2836a2680 Binary files /dev/null and b/src/adonisjs/public/player/images/bubble-landscape.png differ diff --git a/src/adonisjs/public/player/images/bubble-portrait.png b/src/adonisjs/public/player/images/bubble-portrait.png new file mode 100644 index 000000000..f3e856449 Binary files /dev/null and b/src/adonisjs/public/player/images/bubble-portrait.png differ diff --git a/src/adonisjs/public/player/images/call-the-supervisor.svg b/src/adonisjs/public/player/images/call-the-supervisor.svg new file mode 100644 index 000000000..8e8f19609 --- /dev/null +++ b/src/adonisjs/public/player/images/call-the-supervisor.svg @@ -0,0 +1,88 @@ + + + + + + + + + + image/svg+xml + + + + + + + + + + + + + + diff --git a/src/adonisjs/public/player/images/case-forklift.png b/src/adonisjs/public/player/images/case-forklift.png new file mode 100644 index 000000000..4dc882a1c Binary files /dev/null and b/src/adonisjs/public/player/images/case-forklift.png differ diff --git a/src/adonisjs/public/player/images/doctor-icon.png b/src/adonisjs/public/player/images/doctor-icon.png new file mode 100644 index 000000000..3b373e0d2 Binary files /dev/null and b/src/adonisjs/public/player/images/doctor-icon.png differ diff --git a/src/adonisjs/public/player/images/doctor.png b/src/adonisjs/public/player/images/doctor.png new file mode 100644 index 000000000..a8c9ec3c1 Binary files /dev/null and b/src/adonisjs/public/player/images/doctor.png differ diff --git a/src/adonisjs/public/player/images/ebm-clinical-history-aortic-dissection.png b/src/adonisjs/public/player/images/ebm-clinical-history-aortic-dissection.png new file mode 100644 index 000000000..8b6771e8a Binary files /dev/null and b/src/adonisjs/public/player/images/ebm-clinical-history-aortic-dissection.png differ diff --git a/src/adonisjs/public/player/images/ebm-clinical-history-myocardial-infarction.png b/src/adonisjs/public/player/images/ebm-clinical-history-myocardial-infarction.png new file mode 100644 index 000000000..8fc37278d Binary files /dev/null and b/src/adonisjs/public/player/images/ebm-clinical-history-myocardial-infarction.png differ diff --git a/src/adonisjs/public/player/images/ebm-pericarditis.png b/src/adonisjs/public/player/images/ebm-pericarditis.png new file mode 100644 index 000000000..c7d64448f Binary files /dev/null and b/src/adonisjs/public/player/images/ebm-pericarditis.png differ diff --git a/src/adonisjs/public/player/images/ebm-physical-examination-aortic-dissection.png b/src/adonisjs/public/player/images/ebm-physical-examination-aortic-dissection.png new file mode 100644 index 000000000..1d05f5eee Binary files /dev/null and b/src/adonisjs/public/player/images/ebm-physical-examination-aortic-dissection.png differ diff --git a/src/adonisjs/public/player/images/ebm-physical-examination-myocardial-infarction.png b/src/adonisjs/public/player/images/ebm-physical-examination-myocardial-infarction.png new file mode 100644 index 000000000..a75ec55a7 Binary files /dev/null and b/src/adonisjs/public/player/images/ebm-physical-examination-myocardial-infarction.png differ diff --git a/src/adonisjs/public/player/images/ebm-pulmonary-embolism-wells-criteria.png b/src/adonisjs/public/player/images/ebm-pulmonary-embolism-wells-criteria.png new file mode 100644 index 000000000..f076c096e Binary files /dev/null and b/src/adonisjs/public/player/images/ebm-pulmonary-embolism-wells-criteria.png differ diff --git a/src/adonisjs/public/player/images/ekg-description.png b/src/adonisjs/public/player/images/ekg-description.png new file mode 100644 index 000000000..60941ed93 Binary files /dev/null and b/src/adonisjs/public/player/images/ekg-description.png differ diff --git a/src/adonisjs/public/player/images/ekg-detail-01.png b/src/adonisjs/public/player/images/ekg-detail-01.png new file mode 100644 index 000000000..4286bccd2 Binary files /dev/null and b/src/adonisjs/public/player/images/ekg-detail-01.png differ diff --git a/src/adonisjs/public/player/images/ekg-detail-02.png b/src/adonisjs/public/player/images/ekg-detail-02.png new file mode 100644 index 000000000..d5ae3b77a Binary files /dev/null and b/src/adonisjs/public/player/images/ekg-detail-02.png differ diff --git a/src/adonisjs/public/player/images/ekg.png b/src/adonisjs/public/player/images/ekg.png new file mode 100644 index 000000000..2953a82ce Binary files /dev/null and b/src/adonisjs/public/player/images/ekg.png differ diff --git a/src/adonisjs/public/player/images/entrance.jpg b/src/adonisjs/public/player/images/entrance.jpg new file mode 100644 index 000000000..1dd4be7c5 Binary files /dev/null and b/src/adonisjs/public/player/images/entrance.jpg differ diff --git a/src/adonisjs/public/player/images/generate-hypothesis.svg b/src/adonisjs/public/player/images/generate-hypothesis.svg new file mode 100644 index 000000000..57d31831d --- /dev/null +++ b/src/adonisjs/public/player/images/generate-hypothesis.svg @@ -0,0 +1,89 @@ + + + + + + + + + + image/svg+xml + + + + + + + + + + + + + diff --git a/src/adonisjs/public/player/images/hospital-background.png b/src/adonisjs/public/player/images/hospital-background.png new file mode 100644 index 000000000..7f64e05c0 Binary files /dev/null and b/src/adonisjs/public/player/images/hospital-background.png differ diff --git a/src/adonisjs/public/player/images/icon-back.svg b/src/adonisjs/public/player/images/icon-back.svg new file mode 100644 index 000000000..63a7be8ba --- /dev/null +++ b/src/adonisjs/public/player/images/icon-back.svg @@ -0,0 +1,77 @@ + + + + + + + + + + image/svg+xml + + + + + + + + + + + + + diff --git a/src/adonisjs/public/player/images/jacinto-icon.png b/src/adonisjs/public/player/images/jacinto-icon.png new file mode 100644 index 000000000..1662c3c41 Binary files /dev/null and b/src/adonisjs/public/player/images/jacinto-icon.png differ diff --git a/src/adonisjs/public/player/images/jacinto.png b/src/adonisjs/public/player/images/jacinto.png new file mode 100644 index 000000000..4f4a65fbd Binary files /dev/null and b/src/adonisjs/public/player/images/jacinto.png differ diff --git a/src/adonisjs/public/player/images/more-information.svg b/src/adonisjs/public/player/images/more-information.svg new file mode 100644 index 000000000..637071ce6 --- /dev/null +++ b/src/adonisjs/public/player/images/more-information.svg @@ -0,0 +1,80 @@ + + + + + + + + + + image/svg+xml + + + + + + + + + + + + + diff --git a/src/adonisjs/public/player/images/nurse-icon.png b/src/adonisjs/public/player/images/nurse-icon.png new file mode 100644 index 000000000..54bbf995f Binary files /dev/null and b/src/adonisjs/public/player/images/nurse-icon.png differ diff --git a/src/adonisjs/public/player/images/nurse.png b/src/adonisjs/public/player/images/nurse.png new file mode 100644 index 000000000..3e578849d Binary files /dev/null and b/src/adonisjs/public/player/images/nurse.png differ diff --git a/src/adonisjs/public/player/images/nurse_agnes.png b/src/adonisjs/public/player/images/nurse_agnes.png new file mode 100644 index 000000000..f4ab542d0 Binary files /dev/null and b/src/adonisjs/public/player/images/nurse_agnes.png differ diff --git a/src/adonisjs/public/player/images/patient-icon.png b/src/adonisjs/public/player/images/patient-icon.png new file mode 100644 index 000000000..920ac87ab Binary files /dev/null and b/src/adonisjs/public/player/images/patient-icon.png differ diff --git a/src/adonisjs/public/player/images/patient-in-bed.svg b/src/adonisjs/public/player/images/patient-in-bed.svg new file mode 100644 index 000000000..207440247 --- /dev/null +++ b/src/adonisjs/public/player/images/patient-in-bed.svg @@ -0,0 +1,178 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/src/adonisjs/public/player/images/patient.png b/src/adonisjs/public/player/images/patient.png new file mode 100644 index 000000000..899415e23 Binary files /dev/null and b/src/adonisjs/public/player/images/patient.png differ diff --git a/src/adonisjs/public/player/images/patient_jakob.png b/src/adonisjs/public/player/images/patient_jakob.png new file mode 100644 index 000000000..4e49da7ad Binary files /dev/null and b/src/adonisjs/public/player/images/patient_jakob.png differ diff --git a/src/adonisjs/public/player/images/supervisor_harry.png b/src/adonisjs/public/player/images/supervisor_harry.png new file mode 100644 index 000000000..ce0c3dc1e Binary files /dev/null and b/src/adonisjs/public/player/images/supervisor_harry.png differ diff --git a/src/adonisjs/public/player/images/tablet.svg b/src/adonisjs/public/player/images/tablet.svg new file mode 100644 index 000000000..efb362a82 --- /dev/null +++ b/src/adonisjs/public/player/images/tablet.svg @@ -0,0 +1,66 @@ + + + + + + + + + + image/svg+xml + + + + + + + + + diff --git a/src/adonisjs/public/player/index.html b/src/adonisjs/public/player/index.html index a5cf84f37..8a7232fc9 100644 --- a/src/adonisjs/public/player/index.html +++ b/src/adonisjs/public/player/index.html @@ -5,35 +5,37 @@ Player - - - - - - - - + + + + + - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + - + -
diff --git a/src/adonisjs/public/player/js/dcc-player-server-env.js b/src/adonisjs/public/player/js/dcc-player-server-env.js index 4e738bb79..63771b8cd 100644 --- a/src/adonisjs/public/player/js/dcc-player-server-env.js +++ b/src/adonisjs/public/player/js/dcc-player-server-env.js @@ -1,3 +1,3 @@ (function() { - DCCPlayerServer.storePrefix = "casenote_"; + DCCPlayerServer.localEnv = false; })(); \ No newline at end of file diff --git a/src/adonisjs/public/player/js/dcc-player-server-proxy.js b/src/adonisjs/public/player/js/dcc-player-server-proxy.js index df8357add..e1ceaeaf3 100644 --- a/src/adonisjs/public/player/js/dcc-player-server-proxy.js +++ b/src/adonisjs/public/player/js/dcc-player-server-proxy.js @@ -8,13 +8,17 @@ class DCCPlayerServer { * ************* */ + /* getCaseId() { return DCCPlayerServer.playerObj.id; } + */ + /* getStartKnot() { return DCCPlayerServer.playerObj.start; } + */ loadKnot(knotName) { if (DCCPlayerServer.localEnv) { @@ -25,7 +29,6 @@ class DCCPlayerServer { } } - /* @@ -33,25 +36,24 @@ class DCCPlayerServer { * ********************* */ - generateRunningCase() { - const caseid = this.getCaseId(); - const profile = this.getCurrentProfile(); + generateRunningCase(userid, caseid) { + // const profile = this.getCurrentProfile(); const currentDateTime = new Date(); const caseuid = this.generateUID(); - const casekey = profile.id + "#" + caseid + "#" + caseuid; - profile.cases.push(casekey); - this.setProfile(profile); - this.setRunningCasekey(casekey); + // const casekey = profile.id + "#" + caseid + "#" + caseuid; + // profile.cases.push(casekey); + // this.setProfile(profile); + // this.setRunningCasekey(casekey); const casetrack = { - userid : profile.id, + userid : userid, caseid : caseid, start : currentDateTime.toJSON(), inputs : {}, route : [] }; - this.setCaseInstance(casekey, casetrack); + // this.setCaseInstance(casekey, casetrack); return {runningId: caseuid, track: casetrack}; } diff --git a/src/adonisjs/public/player/js/player.js b/src/adonisjs/public/player/js/player.js index 6bf80621b..b02609d05 100644 --- a/src/adonisjs/public/player/js/player.js +++ b/src/adonisjs/public/player/js/player.js @@ -12,8 +12,8 @@ class PlayerManager { constructor() { this._server = new DCCPlayerServer(); this._tracker = new Tracker(); - this._state = new PlayState(); this._history = []; + this._translator = new Translator(); this.controlEvent = this.controlEvent.bind(this); MessageBus.ext.subscribe("control/#", this.controlEvent); @@ -56,17 +56,20 @@ class PlayerManager { case "knot/ 0) { this._history.pop(); const last = this._history[this._history.length - 1]; - this.loadKnot(last); + this.knotLoad(last); } break; case "knot/< Improve the strategy if (this._currentKnot == "entry") @@ -215,7 +253,9 @@ class PlayerManager { startCase() { if (!PlayerManager.isCapsule) { // this._runningCase is provisory - const runningCase = this._server.generateRunningCase(); + const runningCase = + this._server.generateRunningCase(this._userid, + this._currentCaseId); // console.log("************* Running case"); // console.log(runningCase); diff --git a/src/adonisjs/public/author/icons/mono-slide.svg b/src/adonisjs/public/resources/icons/mono-slide.svg similarity index 100% rename from src/adonisjs/public/author/icons/mono-slide.svg rename to src/adonisjs/public/resources/icons/mono-slide.svg diff --git a/src/adonisjs/public/templates/basic/picture_up_left.md b/src/adonisjs/public/templates/basic/picture_up_left.md new file mode 100644 index 000000000..f7b84b5c4 --- /dev/null +++ b/src/adonisjs/public/templates/basic/picture_up_left.md @@ -0,0 +1,5 @@ +# Knot (picture_up_left) + +![Landscape](templates/landscape.svg) + +Text of the scene. \ No newline at end of file diff --git a/src/adonisjs/public/templates/basic/picture_up_left.png b/src/adonisjs/public/templates/basic/picture_up_left.png new file mode 100644 index 000000000..9435b8dfb Binary files /dev/null and b/src/adonisjs/public/templates/basic/picture_up_left.png differ diff --git a/src/adonisjs/public/templates/templates.json b/src/adonisjs/public/templates/templates.json new file mode 100644 index 000000000..493d62826 --- /dev/null +++ b/src/adonisjs/public/templates/templates.json @@ -0,0 +1,4 @@ +{"Picture Up-Left": + {"description": "Template with a picture in the up-left corner.", + "path": "basic/picture_up_left"} +} \ No newline at end of file diff --git a/src/adonisjs/public/themes/README.md b/src/adonisjs/public/themes/README.md index 994b92d6f..84b78e7ab 100644 --- a/src/adonisjs/public/themes/README.md +++ b/src/adonisjs/public/themes/README.md @@ -1,10 +1,12 @@ -# Templates +# Themes -Templates are organized in template families or family sets. Each family has a subdirectory and they are exclusive alternatives, i.e., only one template family can be used in each translation. +Themes are organized in theme families or family sets. Each family has a subdirectory and they are exclusive alternatives, i.e., only one theme family can be used in each translation. The families currently available are: * **classic** - Minimal template without extra format. -* **jacinto** - Standard template for Jacinto cases. +* **jacinto** - The standard template for the Jacinto cases. + +* **zombie** - The standard template for the Zombie Health cases. Each template family has a HTML file for each available knot category. There is always a dafault `knot.html` template used for those knots that do not specify a category, or those that specify unknown categories. diff --git a/src/adonisjs/public/themes/classic/css/player.css b/src/adonisjs/public/themes/classic/css/player.css deleted file mode 100644 index 77f2fa67a..000000000 --- a/src/adonisjs/public/themes/classic/css/player.css +++ /dev/null @@ -1,68 +0,0 @@ -@charset "UTF-8"; - -body { - font-family: "Trebuchet MS", Helvetica, sans-serif; - font-size: 14pt; -} - -.std-border { - border: 1px solid lightgray; - border-radius: 5px; - margin: 5px; -} - -.sty-main-panel { - /* the main box (body) occupies all the visible area */ - position: absolute; - left: 0px; - right: 0px; - top: 0px; - bottom: 0px; - - /* eliminate margins etc. */ - margin: 0px; - padding: 0px; - border-width: 0px; - - display: flex; - flex-direction: column; -} - -.sty-control-panel { - flex: 10%; - max-height: 48px; - display: flex; - flex-direction: row; -} - -.control-button { - flex: 10%; - max-width: 48px; - max-height: 48px; - margin-right: 10px; -} - -.sty-work-panel { - flex: 90%; - height: 90%; - max-height: 90%; - height: 100%; - display: flex; -} - -@media (orientation: landscape) { - .work-panel { - flex-direction: row; - } -} - -@media (orientation: portrait) { - .work-panel { - flex-direction: column; - } -} - -.sty-knot-panel { - flex: 90%; - max-height: 100%; -} diff --git a/src/adonisjs/public/themes/classic/css/templates.css b/src/adonisjs/public/themes/classic/css/templates.css index fc21ec986..a302dc04a 100644 --- a/src/adonisjs/public/themes/classic/css/templates.css +++ b/src/adonisjs/public/themes/classic/css/templates.css @@ -1,5 +1,24 @@ @charset "UTF-8"; +/* picture-up-left + *****************/ + +.tsty-pul-main { + width: 100%; + height: 100%; + font-size: 5vh; +} + +.tsty-pul-main img { + width: 50%; + height: 50%; + object-fit: contain; + float: left; + margin-right: 10px; + margin-bottom: 10px; +} + + /* Knot (template) */ /*******************/ diff --git a/src/adonisjs/public/themes/classic/images/mono-slide.svg b/src/adonisjs/public/themes/classic/images/mono-slide.svg new file mode 100644 index 000000000..526a6ea27 --- /dev/null +++ b/src/adonisjs/public/themes/classic/images/mono-slide.svg @@ -0,0 +1,127 @@ + + + + + + + + + + + + + + + image/svg+xml + + + + + Openclipart + + + + + + + + + + + diff --git a/src/adonisjs/public/themes/classic/images/mountain-1849091.ai b/src/adonisjs/public/themes/classic/images/mountain-1849091.ai new file mode 100644 index 000000000..702f949c1 Binary files /dev/null and b/src/adonisjs/public/themes/classic/images/mountain-1849091.ai differ diff --git a/src/adonisjs/public/themes/classic/picture_up_left.html b/src/adonisjs/public/themes/classic/picture_up_left.html new file mode 100644 index 000000000..ba5a00ad0 --- /dev/null +++ b/src/adonisjs/public/themes/classic/picture_up_left.html @@ -0,0 +1 @@ +
{knot}
\ No newline at end of file diff --git a/src/adonisjs/public/themes/classic/reset.html b/src/adonisjs/public/themes/classic/reset.html deleted file mode 100644 index 581c72e86..000000000 --- a/src/adonisjs/public/themes/classic/reset.html +++ /dev/null @@ -1,11 +0,0 @@ -
-
- -
- -
-
DANGER! Reset Page
- - -
-
\ No newline at end of file diff --git a/src/adonisjs/public/themes/jacinto/images/mono-slide.svg b/src/adonisjs/public/themes/jacinto/images/mono-slide.svg new file mode 100644 index 000000000..526a6ea27 --- /dev/null +++ b/src/adonisjs/public/themes/jacinto/images/mono-slide.svg @@ -0,0 +1,127 @@ + + + + + + + + + + + + + + + image/svg+xml + + + + + Openclipart + + + + + + + + + + + diff --git a/src/adonisjs/public/themes/jacinto/start.html b/src/adonisjs/public/themes/jacinto/start.html index 98ecb6bd2..fe4c72dbb 100644 --- a/src/adonisjs/public/themes/jacinto/start.html +++ b/src/adonisjs/public/themes/jacinto/start.html @@ -1,2 +1,2 @@ - + {knot} \ No newline at end of file diff --git a/src/adonisjs/public/themes/themes.json b/src/adonisjs/public/themes/themes.json new file mode 100644 index 000000000..80bf6b602 --- /dev/null +++ b/src/adonisjs/public/themes/themes.json @@ -0,0 +1,13 @@ +{"Classic": + {"description": "Minimal theme without extra format.", + "path": "classic", + "icon": "mono-slide.svg"}, + "Jacinto": + {"description": "The standard theme for the Jacinto cases.", + "path": "jacinto", + "icon": "mono-slide.svg"}, + "Zombie": + {"description": "The standard theme for the Zombie Health cases.", + "path": "zombie", + "icon": "mono-slide.svg"} +} \ No newline at end of file diff --git a/src/adonisjs/public/themes/zombie/css/player.css b/src/adonisjs/public/themes/zombie/css/player.css deleted file mode 100644 index 5c2c21469..000000000 --- a/src/adonisjs/public/themes/zombie/css/player.css +++ /dev/null @@ -1,46 +0,0 @@ -@charset "UTF-8"; - -body { - font-family: "Trebuchet MS", Helvetica, sans-serif; - font-size: 14pt; -} - -.sty-main-panel { - /* the main box (body) occupies all the visible area */ - position: absolute; - left: 0px; - right: 0px; - top: 0px; - bottom: 0px; - - /* eliminate margins etc. */ - margin: 0px; - padding: 0px; - border-width: 0px; - - display: flex; - flex-direction: column; -} - -.panel_center { - position: absolute; - width: 100%; - top: 0px; - bottom: 0px; - left: 0px; - right: 0px; - margin-top: 60px; - background-color: transparent; -} - -.panel_inner_center { - position: absolute; - top: 0px; - bottom: 0px; - left: 0px; - right: 0px; - margin-left: 10%; - margin-right: 10%; - background-color: #fbfcd2; -} - diff --git a/src/adonisjs/public/themes/zombie/images/mono-slide.svg b/src/adonisjs/public/themes/zombie/images/mono-slide.svg new file mode 100644 index 000000000..526a6ea27 --- /dev/null +++ b/src/adonisjs/public/themes/zombie/images/mono-slide.svg @@ -0,0 +1,127 @@ + + + + + + + + + + + + + + + image/svg+xml + + + + + Openclipart + + + + + + + + + + + diff --git a/src/adonisjs/public/translator/expressions/image.png b/src/adonisjs/public/translator/expressions/image.png new file mode 100644 index 000000000..2a2908e24 Binary files /dev/null and b/src/adonisjs/public/translator/expressions/image.png differ diff --git a/src/adonisjs/public/translator/item-templates.js b/src/adonisjs/public/translator/item-templates.js index 6bb9bdf5c..7daa57f12 100644 --- a/src/adonisjs/public/translator/item-templates.js +++ b/src/adonisjs/public/translator/item-templates.js @@ -1,5 +1,7 @@ (function() { Translator.htmlTemplates = { +image: +``, option: ``, divert: diff --git a/src/adonisjs/public/translator/translator.js b/src/adonisjs/public/translator/translator.js index f65eff67c..9e13cb31b 100644 --- a/src/adonisjs/public/translator/translator.js +++ b/src/adonisjs/public/translator/translator.js @@ -169,12 +169,12 @@ class Translator { compileKnotMarkdown(knotSet, knotId) { const mdToObj = { knot : this._knotMdToObj, + image : this._imageMdToObj, option : this._optionMdToObj, divert : this._divertMdToObj, talk : this._talkMdToObj, talkopen : this._talkopenMdToObj, talkclose: this._talkcloseMdToObj, - // image : this.image, input : this._inputMdToObj, selctxopen : this._selctxopenMdToObj, selctxclose : this._selctxcloseMdToObj, @@ -325,14 +325,13 @@ class Translator { */ generateKnotHTML(knotObj) { const objToHTML = { - // knot : text : this._textObjToHTML, + image : this._imageObjToHTML, option : this._optionObjToHTML, divert : this._divertObjToHTML, talk : this._talkObjToHTML, "talk-open" : this._talkopenObjToHTML, "talk-close": this._talkcloseObjToHTML, - // image : this.image, input : this._inputObjToHTML, "context-open" : this._selctxopenObjToHTML, "context-close" : this._selctxcloseObjToHTML, @@ -466,6 +465,49 @@ class Translator { }; } + /* + * Text Obj to HTML + * Output: [content] + */ + _textObjToHTML(obj) { + // return this._markdownTranslator.makeHtml(obj.content); + return obj.content; + } + + /* + * Image Md to Obj + * Input: !\[alt-text\]([path] "[title]") + * Output: + * { + * type: "image" + * alt: + * path: + * title: + * } + */ + _imageMdToObj(matchArray) { + let image = { + type: "image", + alt: matchArray[1].trim(), + path: matchArray[2].trim() + }; + if (matchArray[3] != null) + image.title = matchArray[3].trim(); + return image; + } + + /* + * Image Obj to HTML + * Output: [title] + */ + _imageObjToHTML(obj) { + return Translator.htmlTemplates.image + .replace("[server]", DCCCommonServer.managerAddress + "artifacts/") + .replace("[path]", obj.path) + .replace("[alt]", (obj.title) + ? " alt='" + obj.title + "'" : ""); + } + /* * Context Open Md to Obj * Input: {{ [context] #[evaluation]: [option-1], ..., [option-n] @@ -481,7 +523,7 @@ class Translator { _contextOpenMdToObj(matchArray) { let context = { type: "context", - context: matchArray[1].trim(), + context: matchArray[1].trim() }; if (matchArray[2] != null) { @@ -572,15 +614,6 @@ class Translator { return Translator.htmlTemplates.annotation.replace("[natural]", obj.natural.complete); } - /* - * Text Obj to HTML - * Output: [content] - */ - _textObjToHTML(obj) { - // return this._markdownTranslator.makeHtml(obj.content); - return obj.content; - } - /* * Option Md to Obj * Input: + [label] ([rule]) -> [target] or * [label] ([rule]) -> [target] @@ -951,12 +984,13 @@ class Translator { Translator.marks = { knot : /(?:^[ \t]*(#+)[ \t]*(\w[\w \t]*)(?:\((\w[\w \t,]*)\))?[ \t]*#*[ \t]*$)|(?:^[ \t]*(\w[\w \t]*)(?:\((\w[\w \t,]*)\))?[ \t]*[\f\n\r][\n\r]?(==+|--+)$)/im, + image : /!\[([\w \t]*)\]\(([\w:.\/\?&#\-]+)[ \t]*(?:"([\w ]*)")?\)/im, + // image : //im, option : /^[ \t]*([\+\*])[ \t]*([^\(&> \t][^\(&>\n\r\f]*)?(?:\(([\w \t-]+)\)[ \t]*)?(?:-(?:(?:>)|>)[ \t]*(\w[\w. \t]*))$/im, divert : /-(?:(?:>)|>) *(\w[\w. ]*)/im, talk : /^[ \t]*:[ \t]*(\w[\w \t]*):[ \t]*([^\n\r\f]+)$/im, talkopen: /^[ \t]*:[ \t]*(\w[\w \t]*):[ \t]*$/im, talkclose: /[ \t]*:[ \t]*:[ \t]*$/im, - // image : //im, input : /\{[ \t]*\?(\d+)?([\w \t]*)(?:\:([\w \t]+))?(?:#([\w \t\+\-\*"=\%\/,]+)(?:;([\w \t\+\-\*"=\%\/,]+))?)?\}/im, selctxopen : Translator.marksAnnotation.ctxopen, selctxclose: Translator.marksAnnotation.ctxclose, diff --git a/src/adonisjs/resources/views/dcc-common-server-address.edge b/src/adonisjs/resources/views/dcc-common-server-address.edge index 043b79ee1..d0d2aa863 100644 --- a/src/adonisjs/resources/views/dcc-common-server-address.edge +++ b/src/adonisjs/resources/views/dcc-common-server-address.edge @@ -4,5 +4,10 @@ */ (function() { - DCCCommonServer.serverAddress = "{{harena_manager_url}}"; + DCCCommonServer.managerAddress = "{{harena_manager_url}}/"; + DCCCommonServer.managerAddressAPI = DCCCommonServer.managerAddress + + "api/{{harena_manager_api_version}}/"; + DCCCommonServer.loggerAddress = "{{harena_logger_url}}/"; + DCCCommonServer.loggerAddressAPI = DCCCommonServer.loggerAddress + + "api/{{harena_logger_api_version}}/"; })(); \ No newline at end of file diff --git a/src/adonisjs/start/routes.js b/src/adonisjs/start/routes.js index eb225f52e..4e8d95306 100644 --- a/src/adonisjs/start/routes.js +++ b/src/adonisjs/start/routes.js @@ -23,13 +23,28 @@ let harenaManagerUrl = Env.get("HARENA_MANAGER_URL", "http://localhost:3000/api/v1/"); */ -const Env = use('Env') +const Env = use("Env"); +Route.get("infra/dcc-common-server-address.js", async ({response, view}) =>{ + const harena_manager_url = Env.get("HARENA_MANAGER_URL", "http://127.0.0.1:1020"); + const harena_manager_api_version = Env.get("HARENA_MANAGER_API_VERSION", "v1"); + const harena_logger_url = Env.get("HARENA_LOGGER_URL", "http://127.0.0.1:1030"); + const harena_logger_api_version = Env.get("HARENA_LOGGER_API_VERSION", "v1"); + response.header("Content-type", "application/javascript"); + return view.render("dcc-common-server-address", + {"harena_manager_url": harena_manager_url, + "harena_manager_api_version": harena_manager_api_version, + "harena_logger_url": harena_logger_url, + "harena_logger_api_version": harena_logger_api_version}); +}); + +/* Route.get('infra/dcc-common-server-address.js', async ({response, view}) =>{ const harena_manager_url = Env.get('HARENA_MANAGER_URL', 'http://127.0.0.1:3000/api/v1'); response.header('Content-type', 'application/javascript'); return view.render('dcc-common-server-address',{ "harena_manager_url" : harena_manager_url }); }); +*/ /* Route.on("/author/js/dcc-author-server-address.js")