[Checkins] SVN: z3ext.layoutform/trunk/ - Added default css styles

Nikolay Kim fafhrd at datacom.kz
Sun Oct 5 15:37:29 EDT 2008


Log message for revision 91785:
  - Added default css styles
  
  - Removed z3c packages dependencies
  
  - Use pagelets instead of macros
  
  

Changed:
  U   z3ext.layoutform/trunk/CHANGES.txt
  U   z3ext.layoutform/trunk/setup.py
  U   z3ext.layoutform/trunk/src/z3ext/layoutform/add.py
  U   z3ext.layoutform/trunk/src/z3ext/layoutform/browser/configure.zcml
  A   z3ext.layoutform/trunk/src/z3ext/layoutform/browser/form.css
  U   z3ext.layoutform/trunk/src/z3ext/layoutform/browser/form.pt
  U   z3ext.layoutform/trunk/src/z3ext/layoutform/browser/formadd.pt
  A   z3ext.layoutform/trunk/src/z3ext/layoutform/browser/formaddbuttons.pt
  A   z3ext.layoutform/trunk/src/z3ext/layoutform/browser/formbuttons.pt
  U   z3ext.layoutform/trunk/src/z3ext/layoutform/browser/formedit.pt
  U   z3ext.layoutform/trunk/src/z3ext/layoutform/browser/formgroup.pt
  A   z3ext.layoutform/trunk/src/z3ext/layoutform/browser/formview.pt
  A   z3ext.layoutform/trunk/src/z3ext/layoutform/browser/formviewspace.pt
  A   z3ext.layoutform/trunk/src/z3ext/layoutform/browser/interfaces.py
  A   z3ext.layoutform/trunk/src/z3ext/layoutform/browser/linkOpaque.gif
  A   z3ext.layoutform/trunk/src/z3ext/layoutform/browser/linkTransparent.gif
  A   z3ext.layoutform/trunk/src/z3ext/layoutform/browser/required.gif
  U   z3ext.layoutform/trunk/src/z3ext/layoutform/browser/subform.pt
  A   z3ext.layoutform/trunk/src/z3ext/layoutform/browser/widget.pt
  U   z3ext.layoutform/trunk/src/z3ext/layoutform/edit.py
  U   z3ext.layoutform/trunk/src/z3ext/layoutform/form.py
  U   z3ext.layoutform/trunk/src/z3ext/layoutform/interfaces.py

-=-
Modified: z3ext.layoutform/trunk/CHANGES.txt
===================================================================
--- z3ext.layoutform/trunk/CHANGES.txt	2008-10-05 19:16:53 UTC (rev 91784)
+++ z3ext.layoutform/trunk/CHANGES.txt	2008-10-05 19:37:29 UTC (rev 91785)
@@ -2,6 +2,16 @@
 CHANGES
 =======
 
+1.2.0 (2008-10-06)
+------------------
+
+- Added default css styles
+
+- Removed z3c packages dependencies
+
+- Use pagelets instead of macros
+
+
 1.1.2 (2008-09-26)
 ------------------
 

Modified: z3ext.layoutform/trunk/setup.py
===================================================================
--- z3ext.layoutform/trunk/setup.py	2008-10-05 19:16:53 UTC (rev 91784)
+++ z3ext.layoutform/trunk/setup.py	2008-10-05 19:37:29 UTC (rev 91785)
@@ -21,7 +21,7 @@
 def read(*rnames):
     return open(os.path.join(os.path.dirname(__file__), *rnames)).read()
 
-version='1.1.3dev'
+version='1.2.0dev'
 
 
 setup(name='z3ext.layoutform',
@@ -56,14 +56,11 @@
 			  'zope.pagetemplate',
 			  'zope.app.pagetemplate',
 			  'zope.i18nmessageid',
-			  'zope.lifecycleevent',
-
-			  'z3c.form',
-                          'z3c.macro',
-                          'z3c.template',
 			  'z3c.autoinclude',
 
-                          'z3ext.layout',
+                          'z3ext.layout>=1.5.0',
+                          'z3ext.resource>=1.2.0',
+			  'z3ext.resourcepackage>=1.2.0',
 			  'z3ext.statusmessage',
                           ],
       include_package_data = True,

Modified: z3ext.layoutform/trunk/src/z3ext/layoutform/add.py
===================================================================
--- z3ext.layoutform/trunk/src/z3ext/layoutform/add.py	2008-10-05 19:16:53 UTC (rev 91784)
+++ z3ext.layoutform/trunk/src/z3ext/layoutform/add.py	2008-10-05 19:37:29 UTC (rev 91785)
@@ -22,17 +22,17 @@
 from zope.app.container.interfaces import IContainerNamesContainer
 
 from z3c.form import form, button
