Hi! I'm still exploring the fundamentals of Xforms, and need help getting pointed in the right direction on how to tackle this:
I've managed to find forum posts and figure out how to save portions of my xform's main instance to a local XML file, but am not sure how to go about doing the reverse: access data from an XML file stored locally, and replace only a portion of the form's main instance. I'm not really sure if this is allowed security-wise. The result I want is for the user to be able to store a certain node of the main instance as a file, and then later have the option of being able to browse to that file and copy that data to that node (instead of using the "default" data on the server). It sounds very simple, but if some can help me "connect-the-dots" on whether this is possible and how to go about it, I'd be grateful! (I'm using Orbeon 3.8 with IE 7, Win XP)
-- Francis
|
I am out of the office until 26th July *********************************************************************************************** This email, including any attachment, is confidential and may be legally privileged. If you are not the intended recipient or if you have received this email in error, please inform the sender immediately by reply and delete all copies from your system. Do not retain, copy, disclose, distribute or otherwise use any of its contents.
Whilst we have taken reasonable precautions to ensure that this email has been swept for computer viruses, we cannot guarantee that this email does not contain such material and we therefore advise you to carry out your own virus checks. We do not accept liability for any damage or losses sustained as a result of such material.
Please note that incoming and outgoing email communications passing through our IT systems may be monitored and/or intercepted by us solely to determine whether the content is business related and compliant with company standards. *********************************************************************************************** The Stationery Office Limited is registered in England No. 3049649 at 10 Eastbourne Terrace, London, W2 6LG
|
In reply to this post by FParsons
Hi Francis,
There's always more than one way... During initialization, there is xinclude and src= attribute: http://www.orbeon.com/orbeon/doc/reference-xforms-guide#xforms-initialization also discussed here: http://wiki.orbeon.com/forms/how-to/load-initial-form-data after that, you can call an xpl file that runs the url-generator: http://wiki.orbeon.com/forms/doc/developer-guide/xforms-xpath-functions#TOC-xxforms:call-xpl- http://www.orbeon.com/orbeon/doc/processors-generators-url Likely other ways as well.... Cheers, Hank > > Hi! I'm still exploring the fundamentals of Xforms, and need help getting > pointed in the right direction on how to tackle this: > > I've managed to find forum posts and figure out how to save portions of my > xform's main instance to a local XML file, but am not sure how to go about > doing the reverse: access data from an XML file stored locally, and replace > only a portion of the form's main instance. I'm not really sure if this is > allowed security-wise. The result I want is for the user to be able to > store a certain node of the main instance as a file, and then later have the > option of being able to browse to that file and copy that data to that node > (instead of using the "default" data on the server). > > It sounds very simple, but if some can help me "connect-the-dots" on whether > this is possible and how to go about it, I'd be grateful! > > (I'm using Orbeon 3.8 with IE 7, Win XP) > > ----- > -- Francis > -- > View this message in context: > http://orbeon-forms-ops-users.24843.n4.nabble.com/replacing-instance-data-with-data-from-local-XML-file-tp2300574p2300574.html > Sent from the Orbeon Forms (ops-users) mailing list archive at Nabble.com. > -- Hank Ratzesberger [hidden email] -- You receive this message as a subscriber of the [hidden email] mailing list. To unsubscribe: mailto:[hidden email] For general help: mailto:[hidden email]?subject=help OW2 mailing lists service home page: http://www.ow2.org/wws |
I am out of the office until 26th July *********************************************************************************************** This email, including any attachment, is confidential and may be legally privileged. If you are not the intended recipient or if you have received this email in error, please inform the sender immediately by reply and delete all copies from your system. Do not retain, copy, disclose, distribute or otherwise use any of its contents.
Whilst we have taken reasonable precautions to ensure that this email has been swept for computer viruses, we cannot guarantee that this email does not contain such material and we therefore advise you to carry out your own virus checks. We do not accept liability for any damage or losses sustained as a result of such material.
Please note that incoming and outgoing email communications passing through our IT systems may be monitored and/or intercepted by us solely to determine whether the content is business related and compliant with company standards. *********************************************************************************************** The Stationery Office Limited is registered in England No. 3049649 at 10 Eastbourne Terrace, London, W2 6LG
|
In reply to this post by Louis Ratzesberger-2
Louis - thanks for the links. I was confused by xpl at first, but I'm slowly getting the hang of using it.
So far I have this xpl: <p:config xmlns:p="http://www.orbeon.com/oxf/pipeline" xmlns:oxf="http://www.orbeon.com/oxf/processors" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> <p:param type="input" name="ui_instance"/> <p:param type="output" name="xml_data"/> <p:processor name="oxf:xslt"> <p:input name="data" href="#ui_instance"/> <p:input name="config"> <xsl:stylesheet version="2.0"> <xsl:template match="/"> <config> <url><xsl:value-of select="//save-question-set/file-to-load"/></url> <content-type>application/xml</content-type> <validating>true</validating> <handle-xinclude>false</handle-xinclude> </config> </xsl:template> </xsl:stylesheet> </p:input> <p:output name="dyn_config" id="dyn_config"/> </p:processor> <p:processor name="oxf:url-generator" > <p:input name="config" href="#dyn_config"/> <p:output name="xml_data" ref="xml_data"/> </p:processor> </p:config> Which gets called by: <xforms:insert context="$qblocks-node" origin="xxforms:call-xpl('oxf:/apps/cc-test2/load-questions.xpl','ui_instance',$ui,'xml_data')/QUESTION_BLOCKS/*"/> This seems to work, but right now I have just an input control for the file path. I'd like to access the browser's file selector, the way you do with the xforms:upload control. Is it possible to use the upload control for this? Do I have to use something else? I guess the primary consideration is that I save a "file:///" URL to the instance, not a "DOS" path. Thanks for any help with this!
-- Francis
|
Francis,
Terrific... yes, the xml pipelining idea is hill, but once up the view is good. XPL (even much of the xforms code) is running on the server, however. I am not aware of a browser or JavaScript method to browse the local file system. I have only seen this in Java applets. So, to process the file in XForms, it would have to be uploaded to the server first. i.e., using fr:upload first. Did I understand you? Best, Hank Quoting FParsons <[hidden email]>: > > Louis - thanks for the links. I was confused by xpl at first, but I'm slowly > getting the hang of using it. > > So far I have this xpl: > > <p:config xmlns:p="http://www.orbeon.com/oxf/pipeline" > xmlns:oxf="http://www.orbeon.com/oxf/processors" > xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> > > <p:param type="input" name="ui_instance"/> > <p:param type="output" name="xml_data"/> > > <!-- write config using filepath from ui instance --> > <p:processor name="oxf:xslt"> > <p:input name="data" href="#ui_instance"/> > <p:input name="config"> > <xsl:stylesheet version="2.0"> > <xsl:template match="/"> > <config> > <url><xsl:value-of > select="//save-question-set/file-to-load"/></url> > <content-type>application/xml</content-type> > <validating>true</validating> > <handle-xinclude>false</handle-xinclude> > </config> > </xsl:template> > </xsl:stylesheet> > </p:input> > <p:output name="dyn_config" id="dyn_config"/> > </p:processor> > > <p:processor name="oxf:url-generator" > > <p:input name="config" href="#dyn_config"/> > <p:output name="xml_data" ref="xml_data"/> > </p:processor> > </p:config> > > Which gets called by: > > <xforms:insert context="$qblocks-node" > origin="xxforms:call-xpl('oxf:/apps/cc-test2/load-questions.xpl','ui_instance',$ui,'xml_data')/QUESTION_BLOCKS/*"/> > > > This seems to work, but right now I have just an input control for the file > path. > > I'd like to access the browser's file selector, the way you do with the > xforms:upload control. Is it possible to use the upload control for this? > Do I have to use something else? I guess the primary consideration is that I > save a "file:///" URL to the instance, not a "DOS" path. > > Thanks for any help with this! > > ----- > -- Francis > -- > View this message in context: > http://orbeon-forms-ops-users.24843.n4.nabble.com/replacing-instance-data-with-data-from-local-XML-file-tp2300574p2302721.html > Sent from the Orbeon Forms (ops-users) mailing list archive at Nabble.com. > -- Hank Ratzesberger [hidden email] -- You receive this message as a subscriber of the [hidden email] mailing list. To unsubscribe: mailto:[hidden email] For general help: mailto:[hidden email]?subject=help OW2 mailing lists service home page: http://www.ow2.org/wws |
Hmm - that's a bit disconcerting. What about using the <xhtml:input type="file" id="some_id"/> element? Is it possible for Orbeon to get the value of a non-xforms control? - or - could javascript triggered by an xhtml input control be used to set the value of an xforms input? (hidden or not)? All I really need is an easy way for the user to get that path into an xforms instance - I'd rather not have to actually upload the file. Any ideas on how to do this are welcome!
-- Francis
|
Administrator
|
Francis,
<xforms:upload> is the "equivalent" to <xhtml:input type="file"> in XForms. So this is what you'll want to use. If you'd like the file to be available "right away" in the instance, just after it is selected, declare a submission as follows: <xforms:submission id="upload-submission" ref="." method="post" replace="none" resource="test:"/> And inside the <xforms:upload> run <xforms:send ev:event="xforms-select" submission="upload-submission"/>. Alex On Tue, Jul 27, 2010 at 9:16 AM, FParsons <[hidden email]> wrote: > > > Louis Ratzesberger-2 wrote: >> >> XPL (even much of the xforms code) is running on the server, however. >> I am not aware of a browser or JavaScript method to browse the local >> file system. I have only seen this in Java applets. >> >> So, to process the file in XForms, it would have to be uploaded to the >> server first. i.e., using fr:upload first. >> > Hmm - that's a bit disconcerting. What about using the <xhtml:input > type="file" id="some_id"/> element? Is it possible for Orbeon to get the > value of a non-xforms control? - or - could javascript triggered by an xhtml > input control be used to set the value of an xforms input? (hidden or not)? > All I really need is an easy way for the user to get that path into an > xforms instance - I'd rather not have to actually upload the file. > > Any ideas on how to do this are welcome! > > ----- > -- Francis > -- > View this message in context: http://orbeon-forms-ops-users.24843.n4.nabble.com/replacing-instance-data-with-data-from-local-XML-file-tp2300574p2303773.html > Sent from the Orbeon Forms (ops-users) mailing list archive at Nabble.com. > > > -- > You receive this message as a subscriber of the [hidden email] mailing list. > To unsubscribe: mailto:[hidden email] > For general help: mailto:[hidden email]?subject=help > OW2 mailing lists service home page: http://www.ow2.org/wws > > -- Orbeon Forms - Web forms, open-source, for the Enterprise - http://www.orbeon.com/ My Twitter: http://twitter.com/avernet -- You receive this message as a subscriber of the [hidden email] mailing list. To unsubscribe: mailto:[hidden email] For general help: mailto:[hidden email]?subject=help OW2 mailing lists service home page: http://www.ow2.org/wws
--
Follow Orbeon on Twitter: @orbeon Follow me on Twitter: @avernet |
Alex - I tried your example, but I'm not sure if I understand how it's supposed to work or what I'm what I'm supposed to see.
What I'm trying to do is read a local XML file, and copy it's contents to a node in the main instance. I don't want to upload the file to the server, just read it and get its XML. Right now I have XPL that can do this, but to use it I'd have to get that file path into the instance. This is probably a very simple problem, but I'm still somewhat confused on how to use the upload element accomplish the same thing.
-- Francis
|
Administrator
|
Francis,
When you say that you want to read a local file, is that file "local" to the machine on which the browser is running or the server on which Tomcat / Orbeon Forms are running? Or are both always on the same machine in your case? Alex On Thu, Jul 29, 2010 at 8:50 AM, FParsons <[hidden email]> wrote: > > Alex - I tried your example, but I'm not sure if I understand how it's > supposed to work or what I'm what I'm supposed to see. > > What I'm trying to do is read a local XML file, and copy it's contents to a > node in the main instance. I don't want to upload the file to the server, > just read it and get its XML. > > Right now I have XPL that can do this, but to use it I'd have to get that > file path into the instance. This is probably a very simple problem, but I'm > still somewhat confused on how to use the upload element accomplish the same > thing. > > > > ----- > -- Francis > -- > View this message in context: http://orbeon-forms-ops-users.24843.n4.nabble.com/replacing-instance-data-with-data-from-local-XML-file-tp2300574p2306689.html > Sent from the Orbeon Forms (ops-users) mailing list archive at Nabble.com. > > > -- > You receive this message as a subscriber of the [hidden email] mailing list. > To unsubscribe: mailto:[hidden email] > For general help: mailto:[hidden email]?subject=help > OW2 mailing lists service home page: http://www.ow2.org/wws > > -- Orbeon Forms - Web forms, open-source, for the Enterprise - http://www.orbeon.com/ My Twitter: http://twitter.com/avernet -- You receive this message as a subscriber of the [hidden email] mailing list. To unsubscribe: mailto:[hidden email] For general help: mailto:[hidden email]?subject=help OW2 mailing lists service home page: http://www.ow2.org/wws
--
Follow Orbeon on Twitter: @orbeon Follow me on Twitter: @avernet |
Alex - I meant the machine on which the browser is running. Basically
we'd like users to be able to store and retrieve parts of the instance on their machine (instead of having to modify "default" instance data every time). On 7/29/2010 5:38 PM, Alessandro Vernet wrote: > Francis, > > When you say that you want to read a local file, is that file "local" > to the machine on which the browser is running or the server on which > Tomcat / Orbeon Forms are running? Or are both always on the same > machine in your case? > > Alex > > On Thu, Jul 29, 2010 at 8:50 AM, FParsons<[hidden email]> wrote: > >> Alex - I tried your example, but I'm not sure if I understand how it's >> supposed to work or what I'm what I'm supposed to see. >> >> What I'm trying to do is read a local XML file, and copy it's contents to a >> node in the main instance. I don't want to upload the file to the server, >> just read it and get its XML. >> >> Right now I have XPL that can do this, but to use it I'd have to get that >> file path into the instance. This is probably a very simple problem, but I'm >> still somewhat confused on how to use the upload element accomplish the same >> thing. >> >> >> >> ----- >> -- Francis >> -- >> View this message in context: http://orbeon-forms-ops-users.24843.n4.nabble.com/replacing-instance-data-with-data-from-local-XML-file-tp2300574p2306689.html >> Sent from the Orbeon Forms (ops-users) mailing list archive at Nabble.com. >> >> >> -- >> You receive this message as a subscriber of the [hidden email] mailing list. >> To unsubscribe: mailto:[hidden email] >> For general help: mailto:[hidden email]?subject=help >> OW2 mailing lists service home page: http://www.ow2.org/wws >> >> >> > > > -- --- Francis -- You receive this message as a subscriber of the [hidden email] mailing list. To unsubscribe: mailto:[hidden email] For general help: mailto:[hidden email]?subject=help OW2 mailing lists service home page: http://www.ow2.org/wws
-- Francis
|
Administrator
|
Francis,
This is an interesting one, which uses a number of non-trivial techniques you can reuse in a number of other cases. So we put together a how-to to cover this: http://wiki.orbeon.com/forms/how-to/upload-and-download-instance You'll let us know if you have any question on this. Alex On Thu, Jul 29, 2010 at 5:18 PM, Francis Parsons <[hidden email]> wrote: > Alex - I meant the machine on which the browser is running. Basically we'd > like users to be able to store and retrieve parts of the instance on their > machine (instead of having to modify "default" instance data every time). > > On 7/29/2010 5:38 PM, Alessandro Vernet wrote: >> >> Francis, >> >> When you say that you want to read a local file, is that file "local" >> to the machine on which the browser is running or the server on which >> Tomcat / Orbeon Forms are running? Or are both always on the same >> machine in your case? >> >> Alex >> >> On Thu, Jul 29, 2010 at 8:50 AM, FParsons<[hidden email]> wrote: >> >>> >>> Alex - I tried your example, but I'm not sure if I understand how it's >>> supposed to work or what I'm what I'm supposed to see. >>> >>> What I'm trying to do is read a local XML file, and copy it's contents to >>> a >>> node in the main instance. I don't want to upload the file to the >>> server, >>> just read it and get its XML. >>> >>> Right now I have XPL that can do this, but to use it I'd have to get that >>> file path into the instance. This is probably a very simple problem, but >>> I'm >>> still somewhat confused on how to use the upload element accomplish the >>> same >>> thing. >>> >>> >>> >>> ----- >>> -- Francis >>> -- >>> View this message in context: >>> http://orbeon-forms-ops-users.24843.n4.nabble.com/replacing-instance-data-with-data-from-local-XML-file-tp2300574p2306689.html >>> Sent from the Orbeon Forms (ops-users) mailing list archive at >>> Nabble.com. >>> >>> >>> -- >>> You receive this message as a subscriber of the [hidden email] mailing >>> list. >>> To unsubscribe: mailto:[hidden email] >>> For general help: mailto:[hidden email]?subject=help >>> OW2 mailing lists service home page: http://www.ow2.org/wws >>> >>> >>> >> >> >> > > > -- > --- Francis > > > > > -- > You receive this message as a subscriber of the [hidden email] mailing > list. > To unsubscribe: mailto:[hidden email] > For general help: mailto:[hidden email]?subject=help > OW2 mailing lists service home page: http://www.ow2.org/wws > > -- Orbeon Forms - Web forms, open-source, for the Enterprise - http://www.orbeon.com/ My Twitter: http://twitter.com/avernet -- You receive this message as a subscriber of the [hidden email] mailing list. To unsubscribe: mailto:[hidden email] For general help: mailto:[hidden email]?subject=help OW2 mailing lists service home page: http://www.ow2.org/wws
--
Follow Orbeon on Twitter: @orbeon Follow me on Twitter: @avernet |
Alex - thanks for this, I'll bet many others will find this useful.
I haven't looked carefully at the code yet, but I was wondering: I would like the user to be able to type a name that would become part of the filename (to be downloaded). The "upload" and "download" instances have a "hardcoded" filename. -------------- <xforms:instance id="download"> <serialized mediatype="application/xml" filename="instance.xml"/> </xforms:instance> <xforms:instance id="upload"> <serialized mediatype="application/xml" filename="instance.xml"/> </xforms:instance> -------------- I think it's important that the user be able to create a filename so they can identify it later. (I was using XPL to concatenate the name the user types in with the current date) Is this possible? I like the design of the dialog, BTW, quite nifty. On 8/2/2010 3:28 PM, Alessandro Vernet wrote: > Francis, > > This is an interesting one, which uses a number of non-trivial > techniques you can reuse in a number of other cases. So we put > together a how-to to cover this: > > http://wiki.orbeon.com/forms/how-to/upload-and-download-instance > > You'll let us know if you have any question on this. > > Alex > > On Thu, Jul 29, 2010 at 5:18 PM, Francis Parsons<[hidden email]> wrote: > >> Alex - I meant the machine on which the browser is running. Basically we'd >> like users to be able to store and retrieve parts of the instance on their >> machine (instead of having to modify "default" instance data every time). >> >> On 7/29/2010 5:38 PM, Alessandro Vernet wrote: >> -- You receive this message as a subscriber of the [hidden email] mailing list. To unsubscribe: mailto:[hidden email] For general help: mailto:[hidden email]?subject=help OW2 mailing lists service home page: http://www.ow2.org/wws
-- Francis
|
Administrator
|
Francis,
If you'd like users to be able to input the file name, then you'd have an <xforms:input ref="instance('download')/@filename"> in your UI. No need to use XPL for this. Alex On Mon, Aug 2, 2010 at 5:54 PM, Francis Parsons <[hidden email]> wrote: > Alex - thanks for this, I'll bet many others will find this useful. > > I haven't looked carefully at the code yet, but I was wondering: I would > like the user to be able to type a name that would become part of the > filename (to be downloaded). The "upload" and "download" instances have a > "hardcoded" filename. > -------------- > <xforms:instance id="download"> > <serialized mediatype="application/xml" filename="instance.xml"/> > </xforms:instance> > <xforms:instance id="upload"> > <serialized mediatype="application/xml" filename="instance.xml"/> > </xforms:instance> > -------------- > I think it's important that the user be able to create a filename so they > can identify it later. (I was using XPL to concatenate the name the user > types in with the current date) Is this possible? > > I like the design of the dialog, BTW, quite nifty. > > On 8/2/2010 3:28 PM, Alessandro Vernet wrote: >> >> Francis, >> >> This is an interesting one, which uses a number of non-trivial >> techniques you can reuse in a number of other cases. So we put >> together a how-to to cover this: >> >> http://wiki.orbeon.com/forms/how-to/upload-and-download-instance >> >> You'll let us know if you have any question on this. >> >> Alex >> >> On Thu, Jul 29, 2010 at 5:18 PM, Francis Parsons<[hidden email]> >> wrote: >> >>> >>> Alex - I meant the machine on which the browser is running. Basically >>> we'd >>> like users to be able to store and retrieve parts of the instance on >>> their >>> machine (instead of having to modify "default" instance data every time). >>> >>> On 7/29/2010 5:38 PM, Alessandro Vernet wrote: >>> > > > > > -- > You receive this message as a subscriber of the [hidden email] mailing > list. > To unsubscribe: mailto:[hidden email] > For general help: mailto:[hidden email]?subject=help > OW2 mailing lists service home page: http://www.ow2.org/wws > > -- Orbeon Forms - Web forms, open-source, for the Enterprise - http://www.orbeon.com/ My Twitter: http://twitter.com/avernet -- You receive this message as a subscriber of the [hidden email] mailing list. To unsubscribe: mailto:[hidden email] For general help: mailto:[hidden email]?subject=help OW2 mailing lists service home page: http://www.ow2.org/wws
--
Follow Orbeon on Twitter: @orbeon Follow me on Twitter: @avernet |
Free forum by Nabble | Edit this page |