Edgewall Software
Modify

Opened 13 years ago

Last modified 6 months 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@…
Release Notes:
API 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> 13 years ago.
Patch for the changes
ticket-custom-field-label-with-wiki-syntax-r2678.patch (996 bytes ) - added by Markus Tacker <m@…> 12 years ago.
ticket-custom-field-label-with-wiki-syntax-r2894.patch (1.0 KB ) - added by Markus Tacker <m@…> 12 years ago.
Updated patch for r2894
ticket-custom-field-label-with-wiki-syntax-r3931.patch (979 bytes ) - added by Markus Tacker <m@…> 11 years ago.
Updated patch for r3931
ticket-custom-field-label-with-wiki-syntax-r4458.patch (1.2 KB ) - added by Tim Hatch <trac@…> 11 years ago.
Updated patch for r4458

Download all attachments as: .zip

Change History (21)

Changed 13 years ago by pkou <pkou at ua.fm>

Patch for the changes

comment:1 Changed 12 years ago by pkou at ua.fm

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 6 months ago by Ryan J Ollos (previous) (diff)

comment:2 Changed 12 years ago by Markus Tacker <m@…>

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 6 months ago by Ryan J Ollos (previous) (diff)

Changed 12 years ago by Markus Tacker <m@…>

comment:3 Changed 12 years ago by Christian Boos

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

Any objection?

Changed 12 years ago by Markus Tacker <m@…>

Updated patch for r2894

comment:4 Changed 12 years ago by anonymous

Cc: shishz@… added

comment:5 Changed 12 years ago by Christian Boos

Keywords: workflow added

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

comment:6 Changed 12 years ago by Christian Boos

Milestone: 0.100.11

comment:7 Changed 12 years ago by Alec Thomas

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

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

comment:8 Changed 12 years ago by Alec Thomas

Status: newassigned

Changed 11 years ago by Markus Tacker <m@…>

Updated patch for r3931

comment:9 Changed 11 years ago by sid

#899 proposes a different approach to the same problem.

comment:10 Changed 11 years ago by Markus Tacker <m@…>

Can anyone provide a patch for r4458? I failed.

Changed 11 years ago by Tim Hatch <trac@…>

Updated patch for r4458

comment:11 Changed 10 years ago by Christian Boos

Milestone: 0.11.10.12

See also #6248.

comment:12 Changed 9 years ago by Remy Blank

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 Changed 7 years ago by Remy Blank

Milestone: next-major-0.1Xunscheduled

comment:14 Changed 3 years ago by Ryan J Ollos

Owner: Alec Thomas deleted
Status: assignednew

comment:15 Changed 2 years ago by figaro

Keywords: patch added

comment:16 Changed 6 months ago by Ryan J Ollos

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.
The owner will be changed from (none) to anonymous.

Add Comment


E-mail address and name can be saved in the Preferences .

 
Note: See TracTickets for help on using tickets.