URI and HTML escape template variables

This commit is contained in:
Oliver Gorwits
2013-03-02 18:18:46 +00:00
parent 043eef9d4d
commit 8e9466b64f
19 changed files with 135 additions and 133 deletions

View File

@@ -12,9 +12,10 @@
* Use Path::Class for path and file name construction consistently * Use Path::Class for path and file name construction consistently
* Avoid use of DNS when looking up devices in DB by IP * Avoid use of DNS when looking up devices in DB by IP
[BIG FIXES] [BUG FIXES]
* Search by device port MAC no longer fatal * Search by device port MAC no longer fatal
* URI and HTML escape template variables
2.005000_002 - 2013-02-10 2.005000_002 - 2013-02-10

View File

@@ -11,13 +11,13 @@
</tbody> </tbody>
[% WHILE (row = results.next) %] [% WHILE (row = results.next) %]
<tr> <tr>
<td>[% row.alias %]</a> <td>[% row.alias | html_entity %]</a>
<td>[% row.dns %]</a> <td>[% row.dns | html_entity %]</a>
<td class="center_cell"><a class="nd_linkcell" <td class="center_cell"><a class="nd_linkcell"
href="[% device_ports %]&q=[% params.q | uri %]&f=[% row.port | uri %]">[% row.port %]</a></td> href="[% device_ports %]&q=[% params.q | uri %]&f=[% row.port | uri %]">[% row.port | html_entity %]</a></td>
<td>[% row.device_port.name %]</td> <td>[% row.device_port.name | html_entity %]</td>
<td><a class="nd_linkcell" <td><a class="nd_linkcell"
href="[% search_device %]&ip=[% row.subnet | uri %]">[% row.subnet %]</a></td> href="[% search_device %]&ip=[% row.subnet | uri %]">[% row.subnet | html_entity %]</a></td>
</tr> </tr>
[% END %] [% END %]
</tbody> </tbody>

View File

@@ -13,12 +13,12 @@
[% IF vars.user.port_control %] [% IF vars.user.port_control %]
<td class="nd_editable_cell" contenteditable="true" <td class="nd_editable_cell" contenteditable="true"
data-field="location" data-for-device="[% d.ip %]"> data-field="location" data-for-device="[% d.ip %]">
[% d.location %] [% d.location | html_entity %]
</td> </td>
[% ELSE %] [% ELSE %]
<td> <td>
<a rel="tooltip" data-placement="top" data-offset="5" data-title="Find Similar Devices" <a rel="tooltip" data-placement="top" data-offset="5" data-title="Find Similar Devices"
href="[% search_device %]&location=[% d.location | uri %]">[% d.location %]</a> href="[% search_device %]&location=[% d.location | uri %]">[% d.location | html_entity %]</a>
</td> </td>
[% END %] [% END %]
</tr> </tr>
@@ -30,68 +30,68 @@
</td> </td>
[% IF vars.user.port_control %] [% IF vars.user.port_control %]
<td class="nd_editable_cell" contenteditable="true" <td class="nd_editable_cell" contenteditable="true"
data-field="contact" data-for-device="[% d.ip %]"> data-field="contact" data-for-device="[% d.ip | html_entity %]">
[% d.contact %] [% d.contact | html_entity %]
</td> </td>
[% ELSE %] [% ELSE %]
<td>[% d.contact %]</td> <td>[% d.contact | html_entity %]</td>
[% END %] [% END %]
</tr> </tr>
<tr> <tr>
<td>Vendor / Model</td> <td>Vendor / Model</td>
<td> <td>
<a rel="tooltip" data-placement="top" data-offset="5" data-title="Find Similar Devices" <a rel="tooltip" data-placement="top" data-offset="5" data-title="Find Similar Devices"
href="[% search_device %]&vendor=[% d.vendor | uri %]">[% d.vendor %]</a> href="[% search_device %]&vendor=[% d.vendor | uri %]">[% d.vendor | html_entity %]</a>
/ /
<a rel="tooltip" data-placement="top" data-offset="5" data-title="Find Similar Devices" <a rel="tooltip" data-placement="top" data-offset="5" data-title="Find Similar Devices"
href="[% search_device %]&model=[% d.model | uri %]">[% d.model %]</a> href="[% search_device %]&model=[% d.model | uri %]">[% d.model | html_entity %]</a>
</td> </td>
</tr> </tr>
<tr> <tr>
<td>OS / Version</td> <td>OS / Version</td>
<td>[% d.os %] / <td>[% d.os | html_entity %] /
<a rel="tooltip" data-placement="top" data-offset="5" <a rel="tooltip" data-placement="top" data-offset="5"
data-title="Find Similar Devices" data-title="Find Similar Devices"
href="[% search_device %]&os_ver=[% d.os_ver | uri %]">[% d.os_ver %]</a> href="[% search_device %]&os_ver=[% d.os_ver | uri %]">[% d.os_ver | html_entity %]</a>
</td> </td>
</tr> </tr>
<tr> <tr>
<td>Serial Number</td> <td>Serial Number</td>
<td>[% d.serial %]</td> <td>[% d.serial | html_entity %]</td>
</tr> </tr>
<tr> <tr>
<td>Description</td> <td>Description</td>
<td>[% d.description.replace(', ',",<br/>") %]</td> <td>[% d.description | html_entity | html_line_break %]</td>
</tr> </tr>
<tr> <tr>
<td>Uptime</td> <td>Uptime</td>
<td>[% d.uptime_age %]</td> <td>[% d.uptime_age | html_entity %]</td>
</tr> </tr>
<tr> <tr>
<td>Last Discover</td> <td>Last Discover</td>
<td>[% d.last_discover_stamp %]</td> <td>[% d.last_discover_stamp | html_entity %]</td>
</tr> </tr>
<tr> <tr>
<td>Last Arpnip</td> <td>Last Arpnip</td>
<td>[% d.last_arpnip_stamp %]</td> <td>[% d.last_arpnip_stamp | html_entity %]</td>
</tr> </tr>
<tr> <tr>
<td>Last Macsuck</td> <td>Last Macsuck</td>
<td>[% d.last_macsuck_stamp %]</td> <td>[% d.last_macsuck_stamp | html_entity %]</td>
</tr> </tr>
<tr> <tr>
<td>Hardware Status</td> <td>Hardware Status</td>
<td>Fan: [% d.fan %] <td>Fan: [% d.fan | html_entity %]
<br/>PS1 [[% d.ps1_type %]]: [% d.ps1_status %] <br/>PS1 [[% d.ps1_type | html_entity %]]: [% d.ps1_status | html_entity %]
<br/>PS2 [[% d.ps2_type %]]: [% d.ps2_status %]</td> <br/>PS2 [[% d.ps2_type | html_entity %]]: [% d.ps2_status | html_entity %]</td>
</tr> </tr>
<tr> <tr>
<td>MAC Address</td> <td>MAC Address</td>
<td>[% d.mac %]</td> <td>[% d.mac | html_entity %]</td>
</tr> </tr>
<tr> <tr>
<td>VTP Domain</td> <td>VTP Domain</td>
<td>[% d.vtp_domain %]</td> <td>[% d.vtp_domain | html_entity %]</td>
</tr> </tr>
</tbody> </tbody>
</table> </table>

View File

@@ -6,7 +6,7 @@
[% NEXT IF item.name == 'c_admin' %] [% NEXT IF item.name == 'c_admin' %]
[% NEXT IF item.name == 'c_nodes' AND params.c_nodes AND params.c_neighbors %] [% NEXT IF item.name == 'c_nodes' AND params.c_nodes AND params.c_neighbors %]
[% NEXT UNLESS params.${item.name} %] [% NEXT UNLESS params.${item.name} %]
<th[% ' class="center_cell"' IF NOT loop.first %]>[% item.label %]</th> <th[% ' class="center_cell"' IF NOT loop.first %]>[% item.label | html_entity %]</th>
[% END %] [% END %]
</tr> </tr>
</thead> </thead>
@@ -29,13 +29,13 @@
[% IF vars.user.port_control AND params.c_admin %] [% IF vars.user.port_control AND params.c_admin %]
[% IF row.up_admin == 'up' %] [% IF row.up_admin == 'up' %]
<td nowrap class="nd_editable_cell" data-action="down" <td nowrap class="nd_editable_cell" data-action="down"
data-field="c_port" data-for-device="[% device %]" data-for-port="[% row.port | html_entity %]"> data-field="c_port" data-for-device="[% device | html_entity %]" data-for-port="[% row.port | html_entity %]">
<i class="icon-hand-down nd_hand_icon" <i class="icon-hand-down nd_hand_icon"
rel="tooltip" data-placement="top" data-offset="3" rel="tooltip" data-placement="top" data-offset="3"
data-animation="" data-title="Click to Disable"></i> data-animation="" data-title="Click to Disable"></i>
[% ELSE %] [% ELSE %]
<td nowrap class="nd_editable_cell" data-action="up" <td nowrap class="nd_editable_cell" data-action="up"
data-field="c_port" data-for-device="[% device %]" data-for-port="[% row.port | html_entity %]"> data-field="c_port" data-for-device="[% device | html_entity %]" data-for-port="[% row.port | html_entity %]">
<i class="icon-hand-up nd_hand_icon" <i class="icon-hand-up nd_hand_icon"
rel="tooltip" data-placement="top" data-offset="3" rel="tooltip" data-placement="top" data-offset="3"
data-animation="" data-title="Click to Enable"></i> data-animation="" data-title="Click to Enable"></i>
@@ -72,7 +72,7 @@
[% IF params.c_name %] [% IF params.c_name %]
[% IF vars.user.port_control AND params.c_admin %] [% IF vars.user.port_control AND params.c_admin %]
<td nowrap class="center_cell nd_editable_cell" contenteditable="true" <td nowrap class="center_cell nd_editable_cell" contenteditable="true"
data-field="c_name" data-for-device="[% device %]" data-for-port="[% row.port | html_entity %]"> data-field="c_name" data-for-device="[% device | html_entity %]" data-for-port="[% row.port | html_entity %]">
<i class="icon-edit nd_edit_icon"></i> <i class="icon-edit nd_edit_icon"></i>
[% ELSE %] [% ELSE %]
<td nowrap class="center_cell"> <td nowrap class="center_cell">
@@ -98,7 +98,7 @@
[% IF params.c_vlan %] [% IF params.c_vlan %]
[% IF vars.user.port_control AND params.c_admin %] [% IF vars.user.port_control AND params.c_admin %]
<td class="center_cell nd_editable_cell" contenteditable="true" <td class="center_cell nd_editable_cell" contenteditable="true"
data-field="c_vlan" data-for-device="[% device %]" data-for-port="[% row.port | html_entity %]"> data-field="c_vlan" data-for-device="[% device | html_entity %]" data-for-port="[% row.port | html_entity %]">
<i class="icon-edit nd_edit_icon"></i> <i class="icon-edit nd_edit_icon"></i>
<div class="nd_editable_cell_content"> <div class="nd_editable_cell_content">
[% IF row.vlan %][% row.vlan | html_entity %][% END %] [% IF row.vlan %][% row.vlan | html_entity %][% END %]
@@ -140,7 +140,7 @@
[% IF row.power.admin == 'true' %] [% IF row.power.admin == 'true' %]
[% IF vars.user.port_control AND params.c_admin %] [% IF vars.user.port_control AND params.c_admin %]
<td nowrap data-action="false" <td nowrap data-action="false"
data-field="c_power" data-for-device="[% device %]" data-field="c_power" data-for-device="[% device | html_entity %]"
data-for-port="[% row.port | html_entity %]"> data-for-port="[% row.port | html_entity %]">
<i class="icon-off nd_power_icon nd_power_on" <i class="icon-off nd_power_icon nd_power_on"
@@ -152,15 +152,15 @@
[% END %] [% END %]
<span> <span>
[% IF row.power.power > 0 %] [% IF row.power.power > 0 %]
[% row.power.power %]&nbsp;mW [% row.power.power | html_entity %]&nbsp;mW
[% ELSE %] [% ELSE %]
([% row.power.status %]) ([% row.power.status | html_entity %])
[% END %] [% END %]
</span> </span>
[% ELSE %] [% ELSE %]
[% IF vars.user.port_control AND params.c_admin %] [% IF vars.user.port_control AND params.c_admin %]
<td nowrap data-action="true" <td nowrap data-action="true"
data-field="c_power" data-for-device="[% device %]" data-field="c_power" data-for-device="[% device | html_entity %]"
data-for-port="[% row.port | html_entity %]"> data-for-port="[% row.port | html_entity %]">
<i class="icon-off nd_power_icon" <i class="icon-off nd_power_icon"
@@ -183,29 +183,29 @@
[% IF row.neighbor %] [% IF row.neighbor %]
<a href="[% uri_for('/device', <a href="[% uri_for('/device',
self_options) %]&q=[% row.neighbor.dns || row.neighbor.ip | uri %]&f=[% row.remote_port | uri %]"> self_options) %]&q=[% row.neighbor.dns || row.neighbor.ip | uri %]&f=[% row.remote_port | uri %]">
[% row.neighbor.dns.remove(settings.domain_suffix) || row.neighbor.ip %] [% row.neighbor.dns.remove(settings.domain_suffix) || row.neighbor.ip | html_entity %]
([% row.remote_port | html_entity %])</a> ([% row.remote_port | html_entity %])</a>
[% ELSE %] [% ELSE %]
<span class="label label-important">N</span> <span class="label label-important">N</span>
<a href="[% search_node %]&q=[% row.remote_ip | uri %]"> <a href="[% search_node %]&q=[% row.remote_ip | uri %]">
[% row.remote_ip %] (port: [% row.remote_port %] [% row.remote_ip | html_entity %] (port: [% row.remote_port | html_entity %]
id: [% (row.remote_type _ ' / ') IF row.remote_type %][% row.remote_id %])</a> id: [% (row.remote_type _ ' / ') IF row.remote_type %][% row.remote_id | html_entity %])</a>
[% END %] [% END %]
[% END %] [% END %]
[% IF params.c_nodes %] [% IF params.c_nodes %]
[% FOREACH node IN row.$nodes %] [% FOREACH node IN row.$nodes %]
[% '<br/>' IF row.remote_ip OR NOT loop.first %] [% '<br/>' IF row.remote_ip OR NOT loop.first %]
[% '<span class="label label-warning">A</span> &nbsp;' IF NOT node.active %] [% '<span class="label label-warning">A</span> &nbsp;' IF NOT node.active %]
<a href="[% search_node %]&q=[% node.mac | uri %]">[% node.mac %]</a> <a href="[% search_node %]&q=[% node.mac | uri %]">[% node.mac | html_entity %]</a>
[% ' (' _ node.time_last_age _ ')' IF params.n_age %] [% ' (' _ node.time_last_age _ ')' IF params.n_age %]
[% IF params.n_ip %] [% IF params.n_ip %]
[% FOREACH ip IN node.ips %] [% FOREACH ip IN node.ips %]
<br/>&nbsp; [% '<span class="label label-warning">A</span> &nbsp;' IF NOT ip.active %] <br/>&nbsp; [% '<span class="label label-warning">A</span> &nbsp;' IF NOT ip.active %]
[% SET dns = ip.dns %] [% SET dns = ip.dns %]
[% IF dns %] [% IF dns %]
<a href="[% search_node %]&q=[% ip.ip | uri %]">[% dns %] ([% ip.ip %])</a> <a href="[% search_node %]&q=[% ip.ip | uri %]">[% dns %] ([% ip.ip | html_entity %])</a>
[% ELSE %] [% ELSE %]
<a href="[% search_node %]&q=[% ip.ip | uri %]">[% ip.ip %]</a> <a href="[% search_node %]&q=[% ip.ip | uri %]">[% ip.ip | html_entity %]</a>
[% END %] [% END %]
[% END %] [% END %]
[% END %] [% END %]

View File

@@ -14,15 +14,14 @@
</tbody> </tbody>
[% WHILE (row = results.next) %] [% WHILE (row = results.next) %]
<tr> <tr>
<td><a href="[% uri_for('/device') %]?q=[% row.dns || row.ip %]">[% row.dns || row.ip %]</a></td> <td><a href="[% uri_for('/device') %]?q=[% row.dns || row.ip | uri %]">[% row.dns || row.ip | html_entity %]</a></td>
<td>[% row.contact %]</td> <td>[% row.contact | html_entity %]</td>
<td>[% row.location %]</td> <td>[% row.location | html_entity %]</td>
<td>[% row.name %]</td> <td>[% row.name | html_entity %]</td>
<!-- <td>[% row.description.substr(0, 100) %][% ' &hellip;' IF row.description.length > 100 %]</td> --> <td>[% row.model | html_entity %]</td>
<td>[% row.model %]</td> <td>[% row.os_ver | html_entity %]</td>
<td>[% row.os_ver %]</td> <td>[% row.ip | html_entity %]</td>
<td>[% row.ip %]</td> <td>[% row.serial | html_entity %]</td>
<td>[% row.serial %]</td>
</tr> </tr>
[% END %] [% END %]
</tbody> </tbody>

View File

@@ -17,18 +17,18 @@
[% WHILE (row = macs.next) %] [% WHILE (row = macs.next) %]
<tr> <tr>
<td><a class="nd_linkcell" <td><a class="nd_linkcell"
href="[% search_node %]&q=[% row.mac | uri %]">[% row.mac %]</a></td> href="[% search_node %]&q=[% row.mac | uri %]">[% row.mac | html_entity %]</a></td>
[% IF params.vendor %] [% IF params.vendor %]
<td>[% row.oui.company %]</td> <td>[% row.oui.company | html_entity %]</td>
[% END %] [% END %]
<td>IP &rarr; MAC</td> <td>IP &rarr; MAC</td>
<td><a href="[% search_node %]&q=[% row.ip | uri %]">[% row.ip %]</a> <td><a href="[% search_node %]&q=[% row.ip | uri %]">[% row.ip | html_entity %]</a>
[% ' <span class="label label-warning">A</span>' IF NOT row.active %] [% ' <span class="label label-warning">A</span>' IF NOT row.active %]
[% ' (' _ row.dns.remove(settings.domain_suffix) _ ')' IF row.dns %] [% ' (' _ row.dns.remove(settings.domain_suffix) _ ')' IF row.dns %]
</td> </td>
[% IF params.stamps %] [% IF params.stamps %]
<td>[% row.time_first_stamp %]</td> <td>[% row.time_first_stamp | html_entity %]</td>
<td>[% row.time_last_stamp %]</td> <td>[% row.time_last_stamp | html_entity %]</td>
[% END %] [% END %]
</tr> </tr>
[% FOREACH node IN row.node_sightings(archive_filter) %] [% FOREACH node IN row.node_sightings(archive_filter) %]
@@ -39,16 +39,16 @@
[% END %] [% END %]
<td>Switch Port</td> <td>Switch Port</td>
<td><a class="nd_linkcell" <td><a class="nd_linkcell"
href="[% device_ports %]&q=[% node.device.dns || node.switch %]&f=[% node.port | uri %]&c_nodes=on&c_neighbors=on"> href="[% device_ports %]&q=[% node.device.dns || node.switch | uri %]&f=[% node.port | uri %]&c_nodes=on&c_neighbors=on">
[% node.switch %] - [% node.port %]</a> [% node.switch | html_entity %] - [% node.port | html_entity %]</a>
[% ' <span class="label label-warning">A</span>' IF NOT node.active %] [% ' <span class="label label-warning">A</span>' IF NOT node.active %]
[% IF node.device.dns AND node.device_port AND node.device_port.name %] [% IF node.device.dns AND node.device_port AND node.device_port.name %]
([% node.device.dns %] - [% node.device_port.name %]) ([% node.device.dns | html_entity %] - [% node.device_port.name | html_entity %])
[% END %] [% END %]
</td> </td>
[% IF params.stamps %] [% IF params.stamps %]
<td>[% node.time_first_stamp %]</td> <td>[% node.time_first_stamp | html_entity %]</td>
<td>[% node.time_last_stamp %]</td> <td>[% node.time_last_stamp | html_entity %]</td>
[% END %] [% END %]
</tr> </tr>
[% END %] [% END %]
@@ -59,13 +59,13 @@
<td>&nbsp;</td> <td>&nbsp;</td>
[% END %] [% END %]
<td>MAC &rarr; IP</td> <td>MAC &rarr; IP</td>
<td><a href="[% search_node %]&q=[% nodeip.ip | uri %]">[% nodeip.ip %]</a> <td><a href="[% search_node %]&q=[% nodeip.ip | uri %]">[% nodeip.ip | html_entity %]</a>
[% ' <span class="label label-warning">A</span>' IF NOT nodeip.active %] [% ' <span class="label label-warning">A</span>' IF NOT nodeip.active %]
[% ' (' _ nodeip.dns.remove(settings.domain_suffix) _ ')' IF nodeip.dns %] [% ' (' _ nodeip.dns.remove(settings.domain_suffix) _ ')' IF nodeip.dns %]
</td> </td>
[% IF params.stamps %] [% IF params.stamps %]
<td>[% nodeip.time_first_stamp %]</td> <td>[% nodeip.time_first_stamp | html_entity %]</td>
<td>[% nodeip.time_last_stamp %]</td> <td>[% nodeip.time_last_stamp | html_entity %]</td>
[% END %] [% END %]
</tr> </tr>
[% END %] [% END %]

