32dbbf3d5e98383e07885c6e71a53ed291cff46e
[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 class="source-url" target="source_window" href="http://comon.cs.princeton.edu/">CoMon</a>';
10 var sourceTophat = '<a class="source-url" target="source_window" href="http://www.top-hat.info/">TopHat</a>';
11 var sourceTophatAPI = '<a class="source-url" target="source_window" href="http://www.top-hat.info/API/">TopHat API</a>';
12 var sourceMySlice = '<a class="source-url" target="source_window" href="http://myslice.info/">MySlice</a>';
13 var sourceCymru = '<a class="source-url" target="source_window" href="http://www.team-cymru.org/">Team Cymru</a>';
14 var sourceSonoma = '<a class="source-url" target="source_window" href="http://sonoma.etomic.org/">SONoMA</a>';
15 var sourceMyPLC = '<a class="source-url" target="source_window" href="https://www.planet-lab.eu/db/doc/PLCAPI.php">MyPLC API</a>';
16 var sourceManiacs = '<a class="source-url" target="source_window" href="http://www.ece.gatech.edu/research/labs/MANIACS/as_taxonomy/">MANIACS</a>';
17 var sourceMaxmind = '<a class="source-url" target="source_window" href="http://www.maxmind.com/app/geolitecity">MaxMind</a>';
18 var sourceMonitor = '<a class="source-url" target="source_window" href="http://monitor.planet-lab.org/">Monitor</a>';
19 var hardwareReqs = 'current <a class="info-url" target="info_window" href="http://www.planet-lab.org/hardware">PlanetLab hardware requirement</a>';
20 var selectReferenceNode ='<div id="refnodes_div"></div>';
21 var selectReferenceNodeRTT ='<div id="refnodes_rtt_div"></div>';
22
23 var descHOSTNAME = "test";
24
25 var titleAU = 'Authority';
26 var detailAU = 'The authority of the global PlanetLab federation that the site of the node belongs to.';
27 var valuesAU = '<span class="bold">PLC</span> (PlanetLab Central), <span class="bold">PLE</span> (PlanetLab Europe)';
28 var sourceAU = 'Source: '+sourceMyPLC;
29 var descAU = '<span class="gray"><span class="column-title">'+titleAU+'</span><p><span class="column-detail">'+detailAU+'</span></p><p>Values: '+valuesAU+'</p><p>Source: '+sourceMyPLC+'</p></span>';
30
31 var titleST = 'Status';
32 var sourceST = 'Source: '+sourceMonitor;
33 var valuesST = 'Values: <span class="bold">online</span> (up and running), <span class="bold">good</span> (up and running recently), <span class="bold">offline</span> (unreachable today), <span class="bold">down</span> (node unreachable for more than one day), <span class="bold">failboot</span> (reachable, but only by administrators for debugging purposes).';
34 var descST = '<span class="gray"><span class="column-title">'+titleST+'</span><p>'+valuesST+'</p><p>'+sourceST+'</p></span>';
35
36 var titleA = 'Architecture name';
37 var detailA = 'The node architecture.';
38 var sourceA = 'Source: '+sourceMyPLC;
39 var valuesA = '<span class="bold">x86_64</span>, <span class="bold">i386</span>, <span class="bold">n/a</span>';
40 var descA = '<span class="gray"><span class="column-title">'+titleA+'</span><p><span class="column-detail">'+detailA+'</span></p><p>Values: '+valuesA+'</p><p>'+sourceA+'</p></span>';
41
42 var titleAS = 'Autonomous system ID';
43 var sourceAS = 'Source: '+sourceCymru+' (via '+sourceTophat+')';
44 var valuesAS = 'Values: <span class="bold">Integer between 0 and 65535</span>, <span class="bold">n/a</span>';
45 var descAS = '<span class="gray"><span class="column-title">'+titleAS+'</span><p>'+valuesAS+'</p><p>' + sourceAS+'</p></span>';
46
47 var titleAST = 'Autonomous system type';
48 var sourceAST = 'Source: '+sourceManiacs;
49 var valuesAST = 'Values: <span class="bold">t1</span> (tier-1), <span class="bold">t2</span> (tier-2), <span class="bold">edu</span> (university), <span class="bold">comp</span> (company), <span class="bold">nic</span> (network information centre -- old name for a domain name registry operator), <span class="bold">ix</span> (IXP), <span class="bold">n/a</span>';
50 var descAST = '<span class="gray"><span class="column-title">'+titleAST+'</span><p>'+valuesAST+'</p><p>'+sourceAST+'</p></span>';
51
52 var titleASN = 'Autonomous system name';
53 var sourceASN = 'Source: '+sourceTophat;
54 var descASN = '<span class="gray"><span class="column-title">'+titleASN+'</span><p>'+sourceASN+'</p></span>';
55
56 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>';
57 var titleBU = 'Bandwidth utilization ';
58 var sourceBU = 'Source: '+sourceComon+' (via '+sourceMySlice+')';
59 var valuesBU ='Unit: <span class="bold">Kbps</span>';
60 var detailBU = '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.'
61 var descBU = '<span class="gray"><span class="column-title">'+titleBU+'</span><p><span class="column-detail">'+detailBU+'</span></p><p>'+selectPeriodBU+'</p><p>'+valuesBU+'</p><p>'+sourceBU+'</p></span>'; 
62
63 var titleBW= 'Bandwidth limit';
64 var sourceBW = 'Source: '+sourceComon;
65 var valuesBW = 'Unit: <span class="bold">Kbps</span>';
66 var detailBW = '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>.';
67 var descBW = '<span class="gray"><span class="column-title">'+titleBW+'</span><p><span class="column-detail">'+detailBW+'</span></p><p>'+valuesBW+'</p><p>'+sourceBW+'</p></span>';
68
69 var titleCC = 'Number of CPU cores';
70 var sourceCC = 'Source: '+sourceComon;
71 var detailCC = 'The number of CPU cores on the node. For reference, the '+hardwareReqs+' is <span class="bold">4 cores min.</span> (Older nodes may have fewer cores).';
72 var descCC = '<span class="gray"><span class="column-title">'+titleCC+'</span><p><span class="column-detail">'+detailCC+'</span></p><p>'+sourceCC+'</p></span>';
73
74 var titleCN = 'Number of CPUs';
75 var sourceCN = 'Source: '+sourceComon;
76 var detailCN = 'The number of CPUs on the node. For reference, the '+hardwareReqs+' is <span class="bold">1 (if quad core) or 2 (if dual core)</span>.';
77 var descCN = '<span class="gray"><span class="column-title">'+titleCN+'</span><p><span class="column-detail">'+detailCN+'</detail></p><p>'+sourceCN+'</p></span>';
78
79 var titleCPC = 'Number of cores per CPU';
80 var sourceCPC = 'Source: '+sourceComon;
81 var detailCPC = 'The number of cores per CPU on the node.'; 
82 var descCPC = '<span class="gray"><span class="column-title">'+titleCPC+'</span><p><span class="column-detail">'+detailCPC+'</span></p><p>'+sourceCPC+'</p></span>';
83
84 var titleCR = 'CPU clock rate';
85 var detailCR = 'The clock rate for the CPUs on the node. For reference, the '+hardwareReqs+' is <span class="bold">2.4 GHz</span>.';
86 var sourceCR = 'Source: '+sourceComon;
87 var valuesCR = 'Unit: <span class="bold">GHz</span>';
88 var descCR = '<span class="gray"><span class="column-title">'+titleCR+'</span><p><span class="column-detail">'+detailCR+'</span></p><p>'+valuesCR+'</p><p>'+sourceCR+'</p></span>';
89
90 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>';
91 var titleCF = 'Free CPU';
92 var sourceCF = 'Source: '+sourceComon+' (via '+sourceMySlice+')';
93 var valuesCF = 'Unit: <span class="bold">%</span>';
94 var detailCF = 'The average CPU percentage that gets allocated to a test slice named burb that is periodically run by CoMon.';
95 var descCF = '<span class="gray"><span class="column-title">'+titleCF+'</span><p><span class="column-detail">'+detailCF+'</span></p><p>'+selectPeriodCF+'</p><p>'+valuesCF+'</p><p>'+sourceCF+'</p></span>'; 
96
97 var titleDN = 'Toplevel domain name';
98 var sourceDN = 'Source: '+sourceMyPLC;
99 var descDN = '<span class="gray"><span class="column-title">'+titleDN+'</span><p>'+sourceDN+'</p></span>';
100
101 var titleDA = 'Date added';
102 var sourceDA = 'Source: '+sourceMyPLC;
103 var detailDA = 'The date that the node was added to PlanetLab.';
104 var descDA = '<span class="gray"><span class="column-title">'+titleDA+'</span><p><span class="column-detail">'+detailDA+'</span></p><p>'+sourceDA+'</p></span>';
105
106 var titleDL = 'Deployment';
107 var detailDL = 'The deployment status.';
108 var valuesDL = 'Values: <span class="bold">alpha</span>, <span class="bold">beta</span>, <span class="bold">production</span>, <span class="bold">n/a</span>';
109 var sourceDL = 'Source: '+sourceMyPLC;
110 var descDL = '<span class="gray"><span class="column-title">'+titleDL+'</span><p><span class="column-detail">'+detailDL+'</span></p><p>'+valuesDL+'</p><p>'+sourceDL+'</p></span>';
111
112 var titleDS = 'Disk size';
113 var detailDS = 'The size of the hard disk available on the node. For reference, the '+hardwareReqs+' is <span class="bold">500 GB</span>.';
114 var sourceDS = 'Source: '+sourceComon;
115 var valuesDS = 'Unit: <span class="bold">GB</span>';
116 var descDS = '<span class="gray"><span class="column-title">'+titleDS+'</span><p><span class="column-detail">'+detailDS+'</span></p><p>'+valuesDS+'</p><p>'+sourceDS+'</p></span>';
117
118 var titleDU = 'Current disk utilization';
119 var sourceDU = 'Source: '+sourceComon;
120 var valuesDU = 'Unit: <span class="bold">GB</span>';
121 var detailDU = 'The amount of disk space currently consumed.';
122 var descDU = '<span class="gray"><span class="column-title">'+titleDU+'</span><p><span class="column-detail">'+detailDU+'</span></p><p>'+valuesDU+'</p><p>'+sourceDU+'</p></span>';
123
124 var titleDF = 'Disk space free';
125 var sourceDF = 'Source: '+sourceComon;
126 var valuesDF = 'Unit: <span class="bold">GB</span>.';
127 var detailDF = 'The amount of disk space currently available.';
128 var descDF = '<span class="gray"><span class="column-title">'+titleDF+'</span><p><span class="column-detail">'+detailDF+'</span></p><p>'+valuesDF+'</p><p>'+sourceDF+'</p></span>';
129
130 var titleHC = 'Hop count (pairwise)';
131 var sourceHC = 'Source: '+sourceTophat;
132 var detailHC = '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.';
133 var descHC = '<span class="gray"><span class="column-title">'+titleHC+'</span><p><span class="column-detail">'+detailHC+'</span></p><p>'+selectReferenceNode+'</p><p>'+sourceHC+'</p></span>';
134
135 var titleIP = 'IP address';
136 var sourceIP = 'Source: '+sourceMyPLC;
137 var descIP = '<span class="gray"><span class="column-title">'+titleIP+'</span><p>'+sourceIP+'</p></span>';
138
139 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>';
140 var titleL= 'Load ';
141 var sourceL = 'Source: '+sourceComon;
142 var valuesL = 'Unit: <span class="bold">5-minute load</span>';
143 var detailL = 'The average 5-minute load (as reported by the Unix uptime command) over the selected period.';
144 var descL = '<span class="gray"><span class="column-title">'+titleL+'</span><p><span class="column-detail">'+detailL+'</span></p><p>'+selectPeriodL+'</p><p>'+valuesL+'</p><p>'+sourceL+'</p></span>'; 
145
146 var titleLON= 'Longitude';
147 var sourceLON = 'Source: '+sourceTophat;
148 var descLON = '<span class="gray"><span class="column-title">'+titleLON+'</span><p>'+sourceLON+'</p></span>';
149
150 var titleLAT= 'Latitude';
151 var sourceLAT = 'Source: '+sourceTophat;
152 var descLAT = '<span class="gray"><span class="column-title">'+titleLAT+'</span><p>'+sourceLAT+'</p></span>';
153
154 var titleLCN= 'Location (Country)';
155 var sourceLCN = 'Source: '+sourceMaxmind+' (via '+sourceTophat+')';
156 var detailLCN = 'Based on the latitude and longitude information.';
157 var descLCN = '<span class="gray"><span class="column-title">'+titleLCN+'</span><p><span class="column-detail">'+detailLCN+'</span></p><p>'+sourceLCN+'</p></span>';
158
159 var titleLCT= 'Location (Continent)';
160 var sourceLCT = 'Source: '+sourceMaxmind+' (via '+sourceTophat+')';
161 var detailLCT = 'Based on the latitude and longitude information.';
162 var descLCT = '<span class="gray"><span class="column-title">'+titleLCT+'</span><p><span class="column-detail">'+detailLCT+'</span></p><p>'+sourceLCT+'</p></span>';
163
164 var titleLCY= 'Location (City)';
165 var sourceLCY = 'Source: '+sourceMaxmind+' (via '+sourceTophat+')';
166 var detailLCY = 'Based on the latitude and longitude information.';
167 var descLCY = '<span class="gray"><span class="column-title">'+titleLCY+'</span><p><span class="column-detail">'+detailLCY+'</span></p><p>'+sourceLCY+'</p></span>';
168
169 var titleLPR= 'Location precision radius';
170 var sourceLPR = 'Source: '+sourceTophat;
171 var valuesLPR = 'Unit: <span class="bold">float</span>.';
172 var detailLPR = 'The radius of the circle corresponding to the error in precision of the geolocalization estimate.';
173 var descLPR = '<span class="gray"><span class="column-title">'+titleLPR+'</span><p><span class="column-detail">'+detailLPR+'</span></p><p>'+valuesLPR+'</p><p>'+sourceLPR+'</p></span>';
174
175 var titleLRN= 'Location (Region)';
176 var sourceLRN = 'Source: '+sourceMaxmind+' (via '+sourceTophat+')';
177 var detailLRN = 'Based on the latitude and longitude information.';
178 var descLRN = '<span class="gray"><span class="column-title">'+titleLRN+'</span><p><span class="column-detail">'+detailLRN+'</span></p><p>'+sourceLRN+'</p></span>';
179
180 var titleMS= 'Memory size';
181 var detailMS = 'The memory size (RAM) available on the node. For reference, the '+hardwareReqs+' is <span class="bold">4 GB</span>.';
182 var sourceMS = 'Source: '+sourceComon;
183 var valuesMS = 'Unit: <span class="bold">GB</span>.';
184 var descMS = '<span class="gray"><span class="column-title">'+titleMS+'</span><p><span class="column-detail">'+detailMS+'</span></p><p>'+valuesMS+'</p><p>'+sourceMS+'</p></span>';
185
186 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>';
187 var titleMU = 'Memory utilization';
188 var sourceMU = 'Source: '+sourceComon;
189 var valuesMU = 'Unit: <span class="bold">%</span>';
190 var detailMU = 'The average active memory utilization as reported by CoMon.';
191 var descMU = '<span class="gray"><span class="column-title">'+titleMU+'</span><p><span class="column-detail">'+detailMU+'</span></p><p>'+selectPeriodMU+'</p><p>'+valuesMU+'</p><p>'+sourceMU+'</p></span>'; 
192
193 var titleMA= 'Measurement agents';
194 var sourceMA = 'Source: '+sourceTophat;
195 var valuesMA = 'Values: <span class="bold">ETOMIC</span>, <span class="bold">SONoMA</span>, <span class="bold">TDMI</span>, <span class="bold">DIMES</span>.';
196 var detailMA = 'Co-located measurement agents.';
197 var descMA = '<span class="gray"><span class="column-title">'+titleMA+'</span><p><span class="column-detail">'+detailMA+'</span></p><p>'+valuesMA+'</p><p>'+sourceMA+'</p></span>';
198
199 var titleMAS= 'Measurement agent SONoMA';
200 var sourceMAS = 'Source: '+sourceTophat;
201 var valuesMAS = 'Values: <span class="bold">Node type</span> (e.g., PLE, APE)';
202 var detailMAS = '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+'.';
203 var descMAS = '<span class="gray"><span class="column-title">'+titleMAS+'</span><p><span class="column-detail">'+detailMAS+'</span></p><p>'+valuesMAS+'</p><p>'+sourceMAS+'</p></span>';
204
205 var titleMAE= 'Measurement agent ETOMIC';
206 var sourceMAE = 'Source: '+sourceTophat;
207 var valuesMAE = 'Values: <span class="bold">yes/no</span>';
208 var detailMAE = '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+'.';
209 var descMAE = '<span class="gray"><span class="column-title">'+titleMAE+'</span><p><span class="column-detail">'+detailMAE+'</span></p><p>'+valuesMAE+'</p><p>'+sourceMAE+'</p></span>';
210
211 var titleMAT= 'Measurement agent TDMI';
212 var sourceMAT = 'Source: '+sourceTophat;
213 var valuesMAT = 'Values: <span class="bold">yes/no</span>';
214 var detailMAT = '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+'.';
215 var descMAT = '<span class="gray"><span class="column-title">'+titleMAT+'</span><p><span class="column-detail">'+detailMAT+'</span></p><p>'+valuesMAT+'</p><p>'+sourceMAT+'</p></span>';
216
217 var titleMAD= 'Measurement agent DIMES';
218 var sourceMAD = 'Source: '+sourceTophat;
219 var valuesMAD = 'Values: <span class="bold">yes/no</span>';
220 var detailMAD = 'The existence of a colocated DIMES agent. When a DIMES agent is present, you have access to DIMES measurements through the '+sourceTophatAPI+'.';
221 var descMAD = '<span class="gray"><span class="column-title">'+titleMAD+'</span><p><span class="column-detail">'+detailMAD+'</span></p><p>'+valuesMAD+'</p><p>'+sourceMAD+'</p></span>';
222
223 var titleNSF= 'Network information (spoof)';
224 var sourceNSF = 'Source: '+sourceTophat;
225 var valuesNSF = 'Values: <span class="bold">yes/no</span>';
226 var detailNSF = 'Whether the node can send packets successfully (or not) with a spoofed IP source address.';
227 var descNSF = '<span class="gray"><span class="column-title">'+titleNSF+'</span><p><span class="column-detail">'+detailNSF+'</span></p><p>'+valuesNSF+'</p><p>'+sourceNSF+'</p></span>';
228
229 var titleNSR= 'Network information (source route)';
230 var sourceNSR = 'Source: '+sourceTophat;
231 var valuesNSR = 'Values: <span class="bold">yes/no</span>';
232 var detailNSR = '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.';
233 var descNSR = '<span class="gray"><span class="column-title">'+titleNSR+'</span><p><span class="column-detail">'+detailNSR+'</span></p><p>'+valuesNSR+'</p><p>'+sourceNSR+'</p></span>';
234
235 var titleNTP= 'Network information (timestamp)';
236 var sourceNTP = 'Source: '+sourceTophat;
237 var valuesNTP = 'Values: <span class="bold">yes/no</span>';
238 var detailNTP = '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.';
239 var descNTP = '<span class="gray"><span class="column-title">'+titleNTP+'</span><p><span class="column-detail">'+detailNTP+'</span></p><p>'+valuesNTP+'</p><p>'+sourceNTP+'</p></span>';
240
241 var titleNRR= 'Network information (record route)';
242 var sourceNRR = 'Source: '+sourceTophat;
243 var valuesNRR = 'Values: <span class="bold">yes/no</span>';
244 var detailNRR = '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.';
245 var descNRR = '<span class="gray"><span class="column-title">'+titleNRR+'</span><p><span class="column-detail">'+detailNRR+'</span></p><p>'+valuesNRR+'</p><p>'+sourceNRR+'</p></span>';
246
247 var titleOS = 'Operating system';
248 var detailOS = 'Fedora or CentOS distribution to use for node or slivers.';
249 var sourceOS = 'Source: '+sourceMyPLC;
250 var valuesOS = 'Values: <span class="bold">f8, f12, Cent/OS, other, n/a</span>';
251 var descOS = '<span class="gray"><span class="column-title">'+titleOS+'</span><p><span class="column-detail">'+detailOS+'</span></p><p>'+valuesOS+'</p><p>'+sourceOS+'</p></span>';
252
253 var titleRTT = 'Round Trip Time (pairwise)';
254 var detailRTT = 'The round trip time between a selected SONoMA agent and PlanetLab nodes.';
255 var sourceRTT = 'Source: '+sourceSonoma+' (via '+sourceTophat+ ')';
256 var descRTT = '<span class="gray"><span class="column-title">'+titleRTT+'</span><p><span class="column-detail">'+detailRTT+'</span></p><p>'+selectReferenceNodeRTT+'</p><p>'+sourceRTT+'</p></span>';
257
258 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>';
259 var titleR = 'Reliability';
260 var sourceR = 'Source: '+sourceComon+' (via '+sourceMySlice+')';
261 var detailR = '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.';
262 var valuesR = 'Unit: <span class="bold">%</span>';
263 var descR = '<span class="gray"><span class="column-title">'+titleR+'</span><p><span class="column-detail">'+detailR+'</span></p><p>'+selectPeriodR+'</p><p>'+valuesR+'</p><p>'+sourceR+'</p></span>'; 
264
265 var titleRES = 'Reservation capabilities';
266 var sourceRES = 'Source: '+sourceMyPLC;
267 //var valuesRES = 'Values: <span class="bold">yes/no</span>';
268 var valuesRES = 'Values: <span class="bold">-R-</span> (if yes)';
269 var detailRES = 'Whether the node can be reserved for a certain duration. Your slivers will be available <span class=bold>only during timeslots where you have obtained leases (see tab above)</span>.  <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></p>';
270 var descRES = '<span class="gray"><span class="column-title">'+titleRES+'</span><p><span class="column-detail">'+detailRES+'</span></p><p>'+valuesRES+'</p><p>'+sourceRES+'</p></span>';
271
272 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>';
273 var titleS = 'Active slices';
274 var sourceS = 'Source: '+sourceComon+' (via '+sourceMySlice+')';
275 var valuesS = 'Unit: <span class="bold">%</span>';
276 var detailS = '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.';
277 var descS = '<span class="gray"><span class="column-title">'+titleS+'</span><p><span class="column-detail">'+detailS+'</span></p><p>'+selectPeriodS+'</p><p>'+valuesS+'</p><p>'+sourceS+'</p></span>'; 
278
279 var titleSM= 'Slices in memory';
280 var detailSM = 'The total number of slices in memory (both active and inactive).';
281 var sourceSM = 'Source: '+sourceComon;
282 var descSM = '<span class="gray"><span class="column-title">'+titleSM+'</span><p><span class="column-detail">'+detailSM+'</span></p><p>'+sourceSM+'</p></span>';
283
284 var titleSN = 'Site name';
285 var sourceSN = 'Source: '+sourceMyPLC;
286 var descSN = '<span class="gray"><span class="column-title">'+titleSN+'</span><p>'+sourceSN+'</p></span>';
287
288 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>';
289 var titleSSH = 'Average SSH response delay';
290 var valuesSSH = 'Unit: <span class="bold">msecs</span>';
291 var detailSSH = '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.';
292 var sourceSSH ='Source: '+sourceComon+' (via '+sourceMySlice+')';
293 var descSSH = '<span class="gray"><span class="column-title">'+titleSSH+'</span><p><span class="column-detail">'+detailSSH+'</span></p><p>'+selectPeriodSSH+'</p><p>'+valuesSSH+'</p><p>'+sourceSSH+'</p></span>'; 
294
295
296 var titleUT = 'Uptime';
297 var sourceUT = 'Source: '+sourceComon;
298 var valuesUT = 'Unit: <span class="bold">days</span>';
299 var detailUT = 'The continuous uptime until the moment that the page is loaded, as reported by the CoMon html query API.';
300 var descUT = '<span class="gray"><span class="column-title">'+titleUT+'</span><p><span class="column-detail">'+detailUT+'</span></p><p>'+valuesUT+'</p><p>'+sourceUT+'</p></span>';
301
302
303
304 //Categorization of columns in different types, useful for filtering 
305
306 function inTypeA(header_name) {
307         var typeA = ['ST','SN','RES','OS','NRR','NTP','NSR','NSF','NDS','NTH','NEC','LRN','LCY','LPR','LCN','LAT','LON','IP','ASN','AST'];
308         return typeA.indexOf(header_name);
309 }
310
311 function inTypeB(header_name) {
312         var typeB = ['BW','DS','MS','CC','CR','AS','MU','DU','CN'];
313         return typeB.indexOf(header_name);
314 }
315
316 function inTypeC(header_name) {
317         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'];
318         return typeC.indexOf(header_name);
319 }
320
321 function inTypeD(header_name) {
322         var typeD = ['HC'];
323         return typeD.indexOf(header_name);
324 }
325
326
327 //Debugging
328 function debugfilter(s) {
329         document.getElementById('debug').innerHTML+=s;
330 }
331
332
333 //Called when a column is selected. It displays the detailed description
334 //on the right panel
335
336 function highlightOption(divid) {
337
338         var columns = document.getElementsByName('columnlist');
339         for(var j = 0; j < columns.length; j++)
340                 columns[j].className = 'out'; 
341
342         document.getElementById(divid).className = 'selected';
343
344         showDescription(divid);
345
346 //panos: to IMPROVE 
347         if (document.getElementById('selectperiod'+divid))
348                 document.getElementById('selectperiod'+divid).value = document.getElementById('period'+divid).value;
349
350 }
351
352
353 //Displays the detailed column description 
354
355 function showDescription(h) {
356
357         if (document.getElementById('selectdescr'))
358         {
359                 //Checks if there is a detailed description defined
360                 if (window['desc'+h])
361                         document.getElementById('selectdescr').innerHTML = ""+window['desc'+h];
362                 else 
363                         document.getElementById('selectdescr').innerHTML = "No detailed description provided";
364         }
365
366         if (document.getElementById('refnodes_div'))
367                 document.getElementById('refnodes_div').innerHTML = ref_nodes_select;
368
369         if (document.getElementById('refnodes_rtt_div'))
370                 document.getElementById('refnodes_rtt_div').innerHTML = ref_nodes_select_rtt;
371 }
372
373
374 //Overrides the titles of the columns as they are shown in the column selection panel.
375 //If no overriding variable exists the tag's description is used
376 function overrideTitles() {
377
378         var columns = document.getElementsByName('columnlist');
379
380         for(var j = 0; j < columns.length; j++)
381         {
382                 var kk = columns[j].id;
383                 if (window['title'+kk])
384                         document.getElementById('htitle'+kk).innerHTML = window['title'+kk];
385         }
386
387
388 }
389
390 //When the checkbox is clicked. Adds/removes column respectively
391 function changeCheckStatus(column) {
392
393         var h = document.getElementById(column).value;
394
395         if (document.getElementById('selectdescr'))
396                 showDescription(h);
397
398         //debugfilter("HERE: "+column+" - "+document.getElementById('type '+column).value);
399         //debugfilter("HERE: "+column);
400
401
402         if (document.getElementById(column).checked)
403                 addColumn(h, true, document.getElementById('type'+h).value);
404         else
405                 deleteColumn(h);
406 }
407
408
409
410 //This function is used when the alternative "quick" selection list is used
411 function changeSelectStatus(column) {
412
413         var optionClass = "";
414         var selected_index = document.getElementById('quicklist').selectedIndex;
415
416         if (document.getElementById('quicklist') && selected_index != 0)
417         {
418
419                 optionClass = document.getElementById('quicklist').options[selected_index].className;
420
421                 if (optionClass == "in")
422                 {
423                         deleteColumn(document.getElementById('quicklist').value);
424                         document.getElementById('quicklist').options[selected_index].className = "out";
425                         document.getElementById('quicklist').value="0";
426                 }
427                 else
428                 {
429                         addColumn(document.getElementById('quicklist').value, true);
430                         document.getElementById('quicklist').options[selected_index].className = "in";
431                         document.getElementById('quicklist').value="0";
432                 }
433         }
434 }
435
436 function updateReferenceNode(select_id, new_ref_node) {
437
438         var old_ref_node = document.getElementById(select_id).value;
439         document.getElementById(select_id).value=new_ref_node;
440
441         //debugfilter("changed "+old_ref_node+" with "+new_ref_node+" and column is "+document.getElementById('checkHC').checked);
442
443         if (select_id == 'refnodeHC' && document.getElementById('checkHC').checked)
444         {
445                 document.getElementById('fetchedHC').value = "false";
446                 addColumnAjax('HC', 'HC');
447                 //debugfilter("replacing "+old_ref_node+" with "+new_ref_node);
448                 replaceColumnConfiguration('HC:'+old_ref_node,'HC:'+new_ref_node);
449         }
450         else if (select_id == 'refnodeRTT' && document.getElementById('checkRTT').checked)
451         {
452                 document.getElementById('fetchedRTT').value = "false";
453                 addColumnAjax('RTT', 'RTT');
454                 //debugfilter("replacing "+old_ref_node+" with "+new_ref_node);
455                 replaceColumnConfiguration('RTT:'+old_ref_node,'RTT:'+new_ref_node);
456         }
457
458 }
459
460
461 //When the period of an already selected column is changed
462 function updatePeriod(h, new_period) {
463
464         var old_period = document.getElementById('period'+h).value;
465         document.getElementById('period'+h).value=new_period;
466
467         //debugfilter(h+''+old_period+'-'+h+''+new_period);
468         if (document.getElementById('check'+h).checked)
469         {
470                 deleteColumnCells(h+''+old_period);
471                 addColumnCells(h+''+new_period);
472                 addColumnAjax(h, h+''+new_period);
473
474                 replaceColumnConfiguration(h+''+old_period,h+''+new_period);
475         }
476 }
477
478 /*
479  
480 RESET/SAVE CONFIGURATION
481
482 */
483
484 function getHTTPObject()
485 {
486         if (typeof XMLHttpRequest != 'undefined')
487         { return new XMLHttpRequest(); }
488
489         try
490         { return new ActiveXObject("Msxml2.XMLHTTP"); }
491         catch (e)
492         {
493                 try { return new ActiveXObject("Microsoft.XMLHTTP"); }
494                 catch (e) {}
495         }
496         return false;
497 }
498
499 function closeMessage(tab)
500 {
501         var current_conf = document.getElementById('show_configuration').value;
502         var value = '';
503
504         if (current_conf != "")
505                 current_conf += ";";
506
507         if (tab == 'reservable') {      
508         document.getElementById('note_reservable_div').style.display = "none";
509         if (current_conf.indexOf('reservable') != -1)
510                 return;
511         value = current_conf+'reservable';
512         }
513
514         if (tab == 'columns') { 
515         document.getElementById('note_columns_div').style.display = "none";
516         if (current_conf.indexOf('columns') != -1)
517                 return;
518         value = current_conf+'columns';
519         }
520
521         var slice_id = document.getElementById('slice_id').value;
522         var person_id = document.getElementById('person_id').value;
523         var tag_id = document.getElementById('show_tag_id').value;
524         
525         var url = "/plekit/php/updateConfiguration.php?value="+value+"&slice_id="+slice_id+"&person_id="+person_id+"&tag_name=showconf&tag_id="+tag_id;
526         //debugfilter("updating conf with "+url);
527         document.getElementById('show_configuration').value = value;
528
529         var req = getHTTPObject();
530         req.open('GET', url, true);
531         req.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
532         req.onreadystatechange =
533         function() {
534                 if (req.readyState == 4)
535                 { debugfilter(req.responseText); }
536         }
537         req.send(null);
538
539 }
540
541
542 function updateColumnConfiguration(value, reload)
543 {
544         var person_id = document.getElementById('person_id').value;
545         var slice_id = document.getElementById('slice_id').value;
546         var tag_id = document.getElementById('conf_tag_id').value;
547         var full_column_configuration = document.getElementById('full_column_configuration').value;
548
549         //debugfilter("<br>OLD = "+full_column_configuration);
550         //debugfilter("<br>value = "+value);
551         //
552         
553         var old_columns = full_column_configuration.split(";");
554         var new_columns = new Array();
555
556         for (var column_index = 0; column_index < old_columns.length ; column_index++) {
557                 new_columns.push(old_columns[column_index]);
558                 if (old_columns[column_index] != slice_id)
559                         new_columns.push(old_columns[++column_index]);
560                 else
561                 {
562                         if (value != "")
563                                 new_columns.push(value);
564                         else
565                                 new_columns.push("default");
566                                 
567                         column_index++;
568                 }
569         }
570
571         var new_configuration = new_columns.join(";");
572         //debugfilter("<br>NEW = "+new_configuration);
573
574         if (window.XMLHttpRequest)
575           {// code for IE7+, Firefox, Chrome, Opera, Safari
576           xmlhttp=new XMLHttpRequest();
577           }
578         else
579           {// code for IE6, IE5
580           xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
581           }
582         xmlhttp.onreadystatechange=function()
583           {
584           if (xmlhttp.readyState==4) // && xmlhttp.status==200)
585             {
586                 //value=xmlhttp.responseText;
587                 //debugfilter(value+"-----"+new_configuration);
588                 document.getElementById('column_configuration').value=value;
589                 document.getElementById('full_column_configuration').value=new_configuration;
590
591                 if (reload)
592                         window.location.reload(true);
593             }
594           }
595
596         xmlhttp.open("GET","/plekit/php/updateConfiguration.php?value="+new_configuration+"&slice_id="+slice_id+"&person_id="+person_id+"&tag_name=columnconf&tag_id="+tag_id,true);
597         //xmlhttp.open("GET","/plekit/php/updateConf.php?value="+value+"&slice_id="+slice_id+"&person_id="+person_id+"&tagName=Columnconf",true);
598
599         xmlhttp.send();
600 }
601
602 function logSortingAction(person_id, slice_id, value)
603 {
604
605
606         var req = getHTTPObject();
607         var url = "/plekit/php/logSorting.php?value="+value+"&slice_id="+slice_id+"&person_id="+person_id;
608
609         req.open('GET', url, true);
610         req.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
611         req.onreadystatechange =
612         function() {
613                 if (req.readyState == 4)
614                 { debugfilter(req.responseText); }
615         }
616         req.send(null);
617 }
618
619 function sortCompleteCallback(tableid) {
620
621         var slice_id = document.getElementById('slice_id').value;
622         var person_id = document.getElementById('person_id').value;
623
624         var ths = document.getElementById(tableid).getElementsByTagName("th");
625         for(var i = 0, th; th = ths[i]; i++) {
626         if (th.className.indexOf("Sort") != -1)
627         {
628                 //debugfilter("sorted"+th.getAttribute("name"));
629
630                 var column_name = th.getAttribute("name");
631                 var hclass = th.className;
632                 var column = hclass.substr(hclass.indexOf("column"),hclass.indexOf("column")+1);
633                 var sortdirection = "forward";
634                 if (hclass.indexOf("reverse")!=-1)
635                         sortdirection = "reverse";
636
637                 if (column.indexOf("column-1")==-1 && column.indexOf("column-0")==-1)
638                         logSortingAction(person_id, slice_id, tableid+"|"+column_name+"|"+sortdirection);
639         }
640         }
641 }
642
643
644 function addColumnToConfiguration(column) {
645
646         var old_configuration = document.getElementById('column_configuration').value;
647
648         var new_configuration = "";
649
650         if (old_configuration != "")
651                 new_configuration = old_configuration += "|"+column;
652         else
653                 new_configuration = column;
654
655         //debugfilter("new configuration = "+new_configuration);
656
657         updateColumnConfiguration(new_configuration, false);
658 }
659
660
661 function deleteColumnFromConfiguration(column) {
662
663         var old_configuration = document.getElementById('column_configuration').value;
664
665         var old_columns = old_configuration.split("|");
666         var new_columns = new Array();
667
668         for (var column_index = 0; column_index < old_columns.length ; column_index++) {
669                 var conf = old_columns[column_index].split(':');
670                 if (conf[0] != column)
671                         new_columns.push(old_columns[column_index]);
672         }
673
674         var new_configuration = new_columns.join("|");
675         updateColumnConfiguration(new_configuration, false);
676
677 }
678
679 function replaceColumnConfiguration(column_old, column_new) {
680
681         var old_configuration = document.getElementById('column_configuration').value;
682
683         var old_columns = old_configuration.split("|");
684         var new_columns = new Array();
685
686         var olds = column_old.split(':');
687
688         for (var column_index = 0; column_index < old_columns.length ; column_index++) {
689                 var conf = old_columns[column_index].split(':');
690                 if (conf[0] != olds[0])
691                         new_columns.push(old_columns[column_index]);
692                 else
693                         new_columns.push(column_new);
694         }
695
696         var new_configuration = new_columns.join("|");
697         
698         updateColumnConfiguration(new_configuration);
699 }
700
701 /*
702  
703 ADD/REMOVE COLUMNS
704
705 */
706
707 function convert_data(value, data_source, data_type, tagname) {
708
709         //debugfilter("v["+tagname+"]="+value+"-");
710
711         if (value == "" || value == "n/a" || value == null || value == "NaN" || value == "None")
712                 return "n/a";
713
714         if (tagname == "uptime") {
715                 return parseInt((parseFloat(value) / 86400));
716         }
717         
718         if (data_type == "date") {
719
720                 var date = new Date(value*1000);
721
722                 var year = date.getFullYear();
723                 var month = date.getMonth()+1;
724                 if (month < 10)
725                         month = "0"+month;
726                 var day = date.getDate();
727                 if (day < 10)
728                         day = "0"+day;
729         
730                 return year + '-' + month + '-' + day;
731         }
732
733         return value;
734 }
735
736
737 function load_data(column, header, url, data_source, data_type, tagname) {
738
739         //debugfilter("<br>loading "+url);
740         var req = getHTTPObject();
741         var res;
742         req.open('GET', url, true);
743         req.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
744         req.onreadystatechange =
745         function() {
746                 if (req.readyState == 4)
747                 { updateColumnData(column, header, req.responseText, data_source, data_type, tagname); }
748         }
749         req.send(null);
750 }
751
752
753 function updateColumnData(column, header, data, data_source, data_type, tagname) {
754
755 var headers = header.split("|");
756 var data_table = data.split("|"); 
757
758 //debugfilter("<p>headers[0] = "+headers[0]);
759 //debugfilter("<p>data[2] = "+data_table[2]);
760
761 //debugfilter("data = "+data + " with type "+data_type + " and source "+data_source);
762 //debugfilter("<p>data table length = "+data_table.length);
763
764 if (data_table.length > 1)
765 {
766   
767   var node_data;
768
769   var table_id1 = 'nodes';
770   var table=$(table_id1);
771   var css='#'+table_id1+'>tbody';
772   var rows = $$(css)[0].rows;
773
774   var data_array1 = new Array();
775
776   //debugfilter("COLUMN "+column+"<p>");
777
778   for (var node_index = 1; node_index < data_table.length; node_index++) {
779         if (data_table[node_index] == '---potential---')        
780                 break;
781         node_data = data_table[node_index].split(':');
782
783         data_array1[node_data[0]] = new Array();
784
785         for (var h_index=0; h_index < headers.length; h_index++) {
786                 
787                 if (node_data[h_index+1] == "" || node_data[h_index+1] == "None")
788                         data_array1[node_data[0]][h_index] = "n/a";
789                 else
790                         data_array1[node_data[0]][h_index] = convert_data(node_data[h_index+1], data_source, data_type, tagname);
791         }
792
793   }
794         
795
796   if (rows)
797   for (var row_index = 0; row_index < rows.length ; row_index++) {
798     var tr=rows[row_index];
799
800     for (var column_index=0; column_index < tr.cells.length; column_index++) {
801                 //debugfilter("<p>node id = "+tr.cells[0].innerHTML+" - "+tr.cells[column_index].getAttribute('name'));
802                 if (tr.cells[column_index].getAttribute('name'))
803                 {
804                 var found_index = headers.indexOf(tr.cells[column_index].getAttribute('name'));
805                 if (found_index != -1)
806                         //debugfilter(tr.cells[0].innerHTML+"-"+found_index);
807                         tr.cells[column_index].innerHTML = data_array1[tr.cells[0].innerHTML][found_index];
808                 }
809     }
810   }
811
812   //debugfilter("Reset sorting .....");
813   //tablePaginater.init(table_id1);
814   fdTableSort.init(table_id1);
815
816 //potential nodes
817 if (data_table[node_index] == '---potential---')        
818 {
819
820   var table_id2 = 'add_nodes';
821   var table2=$(table_id2);
822   var css2='#'+table_id2+'>tbody';
823   var rows2 = $$(css2)[0].rows;
824
825   var data_array2 = new Array();
826
827   //debugfilter("COLUMN "+column+"<p>");
828
829   for (; node_index < data_table.length; node_index++) {
830         if (data_table[node_index] == '')       
831                 continue;
832         node_data = data_table[node_index].split(':');
833
834         data_array2[node_data[0]] = new Array();
835
836         for (var h_index=0; h_index < headers.length; h_index++) {
837                 
838                 if (node_data[h_index+1] == "")
839                         data_array2[node_data[0]][h_index] = "n/a";
840                 else
841                         data_array2[node_data[0]][h_index] = convert_data(node_data[h_index+1], data_source, data_type, tagname);
842         }
843   }
844         
845   if (rows)
846   for (var row_index = 0; row_index < rows2.length ; row_index++) {
847     var tr=rows2[row_index];
848
849     for (var column_index=0; column_index < tr.cells.length; column_index++) {
850                 if (tr.cells[column_index].getAttribute('name'))
851                 {
852                 var found_index = headers.indexOf(tr.cells[column_index].getAttribute('name'));
853                 if (found_index != -1)
854                         tr.cells[column_index].innerHTML = data_array2[tr.cells[0].innerHTML][found_index];
855                 }
856     }
857   }
858   fdTableSort.init(table_id2);
859   //tablePaginater.init(table_id2);
860
861 }
862
863   //fdTableSort.removeTableCache(table_id2);
864   //document.getElementById('loading'+column).innerHTML = "";
865   
866 }
867
868
869 document.getElementById('loading'+column).innerHTML = "";
870
871 }
872
873
874 function addColumnCells(header) {
875
876         var cells = document.getElementsByName(header);
877
878         //debugfilter("got cells -"+cells+"- for "+header);
879         for(var j = 0; j < cells.length; j++) 
880                 cells[j].style.display = "table-cell";
881 }
882
883 function addSampleCells(column) {
884
885         var cellsheader = document.getElementsByName("confheader"+column);
886         for(var j = 0; j < cellsheader.length; j++) 
887                 cellsheader[j].style.display = "table-cell";
888
889 }
890
891 function addColumnAjax(column, header) {
892
893         //var t = document.getElementById('check'+column).name;
894         var t = document.getElementById('tagname'+header).value;
895         var slice_id = document.getElementById('slice_id').value;
896
897         var selectedperiod = document.getElementById('period'+column).value;
898         var fetched = document.getElementById('fetched'+column).value;
899         var data_source = document.getElementById('source'+column).value;
900         var data_type = document.getElementById('type'+column).value;
901         var to_load = false;
902
903         //debugfilter("<br>adding "+column+","+header+','+fetched+','+t+','+data_source+','+data_type);
904
905         if (fetched.indexOf("false")!=-1)
906         {
907                 to_load = true;
908                 document.getElementById('fetched'+column).value = ','+selectedperiod+',true';
909         }
910         else if (fetched.indexOf(','+selectedperiod+',')==-1)
911         {
912                         to_load = true;
913                         document.getElementById('fetched'+column).value = ','+selectedperiod+''+fetched;
914         }
915
916         if (to_load)
917         {
918                 //debugfilter("ready to load ... ");
919                 document.getElementById('loading'+column).innerHTML = "<img width=10 src=/plekit/icons/ajax-loader.gif>";
920                 var url = "/plekit/php/updateColumn.php?slice_id="+slice_id+"&tagName="+t+"&data_type="+data_type+"&data_source="+data_source;
921                 if (t == "hopcount")
922                         url = url+"&ref_node="+document.getElementById('selected_reference_node').value;
923                 //debugfilter("calling "+url);
924                 load_data(column, header, url, data_source, data_type, t);
925         }
926 }
927
928
929
930 function addColumn(column, fetch) {
931
932         var selectedperiod="";
933         var header=column;
934         var conf="";
935
936
937         if (inTypeC(column)!=-1)
938         {
939                 column = column.substring(0,column.length-1);
940         }
941
942         selectedperiod = document.getElementById('period'+column).value;
943         header = column+""+selectedperiod;
944
945         if (inTypeD(column)!=-1)
946         {
947                 //conf = header+":"+document.getElementById('reference_node').value;
948                 //document.getElementById('selected_reference_node').value=document.getElementById('reference_node').value;
949                 conf = header+":"+document.getElementById('refnodeHC').value;
950                 document.getElementById('selected_reference_node').value=document.getElementById('refnodeHC').value;
951         }
952         else
953                 conf = header;
954
955         //debugfilter("adding column "+column+" and header "+header+" and conf = "+conf);
956
957         addColumnCells(header);
958
959         if (fetch)
960                 addColumnAjax(column, header);
961
962         addColumnToConfiguration(conf);
963 }
964
965
966 function deleteColumnCells(header) {
967
968         var cells = document.getElementsByName(header);
969         for(var j = 0; j < cells.length; j++) 
970                 cells[j].style.display = "none";
971
972 }
973
974
975 function deleteColumn(column) {
976
977         var selectedperiod="";
978         var header=column;
979
980         selectedperiod = document.getElementById('period'+column).value;
981         header = column+""+selectedperiod;
982
983         //debugfilter("deleting "+column+","+header);
984
985         deleteColumnCells(header);
986
987         deleteColumnFromConfiguration(header);
988 }
989
990
991  
992 /*
993 EXTRA
994
995
996 function removeSelectHandler(object)
997 {
998         debugfilter(object);
999         object.onclick = null;
1000 }
1001
1002 //to be used for scrolling the column list with down/up arrows 
1003
1004 function scrollList() {
1005 debugfilter("here "+document.getElementById('scrolldiv').focused);
1006 if (event.keyCode == 40)
1007         debugfilter("down");
1008 else if (event.keyCode == 38)
1009         debugfilter("up");
1010 }
1011
1012 function resetColumns() {
1013
1014         for (var kk in column_table) {
1015
1016         if (column_table[kk]['visible'] == true && column_table[kk]['fetch'] == false)
1017                 deleteColumn(kk);
1018         else if (column_table[kk]['visible'] == false && column_table[kk]['fetch'] == true)
1019                 addColumn(kk, true);
1020         }
1021
1022 }
1023
1024 function resetCols(which_conf) {
1025
1026         var target_configuration = "|"+document.getElementById(which_conf).value+"|";
1027         
1028         //debugfilter("<p>Target configuration =  "+target_configuration);
1029
1030         for (var kk in column_table) {
1031                 //debugfilter("in "+kk+" ");
1032
1033                 if (target_configuration.indexOf("|"+kk+"|")>=0)
1034                 {
1035                         if (document.getElementById('check'+kk))
1036                         if (document.getElementById('check'+kk).checked == false)
1037                         {
1038                                 debugfilter("<p>Adding "+kk);
1039                                 addColumn(kk, true);
1040                         }
1041                 }
1042                 else
1043                 {
1044                         if (document.getElementById('check'+kk))
1045                         if (document.getElementById('check'+kk).checked == true)
1046                         {
1047                                 debugfilter("<p>Deleting "+kk);
1048                                 deleteColumn(kk);
1049                         }
1050                 }
1051         }
1052 }
1053
1054 function filterByType(selectedtype) {
1055
1056 var notselectedyet = true;
1057
1058 for (var kk in column_headers) {
1059
1060         if (document.getElementById(kk))
1061         {
1062                 if (window['type'+kk] == selectedtype)
1063                 {
1064                         document.getElementById(kk).className = 'in';
1065                         if (notselectedyet)
1066                                 highlightOption(kk);
1067                         notselectedyet = false;
1068                 }
1069                 else
1070                         document.getElementById(kk).className = 'out';
1071         }
1072 }
1073 }
1074
1075
1076 function deleteColumnSample() {
1077         var cellsheader = document.getElementsByName("confheader"+column);
1078         for(var j = 0; j < cellsheader.length; j++) 
1079                 cellsheader[j].style.display = "none";
1080
1081 }
1082
1083 function checkDataToFetch() {
1084
1085 var dataExist = false;
1086
1087 for (var kk in column_table) {
1088
1089         if (document.getElementById(kk))
1090         {
1091                 if (column_table[kk]['visible'] == true && column_table[kk]['fetch'] == false)
1092                 {
1093                         document.getElementById('fetchbutton').disabled = false;
1094                         document.getElementById('fetchbutton').style.color = 'red';
1095                         dataExist = true;
1096                 }
1097         }
1098 }
1099
1100 if (!dataExist)
1101 {
1102         document.getElementById('fetchbutton').disabled = true;
1103         document.getElementById('fetchbutton').style.color = 'grey';
1104 }
1105
1106 }
1107
1108
1109 function fetchData() {
1110
1111 var tagnames = "";
1112 var headers = "";
1113
1114 for (var kk in column_table) {
1115
1116 if (column_table[kk]['visible'] == true && column_table[kk]['fetch'] == false)
1117         if (tagnames == "")
1118         {       
1119                 tagnames = column_table[kk]['tagname'];
1120                 headers = kk;
1121         }
1122         else
1123         {
1124                 tagnames += "|"+column_table[kk]['tagname'];
1125                 headers += "|"+kk;
1126         }
1127 }
1128
1129 //debugfilter("fetching these columns: "+tagnames+ "("+headers+")");
1130
1131         var slice_id = document.getElementById('slice_id').value;
1132         document.getElementById('loadingDiv').innerHTML = "&nbsp;&nbsp;&nbsp;<img src=/plekit/icons/ajax-loader.gif>&nbsp;Loading data. Please wait ...";
1133         var url = "/plekit/php/updateColumn.php?slice_id="+slice_id+"&tagName="+tagnames;
1134         load_data(headers, url);
1135 }
1136
1137
1138 /*
1139  
1140
1141 HIGHLIGHTING
1142
1143
1144
1145 function updateColumnThreshold(column, minT, maxT) {
1146
1147 debugfilter("updating threshold for "+column+" with "+minT+" and "+maxT);
1148
1149 var cells = document.getElementsByName(column);
1150
1151 for(var j = 0; j < cells.length; j++) 
1152 {
1153 var val = parseFloat(cells[j].innerHTML);
1154
1155 if (val >= minT && val <= maxT)
1156         cells[j].style.color = filtered_color;
1157 else
1158         cells[j].style.color = normal_color;
1159 }
1160
1161 var old_configuration = document.getElementById('column_configuration').value;
1162 var slice_id = document.getElementById('slice_id').value;
1163
1164 var old_columns = old_configuration.split("|");
1165 var new_columns = new Array();
1166
1167 for (var column_index = 0; column_index < old_columns.length ; column_index++) {
1168         var conf = old_columns[column_index].split(':');
1169         if (conf[0] != column)
1170                 new_columns.push(old_columns[column_index]);
1171         else
1172                 new_columns.push(column+":"+minT+","+maxT);
1173 }
1174
1175 var new_configuration = new_columns.join("|");
1176
1177 updateColumnConfiguration(slice_id, new_configuration);
1178
1179 }
1180
1181 function updateExcludeList(column, excludeList) {
1182
1183 //debugfilter("updating list");
1184 debugfilter("updating list for "+column+" with "+excludeList);
1185
1186 var cells = document.getElementsByName(column);
1187
1188 for(var j = 1; j < cells.length; j++) 
1189 {
1190 var val = cells[j].innerHTML;
1191
1192 if (excludeList == val)
1193         cells[j].style.color = filtered_color;
1194 else
1195         cells[j].style.color = normal_color;
1196 }
1197
1198 var old_configuration = document.getElementById('column_configuration').value;
1199 var slice_id = document.getElementById('slice_id').value;
1200
1201 var old_columns = old_configuration.split("|");
1202 var new_columns = new Array();
1203
1204 for (var column_index = 0; column_index < old_columns.length ; column_index++) {
1205         var conf = old_columns[column_index].split(':');
1206         if (conf[0] != column)
1207                 new_columns.push(old_columns[column_index]);
1208         else
1209                 new_columns.push(column+":"+excludeList);
1210 }
1211
1212 var new_configuration = new_columns.join("|");
1213
1214 updateColumnConfiguration(slice_id, new_configuration);
1215
1216 }
1217
1218
1219
1220 /*
1221  
1222 ROW FILTERING
1223
1224
1225 function plekit_table_showAll (slicetable_id) {
1226
1227   var table=$(slicetable_id);
1228   var css='#'+slicetable_id+'>tbody';
1229   var rows = $$(css)[0].rows;
1230
1231   // scan rows, elaborate 'visible'
1232   for (var row_index = 0; row_index < rows.length ; row_index++) {
1233     var tr=rows[row_index];
1234     var visible=true;
1235     plekit_table_row_visible(tr,visible);
1236   }
1237
1238     plekit_table_count_filtered(slicetable_id);
1239
1240   tablePaginater.init(slicetable_id);
1241   
1242 }
1243
1244 function plekit_table_count_filtered (slicetable_id) {
1245   var table=$(slicetable_id);
1246   var css='#'+slicetable_id+'>tbody';
1247   var rows = $$(css)[0].rows;
1248
1249   var no_filtered=0;
1250
1251   // scan rows, elaborate 'visible'
1252   for (var row_index = 0; row_index < rows.length ; row_index++) {
1253     var tr=rows[row_index];
1254     var filtered = false;
1255
1256     for (var column_index=0; column_index < tr.cells.length; column_index++) 
1257                 if (tr.cells[column_index].style.color == "red")
1258                         filtered = true;
1259
1260         if (filtered)
1261         no_filtered++;
1262
1263   }
1264
1265   debugfilter(no_filtered+' nodes do not satisfy the requested threshold');
1266 }
1267
1268
1269 function plekit_table_hide_filtered (slicetable_id) {
1270   var table=$(slicetable_id);
1271   var css='#'+slicetable_id+'>tbody';
1272   var rows = $$(css)[0].rows;
1273
1274   var reg = /(^|\s)invisibleRow(\s|$)/;
1275
1276
1277   if (!document.getElementById('filtercheck').checked)
1278   {
1279         plekit_table_showAll(slicetable_id);
1280         return;
1281   }
1282
1283   var hidden=0;
1284
1285   // scan rows, elaborate 'visible'
1286   for (var row_index = 0; row_index < rows.length ; row_index++) {
1287     var tr=rows[row_index];
1288     var visible=true;
1289
1290     for (var column_index=0; column_index < tr.cells.length; column_index++) {
1291                 if (tr.cells[column_index].style.color == filtered_color)
1292                         visible = false;
1293     }
1294     if (!visible)
1295         hidden++;
1296
1297     plekit_table_row_visible(tr,visible);
1298   }
1299
1300   //debugfilter('hidden '+hidden+' nodes');
1301   debugfilter(hidden+' nodes do not satisfy the requested threshold (hidden)');
1302   
1303   tablePaginater.init(slicetable_id);
1304 }
1305
1306
1307
1308
1309 function plekit_table_apply_config(slicetable_id, configuration) {
1310
1311 var new_configuration = document.getElementById('new_conf').value;
1312 var all_columns = new_configuration.split("|");
1313
1314 var min_values = new Array();
1315 var max_values = new Array();
1316
1317
1318 for (var column_index = 0; column_index < all_columns.length ; column_index++) {
1319
1320         var conf = all_columns[column_index].split(':');
1321         
1322         if (inTypeB(conf[0]) != -1)
1323         {
1324                 var threshold = conf[1].split(',');
1325                 if (threshold.length == 2)
1326                 {
1327                 min_values.push(parseFloat(threshold[0]));
1328                 max_values.push(parseFloat(threshold[1]));
1329                 }
1330         }
1331         else if (inTypeC(conf[0]) == -1)
1332         {
1333                 var threshold = conf[2].split(',');
1334                 if (threshold.length == 2)
1335                 {
1336                 min_values.push(parseInt(threshold[0]));
1337                 max_values.push(parseInt(threshold[1]));
1338                 }
1339         }
1340         else
1341         {
1342                 min_values.push(-1);
1343                 max_values.push(-1);
1344         }
1345         
1346 }
1347
1348   var table=$(slicetable_id);
1349   var css='#'+slicetable_id+'>tbody';
1350   var rows = $$(css)[0].rows;
1351
1352
1353   var no_filtered=0;
1354
1355   for (var row_index = 0; row_index < rows.length ; row_index++) {
1356
1357         var tr=rows[row_index];
1358
1359         var filtered = false;
1360
1361         for (var column_index = 0; column_index < all_columns.length ; column_index++) 
1362         if (min_values[column_index]!=-1)
1363         {
1364                 var val = parseFloat(tr.cells[3+column_index].innerHTML);
1365                 
1366                 if (val >= min_values[column_index] && val <= max_values[column_index])
1367                 {
1368                         tr.cells[3+column_index].style.color = filtered_color;
1369                         filtered = true;
1370                 }
1371                 else
1372                         tr.cells[3+column_index].style.color = normal_color;
1373         }
1374         else
1375                 if (tr.cells[3+column_index].style.color == filtered_color)
1376                         filtered = true;
1377                 
1378
1379         if (filtered)
1380         no_filtered++;
1381   }
1382
1383   debugfilter(no_filtered+' nodes do not satisfy the requested threshold');
1384
1385   //tablePaginater.init(slicetable_id);
1386
1387 }
1388
1389
1390 function reset_select () {
1391   var table=$(slicetable_id);
1392   var css='#'+slicetable_id+'>tbody';
1393   var rows = $$(css)[0].rows;
1394
1395 var action = document.getElementById('onlyselected');
1396 action.checked=false;
1397
1398   // scan rows, elaborate 'visible'
1399   for (var row_index = 0; row_index < rows.length ; row_index++) {
1400     var tr=rows[row_index];
1401
1402     document.getElementById("check"+tr.id).checked=false;
1403
1404   }
1405
1406   plekit_table_count_nodes();
1407 }
1408
1409 }
1410
1411
1412 function plekit_table_select_filter () {
1413   var table=$(slicetable_id);
1414   var css='#'+slicetable_id+'>tbody';
1415   var rows = $$(css)[0].rows;
1416
1417   var reg = /(^|\s)invisibleRow(\s|$)/;
1418
1419   var action = document.getElementById('onlyselected');
1420   if (!action.checked)
1421         plekit_table_reset_filter();
1422
1423   // scan rows, elaborate 'visible'
1424   for (var row_index = 0; row_index < rows.length ; row_index++) {
1425     var tr=rows[row_index];
1426     var visible=true;
1427
1428     if (action.checked)
1429     {
1430          if(tr.className.search(reg) == -1) 
1431               if(!document.getElementById("check"+tr.id).checked)
1432                   visible=false;
1433     }
1434
1435     if(tr.className.search(reg) != -1) 
1436         visible=false;
1437
1438     plekit_table_row_visible(tr,visible);
1439   }
1440   
1441   tablePaginater.init(slicetable_id);
1442   plekit_table_count_nodes();
1443 }
1444
1445 function plekit_table_select_filter2 () {
1446   var table=$(slicetable_id);
1447   var css='#'+slicetable_id+'>tbody';
1448   var rows = $$(css)[0].rows;
1449
1450   var reg = /(^|\s)invisibleRow(\s|$)/;
1451
1452   var action = document.getElementById('onlyselected');
1453
1454   // scan rows, elaborate 'visible'
1455   for (var row_index = 0; row_index < rows.length ; row_index++) {
1456     var tr=rows[row_index];
1457     var visible=true;
1458
1459     if (action.checked)
1460     {
1461          if(tr.className.search(reg) == -1) 
1462               if(!document.getElementById("check"+tr.id).checked)
1463                   visible=false;
1464     }
1465
1466     if(tr.className.search(reg) != -1) 
1467         visible=false;
1468
1469     plekit_table_row_visible(tr,visible);
1470   }
1471   
1472   tablePaginater.init(slicetable_id);
1473   plekit_table_count_nodes();
1474 }
1475
1476 function CheckTopNodes(n) {
1477   var table=$(slicetable_id);
1478   var css='#'+slicetable_id+'>tbody';
1479   var rows = $$(css)[0].rows;
1480   var reg = /(^|\s)invisibleRow(\s|$)/;
1481
1482   var checked=0;
1483
1484   for (var row_index = 0; row_index < rows.length ; row_index++) {
1485     var tr=rows[row_index];
1486
1487     if(tr.className.search(reg) == -1) {
1488         if (checked<n)
1489         {
1490                 document.getElementById("check"+tr.id).checked=true;
1491                 checked++;
1492         }
1493         else
1494         {
1495                 document.getElementById("check"+tr.id).checked=false;
1496         };
1497     };
1498    };
1499 };
1500
1501
1502 function CheckRandomNodes(n) {
1503   var table=$(slicetable_id);
1504   var css='#'+slicetable_id+'>tbody';
1505   var rows = $$(css)[0].rows;
1506   var reg = /(^|\s)invisibleRow(\s|$)/;
1507
1508   var r = n/plekit_table_visible_count();
1509   var checked=0;
1510
1511   for (var row_index = 0; row_index < rows.length ; row_index++) {
1512     var tr=rows[row_index];
1513
1514     if(tr.className.search(reg) == -1) {
1515         if(Math.random() < r) {
1516                 document.getElementById("check"+tr.id).checked=true;
1517                 checked++;
1518         };
1519         if (checked>=n)
1520                 break;
1521      };
1522   };
1523 };
1524
1525
1526 function plekit_table_visible_count() {
1527   var table=$(slicetable_id);
1528   var css='#'+slicetable_id+'>tbody';
1529   var rows = $$(css)[0].rows;
1530   var reg = /(^|\s)invisibleRow(\s|$)/;
1531   var v=0;
1532
1533   for (var row_index = 0; row_index < rows.length ; row_index++) {
1534     var tr=rows[row_index];
1535
1536         if(tr.className.search(reg) == -1) 
1537         {
1538                 v++;
1539         }
1540   }
1541
1542   return v;
1543 }
1544
1545
1546 function plekit_table_count_nodes() {
1547   var table=$(slicetable_id);
1548   var css='#'+slicetable_id+'>tbody';
1549   var rows = $$(css)[0].rows;
1550   var reg = /(^|\s)invisibleRow(\s|$)/;
1551   var n=0;
1552   var v=0;
1553   var s=0;
1554
1555   for (var row_index = 0; row_index < rows.length ; row_index++) {
1556     var tr=rows[row_index];
1557
1558         n++;
1559         var ch = document.getElementById("check"+tr.id);
1560
1561         if(tr.className.search(reg) == -1) 
1562                 v++;
1563         else
1564         {
1565                 if (ch.checked)
1566                         ch.checked=false;
1567         };
1568
1569         if (ch.checked)
1570                 s++;
1571         
1572    };
1573
1574    var dd = document.getElementById('node_statistics');
1575    dd.innerHTML = "Total: "+n+" - Shown: "+v+" - Selected: "+s;
1576 };
1577
1578 function AutoSelect()
1579 {
1580   var a = document.getElementById('automatic').value;
1581   var n = parseInt(document.getElementById('no_nodes').value);
1582
1583   if (isNaN(n))
1584         return;
1585
1586   if (a == "random")
1587          CheckRandomNodes(n);
1588   else if (a == "top")
1589          CheckTopNodes(n);
1590
1591   plekit_table_select_filter2();
1592   plekit_table_count_nodes();
1593 }
1594
1595 */