[Zope-Checkins] CVS: Zope3/lib/python/Zope/App/OFS/Content/DTMLPage/Views/Browser - DTMLPageEdit.py:1.1 DTMLPageEval.py:1.1 __init__.py:1.1 configure.zcml:1.1 edit.pt:1.1

Stephan Richter srichter@cbu.edu
Wed, 10 Jul 2002 20:17:03 -0400


Update of /cvs-repository/Zope3/lib/python/Zope/App/OFS/Content/DTMLPage/Views/Browser
In directory cvs.zope.org:/tmp/cvs-serv13931/DTMLPage/Views/Browser

Added Files:
	DTMLPageEdit.py DTMLPageEval.py __init__.py configure.zcml 
	edit.pt 
Log Message:
Similar to the ZPT Page we should also have a DTML Page. Currently it does
not implement the DTML 2 proposal (no time). :(


=== Added File Zope3/lib/python/Zope/App/OFS/Content/DTMLPage/Views/Browser/DTMLPageEdit.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.
# 
##############################################################################
"""

$Id: DTMLPageEdit.py,v 1.1 2002/07/11 00:17:02 srichter Exp $
"""

from Zope.App.Formulator.Form import Form
from Zope.App.PageTemplate import ViewPageTemplateFile


class DTMLPageEdit(Form):

    __implements__ = Form.__implements__

    name = 'editForm'     
    title = 'Edit Form'
    description = ('This edit form allows you to make changes to the ' +
                   'source code of this DTML Page.')

    _fieldViewNames = ['SourceFieldView']
    template = ViewPageTemplateFile('edit.pt')


=== Added File Zope3/lib/python/Zope/App/OFS/Content/DTMLPage/Views/Browser/DTMLPageEval.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: DTMLPageEval.py,v 1.1 2002/07/11 00:17:02 srichter Exp $
"""

from Zope.Publisher.Browser.BrowserView import BrowserView
from Zope.Proxy.ContextWrapper import getWrapperContainer

class DTMLPageEval(BrowserView):

    def index(self, REQUEST=None, **kw):
        """Call a Page Template"""

        template = self.context
        return template.render(REQUEST, **kw)



=== Added File Zope3/lib/python/Zope/App/OFS/Content/DTMLPage/Views/Browser/__init__.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.
# 
##############################################################################
"""

$Id: __init__.py,v 1.1 2002/07/11 00:17:02 srichter Exp $
"""


=== Added File Zope3/lib/python/Zope/App/OFS/Content/DTMLPage/Views/Browser/configure.zcml ===
<zopeConfigure
   xmlns='http://namespaces.zope.org/zope'
   xmlns:browser='http://namespaces.zope.org/browser'
   package="Zope.App.OFS.Content.DTMLPage"
>

  <!-- DTML Page View Directives -->

  <browser:defaultView
      name="index.html"
      for=".DTMLPage.IDTMLPage."
      />

  <browser:view
      permission="Zope.View"
      for=".DTMLPage.IDTMLPage."
      factory=".Views.Browser.DTMLPageEval.">
      
      <browser:page name="index.html" attribute="index" />
  </browser:view>

  <browser:view
      permission="Zope.ManageContent"
      for=".DTMLPage.IDTMLPage."
      factory=".Views.Browser.DTMLPageEdit." >

      <browser:page name="editForm.html" attribute="index" />
      <browser:page name="edit.html" attribute="action" />

  </browser:view>

  <!-- Registering all the field views for the browser -->

  <browser:view
      name="SourceFieldView"
      for=".DTMLPage.IDTMLPage."
      factory=".DTMLPageFields.SourceField. 
               Zope.App.Formulator.Widgets.Browser.TextAreaWidget." />

  <!-- tabs for DTML Page -->

  <browser:menuItems menu="zmi_views" for=".DTMLPage.IDTMLPage.">
    <browser:menuItem title="Edit" action="editForm.html"/>
    <browser:menuItem title="View" action="."/>
    <!-- XXX This isn't working
    <browser:menuItem title="Role Permissions"
             action="AllRolePermissions.html"/>
    -->
  </browser:menuItems>

  <browser:icon name="zmi_icon" for=".DTMLPage.IDTMLPage." file="dtml.gif" />

  <browser:menuItem menu="add_content"
                    for="Zope.App.OFS.Container.IAdding."
                    title="DTML Page" action="DTMLPage"/>

</zopeConfigure>


=== Added File Zope3/lib/python/Zope/App/OFS/Content/DTMLPage/Views/Browser/edit.pt ===
<html metal:use-macro="views/standard_macros/page">
  <head>
    <style metal:fill-slot="headers" type="text/css">
      <!--
      .ContentIcon {
	  width: 20px;
      }
      
      .ContentTitle {
	  text-align: left;
      }
      -->
    </style>
  </head>

  <body>
    <div metal:fill-slot="body">

 
 
      <p tal:content="context/msg"
         tal:condition="python: hasattr(context, 'msg')">
        Message will go here.
      </p>

      <p tal:content="view/description">
        Description of the Form.
      </p>


      <div tal:condition="python: options.has_key('errors') and options['errors']">
        Errors:
        <div tal:repeat="error options/errors | nothing"
             tal:content="error">Foo </div>
      </div>

      <form action="edit.html" method="post">

        <table class="EditTable">      
	  <tbody>   
  
	    <tr tal:repeat="fieldView python:view.getFieldViews(request)">
	      <th class="EditAttributeName"
                  tal:content="python: fieldView.context.getValue('title')">Title</th>
	      <td class="EditAttributeValue"
	          tal:content="structure fieldView/render"><input />
              </td>
	    </tr>
  
	  </tbody>     
      </table>

      <input type="submit" name="edit" value="Save Changes">

      </form> 

    </div>
  </body>
</html>