-from z3ext.layout.pagelet import BrowserPagelet
 from z3ext.statusmessage.interfaces import IStatusMessage
 
+from form import PageletForm
 from interfaces import _, IPageletAddForm, IAddButton, ICancelButton
 
 
-class PageletAddForm(form.AddForm, BrowserPagelet):
+class PageletAddForm(form.AddForm, PageletForm):
     interface.implements(IPageletAddForm)
 
-    render = BrowserPagelet.render
-    __call__ = BrowserPagelet.__call__
+    render = PageletForm.render
+    __call__ = PageletForm.__call__
 
     _addedObject = None
 

Modified: z3ext.layoutform/trunk/src/z3ext/layoutform/browser/configure.zcml
===================================================================
--- z3ext.layoutform/trunk/src/z3ext/layoutform/browser/configure.zcml	2008-10-05 19:16:53 UTC (rev 91784)
+++ z3ext.layoutform/trunk/src/z3ext/layoutform/browser/configure.zcml	2008-10-05 19:37:29 UTC (rev 91785)
@@ -1,6 +1,6 @@
 <configure 
    xmlns="http://namespaces.zope.org/zope"
-   xmlns:z3c="http://namespaces.zope.org/z3c">
+   xmlns:z3ext="http://namespaces.zope.org/z3ext">
 
   <!-- buttons -->
   <adapter 
@@ -32,77 +32,105 @@
      factory=".textarea.TextAreaFieldWidget" />
 
   <!-- templates -->
-  <z3c:template
+  <z3ext:pagelet
      template="form.pt"
      for="..interfaces.IPageletForm"
-     layer="..interfaces.ILayoutFormLayer" />
+     layer="..interfaces.ILayoutFormLayer"
+     provides="..interfaces.IPageletFormView"
+     permission="zope.Public" />
 
-  <z3c:template
+  <z3ext:pagelet
      template="formadd.pt"
      for="..interfaces.IPageletAddForm"
-     layer="..interfaces.ILayoutFormLayer" />
+     layer="..interfaces.ILayoutFormLayer"
+     provides="..interfaces.IPageletFormView"
+     permission="zope.Public" />
 
-  <z3c:template
+  <z3ext:pagelet
      template="formedit.pt"
      for="..interfaces.IPageletEditForm"
-     layer="..interfaces.ILayoutFormLayer" />
+     layer="..interfaces.ILayoutFormLayer"
+     provides="..interfaces.IPageletFormView"
+     permission="zope.Public" />
 
-  <z3c:template
+  <z3ext:pagelet
      template="subform.pt"
      for="z3c.form.interfaces.ISubForm"
-     layer="..interfaces.ILayoutFormLayer" />
+     layer="..interfaces.ILayoutFormLayer"
+     provides="..interfaces.IPageletFormView"
+     permission="zope.Public" />
 
-  <z3c:template
+  <z3ext:pagelet
      template="formgroup.pt"
      for="z3c.form.group.Group"
-     layer="..interfaces.ILayoutFormLayer" />
+     layer="..interfaces.ILayoutFormLayer"
+     provides="..interfaces.IPageletFormView"
+     permission="zope.Public" />
 
   <!-- Error View -->
-  <z3c:template
+  <z3ext:pagelet
      for="z3c.form.interfaces.IErrorViewSnippet"
      template="error.pt"
-     layer="..interfaces.ILayoutFormLayer" />
+     layer="..interfaces.ILayoutFormLayer"
+     permission="zope.Public" />
 
-  <!-- form macros -->
-  <z3c:macro
-     view="..interfaces.IPageletForm"
-     name="form"
-     template="form.pt"
-     layer="..interfaces.ILayoutFormLayer" />
+  <!-- form view -->
+  <z3ext:pagelet
+     for="z3c.form.interfaces.IForm"
+     template="formview.pt"
+     provides="z3ext.layoutform.browser.interfaces.IForm"
+     layer="..interfaces.ILayoutFormLayer"
+     permission="zope.Public" />
 
-  <z3c:macro
-     view="z3c.form.interfaces.IForm"
-     name="form-header"
-     macro="header"
-     template="form.pt"
-     layer="..interfaces.ILayoutFormLayer" />
+  <!-- viewspace view -->
+  <z3ext:pagelet
+     for="..interfaces.IPageletForm"
+     template="formviewspace.pt"
+     provides="z3ext.layoutform.browser.interfaces.IViewspace"
+     layer="..interfaces.ILayoutFormLayer"
+     permission="zope.Public" />
 
