I just talked with Bob Hanson (of the St. Olaf Chemistry department)
about setting the defaultdirectory. He pointed out that the .jmol
file you use to set the defaultdirectory is now unnecessary because it
is possible to set the defaultdirectory as a parameter to the Jmol.js
script since version 11.6.?? of the (unsigned) JmolApplet.jar. In
particular, the html code to do this is
-------- begin code ---------------
<script type="text/javascript" src="https://math.webwork.rochester.edu/
webwork2_course_files/fall08mth142/applets/Jmol.js"></script>
<script type="text/javascript">
jmolSetAppletColor("white");
jmolApplet(["450","450"],"set defaultdirectory \"https://
math.webwork.rochester.edu/webwork2_course_files/fall08mth142/sage.zip
\"; script SCRIPT")
</script>
--------- end code -----------------
where Jmol.js and JmolApplet.jar are in the coruseURL/applets
directory, and sage.zip in the courseURL directory is the zip file
that contains the SCRIPT file and any .pmesh files for plotting the
graph (this is usually named something like sage0-
size500-???????.zip). If the html file is in the same directory as
sage.zip, you can replace one line above with
---------- begin code -------------
jmolApplet(["450","450"],"set defaultdirectory \"sage.zip\"; script
SCRIPT")
---------- end code ---------------
Setting the defaultdirectory to a zip file tells Jmol to look for any
included files (such as .pmesh) inside that zip file. Perhaps SAGE
should upgrade to a newer version of the unsigned JmolApplet.jar file
(to 11.6 or higher) so that the trick above for setting the
defaultdirectory can be used instead of the .jmol file trick needed
for older versions of the java applet.
Thank you for all of your help.
Paul
On Dec 9 2009, 8:34 am, Jonathan <gu...@uwosh.edu> wrote:
> Paul,
> Jmolhas already solved this problem. The issue is that we have to
> convert the type of files that are produced forJmolin SAGE. For the
> time being you can use the same method that SAGE uses. In the
> directory you will find two files:
>
> 1) A file with the extension .jmol. This is a short script that sets
> the default directory to the zipped file and instructsJmolto read
> the SCRIPT inside of that.
>
> 2) The .zip file with all the surfaces and the script that sets upJmol.
>
> What you need to do is generate a new .jmolfile with the set
> defaultdirectory command set to point to inside the .zip file where
> ever you put it.
>
> In theory you could also useJmol.js and the scriptWait() call to do
> the set defaultdirectory from javascript as well.
>
> Hope this gives you some ideas.
>
> Jonathan
>
> On Dec 8, 5:18 pm, Paul Pearson <paultpear...@gmail.com> wrote:
>
> > Dear Jonathan and others,
>
> > I am a webwork developer, though not one of the main developers. I
> > have been successful at displaying a SAGE generated 3d plot from
> > within webwork using theJmolapplet provided that the plot data file
> > uses no pmesh input files. Sage generates a zipped plot data file
> > sage0...stuff...zip which contains a SCRIPT file and may contain
> > several pmesh data files. I am able to getJmolto read the SCRIPT
> > file, but the lines in the SCRIPT file that load the pmesh files are
> > not executing correctly. I have emailed Robert Hanson (the upstream
> >Jmolcontact) about this, and his advice was as follows
>
> > ---------- begin email correspondence --------------------
>
> >Jmolopens and reads selected files within a zip file. To do this,
> > just use "|" to specify directories within the zip file:
>
> > script cylinder-jmol.zip|SCRIPT
>
> > since the other files are in that zip file as well, you also have to
> > indicate a default path:
>
> > set defaultdirectory "cylinder-jmol.zip|"
>
> > Note the vertical line to indicate we want files within the zip file's
> > main directory.
>
> > then when you execute
>
> > script SCRIPT
>
> > it works.
>
> > ---------- end email correspondence ----------------------
>
> > I am guessing that the SAGE developers have already figured out how to
> > make this "defaultdirectory" issue work for zip files in remote
> > directories, and if you would be able to describe to me how you make
> > it work, that would be greatly appreciated. I like your idea of
> > having a single input file forJmolthat is "portable" in the sense
> > that it can be put anywhere, read as input toJmol, and it will work.
> > jmolApplet(["400","400"],"scripthttp://math.webwork.rochester.edu/webwork2_course_files/fall08mth142/...")
> > </script>
>
> > </body>
> > </html>
>
> > --------------------- end html -------------------------
>
> > You should see a closed cylinder with some vectors on the left from
> > the local copy, and a blankJmolapplet (except for the wordJmol) on
> >Jmolapplet jmolApplet1__3128490663424304__ initializing
> > AppletRegistry.checkIn(jmolApplet1__3128490663424304__)
> > AppletRegistry.checkIn(jmolApplet0__3128490663424304__)
> > applet context: -applet
> > appletDocumentBase=file:/C:/Durango/www/Jmol/trial-local.html
> > appletCodeBase=file:/C:/Durango/www/Jmol/
> > applet context: -applet
> > appletDocumentBase=file:/C:/Durango/www/Jmol/trial-local.html
> > appletCodeBase=file:/C:/Durango/www/Jmol/
> > (C) 2008JmolDevelopment
> >JmolVersion 11.6.16 2008-11-24 13:39
> > java.vendor:Sun Microsystems Inc.
> > java.version:1.6.0_17
> > os.name:Windows XP
> > memory:1.7/5.2
> > useCommandThread: false
> > appletId:jmolApplet1__3128490663424304__
> > (C) 2008JmolDevelopment
> >JmolVersion 11.6.16 2008-11-24 13:39
> > java.security.AccessControlException: access denied
> > (java.net.SocketPermission math.webwork.rochester.edu:80
> > connect,resolve)
> > eval ERROR:
> > ----line 1 command 1:
> > script >> "http://math.webwork.rochester.edu/
> > webwork2_course_files/fall08mth142/cylinder-jmol.zip|SCRIPT" <<
>
> > ---------------- end output from Java console -------------------
>
> > Thank you for all of your help.
>
> > Best Regards,
>
> > Paul
>
> > On Dec 6, 4:34 pm, Jonathan <gu...@uwosh.edu> wrote:
>
> > > Paul,
> > > 1) Removing the flicker idea is good. We'll see about implementing
> > > that.
> > > 2) Tell me if the following is what your envision.
> > > *You want a link you can use to download the file generated forJmol
> > > in SAGE.
> > > *You want that file to work in theJmolapplication (or is it the
> > > applet) no matter where you put it.
>
> > > The first part is really easy. The second part is a bit harder. Jmol
> > > can generate this kind of file from loaded data, but we will have to
> > > rewrite the SAGE code that generates the files forJmolto get those
> > > kinds of files on the server. That is why I suggested the signed
> > > applet. Since they are allowed to write to the local disc if the user
> > > agrees, they can take whatever data is in them and generate a file you
> > > can move around. If you are doing this all inside a web application,
> > > there are other ways to do this from javascript. You would just have
> > > to move data generated in javascript to the server. Jmolcan generate
> > > a "state" script, which would point to all the necessary data on the
> > > server (assuming it is the same one, otherwise you have to use the
> > > signed applet). That script is all that would have to be moved into
> > > the homework. The other issue is gettingJmolto behave within the
> > > WebWork framework. I don't know what those requirements are. I know
> > > from discussions with other people that you have to be very careful
> > > when embeddingJmolin things like Moodle and Wiki sites.
>
> > > Jonathan
>
> ...
>
> read more »
Presently we're looking at the best option for a color picker to
adjust the display. If you want to look and comment on that, please
see the links:
1) My testing code without Jmol, mostly designed to play with the look
and feel
2) A simpler version attached to Jmol
Jonathan
> ...
>
> read more »