Author: jmorliaguet
Date: Wed Mar 15 23:19:00 2006
New Revision: 2644

Added:
   
cpsskins/branches/jmo-perspectives/ui/framework/tests/zope3/functional/panels/
   
cpsskins/branches/jmo-perspectives/ui/framework/tests/zope3/functional/panels/__init__.py
   (contents, props changed)
   
cpsskins/branches/jmo-perspectives/ui/framework/tests/zope3/functional/panels/configure.zcml
   (contents, props changed)
   
cpsskins/branches/jmo-perspectives/ui/framework/tests/zope3/functional/panels/cpsskins_panels.pt
   (contents, props changed)
   
cpsskins/branches/jmo-perspectives/ui/framework/tests/zope3/functional/panels/form.pt
   (contents, props changed)
   
cpsskins/branches/jmo-perspectives/ui/framework/tests/zope3/functional/panels/views.py
   (contents, props changed)
Modified:
   
cpsskins/branches/jmo-perspectives/ui/framework/tests/zope3/functional/configure.zcml
Log:

- demo of form submission and redirection without reloading the page.



Modified: 
cpsskins/branches/jmo-perspectives/ui/framework/tests/zope3/functional/configure.zcml
==============================================================================
--- 
cpsskins/branches/jmo-perspectives/ui/framework/tests/zope3/functional/configure.zcml
       (original)
+++ 
cpsskins/branches/jmo-perspectives/ui/framework/tests/zope3/functional/configure.zcml
       Wed Mar 15 23:19:00 2006
@@ -14,4 +14,6 @@
 
   <include package=".treeview" />
 
+  <include package=".panels" />
+
 </configure>

Added: 
cpsskins/branches/jmo-perspectives/ui/framework/tests/zope3/functional/panels/__init__.py
==============================================================================
--- (empty file)
+++ 
cpsskins/branches/jmo-perspectives/ui/framework/tests/zope3/functional/panels/__init__.py
   Wed Mar 15 23:19:00 2006
@@ -0,0 +1 @@
+#

Added: 
cpsskins/branches/jmo-perspectives/ui/framework/tests/zope3/functional/panels/configure.zcml
==============================================================================
--- (empty file)
+++ 
cpsskins/branches/jmo-perspectives/ui/framework/tests/zope3/functional/panels/configure.zcml
        Wed Mar 15 23:19:00 2006
@@ -0,0 +1,34 @@
+<configure
+    xmlns:browser="http://namespaces.zope.org/browser";>
+
+  <browser:pages
+      for="*"
+      layer="cpsskins.ui.framework.tests.zope3.cpsskinsTest"
+      permission="zope.Public">
+
+    <page
+      name="cpsskins_panels.html"
+      template="cpsskins_panels.pt"
+    />
+
+    <page
+      name="panels-form.html"
+      template="form.pt"
+    />
+
+  </browser:pages>
+
+  <browser:pages
+      for="*"
+      layer="cpsskins.ui.framework.tests.zope3.cpsskinsTest"
+      permission="zope.Public"
+      class=".views.FormAction">
+
+    <page
+        name="doSomething"
+        attribute="doSomething"
+    />
+
+  </browser:pages>
+
+</configure>

Added: 
cpsskins/branches/jmo-perspectives/ui/framework/tests/zope3/functional/panels/cpsskins_panels.pt
==============================================================================
--- (empty file)
+++ 
cpsskins/branches/jmo-perspectives/ui/framework/tests/zope3/functional/panels/cpsskins_panels.pt
    Wed Mar 15 23:19:00 2006
@@ -0,0 +1,83 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd";>
+<html xml:lang="en" lang="en"
+      xmlns="http://www.w3.org/1999/xhtml";>
+<head>
+  <title>CPSSkins Panels</title>
+  <meta http-equiv="content-type" content="text/html; charset=utf-8" />
+  <script src="/++skin++cpsskins/@@/++resource++prototype.js"
+          type="text/javascript"></script>
+  <script src="/++skin++cpsskins/@@/++resource++json.js"
+          type="text/javascript"></script>
+  <script src="/++skin++cpsskins/@@/++resource++ctal.js"
+          type="text/javascript"></script>
+  <script src="/++skin++cpsskins/@@/++resource++cpsskins.js"
+          type="text/javascript"></script>
+
+  <style type="text/css">
+  div.box {
+    padding: 0.8em;
+    border: 1px solid #fc0;
+    background-color: #ffc;
+    width: 200px;
+    font: 13px verdana, sans-serif;
+  }
+  </style>
+
+</head>
+<body>
+
+  <h1>CPSSkins Panels with form submission</h1>
+
+  <p>The panel shown below has a form controller attached to it. When the user
+  clicks on the "click me!" button a remote call is done to the server which 
+  performs some action with the form data and returns a new url for the panel.
+  </p>
+  <p>This makes it possible to perform a form submission with a redirection 
+  inside a given area of a page without reloading the entire page.
+  </p>
+
+  <ins class="model">
+  {"id": "panel",
+   "storage": {
+     "type": "remote",
+     "accessors": {
+       "set": "@@doSomething"
+     }
+   },
+   "data": {
+     "url": "@@panels-form.html"
+  }}
+  </ins>
+
+  <div class="box">
+    <ins class="view">
+    {"id": "panel-view",
+     "model": "panel",
+     "perspectives": ["default"],
+     "controllers": ["show-panel", "form"],
+     "widget": {
+       "type": "panel"
+     },
+     "render_effect": {
+       "transition": "fadein",
+       "duration": 500
+    }}
+    </ins>
+  </div>
+
+  <ins class="controller">
+  {"id": "form",
+   "type": "form"
+  }
+  </ins>
+
+  <ins class="controller">
+  {"id": "show-panel",
+   "type": "perspective selector",
+   "initial": "default"
+  }
+  </ins>
+
+</body>
+</html>

Added: 
cpsskins/branches/jmo-perspectives/ui/framework/tests/zope3/functional/panels/form.pt
==============================================================================
--- (empty file)
+++ 
cpsskins/branches/jmo-perspectives/ui/framework/tests/zope3/functional/panels/form.pt
       Wed Mar 15 23:19:00 2006
@@ -0,0 +1,13 @@
+<form action="" method="get" onsubmit="return false"
+  tal:define="updated request/form/updated|nothing">
+
+  <p tal:condition="not:updated">
+    <span>Update the box ...</span>
+    <button type="submit">Click me!</button>
+  </p>
+
+  <p tal:condition="updated">
+    I have just been updated!
+  </p>
+
+</form>

Added: 
cpsskins/branches/jmo-perspectives/ui/framework/tests/zope3/functional/panels/views.py
==============================================================================
--- (empty file)
+++ 
cpsskins/branches/jmo-perspectives/ui/framework/tests/zope3/functional/panels/views.py
      Wed Mar 15 23:19:00 2006
@@ -0,0 +1,9 @@
+
+from zope.app.publisher.browser import BrowserView
+
+from cpsskins import minjson as json
+
+class FormAction(BrowserView):
+
+    def doSomething(self, updated=0):
+        return json.write({'url': '@@panels-form.html?updated=1'})
-- 
http://lists.nuxeo.com/mailman/listinfo/z3lab-checkins

Reply via email to