Code

Added the missing keyword/topic interface to classic template (blush)
authorrichard <richard@57a73879-2fb5-44c3-a270-3262357dd7e2>
Wed, 11 Sep 2002 02:49:56 +0000 (02:49 +0000)
committerrichard <richard@57a73879-2fb5-44c3-a270-3262357dd7e2>
Wed, 11 Sep 2002 02:49:56 +0000 (02:49 +0000)
Cleaned up the classhelp API
Fixed some stuff in the customisation doc example.

git-svn-id: http://svn.roundup-tracker.org/svnroot/roundup/trunk@1134 57a73879-2fb5-44c3-a270-3262357dd7e2

TODO.txt
doc/customizing.txt
roundup/cgi/templating.py
roundup/templates/classic/dbinit.py
roundup/templates/classic/html/home
roundup/templates/classic/html/issue.index
roundup/templates/classic/html/issue.item
roundup/templates/classic/html/issue.search
roundup/templates/classic/html/page

index 8670986f1d94fc402cb622a4665de7543ecbb564..5280c6e701f56aa7089dc223ba192c08ca9b5c48 100644 (file)
--- a/TODO.txt
+++ b/TODO.txt
@@ -45,8 +45,6 @@ pending web: search "refinement"
 pending web: UNIX init.d script for roundup-server
 pending web: rewritten documentation (can come after the beta though so stuff
              is settled) ... including relevant file names in customisation doc
-pending admin: have "set" command be applicable to all items in a class
-pending admin: add "unset" command
 pending dist: include the HTML in docs
 
 bug web: request.url is incorrect in cgi-bin environments
@@ -78,6 +76,8 @@ done web: fix double-submit by having new-item-submit redirect at end
 done web: daemonify roundup-server (fork, logfile, pidfile)
 done web: modify cgitb to display PageTemplate errors better
 done web: have roundup.cgi pick up instance config from the environment 
+done admin: have "set" command be applicable to all items in a class, and also
+            be able to unset properties (ie. set to None)
 
 rejected instance: the use of non-Python configuration files (ConfigParser)
 
index acc555d64cf0b8cf99cc211e13244e2e01cf71ec..223f04acbae6c9123f83830c309f42b1292bf9b2 100644 (file)
@@ -2,7 +2,7 @@
 Customising Roundup
 ===================
 
-:Version: $Revision: 1.27 $
+:Version: $Revision: 1.28 $
 
 .. This document borrows from the ZopeBook section on ZPT. The original is at:
    http://www.zope.org/Documentation/Books/ZopeBook/current/ZPT.stx
@@ -974,7 +974,7 @@ template issue item edit form - from the "issue.item" template)::
   <th nowrap>Superseder</th>
   <td>
    <span tal:replace="structure python:context.superseder.field(showid=1, size=20)" />
-   <span tal:replace="structure python:db.issue.classhelp('id,title', label='list', width=500)" />
+   <span tal:replace="structure python:db.issue.classhelp('id,title')" />
    <span tal:condition="context/superseder">
     <br>View: <span tal:replace="structure python:context.superseder.link(showid=1)" />
    </span>
@@ -982,7 +982,7 @@ template issue item edit form - from the "issue.item" template)::
   <th nowrap>Nosy List</th>
   <td>
    <span tal:replace="structure context/nosy/field" />
-   <span tal:replace="structure python:db.user.classhelp('username,realname,address,phone', label='list', width=500)" />
+   <span tal:replace="structure python:db.user.classhelp('username,realname,address,phone')" />
   </td>
  </tr>
  
@@ -1293,7 +1293,7 @@ To get everything to line up properly we will put everything in a table,
 and put a nice big header on it so the user has an idea what is happening::
 
     <table class="form">
-     <tr class="strong-header"><td colspan=2>Category</td></tr>
+     <tr><th class="header" colspan=2>Category</th></tr>
 
 Next we need the actual field that the user is going to enter the new
 category. The "context.name.field(size=60)" bit tells roundup to generate a
@@ -1303,7 +1303,7 @@ this is that when the user types something in to the form, a new category
 will be created with that name::
 
     <tr>
-     <td nowrap>Name</td>
+     <th nowrap>Name</th>
      <td tal:content="structure python:context.name.field(size=60)">name</td>
     </tr>
 
@@ -1326,10 +1326,10 @@ So putting it all together, and closing the table and form we get::
   <input type="hidden" name=":required" value="name">
 
   <table class="form">
-   <tr class="strong-header"><td colspan=2>Category</td></tr>
+   <tr><th class="header" colspan=2>Category</th></tr>
 
    <tr>
-    <td nowrap>Name</td>
+    <th nowrap>Name</th>
     <td tal:content="structure python:context.name.field(size=60)">name</td>
    </tr>
 
@@ -1362,8 +1362,7 @@ it is entirely up to your sense of aesthetics::
 
    <th nowrap>Category</th>
    <td><span tal:replace="structure context/category/field" />
