A new version of the column configuration interface including
[plewww.git] / plekit / table / columns.js
index d956477..daf64d6 100644 (file)
@@ -15,32 +15,34 @@ var sourceMyPLC = '<b><a target="source_window" href="https://www.planet-lab.eu/
 var sourceManiacs = '<b><a target="source_window" href="http://www.ece.gatech.edu/research/labs/MANIACS/as_taxonomy/">MANIACS</a></b>';
 var sourceMaxmind = '<b><a target="source_window" href="http://www.maxmind.com/app/geolitecity">MaxMind</a></b>';
 var sourceMonitor = '<b><a target="source_window" href="http://monitor.planet-lab.org/">Monitor</a></b>';
-var selectReferenceNode ='Select reference node: <select id="reference_node" onChange="updateDefaultConf(this.value)"><option value=planetlab-europe-07.ipv6.lip6.fr>planetlab-europe-07.ipv6.lip6.fr</option></select>';
-var addButton = '<input id="addButton" type="button" value="Add" onclick=addColumnAjax(document.getElementById("list1").value)></input>';
-var deleteButton = '<input id="deleteButton" type="button" value="Delete" onclick=deleteColumn(window.document.getElementById("list1").value)></input>';
+var hardwareReqs = 'current <b><a target="source_window" href="http://www.planet-lab.org/hardware">PlanetLab hardware requirement</a></b>';
+var selectReferenceNode ='Select reference node: <select id="reference_node" onChange="updateReferenceNode(this.value)"><option value=planetlab-europe-07.ipv6.lip6.fr>planetlab-europe-07.ipv6.lip6.fr</option><option value=planetlab2.ipv6.lip6.fr>planetlab2.ipv6.lip6.fr</option></select>';
+//var addButton = '<input id="addButton" type="button" value="Add" onclick=addColumnAjax(document.getElementById("list1").value)></input>';
+//var deleteButton = '<input id="deleteButton" type="button" value="Delete" onclick=deleteColumn(window.document.getElementById("list1").value)></input>';
 
 var descHOSTNAME = "test";
 
-var titleA = 'Architecture name';
-var detailA = '<i>The node architecture.</i>';
-var sourceA = '<b>Source:</b> '+sourceMyPLC;
-var valuesA = 'Values: <b>x86_64</b>, <b>i386</b>';
-var descA = '<span class="myslice title">'+titleA+'</span><p>'+detailA+'<p>'+valuesA+'<p>'+sourceA;
-
-var titlef = 'Operating system';
-var detailf = '<i>Fedora or CentOS distribution to use for node or slivers.</i>';
-var sourcef = '<b>Source:</b> '+sourceMyPLC;
-var descf = '<span class="myslice title">'+titlef+'</span><p>'+detailf+'<p>'+sourcef;
 
 var titleAU = 'Authority';
 var detailAU = '<i>The authority of the global PlanetLab federation that the site of the node belongs to.</i>';
 var valuesAU = 'Values: <b>PLC</b> (PlanetLab Central), <b>PLE</b> (PlanetLab Europe)';
-var sourceAU = '<b>Source:</b> '+sourceMyPLC;
+var sourceAU = 'Source: '+sourceMyPLC;
 var descAU = '<span class="myslice title">'+titleAU+'</span><p>'+detailAU+'<p>'+valuesAU+'<p>'+sourceAU;
 
+var titleST = 'Status';
+var sourceST = 'Source: '+sourceMonitor;
+var valuesST = 'Values: <b>online</b> (up and running), <b>good</b> (up and running recently), <b>offline</b> (unreachable today), <b>down</b> (node unreachable for more than one day), <b>failboot</b> (reachable, but only by administrators for debugging purposes).';
+var descST = '<span class="myslice title">'+titleST+'</span><p>'+valuesST+'<p>'+sourceST;
+
+var titleA = 'Architecture name';
+var detailA = '<i>The node architecture.</i>';
+var sourceA = 'Source: '+sourceMyPLC;
+var valuesA = 'Values: <b>x86_64</b>, <b>i386</b>, <b>n/a</b>';
+var descA = '<span class="myslice title">'+titleA+'</span><p>'+detailA+'<p>'+valuesA+'<p>'+sourceA;
+
 var titleAS = 'Autonomous system ID';
 var sourceAS = 'Source: '+sourceCymru+' (via '+sourceTophat+')';
