82 lines
		
	
	
		
			2.6 KiB
		
	
	
	
		
			Plaintext
		
	
	
	
	
	
			
		
		
	
	
			82 lines
		
	
	
		
			2.6 KiB
		
	
	
	
		
			Plaintext
		
	
	
	
	
	
| <table id="data-table" class="table table-striped table-bordered" width="100%" cellspacing="0">
 | |
|   <thead>
 | |
|     <tr>
 | |
|       <th>IP Address</th>
 | |
|       <th>MAC Address</th>
 | |
|       <th>Vendor</th>
 | |
|       <th class="nd_center-cell">DNS</th>
 | |
|       <th class="nd_center-cell">NetBIOS</th>
 | |
|       <th>Last Used</th>      
 | |
|     </tr>
 | |
|   </thead>
 | |
| </table>
 | |
| 
 | |
| <script type="text/javascript">
 | |
| $(document).ready(function() {
 | |
|   var table = $('#data-table').dataTable({
 | |
|     "deferRender": true,
 | |
|     "data": [% results | none %],
 | |
|     "columns": [
 | |
|       {
 | |
|         "data": 'ip',
 | |
|         "render": function(data, type, row, meta) {
 | |
|           var cell_str = he.encode(data);
 | |
|           if (type == 'display') {
 | |
|             if (row.time_last && row.node) {
 | |
|               cell_str = '<a href="[% search_node | none %]&q=' + encodeURIComponent(data)
 | |
|                 + (row.active ? '' : '&archived=on') + '">' + he.encode(data)
 | |
|                 + (row.active ? '' : ' <i class="icon-book text-warning"></i> ') + '</a>';
 | |
|             }
 | |
|             else if (row.time_last) {
 | |
|               cell_str = '<a href="[% search_device | none %]&q=' + encodeURIComponent(data) + '">' + he.encode(data) + '</a>';
 | |
|             }
 | |
|           }
 | |
|           return cell_str;
 | |
|         }
 | |
|       }, {
 | |
|         "data": 'mac',
 | |
|         "render": function(data, type, row, meta) {
 | |
|           var cell_str = he.encode(data || '');
 | |
|           if (type == 'display' && data && row.time_last) {
 | |
|             cell_str = '<a href="[% search_node | none %]&q=' + encodeURIComponent(data)
 | |
|               + (row.active ? '' : '&archived=on') + '">' + he.encode(data)
 | |
|               + (row.active ? '' : ' <i class="icon-book text-warning"></i> ') + '</a>';
 | |
|           }
 | |
|           return cell_str;
 | |
|         }
 | |
|       }, {
 | |
|         "data": 'vendor',
 | |
|         "className": "nd_nowrap nd_center-cell",
 | |
|         "render": function(data, type, row, meta) {
 | |
|           return he.encode(data || '');
 | |
|         }
 | |
|       }, {
 | |
|         "data": 'dns',
 | |
|         "className": "nd_nowrap nd_center-cell",
 | |
|         "render": function(data, type, row, meta) {
 | |
|           return he.encode(data || '');
 | |
|         }
 | |
|       }, {
 | |
|         "data": 'nbname',
 | |
|         "className": "nd_nowrap nd_center-cell",
 | |
|         "render": function(data, type, row, meta) {
 | |
|           return he.encode(data || '');
 | |
|         }
 | |
|       }, {
 | |
|         "data": 'age',
 | |
|         "render": function(data, type, row, meta) {
 | |
|           if (type == 'display') {
 | |
|             return he.encode(data || 'Never');
 | |
|           }
 | |
|           else {
 | |
|             // so that sorting works correctly on this column
 | |
|             return row.time_last;
 | |
|           }
 | |
|         }
 | |
|       }
 | |
|     ],
 | |
| [% INCLUDE 'ajax/datatabledefaults.tt' -%]
 | |
|   });
 | |
| });
 | |
| </script>
 |