-  <z3c:macro
-     view="z3c.form.interfaces.IForm"
-     name="widget-rows"
-     macro="widget-rows"
-     template="form.pt"
-     layer="..interfaces.ILayoutFormLayer" />
+  <!-- form buttons -->
+  <z3ext:pagelet
+     for="..interfaces.IPageletForm"
+     template="formbuttons.pt"
+     provides="z3ext.layoutform.browser.interfaces.IFormButtons"
+     layer="..interfaces.ILayoutFormLayer"
+     permission="zope.Public" />
 
-  <z3c:macro
-     view="z3c.form.interfaces.IForm"
-     name="widget-row"
-     macro="widget-row"
-     template="form.pt"
-     layer="..interfaces.ILayoutFormLayer" />
+  <!-- widget view -->
+  <z3ext:pagelet
+     for="z3c.form.interfaces.IWidget"
+     template="widget.pt"
+     provides="z3ext.layoutform.browser.interfaces.IWidget"
+     layer="..interfaces.ILayoutFormLayer"
+     permission="zope.Public" />
 
-  <z3c:macro
-     view="..interfaces.IPageletForm"
-     name="form-buttons"
-     macro="buttons"
-     template="form.pt"
-     layer="..interfaces.ILayoutFormLayer" />
+  <!-- add form buttons -->
+  <z3ext:pagelet
+     for="..interfaces.IPageletAddForm"
+     template="formaddbuttons.pt"
+     provides="z3ext.layoutform.browser.interfaces.IFormButtons"
+     layer="..interfaces.ILayoutFormLayer"
+     permission="zope.Public" />
 
-  <z3c:macro
-     view="..interfaces.IPageletAddForm"
-     name="form-buttons"
-     macro="buttons"
-     template="formadd.pt"
-     layer="..interfaces.ILayoutFormLayer" />
+  <!-- styles -->
+  <z3ext:resourceinclude
+     name="z3ext-layoutform.css"
+     library="z3ext"
+     type="stylesheet"
+     file="form.css" filetype="zrt" />
 
+  <z3ext:resource
+     file="required.gif"
+     name="z3ext-layoutform-required.gif" />
+
+  <z3ext:resource
+     file="linkOpaque.gif"
+     name="z3ext-layoutform-linkOpaque.gif" />
+
+  <z3ext:resource
+     file="linkTransparent.gif"
+     name="z3ext-layoutform-linkTransparent.gif" />
+
 </configure>

