Last active
April 1, 2019 18:28
-
-
Save ebruchez/b09399d44b64896608f0d380eb5b0340 to your computer and use it in GitHub Desktop.
Actions: support setting a service response as attachment #3828
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<xh:html xmlns:xh="http://www.w3.org/1999/xhtml" xmlns:xf="http://www.w3.org/2002/xforms" | |
xmlns:xs="http://www.w3.org/2001/XMLSchema" | |
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | |
xmlns:ev="http://www.w3.org/2001/xml-events" | |
xmlns:xi="http://www.w3.org/2001/XInclude" | |
xmlns:xxi="http://orbeon.org/oxf/xml/xinclude" | |
xmlns:xxf="http://orbeon.org/oxf/xml/xforms" | |
xmlns:map="http://www.w3.org/2005/xpath-functions/map" | |
xmlns:array="http://www.w3.org/2005/xpath-functions/array" | |
xmlns:exf="http://www.exforms.org/exf/1-0" | |
xmlns:fr="http://orbeon.org/oxf/xml/form-runner" | |
xmlns:saxon="http://saxon.sf.net/" | |
xmlns:sql="http://orbeon.org/oxf/xml/sql" | |
xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" | |
xmlns:fb="http://orbeon.org/oxf/xml/form-builder"> | |
<xh:head> | |
<xh:title>Actions: support setting a service response as attachment #3828</xh:title> | |
<xf:model id="fr-form-model" xxf:expose-xpath-types="true" xxf:analysis.calculate="true"> | |
<!-- Main instance --> | |
<xf:instance id="fr-form-instance" xxf:exclude-result-prefixes="#all" xxf:index="id"> | |
<form> | |
<section-1> | |
<grid-2> | |
<grid-2-iteration> | |
<my-attachment filename="" mediatype="" size=""/> | |
</grid-2-iteration> | |
</grid-2> | |
</section-1> | |
</form> | |
</xf:instance> | |
<!-- Bindings --> | |
<xf:bind id="fr-form-binds" ref="instance('fr-form-instance')"> | |
<xf:bind id="section-1-bind" name="section-1" ref="section-1"> | |
<xf:bind id="grid-2-bind" ref="grid-2" name="grid-2"> | |
<xf:bind id="grid-2-iteration-bind" ref="grid-2-iteration" name="grid-2-iteration"> | |
<xf:bind id="my-attachment-bind" ref="my-attachment" name="my-attachment" | |
type="xf:anyURI" | |
constraint="xxf:upload-mediatypes('image/*')"/> | |
</xf:bind> | |
</xf:bind> | |
</xf:bind> | |
</xf:bind> | |
<!-- Metadata --> | |
<xf:instance id="fr-form-metadata" xxf:readonly="true" xxf:exclude-result-prefixes="#all"> | |
<metadata> | |
<application-name>orbeon</application-name> | |
<form-name>issue3828</form-name> | |
<title xml:lang="en">Actions: support setting a service response as attachment #3828</title> | |
<description xml:lang="en"/> | |
<created-with-version>2019.1-SNAPSHOT PE</created-with-version> | |
<library-versions> | |
<orbeon>1</orbeon> | |
</library-versions> | |
</metadata> | |
</xf:instance> | |
<!-- Attachments --> | |
<xf:instance id="fr-form-attachments" xxf:exclude-result-prefixes="#all"> | |
<attachments/> | |
</xf:instance> | |
<!-- All form resources --> | |
<xf:instance xxf:readonly="true" id="fr-form-resources" xxf:exclude-result-prefixes="#all"> | |
<resources> | |
<resource xml:lang="en"> | |
<my-attachment> | |
<label>My Image Attachment</label> | |
<hint/> | |
</my-attachment> | |
<section-1> | |
<label>Untitled Section</label> | |
</section-1> | |
</resource> | |
</resources> | |
</xf:instance> | |
<xf:instance xxf:readonly="true" xxf:exclude-result-prefixes="#all" id="grid-2-template"> | |
<grid-2-iteration> | |
<my-attachment filename="" mediatype="" size=""/> | |
</grid-2-iteration> | |
</xf:instance> | |
<xf:instance id="get-image-instance" class="fr-service" xxf:exclude-result-prefixes="#all"> | |
<body xmlns:xxbl="http://orbeon.org/oxf/xml/xbl" | |
xmlns:fbf="java:org.orbeon.oxf.fb.FormBuilderXPathApi"><params/></body> | |
</xf:instance> | |
<xf:submission id="get-image-submission" class="fr-service" | |
resource="https://httpbin.org/image/png" | |
method="get" | |
serialization="none" | |
mediatype="" | |
replace="xxf:binary"/> | |
<fr:listener version="2018.2" events="form-load-after-controls" actions="my-action"/> | |
<fr:action name="my-action" version="2018.2"> | |
<fr:service-call service="get-image"/> | |
<fr:control-setattachment control="my-attachment" at="end"/> | |
<fr:control-setfilename control="my-attachment" at="end" value="'My Image.png'"/> | |
</fr:action> | |
</xf:model> | |
</xh:head> | |
<xh:body> | |
<fr:view> | |
<fr:body xmlns:xbl="http://www.w3.org/ns/xbl" xmlns:p="http://www.orbeon.com/oxf/pipeline" | |
xmlns:oxf="http://www.orbeon.com/oxf/processors"> | |
<fr:section id="section-1-section" bind="section-1-bind"> | |
<xf:label ref="$form-resources/section-1/label"/> | |
<fr:grid id="grid-2-grid" bind="grid-2-bind" repeat="content" min="1" | |
template="instance('grid-2-template')" | |
apply-defaults="true" | |
fb:initial-iterations="first"> | |
<fr:c x="1" y="1" w="6"> | |
<fr:image-attachment xmlns="http://orbeon.org/oxf/xml/form-builder" | |
xmlns:xxbl="http://orbeon.org/oxf/xml/xbl" | |
id="my-attachment-control" | |
bind="my-attachment-bind" | |
class="fr-attachment"> | |
<xf:label ref="$form-resources/my-attachment/label"/> | |
<xf:hint ref="$form-resources/my-attachment/hint"/> | |
<xf:alert ref="$fr-resources/detail/labels/alert"/> | |
</fr:image-attachment> | |
</fr:c> | |
<fr:c x="7" y="1" w="6"/> | |
</fr:grid> | |
</fr:section> | |
</fr:body> | |
</fr:view> | |
</xh:body> | |
</xh:html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment