TicketBoxMacro: TicketBox.diffs

File TicketBox.diffs, 1.8 kB (added by Gary Oberbrunner, 3 years ago)

Patch to support optional ticket descriptions as well as text.

Line 
1 27a28,32
2 >
3 > The report should produce at least the field {{{ticket}}} containing
4 > the ticket ID.  If it also contains a {{{text}}} field a different
5 > formatting will be used showing that text after the ticket ID
6 > hyperlink.
7 59a65
8 >     items_have_text = False
9 97a104,105
10 >                     # Get the index of the fields we're interested in
11 >                     # The fields are 'ticket' (the ID) and optionally 'text'.
12 99a108,111
13 >                   if descriptions.count('text'):
14 >                       text = descriptions.index('text')
15 >                       items_have_text = True
16 >                     # Now get the values from each row
17 101c113,116
18 <                         items.append(row[idx])
19 ---
20 >                         if items_have_text:
21 >                           items.append("#%d: %s"%(row[idx], row[text]))
22 >                         else:
23 >                         items.append("#%d"%row[idx])
24 112,113c127,133
25 <         from trac.wiki.formatter import wiki_to_oneliner
26 <         html = wiki_to_oneliner(string.join(["#%d" % c for c in items], ", "),
27 ---
28 >         from trac.wiki.formatter import wiki_to_oneliner, wiki_to_html
29 >         if items_have_text:
30 >           html = wiki_to_html(string.join(["%s" % str(c) for c in items],
31 >                                           "[[BR]]"),
32 >                                env, env.get_db_cnx())
33 >         else:
34 >           html = wiki_to_oneliner(string.join(["%s" % str(c) for c in items], ", "),
35 118c138,139
36 <         html = wiki_to_oneliner(string.join(["#%d" % c for c in items], ", "),
37 ---
38 >         html = wiki_to_oneliner(string.join(["%s" % str(c) for c in items],
39 > sep),
40 127,128c148
41 <         return '<fieldset class="ticketbox"
42 < style="%s"><legend>%s</legend>%s</fieldset>' % \
43 ---
44 >         return '<fieldset class="ticketbox" style="%s"><legend>%s</legend>%s</fieldset>' % \