View File

@@ -20,7 +20,7 @@
<td> <td>
[% IF first_row %] [% IF first_row %]
<a class="nd_linkcell" <a class="nd_linkcell"
href="[% search_node %]&q=[% row.mac | uri %]">[% row.mac %]</a> href="[% search_node %]&q=[% row.mac | uri %]">[% row.mac | html_entity %]</a>
[% ELSE %] [% ELSE %]
&nbsp; &nbsp;
[% END %] [% END %]
@@ -28,20 +28,20 @@
[% IF params.vendor %] [% IF params.vendor %]
<td> <td>
[% IF first_row %] [% IF first_row %]
[% row.oui.company %] [% row.oui.company | html_entity %]
[% ELSE %] [% ELSE %]
&nbsp; &nbsp;
[% END %] [% END %]
</td> </td>
[% END %] [% END %]
<td>MAC &rarr; IP</td> <td>MAC &rarr; IP</td>
<td><a href="[% search_node %]&q=[% row.ip | uri %]">[% row.ip %]</a> <td><a href="[% search_node %]&q=[% row.ip | uri %]">[% row.ip | html_entity %]</a>
[% ' <span class="label label-warning">A</span>' IF NOT row.active %] [% ' <span class="label label-warning">A</span>' IF NOT row.active %]
[% ' (' _ row.dns.remove(settings.domain_suffix) _ ')' IF row.dns %] [% ' (' _ row.dns.remove(settings.domain_suffix) _ ')' IF row.dns %]
</td> </td>
[% IF params.stamps %] [% IF params.stamps %]
<td>[% row.time_first_stamp %]</td> <td>[% row.time_first_stamp | html_entity %]</td>
<td>[% row.time_last_stamp %]</td> <td>[% row.time_last_stamp | html_entity %]</td>
[% END %] [% END %]
</tr> </tr>
[% SET first_row = 0 %] [% SET first_row = 0 %]
@@ -51,7 +51,7 @@
<td> <td>
[% IF first_row %] [% IF first_row %]
<a class="nd_linkcell" <a class="nd_linkcell"
href="[% search_node %]&q=[% node.mac | uri %]">[% node.mac %]</a> href="[% search_node %]&q=[% node.mac | uri %]">[% node.mac | html_entity %]</a>
[% ELSE %] [% ELSE %]
&nbsp; &nbsp;
[% END %] [% END %]
@@ -59,7 +59,7 @@
[% IF params.vendor %] [% IF params.vendor %]
<td> <td>
[% IF first_row %] [% IF first_row %]
[% node.oui.company %] [% node.oui.company | html_entity %]
[% ELSE %] [% ELSE %]
&nbsp; &nbsp;
[% END %] [% END %]
@@ -67,16 +67,16 @@
[% END %] [% END %]
<td>Switch Port</td> <td>Switch Port</td>
<td><a class="nd_linkcell" <td><a class="nd_linkcell"
href="[% device_ports %]&q=[% node.device.dns || node.switch %]&f=[% node.port %]&c_nodes=on&c_neighbors=on"> href="[% device_ports %]&q=[% node.device.dns || node.switch | uri %]&f=[% node.port | uri %]&c_nodes=on&c_neighbors=on">
[% node.switch %] - [% node.port %]</a> [% node.switch | html_entity %] - [% node.port | html_entity %]</a>
[% ' <span class="label label-warning">A</span>' IF NOT node.active %] [% ' <span class="label label-warning">A</span>' IF NOT node.active %]
[% IF node.device.dns AND node.device_port AND node.device_port.name %] [% IF node.device.dns AND node.device_port AND node.device_port.name %]
([% node.device.dns %] - [% node.device_port.name %]) ([% node.device.dns | html_entity %] - [% node.device_port.name | html_entity %])
[% END %] [% END %]
</td> </td>
[% IF params.stamps %] [% IF params.stamps %]
<td>[% node.time_first_stamp %]</td> <td>[% node.time_first_stamp | html_entity %]</td>
<td>[% node.time_last_stamp %]</td> <td>[% node.time_last_stamp | html_entity %]</td>
[% END %] [% END %]
</tr> </tr>
[% SET first_row = 0 %] [% SET first_row = 0 %]
@@ -86,7 +86,7 @@
<td> <td>
[% IF first_row %] [% IF first_row %]
<a class="nd_linkcell" <a class="nd_linkcell"
href="[% search_node %]&q=[% port.mac | uri %]">[% port.mac %]</a> href="[% search_node %]&q=[% port.mac | uri %]">[% port.mac | html_entity %]</a>
[% ELSE %] [% ELSE %]
&nbsp; &nbsp;
[% END %] [% END %]
@@ -94,7 +94,7 @@
[% IF params.vendor %] [% IF params.vendor %]
<td> <td>
[% IF first_row %] [% IF first_row %]
[% port.oui.company %] [% port.oui.company | html_entity %]
[% ELSE %] [% ELSE %]
&nbsp; &nbsp;
[% END %] [% END %]
@@ -102,15 +102,15 @@
[% END %] [% END %]
<td>Switch Port</td> <td>Switch Port</td>
<td><a class="nd_linkcell" <td><a class="nd_linkcell"
href="[% device_ports %]&q=[% port.device.dns || port.ip %]&f=[% port.port %]&c_mac=on&c_nodes=on&c_neighbors=on"> href="[% device_ports %]&q=[% port.device.dns || port.ip | uri %]&f=[% port.port | uri %]&c_mac=on&c_nodes=on&c_neighbors=on">
[% port.ip %] - [% port.descr %]</a> [% port.ip | html_entity %] - [% port.descr | html_entity %]</a>
[% IF port.device.dns AND port.name %] [% IF port.device.dns AND port.name %]
([% port.device.dns %] - [% port.name %]) ([% port.device.dns | html_entity %] - [% port.name | html_entity %])
[% END %] [% END %]
</td> </td>
[% IF params.stamps %] [% IF params.stamps %]
<td>[% port.creation %]</td> <td>[% port.creation | html_entity %]</td>
<td>[% port.creation %]</td> <td>[% port.creation | html_entity %]</td>
[% END %] [% END %]
</tr> </tr>
[% SET first_row = 0 %] [% SET first_row = 0 %]

