[Zope3-checkins] CVS: Zope3/src/zope/app/zptpage/browser - __init__.py:1.2 configure.zcml:1.2 inlinecode.pt:1.2 zpt.gif:1.2 zptpage.py:1.2

Philipp von Weitershausen philikon at philikon.de
Tue Feb 24 11:51:19 EST 2004


Update of /cvs-repository/Zope3/src/zope/app/zptpage/browser
In directory cvs.zope.org:/tmp/cvs-serv27280/src/zope/app/zptpage/browser

Added Files:
	__init__.py configure.zcml inlinecode.pt zpt.gif zptpage.py 
Log Message:


Moved the Template Page content type to its own package below
zope.app, including its interfaces and browser views.




=== Zope3/src/zope/app/zptpage/browser/__init__.py 1.1 => 1.2 ===
--- /dev/null	Tue Feb 24 11:51:18 2004
+++ Zope3/src/zope/app/zptpage/browser/__init__.py	Tue Feb 24 11:50:48 2004
@@ -0,0 +1,2 @@
+#
+# This file is necessary to make this directory a package.


=== Zope3/src/zope/app/zptpage/browser/configure.zcml 1.1 => 1.2 ===
--- /dev/null	Tue Feb 24 11:51:18 2004
+++ Zope3/src/zope/app/zptpage/browser/configure.zcml	Tue Feb 24 11:50:48 2004
@@ -0,0 +1,79 @@
+<configure
+    xmlns='http://namespaces.zope.org/zope'
+    xmlns:browser='http://namespaces.zope.org/browser'
+    i18n_domain='zope'
+    >
+
+  <browser:page
+      name="index.html"
+      for="zope.app.zptpage.interfaces.IZPTPage"
+      class=".zptpage.ZPTPageEval"
+      attribute="index"
+      permission="zope.View"
+      />
+
+  <browser:page
+      name="source.html"
+      for="zope.app.zptpage.interfaces.IZPTPage"
+      class="zope.app.zptpage.zptpage.ZPTSourceView"
+      attribute="__call__"
+      permission="zope.ManageContent"
+      />
+
+  <browser:addMenuItem
+      class="zope.app.zptpage.ZPTPage"
+      title="Templated Page"
+      description="A simple, content-based Page Template"
+      permission="zope.ManageContent"
+      view="zope.app.zptpage.ZPTPage"
+      />
+
+  <browser:addform
+      schema="zope.app.zptpage.interfaces.IZPTPage"
+      label="Add a ZPT Page"
+      content_factory="zope.app.zptpage.ZPTPage"
+      name="zope.app.zptpage.ZPTPage"
+      permission="zope.ManageContent"
+      />
+
+  <browser:editform
+      for="zope.app.zptpage.interfaces.IZPTPage"
+      schema="zope.app.zptpage.interfaces.IZPTPage"
+      name="edit.html"
+      label="Edit a ZPT page"
+      fields="source expand"
+      permission="zope.ManageContent" 
+      menu="zmi_views" title="Edit"
+      />
+
+  <browser:editform
+      for="zope.app.zptpage.interfaces.IZPTPage"
+      schema="zope.app.zptpage.interfaces.IZPTPage"
+      name="inlineCode.html"
+      label="Inline Code"
+      fields="evaluateInlineCode"
+      template="inlinecode.pt"
+      permission="zope.ManageContent" 
+      menu="zmi_views" title="Inline Code"
+      />
+
+  <browser:icon 
+      name="zmi_icon"
+      for="zope.app.zptpage.interfaces.IZPTPage" 
+      file="zpt.gif"
+      />
+
+
+  <!-- Preview view - requires zope.app.preview -->
+
+  <configure package="zope.app.preview">
+    <browser:page
+        for="zope.app.zptpage.interfaces.IZPTPage"
+        name="preview.html"
+        template="preview.pt"
+        permission="zope.ManageContent"
+        menu="zmi_views" title="Preview"
+        />
+  </configure>
+
+</configure>


