removing JS-only links (closes #21)

This commit is contained in:
Oliver Gorwits
2012-04-09 22:55:10 +01:00
parent bec395c2d0
commit 5192b52d55
14 changed files with 132 additions and 75 deletions

View File

@@ -14,10 +14,10 @@
<td>[% row.alias %]</a>
<td>[% row.dns.remove(settings.domain_suffix) %]</a>
<td class="center_cell"><a class="nd_linkcell"
href="[% uri_for('/device') %]?tab=ports&q=[% row.ip %]&f=[% row.port %]">[% row.port %]</a></td>
href="[% vars.device_ports %]&q=[% row.ip %]&f=[% row.port %]">[% row.port %]</a></td>
<td>[% row.device_port.name %]</td>
<td><a class="nd_linkcell"
href="[% uri_for('/search') %]?tab=device&ip=[% row.subnet %]">[% row.subnet %]</a></td>
href="[% vars.search_device %]&ip=[% row.subnet %]">[% row.subnet %]</a></td>
</tr>
[% END %]
</tbody>

View File

@@ -8,7 +8,7 @@
<td>Location</td>
<td>
<a rel="tooltip" data-placement="top" data-offset="5" title="Find Similar Devices"
href="[% uri_for('/search') %]?[% vars.query_defaults.device %]&q=[% d.dns | uri %]&location=[% d.location | uri %]">[% d.location %]</a>
href="[% vars.search_device %]&location=[% d.location | uri %]">[% d.location %]</a>
</td>
</tr>
<tr>
@@ -19,10 +19,10 @@
<td>Vendor / Model</td>
<td>
<a rel="tooltip" data-placement="top" data-offset="5" title="Find Similar Devices"
href="[% uri_for('/search') %]?[% vars.query_defaults.device %]&q=[% d.dns | uri %]&vendor=[% d.vendor | uri %]">[% d.vendor %]</a>
href="[% vars.search_device %]&vendor=[% d.vendor | uri %]">[% d.vendor %]</a>
/
<a rel="tooltip" data-placement="top" data-offset="5" title="Find Similar Devices"
href="[% uri_for('/search') %]?[% vars.query_defaults.device %]&q=[% d.dns | uri %]&model=[% d.model | uri %]">[% d.model %]</a>
href="[% vars.search_device %]&model=[% d.model | uri %]">[% d.model %]</a>
</td>
</tr>
<tr>
@@ -30,7 +30,7 @@
<td>[% d.os %] /
<a rel="tooltip" data-placement="top" data-offset="5"
title="Find Similar Devices"
href="[% uri_for('/search') %]?[% vars.query_defaults.device %]&q=[% d.dns | uri %]&os_ver=[% d.os_ver | uri %]">[% d.os_ver %]</a>
href="[% vars.search_device %]&os_ver=[% d.os_ver | uri %]">[% d.os_ver %]</a>
</td>
</tr>
<tr>

View File

@@ -23,7 +23,10 @@
[% END %]
</td>
[% IF params.c_port %]
<td><a class="nd_linkcell this_port_only">[% row.port | html_entity %]</a></td>
<td><a class="nd_linkcell" href="[% uri_for('/device',
vars.self_options) %]&q=[% params.q | uri %]&f=[% row.port | uri %]">
[% row.port | html_entity %]
</a></td>
[% END %]
[% IF params.c_descr %]
<td class="center_cell">[% row.descr | html_entity %]</td>
@@ -82,12 +85,13 @@
<td>
[% IF row.remote_ip %]
[% IF row.neighbor %]
<a href="[% uri_for('/device') %]?tab=ports&q=[% row.neighbor.ip | uri %]&f=[% row.remote_port | uri %]">
<a href="[% uri_for('/device',
vars.self_options) %]&q=[% row.neighbor.ip | uri %]&f=[% row.remote_port | uri %]">
[% row.neighbor.dns.remove(settings.domain_suffix) || row.neighbor.ip %]
([% row.remote_port | html_entity %])</a>
[% ELSE %]
<span class="label label-important">N</span>
<a href="[% uri_for('/search') %]?tab=node&q=[% row.remote_ip | uri %]">
<a href="[% vars.search_node %]&q=[% row.remote_ip | uri %]">
[% row.remote_ip %] (port: [% row.remote_port %]
id: [% (row.remote_type _ ' / ') IF row.remote_type %][% row.remote_id %])</a>
[% END %]
@@ -95,16 +99,16 @@
[% FOREACH node IN row.$nodes %]
[% '<br/>' IF row.remote_ip OR NOT loop.first %]
[% '<span class="label label-warning">A</span> &nbsp;' IF NOT node.active %]
<a href="[% uri_for('/search') %]?tab=node&q=[% node.mac | uri %]">[% node.mac %]</a>
<a href="[% vars.search_node %]&q=[% node.mac | uri %]">[% node.mac %]</a>
[% ' (' _ node.time_last_age _ ')' IF params.n_age %]
[% IF params.n_ip %]
[% FOREACH ip IN node.ips %]
<br/>&nbsp; [% '<span class="label label-warning">A</span> &nbsp;' IF NOT ip.active %]
[% SET dns = ip.dns %]
[% IF dns %]
<a href="[% uri_for('/search') %]?tab=node&q=[% ip.ip | uri %]">[% dns %] ([% ip.ip %])</a>
<a href="[% vars.search_node %]&q=[% ip.ip | uri %]">[% dns %] ([% ip.ip %])</a>
[% ELSE %]
<a href="[% uri_for('/search') %]?tab=node&q=[% ip.ip | uri %]">[% ip.ip %]</a>
<a href="[% vars.search_node %]&q=[% ip.ip | uri %]">[% ip.ip %]</a>
[% END %]
[% END %]
[% END %]

