-
-
Notifications
You must be signed in to change notification settings - Fork 32
Add download button to DB Manager view #484
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
@joewiz i updated the file name ,please take a look at PR |
@marmoure Thanks for fixing the call to |
hi @joewiz i added a fail message when eXide fail to recognize your selection |
Thanks! Could you update the text of the warning from:
to:
(In my testing, the copy/paste and cut/paste commands can work on multiple resources. But the commands are somewhat inconsistent in their handling of multiple selections. Your warning dialog is very nice and user-friendly!) |
Hi @joewiz i changed the warning message and added few tweaks 😉 |
@marmoure Works beautifully! Could you change the warning from:
to:
|
@marmoure Hmm... If we extend the declare function deploy:download($collection as xs:string, $expathConf as element()?, $expand-xincludes as xs:boolean, $indent as xs:boolean, $omit-xml-declaration as xs:boolean) {
let $name :=
if ($expathConf) then
concat($expathConf/@abbrev, "-", $expathConf/@version, ".xar")
else
replace($collection, "^.+/([^/]+)$", "$1") || ".zip"
let $entries :=
(: compression:zip uses default serialization parameters, so we'll construct entries manually :)
dbutil:scan(xs:anyURI($collection), function($coll as xs:anyURI, $res as xs:anyURI?) {
(: compression:zip doesn't seem to store empty collections, so we'll scan for only resources :)
if (exists($res)) then
let $relative-path := substring-after($res, $collection || "/")
return
if (util:binary-doc-available($res)) then
<entry type="uri" name="{$relative-path}">{$res}</entry>
else
<entry type="xml" name="{$relative-path}">{
(: workaround until https://github.com/eXist-db/exist/issues/2394 is resolved :)
util:declare-option(
"exist:serialize",
"expand-xincludes="
|| (if ($expand-xincludes) then "yes" else "no")
|| " indent="
|| (if ($indent) then "yes" else "no")
|| " omit-xml-declaration="
|| (if ($omit-xml-declaration) then "yes" else "no")
),
doc($res)
}</entry>
else
()
})
let $archive := compression:zip($entries, true())
return (
response:set-header("Content-Disposition", concat("attachment; filename=", $name)),
response:stream-binary($archive, "application/zip", $name)
)
}; ... then this PR could be extended to download collections (like The Do you think that's feasible to incorporate into this PR? |
@joewiz can you please go ahead and give this one a test |
@marmoure Works beautifully - even with mixed selections of resources AND collections. Thank you! |
fixes #111
DB Manager view (File > Manage) now has a Download button to download a selected resource.
This only applies for files at the moment, you select the file then press Download in the toolbar.
This open source contribution to the eXide project was commissioned by the Office of the Historian, U.S. Department of State, https://history.state.gov/.