[Zope-Checkins] CVS: Zope3/lib/python/Zope/App/OFS/ApplicationControl/ServerControl/Views/Browser - ServerControlView.py:1.2 __init__.py:1.2 browser.zcml:1.2 server-control.pt:1.2
Jim Fulton
jim@zope.com
Mon, 10 Jun 2002 19:28:24 -0400
Update of /cvs-repository/Zope3/lib/python/Zope/App/OFS/ApplicationControl/ServerControl/Views/Browser
In directory cvs.zope.org:/tmp/cvs-serv17445/lib/python/Zope/App/OFS/ApplicationControl/ServerControl/Views/Browser
Added Files:
ServerControlView.py __init__.py browser.zcml
server-control.pt
Log Message:
Merged Zope-3x-branch into newly forked Zope3 CVS Tree.
=== Zope3/lib/python/Zope/App/OFS/ApplicationControl/ServerControl/Views/Browser/ServerControlView.py 1.1 => 1.2 ===
+#
+# 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.
+#
+##############################################################################
+__doc__ = """ Server Control View
+
+$Id$ """
+
+from Zope.Publisher.Browser.BrowserView import BrowserView
+from Zope.App.PageTemplate import ViewPageTemplateFile
+from Zope.App.OFS.ApplicationControl.ServerControl.IServerControl \
+ import IServerControl
+from Zope.ComponentArchitecture import getUtility
+
+class ServerControlView(BrowserView):
+
+ def serverControl(self):
+ return getUtility(self.context, IServerControl)
+ # XXX what are we going to do if this fails???
+
+ def action(self):
+ """Do the shutdown/restart!"""
+ if 'restart' in self.request:
+ return self.serverControl().restart() or "You restarted the server."
+ elif 'shutdown' in self.request:
+ return self.serverControl().shutdown() or \
+ "You shut down the server."
+
+ index = ViewPageTemplateFile('server-control.pt')
+
=== Zope3/lib/python/Zope/App/OFS/ApplicationControl/ServerControl/Views/Browser/__init__.py 1.1 => 1.2 ===
=== Zope3/lib/python/Zope/App/OFS/ApplicationControl/ServerControl/Views/Browser/browser.zcml 1.1 => 1.2 ===
+ xmlns='http://namespaces.zope.org/zope'
+ xmlns:security='http://namespaces.zope.org/security'
+ xmlns:browser='http://namespaces.zope.org/browser'
+ xmlns:application-control='http://namespaces.zope.org/application-control'
+>
+
+ <!-- ServerControl View Directives -->
+ <browser:view
+ for="Zope.App.OFS.ApplicationControl.IApplicationControl."
+ permission="Zope.ManageApplication"
+ factory=".ServerControlView.">
+
+ <browser:page name="ServerControlForm.html" attribute="index" />
+ <browser:page name="ServerControl.html" attribute="action" />
+ </browser:view>
+
+
+ <application-control:registerView
+ name="ServerControlForm.html"
+ title="Server control" />
+
+</zopeConfigure>
=== Zope3/lib/python/Zope/App/OFS/ApplicationControl/ServerControl/Views/Browser/server-control.pt 1.1 => 1.2 ===
+<head>
+<title>Zope Stub Server Controller</title>
+</head>
+<body>
+<div metal:fill-slot="body">
+
+ <form name="servercontrol" action="ServerControl.html" method="post">
+ <input type="submit" name="restart" value="Restart server" /> <br />
+ <input type="submit" name="shutdown" value="Shutdown server" /> <br />
+ </form>
+
+</div>
+</body>
+</html>