[Checkins] SVN: grok/trunk/src/grok/ Grokkify grok.admin (the admin
UI).
Philipp von Weitershausen
philikon at philikon.de
Wed Feb 7 07:10:39 EST 2007
Log message for revision 72420:
Grokkify grok.admin (the admin UI).
Changed:
D grok/trunk/src/grok/admin/configure.zcml
D grok/trunk/src/grok/admin/manage.pt
U grok/trunk/src/grok/admin/view.py
A grok/trunk/src/grok/admin/view_templates/
A grok/trunk/src/grok/admin/view_templates/index.pt
U grok/trunk/src/grok/configure.zcml
-=-
Deleted: grok/trunk/src/grok/admin/configure.zcml
===================================================================
--- grok/trunk/src/grok/admin/configure.zcml 2007-02-07 12:04:48 UTC (rev 72419)
+++ grok/trunk/src/grok/admin/configure.zcml 2007-02-07 12:10:39 UTC (rev 72420)
@@ -1,19 +0,0 @@
-<configure
- xmlns="http://namespaces.zope.org/zope"
- xmlns:browser="http://namespaces.zope.org/browser">
-
- <browser:pages
- for="zope.app.folder.interfaces.IRootFolder"
- class=".view.Admin"
- permission="zope.ManageApplication">
- <browser:page
- template="manage.pt"
- name="index.html"
- />
- <browser:page
- name="add"
- attribute="add"
- />
- </browser:pages>
-
-</configure>
Deleted: grok/trunk/src/grok/admin/manage.pt
===================================================================
--- grok/trunk/src/grok/admin/manage.pt 2007-02-07 12:04:48 UTC (rev 72419)
+++ grok/trunk/src/grok/admin/manage.pt 2007-02-07 12:10:39 UTC (rev 72420)
@@ -1,40 +0,0 @@
-<html>
- <head>
- <title>grok administration interface</title>
- </head>
-
- <body>
- <h1>Installed applications</h1>
-
- <ul>
- <li tal:repeat="app context/values">
- <a tal:attributes="href string:${context/@@absolute_url}/${app/__name__}">
- <span tal:replace="app/__name__"/>
- (<span tal:replace="app/__class__/__name__"/>)
- </a>
- </li>
- </ul>
-
- <form tal:attributes="action string:${context/@@absolute_url}/add">
- <fieldset>
- <legend>Add application</legend>
-
- <p>
- <label>Application:
- <select height="1" name="application">
- <option tal:repeat="app view/applications"
- tal:attributes="value app"
- tal:content="app"
- />
- </select>
- </label>
- </p>
-
- <p><label>Name: <input type="text" name="name"/></label></p>
-
- <p><input type="submit" value="Add"/></p>
-
- </fieldset>
- </form>
- </body>
-</html>
Modified: grok/trunk/src/grok/admin/view.py
===================================================================
--- grok/trunk/src/grok/admin/view.py 2007-02-07 12:04:48 UTC (rev 72419)
+++ grok/trunk/src/grok/admin/view.py 2007-02-07 12:10:39 UTC (rev 72420)
@@ -1,25 +1,25 @@
import zope.component
import grok.interfaces
+from zope.app.folder.interfaces import IRootFolder
-from zope.app import zapi
+grok.context(IRootFolder)
+grok.define_permission('grok.ManageApplications')
+class Index(grok.View):
+ grok.name('index.html') # the root folder isn't a grok.Model
+ grok.require('grok.ManageApplications')
-class Admin(object):
-
- def __init__(self, context, request):
- self.context = context
- self.request = request
-
- @property
- def applications(self):
+ def update(self):
apps = zope.component.getAllUtilitiesRegisteredFor(
grok.interfaces.IApplication)
- return ["%s.%s" % (x.__module__, x.__name__)
- for x in apps]
+ self.applications = ("%s.%s" % (x.__module__, x.__name__)
+ for x in apps)
- def add(self, application, name):
+class Add(grok.View):
+ grok.require('grok.ManageApplications')
+
+ def render(self, application, name):
app = zope.component.getUtility(grok.interfaces.IApplication,
name=application)
self.context[name] = app()
- self.request.response.redirect(zapi.absoluteURL(self.context,
- self.request))
+ self.redirect(self.url(self.context))
Copied: grok/trunk/src/grok/admin/view_templates/index.pt (from rev 72416, grok/trunk/src/grok/admin/manage.pt)
Modified: grok/trunk/src/grok/configure.zcml
===================================================================
--- grok/trunk/src/grok/configure.zcml 2007-02-07 12:04:48 UTC (rev 72419)
+++ grok/trunk/src/grok/configure.zcml 2007-02-07 12:10:39 UTC (rev 72420)
@@ -1,5 +1,6 @@
<configure
- xmlns="http://namespaces.zope.org/zope">
+ xmlns="http://namespaces.zope.org/zope"
+ xmlns:grok="http://namespaces.zope.org/grok">
<!-- we register special IAbsoluteURL views on grok views so that
can have them inspect __view_name__ instead of __name__.
@@ -42,6 +43,6 @@
priority="11"
/>
- <include package=".admin"/>
+ <grok:grok package=".admin" />
</configure>
More information about the Checkins
mailing list