diff --git a/docs/docs.md b/docs/docs.md index 4981c7fb..68a3a42b 100644 --- a/docs/docs.md +++ b/docs/docs.md @@ -156,8 +156,8 @@ When loading XML documents from the database into an editor window, you can cont as whether indentation is automatically applied, whether XInclude elements are automatically expanded, and whether XML declarations are omitted. Set these preferences in "Edit > Preferences > Serialization." Additional sets of these preferences are available for download of XML documents via "File > Download" and for -the serialization of XML documents included in application packages via ["Application > Download app"](#Support-for-EXPath-Packages). -By default, indentation is turned on for opening and downloading files but is off for downloading EXPath Packages; XInclude +the serialization of XML documents included in application packages via ["Application > Download app and Synchronize"](#Support-for-EXPath-Packages). +By default, indentation is turned on for opening and downloading files but is off for downloading and synchronizing EXPath Packages; XInclude expansion is turned off in all cases; and the XML declaration is omitted in all cases. ## Options for displaying query results diff --git a/expath-pkg.xml.tmpl b/expath-pkg.xml.tmpl index afa02b21..6a8f39eb 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 2c302cd4..ca1c6a0d 100755 --- a/index.html.tmpl +++ b/index.html.tmpl @@ -733,7 +733,7 @@ -

Downloading EXPath packages (via Application > Download App)

+

Downloading and synchronizing EXPath packages (via Application > Download App and Synchronize)

  1. diff --git a/modules/synchronize.xq b/modules/synchronize.xq index dbed911d..e1527dba 100644 --- a/modules/synchronize.xq +++ b/modules/synchronize.xq @@ -16,7 +16,7 @@ : You should have received a copy of the GNU General Public License : along with this program. If not, see . :) -xquery version "1.0"; +xquery version "3.1"; 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.xqm"; @@ -43,9 +43,18 @@ declare function local:format-output($output) { }; let $startParam := request:get-parameter("start", ()) -let $startTime := if (empty($startParam) or $startParam eq "") then () else $startParam +let $startTime := if (empty($startParam) or $startParam eq "") then () else $startParam cast as xs:dateTime let $collection := request:get-parameter("collection", ()) let $dir := request:get-parameter("dir", apputil:get-info-from-descriptor($collection)/workingDir/string()) -let $output := file:sync($collection, $dir, $startTime) +let $indent := request:get-parameter("indent", true()) cast as xs:boolean +let $expand-xincludes := request:get-parameter("expand-xincludes", false()) cast as xs:boolean +let $omit-xml-declaration := request:get-parameter("omit-xml-declaration", true()) cast as xs:boolean +let $sync-params := map { + "after": $startTime, + "indent": $indent, + "expand-xincludes": $expand-xincludes, + "omit-xml-declaration": $omit-xml-declaration + } +let $output := file:sync($collection, $dir, $sync-params) return local:format-output($output) \ No newline at end of file diff --git a/src/deployment.js b/src/deployment.js index 6dd9d1c3..7f529ea5 100644 --- a/src/deployment.js +++ b/src/deployment.js @@ -142,7 +142,15 @@ eXide.edit.PackageEditor = (function () { } $this.currentProject.dir = dir; - var params = $this.syncDialog.find("form").serialize(); + var params = { + start: $this.syncDialog.find("input[name=\"start\"]").val(), + dir: dir, + auto: $this.syncDialog.find("input[name=\"auto\"]").val(), + collection: $this.syncDialog.find("input[name=\"collection\"]").val(), + indent: $("#indent-on-download-package").is(":checked"), + "expand-xincludes": $("#expand-xincludes-on-download-package").is(":checked"), + "omit-xml-declarationaration": $("#omit-xml-declaration-on-download-package").is(":checked") + }; $("#synchronize-report").text("Synchronization in progress ..."); $("#synchronize-report").load("modules/synchronize.xq", params); }, @@ -193,10 +201,17 @@ eXide.edit.PackageEditor = (function () { return; } + var params = { + collection: $this.currentProject.root, + start: start, + indent: $("#indent-on-download-package").is(":checked"), + "expand-xincludes": $("#expand-xincludes-on-download-package").is(":checked"), + "omit-xml-declaration": $("#omit-xml-declaration-on-download-package").is(":checked") + }; $(statusAnchor).text("Synchronization in progress ..."); $(statusAnchor).load( "modules/synchronize.xq", - { collection : $this.currentProject.root, start :start}, + params, function(responseText, status){if(status == 'success') {eXide.app.git.command($this.currentProject, 'commit', option);}} ); @@ -214,8 +229,8 @@ eXide.edit.PackageEditor = (function () { Constr.prototype.download = function (collection) { 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"); - const url = "modules/deployment.xq?download=true&collection=" + encodeURIComponent(collection) + "&indent=" + indentOnDownloadPackage + "&expand-xincludes=" + expandXIncludesOnDownloadPackage + "&omit-xml-decl=" + omitXMLDeclatarionOnDownloadPackage; + var omitXMLDeclatarionOnDownloadPackage = $("#omit-xml-declaration-on-download-package").is(":checked"); + const url = "modules/deployment.xq?download=true&collection=" + encodeURIComponent(collection) + "&indent=" + indentOnDownloadPackage + "&expand-xincludes=" + expandXIncludesOnDownloadPackage + "&omit-xml-declaration=" + omitXMLDeclatarionOnDownloadPackage; fetch(url) .then(resp => resp.blob()) .then(blob => { @@ -267,7 +282,10 @@ eXide.edit.PackageEditor = (function () { var params = { collection: project.root, start: project.deployed, - dir: project.dir + dir: project.dir, + indent: $("#indent-on-download-package").is(":checked"), + "expand-xincludes": $("#expand-xincludes-on-download-package").is(":checked"), + "omit-xml-declaration": $("#omit-xml-declaration-on-download-package").is(":checked") }; $.ajax({ url: "modules/synchronize.xq",