[freeside-commits] branch master updated. a9aa4d83ae52cfece965cd8f175a29394938f76a

Mitch Jackson mitch at freeside.biz
Sun Mar 31 09:29:19 PDT 2019


The branch, master has been updated
       via  a9aa4d83ae52cfece965cd8f175a29394938f76a (commit)
      from  21a19bf261166b0e3898cd1c05461a8e1f82d69a (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
commit a9aa4d83ae52cfece965cd8f175a29394938f76a
Author: Mitch Jackson <mitch at freeside.biz>
Date:   Sun Mar 31 12:26:28 2019 -0400

    RT# 81692 Update use of deprecated callback element in RT

diff --git a/rt/lib/RT/Interface/Web/Request.pm b/rt/lib/RT/Interface/Web/Request.pm
index 1cd08df3e..9ed7610ba 100644
--- a/rt/lib/RT/Interface/Web/Request.pm
+++ b/rt/lib/RT/Interface/Web/Request.pm
@@ -85,6 +85,12 @@ By default is false, otherwise runs callbacks only once per
 process of the server. Such callbacks can be used to fill
 structures.
 
+=item ReturnComponentOutput
+
+By default, callback returns the status codes of all rendered components, and
+prints the rendered components to STDOUT. If this argument is true, callback
+returns the rendered components instead of printing them to STDOUT.
+
 =back
 
 Searches for callback components in
@@ -102,6 +108,7 @@ sub callback {
 
     my $name = delete $args{'CallbackName'} || 'Default';
     my $page = delete $args{'CallbackPage'} || $self->callers(0)->path;
+    my $use_scomp = delete $args{'ReturnComponentOutput'} ? 1 : 0;
     unless ( $page ) {
         $RT::Logger->error("Couldn't get a page name for callbacks");
         return;
@@ -134,10 +141,16 @@ sub callback {
     }
 
     my @rv;
+    my $scomp_out;
     foreach my $cb ( @$callbacks ) {
-        push @rv, scalar $self->comp( $cb, %args );
+        if ( $use_scomp ) {
+            no warnings 'uninitialized';
+            $scomp_out .= $self->scomp( $cb, %args );
+        } else {
+            push @rv, scalar $self->comp( $cb, %args );
+        }
     }
-    return @rv;
+    return $use_scomp ? $scomp_out : @rv;
 }
 
 sub clear_callback_cache {
diff --git a/rt/share/html/Elements/Header b/rt/share/html/Elements/Header
index 23007ddd1..58136c584 100755
--- a/rt/share/html/Elements/Header
+++ b/rt/share/html/Elements/Header
@@ -148,8 +148,11 @@ jQuery(document).ready(function(){
 
 }
 
-# $m->callback( %ARGS, CallbackName => 'Head' );
-$head .= $m->scomp( '/Elements/Callback', _CallbackName => 'Head', %ARGS );
+$head .= $m->callback(
+  %ARGS,
+  CallbackName => 'Head',
+  ReturnComponentOutput => 1,
+);
 
 #XXX $head .= <& /Elements/Framekiller &>;
 

-----------------------------------------------------------------------

Summary of changes:
 rt/lib/RT/Interface/Web/Request.pm | 17 +++++++++++++++--
 rt/share/html/Elements/Header      |  7 +++++--
 2 files changed, 20 insertions(+), 4 deletions(-)




More information about the freeside-commits mailing list