Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature/history limit #3

Merged
merged 4 commits into from
Mar 14, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions MANIFEST
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
html/Callbacks/RT-Extension-UpdateHistory/Elements/Header/Head
html/Callbacks/RT-Extension-UpdateHistory/Ticket/Update.html/RightColumnBottom
html/NoAuth/css/RT-Extension-UpdateHistory.css
html/static/autohandler
html/static/css/updatehistory.css
html/Ticket/Elements/RT-Extension-UpdateHistory-inline
inc/Module/Install.pm
inc/Module/Install/Base.pm
Expand All @@ -19,3 +19,4 @@ lib/RT/Extension/UpdateHistory.pm
Makefile.PL
MANIFEST This list of files
META.yml
README
45 changes: 45 additions & 0 deletions README
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
NAME
RT-Extension-UpdateHistory - Allows to view a ticket's history while commenting/replying

DESCRIPTION
The default behavior of RT when adding a comment or reply is to not display the ticket's history.

This extension adds an additional element to the sidebar where an configurable amount of recent
activities are listed.

RT VERSION
Works with RT 4.4.2

INSTALLATION
perl Makefile.PL
make
make install
May need root permissions

Edit your /opt/rt4/etc/RT_SiteConfig.pm
Add this line:

Plugin('RT::Extension::UpdateHistory');

Clear your mason cache
rm -rf /opt/rt4/var/mason_data/obj

Restart your webserver

CONFIGURATION
$RT_Extension_UpdateHistory_MaxEntries
The maximum number of history entries to list. If not set, everything is listed.

AUTHOR
NETWAYS GmbH <info@netways.de>

All bugs should be reported via email to
bug-RT-Extension-UpdateHistory@rt.cpan.org
or via the web at
http://rt.cpan.org/Public/Dist/Display.html?Name=RT-Extension-UpdateHistory
LICENSE AND COPYRIGHT
This software is Copyright (c) 2018 by NETWAYS GmbH

This is free software, licensed under:

The GNU General Public License, Version 2, June 1991

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<& /Ticket/Elements/RT-Extension-UpdateHistory-inline, Ticket => $Ticket &>
<& /Ticket/Elements/RT-Extension-UpdateHistory, Ticket => $Ticket &>
<%ARGS>
$Ticket => undef
$Ticket
</%ARGS>
17 changes: 0 additions & 17 deletions html/NoAuth/css/RT-Extension-UpdateHistory.css

This file was deleted.

35 changes: 35 additions & 0 deletions html/Ticket/Elements/RT-Extension-UpdateHistory
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
<div class="rt-extension-update-history-box">
<& /Elements/ShowHistory,
Object => $Ticket,
Transactions => $Transactions,
ShowHeaders => $ARGS{'ShowHeaders'},
DisplayPath => $URI,
ShowDisplayModes => 0
&>

<div class="rt-extension-update-history-info">
% my $totalCount = $Transactions->CountAll();
% if ($maxEntries && $totalCount > $maxEntries) {
<p>Showing <i><% $maxEntries %></i> out of <i><% $totalCount %></i> transactions (Most recent first)</p>
% } else {
<p>Showing <i>all</i> transactions (Most recent first)</p>
% }
</div>

</div>
<%init>
my $Transactions = $Ticket->Transactions();
$Transactions->OrderByCols(
{ FIELD => 'Created', ORDER => 'DESC' },
{ FIELD => 'id', ORDER => 'DESC' },
);

my $maxEntries = RT->Config->Get('RT_Extension_UpdateHistory_MaxEntries');
if ($maxEntries) {
$Transactions->RowsPerPage($maxEntries);
}
</%init>
<%args>
$Ticket
$URI => 'Update.html'
</%args>
14 changes: 0 additions & 14 deletions html/Ticket/Elements/RT-Extension-UpdateHistory-inline

This file was deleted.

15 changes: 15 additions & 0 deletions html/static/autohandler
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
<%INIT>
use RT::Interface::REST;

my $file = $m->base_comp->source_file;

if ($file =~ /\.(css)$/i) {
$r->content_type('text/css; charset=utf-8');
} elsif ($file =~ /\.(js)$/i) {
$r->content_type('application/javascript; charset=utf-8');
}

$m->error_format('text');
$m->call_next();
$m->abort();
</%INIT>
23 changes: 23 additions & 0 deletions html/static/css/updatehistory.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
.rt-extension-update-history-box {
height: 600px;
overflow: scroll;

}

.rt-extension-update-history-info {
padding: 1em;
}

.rt-extension-update-history-info p {
margin: 0;
padding: 1em;
color: white;
font-size: 1.1em;
font-weight: bold;
text-align: center;
background-color: cornflowerblue;
}

#ticket-update-message {
min-width: 600px;
}
2 changes: 2 additions & 0 deletions lib/RT/Extension/UpdateHistory.pm
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ use warnings;

our $VERSION = '1.0.0';

RT->AddStyleSheets('updatehistory.css');

=head1 NAME

RT-Extension-UpdateHistory - Allows to view a ticket's history while commenting/replying
Expand Down