View File

@@ -10,12 +10,13 @@
</tbody> </tbody>
[% WHILE (row = results.next) %] [% WHILE (row = results.next) %]
<tr> <tr>
<td>[% row.name %]</td> <td>[% row.name | html_entity %]</td>
<td><a href="[% device_ports %]&q=[% row.device.dns || row.ip %]&f=[% row.port %]">[% row.ip %] [ [% row.port %] ]</a> <td><a href="[% device_ports %]&q=[% row.device.dns || row.ip | uri %]&f=[% row.port | uri %]">
[% row.ip | html_entity %] [ [% row.port | html_entity %] ]</a>
[% ' (' _ row.device.dns _ ')' IF row.device.dns %] [% ' (' _ row.device.dns _ ')' IF row.device.dns %]
</td> </td>
<td>[% row.descr %]</td> <td>[% row.descr | html_entity %]</td>
<td>[% row.vlan %]</td> <td>[% row.vlan | html_entity %]</td>
</tr> </tr>
[% END %] [% END %]
</tbody> </tbody>

View File

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

View File

@@ -29,8 +29,8 @@
<script type="text/javascript">has_sidebar["[% tab.id %]"] = 1;</script> <script type="text/javascript">has_sidebar["[% tab.id %]"] = 1;</script>
[% CATCH %] [% CATCH %]
<!-- no "[% tab.id %]" search options --> <!-- no "[% tab.id %]" search options -->
<input name="q" value="[% params.q %]" type="hidden"/> <input name="q" value="[% params.q | html_entity %]" type="hidden"/>
<input name="f" value="[% params.f %]" type="hidden"/> <input name="f" value="[% params.f | html_entity %]" type="hidden"/>
<script type="text/javascript">has_sidebar["[% tab.id %]"] = 0;</script> <script type="text/javascript">has_sidebar["[% tab.id %]"] = 0;</script>
[% END %] [% END %]
</form> </form>
@@ -45,7 +45,7 @@
[% FOREACH tab IN settings.device_tabs %] [% FOREACH tab IN settings.device_tabs %]
<li[% ' class="active"' IF params.tab == tab.id %]><a id="[% tab.id %]_link" href="#[% tab.id %]_pane">[% tab.label %]</a></li> <li[% ' class="active"' IF params.tab == tab.id %]><a id="[% tab.id %]_link" href="#[% tab.id %]_pane">[% tab.label %]</a></li>
[% END %] [% END %]
<span id="nd_device_name">[% d.dns || d.name %]</span> <span id="nd_device_name">[% d.dns || d.name | html_entity %]</span>
</ul> </ul>
<div class="tab-content"> <div class="tab-content">
[% FOREACH tab IN settings.device_tabs %] [% FOREACH tab IN settings.device_tabs %]

