Edgewall Software
Modify

Opened 20 years ago

Last modified 7 years ago

#925 new enhancement

[PATCH] Allow wiki syntax in labels for custom fields

Reported by: pkou <pkou at ua.fm> Owned by:
Priority: normal Milestone: unscheduled
Component: ticket system Version: devel
Severity: normal Keywords: custom fields
Cc: m@…, shishz@… Branch:
Release Notes:
API Changes:
Internal Changes:

Description

The proposal is to add a possibility to use Wiki syntax in labels for custom fields.

Example 1: We need to put emphasis on Platform field

[ticket-custom]
platform         = select
platform.order   = 1
platform.label   = '''Platform'''
platform.options = |Intel P4|Intel XEON|AMD Athlon 64|Other

Example 2: We need to define a link to help screen for Platform field

[ticket-custom]
platform         = select
platform.order   = 1
platform.label   = [wiki:HelpPlatform Platform]
platform.options = |Intel P4|Intel XEON|AMD Athlon 64|Other

Attached patch contains an implementation for the proposal.

Attachments (5)

patch-customlabelwiki-r1049.diff (4.8 KB ) - added by pkou <pkou at ua.fm> 20 years ago.
Patch for the changes
ticket-custom-field-label-with-wiki-syntax-r2678.patch (996 bytes ) - added by Markus Tacker <m@…> 19 years ago.
ticket-custom-field-label-with-wiki-syntax-r2894.patch (1.0 KB ) - added by Markus Tacker <m@…> 19 years ago.
Updated patch for r2894
ticket-custom-field-label-with-wiki-syntax-r3931.patch (979 bytes ) - added by Markus Tacker <m@…> 18 years ago.
Updated patch for r3931
ticket-custom-field-label-with-wiki-syntax-r4458.patch (1.2 KB ) - added by Tim Hatch <trac@…> 18 years ago.
Updated patch for r4458

Download all attachments as: .zip

Change History (21)

by pkou <pkou at ua.fm>, 20 years ago

Patch for the changes

comment:1 by pkou at ua.fm, 19 years ago

Thank to refactoring in Trac 0.9, updated patch is the following:

  • trac/ticket/api.py

     
    2121
    2222from trac import perm, util
    2323from trac.core import *
     24from trac.wiki import wiki_to_oneliner
    2425
    2526
    2627class TicketSystem(Component):
     
    107108                'name': name,
    108109                'type': self.config.get('ticket-custom', name),
    109110                'order': int(self.config.get('ticket-custom', name + '.order', '0')),
    110                 'label': self.config.get('ticket-custom', name + '.label', ''),
     111                'label': wiki_to_oneliner(self.config.get('ticket-custom', name + '.label', ''), self.env, self.env.get_db_cnx()),
    111112                'value': self.config.get('ticket-custom', name + '.value', '')
    112113            }
    113114            if field['type'] == 'select' or field['type'] == 'radio':

It is easy :)

Last edited 7 years ago by Ryan J Ollos (previous) (diff)

comment:2 by Markus Tacker <m@…>, 19 years ago

Cc: m@… added

This is the patch against [2678]. Why hasn't this been implemented yet?

  • trac/ticket/api.py

     
    1818from trac.core import *
    1919from trac.perm import IPermissionRequestor
    2020from trac.wiki import IWikiSyntaxProvider
     21from trac.wiki import wiki_to_oneliner
    2122from trac.Search import ISearchSource, query_to_sql, shorten_result
    2223
    2324
     
    108109                'name': name,
    109110                'type': self.config.get('ticket-custom', name),
    110111                'order': int(self.config.get('ticket-custom', name + '.order', '0')),
    111                 'label': self.config.get('ticket-custom', name + '.label', ''),
     112                'label': wiki_to_oneliner(self.config.get('ticket-custom', name + '.label', ''), self.env, self.env.get_db_cnx()),
    112113                'value': self.config.get('ticket-custom', name + '.value', '')
    113114            }
    114115            if field['type'] == 'select' or field['type'] == 'radio':
Last edited 7 years ago by Ryan J Ollos (previous) (diff)

by Markus Tacker <m@…>, 19 years ago

comment:3 by Christian Boos, 19 years ago

Milestone: 0.10
Owner: changed from Jonas Borgström to Christian Boos
Status: newassigned

Any objection?

by Markus Tacker <m@…>, 19 years ago

Updated patch for r2894

comment:4 by anonymous, 19 years ago

Cc: shishz@… added

comment:5 by Christian Boos, 19 years ago

Keywords: workflow added

For info, that's currently done in the WorkFlow branch.

comment:6 by Christian Boos, 19 years ago

Milestone: 0.100.11

comment:7 by Alec Thomas, 19 years ago

Owner: changed from Christian Boos to Alec Thomas
Status: assignednew

I'll close this when WorkFlow is merged in 0.11.

comment:8 by Alec Thomas, 19 years ago

Status: newassigned

by Markus Tacker <m@…>, 18 years ago

Updated patch for r3931

comment:9 by sid, 18 years ago

#899 proposes a different approach to the same problem.

comment:10 by Markus Tacker <m@…>, 18 years ago

Can anyone provide a patch for r4458? I failed.

by Tim Hatch <trac@…>, 18 years ago

Updated patch for r4458

comment:11 by Christian Boos, 17 years ago

Milestone: 0.11.10.12

See also #6248.

comment:12 by Remy Blank, 16 years ago

I wanted to tackle this yesterday evening, but it is a lot trickier than it looks. Field labels are not only used on the ticket page, but also in the custom query page, in the query form headers and controls, and in the result table header. Some of these locations can manage HTML, and others require text only.

So this functionality actually requires the hypothetical wiki_to_text function I have seen mentioned in #1502 and on trac-dev.

comment:13 by Remy Blank, 14 years ago

Milestone: next-major-0.1Xunscheduled

comment:14 by Ryan J Ollos, 10 years ago

Owner: Alec Thomas removed
Status: assignednew

comment:15 by figaro, 9 years ago

Keywords: patch added

comment:16 by Ryan J Ollos, 7 years ago

Keywords: custom fields added; patch workflow removed

Modify Ticket

Change Properties
Set your email in Preferences
Action
as new The ticket will remain with no owner.
The ticket will be disowned.
as The resolution will be set. Next status will be 'closed'.
The owner will be changed from (none) to anonymous. Next status will be 'assigned'.

Add Comment


E-mail address and name can be saved in the Preferences .
 
Note: See TracTickets for help on using tickets.