diff --git a/.gitignore b/.gitignore index 398a55a6d..0d55adda3 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,4 @@ dcc-author-server-address.js + +package-lock\.json diff --git a/author/images/bubble-landscape.png b/author/images/bubble-landscape.png new file mode 100644 index 000000000..2836a2680 Binary files /dev/null and b/author/images/bubble-landscape.png differ diff --git a/author/images/bubble-portrait.png b/author/images/bubble-portrait.png new file mode 100644 index 000000000..f3e856449 Binary files /dev/null and b/author/images/bubble-portrait.png differ diff --git a/author/images/call-the-supervisor.svg b/author/images/call-the-supervisor.svg new file mode 100644 index 000000000..8e8f19609 --- /dev/null +++ b/author/images/call-the-supervisor.svg @@ -0,0 +1,88 @@ + + + + + + + + + + image/svg+xml + + + + + + + + + + + + + + diff --git a/author/images/doctor-icon.png b/author/images/doctor-icon.png new file mode 100644 index 000000000..3b373e0d2 Binary files /dev/null and b/author/images/doctor-icon.png differ diff --git a/author/images/doctor.png b/author/images/doctor.png new file mode 100644 index 000000000..a8c9ec3c1 Binary files /dev/null and b/author/images/doctor.png differ diff --git a/author/images/entrance.jpg b/author/images/entrance.jpg new file mode 100644 index 000000000..1dd4be7c5 Binary files /dev/null and b/author/images/entrance.jpg differ diff --git a/author/images/generate-hypothesis.svg b/author/images/generate-hypothesis.svg new file mode 100644 index 000000000..57d31831d --- /dev/null +++ b/author/images/generate-hypothesis.svg @@ -0,0 +1,89 @@ + + + + + + + + + + image/svg+xml + + + + + + + + + + + + + diff --git a/author/images/icon-back.svg b/author/images/icon-back.svg new file mode 100644 index 000000000..63a7be8ba --- /dev/null +++ b/author/images/icon-back.svg @@ -0,0 +1,77 @@ + + + + + + + + + + image/svg+xml + + + + + + + + + + + + + diff --git a/author/images/jacinto-icon.png b/author/images/jacinto-icon.png new file mode 100644 index 000000000..1662c3c41 Binary files /dev/null and b/author/images/jacinto-icon.png differ diff --git a/author/images/jacinto.png b/author/images/jacinto.png new file mode 100644 index 000000000..4f4a65fbd Binary files /dev/null and b/author/images/jacinto.png differ diff --git a/author/images/mono-slide.svg b/author/images/mono-slide.svg new file mode 100644 index 000000000..526a6ea27 --- /dev/null +++ b/author/images/mono-slide.svg @@ -0,0 +1,127 @@ + + + + + + + + + + + + + + + image/svg+xml + + + + + Openclipart + + + + + + + + + + + diff --git a/author/images/more-information.svg b/author/images/more-information.svg new file mode 100644 index 000000000..637071ce6 --- /dev/null +++ b/author/images/more-information.svg @@ -0,0 +1,80 @@ + + + + + + + + + + image/svg+xml + + + + + + + + + + + + + diff --git a/author/images/nurse-icon.png b/author/images/nurse-icon.png new file mode 100644 index 000000000..54bbf995f Binary files /dev/null and b/author/images/nurse-icon.png differ diff --git a/author/images/nurse.png b/author/images/nurse.png new file mode 100644 index 000000000..3e578849d Binary files /dev/null and b/author/images/nurse.png differ diff --git a/author/images/tablet.svg b/author/images/tablet.svg new file mode 100644 index 000000000..efb362a82 --- /dev/null +++ b/author/images/tablet.svg @@ -0,0 +1,66 @@ + + + + + + + + + + image/svg+xml + + + + + + + + + diff --git a/src/adonisjs/public/author/icons/icon-edit-case.svg b/src/adonisjs/public/author/icons/icon-edit-case.svg new file mode 100644 index 000000000..37d6d408a --- /dev/null +++ b/src/adonisjs/public/author/icons/icon-edit-case.svg @@ -0,0 +1,99 @@ + + + + + + + + + + image/svg+xml + + + + + + + + + + + + + diff --git a/src/adonisjs/public/author/index.html b/src/adonisjs/public/author/index.html index 976475ce6..90ed563a6 100644 --- a/src/adonisjs/public/author/index.html +++ b/src/adonisjs/public/author/index.html @@ -48,6 +48,7 @@
+
diff --git a/src/adonisjs/public/author/js/author.js b/src/adonisjs/public/author/js/author.js index 95227d0ce..09e8edd56 100644 --- a/src/adonisjs/public/author/js/author.js +++ b/src/adonisjs/public/author/js/author.js @@ -22,6 +22,7 @@ class AuthorManager { // new DCCAuthorServer(); // this._currentThemeFamily = "jacinto"; + this._themeSVG = true; this._currentCaseId = null; this._knotSelected = null; this._htmlKnot = null; @@ -66,6 +67,8 @@ class AuthorManager { break; case "control/case/save": this.caseSave(); break; + case "control/case/edit": this.caseEdit(); + break; case "control/knot/new": this.knotNew(); break; case "control/knot/edit": this.knotEdit(); @@ -115,16 +118,24 @@ class AuthorManager { */ async caseNew() { this._temporaryCase = true; - const caseId = await MessageBus.ext.request("data/case//new"); - + await this._themeSelect(); let template = await this._templateSelect(); const templateMd = await MessageBus.ext.request("data/template/" + template.replace("/", ".") + "/get"); + const caseId = await MessageBus.ext.request("data/case//new", + {format: "markdown", + name: "Untitled", + source: templateMd.message}); + + /* const status = await MessageBus.ext.request("data/case/" + caseId.message + "/set", - {format: "markdown", source: templateMd.message}); + {format: "markdown", + name: "Untitled", + source: templateMd.message}); + */ this._caseLoad(caseId.message); } @@ -185,6 +196,21 @@ class AuthorManager { } } + /* + * ACTION: control/case/edit + */ + async caseEdit() { + let md = this._translator.assembleMarkdown(this._compiledCase); + this._knotPanel.innerHTML = "
"; + this._editor = new Quill("#editor-space", { + theme: "snow", + formats: { + font: "Courier New" + } + }); + this._editor.insertText(0, md); + } + /* * ACTION: control/knot/new */ @@ -221,7 +247,6 @@ class AuthorManager { if (this._checkKnotModification()) this._htmlKnot = await this._translator.generateHTML( this._knots[this._knotSelected]); - // this._htmlKnot = await this._generateHTML(this._knotSelected); this._renderSlide = !this._renderSlide; this._renderKnot(); } @@ -290,6 +315,7 @@ class AuthorManager { this._translator.currentThemeFamily = await DCCNoticeInput.displayNotice( "Select a theme to be applied.", "list", "Select", "Cancel", families.message); + this._themeSVG = families.message[this._translator.currentThemeFamily].svg; } /* 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 5fee35893..a923d91fa 100644 --- a/src/adonisjs/public/author/js/dcc-author-server-proxy.js +++ b/src/adonisjs/public/author/js/dcc-author-server-proxy.js @@ -81,24 +81,15 @@ class DCCAuthorServer { "headers": { "Content-Type": "application/json", "Authorization": "Bearer " + DCCCommonServer.instance.token - } + }, + "body": JSON.stringify({name: message.name, + source: message.source}) }; const response = - await fetch(DCCCommonServer.managerAddressAPI + "case/new", header); + await fetch(DCCCommonServer.managerAddressAPI + "case", header); const jsonResponse = await response.json(); MessageBus.ext.publish(MessageBus.buildResponseTopic(topic, message), jsonResponse.uuid); - - /* - const response = await fetch(DCCCommonServer.managerAddressAPI + "new-case", { - method: "POST", - headers:{ - "Content-Type": "application/json" - } - }); - const jsonResponse = await response.json(); - MessageBus.ext.publish("case/" + jsonResponse.caseName + "/set/status", "ok"); - */ } async saveCase(topic, message) { diff --git a/src/adonisjs/public/author/js/navigator.js b/src/adonisjs/public/author/js/navigator.js index ec6fa44e3..27f0bdd42 100644 --- a/src/adonisjs/public/author/js/navigator.js +++ b/src/adonisjs/public/author/js/navigator.js @@ -408,6 +408,8 @@ async _createMiniature(knot, krender) { iframe.srcdoc = this._capsule.message .replace(/{width}/g, Navigator.miniKnot[this._retracted].width) .replace(/{height}/g, Navigator.miniKnot[this._retracted].height-6) + .replace(/{scale}/g, (this._author._themeSVG) + ? "" : ";transform-origin:top left;transform:scale(0.1)") .replace("{knot}", htmlKnot); miniature.appendChild(iframe); diff --git a/src/adonisjs/public/dccs/components/dcc-character.js b/src/adonisjs/public/dccs/components/dcc-character.js index 96caf3d39..70412ade8 100644 --- a/src/adonisjs/public/dccs/components/dcc-character.js +++ b/src/adonisjs/public/dccs/components/dcc-character.js @@ -154,8 +154,12 @@ class DCCCharacter extends DCCBase { let extension = this.image.lastIndexOf("."); let icon = this.image.substring(0, extension) + "-icon" + this.image.substring(extension); - return "
" + - "
"; + return "
" + + "
" + + "
" + + "
"; } /* Editable Component */ diff --git a/src/adonisjs/public/infra/basic.js b/src/adonisjs/public/infra/basic.js index 52622a437..dc25c4d44 100644 --- a/src/adonisjs/public/infra/basic.js +++ b/src/adonisjs/public/infra/basic.js @@ -59,6 +59,10 @@ class Basic { top: ((dimensions.height - height) / 2) / dimensions.zoom + dimensions.top } } + + imageResolver(relativePath) { + return DCCCommonServer.managerAddress + "artifacts/" + relativePath; + } } (function() { diff --git a/src/adonisjs/public/infra/dcc-common-server-proxy.js b/src/adonisjs/public/infra/dcc-common-server-proxy.js index b1cc085ff..40bd35e58 100644 --- a/src/adonisjs/public/infra/dcc-common-server-proxy.js +++ b/src/adonisjs/public/infra/dcc-common-server-proxy.js @@ -65,7 +65,8 @@ class DCCCommonServer { for (var c in jsonResponse) busResponse[jsonResponse[c].uuid] = { name: jsonResponse[c].name, - icon: "../resources/icons/mono-slide.svg" + icon: "../resources/icons/mono-slide.svg", + svg : jsonResponse[c].svg }; MessageBus.ext.publish(MessageBus.buildResponseTopic(topic, message), busResponse); diff --git a/src/adonisjs/public/modules/capsule.html b/src/adonisjs/public/modules/capsule.html index f5812554a..ee60fc54a 100644 --- a/src/adonisjs/public/modules/capsule.html +++ b/src/adonisjs/public/modules/capsule.html @@ -38,7 +38,7 @@ + style="width: 100%; height: {height}px; margin: 0px{scale}">
{knot} diff --git a/src/adonisjs/public/themes/themes.json b/src/adonisjs/public/themes/themes.json index 80bf6b602..c420b8661 100644 --- a/src/adonisjs/public/themes/themes.json +++ b/src/adonisjs/public/themes/themes.json @@ -1,13 +1,16 @@ {"Classic": {"description": "Minimal theme without extra format.", "path": "classic", - "icon": "mono-slide.svg"}, + "icon": "mono-slide.svg", + "svg" : "false"}, "Jacinto": {"description": "The standard theme for the Jacinto cases.", "path": "jacinto", - "icon": "mono-slide.svg"}, + "icon": "mono-slide.svg", + "svg" : "true"}, "Zombie": {"description": "The standard theme for the Zombie Health cases.", "path": "zombie", - "icon": "mono-slide.svg"} + "icon": "mono-slide.svg", + "svg" : "false"} } \ No newline at end of file diff --git a/src/adonisjs/public/translator/item-templates.js b/src/adonisjs/public/translator/item-templates.js index 7daa57f12..23cdd6c5f 100644 --- a/src/adonisjs/public/translator/item-templates.js +++ b/src/adonisjs/public/translator/item-templates.js @@ -1,7 +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 9e13cb31b..a349cee9a 100644 --- a/src/adonisjs/public/translator/translator.js +++ b/src/adonisjs/public/translator/translator.js @@ -287,7 +287,8 @@ class Translator { } deleteThemeSet() { - delete this._themeSet; + // there is some synchronization problem - it is deleting before finishing + // delete this._themeSet; } async generateHTMLBuffer(knot) { @@ -498,12 +499,11 @@ class Translator { /* * Image Obj to HTML - * Output: [title] + * Output: [title] */ _imageObjToHTML(obj) { return Translator.htmlTemplates.image - .replace("[server]", DCCCommonServer.managerAddress + "artifacts/") - .replace("[path]", obj.path) + .replace("[path]", Basic.service.imageResolver(obj.path)) .replace("[alt]", (obj.title) ? " alt='" + obj.title + "'" : ""); }