[Rt-commit] rt branch WIP-5.0/add-article-portlet created. rt-5.0.2-282-gab4f800e7e

BPS Git Server git at git.bestpractical.com
Tue Jul 5 21:27:52 UTC 2022


This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "rt".

The branch, WIP-5.0/add-article-portlet has been created
        at  ab4f800e7e48ebc7968f63f84ec2232a96ba5656 (commit)

- Log -----------------------------------------------------------------
commit ab4f800e7e48ebc7968f63f84ec2232a96ba5656
Author: Brian Conry <bconry at bestpractical.com>
Date:   Tue Jul 5 16:15:54 2022 -0500

    Add portlet for displaying article content
    
    This commit adds a portlet for displaying article content (custom
    fields).
    
    TODO: add appropriate documentation of parameters, once the list is
    finalized

diff --git a/share/html/Elements/ArticleContentAsPortlet b/share/html/Elements/ArticleContentAsPortlet
new file mode 100644
index 0000000000..33f69101b6
--- /dev/null
+++ b/share/html/Elements/ArticleContentAsPortlet
@@ -0,0 +1,97 @@
+%# BEGIN BPS TAGGED BLOCK {{{
+%#
+%# COPYRIGHT:
+%#
+%# This software is Copyright (c) 1996-2022 Best Practical Solutions, LLC
+%#                                          <sales at bestpractical.com>
+%#
+%# (Except where explicitly superseded by other copyright notices)
+%#
+%#
+%# LICENSE:
+%#
+%# This work is made available to you under the terms of Version 2 of
+%# the GNU General Public License. A copy of that license should have
+%# been provided with this software, but in any event can be snarfed
+%# from www.gnu.org.
+%#
+%# This work is distributed in the hope that it will be useful, but
+%# WITHOUT ANY WARRANTY; without even the implied warranty of
+%# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+%# General Public License for more details.
+%#
+%# You should have received a copy of the GNU General Public License
+%# along with this program; if not, write to the Free Software
+%# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+%# 02110-1301 or visit their web page on the internet at
+%# http://www.gnu.org/licenses/old-licenses/gpl-2.0.html.
+%#
+%#
+%# CONTRIBUTION SUBMISSION POLICY:
+%#
+%# (The following paragraph is not intended to limit the rights granted
+%# to you to modify and distribute this software under the terms of
+%# the GNU General Public License and is only of importance to you if
+%# you choose to contribute your changes and enhancements to the
+%# community by submitting them to Best Practical Solutions, LLC.)
+%#
+%# By intentionally submitting any modifications, corrections or
+%# derivatives to this work, or any other work intended for use with
+%# Request Tracker, to Best Practical Solutions, LLC, you confirm that
+%# you are the copyright holder for those contributions and you grant
+%# Best Practical Solutions,  LLC a nonexclusive, worldwide, irrevocable,
+%# royalty-free, perpetual, license to use, copy, create derivative
+%# works based on those contributions, and sublicense and distribute
+%# those contributions and any derivatives thereof.
+%#
+%# END BPS TAGGED BLOCK }}}
+<&|/Widgets/TitleBox, title => loc($PortletTitle), class => 'article-content' &>
+
+<div class="<% $ContentClass %>">
+% if ( $ArticleObj and $ArticleObj->Id ) {
+<& /Elements/ShowCustomFields, Object => $ArticleObj &>
+% }
+% elsif( $ContentIfEmpty ) {
+<% $ContentIfEmpty %>
+% }
+</div>
+
+</&>
+<%init>
+unless ( $ArticleObj->CurrentUserHasRight('ShowArticle') ) {
+    $ArticleObj->Load(0);
+}
+
+$ShowName //= !$ArticleObj->ClassObj->FirstAttribute('Skip-Name');
+$ShowSummary //= !$ArticleObj->ClassObj->FirstAttribute('Skip-Summary');
+
+my $ArticleId = $ArticleObj->Id // '';
+my $ArticleName = $ArticleObj->Name || loc("(no name)");
+my $ArticleSummary = $ArticleObj->Summary || loc("(no summary)");
+
+if ( $ShowName ) {
+    if ( $ShowSummary ) {
+        $PortletTitle //= loc( "Article #[_1]: [_2] - [_3]", $ArticleId, $ArticleName, $ArticleSummary );
+    }
+    else {
+        $PortletTitle //= loc( "Article #[_1]: [_2]", $ArticleId, $ArticleName );
+    }
+}
+else {
+    if ( $ShowSummary ) {
+        $PortletTitle //= loc( "Article #[_1] - [_2]", $ArticleId, $ArticleSummary );
+    }
+    else {
+        $PortletTitle //= loc( "Article #[_1]", $ArticleObj->Id);
+    }
+}
+
+</%init>
+<%ARGS>
+$ArticleObj => RT::Article->new( $session{CurrentUser} )
+$ContentClass => ''
+$ContentIfEmpty => loc("Article not avialable")
+$PortletTitle => undef
+$ShowName => undef
+$ShowSummary => undef
+</%ARGS>

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


hooks/post-receive
-- 
rt


More information about the rt-commit mailing list