View File

@@ -17,12 +17,12 @@
[% WHILE (row = macs.next) %]
<tr>
<td><a class="nd_linkcell"
href="[% uri_for('/search') %]?[% vars.query_defaults.node %]&q=[% row.mac | uri %]">[% row.mac %]</a></td>
href="[% vars.search_node %]&q=[% row.mac | uri %]">[% row.mac %]</a></td>
[% IF params.vendor %]
<td>[% row.oui.company %]</td>
[% END %]
<td>IP &rarr; MAC</td>
<td><a href="[% uri_for('/search') %]?[% vars.query_defaults.node %]&q=[% row.ip | uri %]">[% row.ip %]</a>
<td><a href="[% vars.search_node %]&q=[% row.ip | uri %]">[% row.ip %]</a>
[% ' (' _ row.dns.remove(settings.domain_suffix) _ ')' IF row.dns %]
[% ' <span class="label label-warning">A</span>' IF NOT row.active %]
</td>
@@ -38,7 +38,7 @@
<td>&nbsp;</td>
[% END %]
<td>Switch Port</td>
<td><a href="[% uri_for('/device') %]?tab=ports&q=[% node.switch | url %]&f=[% node.port | url %]">[% node.switch %] [ [% node.port %] ]</a>
<td><a href="[% vars.device_ports %]&q=[% node.switch | url %]&f=[% node.port | url %]">[% node.switch %] [ [% node.port %] ]</a>
[% ' (' _ node.device.dns.remove(settings.domain_suffix) _ ')' IF node.device.dns %]
[% ' <span class="label label-warning">A</span>' IF NOT node.active %]
</td>
@@ -55,7 +55,7 @@
<td>&nbsp;</td>
[% END %]
<td>MAC &rarr; IP</td>
<td><a href="[% uri_for('/search') %]?[% vars.query_defaults.node %]&q=[% nodeip.ip | uri %]">[% nodeip.ip %]</a>
<td><a href="[% vars.search_node %]&q=[% nodeip.ip | uri %]">[% nodeip.ip %]</a>
[% ' (' _ nodeip.dns.remove(settings.domain_suffix) _ ')' IF nodeip.dns %]
[% ' <span class="label label-warning">A</span>' IF NOT nodeip.active %]
</td>

View File

@@ -20,7 +20,7 @@
<td>
[% IF first_row %]
<a class="nd_linkcell"
href="[% uri_for('/search') %]?[% vars.query_defaults.node %]&q=[% row.mac | uri %]">[% row.mac %]</a>
href="[% vars.search_node %]&q=[% row.mac | uri %]">[% row.mac %]</a>
[% ELSE %]
&nbsp;
[% END %]
@@ -35,7 +35,7 @@
</td>
[% END %]
<td>MAC &rarr; IP</td>
<td><a href="[% uri_for('/search') %]?[% vars.query_defaults.node %]&q=[% row.ip | uri %]">[% row.ip %]</a>
<td><a href="[% vars.search_node %]&q=[% row.ip | uri %]">[% row.ip %]</a>
[% ' (' _ row.dns.remove(settings.domain_suffix) _ ')' IF row.dns %]
[% ' <span class="label label-warning">A</span>' IF NOT row.active %]
</td>
@@ -51,7 +51,7 @@
<td>
[% IF first_row %]
<a class="nd_linkcell"
href="[% uri_for('/search') %]?[% vars.query_defaults.node %]&q=[% node.mac | uri %]">[% node.mac %]</a>
href="[% vars.search_node %]&q=[% node.mac | uri %]">[% node.mac %]</a>
[% ELSE %]
&nbsp;
[% END %]
@@ -66,7 +66,7 @@
</td>
[% END %]
<td>Switch Port</td>
<td><a href="[% uri_for('/device') %]?tab=ports&q=[% node.switch | url %]&f=[% node.port | url %]">[% node.switch %] [ [% node.port %] ]</a>
<td><a href="[% vars.device_ports %]&q=[% node.switch | url %]&f=[% node.port | url %]">[% node.switch %] [ [% node.port %] ]</a>
[% ' (' _ node.device.dns.remove(settings.domain_suffix) _ ')' IF node.device.dns %]
[% ' <span class="label label-warning">A</span>' IF NOT node.active %]
</td>
@@ -82,7 +82,7 @@
<td>
[% IF first_row %]
<a class="nd_linkcell"
href="[% uri_for('/search') %]?[% vars.query_defaults.node %]&q=[% port.mac | uri %]">[% port.mac %]</a>
href="[% vars.search_node %]&q=[% port.mac | uri %]">[% port.mac %]</a>
[% ELSE %]
&nbsp;
[% END %]
@@ -97,7 +97,7 @@
</td>
[% END %]
<td>Switch Port</td>
<td><a href="[% uri_for('/device') %]?tab=ports&q=[% port.ip | url %]&f=[% port.port | url %]">[% port.ip %] [ [% port.port %] ]</a>
<td><a href="[% vars.device_ports %]&q=[% port.ip | url %]&f=[% port.port | url %]">[% port.ip %] [ [% port.port %] ]</a>
[% ' (' _ port.device.dns.remove(settings.domain_suffix) _ ')' IF port.device.dns %]
</td>
[% IF params.stamps %]