-var valuesAS = 'Unit: <b>Integer between 0 and 65535</b>';
+var valuesAS = 'Values: <b>Integer between 0 and 65535</b>, <b>n/a</b>';
 var descAS = '<span class="myslice title">'+titleAS+'</span><p>'+valuesAS+'<p>' + sourceAS;
 
 var titleAST = 'Autonomous system type';
@@ -52,7 +54,7 @@ var titleASN = 'Autonomous system name';
 var sourceASN = 'Source: '+sourceTophat;
 var descASN = '<span class="myslice title">'+titleASN+'</span><p>'+sourceASN;
 
-var selectPeriodBU = 'Select period: <select id="selectperiodBU" onChange=updatePeriod("BU",this.value)><option value=w>Week</option><option value=m>Month</option><option value=y>Year</option></select>';
+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>';
 var titleBU = 'Bandwidth utilization ';
 var sourceBU = 'Source: '+sourceComon+' (via '+sourceMySlice+')';
 var valuesBU ='Unit: <b>Kbps</b>';
@@ -67,30 +69,41 @@ var descBW = '<span class="myslice title">'+titleBW+'</span><p>'+detailBW+'<p>'+
 
 var titleCC = 'Number of CPU cores';
 var sourceCC = 'Source: '+sourceComon;
-var valuesCC = 'Current PlanetLab hardware requirements: 4 cores min. <br><i>(Older nodes may have fewer cores)</i>.';
+var valuesCC = '<i>The number of CPU cores on the node. For reference, the '+hardwareReqs+' is <b>4 cores min.</b> <br> (Older nodes may have fewer cores)</i>.';
 var descCC = '<span class="myslice title">'+titleCC+'</span><p>'+valuesCC+'<p>'+sourceCC;
 
 var titleCN = 'Number of CPUs';
 var sourceCN = 'Source: '+sourceComon;
-var valuesCN = 'Current PlanetLab hardware requirements: <b>1 (if quad core) or 2 (if dual core)</b>';
+var valuesCN = '<i>The number of CPUs on the node. For reference, the '+hardwareReqs+' is <b>1 (if quad core) or 2 (if dual core)</b>.</i>';
 var descCN = '<span class="myslice title">'+titleCN+'</span><p>'+valuesCN+'<p>'+sourceCN;
 
 var titleCR = 'CPU clock rate';
+var detailCR = '<i>The clock rate for the CPUs on the node. For reference, the '+hardwareReqs+' is <b>2.4 GHz</b></i>.';
 var sourceCR = 'Source: '+sourceComon;
-var valuesCR = 'Unit: <b>GHz</b><p>Current PlanetLab hardware requirements: <b>2.4 GHz</b>';
-var descCR = '<span class="myslice title">'+titleCR+'</span><p>'+valuesCR+'<p>'+sourceCR;
+var valuesCR = 'Unit: <b>GHz</b>';
+var descCR = '<span class="myslice title">'+titleCR+'</span><p>'+detailCR+'<p>'+valuesCR+'<p>'+sourceCR;
 
-var selectPeriodCF = 'Select period: <select id="selectperiodCF" onChange=updatePeriod("CF",this.value)><option value=w>Week</option><option value=m>Month</option><option value=y>Year</option></select>';
+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>';
 var titleCF = 'Free CPU';
 var sourceCF = 'Source: '+sourceComon+' (via '+sourceMySlice+')';
 var valuesCF = 'Unit: <b>%</b>';
 var detailCF = '<i> The average CPU percentage that gets allocated to a test slice named burb that is periodically run by CoMon.</i>';
 var descCF = '<span class="myslice title">'+titleCF+'</span><p>'+detailCF+'<p>'+selectPeriodCF+'<p>'+valuesCF+'<p>'+sourceCF; 
 
+var titleDN = 'Toplevel domain name';
+var sourceDN = 'Source: '+sourceMyPLC;
+var descDN = '<span class="myslice title">'+titleDN+'</span><p>'+sourceDN;
+
+var titleDA = 'Date added';
+var sourceDA = 'Source: '+sourceMyPLC;
+var detailDA = '<i> The date that the noded was added to PlanetLab.</i>';
+var descDA = '<span class="myslice title">'+titleDA+'</span><p>'+detailDA+'<p>'+sourceDA;
+
 var titleDS = 'Disk size';
