mapstats |
Subversion Repositories: |
Rev 4 | Rev 5 | |
---|---|---|
Line 5... | Line 5... | |
// (c) 2008 All rights reserved |
// (c) 2008 All rights reserved | |
// -------------------------------------------------------- |
// -------------------------------------------------------- | |
|
| |
var mainMap; |
var mainMap; | |
var magnifier; |
var magnifier; | |
imgon = new Image(); |
if (navigator.appName=="Microsoft Internet Explorer") { | |
imgon.src = 'on.png'; |
var imgon = new Image(); | |
var imgoff = new Image(); |
imgon.src = 'on.png'; | |
imgoff.src = 'off.png'; |
var imgoff = new Image(); | |
var imginfo = new Image(); |
imgoff.src = 'off.png'; | |
imginfo.src = 'info.png'; |
var imginfo = new Image(); | |
var imgap = new Image(); |
imginfo.src = 'info.png'; | |
imgap.src = 'ap.png'; |
var imgap = new Image(); | |
var imgcn = new Image(); |
imgap.src = 'ap.png'; | |
imgcn.src = 'client.png'; |
var imgcn = new Image(); | |
var imgsw = new Image(); |
imgcn.src = 'client.png'; | |
imgsw.src = 'switch.png'; |
var imgsw = new Image(); | |
imgsw.src = 'switch.png'; | ||
} | ||
|
| |
var node = new Array(); |
var node = new Array(); | |
var nodecount; | ||
var pozdrav8 = new Array(); |
var pozdrav8 = new Array(); | |
var pomocna = new Array(); |
var pomocna = new Array(); | |
var pomocna1 = new Array(); |
var pomocna1 = new Array(); | |
var pomocna2 = new Array(); |
var pomocna2 = new Array(); | |
var pomocna3 = new Array(); |
var pomocna3 = new Array(); | |
Line 217... | Line 220... | |
size:4 |
size:4 | |
}, |
}, | |
] |
] | |
|
| |
var zoomElt = this.zoomDim[this.zoom]; |
var zoomElt = this.zoomDim[this.zoom]; | |
this.setInnerDivSize (zoomElt.width, zoomElt.height, zoomElt.size, (parseInt(start_mul*1000)/10)); |
this.setInnerDivSize (zoomElt.width, zoomElt.height, zoomElt.size, (parseInt(zoomfirst*1000)/10)); | |
|
| |
var innerDiv = document.getElementById("innerDiv"); |
var innerDiv = document.getElementById("innerDiv"); | |
innerDiv.style.left = -(start_left) + "px"; |
innerDiv.style.left = -(start_left) + "px"; | |
innerDiv.style.top = -(start_top) + "px"; |
innerDiv.style.top = -(start_top) + "px"; | |
|
| |
Line 460... | Line 463... | |
|
| |
this.checkZoom(); |
this.checkZoom(); | |
this.checkTiles(); |
this.checkTiles(); | |
|
| |
titulek1 = document.getElementById("mapstats_infopoint"); |
titulek1 = document.getElementById("mapstats_infopoint"); | |
titulek1.innerHTML = ""; |
||
titulek2 = document.getElementById("mapstats_name"); |
titulek2 = document.getElementById("mapstats_name"); | |
titulek2.innerHTML = ""; |
||
titulek3 = document.getElementById("mapstats_ip"); |
titulek3 = document.getElementById("mapstats_ip"); | |
titulek3.innerHTML = ""; |
||
titulek4 = document.getElementById("mapstats_status"); |
titulek4 = document.getElementById("mapstats_status"); | |
titulek4.innerHTML = ""; |
||
titulek5 = document.getElementById("mapstats_legend"); |
titulek5 = document.getElementById("mapstats_legend"); | |
titulek6 = document.getElementById("mapstats_wave"); | ||
titulek7 = document.getElementById("mapstats_points"); | ||
| ||
titulek1.innerHTML = ""; | ||
titulek2.innerHTML = ""; | ||
titulek3.innerHTML = ""; | ||
titulek4.innerHTML = ""; | ||
titulek5.innerHTML = ""; |
titulek5.innerHTML = ""; | |
titulek6.innerHTML = ""; | ||
titulek7.innerHTML = ""; | ||
|
| |
canvasInit(nasobek); |
canvasInit(nasobek); | |
|
| |
} |
} | |
|
| |
Line 502... | Line 510... | |
var pozdrav2 = new Array(); |
var pozdrav2 = new Array(); | |
var pozdr = new Array(); |
var pozdr = new Array(); | |
pozdrav = pomocna.split('\n'); |
pozdrav = pomocna.split('\n'); | |
pozdrav1 = pomocna1.split('\n'); |
pozdrav1 = pomocna1.split('\n'); | |
var a_cnt = 0; |
var a_cnt = 0; | |
var p0count = pozdrav.length; | ||
var p1count = pozdrav1.length; | ||
|
| |
for(a=0;a<pozdrav.length;a++){ |
for(a=0;a<p0count;a++){ | |
if(pozdrav[a]!="") { |
if(pozdrav[a]!="") { | |
node[a] = new Array(); |
node[a] = new Array(); | |
pozdrav2 = pozdrav[a].split(';'); |
pozdrav2 = pozdrav[a].split(';'); | |
for(b=0;b<pozdrav2.length;b++){ |
for(b=0;b<pozdrav2.length;b++){ | |
node[a][b] = pozdrav2[b]; |
node[a][b] = pozdrav2[b]; | |
} |
} | |
a_cnt++; |
a_cnt++; | |
} |
} | |
} |
} | |
for(e=0;e<pozdrav1.length;e++) { |
for(e=0;e<p1count;e++) { | |
if(pozdrav1[e]!="") { |
if(pozdrav1[e]!="") { | |
node[(e+a_cnt)] = new Array(); |
node[(e+a_cnt)] = new Array(); | |
pozdr = pozdrav1[e].split(';'); |
pozdr = pozdrav1[e].split(';'); | |
for(f=0;f<pozdr.length;f++){ |
for(f=0;f<pozdr.length;f++){ | |
node[(e+a_cnt)][f] = pozdr[f]; |
node[(e+a_cnt)][f] = pozdr[f]; | |
} |
} | |
} |
} | |
} |
} | |
|
| |
nodecount = node.length; | ||
var pozdrav3 = new Array(); |
var pozdrav3 = new Array(); | |
var pozdrav4 = new Array(); |
var pozdrav4 = new Array(); | |
var size; |
var size; | |
var clrlnk; |
var clrlnk; | |
m1 = 0; |
m1 = 0; | |
Line 549... | Line 560... | |
m9_a = 0; |
m9_a = 0; | |
cntm = 0; |
cntm = 0; | |
|
| |
if(pomocna2.length>0) { |
if(pomocna2.length>0) { | |
pozdrav3 = pomocna2.split('\n'); |
pozdrav3 = pomocna2.split('\n'); | |
for(a=0;a<pozdrav3.length;a++){ |
var p3count = pozdrav3.length; | |
for(a=0;a<p3count;a++){ | ||
if(pozdrav3[a]!="") { |
if(pozdrav3[a]!="") { | |
pozdrav4 = pozdrav3[a].split(';'); |
pozdrav4 = pozdrav3[a].split(';'); | |
if(pozdrav4[1].toLowerCase()=="backbone") { size = 4.5; } else { size = 2.7; } |
if(pozdrav4[1].toLowerCase()=="backbone") { size = 4.5; } else { size = 2.7; } | |
if(pozdrav4[2].toLowerCase()=="inp") { |
if(pozdrav4[2].toLowerCase()=="inp") { | |
if(pozdrav4[3]==1) { clrlnk = wifi_client_a; m1_a = 1; } |
if(pozdrav4[3]==1) { clrlnk = wifi_client_a; m1_a = 1; } | |
Line 612... | Line 624... | |
} |
} | |
} |
} | |
} |
} | |
} |
} | |
|
| |
for(e=0;e<pozdrav1.length;e++) { |
for(e=0;e<p1count;e++) { | |
if(pozdrav1[e]!="") { |
if(pozdrav1[e]!="") { | |
if(ch_noping) { |
if(ch_noping) { | |
if(node[(a_cnt+e)][3]==1) { |
if(node[(a_cnt+e)][3]==1) { | |
drawClient(node[(a_cnt+e)][1],node[(a_cnt+e)][2],nasobek); |
drawClient(node[(a_cnt+e)][1],node[(a_cnt+e)][2],nasobek); | |
if(ch_name) { |
if(ch_name) { | |
Line 635... | Line 647... | |
var clrpnt; |
var clrpnt; | |
var x_pos; |
var x_pos; | |
var y_pos; |
var y_pos; | |
var name_pos; |
var name_pos; | |
var title_pos; |
var title_pos; | |
var p7count = pozdrav7.length; | ||
|
| |
for(c=0;c<pozdrav7.length;c++){ |
for(c=0;c<p7count;c++){ | |
if(pozdrav7[c]!="") { |
if(pozdrav7[c]!="") { | |
pozdrav8 = pozdrav7[c].split(';'); |
pozdrav8 = pozdrav7[c].split(';'); | |
if(pozdrav8[1]==1) { clrpnt = imgon; pozdrav8[2] = pozdrav8[2] + ' ms'; } else { clrpnt = imgoff; pozdrav8[2] = "offline"; } |
if(pozdrav8[1]==1) { clrpnt = "on"; pozdrav8[2] = pozdrav8[2] + ' ms'; } else { clrpnt = "off"; pozdrav8[2] = "offline"; } | |
if(pozdrav8[0]!=node[c][4]) { x_pos = ip2sour(pozdrav8[0],1); y_pos = ip2sour(pozdrav8[0],2); name_pos = ip2sour(pozdrav8[0],0); title_pos = ip2sour(pozdrav8[0],3); } else { x_pos = node[c][1]; y_pos = node[c][2]; name_pos = node[c][0]; title_pos = node[c][3]; } // check if the result doesnt replaced |
if(pozdrav8[0]!=node[c][4]) { x_pos = ip2sour(pozdrav8[0],1); y_pos = ip2sour(pozdrav8[0],2); name_pos = ip2sour(pozdrav8[0],0); title_pos = ip2sour(pozdrav8[0],3); } else { x_pos = node[c][1]; y_pos = node[c][2]; name_pos = node[c][0]; title_pos = node[c][3]; } // check if the result doesnt replaced | |
|
| |
if(title_pos.toLowerCase()=="ap") { |
if(title_pos.toLowerCase()=="ap") { | |
if(ch_ap) { |
if(ch_ap) { | |
drawAP(x_pos,y_pos,nasobek); |
drawAP(x_pos,y_pos,nasobek); | |
Line 778... | Line 791... | |
} |
} | |
ctx.stroke(); |
ctx.stroke(); | |
} |
} | |
|
| |
function drawNode(xo, yo, nas, img) { |
function drawNode(xo, yo, nas, img) { | |
var ctx = document.getElementById('paint2').getContext('2d'); |
xo = parseInt((xo*nas)-7); | |
ctx.drawImage(img,parseInt((xo*nas)-7),parseInt((yo*nas)-7)); |
yo = parseInt((yo*nas)-7); | |
if (navigator.appName=="Microsoft Internet Explorer") { | ||
if(img=="on") { img = imgon; } else { img = imgoff; } | ||
var ctx = document.getElementById('paint2').getContext('2d'); | ||
ctx.drawImage(img,xo,yo); | ||
} else { | ||
var text = '<div style="position:absolute;left:' + xo + 'px;top:' + yo + 'px;width: 14px;height: 14px;background-image: url(\'' + img + '.png\');font-size: 0px;cursor: default;" unselectable = "on"></div>'; | ||
titulek = document.getElementById("mapstats_points"); | ||
titulek.innerHTML = titulek.innerHTML + text; | ||
} | ||
} |
} | |
|
| |
function drawAP(xn, yn, nas) { |
function drawAP(xn, yn, nas) { | |
var ctx = document.getElementById('paint').getContext('2d'); |
xn = parseInt((xn*nas)-31); | |
ctx.drawImage(imgap,parseInt((xn*nas)-31),parseInt((yn*nas)-17)); |
yn = parseInt((yn*nas)-17); | |
if (navigator.appName=="Microsoft Internet Explorer") { | ||
var ctx = document.getElementById('paint').getContext('2d'); | ||
ctx.drawImage(imgap,xn,yn); | ||
} else { | ||
var text = '<div style="position:absolute;left:' + xn + 'px;top:' + yn + 'px;width: 62px;height: 34px;background-image: url(\'ap.png\');font-size: 0px;cursor: default;" unselectable = "on"></div>'; | ||
titulek = document.getElementById("mapstats_wave"); | ||
titulek.innerHTML = titulek.innerHTML + text; | ||
} | ||
} |
} | |
|
| |
function drawClient(xc, yc, nas) { |
function drawClient(xc, yc, nas) { | |
var ctx = document.getElementById('paint').getContext('2d'); |
xc = parseInt((xc*nas)-7); | |
ctx.drawImage(imgcn,parseInt((xc*nas)-7),parseInt((yc*nas)-7)); |
yc = parseInt((yc*nas)-7); | |
if (navigator.appName=="Microsoft Internet Explorer") { | ||
var ctx = document.getElementById('paint').getContext('2d'); | ||
ctx.drawImage(imgcn,xc,yc); | ||
} else { | ||
var text = '<div style="position:absolute;left:' + xc + 'px;top:' + yc + 'px;width: 14px;height: 14px;background-image: url(\'client.png\');font-size: 0px;cursor: default;" unselectable = "on"></div>'; | ||
titulek = document.getElementById("mapstats_wave"); | ||
titulek.innerHTML = titulek.innerHTML + text; | ||
} | ||
} |
} | |
|
| |
function drawSwitch(xs, ys, nas) { |
function drawSwitch(xs, ys, nas) { | |
var ctx = document.getElementById('paint').getContext('2d'); |
xs = parseInt((xs*nas)-6); | |
ctx.drawImage(imgsw,parseInt((xs*nas)-6),parseInt((ys*nas)-6)); |
ys = parseInt((ys*nas)-6); | |
if (navigator.appName=="Microsoft Internet Explorer") { | ||
var ctx = document.getElementById('paint').getContext('2d'); | ||
ctx.drawImage(imgsw,xs,ys); | ||
} else { | ||
var text = '<div style="position:absolute;left:' + xs + 'px;top:' + ys + 'px;width: 12px;height: 12px;background-image: url(\'switch.png\');font-size: 0px;cursor: default;" unselectable = "on"></div>'; | ||
titulek = document.getElementById("mapstats_wave"); | ||
titulek.innerHTML = titulek.innerHTML + text; | ||
} | ||
} |
} | |
|
| |
function drawInfoPoint(xl, yl, nas) { |
function drawInfoPoint(xl, yl, nas) { | |
var ctx = document.getElementById('paint').getContext('2d'); |
xl = parseInt((xl*nas)-7); | |
ctx.drawImage(imginfo,parseInt((xl*nas)-7),parseInt((yl*nas)-7)); |
yl = parseInt((yl*nas)-7); | |
if (navigator.appName=="Microsoft Internet Explorer") { | ||
var ctx = document.getElementById('paint').getContext('2d'); | ||
ctx.drawImage(imginfo,xl,yl); | ||
} else { | ||
var text = '<div style="position:absolute;left:' + xl + 'px;top:' + yl + 'px;width: 14px;height: 14px;background-image: url(\'info.png\');font-size: 0px;cursor: default;" unselectable = "on"></div>'; | ||
titulek = document.getElementById("mapstats_wave"); | ||
titulek.innerHTML = titulek.innerHTML + text; | ||
} | ||
} |
} | |
|
| |
function drawLegend() { |
function drawLegend() { | |
var epsilon; |
var epsilon; | |
var cislo = 0; |
var cislo = 0; | |
Line 890... | Line 944... | |
ctx2.clearRect(0,0,parseInt(full_x * ann),parseInt(full_y * ann)); |
ctx2.clearRect(0,0,parseInt(full_x * ann),parseInt(full_y * ann)); | |
} |
} | |
|
| |
function node2sour(name, pos) { |
function node2sour(name, pos) { | |
var ok = 0; |
var ok = 0; | |
for(k=0;k<node.length;k++){ |
for(k=0;k<nodecount;k++){ | |
if(node[k][0]==name) { |
if(node[k][0]==name) { | |
ok = node[k][pos]; |
ok = node[k][pos]; | |
} |
} | |
if(ok!=0) { return ok; } |
if(ok!=0) { return ok; } | |
} |
} | |
return ok; |
return ok; | |
} |
} | |
|
| |
function ip2sour(ip, pos) { |
function ip2sour(ip, pos) { | |
var ok = 0; |
var ok = 0; | |
for(k=0;k<node.length;k++){ |
for(k=0;k<nodecount;k++){ | |
if(node[k][4]==ip) { |
if(node[k][4]==ip) { | |
ok = node[k][pos]; |
ok = node[k][pos]; | |
} |
} | |
if(ok!=0) { return ok; } |
if(ok!=0) { return ok; } | |
} |
} | |
return ok; |
return ok; | |
} |
} | |
|
| |
function nactiSoubory() { |
function nactiSoubory() { | |
pomocna = getFile(nodes); |
var d = new Date(); | |
pomocna1 = getFile(noping); |
var tm = d.getTime(); | |
pomocna2 = getFile(links); |
pomocna = getFile(nodes + "?" + tm); | |
pomocna3 = getFile(infopoints); |
pomocna1 = getFile(noping + "?" + tm); | |
pomocna4 = getFile(state); |
pomocna2 = getFile(links + "?" + tm); | |
pomocna3 = getFile(infopoints + "?" + tm); | ||
pomocna4 = getFile(state + "?" + tm); | ||
redrawUpdate(); |
redrawUpdate(); | |
} |
} | |
|
| |
function getFile(url) { |
function getFile(url) { | |
AJAX = (window.XMLHttpRequest ? new XMLHttpRequest() : (window.ActiveXObject ? new ActiveXObject("Microsoft.XMLHTTP") : false)); |
AJAX = (window.XMLHttpRequest ? new XMLHttpRequest() : (window.ActiveXObject ? new ActiveXObject("Microsoft.XMLHTTP") : false)); | |
Line 968... | Line 1024... | |
if(document.form_map.ch_status.checked) { ch_status = true; } else { ch_status = false; } |
if(document.form_map.ch_status.checked) { ch_status = true; } else { ch_status = false; } | |
if(document.form_map.ch_backbone.checked) { ch_backbone = true; } else { ch_backbone = false; } |
if(document.form_map.ch_backbone.checked) { ch_backbone = true; } else { ch_backbone = false; } | |
if(document.form_map.ch_client.checked) { ch_client = true; } else { ch_client = false; } |
if(document.form_map.ch_client.checked) { ch_client = true; } else { ch_client = false; } | |
if(document.form_map.ch_inp.checked) { ch_inp = true; } else { ch_inp = false; } |
if(document.form_map.ch_inp.checked) { ch_inp = true; } else { ch_inp = false; } | |
titulek1 = document.getElementById("mapstats_infopoint"); |
titulek1 = document.getElementById("mapstats_infopoint"); | |
titulek1.innerHTML = ""; |
||
titulek2 = document.getElementById("mapstats_name"); |
titulek2 = document.getElementById("mapstats_name"); | |
titulek2.innerHTML = ""; |
||
titulek3 = document.getElementById("mapstats_ip"); |
titulek3 = document.getElementById("mapstats_ip"); | |
titulek3.innerHTML = ""; |
||
titulek4 = document.getElementById("mapstats_status"); |
titulek4 = document.getElementById("mapstats_status"); | |
titulek4.innerHTML = ""; |
||
titulek5 = document.getElementById("mapstats_legend"); |
titulek5 = document.getElementById("mapstats_legend"); | |
titulek6 = document.getElementById("mapstats_wave"); | ||
titulek7 = document.getElementById("mapstats_points"); | ||
titulek1.innerHTML = ""; | ||
titulek2.innerHTML = ""; | ||
titulek3.innerHTML = ""; | ||
titulek4.innerHTML = ""; | ||
titulek5.innerHTML = ""; |
titulek5.innerHTML = ""; | |
titulek6.innerHTML = ""; | ||
titulek7.innerHTML = ""; | ||
clearMap(ann); |
clearMap(ann); | |
canvasInit(ann); |
canvasInit(ann); | |
} | ||
| ||
function deleteNames() { | ||
titulek1 = document.getElementById("mapstats_infopoint"); | ||
titulek2 = document.getElementById("mapstats_name"); | ||
titulek3 = document.getElementById("mapstats_ip"); | ||
titulek4 = document.getElementById("mapstats_status"); | ||
titulek6 = document.getElementById("mapstats_wave"); | ||
titulek7 = document.getElementById("mapstats_points"); | ||
titulek1.innerHTML = ""; | ||
titulek2.innerHTML = ""; | ||
titulek3.innerHTML = ""; | ||
titulek4.innerHTML = ""; | ||
titulek6.innerHTML = ""; | ||
titulek7.innerHTML = ""; | ||
} |
} | |
|
| |
function drawInfo(txt, xa, ya, nas) { |
function drawInfo(txt, xa, ya, nas) { | |
xa = parseInt((xa*nas)+6); |
xa = parseInt((xa*nas)+6); | |
ya = parseInt((ya*nas)-13); |
ya = parseInt((ya*nas)-13); |