View File

@@ -11,7 +11,7 @@
[% WHILE (row = results.next) %]
<tr>
<td>[% row.name %]</td>
<td><a href="[% uri_for('/device') %]?tab=ports&q=[% row.ip %]&f=[% row.port %]">[% row.ip %] [ [% row.port %] ]</a>
<td><a href="[% vars.device_ports %]&q=[% row.ip %]&f=[% row.port %]">[% row.ip %] [ [% row.port %] ]</a>
[% ' (' _ row.device.dns.remove(settings.domain_suffix) _ ')' IF row.device.dns %]
</td>
<td>[% row.descr %]</td>

View File

@@ -13,17 +13,17 @@
[% WHILE (row = results.next) %]
<tr>
<td><a class="nd_linkcell nd_stealthlink"
href="[% uri_for('/device') %]?tab=ports&q=[% row.ip %]&f=[% row.vlan.vlan %]">[% row.vlan.vlan %]</a></td>
href="[% vars.device_ports %]&q=[% row.ip %]&f=[% row.vlan.vlan %]">[% row.vlan.vlan %]</a></td>
<td><a class="nd_linkcell"
href="[% uri_for('/device') %]?tab=ports&q=[% row.ip %]&f=[% row.vlan.vlan %]">[% row.dns %]</a></td>
href="[% vars.device_ports %]&q=[% row.ip %]&f=[% row.vlan.vlan %]">[% row.dns %]</a></td>
<td><a class="nd_linkcell nd_stealthlink"
href="[% uri_for('/device') %]?tab=ports&q=[% row.ip %]&f=[% row.vlan.vlan %]">[% row.vlan.description %]</a></td>
href="[% vars.device_ports %]&q=[% row.ip %]&f=[% row.vlan.vlan %]">[% row.vlan.description %]</a></td>
<td><a class="nd_linkcell nd_stealthlink"
href="[% uri_for('/device') %]?tab=ports&q=[% row.ip %]&f=[% row.vlan.vlan %]">[% row.model %]</a></td>
href="[% vars.device_ports %]&q=[% row.ip %]&f=[% row.vlan.vlan %]">[% row.model %]</a></td>
<td><a class="nd_linkcell nd_stealthlink"
href="[% uri_for('/device') %]?tab=ports&q=[% row.ip %]&f=[% row.vlan.vlan %]">[% row.os %]</a></td>
href="[% vars.device_ports %]&q=[% row.ip %]&f=[% row.vlan.vlan %]">[% row.os %]</a></td>
<td><a class="nd_linkcell nd_stealthlink"
href="[% uri_for('/device') %]?tab=ports&q=[% row.ip %]&f=[% row.vlan.vlan %]">[% row.vendor %]</a></td>
href="[% vars.device_ports %]&q=[% row.ip %]&f=[% row.vlan.vlan %]">[% row.vendor %]</a></td>
</tr>
[% END %]
</tbody>

View File

@@ -16,12 +16,12 @@
<tr>
<th>
<a class="nd_stealthlink"
href="[% uri_for('/search') %]?tab=device&matchall=on&vendor=[% platform.vendor %]">
href="[% vars.search_device %]&vendor=[% platform.vendor %]">
[% platform.vendor %]</a>
</th>
<th>
<a class="nd_linkcell"
href="[% uri_for('/search') %]?tab=device&matchall=on&model=[% platform.model %]">
href="[% vars.search_device %]&model=[% platform.model %]">
[% platform.model %]</a>
</th>
<th>[% platform.get_column('count') %]</th>
@@ -46,7 +46,7 @@
<th>[% release.os %]</th>
<th>
<a class="nd_linkcell"
href="[% uri_for('/search') %]?tab=device&matchall=on&os_ver=[% release.os_ver %]">
href="[% vars.search_device %]&os_ver=[% release.os_ver %]">
[% release.os_ver %]</a>
</th>
<th>[% release.get_column('count') %]</th>

View File

@@ -70,10 +70,14 @@
$('#ports_form').trigger('submit');
});
// make all port names clickable to restrict results to that port only
// clickable device port names can simply resubmit AJAX rather than
// fetch the whole page again.
$('body').delegate('.this_port_only', 'click', function() {
event.preventDefault(); // link is real so prevent page submit
var port = $(this).text();
sweep.val(port);
$('.field_clear_icon').show();
$('#ports_form').trigger('submit');
});