View File

@@ -37,7 +37,7 @@
<button type="submit" class="btn btn-info">Log In</button> <button type="submit" class="btn btn-info">Log In</button>
</div> </div>
[% IF vars.requested_path %] [% IF vars.requested_path %]
<input type="hidden" name="path" value="[% vars.requested_path %]"/> <input type="hidden" name="path" value="[% vars.requested_path | html_entity %]"/>
[% END %] [% END %]
</form> </form>
[% ELSE %] [% ELSE %]

View File

@@ -17,15 +17,15 @@
<tr> <tr>
<th> <th>
<a class="nd_linkcell" <a class="nd_linkcell"
href="[% search_device %]&vendor=[% platform.vendor %]"> href="[% search_device %]&vendor=[% platform.vendor | uri %]">
[% platform.vendor %]</a> [% platform.vendor | html_entity %]</a>
</th> </th>
<th> <th>
<a class="nd_linkcell" <a class="nd_linkcell"
href="[% search_device %]&model=[% platform.model %]"> href="[% search_device %]&model=[% platform.model | uri %]">
[% platform.model %]</a> [% platform.model | html_entity %]</a>
</th> </th>
<th>[% platform.get_column('count') %]</th> <th>[% platform.get_column('count') | html_entity %]</th>
</tr> </tr>
[% END %] [% END %]
</tbody> </tbody>
@@ -45,13 +45,13 @@
[% FOREACH release IN releases.all %] [% FOREACH release IN releases.all %]
[% NEXT UNLESS (release.os AND release.os_ver) %] [% NEXT UNLESS (release.os AND release.os_ver) %]
<tr> <tr>
<th>[% release.os %]</th> <th>[% release.os | html_entity %]</th>
<th> <th>
<a class="nd_linkcell" <a class="nd_linkcell"
href="[% search_device %]&os_ver=[% release.os_ver %]"> href="[% search_device %]&os_ver=[% release.os_ver | uri %]">
[% release.os_ver %]</a> [% release.os_ver | html_entity %]</a>
</th> </th>
<th>[% release.get_column('count') %]</th> <th>[% release.get_column('count') | html_entity %]</th>
</tr> </tr>
[% END %] [% END %]
</tbody> </tbody>

View File

@@ -2,7 +2,7 @@
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"> <html xmlns="http://www.w3.org/1999/xhtml">
<head> <head>
<meta http-equiv="Content-type" content="text/html; charset=[% settings.charset %]" /> <meta http-equiv="Content-type" content="text/html; charset=[% settings.charset | html_entity %]" />
<link rel="shortcut icon" href="#" /> <link rel="shortcut icon" href="#" />
<title>Netdisco</title> <title>Netdisco</title>
@@ -54,7 +54,7 @@
<ul class="nav"> <ul class="nav">
[% FOREACH ni IN settings.navbar_items %] [% FOREACH ni IN settings.navbar_items %]
<li[% ' class="active"' IF vars.nav == ni.id %]> <li[% ' class="active"' IF vars.nav == ni.id %]>
<a href="[% uri_for(ni.path) %]">[% ni.label %]</a> <a href="[% uri_for(ni.path) %]">[% ni.label | html_entity %]</a>
</li> </li>
[% END %] [% END %]
[% IF more_dd.size %] [% IF more_dd.size %]
@@ -63,7 +63,7 @@
More <b class="caret"></b></a> More <b class="caret"></b></a>
<ul class="dropdown-menu"> <ul class="dropdown-menu">
[% FOREACH title IN more_dd.keys.sort %] [% FOREACH title IN more_dd.keys.sort %]
<li><a href="[% uri_for(more_dd.$title) %]">[% title %]</a></li> <li><a href="[% uri_for(more_dd.$title) %]">[% title | html_entity %]</a></li>
[% END %] [% END %]
</ul> </ul>
</li> <!-- /dropdown --> </li> <!-- /dropdown -->
@@ -85,10 +85,10 @@
[% ELSE %] [% ELSE %]
<i class="icon-user"></i> <i class="icon-user"></i>
[% END %] [% END %]
[% session.user %] <b class="caret"></b></a> [% session.user | html_entity %] <b class="caret"></b></a>
<ul class="dropdown-menu"> <ul class="dropdown-menu">
[% FOREACH item IN user_dd %] [% FOREACH item IN user_dd %]
<li><a href="[% uri_for(item.link) %]">[% item.title %]</a></li> <li><a href="[% uri_for(item.link) %]">[% item.title | html_entity %]</a></li>
[% END %] [% END %]
</ul> </ul>
</li> <!-- /dropdown --> </li> <!-- /dropdown -->

