>
> What is the easiest way of loading a local file using a remote server ?
No easy solution. Java security precludes reading a file from the user's
system directly. Two options I know of:
1) mirror it from your server:
a) Have a form with <input type=text> with which the user can designate a
local file.
b) Have a server-side script that returns that text embedded in an applet
tag as part of a "loadInline" parameter. This removes the need to save the
file in any temporary way on your server. The trick here is that you need
to add a vertical line at the beginning of each line, because HTML will
strip lines from a parameter.
2) have the user clip the data into a text area. The code used at XTALX
uses this method. It is simpler, but it asks more of your user. The code
XTALX uses is:
function doloadcifdata() {
var s=document.getElementById("cifdata").value.replace(/\n\ /g,"\n")
if(s.indexOf("########################################################################################")>0)
{
var i =
s.lastIndexOf("########################################################################################")
s=s.substring(i,s.length)
}
jmolScriptWait(getlatticeinfo("set defaultlattice "))
lastinlineload=s
jmolLoadInlineScript(s,loadscript)
}
Here "cifdata" is the ID of the textarea. That first replace isn't
necessary. The business of the ######### is that certain CIF files from a
certain database can't be read directly (right now) because they have too
many bytes of comment at the top. You could probably dispense with that as
well. The jmolScriptWait command simply reads the current lattice info
(from another function) and then finally loads the script. The following
will probably work just fine for you:
jmolLoadInlineScript(document.getElementById("cifdata"))
where we have
<textarea wrap=OFF id=cifdata rows=8 cols=50>
</textarea>
on the page somewhere.
So this method asks a bit more of the user but is far easier to implement.
Bob
-------------------------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
_______________________________________________
Jmol-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/jmol-users