+var detailDS = '<i>The size of the hard disk available on the node. For reference, the '+hardwareReqs+' is <b>500 GB</b></i>.';
 var sourceDS = 'Source: '+sourceComon;
-var valuesDS = 'Unit: <b>GB</b><p>Current PlanetLab hardware requirements: <b>500 GB</b>';
-var descDS = '<span class="myslice title">'+titleDS+'</span><p>'+valuesDS+'<p>'+sourceDS;
+var valuesDS = 'Unit: <b>GB</b>';
+var descDS = '<span class="myslice title">'+titleDS+'</span><p>'+detailDS+'<p>'+valuesDS+'<p>'+sourceDS;
 
 var titleDU = 'Current disk utilization';
 var sourceDU = 'Source: '+sourceComon+' (via '+sourceMySlice+')';
@@ -98,13 +111,19 @@ var valuesDU = 'Unit: <b>GB</b>';
 var detailDU = '<i> The amount of disk space currently consumed (checked daily).</i>';
 var descDU = '<span class="myslice title">'+titleDU+'</span><p>'+detailDU+'<p>'+valuesDU+'<p>'+sourceDU;
 
+var titleDF = 'Disk space free';
+var sourceDF = 'Source: '+sourceComon+' (via '+sourceMySlice+')';
+var valuesDF = 'Unit: <b>GB</b>';
+var detailDF = '<i> The amount of disk space currently available (checked daily).</i>';
+var descDF = '<span class="myslice title">'+titleDF+'</span><p>'+detailDF+'<p>'+valuesDF+'<p>'+sourceDF;
+
 var titleHC = 'Hop count (pairwise)';
 var sourceHC = 'Source: '+sourceTophat;
 var detailHC = '<i>TopHat conducts traceroutes every five minutes in a full mesh between all PlanetLab nodes. The hop count is the length of the traceroute from the node to the reference node, based upon the most recently reported traceroute</i>.';
 var descHC = '<span class="myslice title">'+titleHC+'</span><p>'+detailHC+'<p>'+selectReferenceNode+'<p>'+sourceHC;
 
 var titleIP = 'IP address';
-var sourceIP = 'Source: '+sourceTophat;
+var sourceIP = 'Source: '+sourceMyPLC;
 var descIP = '<span class="myslice title">'+titleIP+'</span><p>'+sourceIP;
 
 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>';
@@ -112,8 +131,7 @@ var titleL= 'Load ';
 var sourceL = 'Source: '+sourceComon;
 var valuesL = 'Unit: <b>5-minute load</b>';
 var detailL = '<i>The average 5-minute load (as reported by the Unix uptime command) over the selected period.</i>';
-//var descL = '<span class="myslice title">'+titleL+'</span><p>'+detailL+'<p>'+selectPeriodL+'<p>'+valuesL+'<p>'+sourceL; 
-var descL = '<span class="myslice title">'+titleL+'</span><p>'+detailL+'<p>'+valuesL+'<p>'+sourceL; 
+var descL = '<span class="myslice title">'+titleL+'</span><p>'+detailL+'<p>'+selectPeriodL+'<p>'+valuesL+'<p>'+sourceL; 
 
 var titleLON= 'Longitude';
 var sourceLON = 'Source: '+sourceTophat;
@@ -140,7 +158,7 @@ var descLCY = '<span class="myslice title">'+titleLCY+'</span><p>'+detailLCY+'<p
 
 var titleLPR= 'Location precision radius';
 var sourceLPR = 'Source: '+sourceTophat;
-var valuesLPR = 'Unit: <b>float</b>';
+var valuesLPR = 'Unit: <b>float</b>.';
 var detailLPR = '<i>The radius of the circle corresponding to the error in precision of the geolocalization estimate.</i>';
 var descLPR = '<span class="myslice title">'+titleLPR+'</span><p>'+detailLPR+'<p>'+valuesLPR+'<p>'+sourceLPR;
 
@@ -150,11 +168,12 @@ var detailLRN = '<i>Based on the latitude and longitude information.</i>';
 var descLRN = '<span class="myslice title">'+titleLRN+'</span><p>'+detailLRN+'<p>'+sourceLRN;
 
 var titleMS= 'Memory size';
+var detailMS = '<i>The memory size (RAM) available on the node. For reference, the '+hardwareReqs+' is <b>4 GB</b></i>.';
 var sourceMS = 'Source: '+sourceComon;
