From 0aa5488d44d5e1294cf723a0f3dd950dc551767e Mon Sep 17 00:00:00 2001 From: Joe Wicentowski Date: Sun, 1 May 2022 21:33:47 -0400 Subject: [PATCH] Adopt community XQuery file extension convention - main modules: .xq - library modules: .xqm --- controller.xql => controller.xq | 16 ++++++++-------- expath-pkg.xml.tmpl | 2 +- index.html.tmpl | 2 +- modules/{apply-config.xql => apply-config.xq} | 0 modules/{collections.xql => collections.xq} | 0 modules/{compile.xql => compile.xq} | 0 modules/{dbutils.xql => dbutils.xqm} | 0 modules/{debuger.xql => debuger.xq} | 2 +- modules/{deployment.xql => deployment.xq} | 6 +++--- modules/{docs.xql => docs.xq} | 0 modules/{error-handler.xql => error-handler.xq} | 0 modules/{find.xql => find.xq} | 0 modules/{get-template.xql => get-template.xq} | 0 modules/{git.xql => git.xq} | 2 +- modules/{load.xql => load.xq} | 0 modules/{outline.xql => outline.xq} | 0 modules/{run-test.xql => run-test.xq} | 3 +-- modules/{search.xql => search.xq} | 2 +- modules/{session.xql => session.xq} | 4 ++-- modules/{store.xql => store.xq} | 0 modules/{synchronize.xql => synchronize.xq} | 2 +- modules/{tmpl.xql => tmpl.xqm} | 0 modules/{upload.xql => upload.xq} | 0 modules/{util.xql => util.xqm} | 0 modules/{validate-xml.xql => validate-xml.xq} | 0 modules/{view.xql => view.xq} | 0 pre-install.xql => pre-install.xq | 0 repo.xml | 2 +- src/debuger.js | 2 +- src/deployment.js | 10 +++++----- src/directory.js | 2 +- src/eXide.js | 10 +++++----- src/editor.js | 2 +- src/resources.js | 16 ++++++++-------- src/xml-helper.js | 6 +++--- src/xquery-helper.js | 10 +++++----- 36 files changed, 50 insertions(+), 51 deletions(-) rename controller.xql => controller.xq (96%) rename modules/{apply-config.xql => apply-config.xq} (100%) rename modules/{collections.xql => collections.xq} (100%) rename modules/{compile.xql => compile.xq} (100%) rename modules/{dbutils.xql => dbutils.xqm} (100%) rename modules/{debuger.xql => debuger.xq} (99%) rename modules/{deployment.xql => deployment.xq} (99%) rename modules/{docs.xql => docs.xq} (100%) rename modules/{error-handler.xql => error-handler.xq} (100%) rename modules/{find.xql => find.xq} (100%) rename modules/{get-template.xql => get-template.xq} (100%) rename modules/{git.xql => git.xq} (98%) rename modules/{load.xql => load.xq} (100%) rename modules/{outline.xql => outline.xq} (100%) rename modules/{run-test.xql => run-test.xq} (95%) rename modules/{search.xql => search.xq} (99%) rename modules/{session.xql => session.xq} (97%) rename modules/{store.xql => store.xq} (100%) rename modules/{synchronize.xql => synchronize.xq} (98%) rename modules/{tmpl.xql => tmpl.xqm} (100%) rename modules/{upload.xql => upload.xq} (100%) rename modules/{util.xql => util.xqm} (100%) rename modules/{validate-xml.xql => validate-xml.xq} (100%) rename modules/{view.xql => view.xq} (100%) rename pre-install.xql => pre-install.xq (100%) diff --git a/controller.xql b/controller.xq similarity index 96% rename from controller.xql rename to controller.xq index a5f508fb..962a04d2 100644 --- a/controller.xql +++ b/controller.xq @@ -120,7 +120,7 @@ else if (starts-with($exist:path, "/store/")) then let $resource := substring-after($exist:path, "/store") return - + {$login("org.exist.login", (), false())} @@ -130,7 +130,7 @@ else if (starts-with($exist:path, "/check/")) then let $resource := substring-after($exist:path, "/validate") return - + {$login("org.exist.login", (), false())} @@ -140,7 +140,7 @@ else if ($exist:resource = "index.html") then if (local:user-allowed()) then - + @@ -187,7 +187,7 @@ else if ($exist:resource eq 'execute') then - + - + {$login("org.exist.login", (), false())} @@ -230,7 +230,7 @@ else if ($exist:resource eq "outline") then return - + {$login("org.exist.login", (), false())} @@ -240,13 +240,13 @@ else if ($exist:resource eq "outline") then else if ($exist:resource eq "debug") then - + {$login("org.exist.login", (), false())} -else if (ends-with($exist:path, ".xql")) then +else if (ends-with($exist:path, ".xq")) then {$login("org.exist.login", (), false())} diff --git a/expath-pkg.xml.tmpl b/expath-pkg.xml.tmpl index fd8b308a..afa02b21 100644 --- a/expath-pkg.xml.tmpl +++ b/expath-pkg.xml.tmpl @@ -1,5 +1,5 @@ eXide - XQuery IDE - + diff --git a/index.html.tmpl b/index.html.tmpl index 422ec1d4..2a8388b9 100755 --- a/index.html.tmpl +++ b/index.html.tmpl @@ -452,7 +452,7 @@

