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

Philipp von Weitershausen philikon at philikon.de
Fri Feb 20 14:43:48 EST 2004


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

Added Files:
      Tag: philikon-movecontent-branch
	__init__.py configure.zcml inlinecode.pt zpt.gif zptpage.py 
Log Message:
ZPTPage moved to zope.app.


=== Added File Zope3/src/zope/app/zptpage/browser/__init__.py ===
#
# This file is necessary to make this directory a package.


=== Added File Zope3/src/zope/app/zptpage/browser/configure.zcml ===
<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"
      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:page
      for="zope.app.zptpage.interfaces.IZPTPage"
      name="preview.html"
      menu="zmi_views" title="Preview"
      template="preview.pt"
      permission="zope.ManageContent"
      /-->

  <browser:icon 
      name="zmi_icon"
      for="zope.app.zptpage.interfaces.IZPTPage" 
      file="zpt.gif"
      />

</configure>


=== Added File Zope3/src/zope/app/zptpage/browser/inlinecode.pt ===
<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>


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

=== Added File Zope3/src/zope/app/zptpage/browser/zptpage.py ===
##############################################################################
#
# 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: zptpage.py,v 1.1.2.1 2004/02/20 19:43:47 philikon Exp $
"""
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