[Rt-commit] rt branch, 4.6/reverse-transaction-order, repushed
Michel Rodriguez
michel at bestpractical.com
Fri Mar 13 08:06:48 EDT 2020
The branch 4.6/reverse-transaction-order was deleted and repushed:
was abc139c509cbadcadf442b0652d71e0aa5dd9878
now 3795befe1f21b2c0622b63212fbfb7acc96ca969
1: 4087b3a62 < -: ------- Fixed templates so that ShowHeaders is passed as an argument, instead of getting it sometimes from %ARGS
2: abc139c50 ! 1: 3795befe1 Add a control to reverse the time order on the current ticket.
@@ -2,78 +2,11 @@
Add a control to reverse the time order on the current ticket.
- Add the option in the template.
- Pass the new parameter through the various layers of templates.
- Add an option to SortedTransactions to change the original order.
-
-diff --git a/etc/RT_SiteConfig.pm b/etc/RT_SiteConfig.pm
---- a/etc/RT_SiteConfig.pm
-+++ b/etc/RT_SiteConfig.pm
-@@
- # perl -c /path/to/your/etc/RT_SiteConfig.pm
- #
- # You must restart your webserver after making changes to this file.
--#
-
--# You may also split settings into separate files under the etc/RT_SiteConfig.d/
--# directory. All files ending in ".pm" will be parsed, in alphabetical order,
--# after this file is loaded.
-+#Set( $rtname, '127.0.0.1');
-+Set($rtname, 'localhost');
-+Set($WebPort, 8080);
-+Set(@ReferrerWhitelist, '127.0.0.1', '192.168.1.2',);
-+Set($RestrictReferrer, 0);
-
--Set( $rtname, 'example.com');
-+Set($LogToSTDERR, 'debug');
-+Set($DevelMode, 1);
-
- # You must install Plugins on your own, this is only an example
- # of the correct syntax to use when activating them:
-+# Plugin( "RT::Extension::SLA" );
- # Plugin( "RT::Authen::ExternalAuth" );
-
-+#Plugin( 'RT::Extension::MandatoryOnTransition');
-+#Set( %MandatoryOnTransition,
-+# newstuff => {
-+# 'new -> resolved' => ['CF.color', 'size'],
-+# 'open -> resolved' => ['CF.color', 'size'],
-+# },
-+#);
-+
-+
-+
-+Set( %Crypt,
-+ Incoming => 'GnuPG',
-+ Outgoing => 'GnuPG',
-+
-+ RejectOnMissingPrivateKey => 1,
-+ RejectOnBadData => 1,
-+
-+ AllowEncryptDataInDB => 0,
-+
-+ Dashboards => {
-+ Encrypt => 0,
-+ Sign => 0,
-+ },
-+);
-+
-+Set( %GnuPG,
-+ Enable => 1,
-+ GnuPG => '/usr/bin/gpg1', # debian
-+ # GnuPG => '/usr/local/bin/gpg1', # macOS
-+ Passphrase => 'Ormafura25!',
-+ OutgoingMessagesFormat => "RFC", # Inline
-+);
-+
-+Set( %GnuPGOptions,
-+ homedir => q{/home/mrodrigu/.gnupg/pubring.gpg},
-+);
-+
-+Set($MailCommand, "testfile");
-+
-+
- 1;
+ Add the option in the template.
+ Pass the new parameter through the various layers of templates.
+ Add an option to SortedTransactions to change the original order.
+ When the option is clicked, calls the same page, with the same parameters
+ except for changing the ReverseTransactionOrder value.
diff --git a/lib/RT/Record.pm b/lib/RT/Record.pm
--- a/lib/RT/Record.pm
@@ -127,32 +60,23 @@
$ShowDisplayModes => 1
$ScrollShowHistory => 0
@@
- <div class="history <% lc $record_type %>" id="<% $histid %>">
- <%perl>
- $ShowHeaders //= 0;
--
-+$ReverseTransactionOrder //= 0;
- if ( $ShowDisplayModes or $ShowTitle or $ScrollShowHistory ) {
- my $title = $ShowTitle
- ? loc('History')
-@@
- loc("Show full headers") .
- qq{</a>};
}
-+
-+ my @TransactionHeaders= ( loc( 'Oldest transaction first'), loc( 'Newest transaction first') );
-+ my $Order = (RT->Config->Get("OldestTransactionsFirst", $Object->CurrentUser) xor $ReverseTransactionOrder);
-+ my $TransactionHeader= $TransactionHeaders[$Order];
-+
-+ my $switched_order = 1 - $ReverseTransactionOrder;
-+ $titleright .= '—' if $titleright;
-+ $titleright .= qq{<a href="?ReverseTransactionOrder=$switched_order;ForceShowHistory=1;ShowHeaders=$ShowHeaders;id=} .
-+ $Object->id.qq{#$histid">} .
-+ $TransactionHeader .
-+ qq{</a>};
}
- </%perl>
++ my @TransactionHeaders= ( loc( 'Oldest transaction first' ), loc( 'Newest transaction first' ) );
++ my $Order = ( RT->Config->Get( "OldestTransactionsFirst", $Object->CurrentUser ) xor $ReverseTransactionOrder );
++ my $TransactionHeader= $TransactionHeaders[$Order];
++
++ my $switched_order = 1 - $ReverseTransactionOrder;
++ $ShowHeaders //= 0; # by default $ShowHeaders should be 0, but it is not
++ push( @elements, qq{<a href="?ReverseTransactionOrder=$switched_order;ForceShowHistory=1;ShowHeaders=$ShowHeaders;id=} .
++ $Object->id.qq{#$histid">} .
++ $TransactionHeader .
++ qq{</a>} );
++
+ # build the new link
+ my $alt = loc('Edit');
+ my $titleright = qq{<div class="btn-group dropdown"><a id="history-dropdown" href="#" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false"><span class="fas fa-cog icon-bordered fa-2x" alt="$alt" data-toggle="tooltip" data-placement="top" data-original-title="$alt"></span></a><ul class="dropdown-menu dropdown-menu-right">};
diff --git a/share/html/Elements/ShowHistoryPage b/share/html/Elements/ShowHistoryPage
--- a/share/html/Elements/ShowHistoryPage
@@ -172,19 +96,17 @@
--- a/share/html/Helpers/TicketHistory
+++ b/share/html/Helpers/TicketHistory
@@
+ %# END BPS TAGGED BLOCK }}}
<%ARGS>
$id
- $ShowHeaders => 0
+$ReverseTransactionOrder => 0
</%ARGS>
<%INIT>
my $TicketObj = RT::Ticket->new($session{'CurrentUser'});
@@
- </%INIT>
<& /Elements/ShowHistory,
Object => $TicketObj,
-- ShowHeaders => $ARGS{'ShowHeaders'},
-+ ShowHeaders => $ShowHeaders,
+ ShowHeaders => $ARGS{'ShowHeaders'},
+ ReverseTransactionOrder => $ReverseTransactionOrder,
Attachments => $attachments,
AttachmentContent => $attachment_content,
@@ -206,37 +128,40 @@
--- a/share/html/Ticket/Display.html
+++ b/share/html/Ticket/Display.html
@@
- % if ($ShowHistory eq "scroll") {
<& /Ticket/Elements/ScrollShowHistory,
Ticket => $TicketObj,
-- ShowHeaders => $ARGS{'ShowHeaders'},
-+ ShowHeaders => $ShowHeaders,
+ ShowHeaders => $ARGS{'ShowHeaders'},
+ ReverseTransactionOrder => $ReverseTransactionOrder,
&>
% } elsif ($ShowHistory eq "delay") {
<& /Ticket/Elements/DelayShowHistory,
Ticket => $TicketObj,
-- ShowHeaders => $ARGS{'ShowHeaders'},
-+ ShowHeaders => $ShowHeaders,
+ ShowHeaders => $ARGS{'ShowHeaders'},
+ ReverseTransactionOrder => $ReverseTransactionOrder,
&>
% } elsif (not $ForceShowHistory and $ShowHistory eq "click") {
<& /Ticket/Elements/ClickToShowHistory,
Ticket => $TicketObj,
-- ShowHeaders => $ARGS{'ShowHeaders'},
-+ ShowHeaders => $ShowHeaders,
+ ShowHeaders => $ARGS{'ShowHeaders'},
+ ReverseTransactionOrder => $ReverseTransactionOrder,
&>
% } else {
<& /Elements/ShowHistory ,
Object => $TicketObj,
Transactions => $transactions,
-- ShowHeaders => $ARGS{'ShowHeaders'},
+ ShowHeaders => $ARGS{'ShowHeaders'},
+ ReverseTransactionOrder => $ReverseTransactionOrder,
-+ ShowHeaders => $ShowHeaders,
Attachments => $attachments,
AttachmentContent => $attachment_content
&>
+@@
+ <%ARGS>
+ $TicketObj => undef
+ $ShowHeaders => 0
++$ReverseTransactionOrder => 0
+ $HideUnsetFields => RT->Config->Get('HideUnsetFieldsOnDisplay', $session{CurrentUser})
+ $ForceShowHistory => 0
+ $InlineEdit => RT->Config->Get('InlineEdit', $session{CurrentUser})
@@
Arguments => { id => $TicketObj->id },
);
@@ -251,9 +176,9 @@
--- a/share/html/Ticket/Elements/ScrollShowHistory
+++ b/share/html/Ticket/Elements/ScrollShowHistory
@@
+ %# END BPS TAGGED BLOCK }}}
<%ARGS>
$Ticket
- $ShowHeaders => 0
+$ReverseTransactionOrder => 0
</%ARGS>
@@ -261,7 +186,7 @@
@@
my %extra_args = map { $_ => $ARGS{$_} // 1 } qw/ShowDisplayModes ShowTitle ScrollShowHistory/;
- $extra_args{ShowHeaders} = $ShowHeaders;
+ $extra_args{ShowHeaders} = $ARGS{ShowHeaders};
+$extra_args{ReverseTransactionOrder} = $ReverseTransactionOrder;
$m->callback( CallbackName => 'ExtraShowHistoryArguments', Ticket => $Ticket, ExtraArgs => \%extra_args );
@@ -269,7 +194,7 @@
-
-my $oldestTransactionsFirst = RT->Config->Get("OldestTransactionsFirst", $session{CurrentUser});
+# parens on the right side are required because 'xor' has a lower priority than '='
-+my $oldestTransactionsFirst = ( RT->Config->Get("OldestTransactionsFirst", $session{CurrentUser}) xor $ReverseTransactionOrder);
++my $oldestTransactionsFirst = ( RT->Config->Get( "OldestTransactionsFirst", $session{CurrentUser} ) xor $ReverseTransactionOrder );
</%INIT>
<& /Elements/ShowHistoryHeader,
More information about the rt-commit
mailing list