Code

more doc, more cleanup
authorrichard <richard@57a73879-2fb5-44c3-a270-3262357dd7e2>
Mon, 9 Sep 2002 01:59:43 +0000 (01:59 +0000)
committerrichard <richard@57a73879-2fb5-44c3-a270-3262357dd7e2>
Mon, 9 Sep 2002 01:59:43 +0000 (01:59 +0000)
git-svn-id: http://svn.roundup-tracker.org/svnroot/roundup/trunk@1093 57a73879-2fb5-44c3-a270-3262357dd7e2

doc/customizing.txt
roundup/cgi/templating.py
roundup/templates/classic/html/file.newitem
roundup/templates/classic/html/issue.item
roundup/templates/classic/html/issue.search
roundup/templates/classic/html/msg.item
roundup/templates/classic/html/style.css
roundup/templates/classic/html/user.item

index 6a8b28b4d9853ed389dc5f8e0540fc430721227e..1f4d65e3b0dc4466d8b63b110282de2072302140 100644 (file)
@@ -2,7 +2,7 @@
 Customising Roundup
 ===================
 
-:Version: $Revision: 1.20 $
+:Version: $Revision: 1.21 $
 
 .. This document borrows from the ZopeBook section on ZPT. The original is at:
    http://www.zope.org/Documentation/Books/ZopeBook/current/ZPT.stx
@@ -1016,6 +1016,9 @@ displayed in an editable field.
 Index Views
 ~~~~~~~~~~~
 
+This is one of the class context views. It is also the default view for
+classes. The template used is "*classname*.index".
+
 Index View Specifiers
 :::::::::::::::::::::
 
@@ -1058,109 +1061,120 @@ TODO
 Searching Views
 ~~~~~~~~~~~~~~~
 
+This is one of the class context views. The template used is typically
+"*classname*.search".
+
 TODO
 
 Item Views
 ~~~~~~~~~~
 
-An item view contains an editor section and a spool section. At the top of an
-item view, links to superseding and superseded items are always displayed.
+The basic view of a hyperdb item is provided by the "*classname*.item"
+template. It generally has three sections; an "editor", a "spool" and a
+"history" section.
 
-Editor Section
-::::::::::::::
 
-The editor section is generated from a template containing <display> tags to
-insert the appropriate widgets for editing properties.
 
-Here's an example of a basic editor template.::
+Editor Section
+::::::::::::::
 
-     <table>
-     <tr>
-         <td colspan=2>
-             <display call="field('title', size=60)">
-         </td>
-     </tr>
-     <tr>
-         <td>
-             <display call="field('fixer', size=30)">
-         </td>
-         <td>
-             <display call="menu('status')>
-         </td>
-     </tr>
-     <tr>
-         <td>
-             <display call="field('nosy', size=30)">
-         </td>
-         <td>
-             <display call="menu('priority')>
-         </td>
-     </tr>
-     <tr>
-         <td colspan=2>
-             <display call="note()">
-         </td>
-     </tr>
-     </table>
-
-As shown in the example, the editor template can also request the display of a
-"note" field, which is a text area for entering a note to go along with a
-change.
-
-The <property> tag used in the index may also be used here - it checks to see
-if the nominated Multilink property has any entries. This can be used to
-eliminate sections of the editor section if the property has no entries::
-
-  <td class="form-text">
-    <display call="field('superseder', size=40, showid=1)">
-    <display call="classhelp('issue', 'id,title', label='list', width=500)">
-    <property name="superseder">
-      <br>View: <display call="link('superseder', showid=1)">
-    </property>
+The editor section is used to manipulate the item - it may be a
+static display if the user doesn't have permission to edit the item.
+
+Here's an example of a basic editor template (this is the default "classic"
+template issue item edit form - from the "issue.item" template)::
+
+ <table class="form">
+ <tr>
+  <th nowrap>Title</th>
+  <td colspan=3 tal:content="structure python:context.title.field(size=60)">title</td>
+ </tr>
+ <tr>
+  <th nowrap>Priority</th>
+  <td tal:content="structure context/priority/menu">priority</td>
+  <th nowrap>Status</th>
+  <td tal:content="structure context/status/menu">status</td>
+ </tr>
+ <tr>
+  <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:condition="context/superseder">
+    <br>View: <span tal:replace="structure python:context.superseder.link(showid=1)" />
+   </span>
+  </td>
+  <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)" />
+  </td>
+ </tr>
+ <tr>
+  <th nowrap>Assigned To</th>
+  <td tal:content="structure context/assignedto/menu">
+   assignedto menu
   </td>