Drop files here or click on the button below to upload them to the selected collection. Maximum file size is 100MB.

-
+
diff --git a/modules/apply-config.xql b/modules/apply-config.xq similarity index 100% rename from modules/apply-config.xql rename to modules/apply-config.xq diff --git a/modules/collections.xql b/modules/collections.xq similarity index 100% rename from modules/collections.xql rename to modules/collections.xq diff --git a/modules/compile.xql b/modules/compile.xq similarity index 100% rename from modules/compile.xql rename to modules/compile.xq diff --git a/modules/dbutils.xql b/modules/dbutils.xqm similarity index 100% rename from modules/dbutils.xql rename to modules/dbutils.xqm diff --git a/modules/debuger.xql b/modules/debuger.xq similarity index 99% rename from modules/debuger.xql rename to modules/debuger.xq index 29863bc8..550b0e2e 100755 --- a/modules/debuger.xql +++ b/modules/debuger.xq @@ -18,7 +18,7 @@ :) xquery version "3.0"; -import module namespace sandbox="http://exist-db.org/xquery/sandbox" at "session.xql"; +import module namespace sandbox="http://exist-db.org/xquery/sandbox" at "session.xq"; declare namespace json="http://json.org/"; declare namespace dbg="urn:debugger_protocol_v1"; diff --git a/modules/deployment.xql b/modules/deployment.xq similarity index 99% rename from modules/deployment.xql rename to modules/deployment.xq index a8296575..901943a8 100644 --- a/modules/deployment.xql +++ b/modules/deployment.xq @@ -18,9 +18,9 @@ :) xquery version "3.1"; -import module namespace apputil="http://exist-db.org/apps/eXide/apputil" at "util.xql"; -import module namespace tmpl="http://exist-db.org/xquery/template" at "tmpl.xql"; -import module namespace dbutil="http://exist-db.org/xquery/dbutil" at "dbutils.xql"; +import module namespace apputil="http://exist-db.org/apps/eXide/apputil" at "util.xqm"; +import module namespace tmpl="http://exist-db.org/xquery/template" at "tmpl.xqm"; +import module namespace dbutil="http://exist-db.org/xquery/dbutil" at "dbutils.xqm"; (:~ Edit the expath and repo app descriptors. diff --git a/modules/docs.xql b/modules/docs.xq similarity index 100% rename from modules/docs.xql rename to modules/docs.xq diff --git a/modules/error-handler.xql b/modules/error-handler.xq similarity index 100% rename from modules/error-handler.xql rename to modules/error-handler.xq diff --git a/modules/find.xql b/modules/find.xq similarity index 100% rename from modules/find.xql rename to modules/find.xq diff --git a/modules/get-template.xql b/modules/get-template.xq similarity index 100% rename from modules/get-template.xql rename to modules/get-template.xq diff --git a/modules/git.xql b/modules/git.xq similarity index 98% rename from modules/git.xql rename to modules/git.xq index 66b967de..e230e1d4 100644 --- a/modules/git.xql +++ b/modules/git.xq @@ -1,7 +1,7 @@ xquery version "3.0"; import module namespace process="http://exist-db.org/xquery/process" at "java:org.exist.xquery.modules.process.ProcessModule"; -import module namespace apputil="http://exist-db.org/apps/eXide/apputil" at "util.xql"; +import module namespace apputil="http://exist-db.org/apps/eXide/apputil" at "util.xqm"; declare namespace git="http://exist-db.org/eXide/git"; diff --git a/modules/load.xql b/modules/load.xq similarity index 100% rename from modules/load.xql rename to modules/load.xq diff --git a/modules/outline.xql b/modules/outline.xq similarity index 100% rename from modules/outline.xql rename to modules/outline.xq diff --git a/modules/run-test.xql b/modules/run-test.xq similarity index 95% rename from modules/run-test.xql rename to modules/run-test.xq index d6486480..05f713e8 100644 --- a/modules/run-test.xql +++ b/modules/run-test.xq @@ -1,7 +1,6 @@ xquery version "3.0"; -import module namespace test="http://exist-db.org/xquery/xqsuite" -at "resource:org/exist/xquery/lib/xqsuite/xqsuite.xql"; +import module namespace test="http://exist-db.org/xquery/xqsuite" at "resource:org/exist/xquery/lib/xqsuite/xqsuite.xq"; declare namespace output = "http://www.w3.org/2010/xslt-xquery-serialization"; diff --git a/modules/search.xql b/modules/search.xq similarity index 99% rename from modules/search.xql rename to modules/search.xq index 78cab032..7fec3dec 100644 --- a/modules/search.xql +++ b/modules/search.xq @@ -1,7 +1,7 @@ xquery version "3.1"; -import module namespace dbutil="http://exist-db.org/xquery/dbutil" at "dbutils.xql"; +import module namespace dbutil="http://exist-db.org/xquery/dbutil" at "dbutils.xqm"; declare namespace output="http://www.w3.org/2010/xslt-xquery-serialization"; diff --git a/modules/session.xql b/modules/session.xq similarity index 97% rename from modules/session.xql rename to modules/session.xq index ea34d149..e6d8e5e3 100644 --- a/modules/session.xql +++ b/modules/session.xq @@ -96,10 +96,10 @@ declare function local:store-in-session($results as item()*) as element(result) the results into the HTTP session for subsequent retrieval via individual requests to this endpoint with a "num" parameter. - Error reporting must take into account how controller.xql handles + Error reporting must take into account how controller.xq handles errors thrown by XQueryServlet. From https://exist-db.org/exist/apps/doc/urlrewrite#xq-servlet: - > Since controller.xql sets xquery.report-errors to "yes", an error + > Since controller.xq sets xquery.report-errors to "yes", an error > in the XQuery will not result in an HTTP error. Instead, the string > message of the error is enclosed in an element which is > then written to the response stream. The HTTP status is not changed. diff --git a/modules/store.xql b/modules/store.xq similarity index 100% rename from modules/store.xql rename to modules/store.xq diff --git a/modules/synchronize.xql b/modules/synchronize.xq similarity index 98% rename from modules/synchronize.xql rename to modules/synchronize.xq index 9f6dfeac..dbed911d 100644 --- a/modules/synchronize.xql +++ b/modules/synchronize.xq @@ -19,7 +19,7 @@ xquery version "1.0"; import module namespace file="http://exist-db.org/xquery/file" at "java:org.exist.xquery.modules.file.FileModule"; -import module namespace apputil="http://exist-db.org/apps/eXide/apputil" at "util.xql"; +import module namespace apputil="http://exist-db.org/apps/eXide/apputil" at "util.xqm"; declare function local:format-output($output) { if ($output//file:update) then diff --git a/modules/tmpl.xql b/modules/tmpl.xqm similarity index 100% rename from modules/tmpl.xql rename to modules/tmpl.xqm diff --git a/modules/upload.xql b/modules/upload.xq similarity index 100% rename from modules/upload.xql rename to modules/upload.xq diff --git a/modules/util.xql b/modules/util.xqm similarity index 100% rename from modules/util.xql rename to modules/util.xqm diff --git a/modules/validate-xml.xql b/modules/validate-xml.xq similarity index 100% rename from modules/validate-xml.xql rename to modules/validate-xml.xq diff --git a/modules/view.xql b/modules/view.xq similarity index 100% rename from modules/view.xql rename to modules/view.xq diff --git a/pre-install.xql b/pre-install.xq similarity index 100% rename from pre-install.xql rename to pre-install.xq diff --git a/repo.xml b/repo.xml index 507a5f7f..b8b93abb 100644 --- a/repo.xml +++ b/repo.xml @@ -8,7 +8,7 @@ true application eXide - pre-install.xql + pre-install.xq diff --git a/src/debuger.js b/src/debuger.js index 61b6ea06..61497982 100755 --- a/src/debuger.js +++ b/src/debuger.js @@ -57,7 +57,7 @@ eXide.XQueryDebuger = (function () { params.resource = this.existURL + this.doc.getPath(); $.ajax({ type: "POST", - url: "modules/debuger.xql", + url: "modules/debuger.xq", data: params, dataType: "json", success: function (data) { diff --git a/src/deployment.js b/src/deployment.js index 32d70bee..9cec596e 100644 --- a/src/deployment.js +++ b/src/deployment.js @@ -35,7 +35,7 @@ eXide.edit.Projects = (function(oop) { Constr.prototype.getProject = function (collection, callback) { var $this = this; - $.getJSON("modules/deployment.xql", { info: collection }, function (data) { + $.getJSON("modules/deployment.xq", { info: collection }, function (data) { if (!data) { if (typeof callback == "function") { callback(null); @@ -144,7 +144,7 @@ eXide.edit.PackageEditor = (function () { var params = $this.syncDialog.find("form").serialize(); $("#synchronize-report").text("Synchronization in progress ..."); - $("#synchronize-report").load("modules/synchronize.xql", params); + $("#synchronize-report").load("modules/synchronize.xq", params); }, "Close": function () { $(this).dialog("close"); } } @@ -195,7 +195,7 @@ eXide.edit.PackageEditor = (function () { $(statusAnchor).text("Synchronization in progress ..."); $(statusAnchor).load( - "modules/synchronize.xql", + "modules/synchronize.xq", { collection : $this.currentProject.root, start :start}, function(responseText, status){if(status == 'success') {eXide.app.git.command($this.currentProject, 'commit', option);}} ); @@ -215,7 +215,7 @@ eXide.edit.PackageEditor = (function () { var indentOnDownloadPackage = $("#indent-on-download-package").is(":checked"); var expandXIncludesOnDownloadPackage = $("#expand-xincludes-on-download-package").is(":checked"); var omitXMLDeclatarionOnDownloadPackage = $("#omit-xml-decl-on-download-package").is(":checked"); - window.location.href = "modules/deployment.xql?download=true&collection=" + encodeURIComponent(collection) + "&indent=" + indentOnDownloadPackage + "&expand-xincludes=" + expandXIncludesOnDownloadPackage + "&omit-xml-decl=" + omitXMLDeclatarionOnDownloadPackage; + window.location.href = "modules/deployment.xq?download=true&collection=" + encodeURIComponent(collection) + "&indent=" + indentOnDownloadPackage + "&expand-xincludes=" + expandXIncludesOnDownloadPackage + "&omit-xml-decl=" + omitXMLDeclatarionOnDownloadPackage; }; /** @@ -258,7 +258,7 @@ eXide.edit.PackageEditor = (function () { dir: project.dir }; $.ajax({ - url: "modules/synchronize.xql", + url: "modules/synchronize.xq", type: "GET", data: params, success: function(data) { diff --git a/src/directory.js b/src/directory.js index 2deec85f..b8dd29ba 100644 --- a/src/directory.js +++ b/src/directory.js @@ -76,7 +76,7 @@ eXide.edit.Directory = (function () { } return fn(d) } - d3.json("modules/collections.xql?root=" + (sel.datum().key || "/db") + "&view=r", function(error, data){ + d3.json("modules/collections.xq?root=" + (sel.datum().key || "/db") + "&view=r", function(error, data){ if(error) { return } diff --git a/src/eXide.js b/src/eXide.js index 525552cf..9f73be38 100644 --- a/src/eXide.js +++ b/src/eXide.js @@ -303,7 +303,7 @@ eXide.app = (function(util) { return true; } $.ajax({ - url: "modules/load.xql", + url: "modules/load.xq", dataType: 'text', data: { "path": resource.path, "indent": indentOnOpen, "expand-xincludes": expandXIncludesOnOpen, "omit-xml-decl": omitXMLDeclatarionOnOpen }, success: function (data, status, xhr) { @@ -458,7 +458,7 @@ eXide.app = (function(util) { util.error("There are unsaved changes in the document. Please save it first."); return; } - window.location.href = "modules/load.xql?download=true&path=" + encodeURIComponent(doc.getPath()) + "&indent=" + indentOnDownload + "&expand-xincludes=" + expandXIncludesOnDownload + "&omit-xml-decl=" + omitXMLDeclatarionOnDownload; + window.location.href = "modules/load.xq?download=true&path=" + encodeURIComponent(doc.getPath()) + "&indent=" + indentOnDownload + "&expand-xincludes=" + expandXIncludesOnDownload + "&omit-xml-decl=" + omitXMLDeclatarionOnDownload; }, runQuery: function(path, livePreview) { @@ -995,7 +995,7 @@ eXide.app = (function(util) { }, git: function() { - var gitUrl ='modules/git.xql', + var gitUrl ="modules/git.xq", gitError = function(xhr, status) { util.error("Failed to apply configuration: " + xhr.responseText); }, @@ -1079,7 +1079,7 @@ eXide.app = (function(util) { iframe.contentWindow.document.write("

Searching ...

"); iframe.contentWindow.document.close(); - iframe.src = "modules/search.xql?" + searchParams; + iframe.src = "modules/search.xq?" + searchParams; }); }); }, @@ -1247,7 +1247,7 @@ eXide.app = (function(util) { dataType: "json", open: function() { $.ajax({ - url: "modules/get-template.xql", + url: "modules/get-template.xq", type: "POST", success: function(data) { templates = data; diff --git a/src/editor.js b/src/editor.js index 85509ac4..4125e6e9 100644 --- a/src/editor.js +++ b/src/editor.js @@ -453,7 +453,7 @@ eXide.edit.Editor = (function () { } var self = this; $.ajax({ - url: "modules/get-template.xql", + url: "modules/get-template.xq", type: "POST", data: { template: template }, dataType: "text", diff --git a/src/resources.js b/src/resources.js index 089b3f00..08cbeed2 100644 --- a/src/resources.js +++ b/src/resources.js @@ -45,7 +45,7 @@ class DataSource { if (options.filterModel.name) { params.filter = options.filterModel.name.filter; } - $.getJSON("modules/collections.xql", params, (json) => { + $.getJSON("modules/collections.xq", params, (json) => { if (json && json.items) { options.successCallback(json.items, json.total); if (this.data.length === 0) { @@ -309,7 +309,7 @@ eXide.browse.ResourceBrowser = (function () { return; } params.column.colDef.editable = false; - $.getJSON('modules/collections.xql', { + $.getJSON("modules/collections.xq", { target: params.data.name, rename: this.oldValue, root: this.dataSource.collection @@ -344,7 +344,7 @@ eXide.browse.ResourceBrowser = (function () { } var params = $("form", dialog).serialize(); params = params + "&" + $.param({ "modify[]": resources}); - $.getJSON("modules/collections.xql", params, + $.getJSON("modules/collections.xq", params, function(data) { $(dialog).dialog("close"); $this.reload(); @@ -450,7 +450,7 @@ eXide.browse.ResourceBrowser = (function () { "", function () { $("#eXide-browse-spinner").show(); - $.getJSON("modules/collections.xql", { + $.getJSON("modules/collections.xq", { create: $("#eXide-browse-collection-name").val(), collection: $this.dataSource.collection }, @@ -472,7 +472,7 @@ eXide.browse.ResourceBrowser = (function () { eXide.util.Dialog.input("Confirm Deletion", "Are you sure you want to delete collection " + $this.selected + "?", function () { $("#eXide-browse-spinner").show(); - $.getJSON("modules/collections.xql", { + $.getJSON("modules/collections.xq", { remove: $this.dataSource.collection }, function (data) { @@ -501,7 +501,7 @@ eXide.browse.ResourceBrowser = (function () { eXide.util.Dialog.input("Confirm Deletion", "Are you sure you want to delete the selected resources?", function () { $("#eXide-browse-spinner").show(); - $.getJSON("modules/collections.xql", { + $.getJSON("modules/collections.xq", { remove: resources, root: $this.dataSource.collection }, @@ -528,7 +528,7 @@ eXide.browse.ResourceBrowser = (function () { } } if (resources.length > 0) { - $("#resource-properties-content").load("modules/collections.xql", { "properties": resources }); + $("#resource-properties-content").load("modules/collections.xq", { "properties": resources }); $("#resource-properties-dialog").dialog("open"); } }; @@ -563,7 +563,7 @@ eXide.browse.ResourceBrowser = (function () { $.log("Pasting resources %o to %s in mode %s", this.clipboard, this.dataSource.collection, this.clipboardMode); var params = { root: this.dataSource.collection }; params[this.clipboardMode] = this.clipboard; - $.getJSON("modules/collections.xql", params, + $.getJSON("modules/collections.xq", params, function (data) { $.log(data.status); if (data.status == "fail") { diff --git a/src/xml-helper.js b/src/xml-helper.js index 19a1a142..378ab502 100644 --- a/src/xml-helper.js +++ b/src/xml-helper.js @@ -95,7 +95,7 @@ eXide.edit.XMLModeHelper = (function () { var $this = this; $.ajax({ type: "PUT", - url: "modules/validate-xml.xql", + url: "modules/validate-xml.xq", data: code, contentType: "application/octet-stream", dataType: "json", @@ -138,7 +138,7 @@ eXide.edit.XMLModeHelper = (function () { $.log("Getting suggestions for %s", text); $.ajax({ type: "POST", - url: "modules/validate-xml.xql", + url: "modules/validate-xml.xq", data: { xml: text, row: row, @@ -164,7 +164,7 @@ eXide.edit.XMLModeHelper = (function () { eXide.util.message("Apply configuration and reindex..."); $.ajax({ type: "POST", - url: "modules/apply-config.xql", + url: "modules/apply-config.xq", data: { collection: doc.getBasePath(), config: doc.getName() diff --git a/src/xquery-helper.js b/src/xquery-helper.js index d3b51940..1fbb2d04 100644 --- a/src/xquery-helper.js +++ b/src/xquery-helper.js @@ -116,7 +116,7 @@ eXide.edit.XQueryModeHelper = (function () { var $this = this; $.ajax({ type: "PUT", - url: "modules/compile.xql", + url: "modules/compile.xq", data: text, contentType: "application/octet-stream", headers: { @@ -155,7 +155,7 @@ eXide.edit.XQueryModeHelper = (function () { $.ajax({ type: "PUT", - url: "modules/compile.xql", + url: "modules/compile.xq", data: code, dataType: "json", headers: { @@ -455,7 +455,7 @@ eXide.edit.XQueryModeHelper = (function () { var $this = this; // Call docs.xql to retrieve declared functions and variables $.ajax({ - url: "modules/docs.xql", + url: "modules/docs.xq", dataType: "text", type: "POST", data: { prefix: prefix}, @@ -511,7 +511,7 @@ eXide.edit.XQueryModeHelper = (function () { Constr.prototype.moduleLookup = function(doc, prefix, wordrange, complete) { var self = this; - $.getJSON("modules/find.xql", { prefix: prefix }, function (data) { + $.getJSON("modules/find.xq", { prefix: prefix }, function (data) { if (data) { var popupItems = []; for (var i = 0; i < data.length; i++) { @@ -1057,7 +1057,7 @@ eXide.edit.XQueryModeHelper = (function () { if (info.isModule() && info.hasTests()) { $.ajax({ type: "POST", - url: "modules/run-test.xql", + url: "modules/run-test.xq", data: { source: doc.getPath() }, dataType: "html", success: function (html) {