[rt-users] Editing ShowCustomFields file to maintain Custom Field value formatting
Todd Chapman
todd at chaka.net
Tue Mar 4 14:50:13 EST 2008
You could do this with a callcack and a custom component like so:
/opt/rt3/local/html/Elements/Callbacks/myCompany/Elements/ShowCustomFields/ShowComponentName:
<%INIT>
return unless $CustomField;
unless ( $m->comp_exists( $$Name ) ) {
$$Name = "ShowCustomFieldPre";
}
</%INIT>
<%ARGS>
$Name
$CustomField => undef
</%ARGS>
/opt/rt3/local/html/Elements/ShowCustomFieldPre:
% my $content = $Object->Content;
<pre>
<% $content %>
</pre>
<%ARGS>
$Object
</%ARGS>
On 3/4/08, Simon Jester <sklutch at hostile.org> wrote:
> Morning, everyone!
>
> Long time lurker (with occasional stupid questions) running into an issue with
> a customization to ShowCustomFields file.
>
> In 3.6.1, I edited the ShowCustomfields file to inject a <pre></pre> statement
> just inside the <li> blocks. This took care of an issue in which the carriage
> returns in the custom field value were being stripped on display by the
> browsers. (Interestingly enough, the returns were in the page source but were
> stripped on display). This worked for some time and all was happy.
>
> Now, I'm deploying replacement hardware (beefy!) and taking the opportunity to
> bump my installation to 3.6.5 and I'm stymied by the changes made to the
> ShowCustomFields file in which the code block that was present in 3.6.1 was
> moved to a subroutine and updated. If I use the same logic and insert my
> <pre></pre> statement just inside the <li> block, it just gets ignored and the
> custom fields are a jumble of text.
>
> What up with that? Can someone point me to the proper place/method to insert
> these statements? Or is there a better way that I've completely missed in my
> zeal to edit source files? :)
>
> sklutch
>
> <<<<3.6.1 file changes>>>>
> % while (my $Value = $Values->Next()) {
> <li>
> <pre> <---Added
> % if ($CustomField->LinkValueTo) {
> <a href="<%$Value->LinkValueTo|n%>" target="_new">
> % }
> (...)
> <script><!--
> ahah('<%$Value->IncludeContentForValue%>', 'object_cf_value_<%
> $Value->id%>');
> --></script>
> % }
> </pre> <---Added
> </li>
>
>
>
> <<<<3.6.5 Unsuccessful file changes>>>>
> <ul>
> % while ( my $Value = $Values->Next ) {
> <li>
> <pre> <---Added
> % $print_value->( $CustomField, $Value );
> </pre> <---Added
> </li>
> % }
> </ul>
>
>
>
>
> _______________________________________________
> http://lists.bestpractical.com/cgi-bin/mailman/listinfo/rt-users
>
> Community help: http://wiki.bestpractical.com
> Commercial support: 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