[Checkins] SVN: grok/trunk/src/grok/admin/view Enabled deletion for installed grok applications

Darryl Cousins darryl at darrylcousins.net.nz
Mon Mar 19 20:22:53 EDT 2007


Log message for revision 73366:
  Enabled deletion for installed grok applications

Changed:
  U   grok/trunk/src/grok/admin/view.py
  U   grok/trunk/src/grok/admin/view_templates/index.pt

-=-
Modified: grok/trunk/src/grok/admin/view.py
===================================================================
--- grok/trunk/src/grok/admin/view.py	2007-03-19 22:54:58 UTC (rev 73365)
+++ grok/trunk/src/grok/admin/view.py	2007-03-20 00:22:50 UTC (rev 73366)
@@ -23,3 +23,15 @@
                                         name=application)
         self.context[name] = app()
         self.redirect(self.url(self.context))
+
+class Delete(grok.View):
+    grok.require('grok.ManageApplications')
+
+    def render(self, items):
+        if not type(items) == type([]):
+            items = [items]
+        print items
+        for name in items:
+            del self.context[name]
+        self.redirect(self.url(self.context))
+

Modified: grok/trunk/src/grok/admin/view_templates/index.pt
===================================================================
--- grok/trunk/src/grok/admin/view_templates/index.pt	2007-03-19 22:54:58 UTC (rev 73365)
+++ grok/trunk/src/grok/admin/view_templates/index.pt	2007-03-20 00:22:50 UTC (rev 73366)
@@ -3,11 +3,18 @@
     <title>grok administration interface</title>
   </head>
 
-  <body>
-    <h1>Installed applications</h1>
+  <body tal:define="apps context/values">
+    <h1>Grok Applications</h1>
 
+    <form tal:attributes="action string:${context/@@absolute_url}/delete"
+          tal:condition="apps|nothing">
+      <fieldset>
+        <legend>Installed applications</legend>
+
     <ul>
-      <li tal:repeat="app context/values">
+      <li tal:repeat="app apps">
+        <input type="checkbox" tal:attributes="value app/__name__;
+                                               name string:items" />
         <a tal:attributes="href string:${context/@@absolute_url}/${app/__name__}">
           <span tal:replace="app/__name__"/>
           (<span tal:replace="app/__class__/__name__"/>)
@@ -15,6 +22,9 @@
       </li>
     </ul>
 
+        <p><input type="submit" value="Delete Selected"/></p>
+        </fieldset>
+    </form>
     <form tal:attributes="action string:${context/@@absolute_url}/add">
       <fieldset>
         <legend>Add application</legend>



More information about the Checkins mailing list