-var valuesMS = 'Unit: <b>GB</b><p>Current PlanetLab hardware requirements: <b>4 GB</b>.';
+var valuesMS = 'Unit: <b>GB</b>.';
 var descMS = '<span class="myslice title">'+titleMS+'</span><p>'+valuesMS+'<p>'+sourceMS;
 
-var selectPeriodMU = 'Select period: <select id="selectperiodMU" onChange=updatePeriod("MU",this.value)><option value=w>Week</option><option value=m>Month</option><option value=y>Year</option></select>';
+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>';
 var titleMU = 'Memory utilization';
 var sourceMU = 'Source: '+sourceComon;
 var valuesMU = '<p>Unit: <b>%</b>';
@@ -210,8 +229,9 @@ var detailNRR = '<i> Whether the node can send packets packets using the IP reco
 var descNRR = '<span class="myslice title">'+titleNRR+'</span><p>'+detailNRR+'<p>'+valuesNRR+'<p>'+sourceNRR;
 
 var titleOS = 'Operating system';
+var detailOS = '<i>Fedora or CentOS distribution to use for node or slivers.</i>';
 var sourceOS = 'Source: '+sourceMyPLC;
-var valuesOS = 'Values: <b>Fedora, Cent/OS, other, n/a</b>';
+var valuesOS = 'Values: <b>f8, f12, Cent/OS, other, n/a</b>';
 var descOS = '<span class="myslice title">'+titleOS+'</span><p>'+valuesOS+'<p>'+sourceOS;
 
 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>';
@@ -220,7 +240,6 @@ var sourceR = 'Source: '+sourceComon+' (via '+sourceMySlice+')';
 var detailR = '<i>CoMon queries nodes every 5 minutes, for 255 queries per day. The average reliability is the percentage of queries over the selected period for which CoMon reports a value. The period is the most recent for which data is available, with CoMon data being collected by MySlice daily.</i>';
 var valuesR = 'Unit: <b>%</b>';
 var descR = '<span class="myslice title">'+titleR+'</span><p>'+detailR+'<p>'+selectPeriodR+'<p>'+valuesR+'<p>'+sourceR; 
-//var descR = '<span class="myslice title">'+titleR+'</span><p>'+detailR+'<p>'+valuesR+'<p>'+sourceR; 
 
 var titleRES = 'Reservation capabilities';
 var sourceRES = 'Source: '+sourceMyPLC;
@@ -229,7 +248,7 @@ var valuesRES = 'Values: <b>-R-</b> (if yes)';
 var detailRES = '<i> Whether the node can be reserved for a certain duration.<br>Your slivers will be available <span class=bold>only during timeslots where you have obtained leases (see tab above)</span></i>.  <p>Please note that as of August 2010 this feature is experimental.  Feedback is appreciated at <a href="mailto:devel@planet-lab.org">devel@planet-lab.org</a>';
 var descRES = '<span class="myslice title">'+titleRES+'</span><p>'+detailRES+'<p>'+valuesRES+'<p>'+sourceRES;
 
-var selectPeriodS = 'Select period: <select id="selectperiodS" onChange=updatePeriod("S",this.value)><option value=w>Week</option><option value=m>Month</option><option value=y>Year</option></select>';
+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>';
 var titleS = 'Active slices';
 var sourceS = 'Source: '+sourceComon+' (via '+sourceMySlice+')';
 var valuesS = 'Unit: <b>%</b>';
@@ -240,17 +259,19 @@ var titleSN = 'Site name';
 var sourceSN = 'Source: '+sourceMyPLC;
 var descSN = '<span class="myslice title">'+titleSN+'</span><p>'+sourceSN;
 
-var selectPeriodSSH = 'Select period: <select id="selectperiodSSH" onChange=updatePeriod("SSH",this.value)><option value=w>Week</option><option value=m>Month</option><option value=y>Year</option></select>';
+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>';
 var titleSSH = 'Average SSH response delay';
 var valuesSSH = 'Unit: <b>%</b>';
 var detailSSH = '<i>The average response delay of the node to SSH logins over the selected period for which CoMon reports a value. The period is the most recent for which data is available, with CoMon data being collected by MySlice daily.</i>';
 var sourceSSH ='Source: '+sourceComon+' (via '+sourceMySlice+')';
 var descSSH = '<span class="myslice title">'+titleSSH+'</span><p>'+detailSSH+'<p>'+selectPeriodSSH+'<p>'+valuesSSH+'<p>'+sourceSSH; 
 
