Merge pull request #377 from Luis-Fernando-Molina/develop

Contribution: Reviews Implementation. Adding, Deleting, Searching, etc. reviews.
This commit is contained in:
Luis Fernando Molina authored and GitHub committed 2021-01-15 12:22:12 +01:00
commit 3b5a44c866
15 files changed
+511 -54

No files matched your search

+2 -2
View File
@@ -816,7 +816,7 @@ width: 100%;
.docs-search-results-header-tabs-container {
display: table;
padding-left: 240px;
padding-left: 180px;
margin-top: 20px;
}
@@ -848,7 +848,7 @@ width: 100%;
/* Search Results Page Content */
.docs-search-result-content {
border-top: 1px solid #0295aa;
margin-left: -240px;
margin-left: -180px;
}
.docs-search-result-content > div {
+39
View File
@@ -424,6 +424,36 @@ exports.newHttpInterface = function newHttpInterface(WEB_SERVER, DATA_FILE_SERVE
}
break
}
case 'Save-Review-Schema': {
getBody(processRequest)
async function processRequest(body) {
try {
let docsSchema = JSON.parse(body)
let project = requestParameters[3]
let filePath = global.env.PATH_TO_PROJECTS + '/' + project + '/Schemas/Docs-Reviews'
if (checkAllSchmemaDocuments('Review', docsSchema, filePath) === true) {
respondWithContent(JSON.stringify(global.DEFAULT_OK_RESPONSE), httpResponse)
} else {
respondWithContent(JSON.stringify(global.DEFAULT_FAIL_RESPONSE), httpResponse)
}
} catch (err) {
console.log('[ERROR] httpInterface -> Docs -> Save-Review-Schema -> Method call produced an error.')
console.log('[ERROR] httpInterface -> Docs -> Save-Review-Schema -> err.stack = ' + err.stack)
console.log('[ERROR] httpInterface -> Docs -> Save-Review-Schema -> Params Received = ' + body)
let error = {
result: 'Fail Because',
message: err.message,
stack: err.stack
}
respondWithContent(JSON.stringify(error), httpResponse)
}
}
break
}
case 'Save-Book-Schema': {
getBody(processRequest)
@@ -479,6 +509,11 @@ exports.newHttpInterface = function newHttpInterface(WEB_SERVER, DATA_FILE_SERVE
fileName = cleanFileName(fileName)
break
}
case 'Review': {
fileName = schemaDocument.review.toLowerCase() + '-' + pageNumber.substring(pageNumber.length - 3, pageNumber.length) + '-' + schemaDocument.type.toLowerCase()
fileName = cleanFileName(fileName)
break
}
}
fileName = fileName + '.json'
@@ -1370,6 +1405,10 @@ exports.newHttpInterface = function newHttpInterface(WEB_SERVER, DATA_FILE_SERVE
folder = 'Docs-Tutorials'
break
}
case 'DocsReviewSchema': {
folder = 'Docs-Reviews'
break
}
case 'DocsBookSchema': {
folder = 'Docs-Books'
break
@@ -0,0 +1,51 @@
{
"review": "Superalgos Project Review",
"pageNumber": "1",
"type": "Superalgos Review - Leave Your Feedback!",
"definition": {
"text": "This is the place where you can leave your feedback and impressions about the project, for others to find and read.",
"updated": 1610701752995
},
"paragraphs": [
{
"style": "Success",
"text": "After you create your own review page as part of this collection, you will be able to edit it over time, and add more info as your experience evolves with the system. So, don't worry is right now you can just write your first impressions. You will allways be able to come back and extend your page.",
"updated": 1610701884353
},
{
"style": "Title",
"text": "How to add your own Review",
"updated": 1610702480960
},
{
"style": "Text",
"text": "In order to add your own review page of the Superalgos Project, copy and paste the following code at the search bar:"
},
{
"style": "Json",
"text": "docs.add Review to Superalgos: Superalgos Project Review->Superalgos Review - YOUR REVIEW TITLE",
"updated": 1610702550459
},
{
"style": "List",
"text": "YOUR REVIEW TITLE: Replace this placeholder text for a short title for your Review Page."
},
{
"style": "Important",
"text": "You need to sign your Review Page. At the en of the text, type your Github.com username. This needs to be present in order for the Review to be added to the next release of Superalgos.",
"updated": 1610702866522
},
{
"style": "Text",
"text": "Your review will be merged into the main repository once you send it as a contribution. For that you need to execute:"
},
{
"style": "Json",
"text": "docs.save"
},
{
"style": "Json",
"text": "app.contribute"
}
]
}
@@ -13,26 +13,26 @@
"updated": 1609150474236
},
{
"style": "Text",
"style": "Subtitle",
"text": "Option 1: ",
"updated": 1609149432117
},
{
"style": "Javascript",
"style": "Json",
"text": "docs.add Node to Project: Docs Page Name",
"updated": 1609149799453
},
{
"style": "Text",
"style": "Subtitle",
"text": "Example: ",
"updated": 1609149442319
},
{
"style": "Javascript",
"style": "Json",
"text": "docs.add Node to Superalgos"
},
{
"style": "Text",
"style": "Subtitle",
"text": "Option 2: ",
"updated": 1609149450546
},
@@ -42,7 +42,7 @@
"updated": 1609149807897
},
{
"style": "Text",
"style": "Subtitle",
"text": "Example: ",
"updated": 1609149457691
},
@@ -51,7 +51,7 @@
"text": "docs.add Concept to Superalgos"
},
{
"style": "Text",
"style": "Subtitle",
"text": "Option 3: ",
"updated": 1609149464103
},
@@ -61,7 +61,7 @@
"updated": 1609149846658
},
{
"style": "Text",
"style": "Subtitle",
"text": "Example: ",
"updated": 1609149471266
},
@@ -71,31 +71,68 @@
"updated": 1609149878993
},
{
"style": "Title",
"text": "Parameters",
"updated": 1609150484701
"style": "Subtitle",
"text": "Option 4:",
"updated": 1610706520317
},
{
"style": "Text",
"style": "Json",
"text": "docs.add Topic to Project: Docs Tutorial Name->Docs Page Name->Docs Page Number",
"updated": 1610706514194
},
{
"style": "Subtitle",
"text": "Example:"
},
{
"style": "Json",
"text": "docs.add Tutorial to Superalgos: How to Build Indicators->Intro",
"updated": 1610706570716
},
{
"style": "Subtitle",
"text": "Option 5:",
"updated": 1610706652124
},
{
"style": "Json",
"text": "docs.add Review to Project: Docs Review Name->Docs Page Name->Docs Page Number",
"updated": 1610706722998
},
{
"style": "Subtitle",
"text": "Example:"
},
{
"style": "Json",
"text": "docs.add Review to Project: Superalgos Project Review->Superalgos Review - Great Project!",
"updated": 1610706675495
},
{
"style": "Title",
"text": "Parameters"
},
{
"style": "List",
"text": "Project : Is the project where the Node, Concept or Topic is defined."
},
{
"style": "Text",
"style": "List",
"text": "Docs Page Category : Node, Concept or Topic."
},
{
"style": "Text",
"style": "List",
"text": "Docs Topic Name: The name of the topic which the new page will belong to.",
"updated": 1609149944222
},
{
"style": "Text",
"style": "List",
"text": "Docs Page Name : For Nodes it is the type of node, for Concepts, the concept name, for topics, the topic's page name."
},
{
"style": "Text",
"text": "Docs Page Numer: A page number that you would like to assing the new page. This will impact only at the position of the Topic Index.",
"updated": 1609149987475
"style": "List",
"text": "Docs Page Numer: Optional. A page number that you would like to assing the new page. This will impact only at the position of the Topic Index. If you don't provide one, it will be automatically assigned the last page number in the collection plus 1.",
"updated": 1610706305834
}
]
}
@@ -13,7 +13,7 @@
"updated": 1609152160707
},
{
"style": "Text",
"style": "Subtitle",
"text": "Option 1:",
"updated": 1609152344322
},
@@ -23,7 +23,7 @@
"updated": 1609152359725
},
{
"style": "Text",
"style": "Subtitle",
"text": "Example:"
},
{
@@ -32,16 +32,16 @@
"updated": 1609152405379
},
{
"style": "Text",
"style": "Subtitle",
"text": "Option 2:"
},
{
"style": "Javascript",
"style": "Json",
"text": "docs.delete Concept from Project: Docs Page Name",
"updated": 1609152445366
},
{
"style": "Text",
"style": "Subtitle",
"text": "Example:"
},
{
@@ -50,7 +50,7 @@
"updated": 1609152464312
},
{
"style": "Text",
"style": "Subtitle",
"text": "Option 3:"
},
{
@@ -59,7 +59,7 @@
"updated": 1609152484236
},
{
"style": "Text",
"style": "Subtitle",
"text": "Example:"
},
{
@@ -67,20 +67,58 @@
"text": "docs.delete Topic from Superalgos: Docs Styles->Docs Text Style->1",
"updated": 1609152521245
},
{
"style": "Subtitle",
"text": "Option 4:",
"updated": 1610706965604
},
{
"style": "Json",
"text": "docs.delete Tutorial from Project: Docs Tutorial Name->Docs Page Name->Docs Page Number",
"updated": 1610706951438
},
{
"style": "Subtitle",
"text": "Example:"
},
{
"style": "Json",
"text": "docs.delete Tutorial from Superalgos: How to Build Indicatiors->Intro->1",
"updated": 1610707006603
},
{
"style": "Subtitle",
"text": "Option 5:",
"updated": 1610707021714
},
{
"style": "Json",
"text": "docs.delete Review from Project: Docs Review Name->Docs Page Name->Docs Page Number",
"updated": 1610707068615
},
{
"style": "Subtitle",
"text": "Example:"
},
{
"style": "Json",
"text": "docs.delete Review from Project: Superalgos Project Review->Awasome!->2",
"updated": 1610707101903
},
{
"style": "Title",
"text": "Parameters"
},
{
"style": "Text",
"style": "List",
"text": "Project : Is the project where the Node, Concept or Topic is defined."
},
{
"style": "Text",
"style": "List",
"text": "Docs Page Category : Node, Concept or Topic."
},
{
"style": "Text",
"style": "List",
"text": "Docs Page Name : For Nodes it is the type of node, for Concepts, the concept name, for topics, the topic's page name."
}
]
@@ -1,7 +1,7 @@
{
"topic": "Docs Commands Errors",
"pageNumber": "17",
"type": "No Matching Topic Or Tutorial Found",
"type": "No Matching Topic, Tutorial or Review Found",
"definition": {
"text": "The Topic or Tutorial you specified did not produce any match of pages within that Topic or Tutorial.",
"updated": 1610398888306
@@ -202,6 +202,10 @@ function newSuperalgosDocsCommmandInterface() {
docsSchemaDocument = SCHEMAS_BY_PROJECT.get(project).map.docsTutorialSchema.get(type)
break
}
case 'review': {
docsSchemaDocument = SCHEMAS_BY_PROJECT.get(project).map.docsReviewSchema.get(type)
break
}
case 'book': {
docsSchemaDocument = SCHEMAS_BY_PROJECT.get(project).map.docsBookSchema.get(type)
break
@@ -272,7 +276,7 @@ function newSuperalgosDocsCommmandInterface() {
}
case 'topic': {
let splittedSecondaryCommand = secondaryCommand.split('->')
if (splittedSecondaryCommand.length < 3) {
if (splittedSecondaryCommand.length < 2) {
UI.projects.superalgos.spaces.docsSpace.navigateTo('Superalgos', 'Topic', 'Docs Error - Too Few Parameters', 'Anchor Too Few Paramenters')
return
}
@@ -281,13 +285,22 @@ function newSuperalgosDocsCommmandInterface() {
}
case 'tutorial': {
let splittedSecondaryCommand = secondaryCommand.split('->')
if (splittedSecondaryCommand.length < 3) {
if (splittedSecondaryCommand.length < 2) {
UI.projects.superalgos.spaces.docsSpace.navigateTo('Superalgos', 'Topic', 'Docs Error - Too Few Parameters', 'Anchor Too Few Paramenters')
return
}
addTutorial(splittedPrimaryCommand[3], splittedSecondaryCommand[0], splittedSecondaryCommand[1], splittedSecondaryCommand[2])
return
}
case 'review': {
let splittedSecondaryCommand = secondaryCommand.split('->')
if (splittedSecondaryCommand.length < 2) {
UI.projects.superalgos.spaces.docsSpace.navigateTo('Superalgos', 'Topic', 'Docs Error - Too Few Parameters', 'Anchor Too Few Paramenters')
return
}
addReview(splittedPrimaryCommand[3], splittedSecondaryCommand[0], splittedSecondaryCommand[1], splittedSecondaryCommand[2])
return
}
case 'book': {
addBook(splittedPrimaryCommand[3], secondaryCommand)
return
@@ -366,6 +379,15 @@ function newSuperalgosDocsCommmandInterface() {
deleteTutorial(splittedPrimaryCommand[3], splittedSecondaryCommand[0], splittedSecondaryCommand[1], splittedSecondaryCommand[2])
return
}
case 'review': {
let splittedSecondaryCommand = secondaryCommand.split('->')
if (splittedSecondaryCommand.length < 3) {
UI.projects.superalgos.spaces.docsSpace.navigateTo('Superalgos', 'Topic', 'Docs Error - Too Few Parameters', 'Anchor Too Few Paramenters')
return
}
deleteReview(splittedPrimaryCommand[3], splittedSecondaryCommand[0], splittedSecondaryCommand[1], splittedSecondaryCommand[2])
return
}
case 'book': {
deleteBook(splittedPrimaryCommand[3], secondaryCommand)
return
@@ -429,6 +451,10 @@ function newSuperalgosDocsCommmandInterface() {
repaginate(splittedPrimaryCommand[3], 'Tutorial', secondaryCommand)
return
}
case 'review': {
repaginate(splittedPrimaryCommand[3], 'Review', secondaryCommand)
return
}
case 'book': {
UI.projects.superalgos.spaces.docsSpace.navigateTo('Superalgos', 'Topic', 'Docs Error - Category Not Valid', 'Anchor Category Not Valid')
return
@@ -488,6 +514,10 @@ function newSuperalgosDocsCommmandInterface() {
httpRequest(JSON.stringify(docsSchema), 'Docs/Save-Tutorial-Schema/' + project, onResponse)
requestsSent++
docsSchema = SCHEMAS_BY_PROJECT.get(project).array.docsReviewSchema
httpRequest(JSON.stringify(docsSchema), 'Docs/Save-Review-Schema/' + project, onResponse)
requestsSent++
docsSchema = SCHEMAS_BY_PROJECT.get(project).array.docsBookSchema
httpRequest(JSON.stringify(docsSchema), 'Docs/Save-Book-Schema/' + project, onResponse)
requestsSent++
@@ -580,6 +610,21 @@ function newSuperalgosDocsCommmandInterface() {
}
SCHEMAS_BY_PROJECT.get(project).array.docsTutorialSchema = documents
/* Reviews */
documents = []
for (let i = 0; i < SCHEMAS_BY_PROJECT.get(project).array.docsReviewSchema.length; i++) {
docsSchemaDocument = SCHEMAS_BY_PROJECT.get(project).array.docsReviewSchema[i]
docsSchemaDocument.updated = undefined
docsSchemaDocument.created = undefined
if (docsSchemaDocument.deleted === true) {
SCHEMAS_BY_PROJECT.get(project).map.docsReviewSchema.delete(docsSchemaDocument.type)
} else {
documents.push(docsSchemaDocument)
}
}
SCHEMAS_BY_PROJECT.get(project).array.docsReviewSchema = documents
/* Books */
documents = []
for (let i = 0; i < SCHEMAS_BY_PROJECT.get(project).array.docsBookSchema.length; i++) {
@@ -611,7 +656,7 @@ function newSuperalgosDocsCommmandInterface() {
)
if (orderedArray.length = 0) {
UI.projects.superalgos.spaces.docsSpace.navigateTo('Superalgos', 'Topic', 'No Matching Topic Or Tutorial Found')
UI.projects.superalgos.spaces.docsSpace.navigateTo('Superalgos', 'Topic', 'No Matching Topic, Tutorial or Review Found')
return
}
@@ -681,6 +726,17 @@ function newSuperalgosDocsCommmandInterface() {
}
function addTopic(project, topic, type, pageNumber) {
if (pageNumber === undefined) {
let orderedArray = UI.projects.superalgos.utilities.docs.buildOrderedPageIndex(
project,
'Topic',
review
)
pageNumber = orderedArray.length + 1
}
let template = {
created: true,
topic: topic,
@@ -710,6 +766,17 @@ function newSuperalgosDocsCommmandInterface() {
}
function addTutorial(project, tutorial, type, pageNumber) {
if (pageNumber === undefined) {
let orderedArray = UI.projects.superalgos.utilities.docs.buildOrderedPageIndex(
project,
'Tutorial',
review
)
pageNumber = orderedArray.length + 1
}
let template = {
created: true,
tutorial: tutorial,
@@ -738,6 +805,46 @@ function newSuperalgosDocsCommmandInterface() {
UI.projects.superalgos.spaces.docsSpace.navigateTo(project, 'Tutorial', type)
}
function addReview(project, review, type, pageNumber) {
if (pageNumber === undefined) {
let orderedArray = UI.projects.superalgos.utilities.docs.buildOrderedPageIndex(
project,
'Review',
review
)
pageNumber = orderedArray.length + 1
}
let template = {
created: true,
review: review,
pageNumber: pageNumber,
type: type,
definition: { text: "Write here a summary for this review page." },
paragraphs: [
{
style: "Text",
text: UI.projects.superalgos.globals.docs.NEW_PARAGRAPH_TEXT
}
]
}
if (SCHEMAS_BY_PROJECT.get(project) === undefined) {
UI.projects.superalgos.spaces.docsSpace.navigateTo('Superalgos', 'Topic', 'Docs Error - Project Does Not Exist', 'Anchor Project Does Not Exist')
return
}
let exist = SCHEMAS_BY_PROJECT.get(project).map.docsReviewSchema.get(type)
if (exist !== undefined) {
UI.projects.superalgos.spaces.docsSpace.navigateTo('Superalgos', 'Topic', 'Docs Error - Page Already Exists', 'Anchor Page Already Exists')
return
}
SCHEMAS_BY_PROJECT.get(project).array.docsReviewSchema.push(template)
SCHEMAS_BY_PROJECT.get(project).map.docsReviewSchema.set(type, template)
UI.projects.superalgos.spaces.docsSpace.navigateTo(project, 'Review', type)
}
function addBook(project, type) {
let template = {
created: true,
@@ -852,6 +959,32 @@ function newSuperalgosDocsCommmandInterface() {
UI.projects.superalgos.spaces.docsSpace.navigateTo('Superalgos', 'Topic', 'Docs Message - Deleting Succeed')
}
function deleteReview(project, review, type, pageNumber) {
if (SCHEMAS_BY_PROJECT.get(project) === undefined) {
UI.projects.superalgos.spaces.docsSpace.navigateTo('Superalgos', 'Topic', 'Docs Error - Project Does Not Exist', 'Anchor Project Does Not Exist')
return
}
let exist = SCHEMAS_BY_PROJECT.get(project).map.docsReviewSchema.get(type)
if (exist === undefined) {
UI.projects.superalgos.spaces.docsSpace.navigateTo('Superalgos', 'Topic', 'Docs Error - Page Does Not Exist', 'Anchor Page Does Not Exist')
return
} else {
if (exist.pageNumber !== pageNumber) {
UI.projects.superalgos.spaces.docsSpace.navigateTo('Superalgos', 'Topic', 'Docs Error - Page Number Mismatch', 'Anchor Page Number Mismatch')
return
}
if (exist.review !== review) {
UI.projects.superalgos.spaces.docsSpace.navigateTo('Superalgos', 'Topic', 'Docs Error - Review Mismatch', 'Anchor Review Mismatch')
return
}
}
let schemaDocument = SCHEMAS_BY_PROJECT.get(project).map.docsReviewSchema.get(type)
schemaDocument.deleted = true
UI.projects.superalgos.spaces.docsSpace.navigateTo('Superalgos', 'Topic', 'Docs Message - Deleting Succeed')
}
function deleteBook(project, type) {
if (SCHEMAS_BY_PROJECT.get(project) === undefined) {
UI.projects.superalgos.spaces.docsSpace.navigateTo('Superalgos', 'Topic', 'Docs Error - Project Does Not Exist', 'Anchor Project Does Not Exist')
@@ -18,7 +18,7 @@ function newSuperalgosDocSpace() {
currentDocumentBeingRendered: undefined,
previousDocumentBeingRendered: undefined,
currentBookBeingRendered: undefined,
paragraphMap: undefined, // Here we will store a map of paragraphs from the Docs Node, Concept, Topics, Tutorials or Books Schema in order to find it when we need to update them.
paragraphMap: undefined, // Here we will store a map of paragraphs from the Docs Node, Concept, Topics, Tutorials, Reviews or Books Schema in order to find it when we need to update them.
textArea: undefined,
changeLanguage: changeLanguage,
changeActiveBranch: changeActiveBranch,
@@ -49,6 +49,10 @@ function newSuperalgosDocsDocumentPage() {
thisObject.docsSchemaDocument = SCHEMAS_BY_PROJECT.get(UI.projects.superalgos.spaces.docsSpace.currentDocumentBeingRendered.project).map.docsTutorialSchema.get(UI.projects.superalgos.spaces.docsSpace.currentDocumentBeingRendered.type)
break
}
case 'Review': {
thisObject.docsSchemaDocument = SCHEMAS_BY_PROJECT.get(UI.projects.superalgos.spaces.docsSpace.currentDocumentBeingRendered.project).map.docsReviewSchema.get(UI.projects.superalgos.spaces.docsSpace.currentDocumentBeingRendered.type)
break
}
case 'Workspace': {
thisObject.docsSchemaDocument = SCHEMAS_BY_PROJECT.get(UI.projects.superalgos.spaces.docsSpace.currentDocumentBeingRendered.project).map.workspaceSchema.get(UI.projects.superalgos.spaces.docsSpace.currentDocumentBeingRendered.nodeId)
break
@@ -124,6 +128,7 @@ function newSuperalgosDocsDocumentPage() {
let hierarchyImagesArray = []
let orderedTopicPageIndexArray = []
let orderedTutorialPageIndexArray = []
let orderedReviewPageIndexArray = []
let HTML = ''
HTML = HTML + '<section id="docs-search-results-div" class="docs-search-page-container">'
@@ -181,7 +186,7 @@ function newSuperalgosDocsDocumentPage() {
*/
generateTopicPreviousAndNextPageNavigation()
HTML = HTML = HTML + '<div class="docs-topic-index">' // Container for Topic Navigation including buttons, title and index
HTML = HTML + '<div class="docs-topic-index">' // Container for Topic Navigation including buttons, title and index
HTML = HTML + '<h3 class="docs-h3">' + thisObject.docsSchemaDocument.topic + ' &mdash; TOC</h3>'
@@ -189,7 +194,7 @@ function newSuperalgosDocsDocumentPage() {
generateTopicMultiPageIndex()
HTML = HTML = HTML + '</div>' // END Container for Topic Navigation
HTML = HTML + '</div>' // END Container for Topic Navigation
}
if (UI.projects.superalgos.spaces.docsSpace.currentDocumentBeingRendered.category === 'Tutorial') {
@@ -207,7 +212,7 @@ function newSuperalgosDocsDocumentPage() {
generateTutorialPreviousAndNextPageNavigation()
HTML = HTML = HTML + '<div class="docs-topic-index">' // Container for Tutorial Navigation including buttons, title and index
HTML = HTML + '<div class="docs-topic-index">' // Container for Tutorial Navigation including buttons, title and index
HTML = HTML + '<h3 class="docs-h3">' + thisObject.docsSchemaDocument.tutorial + ' &mdash; TOC</h3>'
@@ -215,7 +220,33 @@ function newSuperalgosDocsDocumentPage() {
generateTutorialMultiPageIndex()
HTML = HTML = HTML + '</div>' // END Container for Tutorial Navigation
HTML = HTML + '</div>' // END Container for Tutorial Navigation
}
if (UI.projects.superalgos.spaces.docsSpace.currentDocumentBeingRendered.category === 'Review') {
orderedReviewPageIndexArray = UI.projects.superalgos.utilities.docs.buildOrderedPageIndex(
UI.projects.superalgos.spaces.docsSpace.currentDocumentBeingRendered.project,
'Review',
thisObject.docsSchemaDocument.review
)
/* Review Title
titleLabel = thisObject.docsSchemaDocument.review + ' Review Navigation'
HTML = HTML + '<div id="docs-main-title-div" class="docs-title-table"><div class="docs-table-cell"><h2 class="docs-h2" id="' + UI.projects.superalgos.spaces.docsSpace.currentDocumentBeingRendered.type.toLowerCase().replace(' ', '-') + '" > ' + titleLabel + '</h2></div><div id="projectImageDiv" class="docs-image-container"/></div></div>'
*/
generateReviewPreviousAndNextPageNavigation()
HTML = HTML + '<div class="docs-topic-index">' // Container for Review Navigation including buttons, title and index
HTML = HTML + '<h3 class="docs-h3">' + thisObject.docsSchemaDocument.review + ' &mdash; TOC</h3>'
HTML = HTML + '<p style="margin-bottom: 15px;">You just read page <strong>' + thisObject.docsSchemaDocument.pageNumber + '</strong> of this review collection.</p>'
generateReviewMultiPageIndex()
HTML = HTML + '</div>' // END Container for Review Navigation
}
HTML = HTML + '</div>' // Common Style Container Ends
@@ -258,7 +289,7 @@ function newSuperalgosDocsDocumentPage() {
each node will have an icon. For the rest only if we could load an
image we use a table, otherwise we will render the definitaion as a Summary.
*/
if ((category === 'Topic' || category === 'Tutorial' || category === 'Concept' || category === 'Book') && testElement === undefined) {
if ((category === 'Topic' || category === 'Tutorial' || category === 'Review' || category === 'Concept' || category === 'Book') && testElement === undefined) {
HTML = HTML + '<div id="definition-summary-editable-paragraph" class="docs-summary"><b>Summary:</b> ' + UI.projects.superalgos.utilities.docs.addToolTips(definitionText, UI.projects.superalgos.spaces.docsSpace.currentDocumentBeingRendered.type) + '</div>'
} else {
HTML = HTML + '<div class="docs-definition-table">'
@@ -310,14 +341,11 @@ function newSuperalgosDocsDocumentPage() {
the documents that share the same key thatn the document we are rendering now.
With the info on those picked document we will build the index.
*/
let key = 'auto-generated-index-paragraph-' + autoGeneratedParagraphIndex
let paragraph
for (let i = 0; i < orderedTopicPageIndexArray.length; i++) {
let arrayItem = orderedTopicPageIndexArray[i]
key = 'auto-generated-index-paragraph-' + autoGeneratedParagraphIndex
let key = 'auto-generated-index-paragraph-' + autoGeneratedParagraphIndex
paragraph = {
style: "Title",
text: "" + arrayItem.type + ""
@@ -359,12 +387,11 @@ function newSuperalgosDocsDocumentPage() {
the documents that share the same key thatn the document we are rendering now.
With the info on those picked document we will build the index.
*/
let key = 'auto-generated-index-paragraph-' + autoGeneratedParagraphIndex
let paragraph
for (let i = 0; i < orderedTutorialPageIndexArray.length; i++) {
let arrayItem = orderedTutorialPageIndexArray[i]
key = 'auto-generated-index-paragraph-' + autoGeneratedParagraphIndex
let key = 'auto-generated-index-paragraph-' + autoGeneratedParagraphIndex
paragraph = {
style: "Title",
text: "" + arrayItem.type + ""
@@ -374,6 +401,51 @@ function newSuperalgosDocsDocumentPage() {
}
}
function generateReviewPreviousAndNextPageNavigation() {
let previousPage
let nextPage
for (let i = 0; i < orderedReviewPageIndexArray.length; i++) {
let arrayItem = orderedReviewPageIndexArray[i]
if (thisObject.docsSchemaDocument.type === arrayItem.type) {
previousPage = orderedReviewPageIndexArray[i - 1]
nextPage = orderedReviewPageIndexArray[i + 1]
HTML = HTML + '<div class="docs-topic-navigation"><div>'
if (previousPage !== undefined) {
HTML = HTML + '<span" onClick="UI.projects.superalgos.spaces.docsSpace.navigateTo(\'' + UI.projects.superalgos.spaces.docsSpace.currentDocumentBeingRendered.project + '\', \'' + 'Review' + '\', \'' + previousPage.type.replace(/'/g, 'AMPERSAND') + '\')"><button> Previous </button></span><br/>' + previousPage.type
}
HTML = HTML + '</div><div>'
if (nextPage !== undefined) {
HTML = HTML + '<span" onClick="UI.projects.superalgos.spaces.docsSpace.navigateTo(\'' + UI.projects.superalgos.spaces.docsSpace.currentDocumentBeingRendered.project + '\', \'' + 'Review' + '\', \'' + nextPage.type.replace(/'/g, 'AMPERSAND') + '\')"><button> Next </button></span><br/>' + nextPage.type
}
HTML = HTML + '</div></div>'
return
}
}
}
function generateReviewMultiPageIndex() {
/*
We will go through all the schema docuents array for the current project and pick
the documents that share the same key thatn the document we are rendering now.
With the info on those picked document we will build the index.
*/
let paragraph
for (let i = 0; i < orderedReviewPageIndexArray.length; i++) {
let arrayItem = orderedReviewPageIndexArray[i]
let key = 'auto-generated-index-paragraph-' + autoGeneratedParagraphIndex
paragraph = {
style: "Title",
text: "" + arrayItem.type + ""
}
autoGeneratedParagraphIndex++
HTML = HTML + '<p>' + arrayItem.pageNumber + '. ' + '<a onClick="UI.projects.superalgos.spaces.docsSpace.navigateTo(\'' + UI.projects.superalgos.spaces.docsSpace.currentDocumentBeingRendered.project + '\', \'' + 'Review' + '\', \'' + arrayItem.type.replace(/'/g, 'AMPERSAND') + '\')">' + paragraph.text + '</a></p>'
}
}
function addContent() {
HTML = HTML + '<div id="docs-content">'
if (thisObject.docsSchemaDocument.paragraphs !== undefined) {
@@ -458,11 +530,15 @@ function newSuperalgosDocsDocumentPage() {
includedSchemaDocument = SCHEMAS_BY_PROJECT.get(project).map.docsTutorialSchema.get(type)
break
}
case 'Review': {
includedSchemaDocument = SCHEMAS_BY_PROJECT.get(project).map.docsReviewSchema.get(type)
break
}
case 'Book': {
includedSchemaDocument = SCHEMAS_BY_PROJECT.get(project).map.docsBookSchema.get(type)
break
}
default: return 'Category provided (' + category + ') not valid. Use Node, Concept, Topic, Tutorial or Book instead.'
default: return 'Category provided (' + category + ') not valid. Use Node, Concept, Topic, Review or Book instead.'
}
if (includedSchemaDocument === undefined) {
return category + ' document ' + type + ' not found at project ' + project
@@ -531,8 +607,8 @@ function newSuperalgosDocsDocumentPage() {
return 'Chapter paragraph style Syntax Error. The Project <i>' + project + '</i> could not be found. Check the Docs Chapter Style Syntax. This error message will dissapear as soon as you fix the problem.'
}
if (category !== 'Topic' && category !== 'Tutorial') {
return 'Category must be either Topic or Tutorial. Found: <i>' + category + '</i>'
if (category !== 'Topic' && category !== 'Tutorial' && category !== 'Review') {
return 'Category must be either Topic, Tutorial or Review. Found: <i>' + category + '</i>'
}
switch (category) {
@@ -560,9 +636,21 @@ function newSuperalgosDocsDocumentPage() {
}
break
}
case 'Review': {
orderedReviewPageIndexArray = UI.projects.superalgos.utilities.docs.buildOrderedPageIndex(
UI.projects.superalgos.spaces.docsSpace.currentDocumentBeingRendered.project,
'Review',
chapterName
)
if (orderedReviewPageIndexArray.length === 0) {
return 'Chapter paragraph style Syntax Error. The Review <i>' + chapterName + '</i> could not be found. Check the Docs Chapter Style Syntax. This error message will dissapear as soon as you fix the problem.'
}
break
}
}
HTML = HTML = HTML + '<div class="docs-topic-index">' // Container for Topic Index
HTML = HTML + '<div class="docs-topic-index">' // Container for Topic Index
let key = 'auto-generated-paragraph-' + autoGeneratedParagraphIndex
paragraph = {
@@ -598,9 +686,13 @@ function newSuperalgosDocsDocumentPage() {
generateTutorialMultiPageIndex()
break
}
case 'Review': {
generateReviewMultiPageIndex()
break
}
}
HTML = HTML = HTML + '</div>' // Container for Topic Index
HTML = HTML + '</div>' // Container for Topic Index
}
}
@@ -53,7 +53,7 @@ function newSuperalgosDocsMainSearchPage() {
if (event.key === "Enter" || event.keyCode === 13) {
UI.projects.superalgos.spaces.docsSpace.currentBookBeingRendered = undefined
UI.projects.superalgos.spaces.docsSpace.contextMenu.forceOutClick()
UI.projects.superalgos.spaces.docsSpace.commandInterface.command = element.value
UI.projects.superalgos.spaces.docsSpace.commandInterface.command = element.value.trim()
UI.projects.superalgos.spaces.docsSpace.commandInterface.detectCommands()
}
});
@@ -18,7 +18,7 @@ function newSuperalgosDocsSearchEngine() {
function setUpSearchEngine() {
setUpWorkspaceSchemas()
setUpWorkspaceSchemas()
thisObject.docsIndex = []
for (let j = 0; j < PROJECTS_ARRAY.length; j++) {
@@ -70,6 +70,17 @@ function newSuperalgosDocsSearchEngine() {
indexDocument(documentIndex)
thisObject.docsIndex.push(documentIndex)
}
/* Search in Reviews */
for (let i = 0; i < SCHEMAS_BY_PROJECT.get(project).array.docsReviewSchema.length; i++) {
documentIndex = {
phraseCount: {}, // here we have an object with properties matching it paragraph style, and each property is a map of phrases and their total count.
docsSchemaDocument: SCHEMAS_BY_PROJECT.get(project).array.docsReviewSchema[i],
category: 'Review',
project: project
}
indexDocument(documentIndex)
thisObject.docsIndex.push(documentIndex)
}
/* Search in Books */
for (let i = 0; i < SCHEMAS_BY_PROJECT.get(project).array.docsBookSchema.length; i++) {
documentIndex = {
@@ -114,6 +125,13 @@ function newSuperalgosDocsSearchEngine() {
}
indexParagraph(paragraph)
}
if (documentIndex.docsSchemaDocument.review !== undefined) {
let paragraph = {
style: 'Review',
text: documentIndex.docsSchemaDocument.review
}
indexParagraph(paragraph)
}
if (documentIndex.docsSchemaDocument.type !== undefined) {
let paragraph = {
style: 'Type',
@@ -49,6 +49,11 @@ function newSuperalgosDocsSearchResultsPage() {
documentPoints = documentPoints + thisPhraseCount * 200
}
}
if (documentIndex.docsSchemaDocument.review !== undefined) {
if (key === UI.projects.superalgos.utilities.strings.cleanTextOfCommonWordEndings(documentIndex.docsSchemaDocument.review.toLowerCase())) {
documentPoints = documentPoints + thisPhraseCount * 200
}
}
switch (style) {
case 'topic': {
@@ -59,6 +64,10 @@ function newSuperalgosDocsSearchResultsPage() {
documentPoints = documentPoints + thisPhraseCount * 100
break
}
case 'review': {
documentPoints = documentPoints + thisPhraseCount * 100
break
}
case 'type': {
documentPoints = documentPoints + thisPhraseCount * 50
break
@@ -194,7 +203,7 @@ function newSuperalgosDocsSearchResultsPage() {
}
function buildHTML() {
const tabs = ['All', 'Nodes', 'Concepts', 'Topics', 'Tutorials', 'Books', 'Workspace']
const tabs = ['All', 'Nodes', 'Concepts', 'Topics', 'Tutorials', 'Reviews', 'Books', 'Workspace']
let HTML = ''
HTML = HTML + '<section id="docs-search-results-div" class="docs-search-page-container">'
HTML = HTML + UI.projects.superalgos.spaces.docsSpace.mainSearchPage.addSearchHeader()
@@ -265,6 +274,10 @@ function newSuperalgosDocsSearchResultsPage() {
mainLink = result.documentIndex.docsSchemaDocument.tutorial + ' - Page ' + result.documentIndex.docsSchemaDocument.pageNumber + ' - ' + result.documentIndex.docsSchemaDocument.type
break
}
case 'Review': {
mainLink = result.documentIndex.docsSchemaDocument.review + ' - Page ' + result.documentIndex.docsSchemaDocument.pageNumber + ' - ' + result.documentIndex.docsSchemaDocument.type
break
}
default: {
mainLink = result.documentIndex.docsSchemaDocument.type
}
+14
View File
@@ -40,6 +40,10 @@ function newSuperalgosUtilitiesDocs() {
schemaArray = SCHEMAS_BY_PROJECT.get(project).array.docsTutorialSchema
break
}
case 'Review': {
schemaArray = SCHEMAS_BY_PROJECT.get(project).array.docsReviewSchema
break
}
}
for (let i = 0; i < schemaArray.length; i++) {
@@ -54,6 +58,10 @@ function newSuperalgosUtilitiesDocs() {
if (arrayItem.tutorial !== query) { continue }
break
}
case 'Review': {
if (arrayItem.review !== query) { continue }
break
}
}
let itemAdded = false
@@ -563,6 +571,11 @@ function newSuperalgosUtilitiesDocs() {
found = true
break
}
docsSchemaDocument = SCHEMAS_BY_PROJECT.get(project).map.docsReviewSchema.get(type)
if (docsSchemaDocument !== undefined) {
found = true
break
}
docsSchemaDocument = SCHEMAS_BY_PROJECT.get(project).map.docsBookSchema.get(type)
if (docsSchemaDocument !== undefined) {
found = true
@@ -645,6 +658,7 @@ function newSuperalgosUtilitiesDocs() {
searchInSchema(SCHEMAS_BY_PROJECT.get(project).map.docsConceptSchema)
searchInSchema(SCHEMAS_BY_PROJECT.get(project).map.docsTopicSchema)
searchInSchema(SCHEMAS_BY_PROJECT.get(project).map.docsTutorialSchema)
searchInSchema(SCHEMAS_BY_PROJECT.get(project).map.docsReviewSchema)
searchInSchema(SCHEMAS_BY_PROJECT.get(project).map.docsBookSchema)
function searchInSchema(docSchema) {
+22
View File
@@ -44,6 +44,7 @@ function newAppPostLoader() {
docsConceptSchema: [],
docsTopicSchema: [],
docsTutorialSchema: [],
docsReviewSchema: [],
docsBookSchema: []
},
map: {
@@ -52,6 +53,7 @@ function newAppPostLoader() {
docsConceptSchema: new Map(),
docsTopicSchema: new Map(),
docsTutorialSchema: new Map(),
docsReviewSchema: new Map(),
docsBookSchema: new Map()
}
}
@@ -157,6 +159,26 @@ function newAppPostLoader() {
if (webServerResponses === totalWebServerCalls) { startCanvas() }
}
totalWebServerCalls++
httpRequest(undefined, 'Schema/' + project + '/DocsReviewSchema', onResponseReviewSchema)
function onResponseReviewSchema(err, schema) {
try {
schemas.array.docsReviewSchema = JSON.parse(schema)
for (let j = 0; j < schemas.array.docsReviewSchema.length; j++) {
let schemaDocument = schemas.array.docsReviewSchema[j]
let key = schemaDocument.type
schemas.map.docsReviewSchema.set(key, schemaDocument)
}
} catch (err) {
console.log(err.stack)
}
webServerResponses++
if (webServerResponses === totalWebServerCalls) { startCanvas() }
}
totalWebServerCalls++
httpRequest(undefined, 'Schema/' + project + '/DocsBookSchema', onResponseBookSchema)