[rt-users] Custom Field size

Kenneth Crocker KFCrocker at lbl.gov
Fri Feb 8 13:32:09 EST 2008


Todd,


	AAAHHH! Methinks I understand. I'll try it and play with it now that I 
"SEE" what you're saying. Thanks.


Kenn
LBNL

On 2/8/2008 6:55 AM, Todd Chapman wrote:
> Kenneth,
> 
> The callback is a building block for changing that behavior of any CF 
> you want.
> 
> Then you drop components into /opt/rt3/local/html/Elements/CustomFields/ 
> to actually change specific CFs.
> 
> So in your case you create a file called EditCF_my_cf_name. The contents 
> should be:
> 
> <& /Elements/EditCustomFieldText, %ARGS, Rows => 10, Cols => 40 &>
> 
> All this does is pass the arguments (%ARGS) that RT would normally use 
> to render your text area CF and overrides the Rows and Cols settings. It 
> uses EditCustomFieldText which is what RT would normally use, but now 
> you have specific control of the number of rows and columns for that 
> custom field. It does not allow you to control the size of all custom 
> fields at once. If you want to do that you can use CSS.
> 
> -Todd
> 
> On 2/7/08, *Kenneth Crocker* <KFCrocker at lbl.gov 
> <mailto:KFCrocker at lbl.gov>> wrote:
> 
>     Todd,
> 
>             Some of it, yes. I know how to create the directories/files,
>     but I
>     still don't see how that will make the box for the CF entry bigger.
> 
> 
>     Kenn
>     LBNL
> 
>     On 2/7/2008 2:06 PM, Todd Chapman wrote:
>      > Kenneth,
>      >
>      > Yes, include the <%INIT> line.
>      >
>      > You have to make the directory /opt/rt3/local/html/Callbacks
>      > /my_company/Elements/EditCustomField/ and create the file
>     EditComponentName.
>      >
>      > Then create the directory /opt/rt3/local/html/Elements
>      > /CustomFields/.
>      >
>      > Now for every CF you want to modify the display of you create a
>     file in
>      > that directory. For edit mode you create the file
>      > EditCF_my_cf_name. That is, "EditCF" + your CF name with all
>      > non-alphanumeric characters replaces with underscores.
>      >
>      > In the example I gave you just end up calling the same component RT
>      > would have normally called, but override the Rows and Cols options.
>      >
>      > Does that make sense?
>      >
>      > -Todd
>      >
>      >
>      > On 2/7/08, *Kenneth Crocker* <KFCrocker at lbl.gov
>     <mailto:KFCrocker at lbl.gov>
>      > <mailto:KFCrocker at lbl.gov <mailto:KFCrocker at lbl.gov>>> wrote:
>      >
>      >     Todd,
>      >
>      >
>      >             That's pretty cool. Any answer as to why the first
>      >     instruction I got
>      >     doesn't work? I more curious than anything else. I'm still
>     REAL new to
>      >     the UNIX world and perl and more of n Administer at this
>     point. I've
>      >     written some simple scrips but no code that involves callbacks,
>      >     subroutines, etc. My hero once said "a good man always knows his
>      >     limitations". So I'm learning this stuff painfully slow. For
>     example:
>      >
>      >             I assume $ cat means you want me to put the code that
>     starts
>      >     with the
>      >     line return .... into
>     ".../Elements/EditCustomField/EditComponentName".
>      >     Do I include the <%init> line? Also, how will RT know that I
>     want just
>      >     the one CF to be bigger and what size? What is "<%ARGS>"?
>     Does all of
>      >     that code go in "/EditCustomField/"? Is that a directory? Is
>      >     "/EditComponentName" a file and does it hold the "</%ARGS>"
>     part of the
>      >     code?
>      >             As you can see, I know very little about any perl
>     code that
>      >     is the
>      >     least bit complicated. If I understood your code better, I'd
>     more than
>      >     likely use it as my 35 years of coding in 20 other languages
>     taught me
>      >     that hard-coding and redundant coding is BAD, BAD, BAD. Thanks.
>      >
>      >
>      >     Kenn
>      >     LBNL
>      >
>      >     On 2/7/2008 12:57 PM, Todd Chapman wrote:
>      >      > RT has a callback to change what component is used to
>      >     edit/display a CF.
>      >      > I wrote a callback that made it easy to override the
>     component to be
>      >      > used for a specific CF.
>      >      >
>      >      > Here is the callback:
>      >      >
>      >      > $ cat
>      >      >
>      >    
>     /opt/rt3/local/html/Callbacks/my_company/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>
>      >      >
>      >      > With that in place I can just drop a new component in the
>     right
>      >     place to
>      >      > get the desired behavior. Here is one what does what you want:
>      >      >
>      >      > $ cat
>      >    
>     /opt/rt3/local/html/Elements/CustomFields/EditCF_Change_Description
>      >      >
>      >      > <& /Elements/EditCustomFieldText, %ARGS, Rows => 10, Cols
>     => 40 &>
>      >      >
>      >      >
>      >      > This is handy for all sorts of things.
>      >      >
>      >      > -Todd
>      >      >
>      >      > On 2/7/08, *Kenneth Crocker* <KFCrocker at lbl.gov
>     <mailto:KFCrocker at lbl.gov>
>      >     <mailto:KFCrocker at lbl.gov <mailto:KFCrocker at lbl.gov>>
>      >      > <mailto:KFCrocker at lbl.gov <mailto:KFCrocker at lbl.gov>
>     <mailto:KFCrocker at lbl.gov <mailto:KFCrocker at lbl.gov>>>> wrote:
>      >      >
>      >      >     To all,
>      >      >
>      >      >
>      >      >             My turn!!!  Awhile back, I asked about how to
>      >     increase the
>      >      >     size of a
>      >      >     custom Field I defined as "Fill in one text area". It all
>      >     works fine,
>      >      >     but the size is like really, really, really small. I
>     wanted
>      >     to make the
>      >      >     box (where the user would type his stuff) much bigger.
>     I was
>      >     told to
>      >      >     change the size of "RT::MessageBoxWidth. I did. I made it
>      >      >     "Set($MessageBoxWidth , 180);" and when I bounced RT,
>     the box
>      >     doesn't
>      >      >     look any different. I created a ticket and when I
>     typed info
>      >     in the
>      >      >     field, same small box and look. Sooooooo, does anyone
>     have a
>      >     solution to
>      >      >     that one? I would greatly appreciate it. Thanks.
>      >      >
>      >      >
>      >      >     Kenn
>      >      >     LBNL
>      >      >
>      >      >     _______________________________________________
>      >      >    
>     http://lists.bestpractical.com/cgi-bin/mailman/listinfo/rt-users
>      >      >
>      >      >     Community help: http://wiki.bestpractical.com
>      >      >     Commercial support: sales at bestpractical.com
>     <mailto:sales at bestpractical.com>
>      >     <mailto:sales at bestpractical.com <mailto:sales at bestpractical.com>>
>      >      >     <mailto:sales at bestpractical.com
>     <mailto:sales at bestpractical.com> <mailto:sales at bestpractical.com
>     <mailto:sales at bestpractical.com>>>
>      >      >
>      >      >
>      >      >     Discover RT's hidden secrets with RT Essentials from
>     O'Reilly
>      >     Media.
>      >      >     Buy a copy at http://rtbook.bestpractical.com
>      >      >
>      >      >
>      >
>      >
> 
> 




More information about the rt-users mailing list