2 <script type=
"text/javascript">//<![CDATA[
4 var displayExtraInfo = function ( id ) {
6 document.getElementById('extra-info').innerHTML = document.getElementById(id).innerHTML;
8 XHR.poll(
5, '/cgi-bin/bmx6-info', { '$neighbours': '' },
11 var originators = st.neighbours[
0].originators;
12 var descriptions = st.neighbours[
1].descriptions;
14 var tb = document.getElementById('descriptions_table');
16 if ( originators.length != descriptions.length )
18 var tr = tb.insertRow(-
1);
19 tr.className = 'cbi-section-table-row';
20 var td = tr.insertCell(-
1);
22 td.innerHTML = '
<em><br /><%:Some problem with JSON: lenght of originators and descriptions different. %
></em>';
23 td.innerHTML += '
<em><%: Please perform a manually cache flush from a terminal: bmx6 -c --flushAll %
></em>'
27 if ( originators && descriptions && tb)
30 while( tb.rows.length
> 1 )
33 for( var i =
0; i < descriptions.length; i++ )
35 var tr = tb.insertRow(-
1);
36 var nodename = descriptions[i].DESC_ADV.globalId.replace(/\.[^\.]+$/,
"");
37 tr.className = 'cbi-section-table-row cbi-rowstyle-' + ((i %
2) +
1);
38 tr.insertCell(-
1).innerHTML = '
<a onclick=
"displayExtraInfo(\'ip-'+i+'\')"><img src=\
"<%=resource%>/cbi/help.gif\" /></a>';
39 tr.insertCell(-
1).innerHTML = nodename;
41 var extensions = descriptions[i].DESC_ADV.extensions;
43 //Looking for the extensions
47 for( var e =
0; e < extensions.length; e++)
49 if( extensions[e].HNA6_EXTENSION )
51 hna6 = extensions[e].HNA6_EXTENSION;
53 if ( extensions[e].TUN4IN6_NET_EXTENSION )
55 tun4in6 = extensions[e].TUN4IN6_NET_EXTENSION;
59 var gateways = '
<ul>';
60 for ( var t =
0; t < tun4in6.length; t++)
62 if ( tun4in6[t].networklen ==
"32" )
63 gateways += '
<li><a href=
"http://' + tun4in6[t].network + '">' + tun4in6[t].network + '
</a></li>';
65 gateways +=
"<li>"+tun4in6[t].network+'/'+tun4in6[t].networklen + ' | ' + tun4in6[t].bandwidth+'
</li>';
69 //Adding HNAs with prefix=
128 as main address
73 var ipstxt_hidden = '
<ul>';
74 var hna6list = '
<ul>';
76 for( var e =
0; e < hna6.length; e++ )
78 address = hna6[e].address;
79 prefix = hna6[e].prefixlen;
80 if ( prefix == '
128' )
85 ipstxt_hidden += '
<li><a href=
"http://['+address+']" >'+address+
"</a></li>";
89 ipstxt_hidden += '
<li><a href=
"http://['+address+']" >'+address+
"</a></li>";
93 hna6list += '
<li>'+address+'/'+prefix+'
</li>';
97 ipstxt_hidden += '
</ul>';
99 tr.insertCell(-
1).innerHTML = ipstxt;
101 tr.insertCell(-
1).innerHTML = originators[i].viaDev;
102 tr.insertCell(-
1).innerHTML = originators[i].metric;
103 tr.insertCell(-
1).innerHTML = originators[i].lastDesc;
104 tr.insertCell(-
1).innerHTML = originators[i].lastRef;
105 tr.insertCell(-
1).innerHTML = originators[i].blocked;
106 //tr.onclick = displayExtraInfo(
"ip-"+i);
108 extrainfo = '
<div id=
"ip-'+ i +'" class=
"hideme">' +
"<div class='inforow'><br /><br /><h4>" + nodename + '
</h4></div>\n' +
"<div class='inforow'><h5>Available IPs</h5>\n<p>" + ipstxt_hidden +
"</p></div>\n" +
"<div class='inforow'><h5>Gateways announced</h5>\n<p>" + gateways +
"</p></div>\n" +
"<div class='inforow'><h5>Networks announced</h5>\n<p>" + hna6list +
"</p></div>\n";
110 extrainfo +=
"\n</div>";
112 tr.insertCell(-
1).innerHTML = extrainfo;
116 if( tb.rows.length ==
1 )
118 var tr = tb.insertRow(-
1);
119 tr.className = 'cbi-section-table-row';
121 var td = tr.insertCell(-
1);
123 td.innerHTML = '
<em><br /><%:There are no nodes available.%
></em>';
147 display:inline-block;
153 #extra-info ul { list-style: none outside none; margin-left:
0em; }
156 <div class=
"cbi-map">
159 <div class=
"cbi-map-descr"></div>
160 <div id=
"extra-info" class=
"info">
162 Click to the icon
<img src=
"<%=resource%>/cbi/help.gif" /> to see individual node information
164 <fieldset class=
"cbi-section">
165 <legend><%:Mesh nodes%
></legend>
166 <table class=
"cbi-section-table" id=
"descriptions_table">
167 <tr class=
"cbi-section-table-titles">
168 <th class=
"cbi-section-table-cell"></th>
169 <th class=
"cbi-section-table-cell"><%:Hostname%
></th>
170 <th class=
"cbi-section-table-cell"><%:Primary IP%
></th>
171 <th class=
"cbi-section-table-cell"><%:Via Device%
></th>
172 <th class=
"cbi-section-table-cell"><%:Metric%
></th>
173 <th class=
"cbi-section-table-cell"><%:Last Desc%
></th>
174 <th class=
"cbi-section-table-cell"><%:Last Ref%
></th>
175 <th class=
"cbi-section-table-cell"><%:Blocked%
></th>
177 <tr class=
"cbi-section-table-row">
178 <td colspan=
"8"><em><br /><%:Collecting data...%
></em></td>
184 <a href=
"<%=link_non_js%>">Go to non JavaScript view
</a>