-       <span tal:replace="structure python:db.category.classhelp('name',
-             label='list', width=500)" />
+       <span tal:replace="structure db/category/classhelp" />
    </td>
 
 First we define a nice header so that the user knows what the next section
index b458c6c7e2a932fb8bf3cebe9f6c54b76c1f9a49..f1b78b448790ed8da5cf57b7dc7e219f38a89e1b 100644 (file)
@@ -348,17 +348,24 @@ class HTMLClass:
              for x in self._klass.filter(None, filterspec, sort, group)]
         return l
 
-    def classhelp(self, properties, label='?', width='400', height='400'):
-        '''pop up a javascript window with class help
-
-           This generates a link to a popup window which displays the 
-           properties indicated by "properties" of the class named by
-           "classname". The "properties" should be a comma-separated list
-           (eg. 'id,name,description').
-
-           You may optionally override the label displayed, the width and
-           height. The popup window will be resizable and scrollable.
+    def classhelp(self, properties=None, label='list', width='500',
+            height='400'):
+        ''' Pop up a javascript window with class help
+
+            This generates a link to a popup window which displays the 
+            properties indicated by "properties" of the class named by
+            "classname". The "properties" should be a comma-separated list
+            (eg. 'id,name,description'). Properties defaults to all the
+            properties of a class (excluding id, creator, created and
+            activity).
+
+            You may optionally override the label displayed, the width and
+            height. The popup window will be resizable and scrollable.
         '''
+        if properties is None:
+            properties = self._klass.getprops(protected=0).keys()
+            properties.sort()
+            properties = ','.join(properties)
         return '<a href="javascript:help_window(\'%s?:template=help&' \
             ':contentonly=1&properties=%s\', \'%s\', \'%s\')"><b>'\
             '(%s)</b></a>'%(self.classname, properties, width, height, label)
index 0cb944d9af3fc408ffdfe3da5f59a7b072af53e6..9ed49bdcaf7e9214703e695ca11adcb8e2b49517 100644 (file)
@@ -15,7 +15,7 @@
 # BASIS, AND THERE IS NO OBLIGATION WHATSOEVER TO PROVIDE MAINTENANCE,
 # SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
 # 
-# $Id: dbinit.py,v 1.27 2002-09-11 01:18:24 richard Exp $
+# $Id: dbinit.py,v 1.28 2002-09-11 02:49:56 richard Exp $
 
 import os
 
@@ -93,7 +93,7 @@ def open(name=None):
     # SECURITY SETTINGS
     #
     # new permissions for this schema
-    for cl in 'issue', 'file', 'msg', 'user':
+    for cl in 'issue', 'file', 'msg', 'user', 'keyword':
         db.security.addPermission(name="Edit", klass=cl,
             description="User is allowed to edit "+cl)
         db.security.addPermission(name="View", klass=cl,
@@ -101,7 +101,7 @@ def open(name=None):
 
     # Assign the access and edit permissions for issue, file and message
     # to regular users now
-    for cl in 'issue', 'file', 'msg':
+    for cl in 'issue', 'file', 'msg', 'keyword':
         p = db.security.getPermission('View', cl)
         db.security.addPermissionToRole('User', p)
         p = db.security.getPermission('Edit', cl)
index 03fe21bbaf55ffadab473eb2a04d541a8cddf08f..d64492ab8417377b5e77e523b621444a2367fe3d 100644 (file)
@@ -6,6 +6,6 @@
 -->
 <span tal:replace="structure python:db.issue.renderWith('index',
     sort=('-', 'activity'), group=('+', 'priority'), filter=['status'],
-    columns=['id','activity','title','creator','assignedto', 'status'],
+    columns=['id','activity','topic','title','creator','assignedto', 'status'],
     filterspec={'status':['-1','1','2','3','4','5','6','7']})" />
 
index 4b1e3af3c122a578e50350296cfa6b0029360c88..8edd88d88d6f46ec8b6c3eaf71e8364141d87027 100644 (file)
@@ -5,6 +5,7 @@
    <th tal:condition="request/show/priority">Priority</th>
    <th tal:condition="request/show/id">ID</th>
    <th tal:condition="request/show/activity">Activity</th>
+   <th tal:condition="request/show/topic">Topic</th>
    <th tal:condition="request/show/title">Title</th>
    <th tal:condition="request/show/status">Status</th>
    <th tal:condition="request/show/creator">Created&nbsp;By</th>
@@ -22,6 +23,7 @@
    <td tal:condition="request/show/id" tal:content="i/id"></td>
    <td tal:condition="request/show/activity"
        tal:content="i/activity/reldate"></td>
+   <td tal:condition="request/show/topic" tal:content="i/topic"></td>
    <td tal:condition="request/show/title">
     <a tal:attributes="href string:issue${i/id}"
        tal:content="python:str(i.title) or '[no title]'">title</a>
index 8c653f6a27769dd56a02ff577519810cd02663b0..50eca434c07b712a0c25efdfe905bc9a7cdee68e 100644 (file)
@@ -22,7 +22,7 @@
  <th nowrap>Superseder</th>
  <td>
   <span tal:replace="structure python:context.superseder.field(showid=1, size=20)" />
-  <span tal:replace="structure python:db.issue.classhelp('id,title', label='list', width=500)" />
+  <span tal:replace="structure python:db.issue.classhelp('id,title')" />
   <span tal:condition="context/superseder" tal:repeat="sup context/superseder">
    <br>View: <a tal:attributes="href string:issue${sup/id}"
                 tal:content="sup/id"></a>
  <th nowrap>Nosy List</th>
  <td>
   <span tal:replace="structure context/nosy/field" />
-  <span tal:replace="structure python:db.user.classhelp('username,realname,address,phone', label='list', width=500)" />
+  <span tal:replace="structure python:db.user.classhelp('username,realname,address,phone')" />
  </td>
 </tr>
 
 <tr>
  <th nowrap>Assigned To</th>
  <td tal:content="structure context/assignedto/menu">assignedto menu</td>
- <td>&nbsp;</td>
- <td>&nbsp;</td>
+ <th nowrap>Topics</th>
+ <td>
+  <span tal:replace="structure context/topic/field" />
+  <span tal:replace="structure db/keyword/classhelp" />
+ </td>
 </tr>
 
 <tr>
index c5899904a5709090d49c8a357c721a6b597aa961..3bc602583fa2f627a1d4d868f7ca90b5b7533ea6 100644 (file)
  <td>&nbsp;</td>
 </tr>
 
+<tr>
+ <th>Topic:</th>
+ <td>
+  <select name="topic">
+   <option value="">don't care</option>
+   <option value="">------------</option>
+   <option tal:repeat="s db/keyword/list" tal:attributes="value s/name"
+           tal:content="s/name">topic to filter on</option>
+  </select>
+ </td>
+ <td><input type="checkbox" name=":columns" value="topic" checked></td>
+ <td><input type="radio" name=":sort" value="topic"></td>
+ <td><input type="radio" name=":group" value="topic"></td>
+</tr>
+
 <tr>
  <th>Created:</th>
  <td><input name="activity"></td>
index ff11246e6aa1a69a9550a1c11a60d46f40598dc0..e5c0f34bf1372e0c76cf03b1b72e794fdfe9c365 100644 (file)
    <b>Issues</b><br>
    <a tal:condition="python:request.user.hasPermission('Edit', 'issue')"
       href="issue?:template=item">New Issue<br></a>
-   <a href="issue?:sort=-activity&:group=priority&:filter=status,assignedto&:columns=id,activity,title,creator,status&status=-1,1,2,3,4,5,6,7&assignedto=-1">Unassigned Issues</a><br>
-   <a href="issue?:sort=-activity&:group=priority&:filter=status&:columns=id,activity,title,creator,assignedto,status&status=-1,1,2,3,4,5,6,7">All Issues</a><br>
+   <a href="issue?:sort=-activity&:group=priority&:filter=status,assignedto&:columns=id,activity,topic,title,creator,status&status=-1,1,2,3,4,5,6,7&assignedto=-1">Unassigned Issues</a><br>
+   <a href="issue?:sort=-activity&:group=priority&:filter=status&:columns=id,activity,topic,title,creator,assignedto,status&status=-1,1,2,3,4,5,6,7">All Issues</a><br>
    <a href="issue?:template=search">Search Issues</a>
   </p>
 
+  <p class="classblock"
+     tal:condition="python:request.user.hasPermission('View', 'keyword')">
+   <b>Keywords</b><br>
+   <a tal:condition="python:request.user.hasPermission('Edit', 'keyword')"
+      href="keyword?:template=item">New Keyword<br></a>
+  </p>
+
   <p class="classblock"
        tal:condition="python:request.user.hasPermission('Edit', None)">
    <b>Admin</b><br>
@@ -59,7 +66,7 @@
    
   <p class="userblock" tal:condition="python:request.user.username != 'anonymous'">
    <b>Hello,</b><br><b tal:content="request/user/username">username</b><br>
-   <a tal:attributes="href string:issue?:sort=-activity&:group=priority&:filter=status,assignedto&:columns=id,activity,title,creator,status&status=-1,1,2,3,4,5,6,7&assignedto=${request/user/id}">My Issues</a><br>
+   <a tal:attributes="href string:issue?:sort=-activity&:group=priority&:filter=status,assignedto&:columns=id,topic,activity,title,creator,status&status=-1,1,2,3,4,5,6,7&assignedto=${request/user/id}">My Issues</a><br>
    <a tal:attributes="href string:user${request/user/id}">My Details</a><br>
    <a tal:attributes="href python:request.indexargs_href('',
        {':action':'logout'})">Logout</a>