[Checkins] SVN: Sandbox/pcardune/zobby/src/zobby/ sort of got a
session add form to work with z3c.form
Paul Carduner
paulcarduner at gmail.com
Fri May 4 15:41:35 EDT 2007
Log message for revision 75461:
sort of got a session add form to work with z3c.form
Changed:
A Sandbox/pcardune/zobby/src/zobby/browser/add.pt
U Sandbox/pcardune/zobby/src/zobby/browser/browser.py
U Sandbox/pcardune/zobby/src/zobby/browser/configure.zcml
U Sandbox/pcardune/zobby/src/zobby/configure.zcml
U Sandbox/pcardune/zobby/src/zobby/interfaces.py
A Sandbox/pcardune/zobby/src/zobby/layer.py
A Sandbox/pcardune/zobby/src/zobby/skin/
A Sandbox/pcardune/zobby/src/zobby/skin/__init__.py
A Sandbox/pcardune/zobby/src/zobby/skin/configure.zcml
A Sandbox/pcardune/zobby/src/zobby/skin/template.pt
U Sandbox/pcardune/zobby/src/zobby/zobby.py
-=-
Added: Sandbox/pcardune/zobby/src/zobby/browser/add.pt
===================================================================
--- Sandbox/pcardune/zobby/src/zobby/browser/add.pt 2007-05-04 19:00:01 UTC (rev 75460)
+++ Sandbox/pcardune/zobby/src/zobby/browser/add.pt 2007-05-04 19:41:34 UTC (rev 75461)
@@ -0,0 +1,2 @@
+<h1>Zobby Session Add Form</h1>
+<div metal:use-macro="macro:form" />
Property changes on: Sandbox/pcardune/zobby/src/zobby/browser/add.pt
___________________________________________________________________
Name: svn:eol-style
+ native
Modified: Sandbox/pcardune/zobby/src/zobby/browser/browser.py
===================================================================
--- Sandbox/pcardune/zobby/src/zobby/browser/browser.py 2007-05-04 19:00:01 UTC (rev 75460)
+++ Sandbox/pcardune/zobby/src/zobby/browser/browser.py 2007-05-04 19:41:34 UTC (rev 75461)
@@ -1,38 +1,33 @@
from zif.jsonserver.jsonrpc import MethodPublisher
+from zope.traversing.browser import absoluteURL
+from z3c.formui import layout
+from z3c.form import form, field, button
+
from zobby import zobby
+from zobby import interfaces
+class SessionAddForm(layout.AddFormLayoutSupport, form.AddForm):
+ """An add form for the zobby application."""
-## class ZobbyApplicationAddForm(form.AddForm):
-## """An add form for the zobby application."""
+ layout = None
+ contentName = None
+ label = u'Add Zobby Session'
-## template = None
-## layout = None
-## contentName = None
-## label = u'Add Zobby Application'
+ fields = field.Fields(interfaces.ISession).omit('chatMessages')
-## fields = field.Fields()
+ def create(self, data):
+ return zobby.Session(**data)
-## def create(self, data):
-## return zobby.ZobbyApplication(**data)
+ def add(self, object):
+ self._name = object.title
+ self.context[object.title] = object
+ return object
-## def add(self, object):
-## self._name = object.title
-## self.context[object.title] = object
+ def nextURL(self):
+ return absoluteURL(self.context[self._name], self.request)
-## def nextURL(self):
-## return absoluteURL(self.context[self._name], self.request)
-## def __call__(self):
-## self.update()
-## if self._finishedAdd:
-## self.request.response.redirect(self.nextURL())
-## return ''
-## layout = zope.component.getMultiAdapter((self, self.request),
-## ILayoutTemplate)
-## return layout(self)
-
-
class ZobbyHandler(MethodPublisher):
"""simple json-rpc view class with two methods"""
Modified: Sandbox/pcardune/zobby/src/zobby/browser/configure.zcml
===================================================================
--- Sandbox/pcardune/zobby/src/zobby/browser/configure.zcml 2007-05-04 19:00:01 UTC (rev 75460)
+++ Sandbox/pcardune/zobby/src/zobby/browser/configure.zcml 2007-05-04 19:41:34 UTC (rev 75461)
@@ -1,9 +1,27 @@
-<configure xmlns:jsonrpc="http://namespaces.zope.org/jsonrpc"
- xmlns="http://namespaces.zope.org/browser"
- xmlns:help="http://namespaces.zope.org/help"
- i18n_domain="zope"
- >
+<configure
+ xmlns="http://namespaces.zope.org/browser"
+ xmlns:jsonrpc="http://namespaces.zope.org/jsonrpc"
+ xmlns:help="http://namespaces.zope.org/help"
+ xmlns:z3c="http://namespaces.zope.org/z3c"
+ i18n_domain="zobby"
+ >
+ <!-- Add Forms -->
+
+ <z3c:pagelet
+ name="addSession.html"
+ for="zobby.interfaces.IZobbyApplication"
+ class=".browser.SessionAddForm"
+ permission="zope.Public"
+ layer="zobby.layer.IZobbyBrowserLayer"
+ />
+
+ <z3c:template
+ template="add.pt"
+ for=".browser.SessionAddForm"
+ layer="zobby.layer.IZobbyBrowserLayer"
+ />
+
<addform
label="Add Zobby"
name="addZobby.html"
Modified: Sandbox/pcardune/zobby/src/zobby/configure.zcml
===================================================================
--- Sandbox/pcardune/zobby/src/zobby/configure.zcml 2007-05-04 19:00:01 UTC (rev 75460)
+++ Sandbox/pcardune/zobby/src/zobby/configure.zcml 2007-05-04 19:41:34 UTC (rev 75461)
@@ -15,6 +15,14 @@
set_schema=".interfaces.ISession" />
</class>
+
+ <!-- zobby layer -->
+ <interface
+ interface="zobby.layer.IZobbyBrowserLayer"
+ type="zope.publisher.interfaces.browser.IBrowserSkinType"
+ />
+
+ <include package=".skin" />
<include package=".browser" />
</configure>
\ No newline at end of file
Modified: Sandbox/pcardune/zobby/src/zobby/interfaces.py
===================================================================
--- Sandbox/pcardune/zobby/src/zobby/interfaces.py 2007-05-04 19:00:01 UTC (rev 75460)
+++ Sandbox/pcardune/zobby/src/zobby/interfaces.py 2007-05-04 19:41:34 UTC (rev 75461)
@@ -1,5 +1,6 @@
from zope.interface import Interface, Attribute
from zope.app.container.interfaces import IContainer
+from zope import schema
class IZobbyApplication(IContainer):
"""A Zobby Session."""
@@ -15,7 +16,17 @@
class ISession(IContainer):
"""A zobby session.... contains documents"""
- chatMessages = Attribute("chat messages")
+ chatMessages = schema.List(
+ title=u"chatMessages",
+ required=True)
+ title = schema.TextLine(
+ title=u"Title",
+ required=False)
+
+ description = schema.TextLine(
+ title=u"Short Description",
+ required=False)
+
def addChatMessage(message):
"""Add a message to the chat."""
Added: Sandbox/pcardune/zobby/src/zobby/layer.py
===================================================================
--- Sandbox/pcardune/zobby/src/zobby/layer.py 2007-05-04 19:00:01 UTC (rev 75460)
+++ Sandbox/pcardune/zobby/src/zobby/layer.py 2007-05-04 19:41:34 UTC (rev 75461)
@@ -0,0 +1,6 @@
+from z3c.form.interfaces import IFormLayer
+from z3c.formui.interfaces import IDivFormLayer
+from z3c.layer.pagelet import IPageletBrowserLayer
+
+class IZobbyBrowserLayer(IDivFormLayer, IFormLayer, IPageletBrowserLayer):
+ """Like IMinimalBrowserLayer including widget layer."""
Property changes on: Sandbox/pcardune/zobby/src/zobby/layer.py
___________________________________________________________________
Name: svn:eol-style
+ native
Added: Sandbox/pcardune/zobby/src/zobby/skin/__init__.py
===================================================================
--- Sandbox/pcardune/zobby/src/zobby/skin/__init__.py 2007-05-04 19:00:01 UTC (rev 75460)
+++ Sandbox/pcardune/zobby/src/zobby/skin/__init__.py 2007-05-04 19:41:34 UTC (rev 75461)
@@ -0,0 +1,10 @@
+from zope.viewlet.interfaces import IViewletManager
+from zope.viewlet.viewlet import CSSViewlet
+from zope.viewlet.viewlet import JavaScriptViewlet
+from z3c.pagelet import browser
+from z3c.formui import interfaces
+
+import zobby.layer
+
+class IZobbyBrowserSkin(zobby.layer.IZobbyBrowserLayer):
+ """The ``Zobby`` browser skin."""
Property changes on: Sandbox/pcardune/zobby/src/zobby/skin/__init__.py
___________________________________________________________________
Name: svn:eol-style
+ native
Added: Sandbox/pcardune/zobby/src/zobby/skin/configure.zcml
===================================================================
--- Sandbox/pcardune/zobby/src/zobby/skin/configure.zcml 2007-05-04 19:00:01 UTC (rev 75460)
+++ Sandbox/pcardune/zobby/src/zobby/skin/configure.zcml 2007-05-04 19:41:34 UTC (rev 75461)
@@ -0,0 +1,21 @@
+<configure
+ xmlns:zope="http://namespaces.zope.org/zope"
+ xmlns="http://namespaces.zope.org/browser"
+ xmlns:z3c="http://namespaces.zope.org/z3c"
+ i18n_domain="zobby">
+
+ <!-- zobby skin -->
+ <zope:interface
+ interface="zobby.skin.IZobbyBrowserSkin"
+ type="zope.publisher.interfaces.browser.IBrowserSkinType"
+ name="ZobbySkin"
+ />
+
+ <!-- layout template -->
+ <z3c:layout
+ for="*"
+ layer="zobby.layer.IZobbyBrowserLayer"
+ template="template.pt"
+ />
+
+</configure>
\ No newline at end of file
Property changes on: Sandbox/pcardune/zobby/src/zobby/skin/configure.zcml
___________________________________________________________________
Name: svn:eol-style
+ native
Added: Sandbox/pcardune/zobby/src/zobby/skin/template.pt
===================================================================
--- Sandbox/pcardune/zobby/src/zobby/skin/template.pt 2007-05-04 19:00:01 UTC (rev 75460)
+++ Sandbox/pcardune/zobby/src/zobby/skin/template.pt 2007-05-04 19:41:34 UTC (rev 75461)
@@ -0,0 +1,25 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"
+ i18n:domain="z3c.formdemo">
+ <head>
+ <title>Zobby</title>
+ <script type="text/javascript" src="/++resource++jsolait/jsolait.js"></script>
+ <script type="text/javascript" src="/@@/z3c.javascript.jquery/jquery.js"></script>
+ <script type="text/javascript" src="/++resource++client.js"></script>
+ <link rel="stylesheet" href="/++resource++zobby.css" type="text/css">
+ <meta http-equiv="Content-Type" content="text/html;charset=utf-8" />
+ <meta http-equiv="cache-control" content="no-cache" />
+ <meta http-equiv="pragma" content="no-cache" />
+ </head>
+ <body>
+ <div id="wrapper">
+ <div id="insideWrapper">
+ <h1 id="header">
+ <img src="/++resource++zobby.png" />
+ </h1>
+ <h4 id="subheader"><u>The</u> web based collaborative editor.</h4>
+ <tal:block replace="structure provider:pagelet" />
+ </div>
+ </div>
+ </body>
+</html>
Property changes on: Sandbox/pcardune/zobby/src/zobby/skin/template.pt
___________________________________________________________________
Name: svn:eol-style
+ native
Modified: Sandbox/pcardune/zobby/src/zobby/zobby.py
===================================================================
--- Sandbox/pcardune/zobby/src/zobby/zobby.py 2007-05-04 19:00:01 UTC (rev 75460)
+++ Sandbox/pcardune/zobby/src/zobby/zobby.py 2007-05-04 19:41:34 UTC (rev 75461)
@@ -2,6 +2,7 @@
from persistent.list import PersistentList
from zope.interface import implements
from zope.app.container import btree
+from zope.schema.fieldproperty import FieldProperty
import interfaces
@@ -27,8 +28,13 @@
"""a Zobby Session."""
implements(interfaces.ISession)
- def __init__(self):
+ title = FieldProperty(interfaces.ISession['title'])
+ description = FieldProperty(interfaces.ISession['description'])
+
+ def __init__(self, title=u"Zobby Session", description=u"Default Description"):
super(Session, self).__init__()
+ self.title = title
+ self.description = description
self.chatMessages = PersistentList()
def addChatMessage(self, message):
More information about the Checkins
mailing list