Changeset 3130

Show
Ignore:
Timestamp:
01/22/08 22:07:43 (11 months ago)
Author:
ixokai
Message:

Added "ticket_email_header_fields" option which controls which fields are always shown at the top of ticket announcement emails.

Also cleaned up the templates a little bit.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • announcerplugin/0.11/announcerplugin/formatters/ticket_email.py

    r3107 r3130  
    11from trac.core import Component, implements 
    22from announcerplugin.api import IAnnouncementFormatter 
    3 from trac.config import Option, IntOption 
     3from trac.config import Option, IntOption, ListOption 
    44from genshi.template import NewTextTemplate, MarkupTemplate 
    55from genshi import HTML 
     
    3333    ticket_email_subject = Option('announcer', 'ticket_email_subject',  
    3434        "Ticket #${ticket.id}: ${ticket['summary']} {% if action %}[${action}]{% end %}") 
     35     
     36    ticket_email_header_fields = ListOption('announcer', 'ticket_email_header_fields', 'owner, reporter, milestone, priority, severity') 
    3537     
    3638    def get_format_transport(self): 
     
    6870         
    6971    def format_subject(self, transport, realm, style, event): 
     72        action = None 
    7073        if transport == "email": 
    7174            if realm == "ticket": 
     
    7376                    if 'status' in event.changes: 
    7477                        action = 'Status -> %s' % (event.target['status']) 
    75                     else: 
    76                         action = None 
     78                         
    7779                template = NewTextTemplate(self.ticket_email_subject) 
    7880                return template.generate(ticket=event.target, event=event, action=action).render() 
     
    115117            author = event.author, 
    116118            comment = event.comment, 
     119            header = self.ticket_email_header_fields, 
    117120            category = event.category, 
    118121            ticket_link = self.env.abs_href('ticket', ticket.id), 
     
    170173            ticket = ticket, 
    171174            author = event.author, 
     175            header = self.ticket_email_header_fields, 
    172176            comment = event.comment, 
    173177            category = event.category, 
  • announcerplugin/0.11/announcerplugin/subscribers/wiki.py

    r3107 r3130  
    5858                 
    5959                sess['announcer_wiki_interests'] = ' '.join( 
    60                     urllib.quote(x) for x in options 
     60                    urllib.quote( 
     61                        x.replace('*', '.*?') 
     62                    ) for x in options 
    6163                ) 
    6264                 
     
    6870        return "prefs_announcer_wiki.html", dict( 
    6971            wiki_interests = '\n'.join( 
    70                 urllib.unquote(x) for x in interests.split(' ') 
     72                urllib.unquote( 
     73                    x.replace('.*?', '*') 
     74                ) for x in interests.split(' ') 
    7175            ) 
    7276        ) 
  • announcerplugin/0.11/announcerplugin/templates/ticket_email_mimic.html

    r3107 r3130  
    118118      <div class="title" style="font-weight: bold; border-bottom: 1pt inset #dfdfdf; padding-bottom: .5em;">${ticket['summary']}</div> 
    119119      <table class="header" width="100%"> 
    120         <tr> 
    121           <td class="label" width="30%" style="font-size: x-small; color: #7e7e7e; border-bottom: 1pt inset #dfdfdf; padding-bottom: .5em; width:  30%;">Owned by:</td> 
    122           <td class="value" width="70%" style="border-bottom: 1pt inset #dfdfdf; padding-bottom: .5em; font-size: small;">${ticket['owner']}</td> 
    123         </tr> 
    124         <tr> 
    125           <td class="label" style="font-size: x-small; color: #7e7e7e; border-bottom: 1pt inset #dfdfdf; padding-bottom: .5em; width:  30%;">Reported by:</td> 
    126           <td class="value" style="border-bottom: 1pt inset #dfdfdf; padding-bottom: .5em; font-size: small;">${ticket['reporter']}</td> 
    127         </tr> 
    128         <tr py:if="ticket['milestone']"> 
    129           <td class="label" style="font-size: x-small; color: #7e7e7e; border-bottom: 1pt inset #dfdfdf; padding-bottom: .5em; width:  30%;">Milestone:</td> 
    130           <td class="value" style="border-bottom: 1pt inset #dfdfdf; padding-bottom: .5em; font-size: small;">${ticket['milestone']}</td> 
    131         </tr> 
    132         <tr py:if="ticket['priority']"> 
    133           <td class="label" style="font-size: x-small; color: #7e7e7e; border-bottom: 1pt inset #dfdfdf; padding-bottom: .5em; width:  30%;">Priority:</td> 
    134           <td class="value" style="border-bottom: 1pt inset #dfdfdf; padding-bottom: .5em; font-size: small;">${ticket['priority']}</td> 
    135         </tr> 
    136         <tr py:if="ticket['severity']"> 
    137           <td class="label" style="font-size: x-small; color: #7e7e7e; border-bottom: 1pt inset #dfdfdf; padding-bottom: .5em; width:  30%;">Severity:</td> 
    138           <td class="value" style="border-bottom: 1pt inset #dfdfdf; padding-bottom: .5em; font-size: small;">${ticket['severity']}</td> 
     120        <tr py:for="field in header"> 
     121          <td class="label" width="30%" style="font-size: x-small; color: #7e7e7e; border-bottom: 1pt inset #dfdfdf; padding-bottom: .5em; width:  30%;">${field.capitalize()}:</td> 
     122          <td class="value" width="70%" style="border-bottom: 1pt inset #dfdfdf; padding-bottom: .5em; font-size: small;">${ticket[field] or 'None'}</td> 
    139123        </tr> 
    140124      </table> 
  • announcerplugin/0.11/announcerplugin/templates/ticket_email_plaintext.txt

    r3046 r3130  
    22${ticket['status']} ${ticket['type']} 
    33--------------------------------------------------------------------- 
    4 Owner: {% choose %}\ 
    5 {% when ticket['owner'] %}\ 
    6 ${ticket['owner']}\ 
     4{% for field in header %}\ 
     5{% choose %}\ 
     6{% when ticket[field] %}\ 
     7${field.capitalize()}: ${ticket[field]} 
    78{% end %}\ 
    89{% otherwise %}\ 
    9 (None)\ 
     10${field.capitalize()}: (None) 
    1011{% end %}\ 
    11 {% end %} 
    12 Reporter: ${ticket['reporter']} 
    13 {% if ticket['milestone'] %}Milestone: ${ticket['milestone']} {% end %} 
    14 {% if ticket['priority'] %}Priority: ${ticket['priority']} {% end %} 
    15 {% if ticket['severity'] %}Severity: ${ticket['severity']} {% end %} 
     12{% end %}\ 
     13{% end %}\ 
    1614{% if category == 'created' %}\ 
    1715--------------------------------------------------------------------- 
     
    3937Attachment: 
    4038 * File '${attachment.filename}' added{% if attachment.description %}: ${attachment.description} {% end %} 
    41 {% end %} 
     39{% end %}\ 
    4240{% if comment %}\ 
    4341---------------------------------------------------------------------