+  <td>&nbsp;</td>
+  <td>&nbsp;</td>
+ </tr>
+ <tr>
+  <th nowrap>Change Note</th>
+  <td colspan=3>
+   <textarea name="__note" wrap="hard" rows="5" cols="60"></textarea>
+  </td>
+ </tr>
+ <tr>
+  <th nowrap>File</th>
+  <td colspan=3><input type="file" name="__file" size="40"></td>
+ </tr>
+ <tr>
+  <td>&nbsp;</td>
+  <td colspan=3 tal:content="structure context/submit">
+   submit button will go here
+  </td>
+ </tr>
+ </table>
 
-The "View: " part with the links will only display if the superseder property
-has values.
 
 When a change is submitted, the system automatically generates a message
-describing the changed properties.
+describing the changed properties. As shown in the example, the editor
+template can use the "__note" and "__file" fields, which are added to the
+standard change note message generated by Roundup.
 
-If a note is given in the "note" field, the note is appended to the
-description. The message is then added to the item's message spool (thus
-triggering the standard detector to react by sending out this message to the
-nosy list).
+Spool Section
+:::::::::::::
 
-The message also displays all of the property values on the item and indicates
-which ones have changed. An example of such a message might be this::
+The spool section lists related information like the messages and files of
+an issue.
 
-     Polly's taken a turn for the worse - this is now really important!
-     -----
-     title: Polly Parrot is dead
-     priority: critical
-     status: unread -> in-progress
-     fixer: terry
-     keywords: parrot,plumage,perch,nailed,dead
+TODO
 
-Spool Section
-:::::::::::::
 
-The spool section lists messages in the item's "messages" property. The index
-of messages displays the "date", "author", and "summary" properties on the
-message nodes, and selecting a message takes you to its content.
+History Section
+:::::::::::::::
+
+The final section displayed is the history of the item - its database journal.
+This is generally generated with the template::
+
+ <tal:block tal:replace="structure context/history" />
+
+*To be done:*
 
-The <property> tag used in the index may also be used here - it checks to see
-if the nominated Multilink property has any entries. This can be used to
-eliminate sections of the spool section if the property has no entries::
+*The actual history entries of the node may be accessed for manual templating
+through the "journal" method of the item*::
 
-     <property name="files">
-      <tr class="strong-header">
-       <td><b>Files</b></td>
-      </tr>
+ <tal:block tal:repeat="entry context/journal">
+  a journal entry
+ </tal:block>
 
-      <tr>
-       <td><display call="list('files')"></td>
-      </tr>
-     </property>
+*where each journal entry is an HTMLJournalEntry.*
 
 
 Access Controls
index d8a4f69fcd8e21649c51dd2a6bf035115ebe0686..52094425a16de44d7ada7cb1ca2db3cb3b294020 100644 (file)
@@ -414,12 +414,14 @@ class HTMLItem:
 
     # XXX this probably should just return the history items, not the HTML
     def history(self, direction='descending'):
