Editing ShowCustomFields file to maintain Custom Field value formatting

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

 statement
just inside the
  • 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

     statement just inside the 
  • 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? :slight_smile:

    sklutch

    <<<<3.6.1 file changes>>>>
    % while (my $Value = $Values->Next()) {

  •   <---Added
    % if ($CustomField->LinkValueTo) {
    
    % }
    (...)
    
    % }
       
    <---Added
  • <<<<3.6.5 Unsuccessful file changes>>>>

      % while ( my $Value = $Values->Next ) {
    •   <---Added
      % $print_value->( $CustomField, $Value );
       
      <---Added
    • % }

    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;

    <% $content %>
    

    <%ARGS>
    $Object
    </%ARGS>On 3/4/08, Simon Jester sklutch@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

     statement
    just inside the
  • 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

     statement just inside the 
  • 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? :slight_smile:

    sklutch

    <<<<3.6.1 file changes>>>>
    % while (my $Value = $Values->Next()) {

  •   <---Added
     % if ($CustomField->LinkValueTo) {
     
     % }
     (...)
     
     % }
       
    <---Added
  • <<<<3.6.5 Unsuccessful file changes>>>>

      % while ( my $Value = $Values->Next ) {
    •   <---Added
       % $print_value->( $CustomField, $Value );
        
      <---Added
    • % }

    The rt-users Archives

    Community help: http://wiki.bestpractical.com
    Commercial support: sales@bestpractical.com

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

    <<<<3.6.5 Unsuccessful file changes>>>>

      % while ( my $Value = $Values->Next ) {
    •   <---Added
      % $print_value->( $CustomField, $Value );
       
      <---Added
    • % }

    When you bring up the page that’s not working, do you see your PRE
    blocks in there? If so, what does the content look like in between them?

    The display of the PRE code is browser-dependent, so either the PRE tags
    are not being inserted correctly, or something has munged your custom
    field value. I would suspect the latter. Maybe a different CF field
    type is the answer? Not sure…

    Regards,

    joe
    Joe Casadonte
    joe.casadonte@oracle.com

    ========== ==========
    == The statements and opinions expressed here are my own and do not ==
    == necessarily represent those of Oracle Corporation. ==
    ========== ==========