diff --git a/Netdisco/share/views/ajax/device/ports.tt b/Netdisco/share/views/ajax/device/ports.tt index 7c683b9b..2b744afa 100644 --- a/Netdisco/share/views/ajax/device/ports.tt +++ b/Netdisco/share/views/ajax/device/ports.tt @@ -74,13 +74,13 @@ $(document).ready(function() { cell_str = ''; } if (row.slave_of) { - cell_str = cell_str + '
'; + cell_str += '
'; if (row.agg_master_up_admin != 'up') { - cell_str = cell_str + ''; + cell_str += ''; } else if (row.agg_master_up === 'up') { - cell_str = cell_str + ''; + cell_str += ''; } else { - cell_str = cell_str + ''; + cell_str += ''; } } return cell_str; @@ -114,40 +114,38 @@ $(document).ready(function() { var cell_str = ''; [% IF user_can_port_control AND params.c_admin %] if (row.up_admin === 'up') { - cell_str = cell_str - + '' + cell_str += '' + '' + ' ' + ''; } else { - cell_str = cell_str - + '' + cell_str += '' + '' + ' ' + ''; } - cell_str = cell_str + ''; - cell_str = cell_str + ''; + cell_str += '' + + ''; [% ELSE %] - cell_str = cell_str + ''; + cell_str += ''; [% END %] - cell_str = cell_str + ''; + cell_str += ''; if (row.is_master) { - cell_str = cell_str + ' '; + cell_str += ' '; } - cell_str = cell_str + he.encode(row.port) + ''; + cell_str += he.encode(row.port) + ''; if (row.slave_of) { - cell_str = cell_str + '
'; - cell_str = cell_str + ''; - cell_str = cell_str + he.encode(row.slave_of) + ''; + cell_str += '
' + + '' + + he.encode(row.slave_of) + ''; } return cell_str; } @@ -189,10 +187,8 @@ $(document).ready(function() { "data": "duplex", "render": function(data, type, row, meta) { if (row.up === 'up' && row.duplex) { - var cell_str = ''; - cell_str = cell_str + he.encode(capitalizeFirstLetter(row.duplex_admin || 'auto') ); - cell_str = cell_str + ' / ' + he.encode(capitalizeFirstLetter(row.duplex) || ''); - return cell_str; + return he.encode(capitalizeFirstLetter(row.duplex_admin || 'auto') ) + + ' / ' + he.encode(capitalizeFirstLetter(row.duplex) || ''); } else { return ''; @@ -218,11 +214,9 @@ $(document).ready(function() { "className": 'nd_editable-cell nd_nowrap', "render": function(data, type, row, meta) { if (type === 'display') { - var cell_str = '' - cell_str = cell_str + '
'; - cell_str = cell_str + he.encode(data || ''); - cell_str = cell_str + '
'; - return cell_str; + return '' + + '
' + + he.encode(data || '') + '
'; } else { return data; @@ -269,13 +263,13 @@ $(document).ready(function() { "className": 'nd_editable-cell', "render": function ( data, type, row, meta ) { if (type === 'display') { - var cell_str = ''; - cell_str = cell_str + '
'; + var cell_str = '' + + '
'; if (row.native_vlan) { /* row.native_vlan is an integer, no need to encode */ - cell_str = cell_str + row.native_vlan; + cell_str += row.native_vlan; } - cell_str = cell_str + '
'; + cell_str += '
'; return cell_str; } else { @@ -307,13 +301,12 @@ $(document).ready(function() { return '' + a + ''; }); if (row.vlan_membership.length > 10) { - cell_str = cell_str + '
('; - cell_str = cell_str + row.vlan_membership.length; - cell_str = cell_str + ')
'; - cell_str = cell_str + '
Show VLANs
'; - cell_str = cell_str + '
' + arr.join(", "); - cell_str = cell_str + '
'; - return cell_str; + return '
(' + + row.vlan_membership.length + + ')
' + + '
Show VLANs
' + + '
' + arr.join(", ") + + '
'; } else { return row.vlan_membership ? arr.join(", ") : ""; @@ -349,29 +342,29 @@ $(document).ready(function() { var cell_str = ''; if (row.power_admin && row.power_admin === 'true') { [% IF user_can_port_control AND params.c_admin %] - cell_str = cell_str + ''; + cell_str += ''; [% ELSE %] - cell_str = cell_str + ''; + cell_str += ''; [% END %] - cell_str = cell_str + ' '; + cell_str += ' '; if (row.power && row.power > 0) { - cell_str = cell_str + row.power + ' mW'; + cell_str += row.power + ' mW'; } else { - cell_str = cell_str + he.encode(row.power_status || ''); + cell_str += he.encode(row.power_status || ''); } - cell_str = cell_str + ''; + cell_str += ''; return cell_str; } else { [% IF user_can_port_control AND params.c_admin %] - cell_str = cell_str + ''; + cell_str += ''; [% ELSE %] - cell_str = cell_str + ''; + cell_str += ''; [% END %] } } @@ -412,118 +405,114 @@ $(document).ready(function() { var d_suffix = '[% settings.domain_suffix %]'; if (row.remote_ip || row.is_uplink) { if (row.neighbor_alias_ip) { - cell_str = cell_str + ' '; + cell_str += '"> '; if (row.remote_type && row.remote_type.match(/ip.phone/i)) { - cell_str = cell_str + ' '; + cell_str += ' '; } else if (row.remote_type && row.remote_type.match(/(cisco\s+AIR-[L|C]?AP|-K9W8-|^AP:\s)/)) { - cell_str = cell_str + ' '; + cell_str += ' '; } - cell_str = cell_str + ''; + cell_str += ''; var n_dns = row.neighbor_alias_dns ? row.neighbor_alias_dns.replace(d_suffix, '') : ''; - cell_str = cell_str + he.encode(n_dns || row.neighbor_alias_ip); - cell_str = cell_str + ''; + cell_str += he.encode(n_dns || row.neighbor_alias_ip) + ''; if (row.remote_port) { - cell_str = cell_str + ' - ' - cell_str = cell_str + '' + he.encode(row.remote_port || ''); - cell_str = cell_str + ''; + cell_str += ' - ' + + '' + he.encode(row.remote_port || '') + ''; } - cell_str = cell_str + '
'; + cell_str += '
'; [% IF params.neigh_id %] if (row.remote_id || row.remote_type) { - cell_str = cell_str + '('; + cell_str += '('; if (row.remote_id) { - cell_str = cell_str + ' id: ' + he.encode(row.remote_id); + cell_str += ' id: ' + he.encode(row.remote_id); } else if (row.remote_type) { - cell_str = cell_str + ' type: ' + he.encode(row.remote_type); + cell_str += ' type: ' + he.encode(row.remote_type); } - cell_str = cell_str + ' )
'; + cell_str += ' )
'; } [% END %] } else if (row.remote_ip) { - cell_str = cell_str + ' '; + cell_str += ' '; if (row.remote_type && row.remote_type.match(/ip.phone/i)) { - cell_str = cell_str + ' '; + cell_str += ' '; } else if (row.remote_type && row.remote_type.match(/(cisco\s+AIR-[L|C]?AP|-K9W8-|^AP:\s)/)) { - cell_str = cell_str + ' '; + cell_str += ' '; } - cell_str = cell_str + ''; - cell_str = cell_str + he.encode(row.remote_ip || ''); + cell_str += '' + + he.encode(row.remote_ip || ''); if (row.remote_port) { - cell_str = cell_str + ' - ' + he.encode(row.remote_port || ''); + cell_str += ' - ' + he.encode(row.remote_port || ''); } - cell_str = cell_str + '
'; + cell_str += '
'; [% IF params.neigh_id %] if (row.remote_id || row.remote_type) { - cell_str = cell_str + '('; + cell_str += '('; if (row.remote_id) { - cell_str = cell_str + ' id: ' + he.encode(row.remote_id); + cell_str += ' id: ' + he.encode(row.remote_id); } else if (row.remote_type) { - cell_str = cell_str + ' type: ' + he.encode(row.remote_type); + cell_str += ' type: ' + he.encode(row.remote_type); } - cell_str = cell_str + ' )
'; + cell_str += ' )
'; } [% END %] } else { - cell_str = cell_str + '  (possible uplink)'; + cell_str += '  (possible uplink)'; } } [% IF params.c_nodes %] var macfmt = '[% params.mac_format %]'; for (index = 0; index < row.nodes.length; ++index) { if ((row.remote_ip || row.is_uplink) && index === 0 ) { - cell_str = cell_str + '
'; + cell_str += '
'; } if (row.nodes[index].active === 0) { [% IF params.n_archived %] if (index > 0 ) { - cell_str = cell_str + '
'; + cell_str += '
'; } - cell_str = cell_str + '  '; + cell_str += '  '; [% ELSE %] continue; [% END %] } else if (index > 0 && row.nodes[index].active !== 0) { - cell_str = cell_str + '
'; + cell_str += '
'; } if (row.remote_type && row.remote_type.match(/ip.phone/i)) { - cell_str = cell_str + ' '; + cell_str += ' '; } else if (row.nodes[index].ssids || (row.remote_type && row.remote_type.match(/(cisco\s+AIR-[L|c]?AP|-K9W8-|^AP:\s)/))) { - cell_str = cell_str + ' '; + cell_str += ' '; } - cell_str = cell_str + ''; - cell_str = cell_str + he.encode(fmac) + ''; + cell_str += encodeURIComponent(fmac) + '">' + + he.encode(fmac) + ''; [% IF params.n_vendor %] if (row.nodes[index].abbrev) { - cell_str = cell_str + ' ('; - cell_str = cell_str + ''; - cell_str = cell_str + he.encode(row.nodes[index].abbrev || '') + ''; - cell_str = cell_str + ')'; + cell_str += ' (' + + '' + + he.encode(row.nodes[index].abbrev || '') + ')'; } [% END %] if (row.nodes[index].vlans.length > 0) { var vl = row.nodes[index].vlans ? row.nodes[index].vlans.join(", ") : ""; - cell_str = cell_str + ' (on vlan '; - cell_str = cell_str + vl + ')'; + cell_str += ' (on vlan ' + vl + ')'; } [% IF params.n_ssid %] if (row.nodes[index].ssids && row.nodes[index].ssids.length > 0) { @@ -532,58 +521,54 @@ $(document).ready(function() { arr = jQuery.map( arr, function( a ) { return '' + he.encode(a) + ''; }); - cell_str = cell_str + ' (SSID: '; - cell_str = cell_str + arr.join(" "); - cell_str = cell_str + ')'; + cell_str += ' (SSID: ' + arr.join(" ") + ')'; } [% END %] [% IF params.n_age %] - cell_str = cell_str + ' ('; + cell_str += ' ('; var now = moment(); var t_last = moment(row.nodes[index].time_last); - cell_str = cell_str + t_last.from(now); - cell_str = cell_str + ')'; + cell_str += t_last.from(now) + ')'; [% END %] [% IF params.n_ip %] if (row.nodes[index].ip && row.nodes[index].ip.length > 0) { for (idx = 0; idx < row.nodes[index].ip.length; ++idx) { if (row.nodes[index].ip_active[idx] === 0) { [% IF params.n_archived %] - cell_str = cell_str + '
 '; - cell_str = cell_str + '  '; + cell_str += '
    '; [% ELSE %] continue; [% END %] } else { - cell_str = cell_str + '
 '; + cell_str += '
 '; } - cell_str = cell_str + ''; + cell_str += ''; if (row.nodes[index].dns[idx]) { - cell_str = cell_str + he.encode(row.nodes[index].dns[idx]); - cell_str = cell_str + ' ( ' + he.encode(row.nodes[index].ip[idx]) + ' )'; + cell_str += he.encode(row.nodes[index].dns[idx]) + + ' ( ' + he.encode(row.nodes[index].ip[idx]) + ' )'; } else { - cell_str = cell_str + he.encode(row.nodes[index].ip[idx]) + ''; + cell_str += he.encode(row.nodes[index].ip[idx]) + ''; } } } [% END %] [% IF params.n_netbios %] if (row.nodes[index].nbname) { - cell_str = cell_str + '
     \\\\' + nb_dom + '\\'; - cell_str = cell_str + ''; - cell_str = cell_str + he.encode(row.nodes[index].nbname) + ''; - cell_str = cell_str + '
     '; + cell_str += nb_dom_uri + '" title="Nodes in this Domain">' + nb_dom + '\\' + + '' + + he.encode(row.nodes[index].nbname) + '' + + '
     '; var nb_user = row.nodes[index].nbuser ? he.encode(row.nodes[index].nbuser) : '[No User]'; - cell_str = cell_str + nb_user + '@'; - cell_str = cell_str + ''; - cell_str = cell_str + he.encode(row.nodes[index].nb_ip) + ''; + cell_str += nb_user + '@' + + '' + + he.encode(row.nodes[index].nb_ip) + ''; } [% END %] }