Added: z3ext.layoutform/trunk/src/z3ext/layoutform/browser/form.css
===================================================================
--- z3ext.layoutform/trunk/src/z3ext/layoutform/browser/form.css	                        (rev 0)
+++ z3ext.layoutform/trunk/src/z3ext/layoutform/browser/form.css	2008-10-05 19:37:29 UTC (rev 91785)
@@ -0,0 +1,182 @@
+/* zrt-cssregistry: */
+
+ at media all {
+
+  .z-form {
+  }
+
+  .z-page .z-form-add,
+  .z-page .z-form-edit {
+    border: borderWidth borderStyle globalExtraBorderColor;
+    margin-top: 0em;
+    padding: 1em;
+    background: contentBackgroundColor;
+  }
+  
+  .z-frame .z-form-edit,
+  .z-frame .z-form-standard,
+  #z-context-view .z-form-edit,
+  #z-context-view .z-form-standard,
+  .z-topframe .z-form-standard {
+    border: none;
+    padding: 0em;
+  }
+
+  .z-add-form {
+    padding: 1em;
+  }
+
+  .z-form-description { 
+    color: discreetColor;
+    margin-bottom: 1.5em;
+    font-size: 90%;
+  }
+  
+  .z-form-field .z-form-description {
+    color: discreetColor;
+    font-size: fontSmallSize;
+    font-weight: normal;
+    margin-bottom: 1.5em;
+  }
+  
+  .z-form-fieldset {
+    margin-bottom: 1em;
+    color: fontColor !important;
+    background-color: backgroundColor;
+    padding: 0.5em 1em 0.5em 1em;
+  }
+  
+  .z-form-fieldset.last {
+    margin-bottom: 0em;
+  }
+  
+  .z-form form:first-child > .z-form-fieldset {
+    margin-top: 0em;
+  }
+  
+  .z-form-fieldset ul a {
+    text-decoration: none;
+    border-bottom: borderWidth dotted discreetColor;
+  }
+  
+  .z-form-fieldset label {
+    font-weight: normal;
+  }
+  
+  .z-form-fieldset h2 { 
+    font-weight: bold;
+  }
+  
+  .z-form-fieldset .header {
+    border-bottom: borderWidth borderStyle globalBorderColor;
+  }
+  
+  /* The edit form elements */
+  .z-form-field {
+    margin: 0 1em 1em 0;
+  }
+  
+  .z-form-field .z-form-field {
+    margin: 1em 0 0 0;
+  }
+  
+  .z-form-field label {
+    font-size: 100%;
+  }
+  
+  .z-form-fieldRequired {
+    background: url(z3ext-layoutform-required.gif) center left no-repeat;
+    padding: 0 0 0 8px;
+    color: backgroundColor;
+  }
+  
+  .z-form-fieldUploadFile {
+    text-align: right; 
+    margin-right: 0.75em;
+    display: none;
+  }
+  
+  .z-form-fieldTextFormat {
+    text-align: right;
+    margin-right: 0.75em
+  }
+  
+  .z-form-help {
+    font-size: fontSmallSize;
+    color: discreetColor;
+    margin: 0 0 0.2em 0;
+  }
+  
+  .z-form-help:hover {
+    color: fontColor;
+    cursor: default;
+  }
+  
+  .z-form-field.error {
+    /* Class for error indication in forms */
+    background-color: notifyBackgroundColor;
+    border: borderWidth borderStyle notifyBorderColor;
+    padding: 1em;
+    margin: 0 0 1em 0;
+    width: 95%;
+  }
+  
+  .z-form-field.error .x-form-fieldRequired {
+    color: notifyBackgroundColor;
+  }
+  
+  .z-form-controls {
+    clear: both;
+    margin-top: 1em;
+  }
+  
+  
+  .z-form-button {
+    background: transparent url(z3ext-layoutform-linkTransparent.gif) no-repeat;
+    background-position: 5px center;
+    cursor: pointer;
+    font-size: fontSmallSize;
+    padding: 1px 1px 1px 14px;
+  }
+  
+  .z-form-standalonebtn {
+    background: globalBackgroundColor url(z3ext-layoutform-linkOpaque.gif) no-repeat;
+    background-position: 5px center;
+    cursor: pointer;
+    font-size: fontSmallSize;
+    padding: 1px 1px 1px 14px;
+  }
+  
+  .z-form-addbutton {
+    background: transparent url(z3ext-layoutform-linkTransparent.gif) no-repeat;
+    background-position: 5px center;
+    cursor: pointer;
+    font-size: fontSmallSize;
+    padding: 1px 1px 1px 14px;
+  }
+  
+  .z-form-savebutton {
+    background: transparent url(z3ext-layoutform-linkTransparent.gif) no-repeat;
+    background-position: 5px center;
+    cursor: pointer;
+    font-size: fontSmallSize;
+    padding: 1px 1px 1px 14px;
+  }
+  
+  .z-form-cancelbutton {
+    background: globalBackgroundColor url(z3ext-layoutform-linkOpaque.gif) no-repeat;
+    background-position: 5px center;
+    cursor: pointer;
+    font-size: fontSmallSize;
+    padding: 1px 1px 1px 14px;
+  }
+  
+  .z-form-removebutton {
+    background: globalBackgroundColor url(z3ext-layoutform-linkOpaque.gif) no-repeat;
+    background-position: 5px center;
+    cursor: pointer;
+    font-size: fontSmallSize;
+    padding: 1px 1px 1px 14px;
+  }
+
+}
\ No newline at end of file

