Opened 3 years ago

# Allow effective passing of URL parameters to /newticket

Reported by: Owned by: hasienda Reinhard normal CondFieldsGenshiPlugin normal hide passthrough falkb 0.12

### Description

Fields handled by this plugin (tweaks option) get totally removed from the ticket page.

To be able to still set an invisible ticket field the field needs to be preserved in the ticket Modify form at the bottom of ticket page. This feature is proposed here as per user request.

Suggested implementation: Introduce a new option in addition to tweaks, that specifically holds names of ticket fields, that should be hidden instead of removed.

### Changed 3 years ago by hasienda

patch for a minimal implementation for hidden - not removed - fields

### comment:1 Changed 3 years ago by hasienda

(From patch comment - see original format of that file): CondFieldsGenshiPlugin: New option to pass field values to Trac even for disabled fields.

Important code fragments have been taken from timingandestimationplugin/blackmagic.py in branch 'trac0.11-Permissions' of TimingAndEstimationPlugin.

Fields given by new option 'hide' are transformed to hidden fields instead of totally removing them from the ticket form, what makes them effectively immutable. Hidden fields can receive values via parameters given in the URL to '/newticket' for promotion into submitted tickets.

### comment:2 Changed 3 years ago by hasienda

• note different way of Trac Option definition - this way will truly register, visible effect: added documentation for this plugin in <env>/wiki/TracIni, after successful install
• note duplication of field names - need to add to tweaks AND hide, IMHO this is hackish and should improved towards putting field names only once, but don't rush, because there is another duplication in type_cond clauses (do we really need tweaks option at all?)
• description ticket field is not properly removed yet (not at all from top ticket box, visual reminders left in bottom editor box), and some users may even rely on that, so it'll require extra care when fixing it

This is up for initial discussion. If you're happy with this (my) way of proposals by filing tickets per issue, I would continue to submit more tickets with patches for various other aspects including the issues mentions above.

### comment:3 Changed 3 years ago by falkb

sorry for the delay, now I'm back from the past 4 free days. I applied hasienda's (great!) patch for testing, and I added hide = description in trac.ini:

[condfieldsgenshi]
description.type_cond = !Foo
tweaks = description
hide = description


Then I clicked a custom menu entry which provides this URL, just to open the 'New ticket' form with predefined values for type and description: ticket_foo.href = /newticket?type=Foo&description=[[Include(PageTemplates/Foo/V1)]]

Now what I see for ticket types Foo is: The label of the description field is hidden but not the description input field, which means hiding works but does not hide all what must be hidden. Do you see the bit that is wrong?

### comment:4 follow-up: ↓ 5 Changed 3 years ago by hasienda

No, actually I only see a remaining box (shadow of an fieldset), no input. At least not in Trac 1.0, so it ooked rather like a cosmetic issue.

But you may use a different version. Even subtle changes to the template could matter, so I'll do further testing. What Trac version did you use for your test?

I wanted to address more issues once you gave a thumb-up for my way of contributions. Seems like you did it with previous comment, thanks. So I'll continue.

### Changed 3 years ago by hasienda

visual result of calling /newticket?type=Foo&description=[[Include(PageTemplates/Foo/V1)]] in Trac 1.0.1 - German localization

### comment:5 in reply to: ↑ 4 Changed 3 years ago by falkb

What Trac version did you use for your test?

1.0.1

As soon as I remove hide = description it appears here in exactly the same way as you described in attachment:20130513_condfieldsgenshi_newticket_desc-with-preliminary-patch.png

I wanted to address more issues once you gave a thumb-up for my way of contributions. Seems like you did it with previous comment, thanks. So I'll continue.

Fine with me. I think Reinhard likes it also.

### comment:6 Changed 3 years ago by falkb

default = disable is also set in my trac.ini