[Checkins] SVN: zope3org/trunk/src/zorg/live/ Fixed a timeout bug.
The reload event is now a JSON expr.
Uwe Oestermeier
uwe_oestermeier at iwm-kmrc.de
Sun Apr 9 05:21:49 EDT 2006
Log message for revision 66712:
Fixed a timeout bug. The reload event is now a JSON expr.
Changed:
U zope3org/trunk/src/zorg/live/README.txt
U zope3org/trunk/src/zorg/live/demo/comment/README.txt
U zope3org/trunk/src/zorg/live/demo/comment/templates/comments.pt
U zope3org/trunk/src/zorg/live/page/client.js
U zope3org/trunk/src/zorg/live/page/client.py
U zope3org/trunk/src/zorg/live/page/page.py
-=-
Modified: zope3org/trunk/src/zorg/live/README.txt
===================================================================
--- zope3org/trunk/src/zorg/live/README.txt 2006-04-09 09:20:19 UTC (rev 66711)
+++ zope3org/trunk/src/zorg/live/README.txt 2006-04-09 09:21:49 UTC (rev 66712)
@@ -233,14 +233,10 @@
>>> page2.input('uuid1', event1)
''
-After that the next call of the output returns javascript snippets:
+After that the next call of the output returns JSON event :
- >>> page1.output(uuid='uuid1').pprint()
- html : '<p>42</p>'
- id : 'target'
- name : 'append'
- recipients : 'all'
- where : None
+ >>> page1.output(uuid='uuid1')
+ '{"html": "<p>42</p>", "where": null, "id": "target", "recipients": "all", "name": "append"}'
And this again and again if we provide new input :
@@ -249,12 +245,8 @@
>>> page2.input('uuid1', event2)
''
- >>> page1.output('uuid1').pprint()
- html : '<p>43</p>'
- id : 'target'
- name : 'append'
- recipients : 'all'
- where : None
+ >>> page1.output('uuid1')
+ '{"html": "<p>43</p>", "where": null, "id": "target", "recipients": "all", "name": "append"}'
Modified: zope3org/trunk/src/zorg/live/demo/comment/README.txt
===================================================================
--- zope3org/trunk/src/zorg/live/demo/comment/README.txt 2006-04-09 09:20:19 UTC (rev 66711)
+++ zope3org/trunk/src/zorg/live/demo/comment/README.txt 2006-04-09 09:21:49 UTC (rev 66712)
@@ -76,49 +76,24 @@
send to the clients. Since both clients send events about changing online
states we get four events :
- >>> page1.output('uuid1').pprint()
- html : 'zorg.member.uwe'
- id : 'online'
- name : 'update'
- recipients : 'all'
- where : None
+ >>> page1.output('uuid1')
+ '{"html": "zorg.member.uwe", ... "id": "online", ...
- >>> page1.output('uuid1').pprint()
- html : 'zorg.member.uwe'
- id : 'online'
- name : 'update'
- recipients : 'all'
- where : None
+ >>> page1.output('uuid1')
+ '{"html": "zorg.member.uwe", ... "id": "online", ...
- >>> page2.output('uuid2').pprint()
- html : 'zorg.member.dominik, zorg.member.uwe'
- id : 'online'
- name : 'update'
- recipients : 'all'
- where : None
+ >>> page2.output('uuid2')
+ '{"html": "zorg.member.dominik, zorg.member.uwe", ... "id": "online", ...
- >>> page2.output('uuid2').pprint()
- html : 'zorg.member.dominik, zorg.member.uwe'
- id : 'online'
- name : 'update'
- recipients : 'all'
- where : None
+ >>> page2.output('uuid2')
+ '{"html": "zorg.member.dominik, zorg.member.uwe", ... "id": "online", ...
- >>> page1.output('uuid1').pprint()
- html : 'zorg.member.dominik, zorg.member.uwe'
- id : 'online'
- name : 'update'
- recipients : 'all'
- where : None
+ >>> page1.output('uuid1')
+ '{"html": "zorg.member.dominik, zorg.member.uwe", ... "id": "online", ...
- >>> page1.output('uuid1').pprint()
- html : 'zorg.member.dominik, zorg.member.uwe'
- id : 'online'
- name : 'update'
- recipients : 'all'
- where : None
+ >>> page1.output('uuid1')
+ '{"html": "zorg.member.dominik, zorg.member.uwe", ... "id": "online", ...
-
When the user starts typing, the Ajax textarea observer calls addComment which
broadcasts a new pending comment div that can be appended to the DOM children
of the 'comments' element of each browser client.
@@ -142,13 +117,9 @@
>>> transaction.commit()
>>> out1 = page1.output('uuid1')
- >>> out1.pprint()
- extra : 'scroll'
- html : '<div id="comment1"...'
- id : 'comments'
- name : 'append'
- recipients : 'all'
- where : None
+ >>> out1
+ '{"html": "<div id=\\"comment1...", "where": null, "id": "comments"}'
+
>>> out1 == page2.output('uuid2')
True
Modified: zope3org/trunk/src/zorg/live/demo/comment/templates/comments.pt
===================================================================
--- zope3org/trunk/src/zorg/live/demo/comment/templates/comments.pt 2006-04-09 09:20:19 UTC (rev 66711)
+++ zope3org/trunk/src/zorg/live/demo/comment/templates/comments.pt 2006-04-09 09:21:49 UTC (rev 66712)
@@ -48,7 +48,7 @@
and observe how others are immediately notified about your typing.</p>
<div>List of Comments</div>
- <div id="comments"
+ <div id="comments_area"
style="display: block;
border: 1px solid #CCCCCC;
padding: 2px 4px;
@@ -85,7 +85,7 @@
i18n:attributes="value cancel-comment-button"/>
</div>
</div>
-
+ <div id="event_count">?</div>
</form>
</div>
Modified: zope3org/trunk/src/zorg/live/page/client.js
===================================================================
--- zope3org/trunk/src/zorg/live/page/client.js 2006-04-09 09:20:19 UTC (rev 66711)
+++ zope3org/trunk/src/zorg/live/page/client.js 2006-04-09 09:21:49 UTC (rev 66712)
@@ -7,6 +7,7 @@
userAgent : navigator.userAgent.toLowerCase(),
lastRequest : null,
alreadyEvaluated : {},
+ numSended: 0,
ajaxHandlers : {
onError: function(request, transport) {
@@ -39,7 +40,7 @@
LivePage.Responders.dispatch(name, event);
}
- setTimeout("LivePage.nextEvent()", 500);
+ setTimeout("LivePage.nextEvent()", 35000);
return true;
}
},
@@ -86,7 +87,10 @@
{ method: 'post',
parameters: params
});
-
+ LivePage.numSended += 1;
+ if ($('event_count')) {
+ $('event_count').innerHTML = LivePage.numSended;
+ }
return true;
},
@@ -167,7 +171,8 @@
$(id).innerHTML += html; /* .stripScripts(); */
/* We must eval all scripts again. Arrgh! */
$(id).innerHTML.evalScripts();
- LivePage.getAttention(id, event.extra);
+
+ // LivePage.getAttention($(id).lastChild.id, event.extra);
return;
},
Modified: zope3org/trunk/src/zorg/live/page/client.py
===================================================================
--- zope3org/trunk/src/zorg/live/page/client.py 2006-04-09 09:20:19 UTC (rev 66711)
+++ zope3org/trunk/src/zorg/live/page/client.py 2006-04-09 09:21:49 UTC (rev 66712)
@@ -88,7 +88,7 @@
"""
output = self.nextEvent()
if output :
- return output
+ return output.toJSON()
end = time.time() + self.refreshInterval
while time.time() < end :
Modified: zope3org/trunk/src/zorg/live/page/page.py
===================================================================
--- zope3org/trunk/src/zorg/live/page/page.py 2006-04-09 09:20:19 UTC (rev 66711)
+++ zope3org/trunk/src/zorg/live/page/page.py 2006-04-09 09:21:49 UTC (rev 66712)
@@ -94,9 +94,7 @@
"""
request = self.request
method = Output(self, request).publishTraverse(request, uuid)
- rslt = method()
- #print "---output", rslt
- return rslt
+ return method()
def input(self, uuid, event=None) :
""" Convenience function that accesses a specific client.
More information about the Checkins
mailing list