diff --git a/Client/WebServer/css/docs.css b/Client/WebServer/css/docs.css
index 8fbe242b6..21f332a82 100644
--- a/Client/WebServer/css/docs.css
+++ b/Client/WebServer/css/docs.css
@@ -556,7 +556,6 @@ width: 100%;
}
/* Search Results Page Content */
-
.docs-search-result-content {
border-top: 1px solid #dedede;
margin-left: -240px;
@@ -642,4 +641,15 @@ a:active.docs-search-result-content-record-title {
a:hover.docs-topic-index-link {
text-decoration: underline;
cursor: pointer;
+}
+
+/* Command Results Page Content */
+.docs-command-result-content {
+border-top: 1px solid #dedede;
+margin-left: -240px;
+}
+
+.docs-command-result-message {
+font-size: 90%;
+color: #31708f;
}
\ No newline at end of file
diff --git a/Projects/Superalgos/UI/Spaces/Docs-Space/DocsSpace.js b/Projects/Superalgos/UI/Spaces/Docs-Space/DocsSpace.js
index 2f3e3f941..c9bbff4ae 100644
--- a/Projects/Superalgos/UI/Spaces/Docs-Space/DocsSpace.js
+++ b/Projects/Superalgos/UI/Spaces/Docs-Space/DocsSpace.js
@@ -40,7 +40,7 @@ function newSuperalgosDocSpace() {
let nodeAppDefinition
let schemaDocument
let menuLabelsMap = new Map()
- let searchPhrase
+ let command
let docsIndex = []
return thisObject
@@ -796,6 +796,157 @@ function newSuperalgosDocSpace() {
detectEnterOnSearchBox()
}
+ function detectCommands() {
+
+ if (command.toLowerCase() === 'help add') {
+ renderCommandResultsPage(
+ [
+ "Command Add syntax: ",
+ "Option 1: Add Node to Project Node Type",
+ "Example: Add Node to Superalgos Task Manager",
+ "Option 2: Add Concpet to Project Concept Name",
+ "Example: Add Concept to Superalgos Attaching Nodes",
+ "Option 3: Add Topic to Project Topic->Part Name",
+ "Example: Add Topic to Superalgos Contributing->Code"
+ ]
+ )
+ return
+ }
+
+ const newParagraphText = "Left click and Edit to enter edit mode and change this text. ENTER to write new paragraphs. ESC to exit edit mode."
+ let splittedCommand = command.split(' ')
+
+ if (splittedCommand[0].toLowerCase() === 'add') {
+ if (splittedCommand[2] !== 'to') {
+ renderCommandResultsPage(["Syntax Error. Keyword to missing: Example: Add Concept to Superalgos New Concept Name. Type Hekp Add to learn the command's syntax."])
+ return
+ }
+
+ if (splittedCommand.length < 5) {
+ renderCommandResultsPage(["Syntax Error. Too few parameters. Found " + splittedCommand.length + ". Expected at least 5. Type Hekp Add to learn the command's syntax."])
+ return
+ }
+
+ let remainderParams = command.replace(splittedCommand[0] + ' ' + splittedCommand[1] + ' ' + splittedCommand[2] + ' ' + splittedCommand[3] + ' ', '')
+ if (remainderParams === '') {
+ renderCommandResultsPage(["Syntax Error. Node, Concept or Topic name can not be undefined."])
+ return
+ }
+
+ switch (splittedCommand[1].toLowerCase()) {
+ case 'node': {
+ addNode(splittedCommand[3], remainderParams)
+ return
+ }
+ case 'concept': {
+ addConcept(splittedCommand[3], remainderParams)
+ return
+ }
+ case 'topic': {
+ let topicPlusPartType = remainderParams
+ let splittedTopic = topicPlusPartType.split('->')
+ addTopic(splittedCommand[3], splittedTopic[0], splittedTopic[1])
+ return
+ }
+ default: {
+ renderCommandResultsPage(["Syntax Error. Expected Node, Concept or Topic. Found " + splittedCommand[1] + ""])
+ return
+ }
+ }
+ }
+
+ renderSearchResultsPage()
+
+ function addNode(project, type) {
+ let template = {
+ type: type,
+ definition: "Write here the definition of this Node.",
+ paragraphs: [
+ {
+ style: "Text",
+ text: newParagraphText
+ }
+ ]
+ }
+ if (SCHEMAS_BY_PROJECT.get(project) === undefined) {
+ renderCommandResultsPage(["Project " + project + " does not exist."])
+ return
+ }
+ SCHEMAS_BY_PROJECT.get(project).array.docsNodeSchema.push(template)
+ SCHEMAS_BY_PROJECT.get(project).map.docsNodeSchema.set(type, template)
+ navigateTo('Node', type, project)
+ }
+
+ function addConcept(project, type) {
+ let template = {
+ type: type,
+ definition: "Write here the definition of this Concept.",
+ paragraphs: [
+ {
+ style: "Text",
+ text: newParagraphText
+ }
+ ]
+ }
+
+ if (SCHEMAS_BY_PROJECT.get(project) === undefined) {
+ renderCommandResultsPage(["Project " + project + " does not exist."])
+ return
+ }
+ SCHEMAS_BY_PROJECT.get(project).array.docsConceptSchema.push(template)
+ SCHEMAS_BY_PROJECT.get(project).map.docsConceptSchema.set(type, template)
+ navigateTo('Concept', type, project)
+ }
+
+ function addTopic(project, topic, type) {
+ let template = {
+ topic: topic,
+ type: type,
+ definition: "Write here the definition of this Concept.",
+ paragraphs: [
+ {
+ style: "Text",
+ text: newParagraphText
+ }
+ ]
+ }
+ if (SCHEMAS_BY_PROJECT.get(project) === undefined) {
+ renderCommandResultsPage(["Project " + project + " does not exist."])
+ return
+ }
+ SCHEMAS_BY_PROJECT.get(project).array.docsTopicSchema.push(template)
+ SCHEMAS_BY_PROJECT.get(project).map.docsTopicSchema.set(topic + ' ' + type, template)
+ navigateTo('Topic', type, project)
+ }
+ }
+
+ function renderCommandResultsPage(resultArray) {
+
+ buildHTML()
+
+ function buildHTML() {
+ let HTML = ''
+ HTML = HTML + '
' + result.documentIndex.project + ' > ' + result.documentIndex.documentCategory + path + '
' - + let mainLink = '' if (result.documentIndex.schemaDocument.topic === undefined) { mainLink = result.documentIndex.schemaDocument.type } else { - mainLink = result.documentIndex.schemaDocument.topic + ' - Part ' + result.documentIndex.schemaDocument.pageNumber + ' - ' + result.documentIndex.schemaDocument.type + mainLink = result.documentIndex.schemaDocument.topic + ' - Part ' + result.documentIndex.schemaDocument.pageNumber + ' - ' + result.documentIndex.schemaDocument.type } HTML = HTML + '' @@ -1031,14 +1182,14 @@ function newSuperalgosDocSpace() { function detectEnterOnSearchBox() { const element = document.getElementsByClassName("docs-search-input")[0] - if (searchPhrase !== undefined) { - element.value = searchPhrase + if (command !== undefined) { + element.value = command } element.focus() element.addEventListener("keyup", function (event) { if (event.key === "Enter" || event.keyCode === 13) { - searchPhrase = element.value - renderSearchResultsPage() + command = element.value + detectCommands() } }); } @@ -1137,11 +1288,11 @@ function newSuperalgosDocSpace() { // Use the New Node Template let template = { type: objectBeingRendered.type, - definition: "Please contribute the definition of this node.", + definition: "Write here the definition of this " + objectBeingRendered.category + ".", paragraphs: [ { style: "Text", - text: "Be the first one to explain how this node works by editing this paragraph. Left click and Edit to enter edit mode and change this text." + text: "Left click and Edit to enter edit mode and change this text." } ] } @@ -1157,11 +1308,6 @@ function newSuperalgosDocSpace() { SCHEMAS_BY_PROJECT.get(objectBeingRendered.project).map.docsConceptSchema.set(objectBeingRendered.type, template) break } - case 'Topic': { - SCHEMAS_BY_PROJECT.get(objectBeingRendered.project).array.docsTopicSchema.push(template) - SCHEMAS_BY_PROJECT.get(objectBeingRendered.project).map.docsTopicSchema.set(objectBeingRendered.type, template) - break - } } schemaDocument = template