[Bps-public-commit] RT-BugTracker-Public branch, 4.2-4.4-compatibility, updated. 1.00-18-g5e645bf
Jim Brandt
jbrandt at bestpractical.com
Tue Mar 28 14:36:05 EDT 2017
The branch, 4.2-4.4-compatibility has been updated
via 5e645bfb6302d26d1b090cd436b1164d8e5110b9 (commit)
from 24d1ce5e8b1bc1c5125a56134e72839e9e03cb56 (commit)
Summary of changes:
.../BugTracker-Public/Elements/Login/Default | 8 ++--
lib/RT/BugTracker/Public.pm | 48 ++++++++++++++++++++++
2 files changed, 51 insertions(+), 5 deletions(-)
- Log -----------------------------------------------------------------
commit 5e645bfb6302d26d1b090cd436b1164d8e5110b9
Author: Jim Brandt <jbrandt at bestpractical.com>
Date: Tue Mar 28 14:34:44 2017 -0400
Add method to return content from articles in select UI locations
Allow customization of select parts of the UI using articles in
the BugTracker Pages class.
diff --git a/html/Callbacks/BugTracker-Public/Elements/Login/Default b/html/Callbacks/BugTracker-Public/Elements/Login/Default
index 9f94e71..4df861a 100644
--- a/html/Callbacks/BugTracker-Public/Elements/Login/Default
+++ b/html/Callbacks/BugTracker-Public/Elements/Login/Default
@@ -45,8 +45,6 @@
%# those contributions and any derivatives thereof.
%#
%# END BPS TAGGED BLOCK }}}
-<h3><% loc("Don't have an account but want to browse bugs?") %></h3>
-<p>
-<% loc('Use the <a href="[_1]">public interface</a>.', RT->Config->Get('WebBaseURL') .'/Public/' ) |n %>
-<% loc('Want to report a bug? Send it in via e-mail.') %>
-</p>
+
+<% $m->comp( '/Elements/ScrubHTML',
+ Content => RT::BugTracker::Public::GetArticleContent('AfterLoginForm')) |n %>
diff --git a/lib/RT/BugTracker/Public.pm b/lib/RT/BugTracker/Public.pm
index 2c6af37..536a0af 100644
--- a/lib/RT/BugTracker/Public.pm
+++ b/lib/RT/BugTracker/Public.pm
@@ -215,6 +215,54 @@ require RT::Interface::Web;
"/Public/index.html" => 1,
);
+=head2 GetArticleContent
+
+Searches in articles for content for various configurable pages in the BugTracker
+interface. The article names are available for adding custom
+content in the listed locations. To customize, create or edit the article with the
+listed name.
+
+=over
+
+=item * AfterLoginForm
+
+Location: Login page, below username/password fields
+
+=back
+
+=cut
+
+sub GetArticleContent {
+ my $article_name = shift;
+
+ my $Class = RT::Class->new( RT->SystemUser );
+ my ($ret, $msg) = $Class->Load('BugTracker Pages');
+
+ unless ( $ret and $Class->Id ){
+ RT::Logger->warning('Unable to load BugTracker Pages class for articles');
+ return '';
+ }
+
+ my $Article = RT::Article->new( RT->SystemUser );
+ ($ret, $msg) = $Article->LoadByCols( Name => $article_name, Class => $Class->Id );
+
+ unless ($ret and $Article->id){
+ RT::Logger->debug("No article found for " . $article_name);
+ return '';
+ }
+
+ RT::Logger->debug("Found article id: " . $Article->Id);
+ my $class = $Article->ClassObj;
+ my $cfs = $class->ArticleCustomFields;
+
+ while (my $cf = $cfs->Next) {
+ my $values = $Article->CustomFieldValues($cf->Id);
+ my $value = $values->First;
+ return $value->Content;
+ }
+ return;
+}
+
=head1 AUTHOR
Best Practical Solutions, LLC E<lt>modules at bestpractical.comE<gt>
-----------------------------------------------------------------------
More information about the Bps-public-commit
mailing list