Login | Register For Free | Help
Search for: (Advanced)

Mailing List Archive: Request Tracker: Users

Special Custom Field Display/Edit - Suggestions?

 

 

Request Tracker users RSS feed   Index | Next | Previous | View Threaded


willir70 at gmail

Oct 30, 2007, 8:51 AM

Post #1 of 4 (524 views)
Permalink
Special Custom Field Display/Edit - Suggestions?

Hello RT world,

Running RT 3.6.4 currently on Suse 9.3 x86 with MySQL 4.1.x and/or Oracle 9i
available. My apologies if you see this twice, as I posted this in both
Users and Devel groups, but I thought both applied in this case.

We would like to use a SINGLE Custom Field in a somewhat unusual manner, if
possible. We would like to modify the "ShowCustomFields" and
"EditCustomFieldText" html Elements to allow both editing and display of a
very special custom field. For this custom field, we would like to present
a specifically formatted repeatable text entry form (including drop down
selections, text entry, etc.) along with incorporating some JavaScript field
validation all as a part of the single custom field. We have some
JavaScript code already that will allow us to add and remove the repeatable
form elements.

The question at hand is, are we able to somehow include a custom
JavaScript+HTML form as a single custom field? My thought is, we could
store the individual field values as comma or pipe delimited text within the
custom field and write the display routines around parsing that
information. How do we put together the changes to the EditCustomFieldText
Elements such that it will take input from either a pop-up form or from an
embedded HTML form displayed in the place of the single custom field?
Perhaps I'm over thinking this, but there almost has to be a way to do this.

Pseudo-code as follows:

% if ( $CustomField->Name eq 'Special_Field' ) {
% ### Display special repeatable HTML form with JavaScript validation
here
% } else {
% ### Original textarea input field here
% }

In short, this all needs to be incorporated into ONE CustomField if at all
possible, as there may be 99 some entries in this section (CustomField), as
a result we would not want to create 99 x10 fields - as individual custom
fields to accomplish this.

Has anyone done anything similar to this? Can anybody offer some pointers,
ideas, or thoughts? Any suggestions would be greatly appreciated.

Thanks!

Todd


stanislaw.sawa at uk

Nov 1, 2007, 3:50 AM

Post #2 of 4 (485 views)
Permalink
Re: Special Custom Field Display/Edit - Suggestions? [In reply to]

On Tue, 30 Oct 2007 11:51:34 -0400
"Todd Williams" <willir70 [at] gmail> wrote:
> Has anyone done anything similar to this? Can anybody offer some
> pointers, ideas, or thoughts? Any suggestions would be greatly
> appreciated.
>


we are currently implementing something like this (that is special
customfield with customised editor viewer). Approach, which seems to
work quite fine is adding new type of custom field (which will be used
only in one cf, but it gives us nice separation of code):

% cat local/lib/RT/CustomField_Local.pm
no warnings qw/redefine/;
package RT::CustomField;

$FieldTypes{ClCustID} = [
'Select multiple customers',
'Select one customer'
];

then, we create/add custom field to queue(s). As rt is using custom
field type for selecting which widget/componenet, so it is using:

local/html/Elements/EditCustomFieldClCustID
local/html/Elements/ShowCustomFieldClCustID

they were created based on one of default ones, with added additional
'helper' dropdowns and searches. They use some javascript/async
requests to fetch data from other systems and modify existing controls.
The only thing you have to keep in mind is that the value stored in
customfield is the one which is passed in
'<%$NamePrefix.$CustomField->Id%>-Value' field of form, so you have to
make sure it is filled with correct value.

Hope it helps.

--
Stanislaw Sawa
_______________________________________________
http://lists.bestpractical.com/cgi-bin/mailman/listinfo/rt-users

SAVE THOUSANDS OF DOLLARS ON RT SUPPORT:

If you sign up for a new RT support contract before December 31, we'll take
up to 20 percent off the price. This sale won't last long, so get in touch today.
Email us at sales [at] bestpractical or call us at +1 617 812 0745.


Community help: http://wiki.bestpractical.com
Commercial support: sales [at] bestpractical


Discover RT's hidden secrets with RT Essentials from O'Reilly Media.
Buy a copy at http://rtbook.bestpractical.com


willir70 at gmail

Nov 15, 2007, 9:20 AM

Post #3 of 4 (449 views)
Permalink
Re: Special Custom Field Display/Edit - Suggestions? [In reply to]

Has anyone else had success with this Custom Custom Field idea and
have any sample implementations they might be willing to share? I've
read through the RT Wiki pages on customizing RT but I am not sure
where to start with this. I have not seen any reference information
posted anywhere doing what we are trying to do here. Sorry if I'm
missing something obvious, just not seeing it.

