[rt-users] <Blank> in default preference / search options ?

Ruslan Zakirov ruz at bestpractical.com
Mon May 30 15:36:03 EDT 2011


On Mon, May 30, 2011 at 11:04 PM, Daniel Schwager
<Daniel.Schwager at dtnet.de> wrote:
>> > I would like to give the user the possibility
>> > to add a <BLANK> to this user default search,
>> > so the new BLANK should appear in the selection
>> > box
>> >
>> >        Search Preferences / Search options  / Display Columns / "Add Columns:"
>> >
>> > I found the available elements setup in
>> >        share/html/Search/Elements/BuildFormatString
>
>> Also, try NBSP (like NEWLINE). It should work similar or exactly like
>> what you want.
>
> Great ! Thx a lot - works fine now:
>
> # Add local copy of BuildFormatString
> cp -av share/html/Search/Elements/BuildFormatString \
>        local/html/Search/Elements/BuildFormatString
>
> # Add NBSP
> local/html/Search/Elements/BuildFormatString:
>             NEWLINE
>        +    NBSP
>        ); # loc_qw
>
>
> ** Advanced (-:
> One additional question - could this be done by using a callback ?
> I saw a callback directly after the definition of the fields ...
>    $m->callback( CallbackOnce => 1, CallbackName => 'SetFieldsOnce', Fields => \@fields );
>
> I tried to create a callback - but it does not work (sorry, I never
> used Callbacks). May you can give me a small hint ?
>
> cat /opt/rt3/local/html/Callbacks/MyCallbacks/Prefs/SearchOptions.html/SetFieldsOnce


It's a wrong path. Correct path is:

/opt/rt3/local/html/Callbacks/MyCallbacks/Search/Elements/BuildFormatString/SetFieldsOnce

> <%init>
>  push @fields, "NBSP";
>  RT::Logger->debug("SetFieldsOnce.1: \n");
> </%init>
> <%args>
>  @fields => undef
> </%args>


A reference to array is passed, so you should use reference:

<%ARGS>
$fields => []
<%ARGS>
<%INIT>
push @$fields, 'NBSP';
</%INIT>

That's it. Not tested.

> Kind regards
> Danny
>



-- 
Best regards, Ruslan.



More information about the rt-users mailing list