Hi Bob
Good to have this overview.
Maybe I'm missing it, but in my impression, a third way would be as I described to use the Jmol File menue, and then the "Save Script with State" function. We believe, the common behavior a user expects is that the user can save a state, as some kind of input file for a calculation, on his local machine. This works nicely with the above function, combined with later using "Open File or URL".

Following your conventions, it would mean

(c) "restore from a previous session using data saved on the client"

Looking forward to anything that can be added to this aspect.
Martin



On 15.06.12 12:30, Robert Hanson wrote:
Martin,

I can't remember if you mean

(a) "restore from a few minutes ago within this session" or
(b) "restore from a previous session using data saved on the server"

So I will use this opportunity to discuss different ways to save the state, some of which are very new and only a couple of us are aware of.


(a) "restore from a few minutes ago within this session"

This is trivial. All within Jmol. This works for all versions of Jmol:
:

save state xxx

restore state xxx


(b) "restore from a previous session using data saved on the server" and using 12.3:

Option 1. Slicker-than-ice new method

WITHIN Jmol we will post the entire state to the server, including all necessary files to restore the state, in PNGJ format. That is, Jmol basically does its own AJAX to deliver a PNGJ file to its server. You can do this with the signed or unsigned applet. The load command is used so that we can confirm that the upload was successful.

print load("myserverurl.xxxx/xxxx?POST?_PNGJ_")

That is really the slickest way to go, because you get an image that you can check. You have to have a server-side app that can accept a post. The variable will be server POST variable will be "_PNGJ_" and it's value will be a base64-encoded image. Server should return something like "OK". If this is your interest, talk with me, because I just realized we could easily just send the entire state in binary format and make this one step simpler. I like this option because on the server you get an image that can be delivered straight back to a client either as an image or as a Jmol model. This option is Jmol 12.3.30-only. Use the files in http://chemapps.stolaf.edu/jmol/Jmol-12.zip

Option 2: Just the state to server, no files:

If you know the files are always available (remote or from your site) and you do not want to save a full PNGJ state, you can just use this to save the Jmol state script:

print load("myserverurl/saveJmolState.php?POST?state=" + getProperty("stateInfo"))

For either of these options you would have to figure out how to restore the state from your server using something like this within Jmol:

script "myserverurl/restoreJmolState.php?....."

and have the server either return the state script or the PNGJ file.

Bob


On Fri, Jun 15, 2012 at 3:16 AM, Martin Hediger <[email protected] <mailto:[email protected]>> wrote:

    Hi Bob, thanks for your answer.
    First of all, my question would be what's the best way to restore
    the state?
    Second, 1.1 and 2.1 are rotatable. 3.1 not.
    I'm trying to do it with the signed applet (useing save script
    with state) and it seems to work, but I'm highly suscpicious about
    anything that works just that easily.

    Martin






    On 13.06.12 23:53, Robert Hanson wrote:
    allowRotateSelected is for all models, right? Not specific to a
    specific model, I think.

    If models have been rotated using allowRotateSelected, it means
    that their atom positions have changed. This will be reflected in
    the state, so I imagine everything should be fine when you
    restore the state from disk.

    Have you seen a problem with that?

    Bob

    On Wed, Jun 13, 2012 at 1:53 PM, Martin Hediger
    <[email protected] <mailto:[email protected]>> wrote:

        Dear Jmol Developers
        I'm working on our application and I require to enable the
        user to
        restore a previous Jmol session. In the applet, three models
        are loaded,
        for two of which "allowRotateSelected" is enabled. That means
        when the
        user restores a session, the orientation of the two rotatable
        models
        (1.1 and 2.1) should also be restored.

        How should this be done?

        Thanks for your input
        Martin

        
------------------------------------------------------------------------------
        Live Security Virtual Conference
        Exclusive live event will cover all the ways today's security and
        threat landscape has changed and how IT managers can respond.
        Discussions
        will include endpoint security, mobile security and the
        latest in malware
        threats.
        http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
        _______________________________________________
        Jmol-users mailing list
        [email protected]
        <mailto:[email protected]>
        https://lists.sourceforge.net/lists/listinfo/jmol-users




-- Robert M. Hanson
    Larson-Anderson Professor of Chemistry
    Chair, Chemistry Department
    St. Olaf College
    Northfield, MN
    http://www.stolaf.edu/people/hansonr


    If nature does not answer first what we want,
    it is better to take what answer we get.

    -- Josiah Willard Gibbs, Lecture XXX, Monday, February 5, 1900




    
------------------------------------------------------------------------------
    Live Security Virtual Conference
    Exclusive live event will cover all the ways today's security and
    threat landscape has changed and how IT managers can respond. Discussions
    will include endpoint security, mobile security and the latest in malware
    threats.http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/


    _______________________________________________
    Jmol-users mailing list
    [email protected]  <mailto:[email protected]>
    https://lists.sourceforge.net/lists/listinfo/jmol-users

    
------------------------------------------------------------------------------
    Live Security Virtual Conference
    Exclusive live event will cover all the ways today's security and
    threat landscape has changed and how IT managers can respond.
    Discussions
    will include endpoint security, mobile security and the latest in
    malware
    threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
    _______________________________________________
    Jmol-users mailing list
    [email protected]
    <mailto:[email protected]>
    https://lists.sourceforge.net/lists/listinfo/jmol-users




--
Robert M. Hanson
Larson-Anderson Professor of Chemistry
Chair, Chemistry Department
St. Olaf College
Northfield, MN
http://www.stolaf.edu/people/hansonr


If nature does not answer first what we want,
it is better to take what answer we get.

-- Josiah Willard Gibbs, Lecture XXX, Monday, February 5, 1900




------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and
threat landscape has changed and how IT managers can respond. Discussions
will include endpoint security, mobile security and the latest in malware
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/


_______________________________________________
Jmol-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/jmol-users
------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and 
threat landscape has changed and how IT managers can respond. Discussions 
will include endpoint security, mobile security and the latest in malware 
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
_______________________________________________
Jmol-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/jmol-users

Reply via email to