Merge branch 'master' of ssh://git.planet-lab.org/git/plewww
[plewww.git] / plekit / table / columns.js
1
2 /* $Id: column.js Panos $ */
3
4 var filtered_color = "grey";
5 var normal_color = "black";
6
7 //Descriptions overriding the default ones set in Accessors_site.py and configuration 
8
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>';
21
22 var descHOSTNAME = "test";
23
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;
29
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;
34
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;
40
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;
45
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;
50
51 var titleASN = 'Autonomous system name';
52 var sourceASN = 'Source: '+sourceTophat;
53 var descASN = '<span class="myslice title">'+titleASN+'</span><p>'+sourceASN;
54
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; 
61
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;
67
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;
72
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;
77
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;
82
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; 
89
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;
94
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;
100
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;
105
106 var titleIP = 'IP address';
107 var sourceIP = 'Source: '+sourceTophat;
108 var descIP = '<span class="myslice title">'+titleIP+'</span><p>'+sourceIP;
109
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>';
111 var titleL= 'Load ';
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; 
117
118 var titleLON= 'Longitude';
119 var sourceLON = 'Source: '+sourceTophat;
120 var descLON = '<span class="myslice title">'+titleLON+'</span><p>'+sourceLON;
121
122 var titleLAT= 'Latitude';
123 var sourceLAT = 'Source: '+sourceTophat;
124 var descLAT = '<span class="myslice title">'+titleLAT+'</span><p>'+sourceLAT;
125
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;
130
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;
135
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;
140
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;
146
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;
151
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;
156
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; 
163
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;
169
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;
175
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;
181
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;
187
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;
193
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;
199
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;
205
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;
211
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;
216
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; 
224
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;
231
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; 
238
239 var titleSN = 'Site name';
240 var sourceSN = 'Source: '+sourceMyPLC;
241 var descSN = '<span class="myslice title">'+titleSN+'</span><p>'+sourceSN;
242
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; 
249
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;
254
255
256 //Categorization of columns in different types, useful for filtering 
257
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);
261 }
262
263 function inTypeB(header_name) {
264         var typeB = ['BW','DS','MS','CC','CR','AS','MU','DU','CN'];
265         return typeB.indexOf(header_name);
266 }
267
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);
271 }
272
273 function inTypeD(header_name) {
274         var typeD = ['HC'];
275         return typeD.indexOf(header_name);
276 }
277
278
279 //Debugging
280 function debugfilter(s) {
281         document.getElementById('debug').innerHTML+=s;
282 }
283
284
285 //Called when a column is selected. It displays the detailed description
286 //on the right panel
287
288 function highlightOption(divid) {
289
290         //debugfilter("highlighting option "+divid);
291
292         var columns = document.getElementsByName('columnlist');
293         for(var j = 0; j < columns.length; j++)
294                 columns[j].className = 'out'; 
295
296         document.getElementById(divid).className = 'selected';
297
298         showDescription(divid);
299
300 //panos: to IMPROVE 
301         if (document.getElementById('selectperiod'+divid))
302                 document.getElementById('selectperiod'+divid).value = document.getElementById('period'+divid).value;
303
304 }
305
306
307 //Displays the detailed column description 
308
309 function showDescription(h) {
310
311         //debugfilter("showing description "+h);
312
313 //Checks if the detailed description div exists 
314         if (document.getElementById('selectdescr'))
315         {
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;
321                 else 
322                         document.getElementById('selectdescr').innerHTML = "No detailed description provided";
323         }
324 }
325
326
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() {
330
331         var columns = document.getElementsByName('columnlist');
332
333         for(var j = 0; j < columns.length; j++)
334         {
335                 var kk = columns[j].id;
336                 if (window['title'+kk])
337                         document.getElementById('htitle'+kk).innerHTML = window['title'+kk];
338         }
339 }
340
341 //When the checkbox is clicked. Adds/removes column respectively
342 function changeCheckStatus(column) {
343
344         if (document.getElementById('selectdescr'))
345                 showDescription(document.getElementById(column).value);
346
347         if (document.getElementById(column).checked)
348                 addColumn(document.getElementById(column).value, true);
349         else
350                 deleteColumn(document.getElementById(column).value);
351 }
352
353 //This function is used when the alternative "quick" selection list is used
354 function changeSelectStatus(column) {
355
356         var optionClass = "";
357         var selected_index = document.getElementById('quicklist').selectedIndex;
358
359         if (document.getElementById('quicklist'))
360         {
361
362                 optionClass = document.getElementById('quicklist').options[selected_index].className;
363
364                 if (optionClass == "in")
365                 {
366                         deleteColumn(document.getElementById('quicklist').value);
367                         document.getElementById('quicklist').options[selected_index].className = "out";
368                 }
369                 else
370                 {
371                         addColumn(document.getElementById('quicklist').value, true);
372                         document.getElementById('quicklist').options[selected_index].className = "in";
373                 }
374         }
375 }
376
377 //When the period of an already selected column is changed
378 function updatePeriod(h, new_period) {
379
380         var old_period = document.getElementById('period'+h).value;
381         document.getElementById('period'+h).value=new_period;
382
383         //debugfilter(h+''+old_period+'-'+h+''+new_period);
384         if (document.getElementById('check'+h).checked)
385         {
386                 deleteColumnCells(h+''+old_period);
387                 addColumnCells(h+''+new_period);
388                 addColumnAjax(h, h+''+new_period);
389
390                 replaceColumnConfiguration(h+''+old_period,h+''+new_period);
391         }
392 }
393
394 /*
395  
396 RESET/SAVE CONFIGURATION
397 */
398
399 function getHTTPObject()
400 {
401         if (typeof XMLHttpRequest != 'undefined')
402         { return new XMLHttpRequest(); }
403
404         try
405         { return new ActiveXObject("Msxml2.XMLHTTP"); }
406         catch (e)
407         {
408                 try { return new ActiveXObject("Microsoft.XMLHTTP"); }
409                 catch (e) {}
410         }
411         return false;
412 }
413
414
415 function closeShowReservable()
416 {
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";
421
422         var url = "/plekit/php/updateConfiguration.php?value="+slice_id+";reservable:no&slice_id="+slice_id+"&person_id="+person_id+"&tag_id="+tag_id;
423
424         var req = getHTTPObject();
425         req.open('GET', url, true);
426         req.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
427         req.onreadystatechange =
428         function() {
429                 if (req.readyState == 4)
430                 { debugfilter(req.responseText); }
431         }
432         req.send(null);
433
434 }
435
436
437 function updateColumnConfiguration(slice_id, value, reload)
438 {
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;
442
443         //debugfilter("<br>OLD = "+full_column_configuration);
444         //debugfilter("<br>value = "+value);
445         
446         var old_columns = full_column_configuration.split(";");
447         var new_columns = new Array();
448
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]);
453                 else
454                 {
455                         column_index++;
456                         new_columns.push(value);
457                 }
458         }
459
460         var new_configuration = new_columns.join(";");
461         //debugfilter("<br>NEW = "+new_configuration);
462
463         if (window.XMLHttpRequest)
464           {// code for IE7+, Firefox, Chrome, Opera, Safari
465           xmlhttp=new XMLHttpRequest();
466           }
467         else
468           {// code for IE6, IE5
469           xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
470           }
471         xmlhttp.onreadystatechange=function()
472           {
473           if (xmlhttp.readyState==4) // && xmlhttp.status==200)
474             {
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;
479
480                 if (reload)
481                         window.location.reload(true);
482             }
483           }
484
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);
487
488         xmlhttp.send();
489 }
490
491 function logSortingAction(slice_id, value)
492 {
493
494         if (value.indexOf("column-1")!=-1)
495                 return;
496
497         var req = getHTTPObject();
498         var url = "/plekit/php/logSorting.php?value="+value+"&slice_id="+slice_id;
499
500         req.open('GET', url, true);
501         req.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
502         req.onreadystatechange =
503         function() {
504                 if (req.readyState == 4)
505                 { debugfilter(req.responseText); }
506         }
507         req.send(null);
508 }
509
510 function sortCompleteCallback(tableid) {
511
512         var slice_id = document.getElementById('slice_id').value;
513
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)
517         {
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);
521         }
522         }
523 }
524
525
526 function addColumnToConfiguration(column) {
527
528         var old_configuration = document.getElementById('column_configuration').value;
529         var slice_id = document.getElementById('slice_id').value;
530
531         var new_configuration = "";
532
533         if (old_configuration != "")
534                 new_configuration = old_configuration += "|"+column;
535         else
536                 new_configuration = column;
537
538         //debugfilter("new configuration = "+new_configuration);
539
540         updateColumnConfiguration(slice_id, new_configuration, false);
541 }
542
543
544 function deleteColumnFromConfiguration(column) {
545
546         var old_configuration = document.getElementById('column_configuration').value;
547         var slice_id = document.getElementById('slice_id').value;
548
549         var old_columns = old_configuration.split("|");
550         var new_columns = new Array();
551
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]);
556         }
557
558         var new_configuration = new_columns.join("|");
559         updateColumnConfiguration(slice_id, new_configuration, false);
560
561 }
562
563 function replaceColumnConfiguration(column_old, column_new) {
564
565         var old_configuration = document.getElementById('column_configuration').value;
566         var slice_id = document.getElementById('slice_id').value;
567
568         var old_columns = old_configuration.split("|");
569         var new_columns = new Array();
570
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]);
575                 else
576                         new_columns.push(column_new);
577         }
578
579         var new_configuration = new_columns.join("|");
580         
581         updateColumnConfiguration(slice_id, new_configuration);
582 }
583
584 /*
585  
586 ADD/REMOVE COLUMNS
587
588 */
589
590
591
592
593 function load_data(column, header, url) {
594
595         //debugfilter("<br>loading "+url);
596         var req = getHTTPObject();
597         var res;
598         req.open('GET', url, true);
599         req.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
600         req.onreadystatechange =
601         function() {
602                 if (req.readyState == 4)
603                 { updateColumnData(column, header, req.responseText); }
604         }
605         req.send(null);
606 }
607
608
609 function updateColumnData(column, header, data) {
610
611 var headers = header.split("|");
612 var data_table = data.split("|"); 
613
614 //debugfilter("<p>headers[0] = "+headers[0]);
615 //debugfilter("<p>sample line = "+data_table[2]);
616
617
618   var node_data;
619
620   var table_id1 = 'nodes';
621   var table=$(table_id1);
622   var css='#'+table_id1+'>tbody';
623   var rows = $$(css)[0].rows;
624
625   var data_array1 = new Array();
626
627   //debugfilter("COLUMN "+column+"<p>");
628
629   for (var node_index = 1; node_index < data_table.length; node_index++) {
630         if (data_table[node_index] == '---potential---')        
631                 break;
632         node_data = data_table[node_index].split(':');
633
634         data_array1[node_data[0]] = new Array();
635
636         for (var h_index=0; h_index < headers.length; h_index++) {
637                 
638                 if (node_data[h_index+1] == "")
639                         data_array1[node_data[0]][h_index] = "n/a";
640                 else
641                         data_array1[node_data[0]][h_index] = node_data[h_index+1];
642         }
643
644   }
645         
646   if (rows)
647   for (var row_index = 0; row_index < rows.length ; row_index++) {
648     var tr=rows[row_index];
649
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'))
653                 {
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];
658                 }
659     }
660   }
661
662   fdTableSort.init(table_id1);
663   tablePaginater.init(table_id1);
664
665 //potential nodes
666 if (data_table[node_index] == '---potential---')        
667 {
668
669   var table_id2 = 'add_nodes';
670   var table2=$(table_id2);
671   var css2='#'+table_id2+'>tbody';
672   var rows2 = $$(css2)[0].rows;
673
674   var data_array2 = new Array();
675
676   //debugfilter("COLUMN "+column+"<p>");
677
678   for (; node_index < data_table.length; node_index++) {
679         if (data_table[node_index] == '')       
680                 continue;
681         node_data = data_table[node_index].split(':');
682
683         data_array2[node_data[0]] = new Array();
684
685         for (var h_index=0; h_index < headers.length; h_index++) {
686                 
687                 if (node_data[h_index+1] == "")
688                         data_array2[node_data[0]][h_index] = "n/a";
689                 else
690                         data_array2[node_data[0]][h_index] = node_data[h_index+1];
691         }
692   }
693         
694   if (rows)
695   for (var row_index = 0; row_index < rows2.length ; row_index++) {
696     var tr=rows2[row_index];
697
698     for (var column_index=0; column_index < tr.cells.length; column_index++) {
699                 if (tr.cells[column_index].getAttribute('name'))
700                 {
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];
704                 }
705     }
706   }
707
708   //fdTableSort.removeTableCache(table_id2);
709   fdTableSort.init(table_id2);
710   tablePaginater.init(table_id2);
711
712 }
713
714 document.getElementById('loading'+column).innerHTML = "";
715
716 }
717
718
719 function addColumnCells(header) {
720
721         var cells = document.getElementsByName(header);
722
723         //debugfilter("got cells -"+cells+"- for "+header);
724         for(var j = 0; j < cells.length; j++) 
725                 cells[j].style.display = "table-cell";
726 }
727
728 function addSampleCells(column) {
729
730         var cellsheader = document.getElementsByName("confheader"+column);
731         for(var j = 0; j < cellsheader.length; j++) 
732                 cellsheader[j].style.display = "table-cell";
733
734 }
735
736 function addColumnAjax(column, header) {
737
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;
741
742         var selectedperiod = document.getElementById('period'+column).value;
743
744         var fetched = document.getElementById('fetched'+column).value;
745         var to_load = false;
746
747         //debugfilter("<br>adding "+column+","+header+','+fetched+','+t);
748
749         if (fetched.indexOf("false")!=-1)
750         {
751                 to_load = true;
752                 document.getElementById('fetched'+column).value = ','+selectedperiod+',true';
753         }
754         else if (fetched.indexOf(','+selectedperiod+',')==-1)
755         {
756                         to_load = true;
757                         document.getElementById('fetched'+column).value = ','+selectedperiod+''+fetched;
758         }
759
760         if (to_load)
761         {
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);
765         }
766 }
767
768
769
770 function addColumn(column, fetch) {
771
772         var selectedperiod="";
773         var header=column;
774
775         if (inTypeC(column)!=-1)
776         {
777                 column = column.substring(0,column.length-1);
778         }
779
780         selectedperiod = document.getElementById('period'+column).value;
781         header = column+""+selectedperiod;
782
783         //debugfilter("adding column "+column+" and header "+header);
784
785         addColumnCells(header);
786
787         if (fetch)
788                 addColumnAjax(column, header);
789
790         addColumnToConfiguration(header);
791         
792 }
793
794
795 function deleteColumnCells(header) {
796
797         var cells = document.getElementsByName(header);
798         for(var j = 0; j < cells.length; j++) 
799                 cells[j].style.display = "none";
800
801 }
802
803
804
805 function deleteColumn(column) {
806
807         var selectedperiod="";
808         var header=column;
809
810         selectedperiod = document.getElementById('period'+column).value;
811         header = column+""+selectedperiod;
812
813         //debugfilter("deleting "+column+","+header);
814
815         deleteColumnCells(header);
816
817         deleteColumnFromConfiguration(header);
818
819         //document.getElementById('check'+column).checked = false;
820 }
821
822
823 /* 
824  
825 EXTRA
826
827 //to be used for scrolling the column list with down/up arrows 
828
829 function scrollList(tableid) {
830
831 debugfilter("here");
832
833 if (event.keyCode == 40)
834         debugfilter("down");
835 else if (event.keyCode == 38)
836         debugfilter("up");
837
838 }
839
840 function resetColumns() {
841
842         for (var kk in column_table) {
843
844         if (column_table[kk]['visible'] == true && column_table[kk]['fetch'] == false)
845                 deleteColumn(kk);
846         else if (column_table[kk]['visible'] == false && column_table[kk]['fetch'] == true)
847                 addColumn(kk, true);
848         }
849
850 }
851
852 function resetCols(which_conf) {
853
854         var target_configuration = "|"+document.getElementById(which_conf).value+"|";
855         
856         //debugfilter("<p>Target configuration =  "+target_configuration);
857
858         for (var kk in column_table) {
859                 //debugfilter("in "+kk+" ");
860
861                 if (target_configuration.indexOf("|"+kk+"|")>=0)
862                 {
863                         if (document.getElementById('check'+kk))
864                         if (document.getElementById('check'+kk).checked == false)
865                         {
866                                 debugfilter("<p>Adding "+kk);
867                                 addColumn(kk, true);
868                         }
869                 }
870                 else
871                 {
872                         if (document.getElementById('check'+kk))
873                         if (document.getElementById('check'+kk).checked == true)
874                         {
875                                 debugfilter("<p>Deleting "+kk);
876                                 deleteColumn(kk);
877                         }
878                 }
879         }
880 }
881
882 function filterByType(selectedtype) {
883
884 var notselectedyet = true;
885
886 for (var kk in column_headers) {
887
888         if (document.getElementById(kk))
889         {
890                 if (window['type'+kk] == selectedtype)
891                 {
892                         document.getElementById(kk).className = 'in';
893                         if (notselectedyet)
894                                 highlightOption(kk);
895                         notselectedyet = false;
896                 }
897                 else
898                         document.getElementById(kk).className = 'out';
899         }
900 }
901 }
902
903
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";
908
909 }
910
911 function checkDataToFetch() {
912
913 var dataExist = false;
914
915 for (var kk in column_table) {
916
917         if (document.getElementById(kk))
918         {
919                 if (column_table[kk]['visible'] == true && column_table[kk]['fetch'] == false)
920                 {
921                         document.getElementById('fetchbutton').disabled = false;
922                         document.getElementById('fetchbutton').style.color = 'red';
923                         dataExist = true;
924                 }
925         }
926 }
927
928 if (!dataExist)
929 {
930         document.getElementById('fetchbutton').disabled = true;
931         document.getElementById('fetchbutton').style.color = 'grey';
932 }
933
934 }
935
936
937 function fetchData() {
938
939 var tagnames = "";
940 var headers = "";
941
942 for (var kk in column_table) {
943
944 if (column_table[kk]['visible'] == true && column_table[kk]['fetch'] == false)
945         if (tagnames == "")
946         {       
947                 tagnames = column_table[kk]['tagname'];
948                 headers = kk;
949         }
950         else
951         {
952                 tagnames += "|"+column_table[kk]['tagname'];
953                 headers += "|"+kk;
954         }
955 }
956
957 //debugfilter("fetching these columns: "+tagnames+ "("+headers+")");
958
959         var slice_id = document.getElementById('slice_id').value;
960         document.getElementById('loadingDiv').innerHTML = "&nbsp;&nbsp;&nbsp;<img src=/plekit/icons/ajax-loader.gif>&nbsp;Loading data. Please wait ...";
961         var url = "/plekit/php/updateColumn.php?slice_id="+slice_id+"&tagName="+tagnames;
962         load_data(headers, url);
963 }
964
965
966 /*
967  
968
969 HIGHLIGHTING
970
971
972
973 function updateColumnThreshold(column, minT, maxT) {
974
975 debugfilter("updating threshold for "+column+" with "+minT+" and "+maxT);
976
977 var cells = document.getElementsByName(column);
978
979 for(var j = 0; j < cells.length; j++) 
980 {
981 var val = parseFloat(cells[j].innerHTML);
982
983 if (val >= minT && val <= maxT)
984         cells[j].style.color = filtered_color;
985 else
986         cells[j].style.color = normal_color;
987 }
988
989 var old_configuration = document.getElementById('column_configuration').value;
990 var slice_id = document.getElementById('slice_id').value;
991
992 var old_columns = old_configuration.split("|");
993 var new_columns = new Array();
994
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]);
999         else
1000                 new_columns.push(column+":"+minT+","+maxT);
1001 }
1002
1003 var new_configuration = new_columns.join("|");
1004
1005 updateColumnConfiguration(slice_id, new_configuration);
1006
1007 }
1008
1009 function updateExcludeList(column, excludeList) {
1010
1011 //debugfilter("updating list");
1012 debugfilter("updating list for "+column+" with "+excludeList);
1013
1014 var cells = document.getElementsByName(column);
1015
1016 for(var j = 1; j < cells.length; j++) 
1017 {
1018 var val = cells[j].innerHTML;
1019
1020 if (excludeList == val)
1021         cells[j].style.color = filtered_color;
1022 else
1023         cells[j].style.color = normal_color;
1024 }
1025
1026 var old_configuration = document.getElementById('column_configuration').value;
1027 var slice_id = document.getElementById('slice_id').value;
1028
1029 var old_columns = old_configuration.split("|");
1030 var new_columns = new Array();
1031
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]);
1036         else
1037                 new_columns.push(column+":"+excludeList);
1038 }
1039
1040 var new_configuration = new_columns.join("|");
1041
1042 updateColumnConfiguration(slice_id, new_configuration);
1043
1044 }
1045
1046
1047
1048 /*
1049  
1050 ROW FILTERING
1051
1052
1053 function plekit_table_showAll (slicetable_id) {
1054
1055   var table=$(slicetable_id);
1056   var css='#'+slicetable_id+'>tbody';
1057   var rows = $$(css)[0].rows;
1058
1059   // scan rows, elaborate 'visible'
1060   for (var row_index = 0; row_index < rows.length ; row_index++) {
1061     var tr=rows[row_index];
1062     var visible=true;
1063     plekit_table_row_visible(tr,visible);
1064   }
1065
1066     plekit_table_count_filtered(slicetable_id);
1067
1068   tablePaginater.init(slicetable_id);
1069   
1070 }
1071
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;
1076
1077   var no_filtered=0;
1078
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;
1083
1084     for (var column_index=0; column_index < tr.cells.length; column_index++) 
1085                 if (tr.cells[column_index].style.color == "red")
1086                         filtered = true;
1087
1088         if (filtered)
1089         no_filtered++;
1090
1091   }
1092
1093   debugfilter(no_filtered+' nodes do not satisfy the requested threshold');
1094 }
1095
1096
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;
1101
1102   var reg = /(^|\s)invisibleRow(\s|$)/;
1103
1104
1105   if (!document.getElementById('filtercheck').checked)
1106   {
1107         plekit_table_showAll(slicetable_id);
1108         return;
1109   }
1110
1111   var hidden=0;
1112
1113   // scan rows, elaborate 'visible'
1114   for (var row_index = 0; row_index < rows.length ; row_index++) {
1115     var tr=rows[row_index];
1116     var visible=true;
1117
1118     for (var column_index=0; column_index < tr.cells.length; column_index++) {
1119                 if (tr.cells[column_index].style.color == filtered_color)
1120                         visible = false;
1121     }
1122     if (!visible)
1123         hidden++;
1124
1125     plekit_table_row_visible(tr,visible);
1126   }
1127
1128   //debugfilter('hidden '+hidden+' nodes');
1129   debugfilter(hidden+' nodes do not satisfy the requested threshold (hidden)');
1130   
1131   tablePaginater.init(slicetable_id);
1132 }
1133
1134
1135
1136
1137 function plekit_table_apply_config(slicetable_id, configuration) {
1138
1139 var new_configuration = document.getElementById('new_conf').value;
1140 var all_columns = new_configuration.split("|");
1141
1142 var min_values = new Array();
1143 var max_values = new Array();
1144
1145
1146 for (var column_index = 0; column_index < all_columns.length ; column_index++) {
1147
1148         var conf = all_columns[column_index].split(':');
1149         
1150         if (inTypeB(conf[0]) != -1)
1151         {
1152                 var threshold = conf[1].split(',');
1153                 if (threshold.length == 2)
1154                 {
1155                 min_values.push(parseFloat(threshold[0]));
1156                 max_values.push(parseFloat(threshold[1]));
1157                 }
1158         }
1159         else if (inTypeC(conf[0]) == -1)
1160         {
1161                 var threshold = conf[2].split(',');
1162                 if (threshold.length == 2)
1163                 {
1164                 min_values.push(parseInt(threshold[0]));
1165                 max_values.push(parseInt(threshold[1]));
1166                 }
1167         }
1168         else
1169         {
1170                 min_values.push(-1);
1171                 max_values.push(-1);
1172         }
1173         
1174 }
1175
1176   var table=$(slicetable_id);
1177   var css='#'+slicetable_id+'>tbody';
1178   var rows = $$(css)[0].rows;
1179
1180
1181   var no_filtered=0;
1182
1183   for (var row_index = 0; row_index < rows.length ; row_index++) {
1184
1185         var tr=rows[row_index];
1186
1187         var filtered = false;
1188
1189         for (var column_index = 0; column_index < all_columns.length ; column_index++) 
1190         if (min_values[column_index]!=-1)
1191         {
1192                 var val = parseFloat(tr.cells[3+column_index].innerHTML);
1193                 
1194                 if (val >= min_values[column_index] && val <= max_values[column_index])
1195                 {
1196                         tr.cells[3+column_index].style.color = filtered_color;
1197                         filtered = true;
1198                 }
1199                 else
1200                         tr.cells[3+column_index].style.color = normal_color;
1201         }
1202         else
1203                 if (tr.cells[3+column_index].style.color == filtered_color)
1204                         filtered = true;
1205                 
1206
1207         if (filtered)
1208         no_filtered++;
1209   }
1210
1211   debugfilter(no_filtered+' nodes do not satisfy the requested threshold');
1212
1213   //tablePaginater.init(slicetable_id);
1214
1215 }
1216
1217
1218 function reset_select () {
1219   var table=$(slicetable_id);
1220   var css='#'+slicetable_id+'>tbody';
1221   var rows = $$(css)[0].rows;
1222
1223 var action = document.getElementById('onlyselected');
1224 action.checked=false;
1225
1226   // scan rows, elaborate 'visible'
1227   for (var row_index = 0; row_index < rows.length ; row_index++) {
1228     var tr=rows[row_index];
1229
1230     document.getElementById("check"+tr.id).checked=false;
1231
1232   }
1233
1234   plekit_table_count_nodes();
1235 }
1236
1237 }
1238
1239
1240 function plekit_table_select_filter () {
1241   var table=$(slicetable_id);
1242   var css='#'+slicetable_id+'>tbody';
1243   var rows = $$(css)[0].rows;
1244
1245   var reg = /(^|\s)invisibleRow(\s|$)/;
1246
1247   var action = document.getElementById('onlyselected');
1248   if (!action.checked)
1249         plekit_table_reset_filter();
1250
1251   // scan rows, elaborate 'visible'
1252   for (var row_index = 0; row_index < rows.length ; row_index++) {
1253     var tr=rows[row_index];
1254     var visible=true;
1255
1256     if (action.checked)
1257     {
1258          if(tr.className.search(reg) == -1) 
1259               if(!document.getElementById("check"+tr.id).checked)
1260                   visible=false;
1261     }
1262
1263     if(tr.className.search(reg) != -1) 
1264         visible=false;
1265
1266     plekit_table_row_visible(tr,visible);
1267   }
1268   
1269   tablePaginater.init(slicetable_id);
1270   plekit_table_count_nodes();
1271 }
1272
1273 function plekit_table_select_filter2 () {
1274   var table=$(slicetable_id);
1275   var css='#'+slicetable_id+'>tbody';
1276   var rows = $$(css)[0].rows;
1277
1278   var reg = /(^|\s)invisibleRow(\s|$)/;
1279
1280   var action = document.getElementById('onlyselected');
1281
1282   // scan rows, elaborate 'visible'
1283   for (var row_index = 0; row_index < rows.length ; row_index++) {
1284     var tr=rows[row_index];
1285     var visible=true;
1286
1287     if (action.checked)
1288     {
1289          if(tr.className.search(reg) == -1) 
1290               if(!document.getElementById("check"+tr.id).checked)
1291                   visible=false;
1292     }
1293
1294     if(tr.className.search(reg) != -1) 
1295         visible=false;
1296
1297     plekit_table_row_visible(tr,visible);
1298   }
1299   
1300   tablePaginater.init(slicetable_id);
1301   plekit_table_count_nodes();
1302 }
1303
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|$)/;
1309
1310   var checked=0;
1311
1312   for (var row_index = 0; row_index < rows.length ; row_index++) {
1313     var tr=rows[row_index];
1314
1315     if(tr.className.search(reg) == -1) {
1316         if (checked<n)
1317         {
1318                 document.getElementById("check"+tr.id).checked=true;
1319                 checked++;
1320         }
1321         else
1322         {
1323                 document.getElementById("check"+tr.id).checked=false;
1324         };
1325     };
1326    };
1327 };
1328
1329
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|$)/;
1335
1336   var r = n/plekit_table_visible_count();
1337   var checked=0;
1338
1339   for (var row_index = 0; row_index < rows.length ; row_index++) {
1340     var tr=rows[row_index];
1341
1342     if(tr.className.search(reg) == -1) {
1343         if(Math.random() < r) {
1344                 document.getElementById("check"+tr.id).checked=true;
1345                 checked++;
1346         };
1347         if (checked>=n)
1348                 break;
1349      };
1350   };
1351 };
1352
1353
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|$)/;
1359   var v=0;
1360
1361   for (var row_index = 0; row_index < rows.length ; row_index++) {
1362     var tr=rows[row_index];
1363
1364         if(tr.className.search(reg) == -1) 
1365         {
1366                 v++;
1367         }
1368   }
1369
1370   return v;
1371 }
1372
1373
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|$)/;
1379   var n=0;
1380   var v=0;
1381   var s=0;
1382
1383   for (var row_index = 0; row_index < rows.length ; row_index++) {
1384     var tr=rows[row_index];
1385
1386         n++;
1387         var ch = document.getElementById("check"+tr.id);
1388
1389         if(tr.className.search(reg) == -1) 
1390                 v++;
1391         else
1392         {
1393                 if (ch.checked)
1394                         ch.checked=false;
1395         };
1396
1397         if (ch.checked)
1398                 s++;
1399         
1400    };
1401
1402    var dd = document.getElementById('node_statistics');
1403    dd.innerHTML = "Total: "+n+" - Shown: "+v+" - Selected: "+s;
1404 };
1405
1406 function AutoSelect()
1407 {
1408   var a = document.getElementById('automatic').value;
1409   var n = parseInt(document.getElementById('no_nodes').value);
1410
1411   if (isNaN(n))
1412         return;
1413
1414   if (a == "random")
1415          CheckRandomNodes(n);
1416   else if (a == "top")
1417          CheckTopNodes(n);
1418
1419   plekit_table_select_filter2();
1420   plekit_table_count_nodes();
1421 }
1422
1423 */