Any guidance, samples, or otherwise pointers to more detailed
information on what we need to do to effectively implement a
customized Custom Field would be extremely helpful.

Thanks in advance!

On Nov 1, 2007 5:50 AM, Stan Sawa <stanislaw.sawa [at] uk> wrote:
> On Tue, 30 Oct 2007 11:51:34 -0400
> "Todd Williams" <willir70 [at] gmail> wrote:
> > Has anyone done anything similar to this? Can anybody offer some
> > pointers, ideas, or thoughts? Any suggestions would be greatly
> > appreciated.
> >
>
>
> we are currently implementing something like this (that is special
> customfield with customised editor viewer). Approach, which seems to
> work quite fine is adding new type of custom field (which will be used
> only in one cf, but it gives us nice separation of code):
>
> % cat local/lib/RT/CustomField_Local.pm
> no warnings qw/redefine/;
> package RT::CustomField;
>
> $FieldTypes{ClCustID} = [
> 'Select multiple customers',
> 'Select one customer'
> ];
>
> then, we create/add custom field to queue(s). As rt is using custom
> field type for selecting which widget/componenet, so it is using:
>
> local/html/Elements/EditCustomFieldClCustID
> local/html/Elements/ShowCustomFieldClCustID
>
> they were created based on one of default ones, with added additional
> 'helper' dropdowns and searches. They use some javascript/async
> requests to fetch data from other systems and modify existing controls.
> The only thing you have to keep in mind is that the value stored in
> customfield is the one which is passed in
> '<%$NamePrefix.$CustomField->Id%>-Value' field of form, so you have to
> make sure it is filled with correct value.
>
> Hope it helps.
>
> --
> Stanislaw Sawa
> _______________________________________________
> http://lists.bestpractical.com/cgi-bin/mailman/listinfo/rt-users
>
> SAVE THOUSANDS OF DOLLARS ON RT SUPPORT:
>
> If you sign up for a new RT support contract before December 31, we'll take
> up to 20 percent off the price. This sale won't last long, so get in touch today.
> Email us at sales [at] bestpractical or call us at +1 617 812 0745.
>
>
> Community help: http://wiki.bestpractical.com
> Commercial support: sales [at] bestpractical
>
>
> Discover RT's hidden secrets with RT Essentials from O'Reilly Media.
> Buy a copy at http://rtbook.bestpractical.com
>
_______________________________________________
http://lists.bestpractical.com/cgi-bin/mailman/listinfo/rt-users

SAVE THOUSANDS OF DOLLARS ON RT SUPPORT:

If you sign up for a new RT support contract before December 31, we'll take
up to 20 percent off the price. This sale won't last long, so get in touch today.
Email us at sales [at] bestpractical or call us at +1 617 812 0745.


Community help: http://wiki.bestpractical.com
Commercial support: sales [at] bestpractical


Discover RT's hidden secrets with RT Essentials from O'Reilly Media.
Buy a copy at http://rtbook.bestpractical.com


todd at chaka

Nov 15, 2007, 10:51 AM

Post #4 of 4 (446 views)
Permalink
Re: Special Custom Field Display/Edit - Suggestions? [In reply to]

RT has a callback that lets you override the name of the component
that is used to render the custom field. We use this to turn an input
CF into a select CF that is loaded with values from an RPC call. Here
is the callbacK:

> cat /opt/rt3/local/html/Callbacks/myCompany/Elements/EditCustomField/EditComponentName

<%INIT>
return unless $CustomField;

if ( $CustomField->FriendlyPattern =~ /\WTime\W/ ) {
$$Name = $m->callers(1)->dir_path . "/CustomFields/TimePicker";
return;
}

my
$Comp = $CustomField->Name;
$Comp =~ s/\W/_/g;
$Comp = $m->callers(1)->dir_path . "/CustomFields/EditCF_$Comp";

$$Name = $m->comp_exists($Comp.$CustomField->id) ? $Comp.$CustomField->id
: $m->comp_exists($Comp) ? $Comp
: $$Name;
</%INIT>
<%ARGS>
$Name
$CustomField => undef
$Object => undef
</%ARGS>


This allows us to create files in
/opt/rt3/local/html/Elements/CustomFields. For example:

> cat /opt/rt3/local/html/Elements/CustomFields/EditCF_Client_Name39
% my $id = $NamePrefix . $CustomField->Id;

<select name="<%$id%>-Values" id="<%$id%>-Values" size="10" >
<option value="" >(no value)</option>
% if ( @$clients == 1 ) {
<option value="<%$Values->First->Content%>" SELECTED >
<%$Values->First->Content%>
</option>
% }
% for my $client ( @$clients ) {
% my $value = $client->{client_id} || $client->{client_name};
<option value="<%$value%>" <% $Values && $Values->HasEntry($value)
? 'SELECTED' : ''%> >
<%substr($client->{client_name}, 0, 50)%>
</option>
% }
</select>

