Edgewall Software

Changeset 3400


Ignore:
Timestamp:
Jun 13, 2006, 7:49:42 PM (19 years ago)
Author:
Alec Thomas
Message:

Ticket and Wiki attachments now show up in the timeline.

Location:
trunk
Files:
1 added
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/htdocs/css/timeline.css

    r3323 r3400  
    4646dt.wiki, dt.wiki a { background-image: url(../wiki.png) !important }
    4747dt.milestone, dt.milestone a { background-image: url(../milestone.png) !important }
     48dt.attachment, dt.attachment a { background-image: url(../attachment.png) !important }
    4849
    4950/* styles for the 'changeset_long_messages' option */
  • trunk/trac/attachment.py

    r3399 r3400  
    3535from trac.web.chrome import add_link, add_stylesheet, INavigationContributor
    3636from trac.wiki import IWikiSyntaxProvider
     37from trac.Timeline import ITimelineEventProvider
    3738
    3839
     
    374375        yield ('attachment', self._format_link)
    375376
     377    # Public methods
     378
     379    def get_attachment_history(self, start, stop, type):
     380        """Return an iterable of tuples describing changes to attachments on
     381        a particular object type.
     382
     383        The tuples are in the form (change, type, id, filename, time,
     384        description, author). `change` can currently only be `created`."""
     385        # Traverse attachment directory
     386        db = self.env.get_db_cnx()
     387        cursor = db.cursor()
     388        cursor.execute("SELECT type, id, filename, time, description, author "
     389                       "  FROM attachment "
     390                       "  WHERE time > %s AND time < %s "
     391                       "        AND type = %s", (start, stop, type))
     392        for type, id, filename, time, description, author in cursor:
     393            yield ('created', type, id, filename, time, description, author)
     394
    376395    # Internal methods
    377396
  • trunk/trac/ticket/web_ui.py

    r3399 r3400  
    2020from StringIO import StringIO
    2121
    22 from trac.attachment import attachments_to_hdf, Attachment
     22from trac.attachment import attachments_to_hdf, Attachment, AttachmentModule
    2323from trac.config import BoolOption, Option
    2424from trac.core import *
     
    418418                    yield produce(row, 'new', {}, None, None)
    419419
     420            # Attachments
     421            if 'ticket_details' in filters:
     422                for change, type, id, filename, time, description, author in \
     423                        AttachmentModule(self.env). \
     424                            get_attachment_history(start, stop, 'ticket'):
     425                    title = Markup('<em>%s</em> attached to ticket <em>#%s</em> by %s' %
     426                                   (os.path.basename(filename), id, author))
     427                    yield ('attachment',
     428                           self.env.href('attachment', type, id, filename),
     429                           title, time, author, description)
     430
    420431    # Internal methods
    421432
  • trunk/trac/wiki/web_ui.py

    r3399 r3400  
    1717#         Christopher Lenz <[email protected]>
    1818
     19import os
    1920import re
    2021import StringIO
    2122
    22 from trac.attachment import attachments_to_hdf, Attachment
     23from trac.attachment import attachments_to_hdf, Attachment, AttachmentModule
    2324from trac.core import *
    2425from trac.perm import IPermissionRequestor
     
    163164                yield 'wiki', href, title, t, author, comment
    164165
     166            # Attachments
     167            for change, type, id, filename, time, description, author in \
     168                    AttachmentModule(self.env).get_attachment_history(start, stop,
     169                                                                      'wiki'):
     170                title = Markup('<em>%s</em> attached to <em>%s</em> by %s' %
     171                               (os.path.basename(filename), id, author))
     172                yield ('attachment',
     173                       self.env.href('attachment', type, id, filename),
     174                       title, time, author, description)
     175
     176
    165177    # Internal methods
    166178
Note: See TracChangeset for help on using the changeset viewer.