2 /* $Id: column.js Panos $ */
4 var filtered_color = "grey";
5 var normal_color = "black";
7 //Descriptions overriding the default ones set in Accessors_site.py and configuration
9 var sourceComon = '<a target="source_window" href="http://comon.cs.princeton.edu/">CoMon</a>';
10 var sourceTophat = '<b><a target="source_window" href="http://www.top-hat.info/">TopHat</a></b>';
11 var sourceTophatAPI = '<b><a target="source_window" href="http://www.top-hat.info/API/">TopHat API</a></b>';
12 var sourceMySlice = '<b><a target="source_window" href="http://myslice.info/">MySlice</a></b>';
13 var sourceCymru = '<b><a target="source_window" href="http://www.team-cymru.org/">Team Cymru</a></b>';
14 var sourceMyPLC = '<b><a target="source_window" href="https://www.planet-lab.eu/db/doc/PLCAPI.php">MyPLC API</a></b>';
15 var sourceManiacs = '<b><a target="source_window" href="http://www.ece.gatech.edu/research/labs/MANIACS/as_taxonomy/">MANIACS</a></b>';
16 var sourceMaxmind = '<b><a target="source_window" href="http://www.maxmind.com/app/geolitecity">MaxMind</a></b>';
17 var sourceMonitor = '<b><a target="source_window" href="http://monitor.planet-lab.org/">Monitor</a></b>';
18 var selectReferenceNode ='Select reference node: <select id="reference_node" onChange="updateDefaultConf(this.value)"><option value=planetlab-europe-07.ipv6.lip6.fr>planetlab-europe-07.ipv6.lip6.fr</option></select>';
19 var addButton = '<input id="addButton" type="button" value="Add" onclick=addColumnAjax(document.getElementById("list1").value)></input>';
20 var deleteButton = '<input id="deleteButton" type="button" value="Delete" onclick=deleteColumn(window.document.getElementById("list1").value)></input>';
22 var descHOSTNAME = "test";
24 var titleA = 'Architecture name';
25 var detailA = '<i>The node architecture.</i>';
26 var sourceA = '<b>Source:</b> '+sourceMyPLC;
27 var valuesA = 'Values: <b>x86_64</b>, <b>i386</b>';
28 var descA = '<span class="myslice title">'+titleA+'</span><p>'+detailA+'<p>'+valuesA+'<p>'+sourceA;
30 var titlef = 'Operating system';
31 var detailf = '<i>Fedora or CentOS distribution to use for node or slivers.</i>';
32 var sourcef = '<b>Source:</b> '+sourceMyPLC;
33 var descf = '<span class="myslice title">'+titlef+'</span><p>'+detailf+'<p>'+sourcef;
35 var titleAU = 'Authority';
36 var detailAU = '<i>The authority of the global PlanetLab federation that the site of the node belongs to.</i>';
37 var valuesAU = 'Values: <b>PLC</b> (PlanetLab Central), <b>PLE</b> (PlanetLab Europe)';
38 var sourceAU = '<b>Source:</b> '+sourceMyPLC;
39 var descAU = '<span class="myslice title">'+titleAU+'</span><p>'+detailAU+'<p>'+valuesAU+'<p>'+sourceAU;
41 var titleAS = 'Autonomous system ID';
42 var sourceAS = 'Source: '+sourceCymru+' (via '+sourceTophat+')';
43 var valuesAS = 'Unit: <b>Integer between 0 and 65535</b>';
44 var descAS = '<span class="myslice title">'+titleAS+'</span><p>'+valuesAS+'<p>' + sourceAS;
46 var titleAST = 'Autonomous system type';
47 var sourceAST = 'Source: '+sourceManiacs;
48 var valuesAST = 'Values: <b>t1</b> (tier-1), <b>t2</b> (tier-2), <b>edu</b> (university), <b>comp</b> (company), <b>nic</b> (network information centre -- old name for a domain name registry operator), <b>ix</b> (IXP), <b>n/a</b>';
49 var descAST = '<span class="myslice title">'+titleAST+'</span><p>'+valuesAST+'<p>'+sourceAST;
51 var titleASN = 'Autonomous system name';
52 var sourceASN = 'Source: '+sourceTophat;
53 var descASN = '<span class="myslice title">'+titleASN+'</span><p>'+sourceASN;
55 var selectPeriodBU = 'Select period: <select id="selectperiodBU" onChange=updatePeriod("BU",this.value)><option value=w>Week</option><option value=m>Month</option><option value=y>Year</option></select>';
56 var titleBU = 'Bandwidth utilization ';
57 var sourceBU = 'Source: '+sourceComon+' (via '+sourceMySlice+')';
58 var valuesBU ='Unit: <b>Kbps</b>';
59 var detailBU = '<i>The average transmited bandwidh over the selected period. The period is the most recent for which data is available, with CoMon data being collected by MySlice daily.</i>'
60 var descBU = '<span class="myslice title">'+titleBU+'</span><p>'+detailBU+'<p>'+selectPeriodBU+'<p>'+valuesBU+'<p>'+sourceBU;
62 var titleBW= 'Bandwidth limit';
63 var sourceBW = 'Source: '+sourceComon;
64 var valuesBW = 'Unit: <b>Kbps</b>';
65 var detailBW = '<i>The bandwidth limit is a cap on the total outbound bandwidth usage of a node. It is set by the site administrator (PI). For more details see <a targe="source_window" href="http://www.planet-lab.org/doc/BandwidthLimits">Bandwidth Limits (planet-lab.org)</a></i>.';
66 var descBW = '<span class="myslice title">'+titleBW+'</span><p>'+detailBW+'<p>'+valuesBW+'<p>'+sourceBW;
68 var titleCC = 'Number of CPU cores';
69 var sourceCC = 'Source: '+sourceComon;
70 var valuesCC = 'Current PlanetLab hardware requirements: 4 cores min. <br><i>(Older nodes may have fewer cores)</i>.';
71 var descCC = '<span class="myslice title">'+titleCC+'</span><p>'+valuesCC+'<p>'+sourceCC;
73 var titleCN = 'Number of CPUs';
74 var sourceCN = 'Source: '+sourceComon;
75 var valuesCN = 'Current PlanetLab hardware requirements: <b>1 (if quad core) or 2 (if dual core)</b>';
76 var descCN = '<span class="myslice title">'+titleCN+'</span><p>'+valuesCN+'<p>'+sourceCN;
78 var titleCR = 'CPU clock rate';
79 var sourceCR = 'Source: '+sourceComon;
80 var valuesCR = 'Unit: <b>GHz</b><p>Current PlanetLab hardware requirements: <b>2.4 GHz</b>';
81 var descCR = '<span class="myslice title">'+titleCR+'</span><p>'+valuesCR+'<p>'+sourceCR;
83 var selectPeriodCF = 'Select period: <select id="selectperiodCF" onChange=updatePeriod("CF",this.value)><option value=w>Week</option><option value=m>Month</option><option value=y>Year</option></select>';
84 var titleCF = 'Free CPU';
85 var sourceCF = 'Source: '+sourceComon+' (via '+sourceMySlice+')';
86 var valuesCF = 'Unit: <b>%</b>';
87 var detailCF = '<i> The average CPU percentage that gets allocated to a test slice named burb that is periodically run by CoMon.</i>';
88 var descCF = '<span class="myslice title">'+titleCF+'</span><p>'+detailCF+'<p>'+selectPeriodCF+'<p>'+valuesCF+'<p>'+sourceCF;
90 var titleDS = 'Disk size';
91 var sourceDS = 'Source: '+sourceComon;
92 var valuesDS = 'Unit: <b>GB</b><p>Current PlanetLab hardware requirements: <b>500 GB</b>';
93 var descDS = '<span class="myslice title">'+titleDS+'</span><p>'+valuesDS+'<p>'+sourceDS;
95 var titleDU = 'Current disk utilization';
96 var sourceDU = 'Source: '+sourceComon+' (via '+sourceMySlice+')';
97 var valuesDU = 'Unit: <b>GB</b>';
98 var detailDU = '<i> The amount of disk space currently consumed (checked daily).</i>';
99 var descDU = '<span class="myslice title">'+titleDU+'</span><p>'+detailDU+'<p>'+valuesDU+'<p>'+sourceDU;
101 var titleHC = 'Hop count (pairwise)';
102 var sourceHC = 'Source: '+sourceTophat;
103 var detailHC = '<i>TopHat conducts traceroutes every five minutes in a full mesh between all PlanetLab nodes. The hop count is the length of the traceroute from the node to the reference node, based upon the most recently reported traceroute</i>.';
104 var descHC = '<span class="myslice title">'+titleHC+'</span><p>'+detailHC+'<p>'+selectReferenceNode+'<p>'+sourceHC;
106 var titleIP = 'IP address';
107 var sourceIP = 'Source: '+sourceTophat;
108 var descIP = '<span class="myslice title">'+titleIP+'</span><p>'+sourceIP;
110 var selectPeriodL = 'Select period: <select id="selectperiodL" onChange=updatePeriod("L",this.value)><option value="">Latest</option><option value=w>Week</option><option value=m>Month</option><option value=y>Year</option></select>';
112 var sourceL = 'Source: '+sourceComon;
113 var valuesL = 'Unit: <b>5-minute load</b>';
114 var detailL = '<i>The average 5-minute load (as reported by the Unix uptime command) over the selected period.</i>';
115 //var descL = '<span class="myslice title">'+titleL+'</span><p>'+detailL+'<p>'+selectPeriodL+'<p>'+valuesL+'<p>'+sourceL;
116 var descL = '<span class="myslice title">'+titleL+'</span><p>'+detailL+'<p>'+valuesL+'<p>'+sourceL;
118 var titleLON= 'Longitude';
119 var sourceLON = 'Source: '+sourceTophat;
120 var descLON = '<span class="myslice title">'+titleLON+'</span><p>'+sourceLON;
122 var titleLAT= 'Latitude';
123 var sourceLAT = 'Source: '+sourceTophat;
124 var descLAT = '<span class="myslice title">'+titleLAT+'</span><p>'+sourceLAT;
126 var titleLCN= 'Location (Country)';
127 var sourceLCN = 'Source: '+sourceMaxmind+' (via '+sourceTophat+')';
128 var detailLCN = '<i>Based on the latitude and longitude information.</i>';
129 var descLCN = '<span class="myslice title">'+titleLCN+'</span><p>'+detailLCN+'<p>'+sourceLCN;
131 var titleLCT= 'Location (Continent)';
132 var sourceLCT = 'Source: '+sourceMaxmind+' (via '+sourceTophat+')';
133 var detailLCT = '<i>Based on the latitude and longitude information.</i>';
134 var descLCT = '<span class="myslice title">'+titleLCT+'</span><p>'+detailLCT+'<p>'+sourceLCT;
136 var titleLCY= 'Location (City)';
137 var sourceLCY = 'Source: '+sourceMaxmind+' (via '+sourceTophat+')';
138 var detailLCY = '<i>Based on the latitude and longitude information.</i>';
139 var descLCY = '<span class="myslice title">'+titleLCY+'</span><p>'+detailLCY+'<p>'+sourceLCY;
141 var titleLPR= 'Location precision radius';
142 var sourceLPR = 'Source: '+sourceTophat;
143 var valuesLPR = 'Unit: <b>float</b>';
144 var detailLPR = '<i>The radius of the circle corresponding to the error in precision of the geolocalization estimate.</i>';
145 var descLPR = '<span class="myslice title">'+titleLPR+'</span><p>'+detailLPR+'<p>'+valuesLPR+'<p>'+sourceLPR;
147 var titleLRN= 'Location (Region)';
148 var sourceLRN = 'Source: '+sourceMaxmind+' (via '+sourceTophat+')';
149 var detailLRN = '<i>Based on the latitude and longitude information.</i>';
150 var descLRN = '<span class="myslice title">'+titleLRN+'</span><p>'+detailLRN+'<p>'+sourceLRN;
152 var titleMS= 'Memory size';
153 var sourceMS = 'Source: '+sourceComon;
154 var valuesMS = 'Unit: <b>GB</b><p>Current PlanetLab hardware requirements: <b>4 GB</b>.';
155 var descMS = '<span class="myslice title">'+titleMS+'</span><p>'+valuesMS+'<p>'+sourceMS;
157 var selectPeriodMU = 'Select period: <select id="selectperiodMU" onChange=updatePeriod("MU",this.value)><option value=w>Week</option><option value=m>Month</option><option value=y>Year</option></select>';
158 var titleMU = 'Memory utilization';
159 var sourceMU = 'Source: '+sourceComon;
160 var valuesMU = '<p>Unit: <b>%</b>';
161 var detailMU = '<i>The average active memory utilization as reported by CoMon.</i>';
162 var descMU = '<span class="myslice title">'+titleMU+'</span><p>'+detailMU+'<p>'+selectPeriodMU+'<p>'+valuesMU+'<p>'+sourceMU;
164 var titleNEC= 'Network information (ETOMIC)';
165 var sourceNEC = 'Source: '+sourceTophat;
166 var valuesNEC = 'Values: <b>yes/no</b>';
167 var detailNEC = '<i>The existence of a colocated ETOMIC box. When an ETOMIC box is present, you have the possibility to conduct high-precision measurements through the '+sourceTophatAPI+'.</i>';
168 var descNEC = '<span class="myslice title">'+titleNEC+'</span><p>'+detailNEC+'<p>'+valuesNEC+'<p>'+sourceNEC;
170 var titleNSN= 'Network information (SONoMA)';
171 var sourceNSN = 'Source: '+sourceTophat;
172 var valuesNSN = 'Values: <b>yes/no</b>';
173 var detailNSN = '<i>The existence of a SONoMA agent. When an SONoMA is present, you have the possibility to have access to high-precision measurements through the '+sourceTophatAPI+'.</i>';
174 var descNSN = '<span class="myslice title">'+titleNSN+'</span><p>'+detailNSN+'<p>'+valuesNSN+'<p>'+sourceNSN;
176 var titleNTH= 'Network information (TopHat)';
177 var sourceNTH = 'Source: '+sourceTophat;
178 var valuesNTH = 'Values: <b>yes/no</b>';
179 var detailNTH = '<i>The existence of a colocated TDMI (TopHat Dedicated Measurement Infrastructure) agent. When a TDMI agent is present, you have access to a wide variety of network topology measurements through the '+sourceTophatAPI+'.</i>';
180 var descNTH = '<span class="myslice title">'+titleNTH+'</span><p>'+detailNTH+'<p>'+valuesNTH+'<p>'+sourceNTH;
182 var titleNDS= 'Network information (DIMES)';
183 var sourceNDS = 'Source: '+sourceTophat;
184 var valuesNDS = 'Values: <b>yes/no</b>';
185 var detailNDS = '<i>The existence of a colocated DIMES agent. When a DIMES agent is present, you have access to DIMES measurements through the '+sourceTophatAPI+'.</i>';
186 var descNDS = '<span class="myslice title">'+titleNDS+'</span><p>'+detailNDS+'<p>'+valuesNDS+'<p>'+sourceNDS;
188 var titleNSF= 'Network information (spoof)';
189 var sourceNSF = 'Source: '+sourceTophat;
190 var valuesNSF = '<p>Values: <b>yes/no</b>';
191 var detailNSF = '<i> Whether the node can send packets successfully (or not) with a spoofed IP source address.</i>';
192 var descNSF = '<span class="myslice title">'+titleNSF+'</span><p>'+detailNSF+'<p>'+valuesNSF+'<p>'+sourceNSF;
194 var titleNSR= 'Network information (source route)';
195 var sourceNSR = 'Source: '+sourceTophat;
196 var valuesNSR = '<p>Values: <b>yes/no</b>';
197 var detailNSR = '<i> Whether the node can send packets packets using the IP source route option. See <a target="info_window" href="http://www.networksorcery.com/enp/protocol/ip/option003.htm">here</a>for more info.</i>';
198 var descNSR = '<span class="myslice title">'+titleNSR+'</span><p>'+detailNSR+'<p>'+valuesNSR+'<p>'+sourceNSR;
200 var titleNTP= 'Network information (timestamp)';
201 var sourceNTP = 'Source: '+sourceTophat;
202 var valuesNTP = '<p>Values: <b>yes/no</b>';
203 var detailNTP = '<i> Whether the node can send packets packets using the IP timestamp option. See <a target="info_window" href="http://www.networksorcery.com/enp/protocol/ip/option004.htm">here</a>for more info.</i>';
204 var descNTP = '<span class="myslice title">'+titleNTP+'</span><p>'+detailNTP+'<p>'+valuesNTP+'<p>'+sourceNTP;
206 var titleNRR= 'Network information (record route)';
207 var sourceNRR = 'Source: '+sourceTophat;
208 var valuesNRR = '<p>Values: <b>yes/no</b>';
209 var detailNRR = '<i> Whether the node can send packets packets using the IP record route option. See <a target="info_window" href="http://www.networksorcery.com/enp/protocol/ip/option007.htm">here</a>for more info.</i>';
210 var descNRR = '<span class="myslice title">'+titleNRR+'</span><p>'+detailNRR+'<p>'+valuesNRR+'<p>'+sourceNRR;
212 var titleOS = 'Operating system';
213 var sourceOS = 'Source: '+sourceMyPLC;
214 var valuesOS = 'Values: <b>Fedora, Cent/OS, other, n/a</b>';
215 var descOS = '<span class="myslice title">'+titleOS+'</span><p>'+valuesOS+'<p>'+sourceOS;
217 var selectPeriodR = 'Select period: <select id="selectperiodR" onChange=updatePeriod("R",this.value)><option value="">Latest</option><option value=w>Week</option><option value=m>Month</option><option value=y>Year</option></select>';
218 var titleR = 'Reliability';
219 var sourceR = 'Source: '+sourceComon+' (via '+sourceMySlice+')';
220 var detailR = '<i>CoMon queries nodes every 5 minutes, for 255 queries per day. The average reliability is the percentage of queries over the selected period for which CoMon reports a value. The period is the most recent for which data is available, with CoMon data being collected by MySlice daily.</i>';
221 var valuesR = 'Unit: <b>%</b>';
222 var descR = '<span class="myslice title">'+titleR+'</span><p>'+detailR+'<p>'+selectPeriodR+'<p>'+valuesR+'<p>'+sourceR;
223 //var descR = '<span class="myslice title">'+titleR+'</span><p>'+detailR+'<p>'+valuesR+'<p>'+sourceR;
225 var titleRES = 'Reservation capabilities';
226 var sourceRES = 'Source: '+sourceMyPLC;
227 //var valuesRES = 'Values: <b>yes/no</b>';
228 var valuesRES = 'Values: <b>-R-</b> (if yes)';
229 var detailRES = '<i> Whether the node can be reserved for a certain duration.<br>Your slivers will be available <span class=bold>only during timeslots where you have obtained leases (see tab above)</span></i>. <p>Please note that as of August 2010 this feature is experimental. Feedback is appreciated at <a href="mailto:devel@planet-lab.org">devel@planet-lab.org</a>';
230 var descRES = '<span class="myslice title">'+titleRES+'</span><p>'+detailRES+'<p>'+valuesRES+'<p>'+sourceRES;
232 var selectPeriodS = 'Select period: <select id="selectperiodS" onChange=updatePeriod("S",this.value)><option value=w>Week</option><option value=m>Month</option><option value=y>Year</option></select>';
233 var titleS = 'Active slices';
234 var sourceS = 'Source: '+sourceComon+' (via '+sourceMySlice+')';
235 var valuesS = 'Unit: <b>%</b>';
236 var detailS = '<i>Average number of active slices over the selected period for which CoMon reports a value. The period is the most recent for which data is available, with CoMon data being collected by MySlice daily.</i>';
237 var descS = '<span class="myslice title">'+titleS+'</span><p>'+detailS+'<p>'+selectPeriodS+'<p>'+valuesS+'<p>'+sourceS;
239 var titleSN = 'Site name';
240 var sourceSN = 'Source: '+sourceMyPLC;
241 var descSN = '<span class="myslice title">'+titleSN+'</span><p>'+sourceSN;
243 var selectPeriodSSH = 'Select period: <select id="selectperiodSSH" onChange=updatePeriod("SSH",this.value)><option value=w>Week</option><option value=m>Month</option><option value=y>Year</option></select>';
244 var titleSSH = 'Average SSH response delay';
245 var valuesSSH = 'Unit: <b>%</b>';
246 var detailSSH = '<i>The average response delay of the node to SSH logins over the selected period for which CoMon reports a value. The period is the most recent for which data is available, with CoMon data being collected by MySlice daily.</i>';
247 var sourceSSH ='Source: '+sourceComon+' (via '+sourceMySlice+')';
248 var descSSH = '<span class="myslice title">'+titleSSH+'</span><p>'+detailSSH+'<p>'+selectPeriodSSH+'<p>'+valuesSSH+'<p>'+sourceSSH;
250 var titleST = 'Status';
251 var sourceST = 'Source: '+sourceMonitor;
252 var valuesST = 'Values: <b>online</b> (up and running), <b>good</b> (up and running recently), <b>offline</b> (unreachable today), <b>down</b> (node unreachable for more than one day), <b>failboot</b> (reachable, but only by administrators for debugging purposes).';
253 var descST = '<span class="myslice title">'+titleST+'</span><p>'+valuesST+'<p>'+sourceST;
256 //Categorization of columns in different types, useful for filtering
258 function inTypeA(header_name) {
259 var typeA = ['ST','SN','RES','OS','NRR','NTP','NSR','NSF','NDS','NTH','NEC','LRN','LCY','LPR','LCN','LAT','LON','IP','ASN','AST'];
260 return typeA.indexOf(header_name);
263 function inTypeB(header_name) {
264 var typeB = ['BW','DS','MS','CC','CR','AS','MU','DU','CN'];
265 return typeB.indexOf(header_name);
268 function inTypeC(header_name) {
269 var typeC = ['Rw','Rm','Ry','BWw','BWm','BWy','Lw','Lm','Ly','Sw','Sm','Sy','CFw','CFm','CFy','BUw','BUm','BUy','MUw','MUm','MUy','SSHw','SSHm','SSHy'];
270 return typeC.indexOf(header_name);
273 function inTypeD(header_name) {
275 return typeD.indexOf(header_name);
280 function debugfilter(s) {
281 document.getElementById('debug').innerHTML+=s;
285 //Called when a column is selected. It displays the detailed description
288 function highlightOption(divid) {
290 //debugfilter("highlighting option "+divid);
292 var columns = document.getElementsByName('columnlist');
293 for(var j = 0; j < columns.length; j++)
294 columns[j].className = 'out';
296 document.getElementById(divid).className = 'selected';
298 showDescription(divid);
301 if (document.getElementById('selectperiod'+divid))
302 document.getElementById('selectperiod'+divid).value = document.getElementById('period'+divid).value;
307 //Displays the detailed column description
309 function showDescription(h) {
311 //debugfilter("showing description "+h);
313 //Checks if the detailed description div exists
314 if (document.getElementById('selectdescr'))
316 //Checks if there is a detailed description defined
317 if (window['desc'+h])
318 document.getElementById('selectdescr').innerHTML = ""+window['desc'+h];
319 //else if (document.getElementById('fdesc'+h))
320 //document.getElementById('selectdescr').innerHTML = document.getElementById('fdesc'+h).value;
322 document.getElementById('selectdescr').innerHTML = "No detailed description provided";
327 //Overrides the titles of the columns as they are shown in the column selection panel.
328 //If no overriding variable exists the tag's description is used
329 function overrideTitles() {
331 var columns = document.getElementsByName('columnlist');
333 for(var j = 0; j < columns.length; j++)
335 var kk = columns[j].id;
336 if (window['title'+kk])
337 document.getElementById('htitle'+kk).innerHTML = window['title'+kk];
341 //When the checkbox is clicked. Adds/removes column respectively
342 function changeCheckStatus(column) {
344 if (document.getElementById('selectdescr'))
345 showDescription(document.getElementById(column).value);
347 if (document.getElementById(column).checked)
348 addColumn(document.getElementById(column).value, true);
350 deleteColumn(document.getElementById(column).value);
353 //This function is used when the alternative "quick" selection list is used
354 function changeSelectStatus(column) {
356 var optionClass = "";
357 var selected_index = document.getElementById('quicklist').selectedIndex;
359 if (document.getElementById('quicklist'))
362 optionClass = document.getElementById('quicklist').options[selected_index].className;
364 if (optionClass == "in")
366 deleteColumn(document.getElementById('quicklist').value);
367 document.getElementById('quicklist').options[selected_index].className = "out";
371 addColumn(document.getElementById('quicklist').value, true);
372 document.getElementById('quicklist').options[selected_index].className = "in";
377 //When the period of an already selected column is changed
378 function updatePeriod(h, new_period) {
380 var old_period = document.getElementById('period'+h).value;
381 document.getElementById('period'+h).value=new_period;
383 //debugfilter(h+''+old_period+'-'+h+''+new_period);
384 if (document.getElementById('check'+h).checked)
386 deleteColumnCells(h+''+old_period);
387 addColumnCells(h+''+new_period);
388 addColumnAjax(h, h+''+new_period);
390 replaceColumnConfiguration(h+''+old_period,h+''+new_period);
396 RESET/SAVE CONFIGURATION
399 function getHTTPObject()
401 if (typeof XMLHttpRequest != 'undefined')
402 { return new XMLHttpRequest(); }
405 { return new ActiveXObject("Msxml2.XMLHTTP"); }
408 try { return new ActiveXObject("Microsoft.XMLHTTP"); }
415 function closeShowReservable()
417 var slice_id = document.getElementById('slice_id').value;
418 var person_id = document.getElementById('person_id').value;
419 var tag_id = document.getElementById('show_tag_id').value;
420 document.getElementById('note_reservable_div').style.display = "none";
422 var url = "/plekit/php/updateConfiguration.php?value="+slice_id+";reservable:no&slice_id="+slice_id+"&person_id="+person_id+"&tag_id="+tag_id;
424 var req = getHTTPObject();
425 req.open('GET', url, true);
426 req.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
427 req.onreadystatechange =
429 if (req.readyState == 4)
430 { debugfilter(req.responseText); }
437 function updateColumnConfiguration(slice_id, value, reload)
439 var person_id = document.getElementById('person_id').value;
440 var tag_id = document.getElementById('conf_tag_id').value;
441 var full_column_configuration = document.getElementById('full_column_configuration').value;
443 //debugfilter("<br>OLD = "+full_column_configuration);
444 //debugfilter("<br>value = "+value);
446 var old_columns = full_column_configuration.split(";");
447 var new_columns = new Array();
449 for (var column_index = 0; column_index < old_columns.length ; column_index++) {
450 new_columns.push(old_columns[column_index]);
451 if (old_columns[column_index] != slice_id)
452 new_columns.push(old_columns[++column_index]);
456 new_columns.push(value);
460 var new_configuration = new_columns.join(";");
461 //debugfilter("<br>NEW = "+new_configuration);
463 if (window.XMLHttpRequest)
464 {// code for IE7+, Firefox, Chrome, Opera, Safari
465 xmlhttp=new XMLHttpRequest();
468 {// code for IE6, IE5
469 xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
471 xmlhttp.onreadystatechange=function()
473 if (xmlhttp.readyState==4) // && xmlhttp.status==200)
475 //value=xmlhttp.responseText;
476 //debugfilter(value+"-----"+new_configuration);
477 document.getElementById('column_configuration').value=value;
478 document.getElementById('full_column_configuration').value=new_configuration;
481 window.location.reload(true);
485 xmlhttp.open("GET","/plekit/php/updateConfiguration.php?value="+new_configuration+"&slice_id="+slice_id+"&person_id="+person_id+"&tag_id="+tag_id,true);
486 //xmlhttp.open("GET","/plekit/php/updateConf.php?value="+value+"&slice_id="+slice_id+"&person_id="+person_id+"&tagName=Columnconf",true);
491 function logSortingAction(slice_id, value)
494 if (value.indexOf("column-1")!=-1)
497 var req = getHTTPObject();
498 var url = "/plekit/php/logSorting.php?value="+value+"&slice_id="+slice_id;
500 req.open('GET', url, true);
501 req.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
502 req.onreadystatechange =
504 if (req.readyState == 4)
505 { debugfilter(req.responseText); }
510 function sortCompleteCallback(tableid) {
512 var slice_id = document.getElementById('slice_id').value;
514 var ths = document.getElementById(tableid).getElementsByTagName("th");
515 for(var i = 0, th; th = ths[i]; i++) {
516 if (th.className.indexOf("Sort") != -1)
518 var column = th.className.substr(th.className.indexOf("column"),th.className.indexOf("column")+1);
519 var sortdirection = th.className.substr(th.className.indexOf("Sort")-8,th.className.indexOf("Sort"));
520 logSortingAction(slice_id, tableid+"|"+column+"|"+sortdirection);
526 function addColumnToConfiguration(column) {
528 var old_configuration = document.getElementById('column_configuration').value;
529 var slice_id = document.getElementById('slice_id').value;
531 var new_configuration = "";
533 if (old_configuration != "")
534 new_configuration = old_configuration += "|"+column;
536 new_configuration = column;
538 //debugfilter("new configuration = "+new_configuration);
540 updateColumnConfiguration(slice_id, new_configuration, false);
544 function deleteColumnFromConfiguration(column) {
546 var old_configuration = document.getElementById('column_configuration').value;
547 var slice_id = document.getElementById('slice_id').value;
549 var old_columns = old_configuration.split("|");
550 var new_columns = new Array();
552 for (var column_index = 0; column_index < old_columns.length ; column_index++) {
553 var conf = old_columns[column_index].split(':');
554 if (conf[0] != column)
555 new_columns.push(old_columns[column_index]);
558 var new_configuration = new_columns.join("|");
559 updateColumnConfiguration(slice_id, new_configuration, false);
563 function replaceColumnConfiguration(column_old, column_new) {
565 var old_configuration = document.getElementById('column_configuration').value;
566 var slice_id = document.getElementById('slice_id').value;
568 var old_columns = old_configuration.split("|");
569 var new_columns = new Array();
571 for (var column_index = 0; column_index < old_columns.length ; column_index++) {
572 var conf = old_columns[column_index].split(':');
573 if (conf[0] != column_old)
574 new_columns.push(old_columns[column_index]);
576 new_columns.push(column_new);
579 var new_configuration = new_columns.join("|");
581 updateColumnConfiguration(slice_id, new_configuration);
593 function load_data(column, header, url) {
595 //debugfilter("<br>loading "+url);
596 var req = getHTTPObject();
598 req.open('GET', url, true);
599 req.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
600 req.onreadystatechange =
602 if (req.readyState == 4)
603 { updateColumnData(column, header, req.responseText); }
609 function updateColumnData(column, header, data) {
611 var headers = header.split("|");
612 var data_table = data.split("|");
614 //debugfilter("<p>headers[0] = "+headers[0]);
615 //debugfilter("<p>sample line = "+data_table[2]);
620 var table_id1 = 'nodes';
621 var table=$(table_id1);
622 var css='#'+table_id1+'>tbody';
623 var rows = $$(css)[0].rows;
625 var data_array1 = new Array();
627 //debugfilter("COLUMN "+column+"<p>");
629 for (var node_index = 1; node_index < data_table.length; node_index++) {
630 if (data_table[node_index] == '---potential---')
632 node_data = data_table[node_index].split(':');
634 data_array1[node_data[0]] = new Array();
636 for (var h_index=0; h_index < headers.length; h_index++) {
638 if (node_data[h_index+1] == "")
639 data_array1[node_data[0]][h_index] = "n/a";
641 data_array1[node_data[0]][h_index] = node_data[h_index+1];
647 for (var row_index = 0; row_index < rows.length ; row_index++) {
648 var tr=rows[row_index];
650 for (var column_index=0; column_index < tr.cells.length; column_index++) {
651 //debugfilter("<p>node id = "+tr.cells[0].innerHTML+" - "+tr.cells[column_index].getAttribute('name'));
652 if (tr.cells[column_index].getAttribute('name'))
654 var found_index = headers.indexOf(tr.cells[column_index].getAttribute('name'));
655 if (found_index != -1)
656 //debugfilter(tr.cells[0].innerHTML+"-"+found_index);
657 tr.cells[column_index].innerHTML = data_array1[tr.cells[0].innerHTML][found_index];
662 fdTableSort.init(table_id1);
663 tablePaginater.init(table_id1);
666 if (data_table[node_index] == '---potential---')
669 var table_id2 = 'add_nodes';
670 var table2=$(table_id2);
671 var css2='#'+table_id2+'>tbody';
672 var rows2 = $$(css2)[0].rows;
674 var data_array2 = new Array();
676 //debugfilter("COLUMN "+column+"<p>");
678 for (; node_index < data_table.length; node_index++) {
679 if (data_table[node_index] == '')
681 node_data = data_table[node_index].split(':');
683 data_array2[node_data[0]] = new Array();
685 for (var h_index=0; h_index < headers.length; h_index++) {
687 if (node_data[h_index+1] == "")
688 data_array2[node_data[0]][h_index] = "n/a";
690 data_array2[node_data[0]][h_index] = node_data[h_index+1];
695 for (var row_index = 0; row_index < rows2.length ; row_index++) {
696 var tr=rows2[row_index];
698 for (var column_index=0; column_index < tr.cells.length; column_index++) {
699 if (tr.cells[column_index].getAttribute('name'))
701 var found_index = headers.indexOf(tr.cells[column_index].getAttribute('name'));
702 if (found_index != -1)
703 tr.cells[column_index].innerHTML = data_array2[tr.cells[0].innerHTML][found_index];
708 //fdTableSort.removeTableCache(table_id2);
709 fdTableSort.init(table_id2);
710 tablePaginater.init(table_id2);
714 document.getElementById('loading'+column).innerHTML = "";
719 function addColumnCells(header) {
721 var cells = document.getElementsByName(header);
723 //debugfilter("got cells -"+cells+"- for "+header);
724 for(var j = 0; j < cells.length; j++)
725 cells[j].style.display = "table-cell";
728 function addSampleCells(column) {
730 var cellsheader = document.getElementsByName("confheader"+column);
731 for(var j = 0; j < cellsheader.length; j++)
732 cellsheader[j].style.display = "table-cell";
736 function addColumnAjax(column, header) {
738 //var t = document.getElementById('check'+column).name;
739 var t = document.getElementById('tagname'+header).value;
740 var slice_id = document.getElementById('slice_id').value;
742 var selectedperiod = document.getElementById('period'+column).value;
744 var fetched = document.getElementById('fetched'+column).value;
747 //debugfilter("<br>adding "+column+","+header+','+fetched+','+t);
749 if (fetched.indexOf("false")!=-1)
752 document.getElementById('fetched'+column).value = ','+selectedperiod+',true';
754 else if (fetched.indexOf(','+selectedperiod+',')==-1)
757 document.getElementById('fetched'+column).value = ','+selectedperiod+''+fetched;
762 document.getElementById('loading'+column).innerHTML = "<img width=10 src=/plekit/icons/ajax-loader.gif>";
763 var url = "/plekit/php/updateColumn.php?slice_id="+slice_id+"&tagName="+t;
764 load_data(column, header, url);
770 function addColumn(column, fetch) {
772 var selectedperiod="";
775 if (inTypeC(column)!=-1)
777 column = column.substring(0,column.length-1);
780 selectedperiod = document.getElementById('period'+column).value;
781 header = column+""+selectedperiod;
783 //debugfilter("adding column "+column+" and header "+header);
785 addColumnCells(header);
788 addColumnAjax(column, header);
790 addColumnToConfiguration(header);
795 function deleteColumnCells(header) {
797 var cells = document.getElementsByName(header);
798 for(var j = 0; j < cells.length; j++)
799 cells[j].style.display = "none";
805 function deleteColumn(column) {
807 var selectedperiod="";
810 selectedperiod = document.getElementById('period'+column).value;
811 header = column+""+selectedperiod;
813 //debugfilter("deleting "+column+","+header);
815 deleteColumnCells(header);
817 deleteColumnFromConfiguration(header);
819 //document.getElementById('check'+column).checked = false;
827 //to be used for scrolling the column list with down/up arrows
829 function scrollList(tableid) {
833 if (event.keyCode == 40)
835 else if (event.keyCode == 38)
840 function resetColumns() {
842 for (var kk in column_table) {
844 if (column_table[kk]['visible'] == true && column_table[kk]['fetch'] == false)
846 else if (column_table[kk]['visible'] == false && column_table[kk]['fetch'] == true)
852 function resetCols(which_conf) {
854 var target_configuration = "|"+document.getElementById(which_conf).value+"|";
856 //debugfilter("<p>Target configuration = "+target_configuration);
858 for (var kk in column_table) {
859 //debugfilter("in "+kk+" ");
861 if (target_configuration.indexOf("|"+kk+"|")>=0)
863 if (document.getElementById('check'+kk))
864 if (document.getElementById('check'+kk).checked == false)
866 debugfilter("<p>Adding "+kk);
872 if (document.getElementById('check'+kk))
873 if (document.getElementById('check'+kk).checked == true)
875 debugfilter("<p>Deleting "+kk);
882 function filterByType(selectedtype) {
884 var notselectedyet = true;
886 for (var kk in column_headers) {
888 if (document.getElementById(kk))
890 if (window['type'+kk] == selectedtype)
892 document.getElementById(kk).className = 'in';
895 notselectedyet = false;
898 document.getElementById(kk).className = 'out';
904 function deleteColumnSample() {
905 var cellsheader = document.getElementsByName("confheader"+column);
906 for(var j = 0; j < cellsheader.length; j++)
907 cellsheader[j].style.display = "none";
911 function checkDataToFetch() {
913 var dataExist = false;
915 for (var kk in column_table) {
917 if (document.getElementById(kk))
919 if (column_table[kk]['visible'] == true && column_table[kk]['fetch'] == false)
921 document.getElementById('fetchbutton').disabled = false;
922 document.getElementById('fetchbutton').style.color = 'red';
930 document.getElementById('fetchbutton').disabled = true;
931 document.getElementById('fetchbutton').style.color = 'grey';
937 function fetchData() {
942 for (var kk in column_table) {
944 if (column_table[kk]['visible'] == true && column_table[kk]['fetch'] == false)
947 tagnames = column_table[kk]['tagname'];
952 tagnames += "|"+column_table[kk]['tagname'];
957 //debugfilter("fetching these columns: "+tagnames+ "("+headers+")");
959 var slice_id = document.getElementById('slice_id').value;
960 document.getElementById('loadingDiv').innerHTML = " <img src=/plekit/icons/ajax-loader.gif> Loading data. Please wait ...";
961 var url = "/plekit/php/updateColumn.php?slice_id="+slice_id+"&tagName="+tagnames;
962 load_data(headers, url);
973 function updateColumnThreshold(column, minT, maxT) {
975 debugfilter("updating threshold for "+column+" with "+minT+" and "+maxT);
977 var cells = document.getElementsByName(column);
979 for(var j = 0; j < cells.length; j++)
981 var val = parseFloat(cells[j].innerHTML);
983 if (val >= minT && val <= maxT)
984 cells[j].style.color = filtered_color;
986 cells[j].style.color = normal_color;
989 var old_configuration = document.getElementById('column_configuration').value;
990 var slice_id = document.getElementById('slice_id').value;
992 var old_columns = old_configuration.split("|");
993 var new_columns = new Array();
995 for (var column_index = 0; column_index < old_columns.length ; column_index++) {
996 var conf = old_columns[column_index].split(':');
997 if (conf[0] != column)
998 new_columns.push(old_columns[column_index]);
1000 new_columns.push(column+":"+minT+","+maxT);
1003 var new_configuration = new_columns.join("|");
1005 updateColumnConfiguration(slice_id, new_configuration);
1009 function updateExcludeList(column, excludeList) {
1011 //debugfilter("updating list");
1012 debugfilter("updating list for "+column+" with "+excludeList);
1014 var cells = document.getElementsByName(column);
1016 for(var j = 1; j < cells.length; j++)
1018 var val = cells[j].innerHTML;
1020 if (excludeList == val)
1021 cells[j].style.color = filtered_color;
1023 cells[j].style.color = normal_color;
1026 var old_configuration = document.getElementById('column_configuration').value;
1027 var slice_id = document.getElementById('slice_id').value;
1029 var old_columns = old_configuration.split("|");
1030 var new_columns = new Array();
1032 for (var column_index = 0; column_index < old_columns.length ; column_index++) {
1033 var conf = old_columns[column_index].split(':');
1034 if (conf[0] != column)
1035 new_columns.push(old_columns[column_index]);
1037 new_columns.push(column+":"+excludeList);
1040 var new_configuration = new_columns.join("|");
1042 updateColumnConfiguration(slice_id, new_configuration);
1053 function plekit_table_showAll (slicetable_id) {
1055 var table=$(slicetable_id);
1056 var css='#'+slicetable_id+'>tbody';
1057 var rows = $$(css)[0].rows;
1059 // scan rows, elaborate 'visible'
1060 for (var row_index = 0; row_index < rows.length ; row_index++) {
1061 var tr=rows[row_index];
1063 plekit_table_row_visible(tr,visible);
1066 plekit_table_count_filtered(slicetable_id);
1068 tablePaginater.init(slicetable_id);
1072 function plekit_table_count_filtered (slicetable_id) {
1073 var table=$(slicetable_id);
1074 var css='#'+slicetable_id+'>tbody';
1075 var rows = $$(css)[0].rows;
1079 // scan rows, elaborate 'visible'
1080 for (var row_index = 0; row_index < rows.length ; row_index++) {
1081 var tr=rows[row_index];
1082 var filtered = false;
1084 for (var column_index=0; column_index < tr.cells.length; column_index++)
1085 if (tr.cells[column_index].style.color == "red")
1093 debugfilter(no_filtered+' nodes do not satisfy the requested threshold');
1097 function plekit_table_hide_filtered (slicetable_id) {
1098 var table=$(slicetable_id);
1099 var css='#'+slicetable_id+'>tbody';
1100 var rows = $$(css)[0].rows;
1102 var reg = /(^|\s)invisibleRow(\s|$)/;
1105 if (!document.getElementById('filtercheck').checked)
1107 plekit_table_showAll(slicetable_id);
1113 // scan rows, elaborate 'visible'
1114 for (var row_index = 0; row_index < rows.length ; row_index++) {
1115 var tr=rows[row_index];
1118 for (var column_index=0; column_index < tr.cells.length; column_index++) {
1119 if (tr.cells[column_index].style.color == filtered_color)
1125 plekit_table_row_visible(tr,visible);
1128 //debugfilter('hidden '+hidden+' nodes');
1129 debugfilter(hidden+' nodes do not satisfy the requested threshold (hidden)');
1131 tablePaginater.init(slicetable_id);
1137 function plekit_table_apply_config(slicetable_id, configuration) {
1139 var new_configuration = document.getElementById('new_conf').value;
1140 var all_columns = new_configuration.split("|");
1142 var min_values = new Array();
1143 var max_values = new Array();
1146 for (var column_index = 0; column_index < all_columns.length ; column_index++) {
1148 var conf = all_columns[column_index].split(':');
1150 if (inTypeB(conf[0]) != -1)
1152 var threshold = conf[1].split(',');
1153 if (threshold.length == 2)
1155 min_values.push(parseFloat(threshold[0]));
1156 max_values.push(parseFloat(threshold[1]));
1159 else if (inTypeC(conf[0]) == -1)
1161 var threshold = conf[2].split(',');
1162 if (threshold.length == 2)
1164 min_values.push(parseInt(threshold[0]));
1165 max_values.push(parseInt(threshold[1]));
1170 min_values.push(-1);
1171 max_values.push(-1);
1176 var table=$(slicetable_id);
1177 var css='#'+slicetable_id+'>tbody';
1178 var rows = $$(css)[0].rows;
1183 for (var row_index = 0; row_index < rows.length ; row_index++) {
1185 var tr=rows[row_index];
1187 var filtered = false;
1189 for (var column_index = 0; column_index < all_columns.length ; column_index++)
1190 if (min_values[column_index]!=-1)
1192 var val = parseFloat(tr.cells[3+column_index].innerHTML);
1194 if (val >= min_values[column_index] && val <= max_values[column_index])
1196 tr.cells[3+column_index].style.color = filtered_color;
1200 tr.cells[3+column_index].style.color = normal_color;
1203 if (tr.cells[3+column_index].style.color == filtered_color)
1211 debugfilter(no_filtered+' nodes do not satisfy the requested threshold');
1213 //tablePaginater.init(slicetable_id);
1218 function reset_select () {
1219 var table=$(slicetable_id);
1220 var css='#'+slicetable_id+'>tbody';
1221 var rows = $$(css)[0].rows;
1223 var action = document.getElementById('onlyselected');
1224 action.checked=false;
1226 // scan rows, elaborate 'visible'
1227 for (var row_index = 0; row_index < rows.length ; row_index++) {
1228 var tr=rows[row_index];
1230 document.getElementById("check"+tr.id).checked=false;
1234 plekit_table_count_nodes();
1240 function plekit_table_select_filter () {
1241 var table=$(slicetable_id);
1242 var css='#'+slicetable_id+'>tbody';
1243 var rows = $$(css)[0].rows;
1245 var reg = /(^|\s)invisibleRow(\s|$)/;
1247 var action = document.getElementById('onlyselected');
1248 if (!action.checked)
1249 plekit_table_reset_filter();
1251 // scan rows, elaborate 'visible'
1252 for (var row_index = 0; row_index < rows.length ; row_index++) {
1253 var tr=rows[row_index];
1258 if(tr.className.search(reg) == -1)
1259 if(!document.getElementById("check"+tr.id).checked)
1263 if(tr.className.search(reg) != -1)
1266 plekit_table_row_visible(tr,visible);
1269 tablePaginater.init(slicetable_id);
1270 plekit_table_count_nodes();
1273 function plekit_table_select_filter2 () {
1274 var table=$(slicetable_id);
1275 var css='#'+slicetable_id+'>tbody';
1276 var rows = $$(css)[0].rows;
1278 var reg = /(^|\s)invisibleRow(\s|$)/;
1280 var action = document.getElementById('onlyselected');
1282 // scan rows, elaborate 'visible'
1283 for (var row_index = 0; row_index < rows.length ; row_index++) {
1284 var tr=rows[row_index];
1289 if(tr.className.search(reg) == -1)
1290 if(!document.getElementById("check"+tr.id).checked)
1294 if(tr.className.search(reg) != -1)
1297 plekit_table_row_visible(tr,visible);
1300 tablePaginater.init(slicetable_id);
1301 plekit_table_count_nodes();
1304 function CheckTopNodes(n) {
1305 var table=$(slicetable_id);
1306 var css='#'+slicetable_id+'>tbody';
1307 var rows = $$(css)[0].rows;
1308 var reg = /(^|\s)invisibleRow(\s|$)/;
1312 for (var row_index = 0; row_index < rows.length ; row_index++) {
1313 var tr=rows[row_index];
1315 if(tr.className.search(reg) == -1) {
1318 document.getElementById("check"+tr.id).checked=true;
1323 document.getElementById("check"+tr.id).checked=false;
1330 function CheckRandomNodes(n) {
1331 var table=$(slicetable_id);
1332 var css='#'+slicetable_id+'>tbody';
1333 var rows = $$(css)[0].rows;
1334 var reg = /(^|\s)invisibleRow(\s|$)/;
1336 var r = n/plekit_table_visible_count();
1339 for (var row_index = 0; row_index < rows.length ; row_index++) {
1340 var tr=rows[row_index];
1342 if(tr.className.search(reg) == -1) {
1343 if(Math.random() < r) {
1344 document.getElementById("check"+tr.id).checked=true;
1354 function plekit_table_visible_count() {
1355 var table=$(slicetable_id);
1356 var css='#'+slicetable_id+'>tbody';
1357 var rows = $$(css)[0].rows;
1358 var reg = /(^|\s)invisibleRow(\s|$)/;
1361 for (var row_index = 0; row_index < rows.length ; row_index++) {
1362 var tr=rows[row_index];
1364 if(tr.className.search(reg) == -1)
1374 function plekit_table_count_nodes() {
1375 var table=$(slicetable_id);
1376 var css='#'+slicetable_id+'>tbody';
1377 var rows = $$(css)[0].rows;
1378 var reg = /(^|\s)invisibleRow(\s|$)/;
1383 for (var row_index = 0; row_index < rows.length ; row_index++) {
1384 var tr=rows[row_index];
1387 var ch = document.getElementById("check"+tr.id);
1389 if(tr.className.search(reg) == -1)
1402 var dd = document.getElementById('node_statistics');
1403 dd.innerHTML = "Total: "+n+" - Shown: "+v+" - Selected: "+s;
1406 function AutoSelect()
1408 var a = document.getElementById('automatic').value;
1409 var n = parseInt(document.getElementById('no_nodes').value);
1415 CheckRandomNodes(n);
1416 else if (a == "top")
1419 plekit_table_select_filter2();
1420 plekit_table_count_nodes();