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