View File

@@ -17,7 +17,7 @@
<script type="text/javascript">has_sidebar["[% tab.id %]"] = 1;</script> <script type="text/javascript">has_sidebar["[% tab.id %]"] = 1;</script>
[% CATCH %] [% CATCH %]
<!-- no "[% tab.id %]" search options --> <!-- no "[% tab.id %]" search options -->
<input name="q" value="[% params.q %]" type="hidden"/> <input name="q" value="[% params.q | html_entity %]" type="hidden"/>
<script type="text/javascript">has_sidebar["[% tab.id %]"] = 0;</script> <script type="text/javascript">has_sidebar["[% tab.id %]"] = 0;</script>
[% END %] [% END %]
</form> </form>

View File

@@ -1,11 +1,11 @@
<input name="q" value="[% params.q %]" type="hidden"/> <input name="q" value="[% params.q | html_entity %]" type="hidden"/>
<div class="clearfix"> <div class="clearfix">
<a class="field_clear_icon" href="#" <a class="field_clear_icon" href="#"
rel="tooltip" data-placement="top" data-offset="3" data-title="Show all Ports"> rel="tooltip" data-placement="top" data-offset="3" data-title="Show all Ports">
<img src="[% uri_base %]/images/tango_sweep.png"/></a> <img src="[% uri_base %]/images/tango_sweep.png"/></a>
<input id="nd_port_query" placeholder="Port, Name or VLAN" <input id="nd_port_query" placeholder="Port, Name or VLAN"
name="f" value="[% params.f %]" type="text" name="f" value="[% params.f | html_entity %]" type="text"
rel="tooltip" data-placement="left" data-offset="5" data-title="Filter by Port, Name or VLAN"/> rel="tooltip" data-placement="left" data-offset="5" data-title="Filter by Port, Name or VLAN"/>
</div> </div>
<div class="clearfix"> <div class="clearfix">
@@ -55,12 +55,12 @@
[% NEXT IF item.name == 'c_admin' AND NOT vars.user.port_control %] [% NEXT IF item.name == 'c_admin' AND NOT vars.user.port_control %]
<li> <li>
<label class="checkbox"> <label class="checkbox">
<input type="checkbox" id="[% item.name %]" <input type="checkbox" id="[% item.name | html_entity %]"
name="[% item.name %]"[% ' checked="checked"' IF params.${item.name} %] /> name="[% item.name | html_entity %]"[% ' checked="checked"' IF params.${item.name} %] />
[% IF item.name == 'c_admin' %] [% IF item.name == 'c_admin' %]
<span class="label label-info">[% item.label %]</span> <span class="label label-info">[% item.label | html_entity %]</span>
[% ELSE %] [% ELSE %]
[% item.label %] [% item.label | html_entity %]
[% END %] [% END %]
</label> </label>
</li> </li>
@@ -110,9 +110,9 @@
[% FOREACH item IN vars.connected_properties %] [% FOREACH item IN vars.connected_properties %]
<li> <li>
<label class="checkbox"> <label class="checkbox">
<input type="checkbox" id="[% item.name %]" <input type="checkbox" id="[% item.name | html_entity %]"
name="[% item.name %]"[% ' checked="checked"' IF params.${item.name} %] /> name="[% item.name | html_entity %]"[% ' checked="checked"' IF params.${item.name} %] />
[% item.label %] [% item.label | html_entity %]
</label> </label>
</li> </li>
[% END %] [% END %]

View File

