Ticket #1791 (closed enhancement: fixed)
[PATCH] Allow WikiFormatting in custom ticket fields of type textarea, and labels of any custom field.
| Reported by: | anthony.vito@… | Owned by: | rblank |
|---|---|---|---|
| Priority: | normal | Milestone: | 0.12 |
| Component: | ticket system | Version: | devel |
| Severity: | normal | Keywords: | wiki custom |
| Cc: | khundeen@…, hoessler@… |
Description (last modified by cboos) (diff)
This patch builds on the patch provided in #925 and resolves the issue addressed in #1392 against the trunk. WikiFormatting of all custom field labels is allowed, and textarea fields can use as much WikiFormatting as they would like. Quite a bit of functionality for 7 lines of code ;) Of course I haven't tested this throughly. Since the preview for tickets is now done at the top with the full ticket display, you even get a preview of everything! This patch is against [1970] the trunk as of 07/14/2005 08:22:30 PM.
Index: trac/ticket/api.py
===================================================================
--- trac/ticket/api.py (revision 1970)
+++ trac/ticket/api.py (working copy)
@@ -25,6 +25,8 @@
from trac.core import *
from trac.perm import IPermissionRequestor
from trac.wiki import IWikiSyntaxProvider
+from trac.wiki import wiki_to_html
+from trac.wiki import wiki_to_oneliner
class MyLinkResolver(Component):
"""
@@ -121,7 +123,8 @@
'name': name,
'type': self.config.get('ticket-custom', name),
'order': int(self.config.get('ticket-custom', name + '.order', '0')),
- 'label': self.config.get('ticket-custom', name + '.label', ''),
+ 'label': wiki_to_oneliner(self.config.get('ticket-custom', name + '.label', ''),
+ self.env, self.env.get_db_cnx()),
'value': self.config.get('ticket-custom', name + '.value', '')
}
if field['type'] == 'select' or field['type'] == 'radio':
Index: trac/ticket/web_ui.py
===================================================================
--- trac/ticket/web_ui.py (revision 1970)
+++ trac/ticket/web_ui.py (working copy)
@@ -348,6 +348,8 @@
if name in ('summary', 'reporter', 'description', 'type', 'status',
'resolution', 'owner'):
field['skip'] = True
+ else:
+ field['formatted'] = wiki_to_html(ticket.values.get(name), self.env, req, db)
req.hdf['ticket.fields.' + name] = field
req.hdf['ticket.reporter_id'] = util.escape(reporter_id)
Index: templates/ticket.cs
===================================================================
--- templates/ticket.cs (revision 1970)
+++ templates/ticket.cs (working copy)
@@ -64,7 +64,7 @@
if:fullrow && idx % 2 ?><th></th><td></td></tr><tr><?cs /if ?>
<th id="h_<?cs var:name(field) ?>"><?cs var:field.label ?>:</th>
<td<?cs if:fullrow ?> colspan="3"<?cs /if ?> headers="h_<?cs
- var:name(field) ?>"><?cs var:ticket[name(field)] ?></td><?cs
+ var:name(field) ?>"><?cs var:field.formatted ?></td><?cs
if:idx % 2 ?></tr><tr><?cs
elif:idx == num_fields - 1 ?><th></th><td></td><?cs
/if ?><?cs set:idx = idx + #fullrow + 1 ?><?cs
Attachments
Change History
Note: See
TracTickets for help on using
tickets.