Modified: z3ext.layoutform/trunk/src/z3ext/layoutform/browser/form.pt
===================================================================
--- z3ext.layoutform/trunk/src/z3ext/layoutform/browser/form.pt	2008-10-05 19:16:53 UTC (rev 91784)
+++ z3ext.layoutform/trunk/src/z3ext/layoutform/browser/form.pt	2008-10-05 19:37:29 UTC (rev 91785)
@@ -1,75 +1,4 @@
-<div class="z-form z-form-standard" i18n:domain="z3ext">
-  <form action="." method="post" enctype="multipart/form-data" 
-	tal:attributes="method view/method;
-			enctype view/enctype;
-			acceptCharset view/acceptCharset;
-			accept view/accept;
-			action view/action;
-			name view/name;
-			id view/id"
-	metal:define-macro="form">
-
-    <div metal:define-slot="viewspace">
-      <metal:block define-macro="header">
-	<metal:block define-slot="header">
-	  <h1 i18n:translate=""
-	      tal:condition="view/label|nothing"
-	      tal:content="view/label|nothing"
-	      metal:define-slot="heading">Do something</h1>
-	  <div class="z-form-description" 
-	       tal:condition="view/description|nothing"
-	       tal:content="view/description|nothing"></div>
-	</metal:block>
-      </metal:block>
-
-      <div metal:define-slot="extra-info" tal:replace="nothing"></div>
-
-      <div metal:define-slot="main">
-	<div class="z-form-fieldset">
-	  <metal:block define-macro="widget-rows">
-	    <metal:block metal:define-slot="extra-top" />
-
-	    <tal:block tal:repeat="widget view/widgets/values">
-	      <div class="z-form-field" metal:define-macro="widget-row"
-		   tal:define="error widget/error|nothing"
-		   tal:attributes="class python:error and 'z-form-field error' or 'z-form-field'">
-		<label tal:attributes="for widget/id;
-				       title widget/field/description"
-		       tal:content="widget/label">The Label</label>
-
-		<span class="z-form-fieldRequired" tal:condition="widget/required">&nbsp;</span>
-
-		<div tal:condition="error" tal:replace="structure error/render">
-		  The Error
-		</div>
-		<div class="z-form-help" tal:content="structure widget/field/description"></div>
-		<div tal:content="structure widget/render">
-		  <input type="text" style="width:100%"/>
-		</div>
-	      </div>
-	    </tal:block>
-	    
-	    <tal:block tal:repeat="group view/groups|python:[]">
-	      <tal:block tal:content="structure python:group.render()" />
-	    </tal:block>
-
-	    <metal:block metal:define-slot="extra-bottom" />
-	  </metal:block>
-	</div>
-      </div>
-      <metal:block define-slot="above-buttons"></metal:block>
-    </div>
-
-    <metal:block define-slot="buttons">
-      <div class="z-form-controls" metal:define-macro="buttons">
-	<span tal:condition="view/actions/values"
-	      metal:define-slot="bottom_buttons">
-	  <hr />
-	  <input tal:repeat="action view/actions/values"
-		 tal:replace="structure action/render" />
-	</span>
-	<metal:block define-slot="bottom-buttons"/>
-      </div>
-    </metal:block>
-  </form>
+<div class="z-form z-form-standard"
+     tal:content="structure
+		  context/@@pagelet/z3ext.layoutform.browser.interfaces.IForm">
 </div>

Modified: z3ext.layoutform/trunk/src/z3ext/layoutform/browser/formadd.pt
===================================================================
--- z3ext.layoutform/trunk/src/z3ext/layoutform/browser/formadd.pt	2008-10-05 19:16:53 UTC (rev 91784)
+++ z3ext.layoutform/trunk/src/z3ext/layoutform/browser/formadd.pt	2008-10-05 19:37:29 UTC (rev 91785)
@@ -1,25 +1,4 @@
-<div class="z-form z-form-add" i18n:domain="z3ext">
-  <metal:block metal:use-macro="macro:form">
-    <metal:block metal:fill-slot="buttons">
-      <div class="z-form-controls" metal:define-macro="buttons">
-	<hr />
-	<div class="z-form-field" tal:condition="view/nameAllowed|nothing">
-	  <label i18n:translate="" for="add_input_name">Content short name</label>
-	  <div class="z-form-help" i18n:translate="">
-	    Should not contain spaces, underscores or mixed case. 
-	    Short Name is part of the item's web address.
-	  </div>
-	  <div>
-	    <input type="text" name="add_input_name" id="add_input_name"
-		   tal:attributes="value request/add_input_name | nothing" />
-	  </div>
-	</div>
-
-	<span tal:condition="view/actions/values">
-	  <input tal:repeat="action view/actions/values"
-		 tal:replace="structure action/render" />
-	</span>
-      </div>
-    </metal:block>
-  </metal:block>
+<div class="z-form z-form-add"
+     tal:content="structure
+		  context/@@pagelet/z3ext.layoutform.browser.interfaces.IForm">
 </div>

Added: z3ext.layoutform/trunk/src/z3ext/layoutform/browser/formaddbuttons.pt
===================================================================
--- z3ext.layoutform/trunk/src/z3ext/layoutform/browser/formaddbuttons.pt	                        (rev 0)
+++ z3ext.layoutform/trunk/src/z3ext/layoutform/browser/formaddbuttons.pt	2008-10-05 19:37:29 UTC (rev 91785)
@@ -0,0 +1,19 @@
+<div class="z-form-controls" i18n:domain="z3ext">
+  <hr />
+  <div class="z-form-field" tal:condition="context/nameAllowed|nothing">
+    <label i18n:translate="" for="add_input_name">Content short name</label>
+    <div class="z-form-help" i18n:translate="">
+      Should not contain spaces, underscores or mixed case. 
+      Short Name is part of the item's web address.
+    </div>
+    <div>
+      <input type="text" name="add_input_name" id="add_input_name"
+	     tal:attributes="value request/add_input_name | nothing" />
+    </div>
+  </div>
+  
+  <span tal:condition="context/actions/values">
+    <input tal:repeat="action context/actions/values"
+	   tal:replace="structure action/render" />
+  </span>
+</div>

