Commits

Anonymous committed f179f89

Added ticket reopen-events to the timeline. More clearsilver work.

  • Participants
  • Parent commits 987c386
  • Branches trunk

Comments (0)

Files changed (4)

svntrac/Ticket.py

 
 import time
 import string
-import StringIO
 from types import *
 
 from util import *
                 hdf.setValue('ticket.changes.%d.new' % idx, new)
             idx = idx + 1
 
-    def get_actions(self, info):
-        out = StringIO.StringIO()
-        out.write ('<input type="radio" name="action" value="leave" '
-                   'checked="checked">&nbsp;leave as %s<br>' % info['status'])
-        
-        if info['status'] == 'new':
-            out.write ('<input type="radio" name="action" value="accept">'
-                       '&nbsp;accept ticket<br>')
-        if info['status'] == 'closed':
-            out.write ('<input type="radio" name="action" value="reopen">'
-                       '&nbsp;reopen ticket<br>')
-        if info['status'] in ['new', 'assigned', 'reopened']:
-            out.write ('<input type="radio" name="action" value="resolve">'
-                       '&nbsp;resolve as: '
-                       '<select name="resolve_resolution">'
-                       '<option selected>fixed</option>'
-                       '<option>invalid</option>'
-                       '<option>wontfix</option>'
-                       '<option>duplicate</option>'
-                       '<option>worksforme</option>'
-                       '</select><br>')
-            out.write ('<input type="radio" name="action" value="reassign">'
-                       '&nbsp;reassign ticket to:'
-                       '&nbsp<input type="text" name="reassign_owner" '
-                       'value="%s">' % info['owner'])
-        return out.getvalue()
-    
     def render (self):
         action = dict_get_with_default(self.args, 'action', 'view')
             
         sql_to_hdf('SELECT name FROM version ORDER BY name',
                    self.cgi.hdf, 'ticket.versions')
         self.cgi.hdf.setValue('ticket.title', 'Ticket #%d' % id)
-        self.cgi.hdf.setValue('ticket.actions', self.get_actions(info))
         self.insert_ticket_data(self.cgi.hdf, id)
         self.cgi.hdf.setValue('ticket.description',
                               wiki_to_html(info['description']))

svntrac/Timeline.py

         # 1: change set
         # 2: new tickets
         # 3: closed tickets
+        # 4: reopened tickets
 
         cursor.execute ("SELECT time, rev AS data, 1 AS type, message "
                         "FROM revision WHERE time>=%s AND time<=%s UNION ALL "
                         "FROM ticket WHERE time>=%s AND time<=%s UNION ALL "
                         "SELECT time, ticket AS data, 3 AS type, '' AS message "
                         "FROM ticket_change WHERE field='status' "
-                        "AND newvalue='closed' AND time>=%s AND time<=%s "
+                        "AND newvalue='closed' AND time>=%s AND time<=%s UNION ALL "
+                        "SELECT time, ticket AS data, 4 AS type, '' AS message "
+                        "FROM ticket_change WHERE field='status' "
+                        "AND newvalue='reopened' AND time>=%s AND time<=%s "
                         "ORDER BY time DESC, message, type",
-                        start, stop, start, stop, start, stop)
+                        start, stop, start, stop, start, stop, start, stop)
 
         # Make the data more HDF-friendly
         info = []

templates/ticket.cs

 <tr>
 <td></td>
 <td colspan="3">
-<?cs var:ticket.actions ?>
+
+
+  <input type="radio" name="action" value="leave" checked="checked">
+  &nbsp;leave as <?cs var:ticket.status ?><br>
+ 
+  <?cs if $ticket.status == "new" ?>
+    <input type="radio" name="action" value="accept">
+    &nbsp;accept ticket<br>
+  <?cs /if ?>
+  <?cs if $ticket.status == "closed" ?>
+    <input type="radio" name="action" value="reopen">
+    &nbsp;reopen ticket<br>
+  <?cs /if ?>
+  <?cs if $ticket.status == "new" || $ticket.status == "assigned" || $ticket.status == "reopened" ?>
+    <input type="radio" name="action" value="resolve">
+    &nbsp;resolve as: 
+    <select name="resolve_resolution">
+      <option selected>fixed</option>
+      <option>invalid</option>
+      <option>wontfix</option>
+      <option>duplicate</option>
+      <option>worksforme</option>
+    </select><br>
+    <input type="radio" name="action" value="reassign">
+    &nbsp;reassign ticket to:
+    &nbsp<input type="text" name="reassign_owner" 
+          value="<?cs var:ticket.owner ?>">
+  <?cs /if ?>
+
 </td>
 </tr>
 <tr>

templates/timeline.cs

       <td><?cs var:item.time?></td>
       <td>ticket <a href="<?cs var:item.ticket_href ?>">#<?cs var:item.data?></a> closed.</td>
     </tr>
+<!-- Reopened ticket -->
+  <?cs elif:item.type == #4 ?>
+    <tr>
+      <td><?cs var:item.time?></td>
+      <td>ticket <a href="<?cs var:item.ticket_href ?>">#<?cs var:item.data?></a> reopened.</td>
+    </tr>
   <?cs /if ?>
 <?cs /each ?>