[Rt-commit] rt branch, 5.0/self-service-homepage-dashboard, repushed
Dianne Skoll
dianne at bestpractical.com
Fri Oct 2 11:14:46 EDT 2020
The branch 5.0/self-service-homepage-dashboard was deleted and repushed:
was ad71c6dd44258f3c1f96201160545d4db5e67d95
now 7bc0b9c0b9b1254fa3b8e19f4e39f6c7a00d551a
1: 81c9702b0c = 1: 81c9702b0c Add callback for modifying the group query
2: de95100478 = 2: de95100478 Refactor code so we can add history endpoints to new classes more easily
3: e3ca9f7381 = 3: e3ca9f7381 Avoid permission check to get CF type in CustomFieldValueIsEmpty
4: 6889750dcd = 4: 6889750dcd Avoid permission check to get CF CanonicalizeClass
5: e3b184f752 = 5: e3b184f752 Add basic article/class endpoints to REST2
6: b40af0d7a5 = 6: b40af0d7a5 Add REST2 tests for articles/classes
7: 9f6f07fdf8 = 7: 9f6f07fdf8 Search group itself for SelfService "My group's tickets"
8: 92c515d372 ! 8: bc4128710a Add ability to serve a custom dashboard as the SelfService home page.
@@ -6,18 +6,20 @@
--- a/etc/RT_Config.pm.in
+++ b/etc/RT_Config.pm.in
@@
- =back
-
-
--
--
- =head2 Ticket search
-
- =over 4
-@@
Set($SelfServiceShowGroupTickets, 0);
++=item C<$SelfServiceUseDashboard>
++
++C<$SelfServiceUseDashboard> is a flag indicating whether or not to use
++a dashboard for the Self Service home page. If it is set to false,
++then the normal Open Tickets / Closed Tickets menu is shown rather
++than a dashboard.
++
++=cut
++
++Set($SelfServiceUseDashboard, 0);
++
+=item C<$SelfServicePageComponents>
+
+C<$SelfServicePageComponents> is an arrayref of allowed components on
@@ -33,17 +35,6 @@
+ ]
+);
+
-+=item C<$SelfServiceUseDashboard>
-+
-+C<$SelfServiceUseDashboard> is a flag indicating whether or not to use
-+a dashboard for the Self Service home page. If it is set to false,
-+then the normal Open Tickets / Closed Tickets menu is shown rather
-+than a dashboard.
-+
-+=cut
-+
-+Set($SelfServiceUseDashboard, 0);
-+
+=item C<$SelfServiceArticleClass>
+
+C<$SelfServiceArticleClass> limits the articles shown to self-service
@@ -56,6 +47,19 @@
=back
=head2 Articles
+
+diff --git a/lib/RT/Attribute.pm b/lib/RT/Attribute.pm
+--- a/lib/RT/Attribute.pm
++++ b/lib/RT/Attribute.pm
+@@
+ }
+ }
+ # dashboards have dependencies on all the searches and dashboards they use
+- elsif ($self->Name eq 'Dashboard') {
++ elsif ($self->Name eq 'Dashboard' || $self->Name eq 'SelfServiceDashboard') {
+ my $content = $self->Content;
+ for my $pane (values %{ $content->{Panes} || {} }) {
+ for my $component (@$pane) {
diff --git a/lib/RT/Config.pm b/lib/RT/Config.pm
--- a/lib/RT/Config.pm
@@ -199,32 +203,27 @@
description => loc('Modify the default "RT at a glance" view'),
path => '/Admin/Global/MyRT.html',
);
++
+ if (RT->Config->Get('SelfServiceUseDashboard')) {
-+ my $self_service = $admin_global->child( selfservice_home =>
-+ title => loc('Self-Service Home Page'),
-+ description => loc('Edit self-service home page dashboard'),
-+ path => '/Admin/Global/SelfServiceHomePage.html');
-+ if ( $request_path =~ m{^/Admin/Global/SelfServiceHomePage} ) {
-+ $page->child(content => title => loc('Content'), path => '/Admin/Global/SelfServiceHomePage.html');
-+ $page->child(show => title => loc('Show'), path => '/SelfService');
++ if ($current_user->HasRight( Right => 'SeeDashboard', Object => RT->System ) ) {
++ my $self_service = $admin_global->child( selfservice_home =>
++ title => loc('Self-Service Home Page'),
++ description => loc('Edit self-service home page dashboard'),
++ path => '/Admin/Global/SelfServiceHomePage.html');
++ if ( $request_path =~ m{^/Admin/Global/SelfServiceHomePage} ) {
++ $page->child(content => title => loc('Content'), path => '/Admin/Global/SelfServiceHomePage.html');
++ $page->child(show => title => loc('Show'), path => '/SelfService');
++ }
+ }
+ }
$admin_global->child( 'dashboards-in-menu' =>
title => loc('Modify Reports menu'),
description => loc('Customize dashboards in menu'),
@@
- }
- }
-
-+#'
- sub BuildSelfServiceNav {
- my $request_path = shift;
- my $top = shift;
-@@
my $current_user = $HTML::Mason::Commands::session{CurrentUser};
-+ if (RT->Config->Get('SelfServiceUseDashboard')) {
++ if (RT->Config->Get('SelfServiceUseDashboard') && $current_user->HasRight( Right => 'SeeDashboard', Object => RT->System ) ) {
+ if ($request_path =~ m{^/SelfService/index\.html$}) {
+ if ($current_user->HasRight( Right => 'ShowConfigTab',
+ Object => RT->System)) {
@@ -354,92 +353,6 @@
+
+</%INIT>
-diff --git a/share/html/Articles/Article/Edit.html b/share/html/Articles/Article/Edit.html
---- a/share/html/Articles/Article/Edit.html
-+++ b/share/html/Articles/Article/Edit.html
-@@
- $ARGS{Disabled} = $ARGS{Enabled} ? 0 : 1;
- }
-
-+my $sortorder_ok = 1;
-+if ($ARGS{SortOrder}) {
-+ if ($ARGS{SortOrder} !~ /^-?\d+$/) {
-+ push @results, (0, loc('Sort Order must be an integer'));
-+ $sortorder_ok = 0;
-+ }
-+}
-+
- if ( !$id ) {
- $title = loc('Create a new article');
- foreach my $arg ( sort keys %ARGS ) {
-@@
- split( /\s+/, $ARGS{'new-RefersTo'} );
- }
-
-- my %cfs = ProcessObjectCustomFieldUpdatesForCreate(
-- ARGSRef => \%ARGS,
-- ContextObject => $ClassObj,
-- );
--
-- my $msg;
-- ( $id, $msg ) = $ArticleObj->Create(
-- Summary => $ARGS{'Summary'},
-- Name => $ARGS{'Name'},
-- Class => $ARGS{'Class'},
-- Topics => $ARGS{'Topics'},
-- Disabled => $ARGS{'Disabled'},
-- %create_args,
-- %cfs
-- );
-- push( @results, $msg );
-- if ($id) {
-+ my %cfs;
-+ if ($sortorder_ok) {
-+ %cfs = ProcessObjectCustomFieldUpdatesForCreate(
-+ ARGSRef => \%ARGS,
-+ ContextObject => $ClassObj,
-+ );
-
-+ my $msg;
-+ ( $id, $msg ) = $ArticleObj->Create(
-+ Summary => $ARGS{'Summary'},
-+ SortOrder => $ARGS{'SortOrder'},
-+ Name => $ARGS{'Name'},
-+ Class => $ARGS{'Class'},
-+ Topics => $ARGS{'Topics'},
-+ Disabled => $ARGS{'Disabled'},
-+ %create_args,
-+ %cfs
-+ );
-+ push( @results, $msg );
-+ } else {
-+ $id = 0;
-+ }
-
-+ if ($id) {
- $ArticleObj->Load($id);
-
- $title = loc( 'Modify article #[_1]', $ArticleObj->Id );
-@@
-
- my @attribs = qw(Name Summary Class Disabled);
-
-- @results = UpdateRecordObject(
-- AttributesRef => \@attribs,
-- Object => $ArticleObj,
-- ARGSRef => \%ARGS
-- );
-+ if ($sortorder_ok) {
-+ @results = UpdateRecordObject(
-+ AttributesRef => \@attribs,
-+ Object => $ArticleObj,
-+ ARGSRef => \%ARGS
-+ );
-+ }
-
- my @cf_results = ProcessObjectCustomFieldUpdates(
- Object => $ArticleObj,
-
diff --git a/share/html/Dashboards/Elements/ShowPortlet/component b/share/html/Dashboards/Elements/ShowPortlet/component
--- a/share/html/Dashboards/Elements/ShowPortlet/component
+++ b/share/html/Dashboards/Elements/ShowPortlet/component
@@ -475,7 +388,7 @@
+}
+
+my $class = $self_service_dashboard ? 'RT::Dashboard::SelfService' : 'RT::Dashboard';
-+eval "use $class;";
++$class->require;
+my $Dashboard = $class->new($session{'CurrentUser'});
my ($ok, $msg) = $Dashboard->LoadById($id);
unless ($ok) {
@@ -540,7 +453,7 @@
</%INIT>
<%ARGS>
$id => '' unless defined $id
-+$self_service_dashboard => 0 unless defined $self_service_dashboard;
++$self_service_dashboard => 0
</%ARGS>
diff --git a/share/html/Dashboards/Render.html b/share/html/Dashboards/Render.html
@@ -564,7 +477,7 @@
-use RT::Dashboard;
-my $Dashboard = RT::Dashboard->new($session{'CurrentUser'});
+my $class = $self_service_dashboard ? 'RT::Dashboard::SelfService' : 'RT::Dashboard';
-+eval "use $class;";
++$class->require;
+my $Dashboard = $class->new($session{'CurrentUser'});
my ($ok, $msg) = $Dashboard->LoadById($id);
unless ($ok) {
@@ -590,172 +503,6 @@
+$self_service_dashboard => 0
</%ARGS>
-
-diff --git a/share/html/Elements/SelfServiceTopArticles b/share/html/Elements/SelfServiceTopArticles
-new file mode 100644
---- /dev/null
-+++ b/share/html/Elements/SelfServiceTopArticles
-@@
-+%# 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 }}}
-+
-+<& /Elements/TopArticles,
-+ title => $title,
-+ display_path => 'SelfService/Article',
-+ classname => (RT->Config->Get('SelfServiceArticleClass') || 'SelfService') &>
-+
-+<%ARGS>
-+$title => undef
-+</%ARGS>
-
-diff --git a/share/html/Elements/TopArticles b/share/html/Elements/TopArticles
-new file mode 100644
---- /dev/null
-+++ b/share/html/Elements/TopArticles
-@@
-+%# 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/TitleBox, title => $title &>
-+
-+% while (my $article = $articles->Next) {
-+ <div class="form-row">
-+ <span class="value col-auto">
-+ <a href="<% RT->Config->Get('WebPath') %>/<% $display_path %>/Display.html?id=<%$article->Id%>"><%$article->Name || loc('(no name)')%>: <%$article->Summary%></a>
-+ </span>
-+ </div>
-+% }
-+</&>
-+
-+<%INIT>
-+$title = loc('Articles');
-+# Figure out which class of articles applies, if a classname was given
-+my $class;
-+
-+if ($classname) {
-+ $class = RT::Class->new( $session{'CurrentUser'} );
-+ my ($ok, $msg) = $class->LoadByCols( Name => RT->Config->Get('SelfServiceArticleClass') );
-+ if (!$ok || !$class->Id) {
-+ # Could not find the class... bail?
-+ return;
-+ }
-+}
-+
-+# Get the articles
-+my $articles = RT::Articles->new( $session{'CurrentUser'} );
-+
-+$articles->RowsPerPage($rows);
-+
-+if ($class) {
-+ $articles->Search(Class => $class->Id,
-+ OrderBy => ['SortOrder', 'LastUpdated'],
-+ Order => ['ASC', 'DESC' ]);
-+} else {
-+ $articles->Search(OrderBy => ['SortOrder', 'LastUpdated'],
-+ Order => ['ASC', 'DESC' ]);
-+}
-+
-+</%INIT>
-+
-+<%ARGS>
-+$title => undef
-+$rows => 10
-+# Unfortunately, the directory hierarchy under SelfService
-+# is just "Article" instead of "Articles/Article", so we have
-+# to make to path for displaying an article a parameter.
-+$display_path => 'Articles/Article'
-+$classname => undef
-+</%ARGS>
diff --git a/share/html/SelfService/Open.html b/share/html/SelfService/Open.html
new file mode 100644
9: f4857f2586 < --: ------- Add UI for editing and displaying the SortOrder associated with an article.
10: ad71c6dd44 < --: ------- Include SelfServiceDashboard in FindDependencies.
--: ------- > 9: 7bc0b9c0b9 Add UI for editing and displaying the SortOrder associated with an article.
More information about the rt-commit
mailing list