Edgewall Software
Modify

Opened 17 years ago

Closed 17 years ago

Last modified 17 years ago

#6277 closed defect (wontfix)

Adding new custom field OUTSIDE of ticket properties

Reported by: Connie Owned by: Jonas Borgström
Priority: normal Milestone:
Component: general Version: 0.10.4
Severity: major Keywords:
Cc: Branch:
Release Notes:
API Changes:
Internal Changes:

Description

Hi, I am just wondering if somebody can help me with this. I am trying to add 2 custom fields called "URL" and "Steps to Reproduce" OUTSIDE of the "Ticket Properties" form. (which means I cannot just add the field through [ticket_custom] in the ini file as suggested here: http://trac.edgewall.org/wiki/TracTicketsCustomFields). This is what I have done so far:

1) Copied the newticket.cs and ticket.cs files from the \share\trac\templates directory to my project directory (\my-project\templates) and added those two fields as follows:

<tr>

<th><label for="url">URL:</label></th> <td class="fullrow" colspan="3"><input type="text" value="<?cs

var:ticket.url ?>" id="url" name="url" size="70" /></td>

</tr> <tr>

<th><label for="reproduce">Steps to Reproduce:</label></th> <td class="fullrow" colspan="3"> <textarea id = "reproduce" name="reproduce" class="wikitext" rows="10" cols = "68" /> <?cs var:ticket.reproduce ?></textarea></td>

</tr>

My question is do I need to create some kind of script so that these custom fields will actually be saved in the database? They are being added to the UI, but they are really not doing anything. Help!

Thanks Connie

Attachments (1)

Ticket 6277.doc (118.5 KB ) - added by Connie 17 years ago.
Screenshot of VIEW TICKET and PREVIEW TICKET page

Download all attachments as: .zip

Change History (4)

comment:1 by hyuga <hyugaricdeau@…>, 17 years ago

Resolution: wontfix
Status: newclosed

Yes, Trac would have to know that the fields exist. The CS templates just display things—Trac can't divine from them added functionality, so this isn't really a problem with Trac.

Here's something you could do though:

  • First, create the custom fields following the instructions in TracTicketsCustomFields
  • Then, apply the following patch:
    • trac/ticket/web_ui.py

       
      164164            name = field['name']
      165165            del field['name']
      166166            if name in ('summary', 'reporter', 'description', 'type', 'status',
      167                         'resolution'):
       167                        'resolution', 'url', 'reproduce'):
      168168                field['skip'] = True
      169169            elif name == 'owner':
      170170                field['label'] = 'Assign to'
  • Now you can modify the templates however it was you were trying to do. Bear in mind that in ticket.cs you will also have to ticket box itself (<div id="ticket">) to display the values of those fields somewhere.

comment:2 by hyuga <hyugaricdeau@…>, 17 years ago

Sorry, the full diff should be:

  • trac/ticket/web_ui.py

     
    164164            name = field['name']
    165165            del field['name']
    166166            if name in ('summary', 'reporter', 'description', 'type', 'status',
    167                         'resolution'):
     167                        'resolution', 'url', 'reproduce'):
    168168                field['skip'] = True
    169169            elif name == 'owner':
    170170                field['label'] = 'Assign to'
     
    596596            name = field['name']
    597597            del field['name']
    598598            if name in ('summary', 'reporter', 'description', 'type', 'status',
    599                         'resolution', 'owner'):
     599                        'resolution', 'owner', 'url', 'reproduce'):
    600600                field['skip'] = True
    601601            req.hdf['ticket.fields.' + name] = field

You could also add code directly to the templates to skip those fields, but I think this way might be easier.

by Connie, 17 years ago

Attachment: Ticket 6277.doc added

Screenshot of VIEW TICKET and PREVIEW TICKET page

comment:3 by anonymous, 17 years ago

This works out perfect! Thanks! Please ignore my screen-shot. I think your 2nd posting fixed my problem! Many thanks!

Modify Ticket

Change Properties
Set your email in Preferences
Action
as closed The owner will remain Jonas Borgström.
The resolution will be deleted. Next status will be 'reopened'.
to The owner will be changed from Jonas Borgström to the specified user.

Add Comment


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