scriptaculous - updater

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
6 messages Options
Reply | Threaded
Open this post in threaded view
|

scriptaculous - updater

cbeler
Hi again

(1) I use an periodical that displays the time in the banner (always
present) on my app and It seems to me the presence of this priodical
avoid expiration of session ? Am I right ?

(2) Also, I did a manipulation that cancel the updater. If I use an
updater to change a part that contain a peridical, then the periodical
effect is cancelled until a full refresh. I dont 'understand why... if
you have any ideas to avoid loosing the effect or if I did something
wrong ? I joined a sample app that display time and an anchor that
refresh it using ajax.

snippet:
renderContent2On: html

    html paragraph
        script: (html periodical
                frequency: 2 second;
                  on: #renderTimeOn: of: self);
          with: [ self renderTimeOn: html ].
       
    html anchor
        onClick: (html updater
                    id: 'content';
                    on: #renderContent2On: of: self);
        with: 'live refresh'.


Thanks

cédrick




_______________________________________________
Seaside mailing list
[hidden email]
http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside

UpdaterTest.st (1K) Download Attachment
Reply | Threaded
Open this post in threaded view
|

RE: scriptaculous - updater

Ramon Leon-5
> Hi again
>
> (1) I use an periodical that displays the time in the banner (always
> present) on my app and It seems to me the presence of this
> periodical avoid expiration of session ? Am I right ?

Yes.

> (2) Also, I did a manipulation that cancel the updater. If I
> use an updater to change a part that contain a periodical,
> then the periodical effect is cancelled until a full refresh.
> I don't 'understand why... if you have any ideas to avoid
> loosing the effect or if I did something wrong ? I joined a
> sample app that display time and an anchor that refresh it using Ajax.
>
> snippet:
> renderContent2On: html
>
>     html paragraph
>         script: (html periodical
>                 frequency: 2 second;
>                   on: #renderTimeOn: of: self);
>           with: [ self renderTimeOn: html ].
>        
>     html anchor
>         onClick: (html updater
>                     id: 'content';
>                     on: #renderContent2On: of: self);
>         with: 'live refresh'.
>
>
> Thanks
>
> cédrick

Simple fix....

html anchor
    onClick: (html updater
                id: 'content';
                evalScripts: true;
                on: #renderContent2On: of: self);
    with: 'live refresh'.

By default, newly rendered JavaScript from an update, isn't evaluated.

Ramon Leon
http://onsmalltalk.com

_______________________________________________
Seaside mailing list
[hidden email]
http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
Reply | Threaded
Open this post in threaded view
|

Re: scriptaculous - updater

cbeler


Ramon Leon a écrit :
>> Hi again
>>
>> (1) I use an periodical that displays the time in the banner (always
>> present) on my app and It seems to me the presence of this
>> periodical avoid expiration of session ? Am I right ?
>>    
>
> Yes.
>  
ok... can be useful... like in my case but maybe not for others... I
imagine the session are expiring as soon as the web page is closed ?

> Simple fix....
>
> html anchor
>     onClick: (html updater
>                 id: 'content';
>                 evalScripts: true;
>                 on: #renderContent2On: of: self);
>     with: 'live refresh'.
>
> By default, newly rendered JavaScript from an update, isn't evaluated.
>
>  
cool !
I finaly understand what is the purpose of evalScripts... :)

I also aften see #return: in scriptaculous code (updater and evaluator).
Can you explain me the purpose of it... in an example if possible...

Thanks for all

Cédrick

_______________________________________________
Seaside mailing list
[hidden email]
http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
Reply | Threaded
Open this post in threaded view
|

RE: scriptaculous - updater

Ramon Leon-5
> I finally understand what is the purpose of evalScripts... :)
>
> I also aften see #return: in scriptaculous code (updater and
> evaluator).
> Can you explain me the purpose of it... in an example if possible...
>
> Thanks for all
>
> Cédrick

If you say return: fase; the tag with generate like so...

<a href="blabla" onclick="blalba; return false;">link</a>

Canceling the click, preventing the button, link, or whatever from posting
and leaving the page, this can be useful if you want to click an href to
live update a div, for example.

Ramon Leon
http://onsmalltalk.com 

_______________________________________________
Seaside mailing list
[hidden email]
http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
Reply | Threaded
Open this post in threaded view
|

Re: scriptaculous - updater

Jason Johnson-3
In reply to this post by Ramon Leon-5
Ramon Leon wrote:
>> Hi again
>>
>> (1) I use an periodical that displays the time in the banner (always
>> present) on my app and It seems to me the presence of this
>> periodical avoid expiration of session ? Am I right ?
>>    
>
> Yes.

This I find interesting.  Doesn't this mean that if one wanted, one
could make the expiration cache extremely low (e.g. like 30 seconds) and
use something like this to ensure people who keep their browser open
don't lose the session, while not having to waste space on sessions for
people who have already surfed away from the site?  And it should be
fairly simple to make a hidden field in normal html (i.e. not
javascript) that does this autoupdate transparently (well, the user will
see a little blue reload every 10 seconds or so) to support users who
don't have javascript enabled?

Of course it isn't quite this simple.  The reason the session isn't
getting updates may be that the user is surfing a different part of the
site and will come back later via the back button.  But with a little
work I think something like this would be possible.  Right?
_______________________________________________
Seaside mailing list
[hidden email]
http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
Reply | Threaded
Open this post in threaded view
|

RE: scriptaculous - updater

Ramon Leon-5
> This I find interesting.  Doesn't this mean that if one
> wanted, one could make the expiration cache extremely low
> (e.g. like 30 seconds) and use something like this to ensure
> people who keep their browser open don't lose the session,
> while not having to waste space on sessions for people who
> have already surfed away from the site?  And it should be
> fairly simple to make a hidden field in normal html (i.e. not
> javascript) that does this autoupdate transparently (well,
> the user will see a little blue reload every 10 seconds or
> so) to support users who don't have javascript enabled?
>
> Of course it isn't quite this simple.  The reason the session
> isn't getting updates may be that the user is surfing a
> different part of the site and will come back later via the
> back button.  But with a little work I think something like
> this would be possible.  Right?

Yup, I do this for exactly that reason, though I still keep a 10 minute
timeout.  As long as the browser stays open, the session remains active.
You don't even need to render anything to the client.

renderSessionKeepAliveOn: html
    html script: ((html periodical)
        frequency: (self preferenceAt: #sessionExpirySeconds) - 20;
        callback: [Transcript show: 'session touch'; cr];
        yourself)

Ramon Leon
http://onsmalltalk.com 

_______________________________________________
Seaside mailing list
[hidden email]
http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside