a clean version of columns.js
[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 eeference, 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
437 //When the period of an already selected column is changed
438 function updatePeriod(h, new_period) {
439
440         var old_period = document.getElementById('period'+h).value;
441         document.getElementById('period'+h).value=new_period;
442
443         //debugfilter(h+''+old_period+'-'+h+''+new_period);
444         if (document.getElementById('check'+h).checked)
445         {
446                 deleteColumnCells(h+''+old_period);
447                 addColumnCells(h+''+new_period);
448                 addColumnAjax(h, h+''+new_period);
449
450                 replaceColumnConfiguration(h+''+old_period,h+''+new_period);
451         }
452 }
453
454 /*
455  
456 RESET/SAVE CONFIGURATION
457
458 */
459
460 function getHTTPObject()
461 {
462         if (typeof XMLHttpRequest != 'undefined')
463         { return new XMLHttpRequest(); }
464
465         try
466         { return new ActiveXObject("Msxml2.XMLHTTP"); }
467         catch (e)
468         {
469                 try { return new ActiveXObject("Microsoft.XMLHTTP"); }
470                 catch (e) {}
471         }
472         return false;
473 }
474
475 function closeMessage(tab)
476 {
477         var current_conf = document.getElementById('show_configuration').value;
478         var value = '';
479
480         if (current_conf != "")
481                 current_conf += ";";
482
483         if (tab == 'reservable') {      
484         document.getElementById('note_reservable_div').style.display = "none";
485         if (current_conf.indexOf('reservable') != -1)
486                 return;
487         value = current_conf+'reservable';
488         }
489
490         if (tab == 'columns') { 
491         document.getElementById('note_columns_div').style.display = "none";
492         if (current_conf.indexOf('columns') != -1)
493                 return;
494         value = current_conf+'columns';
495         }
496
497         var slice_id = document.getElementById('slice_id').value;
498         var person_id = document.getElementById('person_id').value;
499         var tag_id = document.getElementById('show_tag_id').value;
500         
501         var url = "/plekit/php/updateConfiguration.php?value="+value+"&slice_id="+slice_id+"&person_id="+person_id+"&tag_name=showconf&tag_id="+tag_id;
502         //debugfilter("updating conf with "+url);
503         document.getElementById('show_configuration').value = value;
504
505         var req = getHTTPObject();
506         req.open('GET', url, true);
507         req.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
508         req.onreadystatechange =
509         function() {
510                 if (req.readyState == 4)
511                 { debugfilter(req.responseText); }
512         }
513         req.send(null);
514
515 }
516
517
518 function updateColumnConfiguration(value, reload)
519 {
520         var person_id = document.getElementById('person_id').value;
521         var slice_id = document.getElementById('slice_id').value;
522         var tag_id = document.getElementById('conf_tag_id').value;
523         var full_column_configuration = document.getElementById('full_column_configuration').value;
524
525         //debugfilter("<br>OLD = "+full_column_configuration);
526         //debugfilter("<br>value = "+value);
527         //
528         
529         var old_columns = full_column_configuration.split(";");
530         var new_columns = new Array();
531
532         for (var column_index = 0; column_index < old_columns.length ; column_index++) {
533                 new_columns.push(old_columns[column_index]);
534                 if (old_columns[column_index] != slice_id)
535                         new_columns.push(old_columns[++column_index]);
536                 else
537                 {
538                         if (value != "")
539                                 new_columns.push(value);
540                         else
541                                 new_columns.push("default");
542                                 
543                         column_index++;
544                 }
545         }
546
547         var new_configuration = new_columns.join(";");
548         //debugfilter("<br>NEW = "+new_configuration);
549
550         if (window.XMLHttpRequest)
551           {// code for IE7+, Firefox, Chrome, Opera, Safari
552           xmlhttp=new XMLHttpRequest();
553           }
554         else
555           {// code for IE6, IE5
556           xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
557           }
558         xmlhttp.onreadystatechange=function()
559           {
560           if (xmlhttp.readyState==4) // && xmlhttp.status==200)
561             {
562                 //value=xmlhttp.responseText;
563                 //debugfilter(value+"-----"+new_configuration);
564                 document.getElementById('column_configuration').value=value;
565                 document.getElementById('full_column_configuration').value=new_configuration;
566
567                 if (reload)
568                         window.location.reload(true);
569             }
570           }
571
572         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);
573         //xmlhttp.open("GET","/plekit/php/updateConf.php?value="+value+"&slice_id="+slice_id+"&person_id="+person_id+"&tagName=Columnconf",true);
574
575         xmlhttp.send();
576 }
577
578 function logSortingAction(person_id, slice_id, value)
579 {
580
581
582         var req = getHTTPObject();
583         var url = "/plekit/php/logSorting.php?value="+value+"&slice_id="+slice_id+"&person_id="+person_id;
584
585         req.open('GET', url, true);
586         req.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
587         req.onreadystatechange =
588         function() {
589                 if (req.readyState == 4)
590                 { debugfilter(req.responseText); }
591         }
592         req.send(null);
593 }
594
595 function sortCompleteCallback(tableid) {
596
597         var slice_id = document.getElementById('slice_id').value;
598         var person_id = document.getElementById('person_id').value;
599
600         var ths = document.getElementById(tableid).getElementsByTagName("th");
601         for(var i = 0, th; th = ths[i]; i++) {
602         if (th.className.indexOf("Sort") != -1)
603         {
604                 //debugfilter("sorted"+th.getAttribute("name"));
605
606                 var column_name = th.getAttribute("name");
607                 var hclass = th.className;
608                 var column = hclass.substr(hclass.indexOf("column"),hclass.indexOf("column")+1);
609                 var sortdirection = "forward";
610                 if (hclass.indexOf("reverse")!=-1)
611                         sortdirection = "reverse";
612
613                 if (column.indexOf("column-1")==-1 && column.indexOf("column-0")==-1)
614                         logSortingAction(person_id, slice_id, tableid+"|"+column_name+"|"+sortdirection);
615         }
616         }
617 }
618
619
620 function addColumnToConfiguration(column) {
621
622         var old_configuration = document.getElementById('column_configuration').value;
623
624         var new_configuration = "";
625
626         if (old_configuration != "")
627                 new_configuration = old_configuration += "|"+column;
628         else
629                 new_configuration = column;
630
631         //debugfilter("new configuration = "+new_configuration);
632
633         updateColumnConfiguration(new_configuration, false);
634 }
635
636
637 function deleteColumnFromConfiguration(column) {
638
639         var old_configuration = document.getElementById('column_configuration').value;
640
641         var old_columns = old_configuration.split("|");
642         var new_columns = new Array();
643
644         for (var column_index = 0; column_index < old_columns.length ; column_index++) {
645                 var conf = old_columns[column_index].split(':');
646                 if (conf[0] != column)
647                         new_columns.push(old_columns[column_index]);
648         }
649
650         var new_configuration = new_columns.join("|");
651         updateColumnConfiguration(new_configuration, false);
652
653 }
654
655 function replaceColumnConfiguration(column_old, column_new) {
656
657         var old_configuration = document.getElementById('column_configuration').value;
658
659         var old_columns = old_configuration.split("|");
660         var new_columns = new Array();
661
662         var olds = column_old.split(':');
663
664         for (var column_index = 0; column_index < old_columns.length ; column_index++) {
665                 var conf = old_columns[column_index].split(':');
666                 if (conf[0] != olds[0])
667                         new_columns.push(old_columns[column_index]);
668                 else
669                         new_columns.push(column_new);
670         }
671
672         var new_configuration = new_columns.join("|");
673         
674         updateColumnConfiguration(new_configuration);
675 }
676
677 /*
678  
679 ADD/REMOVE COLUMNS
680
681 */
682
683 function convert_data(value, data_source, data_type, tagname) {
684
685         //debugfilter("v["+tagname+"]="+value+"-");
686
687         if (value == "" || value == "n/a" || value == null || value == "NaN" || value == "None")
688                 return "n/a";
689
690         if (tagname == "uptime") {
691                 return parseInt((parseFloat(value) / 86400));
692         }
693         
694         if (data_type == "date") {
695
696                 var date = new Date(value*1000);
697
698                 var year = date.getFullYear();
699                 var month = date.getMonth()+1;
700                 if (month < 10)
701                         month = "0"+month;
702                 var day = date.getDate();
703                 if (day < 10)
704                         day = "0"+day;
705         
706                 return year + '-' + month + '-' + day;
707         }
708
709         return value;
710 }
711
712
713 function load_data(column, header, url, data_source, data_type, tagname) {
714
715         //debugfilter("<br>loading "+url);
716         var req = getHTTPObject();
717         var res;
718         req.open('GET', url, true);
719         req.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
720         req.onreadystatechange =
721         function() {
722                 if (req.readyState == 4)
723                 { updateColumnData(column, header, req.responseText, data_source, data_type, tagname); }
724         }
725         req.send(null);
726 }
727
728
729 function updateColumnData(column, header, data, data_source, data_type, tagname) {
730
731 var headers = header.split("|");
732 var data_table = data.split("|"); 
733
734 //debugfilter("<p>headers[0] = "+headers[0]);
735 //debugfilter("<p>data[2] = "+data_table[2]);
736
737 //debugfilter("data = "+data + " with type "+data_type + " and source "+data_source);
738 //debugfilter("<p>data table length = "+data_table.length);
739
740 if (data_table.length > 1)
741 {
742   
743   var node_data;
744
745   var table_id1 = 'nodes';
746   var table=$(table_id1);
747   var css='#'+table_id1+'>tbody';
748   var rows = $$(css)[0].rows;
749
750   var data_array1 = new Array();
751
752   //debugfilter("COLUMN "+column+"<p>");
753
754   for (var node_index = 1; node_index < data_table.length; node_index++) {
755         if (data_table[node_index] == '---potential---')        
756                 break;
757         node_data = data_table[node_index].split(':');
758
759         data_array1[node_data[0]] = new Array();
760
761         for (var h_index=0; h_index < headers.length; h_index++) {
762                 
763                 if (node_data[h_index+1] == "" || node_data[h_index+1] == "None")
764                         data_array1[node_data[0]][h_index] = "n/a";
765                 else
766                         data_array1[node_data[0]][h_index] = convert_data(node_data[h_index+1], data_source, data_type, tagname);
767         }
768
769   }
770         
771
772   if (rows)
773   for (var row_index = 0; row_index < rows.length ; row_index++) {
774     var tr=rows[row_index];
775
776     for (var column_index=0; column_index < tr.cells.length; column_index++) {
777                 //debugfilter("<p>node id = "+tr.cells[0].innerHTML+" - "+tr.cells[column_index].getAttribute('name'));
778                 if (tr.cells[column_index].getAttribute('name'))
779                 {
780                 var found_index = headers.indexOf(tr.cells[column_index].getAttribute('name'));
781                 if (found_index != -1)
782                         //debugfilter(tr.cells[0].innerHTML+"-"+found_index);
783                         tr.cells[column_index].innerHTML = data_array1[tr.cells[0].innerHTML][found_index];
784                 }
785     }
786   }
787
788   //debugfilter("Reset sorting .....");
789   //tablePaginater.init(table_id1);
790   fdTableSort.init(table_id1);
791
792 //potential nodes
793 if (data_table[node_index] == '---potential---')        
794 {
795
796   var table_id2 = 'add_nodes';
797   var table2=$(table_id2);
798   var css2='#'+table_id2+'>tbody';
799   var rows2 = $$(css2)[0].rows;
800
801   var data_array2 = new Array();
802
803   //debugfilter("COLUMN "+column+"<p>");
804
805   for (; node_index < data_table.length; node_index++) {
806         if (data_table[node_index] == '')       
807                 continue;
808         node_data = data_table[node_index].split(':');
809
810         data_array2[node_data[0]] = new Array();
811
812         for (var h_index=0; h_index < headers.length; h_index++) {
813                 
814                 if (node_data[h_index+1] == "")
815                         data_array2[node_data[0]][h_index] = "n/a";
816                 else
817                         data_array2[node_data[0]][h_index] = convert_data(node_data[h_index+1], data_source, data_type, tagname);
818         }
819   }
820         
821   if (rows)
822   for (var row_index = 0; row_index < rows2.length ; row_index++) {
823     var tr=rows2[row_index];
824
825     for (var column_index=0; column_index < tr.cells.length; column_index++) {
826                 if (tr.cells[column_index].getAttribute('name'))
827                 {
828                 var found_index = headers.indexOf(tr.cells[column_index].getAttribute('name'));
829                 if (found_index != -1)
830                         tr.cells[column_index].innerHTML = data_array2[tr.cells[0].innerHTML][found_index];
831                 }
832     }
833   }
834   fdTableSort.init(table_id2);
835   //tablePaginater.init(table_id2);
836
837 }
838
839   //fdTableSort.removeTableCache(table_id2);
840   //document.getElementById('loading'+column).innerHTML = "";
841   
842 }
843
844
845 document.getElementById('loading'+column).innerHTML = "";
846
847 }
848
849
850 function addColumnCells(header) {
851
852         var cells = document.getElementsByName(header);
853
854         //debugfilter("got cells -"+cells+"- for "+header);
855         for(var j = 0; j < cells.length; j++) 
856                 cells[j].style.display = "table-cell";
857 }
858
859 function addSampleCells(column) {
860
861         var cellsheader = document.getElementsByName("confheader"+column);
862         for(var j = 0; j < cellsheader.length; j++) 
863                 cellsheader[j].style.display = "table-cell";
864
865 }
866
867 function addColumnAjax(column, header) {
868
869         //var t = document.getElementById('check'+column).name;
870         var t = document.getElementById('tagname'+header).value;
871         var slice_id = document.getElementById('slice_id').value;
872
873         var selectedperiod = document.getElementById('period'+column).value;
874         var fetched = document.getElementById('fetched'+column).value;
875         var data_source = document.getElementById('source'+column).value;
876         var data_type = document.getElementById('type'+column).value;
877         var to_load = false;
878
879         //debugfilter("<br>adding "+column+","+header+','+fetched+','+t+','+data_source+','+data_type);
880
881         if (fetched.indexOf("false")!=-1)
882         {
883                 to_load = true;
884                 document.getElementById('fetched'+column).value = ','+selectedperiod+',true';
885         }
886         else if (fetched.indexOf(','+selectedperiod+',')==-1)
887         {
888                         to_load = true;
889                         document.getElementById('fetched'+column).value = ','+selectedperiod+''+fetched;
890         }
891
892         if (to_load)
893         {
894                 //debugfilter("ready to load ... ");
895                 document.getElementById('loading'+column).innerHTML = "<img width=10 src=/plekit/icons/ajax-loader.gif>";
896                 var url = "/plekit/php/updateColumn.php?slice_id="+slice_id+"&tagName="+t+"&data_type="+data_type+"&data_source="+data_source;
897                 //debugfilter("calling "+url);
898                 load_data(column, header, url, data_source, data_type, t);
899         }
900 }
901
902
903
904 function addColumn(column, fetch) {
905
906         var selectedperiod="";
907         var header=column;
908         var conf="";
909
910
911         if (inTypeC(column)!=-1)
912         {
913                 column = column.substring(0,column.length-1);
914         }
915
916         selectedperiod = document.getElementById('period'+column).value;
917         header = column+""+selectedperiod;
918
919         conf = header;
920
921         //debugfilter("adding column "+column+" and header "+header+" and conf = "+conf);
922
923         addColumnCells(header);
924
925         if (fetch)
926                 addColumnAjax(column, header);
927
928         addColumnToConfiguration(conf);
929 }
930
931
932 function deleteColumnCells(header) {
933
934         var cells = document.getElementsByName(header);
935         for(var j = 0; j < cells.length; j++) 
936                 cells[j].style.display = "none";
937
938 }
939
940
941 function deleteColumn(column) {
942
943         var selectedperiod="";
944         var header=column;
945
946         selectedperiod = document.getElementById('period'+column).value;
947         header = column+""+selectedperiod;
948
949         //debugfilter("deleting "+column+","+header);
950
951         deleteColumnCells(header);
952
953         deleteColumnFromConfiguration(header);
954 }
955
956