Dear Jonathan, 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. > > However, I also think that there ought to be a way to make the current > > system of zip files work (even though I haven't fully figured it out > > yet). > > > I have been able to get things to work correctly when loading the zip > > file locally (from my own computer) but not remotely (from the webwork > > server). Here's what I have done. Get the zip file with the SCRIPT > > and pmesh files from > > >http://math.webwork.rochester.edu/webwork2_course_files/fall08mth142/... > > > and save it to a local directory that contains "Jmol.js" and > > "JmolApplet.jar". Notice that the first line of the SCRIPT file was > > added by me and uses verbatim the advice from Robert Hanson about > > setting the default directory. Create a html file in that same local > > directory with the following code: > > > ------------------- begin html ---------------------------- > > > <html> > > <head> > > <script type="text/javascript" src="Jmol.js"></script> > > </head> > > <body> > > <!-- > > <script> > > jmolInitialize(".",useSignedApplet) > > </script> > > --> > > > <!-- read cylinder-jmol.zip locally --> > > <script type="text/javascript"> > > jmolApplet(["450","450"],"script cylinder-jmol.zip|SCRIPT") > > </script> > > > <!-- read cylinder-jmol.zip remotely --> > > <script type="text/javascript"> > > jmolSetAppletColor("white"); > > 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 > > the right from the remote copy. The output from the Java Console is > > given below, in case you're interested in tracing the errors. > > > ---------------------------------------- begin output from Java > > Console ----------------------- > > > Java Plug-in 1.6.0_17 > > Using JRE version 1.6.0_17-b04 Java HotSpot(TM) Client VM > > User home directory = C:\Documents and Settings\Pearson_p > > ---------------------------------------------------- > > c: clear console window > > f: finalize objects on finalization queue > > g: garbage collect > > h: display this help message > > l: dump classloader list > > m: print memory usage > > o: trigger logging > > q: hide console > > r: reload policy configuration > > s: dump system and deployment properties > > t: dump thread list > > v: dump thread stack > > x: clear classloader cache > > 0-5: set trace level to <n> > > ---------------------------------------------------- > > > urlImage=jar:file:/C:/Durango/www/Jmol/JmolApplet.jar!/jmol75x29x8.gif > > urlImage=jar:file:/C:/Durango/www/Jmol/JmolApplet.jar!/jmol75x29x8.gif > >Jmolapplet jmolApplet0__3128490663424304__ initializing > >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.vendor:Sun Microsystems Inc. > > java.version:1.6.0_17 > > os.name:Windows XP > > memory:1.7/5.2 > > useCommandThread: false > > appletId:jmolApplet0__3128490663424304__ > > defaults = "Jmol" > > defaults = "Jmol" > > backgroundColor = "white" > > backgroundColor = "white" > > language=en_US > > language=en_US > > FileManager > > openinghttp://math.webwork.rochester.edu/webwork2_course_files/fall08mth142/... > > FileManager opening file:/C:/Durango/www/Jmol/cylinder-jmol.zip > > FileManager.openStringInline() > > The Resolver thinks Xyz > > ModelSet: haveSymmetry:false haveUnitcells:false > > haveFractionalCoord:false > > 1 model in this collection. Use getProperty "modelInfo" or getProperty > > "auxiliaryInfo" to inspect them. > > ModelSet: autobonding; use autobond=false to not generate bonds > > automatically > > data "model list" > > 13 > > empty > > Xx 0.0 -6.0 -6.0 > > Xx 6.0 0.0 -6.0 > > Xx -6.0 -6.0 0.0 > > Xx -6.0 -7.0 -6.0 > > Xx 0.0 -7.0 -6.0 > > Xx 6.0 -7.0 -6.0 > > Xx 7.0 -6.0 -6.0 > > Xx 7.0 0.0 -6.0 > > Xx 7.0 6.0 -6.0 > > Xx -7.0 -6.0 -6.0 > > Xx -7.0 -6.0 0.0 > > Xx -7.0 -6.0 6.0 > > Xx 5.5 5.5 5.5 > > > end "model list"; > > FileManager opening file:/C:/Durango/www/Jmol/cylinder-jmol.zip > > reading pmesh data from file:/C:/Durango/www/Jmol/cylinder-jmol.zip| > > obj_264530.pmesh > > FileManager opening file:/C:/Durango/www/Jmol/cylinder-jmol.zip > > reading pmesh data from file:/C:/Durango/www/Jmol/cylinder-jmol.zip| > > obj_878432.pmesh > > FileManager opening file:/C:/Durango/www/Jmol/cylinder-jmol.zip > > reading pmesh data from file:/C:/Durango/www/Jmol/cylinder-jmol.zip| > > obj_877928.pmesh > > script ERROR: io error > > readinghttp://math.webwork.rochester.edu/webwork2_course_files/fall08mth142/... > > 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 »
-- You received this message because you are subscribed to the Google Groups "sage-edu" group. To post to this group, send email to sage-...@googlegroups.com. To unsubscribe from this group, send email to sage-edu+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/sage-edu?hl=en.