From 9c5ba03e04851a4322a3826b81149eaca5169e59 Mon Sep 17 00:00:00 2001 From: Gauntlet173 Date: Tue, 9 May 2023 15:23:44 -0600 Subject: [PATCH 1/4] use new location of xml util --- blawx/static/blawx/blawx-blocks.js | 2 +- blawx/static/blawx/buttons.js | 10 +++--- blawx/static/blawx/drawers.js | 54 +++++++++++++++--------------- blawx/static/blawx/import.js | 2 +- 4 files changed, 34 insertions(+), 34 deletions(-) diff --git a/blawx/static/blawx/blawx-blocks.js b/blawx/static/blawx/blawx-blocks.js index 18fca2d3..93409b45 100644 --- a/blawx/static/blawx/blawx-blocks.js +++ b/blawx/static/blawx/blawx-blocks.js @@ -5461,7 +5461,7 @@ function getKnownCategories() { // Go through the blocks in the workspace. // If the block is an object declaration, add the relevant block to the xml if (all_workspaces[w].xml_content) { - var domObject = Blockly.Xml.textToDom(all_workspaces[w].xml_content); + var domObject = Blockly.utils.xml.textToDom(all_workspaces[w].xml_content); var tempWorkspace = new Blockly.Workspace(); Blockly.Xml.domToWorkspace(domObject, tempWorkspace); var blockList = tempWorkspace.getAllBlocks(); diff --git a/blawx/static/blawx/buttons.js b/blawx/static/blawx/buttons.js index dc515bae..bf7c1a0f 100644 --- a/blawx/static/blawx/buttons.js +++ b/blawx/static/blawx/buttons.js @@ -381,7 +381,7 @@ function loadBlocksFile(element) { var file = element.files[0]; var fr = new FileReader(); fr.onload = function (event) { - var xml = Blockly.Xml.textToDom(event.target.result); + var xml = Blockly.utils.xml.textToDom(event.target.result); demoWorkspace.clear(); Blockly.Xml.domToWorkspace(xml, demoWorkspace); }; @@ -397,7 +397,7 @@ try { var file = element.files[0]; var fr = new FileReader(); fr.onload = function (event) { - var xml = Blockly.Xml.textToDom(event.target.result); + var xml = Blockly.utils.xml.textToDom(event.target.result); importWorkspace.clear(); Blockly.Xml.domToWorkspace(xml, importWorkspace); }; @@ -418,7 +418,7 @@ getExample = function(example_pk){ xhttp.onreadystatechange = function() { output_object = JSON.parse(this.responseText); demoWorkspace.clear(); - xml = Blockly.Xml.textToDom(output_object.xml_content); + xml = Blockly.utils.xml.textToDom(output_object.xml_content); Blockly.Xml.domToWorkspace(xml, demoWorkspace); } xhttp.send(); @@ -441,7 +441,7 @@ load_section_workspace = function(ruledoc_id,workspace_id) { if (this.responseText) { output_object = JSON.parse(this.responseText); if (output_object.xml_content) { - xml = Blockly.Xml.textToDom(output_object.xml_content); + xml = Blockly.utils.xml.textToDom(output_object.xml_content); Blockly.Xml.domToWorkspace(xml, demoWorkspace); } } @@ -467,7 +467,7 @@ load_test_workspace = function(ruledoc_id,test_name) { if (this.responseText) { output_object = JSON.parse(this.responseText); if (output_object.xml_content) { - xml = Blockly.Xml.textToDom(output_object.xml_content); + xml = Blockly.utils.xml.textToDom(output_object.xml_content); Blockly.Xml.domToWorkspace(xml, demoWorkspace); } } diff --git a/blawx/static/blawx/drawers.js b/blawx/static/blawx/drawers.js index e5747e81..69d28a1a 100644 --- a/blawx/static/blawx/drawers.js +++ b/blawx/static/blawx/drawers.js @@ -9,7 +9,7 @@ knownAttributesCallback = function(workspace) { // Go through the blocks in the workspace. // If the block is an object declaration, add the relevant block to the xml if (all_workspaces[w].xml_content) { - var domObject = Blockly.Xml.textToDom(all_workspaces[w].xml_content); + var domObject = Blockly.utils.xml.textToDom(all_workspaces[w].xml_content); var tempWorkspace = new Blockly.Workspace(); Blockly.Xml.domToWorkspace(domObject, tempWorkspace); var blockList = tempWorkspace.getAllBlocks(); @@ -29,7 +29,7 @@ knownAttributesCallback = function(workspace) { } else { // all other attribute types use a binary attribute selector var blockText = "" + text_prefix + "" + text_infix + "" + text_postfix + ""; } - var block = Blockly.Xml.textToDom(blockText).firstChild; + var block = Blockly.utils.xml.textToDom(blockText).firstChild; // need to check for repeatedly adding the same block. xmlList.push(block); } @@ -53,7 +53,7 @@ knownAttributesCallback = function(workspace) { } else { // all other attribute types use a binary attribute selector var blockText = "" + text_prefix + "" + text_infix + "" + text_postfix + ""; } - var block = Blockly.Xml.textToDom(blockText).firstChild; + var block = Blockly.utils.xml.textToDom(blockText).firstChild; // need to check for repeatedly adding the same block. xmlList.push(block); } @@ -72,7 +72,7 @@ knownRelationshipsCallback = function(workspace) { // Go through the blocks in the workspace. // If the block is a relationship declaration, add the relevant block to the xml if (all_workspaces[w].xml_content) { - var domObject = Blockly.Xml.textToDom(all_workspaces[w].xml_content); + var domObject = Blockly.utils.xml.textToDom(all_workspaces[w].xml_content); var tempWorkspace = new Blockly.Workspace(); Blockly.Xml.domToWorkspace(domObject, tempWorkspace); var blockList = tempWorkspace.getAllBlocks(); @@ -102,7 +102,7 @@ knownRelationshipsCallback = function(workspace) { } blockText += "" + blockList[i].getFieldValue("postfix") + ""; blockText += ""; - var block = Blockly.Xml.textToDom(blockText).firstChild; + var block = Blockly.utils.xml.textToDom(blockText).firstChild; // need to check for repeatedly adding the same block. xmlList.push(block); } @@ -122,7 +122,7 @@ knownObjectsCallback = function(workspace) { // Go through the blocks in the workspace. // If the block is an object declaration, add the relevant block to the xml if (all_workspaces[w].xml_content) { - var domObject = Blockly.Xml.textToDom(all_workspaces[w].xml_content); + var domObject = Blockly.utils.xml.textToDom(all_workspaces[w].xml_content); var tempWorkspace = new Blockly.Workspace(); Blockly.Xml.domToWorkspace(domObject, tempWorkspace); var blockList = tempWorkspace.getAllBlocks(); @@ -131,7 +131,7 @@ knownObjectsCallback = function(workspace) { // Get the name of the entity, insert a block of that type, var object_name = blockList[i].getFieldValue('object_name'); var blockText = "" + object_name+"" - var block = Blockly.Xml.textToDom(blockText).firstChild; + var block = Blockly.utils.xml.textToDom(blockText).firstChild; // Need to add check to make sure I'm not repeatedly adding the same block. xmlList.push(block); } @@ -139,7 +139,7 @@ knownObjectsCallback = function(workspace) { if (blockList[i].type == "data_dictionary") { var entity_name = blockList[i].getFieldValue('dictionary_name'); var blockText = "" + entity_name+"" - var block = Blockly.Xml.textToDom(blockText).firstChild; + var block = Blockly.utils.xml.textToDom(blockText).firstChild; // Need to add check to make sure I'm not repeatedly adding the same block. xmlList.push(block); } @@ -153,7 +153,7 @@ knownObjectsCallback = function(workspace) { // Get the name of the entity, insert a block of that type, var object_name = blockList[i].getFieldValue('object_name'); var blockText = "" + object_name+"" - var block = Blockly.Xml.textToDom(blockText).firstChild; + var block = Blockly.utils.xml.textToDom(blockText).firstChild; // Need to add check to make sure I'm not repeatedly adding the same block. xmlList.push(block); } @@ -161,7 +161,7 @@ knownObjectsCallback = function(workspace) { if (blockList[i].type == "data_dictionary") { var entity_name = blockList[i].getFieldValue('dictionary_name'); var blockText = "" + entity_name+"" - var block = Blockly.Xml.textToDom(blockText).firstChild; + var block = Blockly.utils.xml.textToDom(blockText).firstChild; // Need to add check to make sure I'm not repeatedly adding the same block. xmlList.push(block); } @@ -182,7 +182,7 @@ knownCategoriesCallback = function(workspace) { // Go through the blocks in the workspace. // If the block is an object declaration, add the relevant block to the xml if (all_workspaces[w].xml_content) { - var domObject = Blockly.Xml.textToDom(all_workspaces[w].xml_content); + var domObject = Blockly.utils.xml.textToDom(all_workspaces[w].xml_content); var tempWorkspace = new Blockly.Workspace(); Blockly.Xml.domToWorkspace(domObject, tempWorkspace); var blockList = tempWorkspace.getAllBlocks(); @@ -192,7 +192,7 @@ knownCategoriesCallback = function(workspace) { // Get the name of the entity, insert a block of that type, var category_name = blockList[i].getFieldValue('category_name'); var blockText = "" + category_name + "" - var block = Blockly.Xml.textToDom(blockText).firstChild; + var block = Blockly.utils.xml.textToDom(blockText).firstChild; // Need to add check to make sure I'm not repeatedly adding the same block. xmlList.push(block); } @@ -207,7 +207,7 @@ knownCategoriesCallback = function(workspace) { // Get the name of the entity, insert a block of that type, var category_name = blockList[i].getFieldValue('category_name'); var blockText = "" + category_name + "" - var block = Blockly.Xml.textToDom(blockText).firstChild; + var block = Blockly.utils.xml.textToDom(blockText).firstChild; // Need to add check to make sure I'm not repeatedly adding the same block. xmlList.push(block); } @@ -229,7 +229,7 @@ newObjectCallback = function(workspace) { // Go through the blocks in the workspace. // If the block is an object declaration, add the relevant block to the xml if (all_workspaces[w].xml_content) { - var domObject = Blockly.Xml.textToDom(all_workspaces[w].xml_content); + var domObject = Blockly.utils.xml.textToDom(all_workspaces[w].xml_content); var tempWorkspace = new Blockly.Workspace(); Blockly.Xml.domToWorkspace(domObject, tempWorkspace); var blockList = tempWorkspace.getAllBlocks(); @@ -240,7 +240,7 @@ newObjectCallback = function(workspace) { var text_prefix = blockList[i].getFieldValue('prefix'); var text_postfix = blockList[i].getFieldValue('postfix'); var blockText = "" + text_prefix + "" + text_postfix + ""; - var block = Blockly.Xml.textToDom(blockText).firstChild; + var block = Blockly.utils.xml.textToDom(blockText).firstChild; // Need to add check to make sure I'm not repeatedly adding the same block. xmlList.push(block); } @@ -256,7 +256,7 @@ newObjectCallback = function(workspace) { var text_prefix = blockList[i].getFieldValue('prefix'); var text_postfix = blockList[i].getFieldValue('postfix'); var blockText = "" + text_prefix + "" + text_postfix + ""; - var block = Blockly.Xml.textToDom(blockText).firstChild; + var block = Blockly.utils.xml.textToDom(blockText).firstChild; // Need to add check to make sure I'm not repeatedly adding the same block. xmlList.push(block); } @@ -265,11 +265,11 @@ newObjectCallback = function(workspace) { } var objectEqualityBlockText = ''; - var objectEqualityBlock = Blockly.Xml.textToDom(objectEqualityBlockText).firstChild; + var objectEqualityBlock = Blockly.utils.xml.textToDom(objectEqualityBlockText).firstChild; var objectDisequalityBlockText = ''; - var objectDisequalityBlock = Blockly.Xml.textToDom(objectDisequalityBlockText).firstChild; + var objectDisequalityBlock = Blockly.utils.xml.textToDom(objectDisequalityBlockText).firstChild; var objectCategoryBlockText = ''; - var objectCategoryBlock = Blockly.Xml.textToDom(objectCategoryBlockText).firstChild; + var objectCategoryBlock = Blockly.utils.xml.textToDom(objectCategoryBlockText).firstChild; xmlList.push(objectEqualityBlock); xmlList.push(objectDisequalityBlock); xmlList.push(objectCategoryBlock); @@ -310,7 +310,7 @@ knownRulesCallback = function(workspace) { // var blocktypes = ['scope'] // for (var i = 0; i < blocktypes.length; i++) { // var blocktext = ''; - // var block = Blockly.Xml.textToDom(blocktext).firstChild; + // var block = Blockly.utils.xml.textToDom(blocktext).firstChild; // xmlList.push(block); // } @@ -339,7 +339,7 @@ knownRulesCallback = function(workspace) { blocktext += "" blocktext += '' blocktext += "" - var block = Blockly.Xml.textToDom(blocktext).firstChild; + var block = Blockly.utils.xml.textToDom(blocktext).firstChild; xmlList.push(block); // if (sections[i].attributes.eid.value.startsWith('sec')) { // var short_ref = sections[i].attributes.eid.value; @@ -348,7 +348,7 @@ knownRulesCallback = function(workspace) { // short_ref = short_ref.replace("__para_","."); // short_ref = short_ref.replace("__subpara_","."); // var blocktext = '' + abbreviation + " " + short_ref + ''; - // var block = Blockly.Xml.textToDom(blocktext).firstChild; + // var block = Blockly.utils.xml.textToDom(blocktext).firstChild; // xmlList.push(block); // // console.log("Pushing " + blocktext); // } @@ -365,7 +365,7 @@ primaryDrawerCallback = function(workspace) { var xmlList = []; for (var i = 0; i < blocktypes.length; i++) { var blocktext = ''; - var block = Blockly.Xml.textToDom(blocktext).firstChild; + var block = Blockly.utils.xml.textToDom(blocktext).firstChild; xmlList.push(block); } // console.log("Creating drawer using " + blocktext) @@ -385,13 +385,13 @@ primaryDrawerCallback = function(workspace) { \ \ '; - var queryblock = Blockly.Xml.textToDom(querytext).firstChild; + var queryblock = Blockly.utils.xml.textToDom(querytext).firstChild; xmlList.push(queryblock) } var blocktypes = ['unattributed_constraint','query'] for (var i = 0; i < blocktypes.length; i++) { var blocktext = ''; - var block = Blockly.Xml.textToDom(blocktext).firstChild; + var block = Blockly.utils.xml.textToDom(blocktext).firstChild; xmlList.push(block); } // var querytext = '\ @@ -399,12 +399,12 @@ primaryDrawerCallback = function(workspace) { // \ // \ // '; -// var queryblock = Blockly.Xml.textToDom(querytext).firstChild; +// var queryblock = Blockly.utils.xml.textToDom(querytext).firstChild; // xmlList.push(queryblock) var blocktypes = ['assume','json_textfield'] for (var i = 0; i < blocktypes.length; i++) { var blocktext = ''; - var block = Blockly.Xml.textToDom(blocktext).firstChild; + var block = Blockly.utils.xml.textToDom(blocktext).firstChild; xmlList.push(block); } return xmlList diff --git a/blawx/static/blawx/import.js b/blawx/static/blawx/import.js index c6d40439..2cf8e898 100644 --- a/blawx/static/blawx/import.js +++ b/blawx/static/blawx/import.js @@ -18,7 +18,7 @@ function createImportListener(event) { request.send(null); request.onreadystatechange = function () { if (request.readyState === 4 && request.status === 200) { - var xml = Blockly.Xml.textToDom(request.responseText); + var xml = Blockly.utils.xml.textToDom(request.responseText); Blockly.Xml.domToWorkspace(xml, importSpace); } } From df14f230e76dd78b822bcf41e09d5f44b0971720 Mon Sep 17 00:00:00 2001 From: Gauntlet173 Date: Tue, 9 May 2023 17:28:25 -0600 Subject: [PATCH 2/4] fix favico issue --- blawx/templates/base2.html | 1 + 1 file changed, 1 insertion(+) diff --git a/blawx/templates/base2.html b/blawx/templates/base2.html index 417b1659..c749e324 100644 --- a/blawx/templates/base2.html +++ b/blawx/templates/base2.html @@ -17,6 +17,7 @@ + {% block head_extras %} {% endblock head_extras %} From 386b1541d03014e5df6049e3076c254eb7d6a651 Mon Sep 17 00:00:00 2001 From: Gauntlet173 Date: Tue, 9 May 2023 17:28:43 -0600 Subject: [PATCH 3/4] fix JSON errors in test editor --- blawx/static/blawx/buttons.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/blawx/static/blawx/buttons.js b/blawx/static/blawx/buttons.js index bf7c1a0f..79e19246 100644 --- a/blawx/static/blawx/buttons.js +++ b/blawx/static/blawx/buttons.js @@ -221,7 +221,8 @@ runCode = function(button) { run_xhttp.open("POST", "run/", true); run_xhttp.setRequestHeader('Content-type', 'application/json'); run_xhttp.setRequestHeader('X-CSRFToken', csrftoken); - run_xhttp.onreadystatechange = function() { + run_xhttp.onload = function() { + //console.log("Response Length: " + this.responseText.length) output_object = JSON.parse(this.responseText); // console.log(output_object); if (output_object.error) { From eba385eb7fd7af2a755073d49482aea683daf6b7 Mon Sep 17 00:00:00 2001 From: Gauntlet173 Date: Tue, 9 May 2023 17:32:53 -0600 Subject: [PATCH 4/4] update changelog and version --- CHANGELOG.md | 7 +++++++ blawx/settings.py | 2 +- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 4ff37400..3f78996f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,13 @@ As of v0.2-alpha, this project is attempting to adhere to [Semantic Versioning]( While alpha, however, any version may include breaking changes that may not be specifically noted as such, and breaking changes will not necessarily result in changes to the main version number. +## [v1.6.13-alpha](https://github.com/Lexpedite/blawx/releases/tag/v1.6.13-alpha) 2023-05-09 + +### Fixes +* Favicon works properly +* JSON errors no longer occur in test editor +* Blockly warnings no longer occur in test editor and code editor + ## [v1.6.12-alpha](https://github.com/Lexpedite/blawx/releases/tag/v1.6.12-alpha) 2023-05-09 This release chances how code is generated for projects. To upgrade existing files you may need to diff --git a/blawx/settings.py b/blawx/settings.py index bd2de663..a0d805d3 100644 --- a/blawx/settings.py +++ b/blawx/settings.py @@ -13,7 +13,7 @@ from pathlib import Path # For adding a version identifier -BLAWX_VERSION = "v1.6.12-alpha" +BLAWX_VERSION = "v1.6.13-alpha" # Build paths inside the project like this: BASE_DIR / 'subdir'.