Merge branch 'master' of git.onelab.eu:/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="">Latest</option><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="">Latest</option><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 titleDN = 'Toplevel domain name';
91 var sourceDN = 'Source: '+sourceMyPLC;
92 var descDN = '<span class="myslice title">'+titleDN+'</span><p>'+sourceDN;
93
94 var titleDS = 'Disk size';
95 var sourceDS = 'Source: '+sourceComon;
96 var valuesDS = 'Unit: <b>GB</b><p>Current PlanetLab hardware requirements: <b>500 GB</b>';
97 var descDS = '<span class="myslice title">'+titleDS+'</span><p>'+valuesDS+'<p>'+sourceDS;
98
99 var titleDU = 'Current disk utilization';
100 var sourceDU = 'Source: '+sourceComon+' (via '+sourceMySlice+')';
101 var valuesDU = 'Unit: <b>GB</b>';
102 var detailDU = '<i> The amount of disk space currently consumed (checked daily).</i>';
103 var descDU = '<span class="myslice title">'+titleDU+'</span><p>'+detailDU+'<p>'+valuesDU+'<p>'+sourceDU;
104
105 var titleDF = 'Disk space free';
106 var sourceDF = 'Source: '+sourceComon+' (via '+sourceMySlice+')';
107 var valuesDF = 'Unit: <b>GB</b>';
108 var detailDF = '<i> The amount of disk space currently available (checked daily).</i>';
109 var descDF = '<span class="myslice title">'+titleDF+'</span><p>'+detailDF+'<p>'+valuesDF+'<p>'+sourceDF;
110
111 var titleHC = 'Hop count (pairwise)';
112 var sourceHC = 'Source: '+sourceTophat;
113 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>.';
114 var descHC = '<span class="myslice title">'+titleHC+'</span><p>'+detailHC+'<p>'+selectReferenceNode+'<p>'+sourceHC;
115
116 var titleIP = 'IP address';
117 var sourceIP = 'Source: '+sourceMyPLC;
118 var descIP = '<span class="myslice title">'+titleIP+'</span><p>'+sourceIP;
119
120 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>';
121 var titleL= 'Load ';
122 var sourceL = 'Source: '+sourceComon;
123 var valuesL = 'Unit: <b>5-minute load</b>';
124 var detailL = '<i>The average 5-minute load (as reported by the Unix uptime command) over the selected period.</i>';
125 var descL = '<span class="myslice title">'+titleL+'</span><p>'+detailL+'<p>'+selectPeriodL+'<p>'+valuesL+'<p>'+sourceL; 
126 //var descL = '<span class="myslice title">'+titleL+'</span><p>'+detailL+'<p>'+valuesL+'<p>'+sourceL; 
127
128 var titleLON= 'Longitude';
129 var sourceLON = 'Source: '+sourceTophat;
130 var descLON = '<span class="myslice title">'+titleLON+'</span><p>'+sourceLON;
131
132 var titleLAT= 'Latitude';
133 var sourceLAT = 'Source: '+sourceTophat;
134 var descLAT = '<span class="myslice title">'+titleLAT+'</span><p>'+sourceLAT;
135
136 var titleLCN= 'Location (Country)';
137 var sourceLCN = 'Source: '+sourceMaxmind+' (via '+sourceTophat+')';
138 var detailLCN = '<i>Based on the latitude and longitude information.</i>';
139 var descLCN = '<span class="myslice title">'+titleLCN+'</span><p>'+detailLCN+'<p>'+sourceLCN;
140
141 var titleLCT= 'Location (Continent)';
142 var sourceLCT = 'Source: '+sourceMaxmind+' (via '+sourceTophat+')';
143 var detailLCT = '<i>Based on the latitude and longitude information.</i>';
144 var descLCT = '<span class="myslice title">'+titleLCT+'</span><p>'+detailLCT+'<p>'+sourceLCT;
145
146 var titleLCY= 'Location (City)';
147 var sourceLCY = 'Source: '+sourceMaxmind+' (via '+sourceTophat+')';
148 var detailLCY = '<i>Based on the latitude and longitude information.</i>';
149 var descLCY = '<span class="myslice title">'+titleLCY+'</span><p>'+detailLCY+'<p>'+sourceLCY;
150
151 var titleLPR= 'Location precision radius';
152 var sourceLPR = 'Source: '+sourceTophat;
153 var valuesLPR = 'Unit: <b>float</b>';
154 var detailLPR = '<i>The radius of the circle corresponding to the error in precision of the geolocalization estimate.</i>';
155 var descLPR = '<span class="myslice title">'+titleLPR+'</span><p>'+detailLPR+'<p>'+valuesLPR+'<p>'+sourceLPR;
156
157 var titleLRN= 'Location (Region)';
158 var sourceLRN = 'Source: '+sourceMaxmind+' (via '+sourceTophat+')';
159 var detailLRN = '<i>Based on the latitude and longitude information.</i>';
160 var descLRN = '<span class="myslice title">'+titleLRN+'</span><p>'+detailLRN+'<p>'+sourceLRN;
161
162 var titleMS= 'Memory size';
163 var sourceMS = 'Source: '+sourceComon;
164 var valuesMS = 'Unit: <b>GB</b><p>Current PlanetLab hardware requirements: <b>4 GB</b>.';
165 var descMS = '<span class="myslice title">'+titleMS+'</span><p>'+valuesMS+'<p>'+sourceMS;
166
167 var selectPeriodMU = 'Select period: <select id="selectperiodMU" onChange=updatePeriod("MU",this.value)><option value="">Latest</option><option value=w>Week</option><option value=m>Month</option><option value=y>Year</option></select>';
168 var titleMU = 'Memory utilization';
169 var sourceMU = 'Source: '+sourceComon;
170 var valuesMU = '<p>Unit: <b>%</b>';
171 var detailMU = '<i>The average active memory utilization as reported by CoMon.</i>';
172 var descMU = '<span class="myslice title">'+titleMU+'</span><p>'+detailMU+'<p>'+selectPeriodMU+'<p>'+valuesMU+'<p>'+sourceMU; 
173
174 var titleNEC= 'Network information (ETOMIC)';
175 var sourceNEC = 'Source: '+sourceTophat;
176 var valuesNEC = 'Values: <b>yes/no</b>';
177 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>';
178 var descNEC = '<span class="myslice title">'+titleNEC+'</span><p>'+detailNEC+'<p>'+valuesNEC+'<p>'+sourceNEC;
179
180 var titleNSN= 'Network information (SONoMA)';
181 var sourceNSN = 'Source: '+sourceTophat;
182 var valuesNSN = 'Values: <b>yes/no</b>';
183 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>';
184 var descNSN = '<span class="myslice title">'+titleNSN+'</span><p>'+detailNSN+'<p>'+valuesNSN+'<p>'+sourceNSN;
185
186 var titleNTH= 'Network information (TopHat)';
187 var sourceNTH = 'Source: '+sourceTophat;
188 var valuesNTH = 'Values: <b>yes/no</b>';
189 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>';
190 var descNTH = '<span class="myslice title">'+titleNTH+'</span><p>'+detailNTH+'<p>'+valuesNTH+'<p>'+sourceNTH;
191
192 var titleNDS= 'Network information (DIMES)';
193 var sourceNDS = 'Source: '+sourceTophat;
194 var valuesNDS = 'Values: <b>yes/no</b>';
195 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>';
196 var descNDS = '<span class="myslice title">'+titleNDS+'</span><p>'+detailNDS+'<p>'+valuesNDS+'<p>'+sourceNDS;
197
198 var titleNSF= 'Network information (spoof)';
199 var sourceNSF = 'Source: '+sourceTophat;
200 var valuesNSF = '<p>Values: <b>yes/no</b>';
201 var detailNSF = '<i> Whether the node can send packets successfully (or not) with a spoofed IP source address.</i>';
202 var descNSF = '<span class="myslice title">'+titleNSF+'</span><p>'+detailNSF+'<p>'+valuesNSF+'<p>'+sourceNSF;
203
204 var titleNSR= 'Network information (source route)';
205 var sourceNSR = 'Source: '+sourceTophat;
206 var valuesNSR = '<p>Values: <b>yes/no</b>';
207 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>';
208 var descNSR = '<span class="myslice title">'+titleNSR+'</span><p>'+detailNSR+'<p>'+valuesNSR+'<p>'+sourceNSR;
209
210 var titleNTP= 'Network information (timestamp)';
211 var sourceNTP = 'Source: '+sourceTophat;
212 var valuesNTP = '<p>Values: <b>yes/no</b>';
213 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>';
214 var descNTP = '<span class="myslice title">'+titleNTP+'</span><p>'+detailNTP+'<p>'+valuesNTP+'<p>'+sourceNTP;
215
216 var titleNRR= 'Network information (record route)';
217 var sourceNRR = 'Source: '+sourceTophat;
218 var valuesNRR = '<p>Values: <b>yes/no</b>';
219 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>';
220 var descNRR = '<span class="myslice title">'+titleNRR+'</span><p>'+detailNRR+'<p>'+valuesNRR+'<p>'+sourceNRR;
221
222 var titleOS = 'Operating system';
223 var sourceOS = 'Source: '+sourceMyPLC;
224 var valuesOS = 'Values: <b>Fedora, Cent/OS, other, n/a</b>';
225 var descOS = '<span class="myslice title">'+titleOS+'</span><p>'+valuesOS+'<p>'+sourceOS;
226
227 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>';
228 var titleR = 'Reliability';
229 var sourceR = 'Source: '+sourceComon+' (via '+sourceMySlice+')';
230 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>';
231 var valuesR = 'Unit: <b>%</b>';
232 var descR = '<span class="myslice title">'+titleR+'</span><p>'+detailR+'<p>'+selectPeriodR+'<p>'+valuesR+'<p>'+sourceR; 
233 //var descR = '<span class="myslice title">'+titleR+'</span><p>'+detailR+'<p>'+valuesR+'<p>'+sourceR; 
234
235 var titleRES = 'Reservation capabilities';
236 var sourceRES = 'Source: '+sourceMyPLC;
237 //var valuesRES = 'Values: <b>yes/no</b>';
238 var valuesRES = 'Values: <b>-R-</b> (if yes)';
239 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>';
240 var descRES = '<span class="myslice title">'+titleRES+'</span><p>'+detailRES+'<p>'+valuesRES+'<p>'+sourceRES;
241
242 var selectPeriodS = 'Select period: <select id="selectperiodS" onChange=updatePeriod("S",this.value)><option value="">Latest</option><option value=w>Week</option><option value=m>Month</option><option value=y>Year</option></select>';
243 var titleS = 'Active slices';
244 var sourceS = 'Source: '+sourceComon+' (via '+sourceMySlice+')';
245 var valuesS = 'Unit: <b>%</b>';
246 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>';
247 var descS = '<span class="myslice title">'+titleS+'</span><p>'+detailS+'<p>'+selectPeriodS+'<p>'+valuesS+'<p>'+sourceS; 
248
249 var titleSN = 'Site name';
250 var sourceSN = 'Source: '+sourceMyPLC;
251 var descSN = '<span class="myslice title">'+titleSN+'</span><p>'+sourceSN;
252
253 var selectPeriodSSH = 'Select period: <select id="selectperiodSSH" onChange=updatePeriod("SSH",this.value)><option value="">Latest</option><option value=w>Week</option><option value=m>Month</option><option value=y>Year</option></select>';
254 var titleSSH = 'Average SSH response delay';
255 var valuesSSH = 'Unit: <b>%</b>';
256 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>';
257 var sourceSSH ='Source: '+sourceComon+' (via '+sourceMySlice+')';
258 var descSSH = '<span class="myslice title">'+titleSSH+'</span><p>'+detailSSH+'<p>'+selectPeriodSSH+'<p>'+valuesSSH+'<p>'+sourceSSH; 
259
260 var titleST = 'Status';
261 var sourceST = 'Source: '+sourceMonitor;
262 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).';
263 var descST = '<span class="myslice title">'+titleST+'</span><p>'+valuesST+'<p>'+sourceST;
264
265
266 //Categorization of columns in different types, useful for filtering 
267
268 function inTypeA(header_name) {
269         var typeA = ['ST','SN','RES','OS','NRR','NTP','NSR','NSF','NDS','NTH','NEC','LRN','LCY','LPR','LCN','LAT','LON','IP','ASN','AST'];
270         return typeA.indexOf(header_name);
271 }
272
273 function inTypeB(header_name) {
274         var typeB = ['BW','DS','MS','CC','CR','AS','MU','DU','CN'];
275         return typeB.indexOf(header_name);
276 }
277
278 function inTypeC(header_name) {
279         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'];
280         return typeC.indexOf(header_name);
281 }
282
283 function inTypeD(header_name) {
284         var typeD = ['HC'];
285         return typeD.indexOf(header_name);
286 }
287
288
289 //Debugging
290 function debugfilter(s) {
291         document.getElementById('debug').innerHTML+=s;
292 }
293
294
295 //Called when a column is selected. It displays the detailed description
296 //on the right panel
297
298 function highlightOption(divid) {
299
300         //debugfilter("highlighting option "+divid);
301
302         var columns = document.getElementsByName('columnlist');
303         for(var j = 0; j < columns.length; j++)
304                 columns[j].className = 'out'; 
305
306         document.getElementById(divid).className = 'selected';
307
308         showDescription(divid);
309
310 //panos: to IMPROVE 
311         if (document.getElementById('selectperiod'+divid))
312                 document.getElementById('selectperiod'+divid).value = document.getElementById('period'+divid).value;
313
314 }
315
316
317 //Displays the detailed column description 
318
319 function showDescription(h) {
320
321         //debugfilter("showing description "+h);
322
323 //Checks if the detailed description div exists 
324         if (document.getElementById('selectdescr'))
325         {
326                 //Checks if there is a detailed description defined
327                 if (window['desc'+h])
328                         document.getElementById('selectdescr').innerHTML = ""+window['desc'+h];
329                 //else if (document.getElementById('fdesc'+h))
330                         //document.getElementById('selectdescr').innerHTML = document.getElementById('fdesc'+h).value;
331                 else 
332                         document.getElementById('selectdescr').innerHTML = "No detailed description provided";
333         }
334 }
335
336
337 //Overrides the titles of the columns as they are shown in the column selection panel.
338 //If no overriding variable exists the tag's description is used
339 function overrideTitles() {
340
341         var columns = document.getElementsByName('columnlist');
342
343         for(var j = 0; j < columns.length; j++)
344         {
345                 var kk = columns[j].id;
346                 if (window['title'+kk])
347                         document.getElementById('htitle'+kk).innerHTML = window['title'+kk];
348         }
349 }
350
351 //When the checkbox is clicked. Adds/removes column respectively
352 function changeCheckStatus(column) {
353
354         if (document.getElementById('selectdescr'))
355                 showDescription(document.getElementById(column).value);
356
357         if (document.getElementById(column).checked)
358                 addColumn(document.getElementById(column).value, true);
359         else
360                 deleteColumn(document.getElementById(column).value);
361 }
362
363 //This function is used when the alternative "quick" selection list is used
364 function changeSelectStatus(column) {
365
366         var optionClass = "";
367         var selected_index = document.getElementById('quicklist').selectedIndex;
368
369         if (document.getElementById('quicklist'))
370         {
371
372                 optionClass = document.getElementById('quicklist').options[selected_index].className;
373
374                 if (optionClass == "in")
375                 {
376                         deleteColumn(document.getElementById('quicklist').value);
377                         document.getElementById('quicklist').options[selected_index].className = "out";
378                 }
379                 else
380                 {
381                         addColumn(document.getElementById('quicklist').value, true);
382                         document.getElementById('quicklist').options[selected_index].className = "in";
383                 }
384         }
385 }
386
387 //When the period of an already selected column is changed
388 function updatePeriod(h, new_period) {
389
390         var old_period = document.getElementById('period'+h).value;
391         document.getElementById('period'+h).value=new_period;
392
393         //debugfilter(h+''+old_period+'-'+h+''+new_period);
394         if (document.getElementById('check'+h).checked)
395         {
396                 deleteColumnCells(h+''+old_period);
397                 addColumnCells(h+''+new_period);
398                 addColumnAjax(h, h+''+new_period);
399
400                 replaceColumnConfiguration(h+''+old_period,h+''+new_period);
401         }
402 }
403
404 /*
405  
406 RESET/SAVE CONFIGURATION
407 */
408
409 function getHTTPObject()
410 {
411         if (typeof XMLHttpRequest != 'undefined')
412         { return new XMLHttpRequest(); }
413
414         try
415         { return new ActiveXObject("Msxml2.XMLHTTP"); }
416         catch (e)
417         {
418                 try { return new ActiveXObject("Microsoft.XMLHTTP"); }
419                 catch (e) {}
420         }
421         return false;
422 }
423
424
425 function closeShowReservable()
426 {
427         var slice_id = document.getElementById('slice_id').value;
428         var person_id = document.getElementById('person_id').value;
429         var tag_id = document.getElementById('show_tag_id').value;
430         document.getElementById('note_reservable_div').style.display = "none";
431
432         var url = "/plekit/php/updateConfiguration.php?value="+slice_id+";reservable:no&slice_id="+slice_id+"&person_id="+person_id+"&tag_id="+tag_id;
433
434         var req = getHTTPObject();
435         req.open('GET', url, true);
436         req.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
437         req.onreadystatechange =
438         function() {
439                 if (req.readyState == 4)
440                 { debugfilter(req.responseText); }
441         }
442         req.send(null);
443
444 }
445
446
447 function updateColumnConfiguration(value, reload)
448 {
449         var person_id = document.getElementById('person_id').value;
450         var slice_id = document.getElementById('slice_id').value;
451         var tag_id = document.getElementById('conf_tag_id').value;
452         var full_column_configuration = document.getElementById('full_column_configuration').value;
453
454         //debugfilter("<br>OLD = "+full_column_configuration);
455         //debugfilter("<br>value = "+value);
456         //
457         
458         var old_columns = full_column_configuration.split(";");
459         var new_columns = new Array();
460
461         for (var column_index = 0; column_index < old_columns.length ; column_index++) {
462                 new_columns.push(old_columns[column_index]);
463                 if (old_columns[column_index] != slice_id)
464                         new_columns.push(old_columns[++column_index]);
465                 else
466                 {
467                         if (value != "")
468                                 new_columns.push(value);
469                         else
470                                 new_columns.push("default");
471                                 
472                         column_index++;
473                 }
474         }
475
476         var new_configuration = new_columns.join(";");
477         //debugfilter("<br>NEW = "+new_configuration);
478
479         if (window.XMLHttpRequest)
480           {// code for IE7+, Firefox, Chrome, Opera, Safari
481           xmlhttp=new XMLHttpRequest();
482           }
483         else
484           {// code for IE6, IE5
485           xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
486           }
487         xmlhttp.onreadystatechange=function()
488           {
489           if (xmlhttp.readyState==4) // && xmlhttp.status==200)
490             {
491                 //value=xmlhttp.responseText;
492                 //debugfilter(value+"-----"+new_configuration);
493                 document.getElementById('column_configuration').value=value;
494                 document.getElementById('full_column_configuration').value=new_configuration;
495
496                 if (reload)
497                         window.location.reload(true);
498             }
499           }
500
501         xmlhttp.open("GET","/plekit/php/updateConfiguration.php?value="+new_configuration+"&slice_id="+slice_id+"&person_id="+person_id+"&tag_id="+tag_id,true);
502         //xmlhttp.open("GET","/plekit/php/updateConf.php?value="+value+"&slice_id="+slice_id+"&person_id="+person_id+"&tagName=Columnconf",true);
503
504         xmlhttp.send();
505 }
506
507 function logSortingAction(slice_id, value)
508 {
509
510         if (value.indexOf("column-1")!=-1)
511                 return;
512
513         var req = getHTTPObject();
514         var url = "/plekit/php/logSorting.php?value="+value+"&slice_id="+slice_id;
515
516         req.open('GET', url, true);
517         req.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
518         req.onreadystatechange =
519         function() {
520                 if (req.readyState == 4)
521                 { debugfilter(req.responseText); }
522         }
523         req.send(null);
524 }
525
526 function sortCompleteCallback(tableid) {
527
528         var slice_id = document.getElementById('slice_id').value;
529
530         var ths = document.getElementById(tableid).getElementsByTagName("th");
531         for(var i = 0, th; th = ths[i]; i++) {
532         if (th.className.indexOf("Sort") != -1)
533         {
534                 var column = th.className.substr(th.className.indexOf("column"),th.className.indexOf("column")+1);
535                 var sortdirection = th.className.substr(th.className.indexOf("Sort")-8,th.className.indexOf("Sort"));
536                 logSortingAction(slice_id, tableid+"|"+column+"|"+sortdirection);
537         }
538         }
539 }
540
541
542 function addColumnToConfiguration(column) {
543
544         var old_configuration = document.getElementById('column_configuration').value;
545
546         var new_configuration = "";
547
548         if (old_configuration != "")
549                 new_configuration = old_configuration += "|"+column;
550         else
551                 new_configuration = column;
552
553         //debugfilter("new configuration = "+new_configuration);
554
555         updateColumnConfiguration(new_configuration, false);
556 }
557
558
559 function deleteColumnFromConfiguration(column) {
560
561         var old_configuration = document.getElementById('column_configuration').value;
562
563         var old_columns = old_configuration.split("|");
564         var new_columns = new Array();
565
566         for (var column_index = 0; column_index < old_columns.length ; column_index++) {
567                 var conf = old_columns[column_index].split(':');
568                 if (conf[0] != column)
569                         new_columns.push(old_columns[column_index]);
570         }
571
572         var new_configuration = new_columns.join("|");
573         updateColumnConfiguration(new_configuration, false);
574
575 }
576
577 function replaceColumnConfiguration(column_old, column_new) {
578
579         var old_configuration = document.getElementById('column_configuration').value;
580
581         var old_columns = old_configuration.split("|");
582         var new_columns = new Array();
583
584         for (var column_index = 0; column_index < old_columns.length ; column_index++) {
585                 var conf = old_columns[column_index].split(':');
586                 if (conf[0] != column_old)
587                         new_columns.push(old_columns[column_index]);
588                 else
589                         new_columns.push(column_new);
590         }
591
592         var new_configuration = new_columns.join("|");
593         
594         updateColumnConfiguration(new_configuration);
595 }
596
597 /*
598  
599 ADD/REMOVE COLUMNS
600
601 */
602
603
604
605
606 function load_data(column, header, url) {
607
608         //debugfilter("<br>loading "+url);
609         var req = getHTTPObject();
610         var res;
611         req.open('GET', url, true);
612         req.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
613         req.onreadystatechange =
614         function() {
615                 if (req.readyState == 4)
616                 { updateColumnData(column, header, req.responseText); }
617         }
618         req.send(null);
619 }
620
621
622 function updateColumnData(column, header, data) {
623
624 var headers = header.split("|");
625 var data_table = data.split("|"); 
626
627 //debugfilter("<p>headers[0] = "+headers[0]);
628 //debugfilter("<p>data[2] = "+data_table[2]);
629
630 //debugfilter("data = "+data);
631
632 if (data != "")
633 {
634
635   var node_data;
636
637   var table_id1 = 'nodes';
638   var table=$(table_id1);
639   var css='#'+table_id1+'>tbody';
640   var rows = $$(css)[0].rows;
641
642   var data_array1 = new Array();
643
644   //debugfilter("COLUMN "+column+"<p>");
645
646   for (var node_index = 1; node_index < data_table.length; node_index++) {
647         if (data_table[node_index] == '---potential---')        
648                 break;
649         node_data = data_table[node_index].split(':');
650
651         data_array1[node_data[0]] = new Array();
652
653         for (var h_index=0; h_index < headers.length; h_index++) {
654                 
655                 if (node_data[h_index+1] == "")
656                         data_array1[node_data[0]][h_index] = "n/a";
657                 else
658                         data_array1[node_data[0]][h_index] = node_data[h_index+1];
659         }
660
661   }
662         
663
664   if (rows)
665   for (var row_index = 0; row_index < rows.length ; row_index++) {
666     var tr=rows[row_index];
667
668     for (var column_index=0; column_index < tr.cells.length; column_index++) {
669                 //debugfilter("<p>node id = "+tr.cells[0].innerHTML+" - "+tr.cells[column_index].getAttribute('name'));
670                 if (tr.cells[column_index].getAttribute('name'))
671                 {
672                 var found_index = headers.indexOf(tr.cells[column_index].getAttribute('name'));
673                 if (found_index != -1)
674                         //debugfilter(tr.cells[0].innerHTML+"-"+found_index);
675                         tr.cells[column_index].innerHTML = data_array1[tr.cells[0].innerHTML][found_index];
676                 }
677     }
678   }
679
680   fdTableSort.init(table_id1);
681   tablePaginater.init(table_id1);
682
683 //potential nodes
684 if (data_table[node_index] == '---potential---')        
685 {
686
687   var table_id2 = 'add_nodes';
688   var table2=$(table_id2);
689   var css2='#'+table_id2+'>tbody';
690   var rows2 = $$(css2)[0].rows;
691
692   var data_array2 = new Array();
693
694   //debugfilter("COLUMN "+column+"<p>");
695
696   for (; node_index < data_table.length; node_index++) {
697         if (data_table[node_index] == '')       
698                 continue;
699         node_data = data_table[node_index].split(':');
700
701         data_array2[node_data[0]] = new Array();
702
703         for (var h_index=0; h_index < headers.length; h_index++) {
704                 
705                 if (node_data[h_index+1] == "")
706                         data_array2[node_data[0]][h_index] = "n/a";
707                 else
708                         data_array2[node_data[0]][h_index] = node_data[h_index+1];
709         }
710   }
711         
712   if (rows)
713   for (var row_index = 0; row_index < rows2.length ; row_index++) {
714     var tr=rows2[row_index];
715
716     for (var column_index=0; column_index < tr.cells.length; column_index++) {
717                 if (tr.cells[column_index].getAttribute('name'))
718                 {
719                 var found_index = headers.indexOf(tr.cells[column_index].getAttribute('name'));
720                 if (found_index != -1)
721                         tr.cells[column_index].innerHTML = data_array2[tr.cells[0].innerHTML][found_index];
722                 }
723     }
724   }
725
726   //fdTableSort.removeTableCache(table_id2);
727   fdTableSort.init(table_id2);
728   tablePaginater.init(table_id2);
729 }
730
731 }
732
733 document.getElementById('loading'+column).innerHTML = "";
734
735 }
736
737
738 function addColumnCells(header) {
739
740         var cells = document.getElementsByName(header);
741
742         //debugfilter("got cells -"+cells+"- for "+header);
743         for(var j = 0; j < cells.length; j++) 
744                 cells[j].style.display = "table-cell";
745 }
746
747 function addSampleCells(column) {
748
749         var cellsheader = document.getElementsByName("confheader"+column);
750         for(var j = 0; j < cellsheader.length; j++) 
751                 cellsheader[j].style.display = "table-cell";
752
753 }
754
755 function addColumnAjax(column, header) {
756
757         //var t = document.getElementById('check'+column).name;
758         var t = document.getElementById('tagname'+header).value;
759         var slice_id = document.getElementById('slice_id').value;
760
761         var selectedperiod = document.getElementById('period'+column).value;
762
763         var fetched = document.getElementById('fetched'+column).value;
764         var to_load = false;
765
766         //debugfilter("<br>adding "+column+","+header+','+fetched+','+t);
767
768         if (fetched.indexOf("false")!=-1)
769         {
770                 to_load = true;
771                 document.getElementById('fetched'+column).value = ','+selectedperiod+',true';
772         }
773         else if (fetched.indexOf(','+selectedperiod+',')==-1)
774         {
775                         to_load = true;
776                         document.getElementById('fetched'+column).value = ','+selectedperiod+''+fetched;
777         }
778
779         if (to_load)
780         {
781                 document.getElementById('loading'+column).innerHTML = "<img width=10 src=/plekit/icons/ajax-loader.gif>";
782                 var url = "/plekit/php/updateColumn.php?slice_id="+slice_id+"&tagName="+t;
783                 load_data(column, header, url);
784         }
785 }
786
787
788
789 function addColumn(column, fetch) {
790
791         var selectedperiod="";
792         var header=column;
793
794         if (inTypeC(column)!=-1)
795         {
796                 column = column.substring(0,column.length-1);
797         }
798
799         selectedperiod = document.getElementById('period'+column).value;
800         header = column+""+selectedperiod;
801
802         //debugfilter("adding column "+column+" and header "+header);
803
804         addColumnCells(header);
805
806         if (fetch)
807                 addColumnAjax(column, header);
808
809         addColumnToConfiguration(header);
810         
811 }
812
813
814 function deleteColumnCells(header) {
815
816         var cells = document.getElementsByName(header);
817         for(var j = 0; j < cells.length; j++) 
818                 cells[j].style.display = "none";
819
820 }
821
822
823
824 function deleteColumn(column) {
825
826         var selectedperiod="";
827         var header=column;
828
829         selectedperiod = document.getElementById('period'+column).value;
830         header = column+""+selectedperiod;
831
832         //debugfilter("deleting "+column+","+header);
833
834         deleteColumnCells(header);
835
836         deleteColumnFromConfiguration(header);
837
838         //document.getElementById('check'+column).checked = false;
839 }
840
841
842 /* 
843  
844 EXTRA
845
846 //to be used for scrolling the column list with down/up arrows 
847
848 function scrollList(tableid) {
849
850 debugfilter("here");
851
852 if (event.keyCode == 40)
853         debugfilter("down");
854 else if (event.keyCode == 38)
855         debugfilter("up");
856
857 }
858
859 function resetColumns() {
860
861         for (var kk in column_table) {
862
863         if (column_table[kk]['visible'] == true && column_table[kk]['fetch'] == false)
864                 deleteColumn(kk);
865         else if (column_table[kk]['visible'] == false && column_table[kk]['fetch'] == true)
866                 addColumn(kk, true);
867         }
868
869 }
870
871 function resetCols(which_conf) {
872
873         var target_configuration = "|"+document.getElementById(which_conf).value+"|";
874         
875         //debugfilter("<p>Target configuration =  "+target_configuration);
876
877         for (var kk in column_table) {
878                 //debugfilter("in "+kk+" ");
879
880                 if (target_configuration.indexOf("|"+kk+"|")>=0)
881                 {
882                         if (document.getElementById('check'+kk))
883                         if (document.getElementById('check'+kk).checked == false)
884                         {
885                                 debugfilter("<p>Adding "+kk);
886                                 addColumn(kk, true);
887                         }
888                 }
889                 else
890                 {
891                         if (document.getElementById('check'+kk))
892                         if (document.getElementById('check'+kk).checked == true)
893                         {
894                                 debugfilter("<p>Deleting "+kk);
895                                 deleteColumn(kk);
896                         }
897                 }
898         }
899 }
900
901 function filterByType(selectedtype) {
902
903 var notselectedyet = true;
904
905 for (var kk in column_headers) {
906
907         if (document.getElementById(kk))
908         {
909                 if (window['type'+kk] == selectedtype)
910                 {
911                         document.getElementById(kk).className = 'in';
912                         if (notselectedyet)
913                                 highlightOption(kk);
914                         notselectedyet = false;
915                 }
916                 else
917                         document.getElementById(kk).className = 'out';
918         }
919 }
920 }
921
922
923 function deleteColumnSample() {
924         var cellsheader = document.getElementsByName("confheader"+column);
925         for(var j = 0; j < cellsheader.length; j++) 
926                 cellsheader[j].style.display = "none";
927
928 }
929
930 function checkDataToFetch() {
931
932 var dataExist = false;
933
934 for (var kk in column_table) {
935
936         if (document.getElementById(kk))
937         {
938                 if (column_table[kk]['visible'] == true && column_table[kk]['fetch'] == false)
939                 {
940                         document.getElementById('fetchbutton').disabled = false;
941                         document.getElementById('fetchbutton').style.color = 'red';
942                         dataExist = true;
943                 }
944         }
945 }
946
947 if (!dataExist)
948 {
949         document.getElementById('fetchbutton').disabled = true;
950         document.getElementById('fetchbutton').style.color = 'grey';
951 }
952
953 }
954
955
956 function fetchData() {
957
958 var tagnames = "";
959 var headers = "";
960
961 for (var kk in column_table) {
962
963 if (column_table[kk]['visible'] == true && column_table[kk]['fetch'] == false)
964         if (tagnames == "")
965         {       
966                 tagnames = column_table[kk]['tagname'];
967                 headers = kk;
968         }
969         else
970         {
971                 tagnames += "|"+column_table[kk]['tagname'];
972                 headers += "|"+kk;
973         }
974 }
975
976 //debugfilter("fetching these columns: "+tagnames+ "("+headers+")");
977
978         var slice_id = document.getElementById('slice_id').value;
979         document.getElementById('loadingDiv').innerHTML = "&nbsp;&nbsp;&nbsp;<img src=/plekit/icons/ajax-loader.gif>&nbsp;Loading data. Please wait ...";
980         var url = "/plekit/php/updateColumn.php?slice_id="+slice_id+"&tagName="+tagnames;
981         load_data(headers, url);
982 }
983
984
985 /*
986  
987
988 HIGHLIGHTING
989
990
991
992 function updateColumnThreshold(column, minT, maxT) {
993
994 debugfilter("updating threshold for "+column+" with "+minT+" and "+maxT);
995
996 var cells = document.getElementsByName(column);
997
998 for(var j = 0; j < cells.length; j++) 
999 {
1000 var val = parseFloat(cells[j].innerHTML);
1001
1002 if (val >= minT && val <= maxT)
1003         cells[j].style.color = filtered_color;
1004 else
1005         cells[j].style.color = normal_color;
1006 }
1007
1008 var old_configuration = document.getElementById('column_configuration').value;
1009 var slice_id = document.getElementById('slice_id').value;
1010
1011 var old_columns = old_configuration.split("|");
1012 var new_columns = new Array();
1013
1014 for (var column_index = 0; column_index < old_columns.length ; column_index++) {
1015         var conf = old_columns[column_index].split(':');
1016         if (conf[0] != column)
1017                 new_columns.push(old_columns[column_index]);
1018         else
1019                 new_columns.push(column+":"+minT+","+maxT);
1020 }
1021
1022 var new_configuration = new_columns.join("|");
1023
1024 updateColumnConfiguration(slice_id, new_configuration);
1025
1026 }
1027
1028 function updateExcludeList(column, excludeList) {
1029
1030 //debugfilter("updating list");
1031 debugfilter("updating list for "+column+" with "+excludeList);
1032
1033 var cells = document.getElementsByName(column);
1034
1035 for(var j = 1; j < cells.length; j++) 
1036 {
1037 var val = cells[j].innerHTML;
1038
1039 if (excludeList == val)
1040         cells[j].style.color = filtered_color;
1041 else
1042         cells[j].style.color = normal_color;
1043 }
1044
1045 var old_configuration = document.getElementById('column_configuration').value;
1046 var slice_id = document.getElementById('slice_id').value;
1047
1048 var old_columns = old_configuration.split("|");
1049 var new_columns = new Array();
1050
1051 for (var column_index = 0; column_index < old_columns.length ; column_index++) {
1052         var conf = old_columns[column_index].split(':');
1053         if (conf[0] != column)
1054                 new_columns.push(old_columns[column_index]);
1055         else
1056                 new_columns.push(column+":"+excludeList);
1057 }
1058
1059 var new_configuration = new_columns.join("|");
1060
1061 updateColumnConfiguration(slice_id, new_configuration);
1062
1063 }
1064
1065
1066
1067 /*
1068  
1069 ROW FILTERING
1070
1071
1072 function plekit_table_showAll (slicetable_id) {
1073
1074   var table=$(slicetable_id);
1075   var css='#'+slicetable_id+'>tbody';
1076   var rows = $$(css)[0].rows;
1077
1078   // scan rows, elaborate 'visible'
1079   for (var row_index = 0; row_index < rows.length ; row_index++) {
1080     var tr=rows[row_index];
1081     var visible=true;
1082     plekit_table_row_visible(tr,visible);
1083   }
1084
1085     plekit_table_count_filtered(slicetable_id);
1086
1087   tablePaginater.init(slicetable_id);
1088   
1089 }
1090
1091 function plekit_table_count_filtered (slicetable_id) {
1092   var table=$(slicetable_id);
1093   var css='#'+slicetable_id+'>tbody';
1094   var rows = $$(css)[0].rows;
1095
1096   var no_filtered=0;
1097
1098   // scan rows, elaborate 'visible'
1099   for (var row_index = 0; row_index < rows.length ; row_index++) {
1100     var tr=rows[row_index];
1101     var filtered = false;
1102
1103     for (var column_index=0; column_index < tr.cells.length; column_index++) 
1104                 if (tr.cells[column_index].style.color == "red")
1105                         filtered = true;
1106
1107         if (filtered)
1108         no_filtered++;
1109
1110   }
1111
1112   debugfilter(no_filtered+' nodes do not satisfy the requested threshold');
1113 }
1114
1115
1116 function plekit_table_hide_filtered (slicetable_id) {
1117   var table=$(slicetable_id);
1118   var css='#'+slicetable_id+'>tbody';
1119   var rows = $$(css)[0].rows;
1120
1121   var reg = /(^|\s)invisibleRow(\s|$)/;
1122
1123
1124   if (!document.getElementById('filtercheck').checked)
1125   {
1126         plekit_table_showAll(slicetable_id);
1127         return;
1128   }
1129
1130   var hidden=0;
1131
1132   // scan rows, elaborate 'visible'
1133   for (var row_index = 0; row_index < rows.length ; row_index++) {
1134     var tr=rows[row_index];
1135     var visible=true;
1136
1137     for (var column_index=0; column_index < tr.cells.length; column_index++) {
1138                 if (tr.cells[column_index].style.color == filtered_color)
1139                         visible = false;
1140     }
1141     if (!visible)
1142         hidden++;
1143
1144     plekit_table_row_visible(tr,visible);
1145   }
1146
1147   //debugfilter('hidden '+hidden+' nodes');
1148   debugfilter(hidden+' nodes do not satisfy the requested threshold (hidden)');
1149   
1150   tablePaginater.init(slicetable_id);
1151 }
1152
1153
1154
1155
1156 function plekit_table_apply_config(slicetable_id, configuration) {
1157
1158 var new_configuration = document.getElementById('new_conf').value;
1159 var all_columns = new_configuration.split("|");
1160
1161 var min_values = new Array();
1162 var max_values = new Array();
1163
1164
1165 for (var column_index = 0; column_index < all_columns.length ; column_index++) {
1166
1167         var conf = all_columns[column_index].split(':');
1168         
1169         if (inTypeB(conf[0]) != -1)
1170         {
1171                 var threshold = conf[1].split(',');
1172                 if (threshold.length == 2)
1173                 {
1174                 min_values.push(parseFloat(threshold[0]));
1175                 max_values.push(parseFloat(threshold[1]));
1176                 }
1177         }
1178         else if (inTypeC(conf[0]) == -1)
1179         {
1180                 var threshold = conf[2].split(',');
1181                 if (threshold.length == 2)
1182                 {
1183                 min_values.push(parseInt(threshold[0]));
1184                 max_values.push(parseInt(threshold[1]));
1185                 }
1186         }
1187         else
1188         {
1189                 min_values.push(-1);
1190                 max_values.push(-1);
1191         }
1192         
1193 }
1194
1195   var table=$(slicetable_id);
1196   var css='#'+slicetable_id+'>tbody';
1197   var rows = $$(css)[0].rows;
1198
1199
1200   var no_filtered=0;
1201
1202   for (var row_index = 0; row_index < rows.length ; row_index++) {
1203
1204         var tr=rows[row_index];
1205
1206         var filtered = false;
1207
1208         for (var column_index = 0; column_index < all_columns.length ; column_index++) 
1209         if (min_values[column_index]!=-1)
1210         {
1211                 var val = parseFloat(tr.cells[3+column_index].innerHTML);
1212                 
1213                 if (val >= min_values[column_index] && val <= max_values[column_index])
1214                 {
1215                         tr.cells[3+column_index].style.color = filtered_color;
1216                         filtered = true;
1217                 }
1218                 else
1219                         tr.cells[3+column_index].style.color = normal_color;
1220         }
1221         else
1222                 if (tr.cells[3+column_index].style.color == filtered_color)
1223                         filtered = true;
1224                 
1225
1226         if (filtered)
1227         no_filtered++;
1228   }
1229
1230   debugfilter(no_filtered+' nodes do not satisfy the requested threshold');
1231
1232   //tablePaginater.init(slicetable_id);
1233
1234 }
1235
1236
1237 function reset_select () {
1238   var table=$(slicetable_id);
1239   var css='#'+slicetable_id+'>tbody';
1240   var rows = $$(css)[0].rows;
1241
1242 var action = document.getElementById('onlyselected');
1243 action.checked=false;
1244
1245   // scan rows, elaborate 'visible'
1246   for (var row_index = 0; row_index < rows.length ; row_index++) {
1247     var tr=rows[row_index];
1248
1249     document.getElementById("check"+tr.id).checked=false;
1250
1251   }
1252
1253   plekit_table_count_nodes();
1254 }
1255
1256 }
1257
1258
1259 function plekit_table_select_filter () {
1260   var table=$(slicetable_id);
1261   var css='#'+slicetable_id+'>tbody';
1262   var rows = $$(css)[0].rows;
1263
1264   var reg = /(^|\s)invisibleRow(\s|$)/;
1265
1266   var action = document.getElementById('onlyselected');
1267   if (!action.checked)
1268         plekit_table_reset_filter();
1269
1270   // scan rows, elaborate 'visible'
1271   for (var row_index = 0; row_index < rows.length ; row_index++) {
1272     var tr=rows[row_index];
1273     var visible=true;
1274
1275     if (action.checked)
1276     {
1277          if(tr.className.search(reg) == -1) 
1278               if(!document.getElementById("check"+tr.id).checked)
1279                   visible=false;
1280     }
1281
1282     if(tr.className.search(reg) != -1) 
1283         visible=false;
1284
1285     plekit_table_row_visible(tr,visible);
1286   }
1287   
1288   tablePaginater.init(slicetable_id);
1289   plekit_table_count_nodes();
1290 }
1291
1292 function plekit_table_select_filter2 () {
1293   var table=$(slicetable_id);
1294   var css='#'+slicetable_id+'>tbody';
1295   var rows = $$(css)[0].rows;
1296
1297   var reg = /(^|\s)invisibleRow(\s|$)/;
1298
1299   var action = document.getElementById('onlyselected');
1300
1301   // scan rows, elaborate 'visible'
1302   for (var row_index = 0; row_index < rows.length ; row_index++) {
1303     var tr=rows[row_index];
1304     var visible=true;
1305
1306     if (action.checked)
1307     {
1308          if(tr.className.search(reg) == -1) 
1309               if(!document.getElementById("check"+tr.id).checked)
1310                   visible=false;
1311     }
1312
1313     if(tr.className.search(reg) != -1) 
1314         visible=false;
1315
1316     plekit_table_row_visible(tr,visible);
1317   }
1318   
1319   tablePaginater.init(slicetable_id);
1320   plekit_table_count_nodes();
1321 }
1322
1323 function CheckTopNodes(n) {
1324   var table=$(slicetable_id);
1325   var css='#'+slicetable_id+'>tbody';
1326   var rows = $$(css)[0].rows;
1327   var reg = /(^|\s)invisibleRow(\s|$)/;
1328
1329   var checked=0;
1330
1331   for (var row_index = 0; row_index < rows.length ; row_index++) {
1332     var tr=rows[row_index];
1333
1334     if(tr.className.search(reg) == -1) {
1335         if (checked<n)
1336         {
1337                 document.getElementById("check"+tr.id).checked=true;
1338                 checked++;
1339         }
1340         else
1341         {
1342                 document.getElementById("check"+tr.id).checked=false;
1343         };
1344     };
1345    };
1346 };
1347
1348
1349 function CheckRandomNodes(n) {
1350   var table=$(slicetable_id);
1351   var css='#'+slicetable_id+'>tbody';
1352   var rows = $$(css)[0].rows;
1353   var reg = /(^|\s)invisibleRow(\s|$)/;
1354
1355   var r = n/plekit_table_visible_count();
1356   var checked=0;
1357
1358   for (var row_index = 0; row_index < rows.length ; row_index++) {
1359     var tr=rows[row_index];
1360
1361     if(tr.className.search(reg) == -1) {
1362         if(Math.random() < r) {
1363                 document.getElementById("check"+tr.id).checked=true;
1364                 checked++;
1365         };
1366         if (checked>=n)
1367                 break;
1368      };
1369   };
1370 };
1371
1372
1373 function plekit_table_visible_count() {
1374   var table=$(slicetable_id);
1375   var css='#'+slicetable_id+'>tbody';
1376   var rows = $$(css)[0].rows;
1377   var reg = /(^|\s)invisibleRow(\s|$)/;
1378   var v=0;
1379
1380   for (var row_index = 0; row_index < rows.length ; row_index++) {
1381     var tr=rows[row_index];
1382
1383         if(tr.className.search(reg) == -1) 
1384         {
1385                 v++;
1386         }
1387   }
1388
1389   return v;
1390 }
1391
1392
1393 function plekit_table_count_nodes() {
1394   var table=$(slicetable_id);
1395   var css='#'+slicetable_id+'>tbody';
1396   var rows = $$(css)[0].rows;
1397   var reg = /(^|\s)invisibleRow(\s|$)/;
1398   var n=0;
1399   var v=0;
1400   var s=0;
1401
1402   for (var row_index = 0; row_index < rows.length ; row_index++) {
1403     var tr=rows[row_index];
1404
1405         n++;
1406         var ch = document.getElementById("check"+tr.id);
1407
1408         if(tr.className.search(reg) == -1) 
1409                 v++;
1410         else
1411         {
1412                 if (ch.checked)
1413                         ch.checked=false;
1414         };
1415
1416         if (ch.checked)
1417                 s++;
1418         
1419    };
1420
1421    var dd = document.getElementById('node_statistics');
1422    dd.innerHTML = "Total: "+n+" - Shown: "+v+" - Selected: "+s;
1423 };
1424
1425 function AutoSelect()
1426 {
1427   var a = document.getElementById('automatic').value;
1428   var n = parseInt(document.getElementById('no_nodes').value);
1429
1430   if (isNaN(n))
1431         return;
1432
1433   if (a == "random")
1434          CheckRandomNodes(n);
1435   else if (a == "top")
1436          CheckTopNodes(n);
1437
1438   plekit_table_select_filter2();
1439   plekit_table_count_nodes();
1440 }
1441
1442 */