[Rt-commit] rt branch, 5.0/add-self-service-article-components, created. rt-5.0.0-132-g2c6bd12b37

Dianne Skoll dianne at bestpractical.com
Mon Nov 23 13:42:51 EST 2020


The branch, 5.0/add-self-service-article-components has been created
        at  2c6bd12b37373f5c77c44421cab8e4c0128c3631 (commit)

- Log -----------------------------------------------------------------
commit 2c6bd12b37373f5c77c44421cab8e4c0128c3631
Author: Dianne Skoll <dianne at bestpractical.com>
Date:   Mon Nov 23 13:40:43 2020 -0500

    Add components to self-service dashboard to show Top or Newest articles.

diff --git a/etc/RT_Config.pm.in b/etc/RT_Config.pm.in
index 2539240f4d..e33f49c32f 100644
--- a/etc/RT_Config.pm.in
+++ b/etc/RT_Config.pm.in
@@ -2970,10 +2970,19 @@ If this is not set at all, then $HomepageComponents is used instead.
 Set(
     $SelfServicePageComponents,
     [
-        qw(QuickCreate QueueList MyAdminQueues MySupportQueues MyReminders RefreshHomepage Dashboards SavedSearches FindUser MyAssets FindAsset FindGroup) # loc_qw
+        qw(/SelfService/Elements/TopArticles /SelfService/Elements/NewestArticles)
     ]
 );
 
+=item C<$SelfServiceArticleClass>
+
+C<$SelfServiceArticleClass> specifies the article class that self-service
+users can see in their TopArticles or NewestArticles portlet.
+
+=cut
+
+Set($SelfServiceArticleClass, 'General');
+
 =back
 
 =head2 Articles
diff --git a/share/html/SelfService/Elements/NewestArticles b/share/html/SelfService/Elements/NewestArticles
new file mode 100644
index 0000000000..96a43d7629
--- /dev/null
+++ b/share/html/SelfService/Elements/NewestArticles
@@ -0,0 +1,48 @@
+%# BEGIN BPS TAGGED BLOCK {{{
+%#
+%# COPYRIGHT:
+%#
+%# This software is Copyright (c) 1996-2020 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 }}}
+<& /SelfService/Elements/ShowArticles &>
diff --git a/share/html/SelfService/Elements/ShowArticles b/share/html/SelfService/Elements/ShowArticles
new file mode 100644
index 0000000000..407d103443
--- /dev/null
+++ b/share/html/SelfService/Elements/ShowArticles
@@ -0,0 +1,88 @@
+%# BEGIN BPS TAGGED BLOCK {{{
+%#
+%# COPYRIGHT:
+%#
+%# This software is Copyright (c) 1996-2020 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/TitleBoxStart, title => $title, bodyclass=> '' &>
+
+<div class="form-row article-headers">
+  <div class="label col-4 text-left">
+    <&|/l&>Name</&>
+  </div>
+</div>
+% while (my $Article = $MyArticles->Next) {
+% $i++;
+<div class="<% $i%2 ? 'oddline' : 'evenline'%> form-row article-metadata">
+  <div class="value col-4 text-left">
+    <span class="current-value font-weight-bold"><a href="<% RT->Config->Get('WebPath') %>/SelfService/Article/Display.html?id=<%$Article->Id%>"><%$Article->Name || loc('(no name)')%></a></span>
+  </div>
+</div>
+<div class="<% $i%2 ? 'oddline' : 'evenline'%> form-row article-summary">
+  <div class="col-11 col-offset-1">
+    <span class="current-value"><small><%$Article->Summary || loc('(no Summary)')%></small></span>
+  </div>
+</div>
+% }
+<& /Widgets/TitleBoxEnd &>
+<%INIT>
+my $i;
+
+my $class = RT::Class->new($session{'CurrentUser'});
+$class->Load(RT::Config->Get('SelfServiceArticleClass'));
+my @classes = ($class->Id);
+my $MyArticles;
+$MyArticles = RT::Articles->new($session{'CurrentUser'});
+$MyArticles->Limit(FIELD => 'Class', OPERATOR => 'IN', VALUE => \@classes)
+    if @classes;
+$MyArticles->RowsPerPage($rows);
+$MyArticles->OrderBy(FIELD => $orderby_field, ORDER => $sortorder);
+
+</%INIT>
+<%ARGS>
+$orderby_field => 'LastUpdated'
+$sortorder     => 'Desc'
+$rows          => 10
+$title         => loc("[_1] Newest Articles", $rows)
+</%ARGS>
diff --git a/share/html/SelfService/Elements/TopArticles b/share/html/SelfService/Elements/TopArticles
new file mode 100644
index 0000000000..70b964799f
--- /dev/null
+++ b/share/html/SelfService/Elements/TopArticles
@@ -0,0 +1,48 @@
+%# BEGIN BPS TAGGED BLOCK {{{
+%#
+%# COPYRIGHT:
+%#
+%# This software is Copyright (c) 1996-2020 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 }}}
+<& /SelfService/Elements/ShowArticles, orderby_field => 'SortOrder', sortorder => 'Desc', title => loc('[_1] Top Articles', 10), rows => 10 &>

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


More information about the rt-commit mailing list