Re: form control to select a folder

As Iņaki mentioned, it is a problem for the XForms processor to know 
whether the form author intends the user to pick a file or a directory. 
  And the processor in many cases MUST know in order to create the 
widget correctly.  For example, in Mozilla when instantiating a file 
picker, we'll need to pass in a flag if we want the file picker to pick 
a folder instead of a file.  This is the case on other platforms and in 
different OS's, too, I'm sure.

--Aaron

Iņaki Salinas Bueno wrote:
> Hi all,
> 
> I want to suggest include the option of select a folder using upload 
> form control (or another form control).
> 
> My scenario is:
> - The user had a java.policy defined. This policy allows applets signed 
> by X to write/read in a particular folder (choosed by the user).
> - The signing applet (signed by X) must know this folder to be able to 
> store the documents in the user's PC.
> - In the XForms+applet application, the user should enter the 
> destination folder with other critical information and then call the 
> applet sending it this parameters.
> 
> I have to use the input control and do copy&paste of the folder's path 
> because the upload control isn't able to select a folder. I understand a 
> folder as an URI, so I suppose a folder is included in the xsd:anyURI 
> type definition, and the upload control is the manager of this type... 
> reading the spec I don't see anything wrong in including folder 
> selection in the upload control (well, avoiding filename, and maybe 
> mediatype and size).
> 
> Aaron Reed explained me some problems on knowing if the user wants to 
> select a folder or wants to select a file. I don't know how to solve 
> this problem.
> 
> My use case:
> 
> <?xml version="1.0" encoding="ISO-8859-1" standalone="yes"?>
> 
> <html    xmlns="http://www.w3.org/1999/xhtml"
>         xmlns:xforms="http://www.w3.org/2002/xforms"
>         xmlns:ev="http://www.w3.org/2001/xml-events"
>         xmlns:xsd="http://www.w3.org/2001/XMLSchema">
>        
> <head>
> 
>     <title>Test - Select a folder as input</title>
>    
>     <script language="javascript">
>         <![CDATA[
>         function sign() {
>             //get the instance
>             var model = document.getElementById("model");
>             var instance = model.getInstanceDocument("data");
>            
>             //get parameter
>             var keystore = instance.getElementsByTagName("keystore");
>             var password = instance.getElementsByTagName("password");
>             var folder = instance.getElementsByTagName("folder");
>            
>             //call the applet
>             
> document.applets.item("theapplet").sign(keystore[0].firstChild.nodeValue, 
> password[0].firstChild.nodeValue, folder[0].firstChild.nodeValue);
>         }
>         ]]>
>     </script>
>    
>     <xforms:model id="model">
>    
>         <xforms:instance id="data" xmlns="">
>             <data>
>                 <keystore filename="" mediatype="" size="" />
>                 <password />
>                 <folder filename="" mediatype="" size="" />
>             </data>
>         </xforms:instance>
>         <xforms:bind nodeset="instance('data')/keystore" 
> type="xsd:anyURI"/>
>         <xforms:bind nodeset="instance('data')/password" id="password" 
> type="xsd:string"/>
>         <xforms:bind nodeset="instance('data')/folder" type="xsd:anyURI"/>
>     </xforms:model>
>    
> </head>
> 
> <body>
> 
>     <h1>Signing test</h1>
>    
>     <h2>Key Access</h2>
>     <p>
>         <xforms:upload ref="instance('data')/keystore">
>             <xforms:label>Select your KeyStore</xforms:label>
>             <xforms:filename ref="@filename"/>
>             <xforms:mediatype ref="@mediatype"/>
>             <xforms:size ref="@size"/>
>         </xforms:upload>
>         <xforms:secret 
> bind="password"><xforms:label>Password</xforms:label></xforms:secret>
>     </p>
>     <h2>Destination folder</h2>
>     <p>
>         <xforms:upload ref="instance('data')/folder">
>             <xforms:label>Folder</xforms:label>
>             <xforms:filename ref="@filename"/>
>             <xforms:mediatype ref="@mediatype"/>
>             <xforms:size ref="@size"/>
>         </xforms:upload>
>     </p>   
>    
>     <p>
>         <xforms:trigger>
>             <xforms:label>Sign</xforms:label>
>             <xforms:action ev:event="DOMActivate">
>                 <xforms:load resource="javascript:sign()"/>
>             </xforms:action>
>         </xforms:trigger>
>     </p>
>    
>    
>     <!--* APPLET FIRMA *-->
>     <applet    code="signing.Sign.class"
>             archive="sSigning.jar"
>             type="application/x-java-applet"
>             width="200" height="200" id="theapplet">
>         Signing no se ha podido cargar
>     </applet>
>     <!-- -->
>    
> </body>
> 
> </html>
> 
> 
> Regards
> 
> Iņaki

Received on Thursday, 10 May 2007 00:13:35 UTC