=== Zope3/src/zope/app/zptpage/browser/inlinecode.pt 1.1 => 1.2 ===
--- /dev/null	Tue Feb 24 11:51:18 2004
+++ Zope3/src/zope/app/zptpage/browser/inlinecode.pt	Tue Feb 24 11:50:48 2004
@@ -0,0 +1,82 @@
+<tal:tag condition="view/update"
+/><html metal:use-macro="views/standard_macros/page">
+  <body>
+  <div metal:fill-slot="body">
+
+  <div metal:define-macro="body">
+
+    <form action="." tal:attributes="action request/URL" method="POST"
+          enctype="multipart/form-data">
+
+      <div metal:define-macro="formbody">
+
+        <h3 tal:condition="view/label"
+            tal:content="view/label"
+            metal:define-slot="heading"
+            >Edit something</h3>
+
+        <div style="color:red; font-weight: bold">
+          <p i18n:translate="">
+            This screen allows you to activate Inline Code Evaluation. This
+            means that you can say
+            <span i18n:name="code-example-1"><pre>
+               &lt;script type="text/server-python"&gt;<br/>
+               &nbsp;&nbsp;print "Hello World!"<br/>
+               &lt;/script&gt;
+            </pre></span>
+            or
+            <span i18n:name="code-example-2"><pre>
+               &lt;p tal:script="text/server-python"&gt;<br/>
+               &nbsp;&nbsp;print "Hello World!"<br/>
+               &lt;/p&gt;
+            </pre></span>
+          </p>
+          <p i18n:translate="">
+            Many Zope 3 developers consider inline code blocks something
+            very bad, since it does not follow the design of Page Templates
+            or Zope 3 in general. However, application and application server
+            developers are not the only audience for Zope 3. Scripters are
+            used to inline code from other technologies like PHP and it fits
+            their brain, which is very important.
+          </p>
+        </div>
+
+        <p tal:define="status view/update"
+           tal:condition="status"
+           tal:content="status" />
+
+         <p tal:condition="view/errors" i18n:translate="">
+           There are  <strong tal:content="python:len(view.errors)"
+                              i18n:name="num_errors">6</strong> input errors.
+        </p>
+
+        <tal:block repeat="error view/errors">
+          <div class="error" tal:content="error">error</div>
+        </tal:block>
+
+        <div class="row"
+             metal:define-macro="widget_rows" tal:repeat="widget view/widgets"
+             tal:content="structure widget/row">
+            <div class="label">Name</div>
+            <div class="field"><input type="text" style="width:100%" /></div>
+        </div>
+
+      </div>
+
+      <div class="row">
+        <div class="controls">
+          <input type="submit" value="Refresh" 
+              i18n:attributes="value refresh-button" />
+          <input type="submit" name="UPDATE_SUBMIT" value="Submit" 
+              i18n:attributes="value submit-button"/>
+        </div>
+      </div>
+
+    </form>
+
+  </div>
+
+  </div>
+  </body>
+
+</html>


=== Zope3/src/zope/app/zptpage/browser/zpt.gif 1.1 => 1.2 ===
  <Binary-ish file>

=== Zope3/src/zope/app/zptpage/browser/zptpage.py 1.1 => 1.2 ===
--- /dev/null	Tue Feb 24 11:51:18 2004
+++ Zope3/src/zope/app/zptpage/browser/zptpage.py	Tue Feb 24 11:50:48 2004
@@ -0,0 +1,29 @@
+##############################################################################
+#
+# Copyright (c) 2001, 2002 Zope Corporation and Contributors.
+# All Rights Reserved.
+#
+# This software is subject to the provisions of the Zope Public License,
+# Version 2.0 (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.
+#
+##############################################################################
+"""Define view component for ZPT page eval results.
+
+$Id$
+"""
+class ZPTPageEval:
+
+    def index(self, **kw):
+        """Call a Page Template"""
+
+        template = self.context
+        request = self.request
+
+        request.response.setHeader('content-type',
+                                   template.content_type)
+
+        return template.render(request, **kw)




More information about the Zope3-Checkins mailing list