Added: z3ext.layoutform/trunk/src/z3ext/layoutform/browser/formbuttons.pt
===================================================================
--- z3ext.layoutform/trunk/src/z3ext/layoutform/browser/formbuttons.pt	                        (rev 0)
+++ z3ext.layoutform/trunk/src/z3ext/layoutform/browser/formbuttons.pt	2008-10-05 19:37:29 UTC (rev 91785)
@@ -0,0 +1,7 @@
+<div class="z-form-controls">
+  <span tal:condition="context/actions/values">
+    <hr />
+    <input tal:repeat="action context/actions/values"
+	   tal:replace="structure action/render" />
+  </span>
+</div>

Modified: z3ext.layoutform/trunk/src/z3ext/layoutform/browser/formedit.pt
===================================================================
--- z3ext.layoutform/trunk/src/z3ext/layoutform/browser/formedit.pt	2008-10-05 19:16:53 UTC (rev 91784)
+++ z3ext.layoutform/trunk/src/z3ext/layoutform/browser/formedit.pt	2008-10-05 19:37:29 UTC (rev 91785)
@@ -1,3 +1,4 @@
-<div class="z-form z-form-edit">
-  <metal:block metal:use-macro="macro:form" />
+<div class="z-form z-form-edit"
+     tal:content="structure
+		  context/@@pagelet/z3ext.layoutform.browser.interfaces.IForm">
 </div>

Modified: z3ext.layoutform/trunk/src/z3ext/layoutform/browser/formgroup.pt
===================================================================
--- z3ext.layoutform/trunk/src/z3ext/layoutform/browser/formgroup.pt	2008-10-05 19:16:53 UTC (rev 91784)
+++ z3ext.layoutform/trunk/src/z3ext/layoutform/browser/formgroup.pt	2008-10-05 19:37:29 UTC (rev 91785)
@@ -1,8 +1,8 @@
 <fieldset>
-  <legend tal:content="view/label"></legend>
-  <div class="pageDescription" tal:content="view/description|nothing"></div>
+  <legend tal:content="context/label"></legend>
+  <div class="pageDescription" tal:content="context/description|nothing"></div>
 
-  <tal:block tal:repeat="widget view/widgets/values">
-    <metal:block use-macro="macro:widget-row" />
-  </tal:block>
+  <tal:block tal:repeat="widget context/widgets/values"
+       tal:content="structure 
+           widget/@@pagelet/z3ext.layoutform.browser.interfaces.IWidget" />
 </fieldset>

Added: z3ext.layoutform/trunk/src/z3ext/layoutform/browser/formview.pt
===================================================================
--- z3ext.layoutform/trunk/src/z3ext/layoutform/browser/formview.pt	                        (rev 0)
+++ z3ext.layoutform/trunk/src/z3ext/layoutform/browser/formview.pt	2008-10-05 19:37:29 UTC (rev 91785)
@@ -0,0 +1,15 @@
+<form action="." method="post" enctype="multipart/form-data" 
+      tal:attributes="method context/method;
+		      enctype context/enctype;
+		      acceptCharset context/acceptCharset;
+		      accept context/accept;
+		      action context/action;
+		      name context/name;
+		      id context/id">
+
+  <tal:block tal:content="structure
+	  context/@@pagelet/z3ext.layoutform.browser.interfaces.IViewspace" />
+
+  <tal:block tal:content="structure
+	  context/@@pagelet/z3ext.layoutform.browser.interfaces.IFormButtons" />
+</form>

Added: z3ext.layoutform/trunk/src/z3ext/layoutform/browser/formviewspace.pt
===================================================================
--- z3ext.layoutform/trunk/src/z3ext/layoutform/browser/formviewspace.pt	                        (rev 0)
+++ z3ext.layoutform/trunk/src/z3ext/layoutform/browser/formviewspace.pt	2008-10-05 19:37:29 UTC (rev 91785)
@@ -0,0 +1,11 @@
+<h1 tal:condition="context/label|nothing"
+    tal:content="context/label|nothing">Do something</h1>
+<div class="z-form-description" 
+     tal:condition="context/description|nothing"
+     tal:content="context/description|nothing"></div>
+
+<div class="z-form-fieldset">
+  <tal:block tal:repeat="widget context/widgets/values"
+       tal:content="structure 
+           widget/@@pagelet/z3ext.layoutform.browser.interfaces.IWidget" />
+</div>

