[Bps-public-commit] rt-extension-announce branch, support-html-content-as-banner, created. 1.00-4-g62a496b
Craig Kaiser
craig at bestpractical.com
Fri Sep 20 14:51:54 EDT 2019
The branch, support-html-content-as-banner has been created
at 62a496bfa004960c48f1d24c0fc62f8dbffd009f (commit)
- Log -----------------------------------------------------------------
commit a6e1bf09428195173f86fb2cb7f77d66ebd78877
Author: Craig Kaiser <craig at bestpractical.com>
Date: Mon Aug 19 14:51:15 2019 -0400
Add configuration variable to allow HTML content as announce banner
diff --git a/README b/README
index 08fbfde..a50df58 100644
--- a/README
+++ b/README
@@ -2,7 +2,7 @@ NAME
RT-Extension-Announce - Display announcements as a banner on RT pages.
RT VERSION
- Works with RT 4.0 and 4.2.
+ Works with RT 4.0, 4.2 and 4.4.
INSTALLATION
perl Makefile.PL
@@ -113,6 +113,13 @@ CONFIGURATION
Set this to true to show announcements on the self service page as well
as the regular privileged RT page.
+ $RTAnnounceAllowHTML
+ If set to true, the banner content will be set to 'text/html' and allow
+ HTML rendering. If the content of the banner is rather large there is an
+ option to wrap the content in overflow divs. By wrapping any content in
+ the following: <div class="RTAnnounceBannerOverflow"></div> the content
+ within the divs will be available as scrollable overflow content.
+
AUTHOR
Best Practical Solutions, LLC <modules at bestpractical.com>
diff --git a/html/Callbacks/RT-Extension-Announce/Elements/PageLayout/BeforeBody b/html/Callbacks/RT-Extension-Announce/Elements/PageLayout/BeforeBody
index 86d8b18..fe72759 100644
--- a/html/Callbacks/RT-Extension-Announce/Elements/PageLayout/BeforeBody
+++ b/html/Callbacks/RT-Extension-Announce/Elements/PageLayout/BeforeBody
@@ -67,7 +67,11 @@
}
$txns->OrderBy( FIELD => 'Created', ORDER => 'DESC' );
$txns->RowsPerPage(1);
- my $content = $txns->First->Content(Type => 'text/plain');
+
+ my $show_html = RT::Config->Get('RTAnnounceAllowHTML') || 0;
+ my $advanced_mode = RT::Config->Get('RTAnnounceAdvancedMode') || 0;
+ my $content = $show_html ? $txns->First->Content(Type => 'text/html') : $txns->First->Content(Type => 'text/plain');
+
if( length $content > $MaxMessageLength ){
$content = substr($content, 0, $MaxMessageLength);
# Try to break at a word boundary.
@@ -76,7 +80,13 @@
$content .= chr(8230); # Ellipsis character
}
</%perl>
-<% $content %>
+<div id="RTAnnounceScrollable" class="RTAnnounceScrollable">
+% if ( $show_html ) {
+ <% $content |n %>
+% } else {
+ <% $content %>
+% }
+</div>
%if( $show_ticket_links{$ticket->Id} ){
(<a class="announcements_detail" href="<% RT->Config->Get('WebPath') %>/Ticket/Display.html?id=<% $ticket->Id %>">more</a>)
%}
diff --git a/lib/RT/Extension/Announce.pm b/lib/RT/Extension/Announce.pm
index 278ce8d..009b89d 100644
--- a/lib/RT/Extension/Announce.pm
+++ b/lib/RT/Extension/Announce.pm
@@ -220,6 +220,13 @@ in your RT_SiteConfig.pm:
Set this to true to show announcements on the self service page as well as
the regular privileged RT page.
+=head2 C<$RTAnnounceAllowHTML>
+
+If set to true, the banner content will be set to 'text/html' and allow HTML rendering. If the content of
+the banner is rather large there is an option to wrap the content in overflow divs. By wrapping any content in
+the following: C<E<lt>div class="RTAnnounceBannerOverflow"E<gt>E<lt>/divE<gt>> the content within the divs will be available as
+scrollable overflow content.
+
=head1 AUTHOR
Best Practical Solutions, LLC E<lt>modules at bestpractical.comE<gt>
diff --git a/static/css/announce.css b/static/css/announce.css
index 022eac9..1052ec5 100644
--- a/static/css/announce.css
+++ b/static/css/announce.css
@@ -82,3 +82,12 @@ table.announce td.date {
font-size: smaller;
color: #777;
}
+
+.RTAnnounceBannerOverflow {
+ height: 0px;
+ white-space: nowrap;
+}
+
+.RTAnnounceScrollable {
+ overflow: auto;
+}
commit 62a496bfa004960c48f1d24c0fc62f8dbffd009f
Author: Craig Kaiser <craig at bestpractical.com>
Date: Wed Sep 4 17:24:06 2019 -0400
Hide banner scrollbar
diff --git a/static/css/announce.css b/static/css/announce.css
index 1052ec5..9d86ad1 100644
--- a/static/css/announce.css
+++ b/static/css/announce.css
@@ -86,8 +86,17 @@ table.announce td.date {
.RTAnnounceBannerOverflow {
height: 0px;
white-space: nowrap;
+ margin-right: -5px;
}
.RTAnnounceScrollable {
overflow: auto;
+ -ms-overflow-style: none; /* IE 11 */
+ scrollbar-width: none; /* Firefox 64 */
+}
+
+/* Chrome */
+.RTAnnounceScrollable::-webkit-scrollbar {
+ width: 0px; /* Remove scrollbar space */
+ background: transparent; /* Optional: just make scrollbar invisible */
}
-----------------------------------------------------------------------
More information about the Bps-public-commit
mailing list