[Zope3-checkins] CVS: Zope3/lib/python/Zope/App/OFS/Services/ServiceManager/Views/Browser - edit_module.pt:1.1 EditModule.py:1.1 AddModule.py:1.1 configure.zcml:1.9

Jeremy Hylton jeremy@zope.com
Wed, 2 Oct 2002 18:18:02 -0400


Update of /cvs-repository/Zope3/lib/python/Zope/App/OFS/Services/ServiceManager/Views/Browser
In directory cvs.zope.org:/tmp/cvs-serv32741/lib/python/Zope/App/OFS/Services/ServiceManager/Views/Browser

Modified Files:
	configure.zcml 
Added Files:
	edit_module.pt EditModule.py AddModule.py 
Log Message:
Add persistent module manager for use with Zope.

The manager uses the ServiceManager as its registry, finding it via
context.

New views to add and edit modules.

XXX There are no test cases yet.




=== Added File Zope3/lib/python/Zope/App/OFS/Services/ServiceManager/Views/Browser/edit_module.pt ===
<html metal:use-macro="views/standard_macros/page">
<head><title>Add a module</title></head>
<body>
<div metal:fill-slot="body">

<p>Enter the absolute module name and source code.</p>

<form action="edit.html">
<span tal:replace="view/update"></span>
<p>Module: <span tal:content="context/name">Module Name</span></p>
<textarea name="source" cols="65" rows="25" tal:content="context/source">  
</textarea>
<input type="submit" value="Edit"/>
</form>

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


=== Added File Zope3/lib/python/Zope/App/OFS/Services/ServiceManager/Views/Browser/EditModule.py ===
##############################################################################
#
# Copyright (c) 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.
# 
##############################################################################
"""Handle form to edit module

$Id: EditModule.py,v 1.1 2002/10/02 22:18:00 jeremy Exp $
"""

from Zope.Publisher.Browser.BrowserView import BrowserView
from Zope.App.OFS.Services.ServiceManager.Module import Manager

class EditModule(BrowserView):

    def update(self):
        if "source" in self.request:
            self.context.update(self.request["source"])
            return u"The source was updated."
        else:
            return u""


=== Added File Zope3/lib/python/Zope/App/OFS/Services/ServiceManager/Views/Browser/AddModule.py ===
##############################################################################
#
# Copyright (c) 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.
# 
##############################################################################
"""Handle form to create module

$Id: AddModule.py,v 1.1 2002/10/02 22:18:00 jeremy Exp $
"""

from Zope.Publisher.Browser.BrowserView import BrowserView
from Zope.App.OFS.Services.ServiceManager.Module import Manager

class AddModule(BrowserView):

    def action(self, name, source):
        mgr = Manager()
        mgr = self.context.add(mgr)
        mgr.new(name, source)
        self.request.response.redirect(self.context.nextURL())


=== Zope3/lib/python/Zope/App/OFS/Services/ServiceManager/Views/Browser/configure.zcml 1.8 => 1.9 ===
--- Zope3/lib/python/Zope/App/OFS/Services/ServiceManager/Views/Browser/configure.zcml:1.8	Wed Oct  2 15:01:45 2002
+++ Zope3/lib/python/Zope/App/OFS/Services/ServiceManager/Views/Browser/configure.zcml	Wed Oct  2 18:18:00 2002
@@ -87,5 +87,26 @@
   <menuItem menu="add_component" for="Zope.App.OFS.Container.IAdding."
      action="ServiceDirective"  title="Service Directive" />
 
+  <view for="Zope.App.OFS.Container.IAdding."
+        name="Module"
+        factory=".Views.Browser.AddModule."
+        >
+      <page name="index.html" template="Views/Browser/add_module.pt" />
+      <page name="action.html" attribute="action" />
+  </view>
+
+  <menuItem menu="add_component" for="Zope.App.OFS.Container.IAdding."
+     action="Module"  title="Module" />
+
+  <view for="Persistence.IPersistentModuleManager."
+        factory=".Views.Browser.EditModule."
+        >
+      <page name="edit.html" template="Views/Browser/edit_module.pt" />
+  </view>
+
+  <menuItems menu="zmi_views" for="Persistence.IPersistentModuleManager.">
+    <menuItem title="Edit" action="edit.html" />
+  </menuItems>
+
 </zope:zopeConfigure>