[Rt-commit] rt branch, 4.4/download-user-info, repushed
Craig Kaiser
craig at bestpractical.com
Wed Nov 21 15:15:28 EST 2018
The branch 4.4/download-user-info was deleted and repushed:
was 08c9ee0047c20974b30570e032536a949b33393e
now 5f5965c3feab166f051c04bdf2a39ac96a18cc47
1: 7e03a7e76 ! 1: 0aad7cfc6 Add column to transaction column map for content
@@ -11,7 +11,6 @@
},
+ Content => {
+ title => 'Content', # loc
-+ Attribute => 'Content', # loc
+ value => sub { return $_[0]->Content },
+ },
};
2: 8c8225627 = 2: 98e985990 Add config options for download user data result formats
3: 138e2dc5b = 3: 233bf58a0 Create helper for exporting user related information
4: ad2ba60d0 ! 4: ac2bfaec7 Create portlet for downloading user information
@@ -77,8 +77,8 @@
+
+<%ARGS>
+$UserObj
-+$UserDataButton => loc( 'Download User Data' )
++$UserDataButton => loc( 'Download User Data' )
+$UserTicketsButton => loc( 'Download User Tickets' )
-+$UserTxnButton => loc( 'Download User Transaction Data' )
++$UserTxnButton => loc( 'Download User Transaction Data' )
+</%ARGS>
5: 76aebc3c4 = 5: e97921391 Add user data download portlet to admin user modify page
6: d35da5e18 ! 6: 110ee095a Add download user data portlet to AboutMe.html page
@@ -9,10 +9,11 @@
</form>
-+<& /User/Elements/RelatedData, UserObj => $UserObj,
-+ UserDataButton => 'Download My Data',
-+ UserTicketsButton => 'Download My Tickets',
-+ UserTxnButton => 'Download My Transaction Data',
++<& /User/Elements/RelatedData,
++ UserObj => $UserObj,
++ UserDataButton => loc( 'Download My Data' ),
++ UserTicketsButton => loc( 'Download My Tickets' ),
++ UserTxnButton => loc( 'Download My Transaction Data' ),
+&>
<%INIT>
8: 08c9ee004 ! 7: 2065a16e0 Add user download component to self service
@@ -1,32 +1,26 @@
-Author: Maureen E. Mirville <maureen at bestpractical.com>
-
- Add new config to allow Self Service users to download their RT data
-
-diff --git a/etc/RT_Config.pm.in b/etc/RT_Config.pm.in
---- a/etc/RT_Config.pm.in
-+++ b/etc/RT_Config.pm.in
-@@
+Author: Craig Kaiser <craig at bestpractical.com>
+
+ Add user download component to self service
+
+diff --git a/share/html/SelfService/Prefs.html b/share/html/SelfService/Prefs.html
+--- a/share/html/SelfService/Prefs.html
++++ b/share/html/SelfService/Prefs.html
+@@
+ <& /Elements/Submit, Label => loc('Save Changes') &>
+ </form>
- Set($SelfServiceRegex, qr!^(?:/+SelfService/)!x );
++% if( RT->Config->Get('SelfServiceDownloadData') ) {
++<& /SelfService/User/Elements/RelatedData, UserObj => $user,
++&>
++% }
-+=item C<$SelfServiceDownloadData>
-+
-+Allow Self Service users to download their user information, ticket data
-+and transaction data as a .tsv file. When enabled, these three options
-+will appear on the /SelfService/Prefs.html page.
-+
-+=cut
-+
-+Set( $SelfServiceDownloadData, 0 );
-+
- =back
-
- =head2 Articles
-
-diff --git a/share/html/SelfService/Elements/RelatedData b/share/html/SelfService/Elements/RelatedData
+ <%INIT>
+ my @results;
+
+diff --git a/share/html/SelfService/Search/Results.tsv b/share/html/SelfService/Search/Results.tsv
new file mode 100644
--- /dev/null
-+++ b/share/html/SelfService/Elements/RelatedData
++++ b/share/html/SelfService/Search/Results.tsv
@@
+%# BEGIN BPS TAGGED BLOCK {{{
+%#
@@ -75,57 +69,14 @@
+%# those contributions and any derivatives thereof.
+%#
+%# END BPS TAGGED BLOCK }}}
-+<&|/Widgets/TitleBox,
-+ class => 'user-related-info',
-+ title => loc("User related info"),
-+&>
-+
-+<div>
-+ <a href="/SelfService/RelatedData.tsv?Type=User&id=<% $UserObj->id %>" class="button"><% $UserDataButton %></a>
-+ <a href="/SelfService/Results.tsv?Query=Requestor.id=<% $UserObj->id %>&Format=<% $Format | un %>" class="button"><% $UserTicketsButton %></a>
-+ <a href="/SelfService/RelatedData.tsv?Type=Transaction&id=<% $UserObj->id %>" class="button"><% $UserTxnButton %></a>
-+</div>
-+</&>
-+
+<%INIT>
-+my $Format = RT->Config->Get('DefaultSelfServiceSearchResultFormat') || RT->Config->Get('DefaultSearchResultFormat');
++$m->comp('/Search/Results.tsv', %ARGS);
+</%INIT>
-+
-+<%ARGS>
-+$UserObj
-+$UserDataButton => loc( 'Download My Data' )
-+$UserTicketsButton => loc( 'Download My Tickets' )
-+$UserTxnButton => loc( 'Download My Transaction Data' )
-+</%ARGS>
-
-diff --git a/share/html/SelfService/Prefs.html b/share/html/SelfService/Prefs.html
---- a/share/html/SelfService/Prefs.html
-+++ b/share/html/SelfService/Prefs.html
-@@
- <& /Elements/Submit, Label => loc('Save Changes') &>
- </form>
-
-+% if( $SelfServiceDownloadData ) {
-+<& /SelfService/Elements/RelatedData, UserObj => $user,
-+&>
-+% }
-
- <%INIT>
- my @results;
-@@
- }
- }
-
-+my $SelfServiceDownloadData = RT->Config->Get( 'SelfServiceDownloadData' );
-+
- #A hack to make sure that session gets rewritten.
- $session{'i'}++;
- </%INIT>
-
-diff --git a/share/html/SelfService/RelatedData.tsv b/share/html/SelfService/RelatedData.tsv
+
+diff --git a/share/html/SelfService/User/Elements/RelatedData b/share/html/SelfService/User/Elements/RelatedData
new file mode 100644
--- /dev/null
-+++ b/share/html/SelfService/RelatedData.tsv
++++ b/share/html/SelfService/User/Elements/RelatedData
@@
+%# BEGIN BPS TAGGED BLOCK {{{
+%#
@@ -174,49 +125,33 @@
+%# those contributions and any derivatives thereof.
+%#
+%# END BPS TAGGED BLOCK }}}
-+<%ARGS>
-+$PreserveNewLines => 0
-+$Type => 'User'
-+$Format => undef
-+$id
-+</%ARGS>
++<&|/Widgets/TitleBox,
++ class => 'user-related-info',
++ title => loc("User related info"),
++&>
++
++<div>
++ <a href="/SelfService/User/RelatedData.tsv?Type=User&id=<% $UserObj->id %>" class="button"><% $UserDataButton %></a>
++ <a href="/SelfService/Search/Results.tsv?Query=Requestor.id=<% $UserObj->id %>&Format=<% $Format | un %>" class="button"><% $UserTicketsButton %></a>
++ <a href="/SelfService/User/RelatedData.tsv?Type=Transaction&id=<% $UserObj->id %>" class="button"><% $UserTxnButton %></a>
++</div>
++</&>
+
+<%INIT>
-+# Abort unless supported type for export found
-+Abort('Incorrect value passed for Type') unless
-+ $Type && ( $Type eq 'User' || $Type eq 'Transaction');
++my $Format = RT->Config->Get('UserTicketDataResultFormat') || RT->Config->Get('DefaultSelfServiceSearchResultFormat');
++</%INIT>
+
-+if ( $session{'CurrentUser'}->id ne $id ) {
-+ Abort('User does not have the right to view other users') unless
-+ $session{'CurrentUser'}->UserObj->HasRight( Object => $RT::System, Right =>'AdminUsers');
-+}
-+
-+my $Collection;
-+
-+if ( $Type eq 'User' ) {
-+ $Format = RT->Config->Get('UserDataResultFormat') unless $Format;
-+
-+ $Collection = RT::Users->new( $session{'CurrentUser'} );
-+ $Collection->Limit( FIELD => 'id', VALUE => $id );
-+
-+} elsif ( $Type eq 'Transaction' ) {
-+ $Format = RT->Config->Get('UserTransactionDataResultFormat') unless $Format;
-+
-+ $Collection = RT::Transactions->new( $session{'CurrentUser'} );
-+ $Collection->Limit( FIELD => 'ObjectType', VALUE => 'RT::Ticket' );
-+ $Collection->Limit( FIELD => 'Creator', VALUE => $id );
-+ $Collection->Limit( FIELD => 'Type', VALUE => 'Create' );
-+ $Collection->Limit( FIELD => 'Type', VALUE => 'Correspond' );
-+ $Collection->Limit( FIELD => 'Type', VALUE => 'Comment' );
-+}
-+
-+$m->comp( "/Elements/TSVExport", Collection => $Collection, Format => $Format, PreserveNewLines => $PreserveNewLines );
-+</%INIT>
-
-diff --git a/share/html/SelfService/Results.tsv b/share/html/SelfService/Results.tsv
++<%ARGS>
++$UserObj
++$UserDataButton => loc( 'Download My Data' )
++$UserTicketsButton => loc( 'Download My Tickets' )
++$UserTxnButton => loc( 'Download My Transaction Data' )
++</%ARGS>
+
+diff --git a/share/html/SelfService/User/RelatedData.tsv b/share/html/SelfService/User/RelatedData.tsv
new file mode 100644
--- /dev/null
-+++ b/share/html/SelfService/Results.tsv
++++ b/share/html/SelfService/User/RelatedData.tsv
@@
+%# BEGIN BPS TAGGED BLOCK {{{
+%#
@@ -265,28 +200,7 @@
+%# those contributions and any derivatives thereof.
+%#
+%# END BPS TAGGED BLOCK }}}
-+<%ARGS>
-+$Format => undef
-+$Query => ''
-+$OrderBy => 'id'
-+$Order => 'ASC'
-+$PreserveNewLines => 0
-+</%ARGS>
+<%INIT>
-+my $Tickets = RT::Tickets->new( $session{'CurrentUser'} );
-+$Tickets->FromSQL( $Query );
-+if ( $OrderBy =~ /\|/ ) {
-+ # Multiple Sorts
-+ my @OrderBy = split /\|/, $OrderBy;
-+ my @Order = split /\|/, $Order;
-+ $Tickets->OrderByCols(
-+ map { { FIELD => $OrderBy[$_], ORDER => $Order[$_] } }
-+ ( 0 .. $#OrderBy )
-+ );
-+}
-+else {
-+ $Tickets->OrderBy( FIELD => $OrderBy, ORDER => $Order );
-+}
-+
-+$m->comp( "/Elements/TSVExport", Collection => $Tickets, Format => $Format, PreserveNewLines => $PreserveNewLines );
++$m->comp('/User/RelatedData.tsv', %ARGS);
+</%INIT>
+
-: ------- > 8: f8b70b83f Config option to allow self service users to download their user data
7: cb22e5cbc ! 9: 5f5965c3f Create test for user information TSV download
@@ -95,4 +95,3 @@
+}
+
+done_testing();
-
More information about the rt-commit
mailing list