[Rt-commit] rtir branch, 4.0/save-lookup-results, created. 4.0.0-38-g74c709e
Aaron Kondziela
aaron at bestpractical.com
Wed Mar 22 21:43:14 EDT 2017
The branch, 4.0/save-lookup-results has been created
at 74c709e5116eb0ab9d49e859a5b71b6bf0ad89dc (commit)
- Log -----------------------------------------------------------------
commit 74c709e5116eb0ab9d49e859a5b71b6bf0ad89dc
Author: Aaron Kondziela <aaron at bestpractical.com>
Date: Wed Mar 22 21:43:31 2017 -0400
Add button to save Whois results to a ticket
diff --git a/html/RTIR/Tools/Elements/ToolResultsWhois b/html/RTIR/Tools/Elements/ToolResultsWhois
index b9d570f..d5ec771 100644
--- a/html/RTIR/Tools/Elements/ToolResultsWhois
+++ b/html/RTIR/Tools/Elements/ToolResultsWhois
@@ -47,6 +47,11 @@
%# END BPS TAGGED BLOCK }}}
% if ( $q ) {
<h2>WHOIS Results</h2>
+
+% if ($TicketObj and $WhoisIterator) {
+ <button onClick="jQuery('#save-results-to-ticket').click()"><% loc('Save these results to the ticket') %></button>
+% }
+
% if ( $TicketObj && RT::IR::TicketType( Ticket => $TicketObj ) eq 'Incident' ) {
<form method="post" action="<% RT::IR->HREFTo("Tools/Lookup.html")|n%>">
<input type="hidden" name="incidentid" value="<% $TicketObj->id %>" />
@@ -58,8 +63,10 @@
% }
<%PERL>
my $DoInvestigate = 0;
+my $SavedContent = '';
if ($WhoisIterator) {
while (my $obj = $WhoisIterator->next) {
+ $SavedContent = $SavedContent . $obj->content . "\n";
my @lines_starting_with_space = grep /^(\s+)(\w+)/, $obj->content;
if ($handparse || $#lines_starting_with_space >= 4) { #we couldn't parse that. suck
my $content = join "", $obj->content;
@@ -72,7 +79,7 @@ if ($WhoisIterator) {
<pre><% $content |n %></pre><br />
% } else {
Structured RIPE whois data returned.
-lick <a href="Lookup.html?q=<% $q |u %>&server=<% $WhoisServer |u %>&handparse=1">here</a> to manually parse this data.
+Click <a href="Lookup.html?q=<% $q |u %>&server=<% $WhoisServer |u %>&handparse=1">here</a> to manually parse this data.
<br />Warnings <% $obj->warnings %>
<br />errors <% $obj->errors %>
<hr />
@@ -108,13 +115,24 @@ foreach my $attribute ( $obj->attributes ) {
&>
% }
</form>
+
+% if ($TicketObj and $WhoisIterator and $SavedContent) {
+ <form method="post" action="">
+ <input type="hidden" name="LookupResults" value="<% $SavedContent | h %>" />
+ <input type="submit" value="<% loc('Save these results to the ticket') %>" id="save-results-to-ticket" />
+ </form>
+% }
+
<%args>
$q => undef
$handparse => 1
$TicketObj => undef
$WhoisServer => undef
+$WhoisResults => undef
+$results => undef
$server => undef
</%args>
+
<%init>
$WhoisServer = $server unless defined $WhoisServer;
diff --git a/html/RTIR/Tools/Lookup.html b/html/RTIR/Tools/Lookup.html
index c0899ef..809e014 100644
--- a/html/RTIR/Tools/Lookup.html
+++ b/html/RTIR/Tools/Lookup.html
@@ -47,6 +47,7 @@
%# END BPS TAGGED BLOCK }}}
<& /RTIR/Elements/Header, Title => $title &>
<& /Elements/Tabs &>
+<& /Elements/ListActions, actions => \@results &>
% $m->callback(CallbackName => 'BeforeCurrent', %ARGS, ARGSRef => \%ARGS, Ticket => $TicketObj, LookupType => $type, q => $q);
@@ -80,7 +81,7 @@
% $m->callback(CallbackName => 'AfterTools', %ARGS, ARGSRef => \%ARGS, Ticket => $TicketObj, LookupType => $type, q => $q);
<%INIT>
-
+my @results;
# Redirect when necessary
if ( $ARGS{'InvestigateTo'} ) {
my $requestors = join ', ', map /^Requestorbox-(.*)/, keys %ARGS;
@@ -99,8 +100,6 @@ if ( $ARGS{'InvestigateTo'} ) {
));
}
-my $title = $q ? loc("Lookup '[_1]'", $q) : loc("Lookup");
-
my ($TicketObj, $TicketType);
if ( $ticket ) {
$TicketObj = LoadTicket( $ticket );
@@ -108,10 +107,20 @@ if ( $ticket ) {
$TicketType = RT::IR::TicketType( Ticket => $TicketObj );
}
+if ($TicketObj and $LookupResults) {
+ my ($val, $msg) = $TicketObj->Comment(
+ Content => $LookupResults,
+ );
+ push @results, loc("Lookup results for Ticket [_1]: [_2]", $TicketObj->id, $msg);
+}
+
+my $title = $q ? loc("Lookup '[_1]'", $q) : loc("Lookup");
+
</%INIT>
<%ARGS>
$q => ''
$type => undef
$ticket => undef
+$LookupResults => undef
$HideResults => 0
</%ARGS>
-----------------------------------------------------------------------
More information about the rt-commit
mailing list