Added: z3ext.layoutform/trunk/src/z3ext/layoutform/browser/interfaces.py
===================================================================
--- z3ext.layoutform/trunk/src/z3ext/layoutform/browser/interfaces.py	                        (rev 0)
+++ z3ext.layoutform/trunk/src/z3ext/layoutform/browser/interfaces.py	2008-10-05 19:37:29 UTC (rev 91785)
@@ -0,0 +1,34 @@
+##############################################################################
+#
+# Copyright (c) 2008 Zope Corporation and Contributors.
+# All Rights Reserved.
+#
+# This software is subject to the provisions of the Zope Public License,
+# Version 2.1 (ZPL).  A copy of the ZPL should accompany this distribution.
+# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
+# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
+# FOR A PARTICULAR PURPOSE.
+#
+##############################################################################
+""" 
+
+$Id:  2007-12-12 12:27:02Z fafhrd $
+"""
+from zope import interface
+
+
+class IForm(interface.Interface):
+    """ form view """
+
+
+class IWidget(interface.Interface):
+    """ widget view """
+
+
+class IViewspace(interface.Interface):
+    """ form viewspace """
+
+
+class IFormButtons(interface.Interface):
+    """ form buttons """

Added: z3ext.layoutform/trunk/src/z3ext/layoutform/browser/linkOpaque.gif
===================================================================
(Binary files differ)


Property changes on: z3ext.layoutform/trunk/src/z3ext/layoutform/browser/linkOpaque.gif
___________________________________________________________________
Name: svn:mime-type
   + application/octet-stream

Added: z3ext.layoutform/trunk/src/z3ext/layoutform/browser/linkTransparent.gif
===================================================================
(Binary files differ)


Property changes on: z3ext.layoutform/trunk/src/z3ext/layoutform/browser/linkTransparent.gif
___________________________________________________________________
Name: svn:mime-type
   + application/octet-stream

Added: z3ext.layoutform/trunk/src/z3ext/layoutform/browser/required.gif
===================================================================
(Binary files differ)


Property changes on: z3ext.layoutform/trunk/src/z3ext/layoutform/browser/required.gif
___________________________________________________________________
Name: svn:mime-type
   + application/octet-stream

Modified: z3ext.layoutform/trunk/src/z3ext/layoutform/browser/subform.pt
===================================================================
--- z3ext.layoutform/trunk/src/z3ext/layoutform/browser/subform.pt	2008-10-05 19:16:53 UTC (rev 91784)
+++ z3ext.layoutform/trunk/src/z3ext/layoutform/browser/subform.pt	2008-10-05 19:37:29 UTC (rev 91785)
@@ -1,24 +1,13 @@
-<div class="fieldset">
-  <h1 i18n:translate=""
-      tal:condition="view/label|nothing"
-      tal:content="view/label|nothing">Do something</h1>
-  <div class="formDescription" tal:content="view/description|nothing"></div>
-  
-  <metal:block define-macro="widget-rows">
-    <metal:block metal:define-slot="extra_top" />
-    
-    <tal:block tal:repeat="widget view/widgets/values">
-      <metal:block use-macro="context/@@form_macros/widget_row"/>
-    </tal:block>
-    
-    <metal:block metal:define-slot="extra-bottom" />
-  </metal:block>
+<div class="z-form-fieldset">
+  <h1 tal:condition="context/label|nothing"
+      tal:content="context/label|nothing">Do something</h1>
+  <div class="z-form-description" 
+       tal:content="context/description|nothing"></div>
+
+  <tal:block tal:repeat="widget context/widgets/values"
+       tal:content="structure 
+           widget/@@pagelet/z3ext.layoutform.browser.interfaces.IWidget" />
 </div>
 
-<tal:block tal:condition="view/actions|nothing">
-  <hr />
-  <span class="buttons">
-    <input tal:repeat="action view/actions/values"
-	   tal:replace="structure action/render" />
-  </span>
-</tal:block>
+<tal:block tal:content="structure
+	context/@@pagelet/z3ext.layoutform.browser.interfaces.IFormButtons" />

