[Rt-commit] rt branch, 4.4/user-info, created. rt-4.4.2-238-g623935bb3

Craig Kaiser craig at bestpractical.com
Tue Sep 4 16:57:47 EDT 2018


The branch, 4.4/user-info has been created
        at  623935bb38fddeead83ad26bc59d9a2ebf489712 (commit)

- Log -----------------------------------------------------------------
commit 180df032fc6e072ce06c275922a55f1362afaf98
Author: Craig Kaiser <craig at bestpractical.com>
Date:   Fri May 18 15:06:01 2018 -0400

    Add column map for transaction content

diff --git a/share/html/Elements/RT__Transaction/ColumnMap b/share/html/Elements/RT__Transaction/ColumnMap
index 28a82f1e0..d709a5440 100644
--- a/share/html/Elements/RT__Transaction/ColumnMap
+++ b/share/html/Elements/RT__Transaction/ColumnMap
@@ -105,6 +105,11 @@ my $COLUMN_MAP = {
             }
         },
     },
+    Content => {
+        title       => 'Content', # loc
+        Attribute   => 'Content', # loc
+        value       => sub { return $_[0]->Content },
+    },
 };
 
 

commit b131c0033740e140bb6c4f4de6637860b00e1cc6
Author: Craig Kaiser <craig at bestpractical.com>
Date:   Fri May 18 15:07:19 2018 -0400

    Add helper file for TSV exporting data
    
    Move the TSVExport file to /Elements instead of the local elements dir.

