[Rt-commit] rtir branch 5.0/open-research-tool-in-new-tab created. 5.0.4-2-g9683c105

BPS Git Server git at git.bestpractical.com
Thu May 4 20:05:22 UTC 2023


This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "rtir".

The branch, 5.0/open-research-tool-in-new-tab has been created
        at  9683c105fb601c4922603f8f16742953c8c6060b (commit)

- Log -----------------------------------------------------------------
commit 9683c105fb601c4922603f8f16742953c8c6060b
Author: Ronaldo Richieri <ronaldo at bestpractical.com>
Date:   Thu May 4 16:59:22 2023 -0300

    Replace ToolFormIframe by ToolFormExternal
    
    ToolFormIframe was created with the concept of opening useful tools such
    as Siteadvisor and CVE in an iframe, helping to debug and search ticket
    informations. Since the adoption of X-Frame-Options by most websites,
    this feature is no longer useful. This commit keeps the same behavior
    but opens the tools in a new tab of the browser.

diff --git a/etc/RTIR_Config.pm b/etc/RTIR_Config.pm
index be018fe0..39dd5ac1 100644
--- a/etc/RTIR_Config.pm
+++ b/etc/RTIR_Config.pm
@@ -795,13 +795,13 @@ using the following mason components:
 
 =cut
 
-Set( @RTIRResearchTools, (qw(Traceroute Whois Iframe)));
+Set( @RTIRResearchTools, (qw(Traceroute Whois External)));
 
-=item C<$RTIRIframeResearchToolConfig>
+=item C<$RTIRExternalResearchToolConfig>
 
 One of the research tools available in RTIR allows you to
 configure a set of search URLs that incident handlers
-can use to open searches in IFRAMES.
+can use to open searches in new tab.
 
 Entries are keyed by integer in the order you'd like to see
 them in the dropdown on the research page. Each entry consists
@@ -811,7 +811,7 @@ search term.
 
 =cut
 
-Set($RTIRIframeResearchToolConfig, {
+Set($RTIRExternalResearchToolConfig, {
     1 => { FriendlyName => 'Google', URL => 'https://encrypted.google.com/search?q=__SearchTerm__' },
     2 => { FriendlyName => 'CVE', URL => 'http://cve.mitre.org/cgi-bin/cvekey.cgi?keyword=__SearchTerm__'},
     3 => { FriendlyName => 'McAfee SiteAdvisor', URL => 'http://www.siteadvisor.com/sites/__SearchTerm__'}
diff --git a/html/RTIR/Tools/Elements/ToolFormIframe b/html/RTIR/Tools/Elements/ToolFormExternal
similarity index 82%
rename from html/RTIR/Tools/Elements/ToolFormIframe
rename to html/RTIR/Tools/Elements/ToolFormExternal
index 6b5326cb..68fa247c 100644
--- a/html/RTIR/Tools/Elements/ToolFormIframe
+++ b/html/RTIR/Tools/Elements/ToolFormExternal
@@ -45,7 +45,7 @@
 %# those contributions and any derivatives thereof.
 %#
 %# END BPS TAGGED BLOCK }}}
-<form action="Lookup.html" method="get">
+<form>
   <div class="form-row">
     <div class="col-2">
       <span class="current-value form-control"><%loc('Research Tool')%>:</span>
@@ -54,20 +54,21 @@
     <input type="hidden" name="<% $arg %>" value="<% $ARGS{ $arg } %>" />
 % }
     <div class="col-4">
-      <input class="form-control" type="text" name="q" value="<% $q %>" />
+      <input class="form-control" type="text" id="q" name="q" value="<% $q %>" />
     </div>
     <div class="col-auto">
       <span class="current-value form-control">at</span>
     </div>
     <div class="col-3">
-      <select class="form-control selectpicker" name="ResearchTool">
+      <select class="form-control selectpicker" id="ResearchTool" name="ResearchTool">
 % for my $tool (grep {defined } keys %$research_tools) {
-        <option value="<%$tool%>" <%$tool eq $ResearchTool ? 'SELECTED' : ''%>><% $research_tools->{$tool}->{FriendlyName} %></option>
+        <option value="<%$research_tools->{$tool}->{URL}%>" <%$tool eq $ResearchTool ? 'SELECTED' : ''%>><% $research_tools->{$tool}->{FriendlyName} %></option>
 %}
       </select>
     </div>
     <div class="col-auto">
-      <input class="form-control btn btn-primary button" type="submit" value="<%loc('Go')%>" />
+      <input class="form-control btn btn-primary button" type="submit" value="<%loc('Go')%>"
+      onclick="window.open(jQuery('#ResearchTool').val().replace('__SearchTerm__',jQuery('#q').val()), '_blank');return false;"/>
     </div>
   </div>
 </form>
@@ -77,7 +78,5 @@ $ResearchTool => ''
 @PassArguments => ()
 </%args>
 <%INIT>
-my $unique_id = time().rand();
-$m->notes(rtir_research_iframe_id => $unique_id);
-my $research_tools = RT->Config->Get('RTIRIframeResearchToolConfig');
+my $research_tools = RT->Config->Get('RTIRExternalResearchToolConfig');
 </%INIT>
diff --git a/html/RTIR/Tools/Elements/ToolResultsIframe b/html/RTIR/Tools/Elements/ToolResultsIframe
deleted file mode 100644
index 323f11c0..00000000
--- a/html/RTIR/Tools/Elements/ToolResultsIframe
+++ /dev/null
@@ -1,69 +0,0 @@
-%# BEGIN BPS TAGGED BLOCK {{{
-%#
-%# COPYRIGHT:
-%#
-%# This software is Copyright (c) 1996-2023 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 }}}
-<h2><%loc($research_tools->{$ResearchTool}->{FriendlyName})%></h2>
-<iframe 
-    src="<%$url%>" 
-    name="rtir_research_<%$m->notes('rtir_research_iframe_id')%>" 
-    style="width: 100%; height: 70%;"></iframe>
-<%args>
-$q =>  undef
-$TicketType => undef
-$TicketObj => undef
-$ResearchTool => undef
-</%args>
-<%init>
-return unless ($ResearchTool);
-my $research_tools = RT->Config->Get('RTIRIframeResearchToolConfig');
-if (!$research_tools->{$ResearchTool}->{URL}) {
-    $RT::Logger->error(
-        "Couldn't find a URL for RTIR research tool $ResearchTool. You should check your RTIRIframeResearchToolConfig");
-    return;
-}
-my $url = $research_tools->{$ResearchTool}->{URL};
-$url =~ s/__SearchTerm__/$q/g;
-</%init>

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


hooks/post-receive
-- 
rtir


More information about the rt-commit mailing list