-var titleST = 'Status';
-var sourceST = 'Source: '+sourceMonitor;
-var valuesST = 'Values: <b>online</b> (up and running), <b>good</b> (up and running recently), <b>offline</b> (unreachable today), <b>down</b> (node unreachable for more than one day), <b>failboot</b> (reachable, but only by administrators for debugging purposes).';
-var descST = '<span class="myslice title">'+titleST+'</span><p>'+valuesST+'<p>'+sourceST;
+
+var titleUT = 'Uptime';
+var sourceUT = 'Source: '+sourceComon;
+var valuesUT = 'Unit: <b>days</b>';
+var detailUT = 'The continuous uptime until the moment that the page is loaded, as reported by the CoMon html query API.';
+var descUT = '<span class="myslice title">'+titleUT+'</span><p>'+detailUT+'<p>'+valuesUT+'<p>'+sourceUT;
 
 
 //Categorization of columns in different types, useful for filtering 
@@ -341,22 +362,30 @@ function overrideTitles() {
 //When the checkbox is clicked. Adds/removes column respectively
 function changeCheckStatus(column) {
 
+       var h = document.getElementById(column).value;
+
        if (document.getElementById('selectdescr'))
-               showDescription(document.getElementById(column).value);
+               showDescription(h);
+
+       //debugfilter("HERE: "+column+" - "+document.getElementById('type '+column).value);
+       //debugfilter("HERE: "+column);
+
 
        if (document.getElementById(column).checked)
-               addColumn(document.getElementById(column).value, true);
+               addColumn(h, true, document.getElementById('type'+h).value);
        else
-               deleteColumn(document.getElementById(column).value);
+               deleteColumn(h);
 }
 
+
+
 //This function is used when the alternative "quick" selection list is used
 function changeSelectStatus(column) {
 
        var optionClass = "";
        var selected_index = document.getElementById('quicklist').selectedIndex;
 
-       if (document.getElementById('quicklist'))
+       if (document.getElementById('quicklist') && selected_index != 0)
        {
 
                optionClass = document.getElementById('quicklist').options[selected_index].className;
@@ -365,15 +394,34 @@ function changeSelectStatus(column) {
                {
                        deleteColumn(document.getElementById('quicklist').value);
                        document.getElementById('quicklist').options[selected_index].className = "out";
+                       document.getElementById('quicklist').value="0";
                }
                else
                {
                        addColumn(document.getElementById('quicklist').value, true);
                        document.getElementById('quicklist').options[selected_index].className = "in";
+                       document.getElementById('quicklist').value="0";
                }
        }
 }
 
+function updateReferenceNode(new_ref_node) {
+
+       var old_ref_node = document.getElementById('selected_reference_node').value;
+       document.getElementById('selected_reference_node').value=new_ref_node;
+
+       //debugfilter("changed "+old_ref_node+" with "+new_ref_node);
+
+       if (document.getElementById('checkHC').checked)
+       {
+               addColumnAjax('HC', 'HC');
+               //debugfilter("replacing "+old_ref_node+" with "+new_ref_node);
+               replaceColumnConfiguration('HC:'+old_ref_node,'HC:'+new_ref_node);
+       }
+
+}
+
+
 //When the period of an already selected column is changed
 function updatePeriod(h, new_period) {
 
@@ -411,15 +459,35 @@ function getHTTPObject()
         return false;
 }
 
-
-function closeShowReservable()
+function closeMessage(tab)
 {
+       var current_conf = document.getElementById('show_configuration').value;
+       var value = '';
+
+       if (current_conf != "")
+               current_conf += ";";
+
+       if (tab == 'reservable') {      
+        document.getElementById('note_reservable_div').style.display = "none";
+       if (current_conf.indexOf('reservable') != -1)
+               return;
+       value = current_conf+'reservable';
+       }
+
+       if (tab == 'columns') { 
+        document.getElementById('note_columns_div').style.display = "none";
+       if (current_conf.indexOf('columns') != -1)
+               return;
+       value = current_conf+'columns';
+       }
+
        var slice_id = document.getElementById('slice_id').value;
        var person_id = document.getElementById('person_id').value;
        var tag_id = document.getElementById('show_tag_id').value;
-        document.getElementById('note_reservable_div').style.display = "none";
-
-        var url = "/plekit/php/updateConfiguration.php?value="+slice_id+";reservable:no&slice_id="+slice_id+"&person_id="+person_id+"&tag_id="+tag_id;
+       
+        var url = "/plekit/php/updateConfiguration.php?value="+value+"&slice_id="+slice_id+"&person_id="+person_id+"&tag_name=showconf&tag_id="+tag_id;
+       //debugfilter("updating conf with "+url);
+       document.getElementById('show_configuration').value = value;
 
        var req = getHTTPObject();
        req.open('GET', url, true);
@@ -434,14 +502,16 @@ function closeShowReservable()
 }
 
 
-function updateColumnConfiguration(slice_id, value, reload)
+function updateColumnConfiguration(value, reload)
 {
        var person_id = document.getElementById('person_id').value;
+       var slice_id = document.getElementById('slice_id').value;
        var tag_id = document.getElementById('conf_tag_id').value;
        var full_column_configuration = document.getElementById('full_column_configuration').value;
 
        //debugfilter("<br>OLD = "+full_column_configuration);
        //debugfilter("<br>value = "+value);
+       //
        
        var old_columns = full_column_configuration.split(";");
        var new_columns = new Array();
@@ -452,8 +522,12 @@ function updateColumnConfiguration(slice_id, value, reload)
                        new_columns.push(old_columns[++column_index]);
                else
                {
+                       if (value != "")
+                               new_columns.push(value);
+                       else
+                               new_columns.push("default");
+                               
                        column_index++;
-                       new_columns.push(value);
                }
        }
 
@@ -482,20 +556,18 @@ function updateColumnConfiguration(slice_id, value, reload)
             }
           }
 