<%init>
my $clients = myCompany::RPC->get_clients();
</%init>

<%args>
$Object => undef
$CustomField => undef
$NamePrefix => undef
$Default => undef
$Values => undef
$Multiple => 0
$Rows => undef
</%args>



-Todd

On 11/15/07, Todd Williams <willir70 [at] gmail> wrote:
> Has anyone else had success with this Custom Custom Field idea and
> have any sample implementations they might be willing to share? I've
> read through the RT Wiki pages on customizing RT but I am not sure
> where to start with this. I have not seen any reference information
> posted anywhere doing what we are trying to do here. Sorry if I'm
> missing something obvious, just not seeing it.
>
> Any guidance, samples, or otherwise pointers to more detailed
> information on what we need to do to effectively implement a
> customized Custom Field would be extremely helpful.
>
> Thanks in advance!
>
> On Nov 1, 2007 5:50 AM, Stan Sawa <stanislaw.sawa [at] uk> wrote:
> > On Tue, 30 Oct 2007 11:51:34 -0400
> > "Todd Williams" <willir70 [at] gmail> wrote:
> > > Has anyone done anything similar to this? Can anybody offer some
> > > pointers, ideas, or thoughts? Any suggestions would be greatly
> > > appreciated.
> > >
> >
> >
> > we are currently implementing something like this (that is special
> > customfield with customised editor viewer). Approach, which seems to
> > work quite fine is adding new type of custom field (which will be used
> > only in one cf, but it gives us nice separation of code):
> >
> > % cat local/lib/RT/CustomField_Local.pm
> > no warnings qw/redefine/;
> > package RT::CustomField;
> >
> > $FieldTypes{ClCustID} = [.
> > 'Select multiple customers',
> > 'Select one customer'
> > ];
> >
> > then, we create/add custom field to queue(s). As rt is using custom
> > field type for selecting which widget/componenet, so it is using:
> >
> > local/html/Elements/EditCustomFieldClCustID
> > local/html/Elements/ShowCustomFieldClCustID
> >
> > they were created based on one of default ones, with added additional
> > 'helper' dropdowns and searches. They use some javascript/async
> > requests to fetch data from other systems and modify existing controls.
> > The only thing you have to keep in mind is that the value stored in
> > customfield is the one which is passed in
> > '<%$NamePrefix.$CustomField->Id%>-Value' field of form, so you have to
> > make sure it is filled with correct value.
> >
> > Hope it helps.
> >
> > --
> > Stanislaw Sawa
> > _______________________________________________
> > http://lists.bestpractical.com/cgi-bin/mailman/listinfo/rt-users
> >
> > SAVE THOUSANDS OF DOLLARS ON RT SUPPORT:
> >
> > If you sign up for a new RT support contract before December 31, we'll take
> > up to 20 percent off the price. This sale won't last long, so get in touch today.
> > Email us at sales [at] bestpractical or call us at +1 617 812 0745.
> >
> >
> > Community help: http://wiki.bestpractical.com
> > Commercial support: sales [at] bestpractical
> >
> >
> > Discover RT's hidden secrets with RT Essentials from O'Reilly Media.
> > Buy a copy at http://rtbook.bestpractical.com
> >
> _______________________________________________
> http://lists.bestpractical.com/cgi-bin/mailman/listinfo/rt-users
>
> SAVE THOUSANDS OF DOLLARS ON RT SUPPORT:
>
> If you sign up for a new RT support contract before December 31, we'll take
> up to 20 percent off the price. This sale won't last long, so get in touch today.
> Email us at sales [at] bestpractical or call us at +1 617 812 0745.
>
>
> Community help: http://wiki.bestpractical.com
> Commercial support: sales [at] bestpractical
>
>
> Discover RT's hidden secrets with RT Essentials from O'Reilly Media.
> Buy a copy at http://rtbook.bestpractical.com
>
_______________________________________________
http://lists.bestpractical.com/cgi-bin/mailman/listinfo/rt-users

SAVE THOUSANDS OF DOLLARS ON RT SUPPORT:

If you sign up for a new RT support contract before December 31, we'll take
up to 20 percent off the price. This sale won't last long, so get in touch today.
Email us at sales [at] bestpractical or call us at +1 617 812 0745.


Community help: http://wiki.bestpractical.com
Commercial support: sales [at] bestpractical


Discover RT's hidden secrets with RT Essentials from O'Reilly Media.
Buy a copy at http://rtbook.bestpractical.com

Request Tracker users RSS feed   Index | Next | Previous | View Threaded
 
 


Interested in having your list archived? Contact Gossamer Threads
 
  Web Applications & Managed Hosting Powered by Gossamer Threads Inc.