-        l = ['<table width=100% border=0 cellspacing=0 cellpadding=2>',
-            '<tr class="list-header">',
-            _('<th align=left><span class="list-item">Date</span></th>'),
-            _('<th align=left><span class="list-item">User</span></th>'),
-            _('<th align=left><span class="list-item">Action</span></th>'),
-            _('<th align=left><span class="list-item">Args</span></th>'),
+        l = ['<table class="history">'
+             '<tr><th colspan="4" class="header">',
+             _('History'),
+             '</th></tr><tr>',
+             _('<th>Date</th>'),
+             _('<th>User</th>'),
+             _('<th>Action</th>'),
+             _('<th>Args</th>'),
             '</tr>']
         comments = {}
         history = self.klass.history(self.nodeid)
@@ -550,9 +552,8 @@ class HTMLItem:
                     handled by the history display!</em></strong>''')
                 arg_s = '<strong><em>' + str(args) + '</em></strong>'
             date_s = date_s.replace(' ', '&nbsp;')
-            l.append('<tr><td nowrap valign=top>%s</td><td valign=top>%s</td>'
-                '<td valign=top>%s</td><td valign=top>%s</td></tr>'%(date_s,
-                user, action, arg_s))
+            l.append('<tr><td>%s</td><td>%s</td><td>%s</td><td>%s</td></tr>'%(
+                date_s, user, action, arg_s))
         if comments:
             l.append(_('<tr><td colspan=4><strong>Note:</strong></td></tr>'))
         for entry in comments.values():
@@ -560,10 +561,6 @@ class HTMLItem:
         l.append('</table>')
         return '\n'.join(l)
 
-    def remove(self):
-        # XXX do what?
-        return ''
-
 class HTMLUser(HTMLItem):
     ''' Accesses through the *user* (a special case of item)
     '''
@@ -758,10 +755,6 @@ class LinkHTMLProperty(HTMLProperty):
             value = cgi.escape(value)
         return value
 
-    # XXX most of the stuff from here down is of dubious utility - it's easy
-    # enough to do in the template by hand (and in some cases, it's shorter
-    # and clearer...
-
     def field(self):
         linkcl = self.db.getclass(self.prop.classname)
         if linkcl.getprops().has_key('order'):  
@@ -900,10 +893,6 @@ class MultilinkHTMLProperty(HTMLProperty):
             value = cgi.escape(value)
         return value
 
-    # XXX most of the stuff from here down is of dubious utility - it's easy
-    # enough to do in the template by hand (and in some cases, it's shorter
-    # and clearer...
-
     def field(self, size=30, showid=0):
         sortfunc = make_sort_function(self.db, self.prop.classname)
         linkcl = self.db.getclass(self.prop.classname)
index 6776d082a9c65d94ce88be9484a1bff1d015992f..32d514903a199d3e113c2205322585df8dccd4a3 100644 (file)
@@ -1,18 +1,18 @@
 <!-- dollarId: file.newitem,v 1.1 2001/07/30 08:12:17 richard Exp dollar-->
-<table border=0 cellspacing=0 cellpadding=2>
+<table class="form">
 
-<tr class="strong-header">
+<tr class="header">
  <td colspan=2>File upload details</td>
 </td>
 
-<tr bgcolor="ffffea">
- <td width=1% nowrap align=right><span class="form-label">File:</span></td>
- <td class="form-text"><input type="file" name="content" size="40"></td>
+<tr>
+ <td>File:</td>
+ <td><input type="file" name="content" size="40"></td>
 </tr>
 
-<tr bgcolor="ffffea">
+<tr>
  <td>&nbsp;</td>
- <td class="form-text"><input type="submit" name="submit" value="Submit New Entry"></td>
+ <td><input type="submit" name="submit" value="Submit New Entry"></td>
 </tr>
 
 </table>
index 70ff043a99f33e9f59c1d503aa82a61ab6838438..be47a15e2957e6363de6324fdeb5d9ed49d28707 100644 (file)
@@ -4,20 +4,20 @@
 
 <input type="hidden" name=":required" value="title">
 
-<table border=0 cellspacing=0 cellpadding=2 class="form">
+<table class="form">
 <tr>
  <th nowrap>Title</th>
- <td colspan=3 class="form-text" tal:content="structure python:context.title.field(size=60)">title</td>
+ <td colspan=3 tal:content="structure python:context.title.field(size=60)">title</td>
 </tr>
 
-<tr class="form">
+<tr>
  <th nowrap>Priority</th>
- <td class="form-text" tal:content="structure context/priority/menu">priority</td>
+ <td tal:content="structure context/priority/menu">priority</td>
  <th nowrap>Status</th>
- <td class="form-text" tal:content="structure context/status/menu">status</td>
+ <td tal:content="structure context/status/menu">status</td>
 </tr>
 
-<tr class="form">
+<tr>
  <th nowrap>Superseder</th>
  <td>
   <span tal:replace="structure python:context.superseder.field(showid=1, size=20)" />
  </td>
 </tr>
 
-<tr class="form">
+<tr>
  <th nowrap>Assigned To</th>
- <td class="form-text" tal:content="structure context/assignedto/menu">
+ <td tal:content="structure context/assignedto/menu">
   assignedto menu
  </td>
  <td>&nbsp;</td>
  <td>&nbsp;</td>
 </tr>
 
-<tr class="form">
+<tr>
  <th nowrap>Change Note</th>
- <td colspan=3 class="form-text">
+ <td colspan=3>
   <textarea name="__note" wrap="hard" rows="5" cols="60"></textarea>
  </td>
 </tr>
 
-<tr class="form">
+<tr>
  <th nowrap>File</th>
- <td colspan=3 class="form-text">
-  <input type="file" name="__file" size="40">
- </td>
+ <td colspan=3><input type="file" name="__file" size="40"></td>
 </tr>
 
-<tr class="form">
+<tr>
  <td>&nbsp;</td>
- <td colspan=3 class="form-text" tal:content="structure context/submit">
+ <td colspan=3 tal:content="structure context/submit">
   submit button will go here
  </td>
 </tr>
@@ -97,10 +95,8 @@ changed <b>${context/activity}</b>.">activity info</span>
   </tr>
  </table>
 
- <table class="history">
-  <tr><th colspan="2" class="header">History</th></tr>
-  <tr><td colspan="2" tal:content="structure context/history">history</td></tr>
- </table>
+ <tal:block tal:replace="structure context/history" />
+
 </tal:block>
 
 </form>
index 3bd1ca140bf65046b9fad10ca5aeba550de970e8..0444c622cc572211283384de3c3adc2b3c320e46 100644 (file)
@@ -8,9 +8,12 @@
    defgroup python:['priority'];
    defdisp python:'id activity title status assignedto'.split()">
 
-<tr class="form-header">
- <th>&nbsp;</th>
- <th>Filter on</th><th>Display</th><th>Sort on</th><th>Group on</th>
+<tr>
+ <th class="header">&nbsp;</th>
+ <th class="header">Filter on</th>
+ <th class="header">Display</th>
+ <th class="header">Sort on</th>
+ <th class="header">Group on</th>
 </tr>
 
 <tr>
index abf69d84c6b5d5642226e91799dc518efb595163..0160a9efef840278bb1380c417108c45fa0fcdc1 100644 (file)
@@ -1,42 +1,40 @@
 <!-- dollarId: msg.item,v 1.3 2002/05/22 00:32:34 richard Exp dollar-->
-<table border=0 cellspacing=0 cellpadding=2>
+<table class="form">
 
-<tr bgcolor="ffffea">
- <td width=1% nowrap align=right><span class="form-label">Author</span></td>
- <td class="form-text" tal:content="context/author"></td>
+<tr>
+ <td nowrap>Author</td>
+ <td tal:content="context/author"></td>
 </tr>
 
-<tr bgcolor="ffffea">
- <td width=1% nowrap align=right><span class="form-label">Recipients</span></td>
- <td class="form-text" tal:content="context/recipients"></td>
+<tr>
+ <td nowrap>Recipients</td>
+ <td tal:content="context/recipients"></td>
 </tr>
 
-<tr bgcolor="ffffea">
- <td width=1% nowrap align=right><span class="form-label">Date</span></td>
- <td class="form-text" tal:content="context/date"></td>
+<tr>
+ <td nowrap>Date</td>
+ <td tal:content="context/date"></td>
 </tr>
 
-<tr bgcolor="ffeaff">
- <td colspan=2 class="form-text">
-  <pre tal:content="context/content"></pre>
- </td>
+<tr>
+ <td colspan=2><pre tal:content="context/content"></pre></td>
 </tr>
 
-<property name="files">
-<tr class="strong-header"><td colspan=2><b>Files</b></td></tr>
-<tr tal:repeat="file context/files">
- <td>
-  <a tal:attributes="href string:file${file/id}/${file/name}"
-     tal:content="file/name">dld link</a>
- </td>
- <td>
-  <span tal:content="file/creator">creator's name</span>,
-  <span tal:content="file/creation">creation date</span>
- </td>
-</tr>
-</property>
+ <table class="files" tal:condition="context/files">
+  <tr><th colspan="2" class="header">Files</th></tr>
+  <tr><th>File name</th><th>Uploaded</th></tr>
+  <tr tal:repeat="file context/files">
+   <td>
+    <a tal:attributes="href string:file${file/id}/${file/name}"
+       tal:content="file/name">dld link</a>
+   </td>
+   <td>
+    <span tal:content="file/creator">creator's name</span>,
+    <span tal:content="file/creation">creation date</span>
+   </td>
+  </tr>
+ </table>
 
-<tr class="history-header"><td colspan=2><b>History</b></td><tr>
-<tr><td colspan="2" tal:content="structure context/history">history</td></tr>
+ <tal:block tal:replace="structure context/history" />
 
 </table>
index e1278d917e2e9fcc1022d8da19528247dec3d7e3..10a31efdaac7f80749f4c734134cf0e5bac7ed7f 100644 (file)
@@ -58,35 +58,36 @@ p.error-message {
 
 /* style for forms */
 table.form {
+  padding: 2;
   border-spacing: 0px;
   border-collapse: separate;
 }
 
-.form th {
+table.form th {
   font-weight: bold;
   color: #333388;
   text-align: right;
   vertical-align: top;
 }
 
-.form-header th {
+table.form th.header {
   font-weight: bold;
   color: #333388;
   background-color: #eeeeff;
   text-align: left;
 }
 
-.form td.optional {
+table.form td.optional {
   font-weight: bold;
   font-style: italic;
   color: #333333;
 }
 
-.form td {
+table.form td {
   color: #333333;
 }
 
-.form td.html {
+table.form td.html {
   color: #777777;
 }
 
@@ -219,6 +220,7 @@ table.history th {
 
 table.history td {
   font-size: 90%;
+  vertical-align: top;
 }
 
 /* style for "other" displays */
index 2968d7886efaa96f7ab76830eebbb50deb78d810..96b3926e44e635baca81cebe53418bf6287fe5d1 100644 (file)
@@ -28,9 +28,9 @@ You are not allowed to view this page.
  </tr>
  <tr tal:condition="python:request.user.hasPermission('Web Roles')">
   <th>Roles</th>
-  <td tal:condition="item/created"
+  <td tal:condition="context/id"
       tal:content="structure context/roles/field">roles</td>
-  <td tal:condition="not:item/created">
+  <td tal:condition="not:context/id">
    <input name="roles" tal:attributes="value db/config/NEW_WEB_USER_ROLES">
   </td>
  </tr>
@@ -58,7 +58,7 @@ You are not allowed to view this page.
 </table>
 </form>
 
-<tal:block tal:condition="item/created">
+<tal:block tal:condition="context/id">
  <table class="otherinfo" tal:condition="context/queries">
   <tr><th class="header">Queries</th></tr>
   <tr tal:repeat="query context/queries">
@@ -66,12 +66,8 @@ You are not allowed to view this page.
   </tr>
  </table>
 
- <table class="otherinfo">
-  <tr><th class="header">History</th></tr>
-  <tr>
-   <td tal:content="structure context/history">history</td>
-  </tr>
- </table>
+ <tal:block tal:replace="structure context/history" />
+
 </tal:block>
 
 </tal:block>