[Zope3-checkins] CVS: Zope3/src/zope/app/browser/content - zpt_inlinecode.pt:1.1.2.1 configure.zcml:1.36.2.1

Stephan Richter srichter at cosmos.phy.tufts.edu
Wed Aug 20 21:11:40 EDT 2003


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

Modified Files:
      Tag: srichter-inlinepython-branch
	configure.zcml 
Added Files:
      Tag: srichter-inlinepython-branch
	zpt_inlinecode.pt 
Log Message:
Hooked up the new TAL script support to Templated Pages. The support has to
be manually activated on a separate page (as requested by __gotcha).

Also, currently we only have support for the "text/server-python" type. 
Later we might want to add other languages too.

TO DO:

  - tests

  - documentation



=== Added File Zope3/src/zope/app/browser/content/zpt_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
            <pre i18n:name="code-example-1">
               &lt;script type="text/server-python"&gt;
                 print "Hello World!"
               &lt;/script&gt;
            </pre>
            or
            <pre i18n:name="code-example-2">
               &lt;p tal:script="text/server-python"&gt;
                 print "Hello World!"
               &lt;/p&gt;
            </pre>.
          </p>
          <p i18n:translate="">
            Now, 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 liek 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/browser/content/configure.zcml 1.36 => 1.36.2.1 ===
--- Zope3/src/zope/app/browser/content/configure.zcml:1.36	Wed Aug 20 14:21:03 2003
+++ Zope3/src/zope/app/browser/content/configure.zcml	Wed Aug 20 20:11:09 2003
@@ -196,11 +196,23 @@
       permission="zope.ManageContent" />
 
   <editform
+      for="zope.app.content.zpt.IZPTPage"
       schema="zope.app.content.zpt.IZPTPage"
       name="edit.html"
-      menu="zmi_views"
       label="Edit a ZPT page"
-      permission="zope.ManageContent" />
+      fields="source expand"
+      permission="zope.ManageContent" 
+      menu="zmi_views" title="Edit"/>
+
+  <editform
+      for="zope.app.content.zpt.IZPTPage"
+      schema="zope.app.content.zpt.IZPTPage"
+      name="inlineCode.html"
+      label="Inline Code"
+      fields="evaluateInlineCode"
+      template="zpt_inlinecode.pt"
+      permission="zope.ManageContent" 
+      menu="zmi_views" title="Inline Code"/>
 
   <page
       for="zope.app.content.zpt.IZPTPage"




More information about the Zope3-Checkins mailing list