Added: z3ext.layoutform/trunk/src/z3ext/layoutform/browser/widget.pt
===================================================================
--- z3ext.layoutform/trunk/src/z3ext/layoutform/browser/widget.pt	                        (rev 0)
+++ z3ext.layoutform/trunk/src/z3ext/layoutform/browser/widget.pt	2008-10-05 19:37:29 UTC (rev 91785)
@@ -0,0 +1,17 @@
+<div class="z-form-field"
+     tal:define="error context/error|nothing"
+     tal:attributes="class python:error and'z-form-field error'or'z-form-field'">
+  <label tal:attributes="for context/id;
+			 title context/field/description"
+	 tal:content="context/label">The Label</label>
+  <span class="z-form-fieldRequired"
+	tal:condition="context/required">&nbsp;</span>
+  <div tal:condition="error" tal:replace="structure error/render">
+    The Error
+  </div>
+  <div class="z-form-help" 
+       tal:content="structure context/field/description"></div>
+  <div tal:content="structure context/render">
+    <input type="text" style="width:100%" />
+  </div>
+</div>

Modified: z3ext.layoutform/trunk/src/z3ext/layoutform/edit.py
===================================================================
--- z3ext.layoutform/trunk/src/z3ext/layoutform/edit.py	2008-10-05 19:16:53 UTC (rev 91784)
+++ z3ext.layoutform/trunk/src/z3ext/layoutform/edit.py	2008-10-05 19:37:29 UTC (rev 91785)
@@ -17,23 +17,22 @@
 """
 from zope import interface, event
 from zope.traversing.browser import absoluteURL
-from zope.lifecycleevent import ObjectCreatedEvent
 from zope.app.container.interfaces import IAdding
 from zope.app.container.interfaces import IWriteContainer
 from zope.app.container.interfaces import IContainerNamesContainer
 
 from z3c.form import form, button
-from z3ext.layout.pagelet import BrowserPagelet
 from z3ext.statusmessage.interfaces import IStatusMessage
 
+from form import PageletForm
 from interfaces import _, IPageletEditForm, ISaveButton
 
 
-class PageletEditForm(form.EditForm, BrowserPagelet):
+class PageletEditForm(form.EditForm, PageletForm):
     interface.implements(IPageletEditForm)
 
-    render = BrowserPagelet.render
-    __call__ = BrowserPagelet.__call__
+    render = PageletForm.render
+    __call__ = PageletForm.__call__
 
     @button.buttonAndHandler(
         _(u'Save'), name='save', provides=ISaveButton)

Modified: z3ext.layoutform/trunk/src/z3ext/layoutform/form.py
===================================================================
--- z3ext.layoutform/trunk/src/z3ext/layoutform/form.py	2008-10-05 19:16:53 UTC (rev 91784)
+++ z3ext.layoutform/trunk/src/z3ext/layoutform/form.py	2008-10-05 19:37:29 UTC (rev 91785)
@@ -16,15 +16,30 @@
 $Id$
 """
 from zope import interface
+from zope.component import getMultiAdapter, queryMultiAdapter
+from zope.pagetemplate.interfaces import IPageTemplate
 
 from z3c.form import form
+from z3ext.layout.interfaces import IPagelet
 from z3ext.layout.pagelet import BrowserPagelet
 
-from interfaces import IPageletForm
+from interfaces import IPageletForm, IPageletFormView
 
 
 class PageletForm(form.Form, BrowserPagelet):
     interface.implements(IPageletForm)
 
-    render = BrowserPagelet.render
     __call__ = BrowserPagelet.__call__
+
+    def render(self):
+        # render content template 
+        if self.template is None:
+            view = queryMultiAdapter((self, self.request), IPageletFormView)
+            if view is not None:
+                view.update()
+                return view.render()
+
+            template = getMultiAdapter((self, self.request), IPageTemplate)
+            return template(self)
+
+        return self.template()

Modified: z3ext.layoutform/trunk/src/z3ext/layoutform/interfaces.py
===================================================================
--- z3ext.layoutform/trunk/src/z3ext/layoutform/interfaces.py	2008-10-05 19:16:53 UTC (rev 91784)
+++ z3ext.layoutform/trunk/src/z3ext/layoutform/interfaces.py	2008-10-05 19:37:29 UTC (rev 91785)
@@ -1,6 +1,6 @@
 ##############################################################################
 #
-# Copyright (c) 2007 Zope Corporation and Contributors.
+# Copyright (c) 2008 Zope Corporation and Contributors.
 # All Rights Reserved.
 #
 # This software is subject to the provisions of the Zope Public License,
@@ -27,6 +27,10 @@
     """ browser layer """
 
 
+class IPageletFormView(IPagelet):
+    """ pagelet form view """
+
+
 class IPageletForm(IPagelet):
     """Form mixin for pagelet implementation."""
 



More information about the Checkins mailing list