@@ -1,12 +1,12 @@
<p class="nd_sidebar_title"><em>Device Search Options</em></p> <p class="nd_sidebar_title"><em>Device Search Options</em></p>
<input name="q" value="[% params.q %]" type="hidden"/> <input name="q" value="[% params.q | html_entity %]" type="hidden"/>
<div class="clearfix"> <div class="clearfix">
<i data-btn-for="dns" class="field_copy_icon icon-copy icon-large"></i> <i data-btn-for="dns" class="field_copy_icon icon-copy icon-large"></i>
<i id="dns_clear_btn" data-btn-for="dns" <i id="dns_clear_btn" data-btn-for="dns"
class="field_clear_icon icon-trash icon-large"></i> class="field_clear_icon icon-trash icon-large"></i>
<input class="nd_side_input" placeholder="DNS" <input class="nd_side_input" placeholder="DNS"
type="text" name="dns" value="[% params.dns %]" type="text" name="dns" value="[% params.dns | html_entity %]"
rel="tooltip" data-placement="left" data-offset="5" data-title="DNS"/> rel="tooltip" data-placement="left" data-offset="5" data-title="DNS"/>
</div> </div>
<div class="clearfix"> <div class="clearfix">
@@ -14,7 +14,7 @@
<i id="ip_clear_btn" data-btn-for="ip" <i id="ip_clear_btn" data-btn-for="ip"
class="field_clear_icon icon-trash icon-large"></i> class="field_clear_icon icon-trash icon-large"></i>
<input class="nd_side_input" placeholder="IP Address" <input class="nd_side_input" placeholder="IP Address"
type="text" name="ip" value="[% params.ip %]" type="text" name="ip" value="[% params.ip | html_entity %]"
rel="tooltip" data-placement="left" data-offset="5" data-title="IP Address"/> rel="tooltip" data-placement="left" data-offset="5" data-title="IP Address"/>
</div> </div>
<div class="clearfix"> <div class="clearfix">
@@ -22,7 +22,7 @@
<i id="name_clear_btn" data-btn-for="name" <i id="name_clear_btn" data-btn-for="name"
class="field_clear_icon icon-trash icon-large"></i> class="field_clear_icon icon-trash icon-large"></i>
<input class="nd_side_input" placeholder="System Name" <input class="nd_side_input" placeholder="System Name"
type="text" name="name" value="[% params.name %]" type="text" name="name" value="[% params.name | html_entity %]"
rel="tooltip" data-placement="left" data-offset="5" data-title="System Name"/> rel="tooltip" data-placement="left" data-offset="5" data-title="System Name"/>
</div> </div>
<div class="clearfix"> <div class="clearfix">
@@ -30,7 +30,7 @@
<i id="location_clear_btn" data-btn-for="location" <i id="location_clear_btn" data-btn-for="location"
class="field_clear_icon icon-trash icon-large"></i> class="field_clear_icon icon-trash icon-large"></i>
<input class="nd_side_input" placeholder="Location" <input class="nd_side_input" placeholder="Location"
type="text" name="location" value="[% params.location %]" type="text" name="location" value="[% params.location | html_entity %]"
rel="tooltip" data-placement="left" data-offset="5" data-title="Location"/> rel="tooltip" data-placement="left" data-offset="5" data-title="Location"/>
</div> </div>
<div class="clearfix"> <div class="clearfix">
@@ -38,7 +38,7 @@
<i id="description_clear_btn" data-btn-for="description" <i id="description_clear_btn" data-btn-for="description"
class="field_clear_icon icon-trash icon-large"></i> class="field_clear_icon icon-trash icon-large"></i>
<input class="nd_side_input" placeholder="Description" <input class="nd_side_input" placeholder="Description"
type="text" name="description" value="[% params.description %]" type="text" name="description" value="[% params.description | html_entity %]"
rel="tooltip" data-placement="left" data-offset="5" data-title="Description"/> rel="tooltip" data-placement="left" data-offset="5" data-title="Description"/>
</div> </div>
<div class="clearfix"> <div class="clearfix">
@@ -46,7 +46,7 @@
multiple="on" name="model" multiple="on" name="model"
rel="tooltip" data-placement="left" data-offset="5" data-title="Model"/> rel="tooltip" data-placement="left" data-offset="5" data-title="Model"/>
[% FOREACH opt IN model_list %] [% FOREACH opt IN model_list %]
<option[% ' selected="selected"' IF model_lkp.exists(opt) %]>[% opt %]</option> <option[% ' selected="selected"' IF model_lkp.exists(opt) %]>[% opt | html_entity %]</option>
[% END %] [% END %]
</select> </select>
</div> </div>
@@ -55,7 +55,7 @@
multiple="on" name="os_ver" multiple="on" name="os_ver"
rel="tooltip" data-placement="left" data-offset="5" data-title="OS Release"/> rel="tooltip" data-placement="left" data-offset="5" data-title="OS Release"/>
[% FOREACH opt IN os_ver_list %] [% FOREACH opt IN os_ver_list %]
<option[% ' selected="selected"' IF os_ver_lkp.exists(opt) %]>[% opt %]</option> <option[% ' selected="selected"' IF os_ver_lkp.exists(opt) %]>[% opt | html_entity %]</option>
[% END %] [% END %]
</select> </select>
</div> </div>
@@ -64,7 +64,7 @@
multiple="on" name="vendor" multiple="on" name="vendor"
rel="tooltip" data-placement="left" data-offset="5" data-title="Vendor"/> rel="tooltip" data-placement="left" data-offset="5" data-title="Vendor"/>
[% FOREACH opt IN vendor_list %] [% FOREACH opt IN vendor_list %]
<option[% ' selected="selected"' IF vendor_lkp.exists(opt) %]>[% opt %]</option> <option[% ' selected="selected"' IF vendor_lkp.exists(opt) %]>[% opt | html_entity %]</option>
[% END %] [% END %]
</select> </select>
</div> </div>

View File

@@ -1,6 +1,6 @@
<p class="nd_sidebar_title"><em>Node Search Options</em></p> <p class="nd_sidebar_title"><em>Node Search Options</em></p>
<input name="q" value="[% params.q %]" type="hidden"/> <input name="q" value="[% params.q | html_entity %]" type="hidden"/>
<div class="clearfix input-prepend"> <div class="clearfix input-prepend">
<label class="add-on"> <label class="add-on">
<input type="checkbox" id="stamps" <input type="checkbox" id="stamps"

View File

@@ -1,6 +1,6 @@
<p class="nd_sidebar_title"><em>Port Search Options</em></p> <p class="nd_sidebar_title"><em>Port Search Options</em></p>
<input name="q" value="[% params.q %]" type="hidden"/> <input name="q" value="[% params.q | html_entity %]" type="hidden"/>
<div class="clearfix input-prepend"> <div class="clearfix input-prepend">
<label class="add-on"> <label class="add-on">
<input type="checkbox" id="partial" <input type="checkbox" id="partial"

5
TODO
View File

@@ -9,10 +9,8 @@ FRONTEND
- drop topo file support and use DB only - drop topo file support and use DB only
* update inventory to use bootstrap accordion * update inventory to use bootstrap accordion
* UI plugins add template include path * UI plugins add template include path
* logging from web app
* reports page * reports page
* reports plugin(s) * reports plugin(s)
* URI escape TT substitutions
* (jeneric) device module tab * (jeneric) device module tab
@@ -25,12 +23,15 @@ DAEMON
CORE CORE
==== ====
* ditch ~/bin
* pseudo-device support * pseudo-device support
* VRF support * VRF support
* docs notes * docs notes
- start release notes page
- plackup -R option - plackup -R option
- localenv - localenv
- Try::Tiny - Try::Tiny
- Role::Tiny - Role::Tiny
- before and before_template hooks - before and before_template hooks
- running from git clone of netdisco-ng - running from git clone of netdisco-ng
- plackup --path for relocating