-        xmlhttp.open("GET","/plekit/php/updateConfiguration.php?value="+new_configuration+"&slice_id="+slice_id+"&person_id="+person_id+"&tag_id="+tag_id,true);
+        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);
         //xmlhttp.open("GET","/plekit/php/updateConf.php?value="+value+"&slice_id="+slice_id+"&person_id="+person_id+"&tagName=Columnconf",true);
 
         xmlhttp.send();
 }
 
-function logSortingAction(slice_id, value)
+function logSortingAction(person_id, slice_id, value)
 {
 
-       if (value.indexOf("column-1")!=-1)
-               return;
 
        var req = getHTTPObject();
-        var url = "/plekit/php/logSorting.php?value="+value+"&slice_id="+slice_id;
+        var url = "/plekit/php/logSorting.php?value="+value+"&slice_id="+slice_id+"&person_id="+person_id;
 
        req.open('GET', url, true);
        req.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
@@ -510,14 +582,23 @@ function logSortingAction(slice_id, value)
 function sortCompleteCallback(tableid) {
 
        var slice_id = document.getElementById('slice_id').value;
+       var person_id = document.getElementById('person_id').value;
 
        var ths = document.getElementById(tableid).getElementsByTagName("th");
        for(var i = 0, th; th = ths[i]; i++) {
        if (th.className.indexOf("Sort") != -1)
        {
-               var column = th.className.substr(th.className.indexOf("column"),th.className.indexOf("column")+1);
-               var sortdirection = th.className.substr(th.className.indexOf("Sort")-8,th.className.indexOf("Sort"));
-               logSortingAction(slice_id, tableid+"|"+column+"|"+sortdirection);
+               //debugfilter("sorted"+th.getAttribute("name"));
+
+               var column_name = th.getAttribute("name");
+               var hclass = th.className;
+               var column = hclass.substr(hclass.indexOf("column"),hclass.indexOf("column")+1);
+               var sortdirection = "forward";
+               if (hclass.indexOf("reverse")!=-1)
+                       sortdirection = "reverse";
+
+               if (column.indexOf("column-1")==-1 && column.indexOf("column-0")==-1)
+                       logSortingAction(person_id, slice_id, tableid+"|"+column_name+"|"+sortdirection);
        }
        }
 }
@@ -526,7 +607,6 @@ function sortCompleteCallback(tableid) {
 function addColumnToConfiguration(column) {
 
        var old_configuration = document.getElementById('column_configuration').value;
-       var slice_id = document.getElementById('slice_id').value;
 
        var new_configuration = "";
 
@@ -537,14 +617,13 @@ function addColumnToConfiguration(column) {
 
        //debugfilter("new configuration = "+new_configuration);
 
-       updateColumnConfiguration(slice_id, new_configuration, false);
+       updateColumnConfiguration(new_configuration, false);
 }
 
 
 function deleteColumnFromConfiguration(column) {
 
        var old_configuration = document.getElementById('column_configuration').value;
-       var slice_id = document.getElementById('slice_id').value;
 
        var old_columns = old_configuration.split("|");
        var new_columns = new Array();
@@ -556,21 +635,22 @@ function deleteColumnFromConfiguration(column) {
        }
 
        var new_configuration = new_columns.join("|");
-       updateColumnConfiguration(slice_id, new_configuration, false);
+       updateColumnConfiguration(new_configuration, false);
 
 }
 
 function replaceColumnConfiguration(column_old, column_new) {
 
        var old_configuration = document.getElementById('column_configuration').value;
-       var slice_id = document.getElementById('slice_id').value;
 
        var old_columns = old_configuration.split("|");
        var new_columns = new Array();
 
+       var olds = column_old.split(':');
+
        for (var column_index = 0; column_index < old_columns.length ; column_index++) {
                var conf = old_columns[column_index].split(':');
-               if (conf[0] != column_old)
+               if (conf[0] != olds[0])
                        new_columns.push(old_columns[column_index]);
                else
                        new_columns.push(column_new);
@@ -578,7 +658,7 @@ function replaceColumnConfiguration(column_old, column_new) {
 
        var new_configuration = new_columns.join("|");
        
-       updateColumnConfiguration(slice_id, new_configuration);
+       updateColumnConfiguration(new_configuration);
 }
 
 /*
@@ -588,9 +668,37 @@ ADD/REMOVE COLUMNS
 */
 
 
+function convert_data(value, data_source, data_type, tagname) {
 
+       //debugfilter("v["+tagname+"]="+value+"-");
 
-function load_data(column, header, url) {
+       if (value == "" || value == "n/a" || value == null || value == "NaN" || value == "None")
+               return "n/a";
+
+       if (tagname == "uptime") {
+               return parseInt((parseFloat(value) / 86400));
+       }
+       
+       if (data_type == "date") {
+
+               var date = new Date(value*1000);
+
+               var year = date.getFullYear();
+               var month = date.getMonth()+1;
+               if (month < 10)
+                       month = "0"+month;
+               var day = date.getDate();
+               if (day < 10)
+                       day = "0"+day;
+       
+               return year + '-' + month + '-' + day;
+       }
+
+       return value;
+}
+
+
+function load_data(column, header, url, data_source, data_type, tagname) {
 
        //debugfilter("<br>loading "+url);
        var req = getHTTPObject();
@@ -600,20 +708,26 @@ function load_data(column, header, url) {
        req.onreadystatechange =
         function() {
                 if (req.readyState == 4)
-                { updateColumnData(column, header, req.responseText); }
+                { updateColumnData(column, header, req.responseText, data_source, data_type, tagname); }
         }
        req.send(null);
 }
 
 
-function updateColumnData(column, header, data) {
+function updateColumnData(column, header, data, data_source, data_type, tagname) {
 
 var headers = header.split("|");
 var data_table = data.split("|"); 
 
 //debugfilter("<p>headers[0] = "+headers[0]);
-//debugfilter("<p>sample line = "+data_table[2]);
+//debugfilter("<p>data[2] = "+data_table[2]);
+
+//debugfilter("data = "+data + " with type "+data_type + " and source "+data_source);
 
+if (data != "")
+{
+  
+//debugfilter("GOT SOME DATA");
 
   var node_data;
 
@@ -635,14 +749,15 @@ var data_table = data.split("|");
 
        for (var h_index=0; h_index < headers.length; h_index++) {
                
-               if (node_data[h_index+1] == "")
+               if (node_data[h_index+1] == "" || node_data[h_index+1] == "None")
                        data_array1[node_data[0]][h_index] = "n/a";
                else
-                       data_array1[node_data[0]][h_index] = node_data[h_index+1];
+                       data_array1[node_data[0]][h_index] = convert_data(node_data[h_index+1], data_source, data_type, tagname);
        }
 
   }
        
+
   if (rows)
   for (var row_index = 0; row_index < rows.length ; row_index++) {
     var tr=rows[row_index];
@@ -659,8 +774,8 @@ var data_table = data.split("|");
     }
   }
 
+  //tablePaginater.init(table_id1);
   fdTableSort.init(table_id1);
-  tablePaginater.init(table_id1);
 
 //potential nodes
 if (data_table[node_index] == '---potential---')       
@@ -687,7 +802,7 @@ if (data_table[node_index] == '---potential---')
                if (node_data[h_index+1] == "")
                        data_array2[node_data[0]][h_index] = "n/a";
                else
-                       data_array2[node_data[0]][h_index] = node_data[h_index+1];
+                       data_array2[node_data[0]][h_index] = convert_data(node_data[h_index+1], data_source, data_type, tagname);
        }
   }
        
@@ -704,11 +819,15 @@ if (data_table[node_index] == '---potential---')
                }
     }
   }
-
-  //fdTableSort.removeTableCache(table_id2);
   fdTableSort.init(table_id2);
-  tablePaginater.init(table_id2);
+  //tablePaginater.init(table_id2);
 
+}
+
+  //fdTableSort.removeTableCache(table_id2);
+  //document.getElementById('loading'+column).innerHTML = "";
+  //debugfilter("Reset sorting .....");
+  
 }
 
 document.getElementById('loading'+column).innerHTML = "";
@@ -742,6 +861,8 @@ function addColumnAjax(column, header) {
         var selectedperiod = document.getElementById('period'+column).value;
 
        var fetched = document.getElementById('fetched'+column).value;
+       var data_source = document.getElementById('source'+column).value;
+       var data_type = document.getElementById('type'+column).value;
        var to_load = false;
 
        //debugfilter("<br>adding "+column+","+header+','+fetched+','+t);
@@ -760,8 +881,8 @@ function addColumnAjax(column, header) {
        if (to_load)
        {
                document.getElementById('loading'+column).innerHTML = "<img width=10 src=/plekit/icons/ajax-loader.gif>";
-               var url = "/plekit/php/updateColumn.php?slice_id="+slice_id+"&tagName="+t;
-               load_data(column, header, url);
+               var url = "/plekit/php/updateColumn.php?slice_id="+slice_id+"&tagName="+t+"&data_type="+data_type+"&data_source="+data_source;
+               load_data(column, header, url, data_source, data_type, t);
        }
 }
 
@@ -771,6 +892,8 @@ function addColumn(column, fetch) {
 
        var selectedperiod="";
        var header=column;
+       var conf="";
+
 
        if (inTypeC(column)!=-1)
        {
@@ -780,15 +903,22 @@ function addColumn(column, fetch) {
         selectedperiod = document.getElementById('period'+column).value;
        header = column+""+selectedperiod;
 
-       //debugfilter("adding column "+column+" and header "+header);
+       if (inTypeD(column)!=-1)
+       {
+               conf = header+":"+document.getElementById('reference_node').value;
+               document.getElementById('selected_reference_node').value=document.getElementById('reference_node').value;
+       }
+       else
+               conf = header;
+
+       //debugfilter("adding column "+column+" and header "+header+" and conf = "+conf);
 
        addColumnCells(header);
 
        if (fetch)
                addColumnAjax(column, header);
 
-       addColumnToConfiguration(header);
-       
+       addColumnToConfiguration(conf);
 }
 
 
@@ -801,7 +931,6 @@ function deleteColumnCells(header) {
 }
 
 
-
 function deleteColumn(column) {
 
        var selectedperiod="";
@@ -815,8 +944,6 @@ function deleteColumn(column) {
        deleteColumnCells(header);
 
        deleteColumnFromConfiguration(header);
-
-       //document.getElementById('check'+column).checked = false;
 }
 
 
@@ -824,17 +951,21 @@ function deleteColumn(column) {
  
 EXTRA
 
-//to be used for scrolling the column list with down/up arrows 
 
-function scrollList(tableid) {
+function removeSelectHandler(object)
+{
+       debugfilter(object);
+        object.onclick = null;
+}
 
-debugfilter("here");
+//to be used for scrolling the column list with down/up arrows 
 
+function scrollList() {
+debugfilter("here "+document.getElementById('scrolldiv').focused);
 if (event.keyCode == 40)
        debugfilter("down");
 else if (event.keyCode == 38)
        debugfilter("up");
-
 }
 
 function resetColumns() {