Author: fschulze
Date: Wed Nov 16 09:48:25 2005
New Revision: 1828

Added:
   azax/trunk/demos/azaxdemo/browser/azax_three_autoupdate.azax
   azax/trunk/demos/azaxdemo/browser/azax_three_autoupdate.pt
Modified:
   azax/trunk/demos/azaxdemo/azaxview.py
   azax/trunk/demos/azaxdemo/browser/azax_demo_index.pt
   azax/trunk/demos/azaxdemo/configure.zcml
Log:
Added third demo which should automatically update it's content. It's not 
finished yet, as we have to add a new event handler for timers.

Modified: azax/trunk/demos/azaxdemo/azaxview.py
==============================================================================
--- azax/trunk/demos/azaxdemo/azaxview.py       (original)
+++ azax/trunk/demos/azaxdemo/azaxview.py       Wed Nov 16 09:48:25 2005
@@ -21,6 +21,7 @@
 from Products.Five import BrowserView
 
 from Products.azax.azaxresponse import AzaxResponse
+from datetime import datetime
 
 class AzaxView(BrowserView):
 
@@ -70,3 +71,10 @@
         return_object.setHtmlAsChild('select#second', ' '.join(result))
         return return_object()
 
+    def getCurrentTime(self):
+        """ returns the current time """
+        return_object = AzaxResponse(self.request.response)
+        return_object.setHtmlAsChild('div#update-area', "<p>%s</p>" % 
str(datetime.now()))
+        result = return_object()
+        print result
+        return result

Modified: azax/trunk/demos/azaxdemo/browser/azax_demo_index.pt
==============================================================================
--- azax/trunk/demos/azaxdemo/browser/azax_demo_index.pt        (original)
+++ azax/trunk/demos/azaxdemo/browser/azax_demo_index.pt        Wed Nov 16 
09:48:25 2005
@@ -5,6 +5,7 @@
     <ul>
      <li><a href="demo1.html">Change tag content</a></li>
      <li><a href="two_selects.html">Two selects</a></li>
+     <li><a href="three_autoupdate.html">Three autoupdate</a></li>
     </ul>
   </body>
 </html>

Added: azax/trunk/demos/azaxdemo/browser/azax_three_autoupdate.azax
==============================================================================
--- (empty file)
+++ azax/trunk/demos/azaxdemo/browser/azax_three_autoupdate.azax        Wed Nov 
16 09:48:25 2005
@@ -0,0 +1,8 @@
+<?xml version="1.0"?>
+<styles>
+  <style>
+    <selector>div#update-area</selector>
+    <event>click</event>
+    <action>getCurrentTime</action>
+  </style>
+</styles>

Added: azax/trunk/demos/azaxdemo/browser/azax_three_autoupdate.pt
==============================================================================
--- (empty file)
+++ azax/trunk/demos/azaxdemo/browser/azax_three_autoupdate.pt  Wed Nov 16 
09:48:25 2005
@@ -0,0 +1,45 @@
+<html>
+  <head>
+    <link rel="azax"
+          tal:attributes="href 
string:${context/absolute_url}/++resource++azax_three_autoupdate.azax"/>
+    <script type="text/javascript"
+      tal:attributes="src 
string:${context/absolute_url}/++resource++sarissa.js;"
+      src="++resource++sarissa.js">
+    </script>
+    <script type="text/javascript"
+      tal:attributes="src 
string:${context/absolute_url}/++resource++cssQuery.js;"
+      src="++resource++cssQuery.js">
+    </script>
+    <script type="text/javascript"
+      tal:attributes="src string:${context/absolute_url}/++resource++azax.js;"
+      src="++resource++azax.js">
+    </script>
+    <style type="text/css">
+        #update-area {
+            border: 1px solid black;
+            width: 10em;
+            height: 10em;
+        }
+    </style>
+    <script type="text/javascript">
+        /*
+        function handleTimeout() {
+            element = document.getElementById("update-area");
+            element.click()
+            setTimeout("handleTimeout();", 500);
+        }
+        window.onload = function () {
+            setTimeout("handleTimeout();", 500);
+        }
+        */
+    </script>
+  </head>
+  <body>
+    <p><a href=".">All demos</a></p>
+    <h2>Three autoupdate</h2>
+
+<h3>Demo</h3>
+    <div id="update-area">
+    </div>
+  </body>
+</html>

Modified: azax/trunk/demos/azaxdemo/configure.zcml
==============================================================================
--- azax/trunk/demos/azaxdemo/configure.zcml    (original)
+++ azax/trunk/demos/azaxdemo/configure.zcml    Wed Nov 16 09:48:25 2005
@@ -108,4 +108,25 @@
       permission="zope2.View"
       />
 
+  <!-- three autoupdate content -->
+  <browser:page
+      for=".interfaces.ISimpleContent"
+      template="browser/azax_three_autoupdate.pt"
+      name="three_autoupdate.html"
+      permission="zope2.View"
+      />
+
+  <browser:resource
+    file="browser/azax_three_autoupdate.azax"
+    name="azax_three_autoupdate.azax"
+  />
+
+  <browser:page
+      for=".interfaces.ISimpleContent"
+      class=".azaxview.AzaxView"
+      attribute="getCurrentTime"
+      name="getCurrentTime"
+      permission="zope2.View"
+      />
+
 </configure>
-- 
http://lists.nuxeo.com/mailman/listinfo/z3lab-checkins

Reply via email to