Project

General

Profile

Actions

Bug #3301

closed

"Reverse Resolve with DNS" popup poorly formatted

Added by Robert Nelson over 10 years ago. Updated over 10 years ago.

Status:
Closed
Priority:
Normal
Assignee:
-
Category:
-
Target version:
-
Start date:
11/03/2013
Due date:
% Done:

100%

Estimated time:
Plus Target Version:
Release Notes:
Affected Version:
2.1
Affected Architecture:

Description

The dialog that is displayed from the firewall log with the results of the reverse DNS lookup is poorly formatted.

It is displayed using the javascript alert function and formatted using tabs and newlines.

Unfortunately the Chrome browser doesn't support tabs so there is no separation between the columns, the fields in each row are joined together. Even on browsers which support tabs there can be a very small separation between fields.

I've rewritten the display_host_results() function in display_dns.php to use spaces instead of tabs. It does a much better job of aligning the fields in each column and works in all the browsers.

It still isn't perfect due to the use of a proportional font.

Here is the new version of the function:

function display_host_results ($address,$hostname,$dns_speeds) {
        $map_lengths = function($element) { return array(strlen($element[0]), strlen($element[1])); };
        $map_column0 = function($element) { return $element[0]; };

        echo gettext("IP Address") . ": {$address} \n";
        echo gettext("Host Name") . ": {$hostname} \n";
        echo "\n";
        $text_table = array();
        $text_table[] = array(gettext("Server"), gettext("Query Time"));
        if(is_array($dns_speeds))
                foreach($dns_speeds as $qt){
                        $text_table[] = array(trim($qt['dns_server']), trim($qt['query_time']));
                }
        $length_table = array_map($map_lengths, $text_table);
        $col0_padlength = max(array_map($map_column0, $length_table));
        foreach ($text_table as $text_row) {
                echo str_pad($text_row[0], $col0_padlength + 4) . $text_row[1] . "\n";
        }
}
Actions

Also available in: Atom PDF