diff --git a/share/html/Helpers/TSVExport b/share/html/Helpers/TSVExport
new file mode 100644
index 000000000..6b488b478
--- /dev/null
+++ b/share/html/Helpers/TSVExport
@@ -0,0 +1,107 @@
+%# BEGIN BPS TAGGED BLOCK {{{
+%#
+%# COPYRIGHT:
+%#
+%# This software is Copyright (c) 1996-2017 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 }}}
+<%ARGS>
+$Format           => undef
+$Query            => ''
+$OrderBy          => 'id'
+$Order            => 'ASC'
+$PreserveNewLines => 0
+$Type             => undef
+$UserId           => undef
+</%ARGS>
+
+<%INIT>
+my $Collection;
+
+if ( !$Type ) {
+    $Collection = RT::Tickets->new( $session{'CurrentUser'} );
+    $Format = RT->Config->Get('UserDataSearchResultFormat') || RT->Config->Get('DefaultSearchResultFormat');
+    $Collection->FromSQL( $Query );
+    if ( $OrderBy =~ /\|/ ) {
+        # Multiple Sorts
+        my @OrderBy = split /\|/, $OrderBy;
+        my @Order   = split /\|/, $Order;
+        $Collection->OrderByCols(
+            map { { FIELD => $OrderBy[$_], ORDER => $Order[$_] } }
+            ( 0 .. $#OrderBy )
+        );
+    }
+    else {
+        $Collection->OrderBy( FIELD => $OrderBy, ORDER => $Order );
+    }
+} elsif ( $Type eq 'User' ) {
+    $Format = RT->Config->Get('UserDataSearchResultFormat') || "'__id__', '__Name__', '__EmailAddress__', '__RealName__', '__NickName__', '__Organization__', '__HomePhone__', '__WorkPhone__','__MobilePhone__', '__PagerPhone__', '__Address1__', '__Address2__', '__City__', '__State__','__Zip__', '__Country__', '__Gecos__', '__Lang__', '__FreeFormContactInfo__'";
+
+    my $user = RT::User->new($session{'CurrentUser'});
+    if ( $UserId ) {
+        $user->Load( $UserId );
+    } else {
+        $user->Load($session{'CurrentUser'});
+    }
+
+    $Collection = RT::Users->new($session{'CurrentUser'});
+    $Collection->Limit( FIELD => 'id', VALUE => $user->Id );
+
+} elsif ( $Type eq 'Transaction' ) {
+    $Format = RT->Config->Get('UserDataSearchResultFormat') || "'__ObjectId__', '__id__', '__Created__', '__Description__', '__OldValue__', '__NewValue__', '__Content__'";
+
+    my $user = RT::User->new($session{'CurrentUser'});
+    if ( $UserId ) {
+        $user->Load( $UserId );
+    } else {
+        $user->Load($session{'CurrentUser'});
+    }
+
+    $Collection = RT::Transactions->new($session{'CurrentUser'});
+    $Collection->Limit( FIELD => 'Creator', VALUE => $user->Id );
+    $Collection->Limit( FIELD => 'Type', VALUE => 'Correspondence' );
+    $Collection->Limit( FIELD => 'Type', VALUE => 'Comment' );
+}
+
+$m->comp( "/Elements/TSVExport", Collection => $Collection, Format => $Format, PreserveNewLines => $PreserveNewLines );
+</%INIT>

commit 757c3c3ba8da8e50235b2bb53810d6a77babe61b
Author: Craig Kaiser <craig at bestpractical.com>
Date:   Fri May 18 15:07:45 2018 -0400

    Set current search result TSV link to use helper file
    
    Have action menu on the search results page use the TSV export
    file from the /Elements dir instead of the local one.

diff --git a/share/html/Elements/Tabs b/share/html/Elements/Tabs
index 40cb43e7c..cf2d99cef 100644
--- a/share/html/Elements/Tabs
+++ b/share/html/Elements/Tabs
@@ -982,7 +982,7 @@ my $build_main_nav = sub {
 
             my $more = $current_search_menu->child( more => title => loc('Feeds') );
 
-            $more->child( spreadsheet => title => loc('Spreadsheet'), path => "/Search/Results.tsv$args" );
+            $more->child( spreadsheet => title => loc('Spreadsheet'), path => "/Helpers/TSVExport$args" );
 
             my %rss_data = map {
                 $_ => $QueryArgs->{$_} || $fallback_query_args{$_} || '' }

commit f556ebd7d55eecb9454430ff43b7fc8f66e6a93c
Author: Craig Kaiser <craig at bestpractical.com>
Date:   Fri May 18 15:08:42 2018 -0400

    Add portlet for user information
    
    This portlet allows a user from the Admin->Users->Modify page see all
    the user information that RT has on them. They can download a TSV file
    for User record data, Ticket data where the user is the requestor and
    transaction data where the user is the creator. They can also choose to
    remove their user record from RT by the anonymize, replace or remove
    methods.

diff --git a/share/html/Elements/UserRelatedInfo b/share/html/Elements/UserRelatedInfo
new file mode 100644
index 000000000..9144b7ae6
--- /dev/null
+++ b/share/html/Elements/UserRelatedInfo
@@ -0,0 +1,78 @@
+%# BEGIN BPS TAGGED BLOCK {{{
+%#
+%# COPYRIGHT:
+%#
+%# This software is Copyright (c) 1996-2017 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 }}}
+% if ( $UserObj->Id ) {
+<&|/Widgets/TitleBox,
+    class => 'user-related-info',
+    title => loc("User related info"),
+&>
+<table>
+    <tr>
+        <td class="label"><&|/l&>Download CSV file of all user info stored on RT</&>:</td>
+        <td class="value"><a href="/Helpers/TSVExport?Type=User&UserId=<% $UserObj->Id %>" class="button">Info</a></td>
+    </tr><tr>
+        <td class="label"><&|/l&>Download CSV of tickets user is a requestor on</&>:</td>
+        <td class="value"><a href="/Helpers/TSVExport?<% $query_tickets %>" class="button">Tickets</a></td>
+    </tr><tr>
+        <td class="label"><&|/l&>Download CSV of transactions created by user</&>:</td>
+        <td class="value"><a href="/Helpers/TSVExport?Type=Transaction&UserId=<% $UserObj->Id %>" class="button">Transactions</a></td>
+    </tr>
+</table>
+</&>
+% }
+<%INIT>
+my $query_tickets;
+
+# Build Ticket Query
+if ( $UserObj->Id ) {
+   $query_tickets = "Query=Requestor.id = " . $UserObj->Id;
+}
+</%INIT>
+
+<%ARGS>
+$UserObj
+</%ARGS>

commit 623935bb38fddeead83ad26bc59d9a2ebf489712
Author: Craig Kaiser <craig at bestpractical.com>
Date:   Fri May 18 15:09:05 2018 -0400

    Add user info portlet to Admin/User/Modify
    
    Add the user portlet to the Modify user page. As well as adding logic to
    handle if a user record is changed during the anonymizing process.

diff --git a/share/html/Admin/Users/Modify.html b/share/html/Admin/Users/Modify.html
index 3b8bc42fc..b83e74e11 100644
--- a/share/html/Admin/Users/Modify.html
+++ b/share/html/Admin/Users/Modify.html
@@ -210,10 +210,16 @@
 % $m->callback( %ARGS, CallbackName => 'RightColumnBottom', UserObj => $UserObj );
 </td></tr>
 <tr>
-<td colspan="2">
+<td>
 <&| /Widgets/TitleBox, title => loc('Comments about this user'), class => 'user-info-comments' &>
 <textarea class="comments" name="Comments" cols="80" rows="5" wrap="virtual"><%$UserObj->Comments//$ARGS{Comments}//''%></textarea>
 </&>
+</td>
+<td>
+<& /Elements/UserRelatedInfo, UserObj => $UserObj &>
+</td></tr>
+
+<tr><td>
 %if (!$Create && $UserObj->Privileged) {
 <br />
 <&| /Widgets/TitleBox, title => loc('Signature'), class => 'user-info-signature' &>

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


More information about the rt-commit mailing list