[Rt-commit] [svn] r1590 - in rtir/branches/1.1-TESTING: etc html/RTIR/Tools

leira at pallas.eruditorum.org leira at pallas.eruditorum.org
Wed Sep 29 21:42:07 EDT 2004


Author: leira
Date: Wed Sep 29 21:42:07 2004
New Revision: 1590

Modified:
   rtir/branches/1.1-TESTING/etc/RTIR_Config.pm
   rtir/branches/1.1-TESTING/html/RTIR/Tools/Lookup.html
Log:
RT-Ticket: 6117
RT-Status: resolved
RT-Action: correspond
Added new features based on a patch by ruediger.riediger at Sun.COM.


Modified: rtir/branches/1.1-TESTING/etc/RTIR_Config.pm
==============================================================================
--- rtir/branches/1.1-TESTING/etc/RTIR_Config.pm	(original)
+++ rtir/branches/1.1-TESTING/etc/RTIR_Config.pm	Wed Sep 29 21:42:07 2004
@@ -10,7 +10,17 @@
 
 
 # Set the hash of whois servers
-Set($whois, {1 => "localhost", 2 => "whois-demo.bestpractical.com"});
+# Host is of the form "hostname:port"
+Set($whois, { 1 => { Host => "localhost", },
+	      2 => { Host => "whois-demo.bestpractical.com",
+		     FriendlyName => "BPS Demo Server", },
+	  },
+    );
+
+# Beautified hostnames
+Set($WhoisNames, {1 => "Internal Lookup",
+		  2 => "BPS Whois",
+	      } );
 
 # Set the name of the Business::SLA class
 # Use this if you have a custom SLA module

Modified: rtir/branches/1.1-TESTING/html/RTIR/Tools/Lookup.html
==============================================================================
--- rtir/branches/1.1-TESTING/html/RTIR/Tools/Lookup.html	(original)
+++ rtir/branches/1.1-TESTING/html/RTIR/Tools/Lookup.html	Wed Sep 29 21:42:07 2004
@@ -107,12 +107,21 @@
       <input size=30 name="q" value="<%$q%>"> at 
       <select name="server">
 % foreach my $s (sort keys %{$servers}) {
-% next unless $servers->{$s};
+% my ($host, $name);
+% my $srv = $servers->{$s};
+% next unless $srv;
+% if (ref($srv) eq 'HASH') {
+% $host = $srv->{'Host'};
+% $name = $srv->{'FriendlyName'};
+% } else {
+% $host = $srv;
+% }
+% next unless $srv;
 % my $selected = "";
 % if ($servers->{$s} eq $server) {
 %   $selected = " SELECTED";
 % }
-        <option value="<%$servers->{$s}%>"<%$selected%>><%$servers->{$s}%></option>
+        <option value="<%$host%>"<%$selected%>><%$name || $host%></option>
 % }
       </select>
     </td>
@@ -164,9 +173,6 @@
 % }
 
 <%init>
-
-my $title = loc("Lookup '[_1]' using server [_2]", $q, $server);
-
 my $current_subtab;
 my $TicketType;
 my $TicketObj;
@@ -177,8 +183,16 @@
   last;
 }
 
+$beauty = ( exists($beauties->{ ({ reverse %$servers }->{$server}) })
+      ? $beauties->{ ({ reverse %$servers }->{$server}) } ." (". $server .")"
+      : $server );
+
+my $title = loc("Lookup '[_1]' using server [_2]", $q, $server);
+
 use Net::Whois::RIPE;
-my $query = Net::Whois::RIPE->new($server);
+my ($whois, $port) = split(/\s*:\s*/, $server, 2);
+$port = 43 unless($port =~ /^\d+$/);
+my $query = Net::Whois::RIPE->new($whois, Port => $port);
 my ($iterator, $error);
 if ($query) {
     $iterator = $query->query_iterator($q);
@@ -227,6 +241,8 @@
 <%args>
 $servers => $RT::whois
 $server => undef
+$beauties => $RT::WhoisNames
+$beauty => undef
 $handparse => 1
 $q => undef
 $type => undef


More information about the Rt-commit mailing list