}
foreach ($this->tag_columns as $column) {
-$this->all_headers[$column['header']]=array('header'=>$column['header'],'type'=>$column['type'],'tagname'=>$column['tagname'],'title'=>$column['tagname'], 'description'=>$column['title'], 'label'=>$this->removeDuration($column['header']),'visible'=>false);
+
+//print("<br>".$column['header'].":".$column['headerId'].":".$column['tagname']);
+
+if ($column['headerId'] != "")
+ $headerId = $column['headerId'];
+else
+ $headerId = $column['header'];
+
+$this->all_headers[$headerId]=array('header'=>$headerId,'type'=>$column['type'],'tagname'=>$column['tagname'],'title'=>$column['title'], 'description'=>$column['title'], 'label'=>$column['header'],'visible'=>false);
}
foreach ($this->extra_columns as $column) {
-$this->all_headers[$column['header']]=array('header'=>$column['header'],'type'=>$column['type'],'tagname'=>$column['tagname'],'title'=>$column['tagname'], 'description'=>$column['title'], 'label'=>$this->removeDuration($column['header']),'visible'=>false);
+$this->all_headers[$column['header']]=array('header'=>$column['header'],'type'=>$column['type'],'tagname'=>$column['tagname'],'title'=>$column['title'], 'description'=>$column['title'], 'label'=>$column['header'],'visible'=>false);
}
return $this->all_headers;
}
+function get_selected_period($label) {
+
+if ($this->all_headers[$label."w"]['visible'])
+ return "w";
+else if ($this->all_headers[$label."m"]['visible'])
+ return "m";
+else if ($this->all_headers[$label."y"]['visible'])
+ return "y";
+else if ($this->all_headers[$label]['visible'])
+ return "";
+
+return "";
+}
+
function node_tags() {
$fetched_tags = array('node_id');
foreach ($this->all_headers as $h)
{
- $headers.="<br>".$h['header'].":".$h['label'].":".$h['tagname'];
+ $headers.="<br>".$h['header'].":".$h['label'].":".$h['tagname'].":".$h['visible'];
}
return $headers;
}
$headersToShow = $this->visible_headers;
+if (in_array($header_name, $headersToShow))
+ return true;
- if ($this->inTypeC($header_name."w") || $this->inTypeC($header_name."m") || $this->inTypeC($header_name."y"))
- return (in_array($header_name."w", $headersToShow) || in_array($header_name."m", $headersToShow) || in_array($header_name."y", $headersToShow));
- else
- return in_array($header_name, $headersToShow);
+if ($this->inTypeC($header_name."w"))
+ return (in_array($header_name."w", $headersToShow) || in_array($header_name."m", $headersToShow) || in_array($header_name."y", $headersToShow));
}
function cells($table, $node) {
+$this->fetch_data($node);
foreach ($this->all_headers as $h)
{
+if (!$h['fixed']) {
-if (!$h['fixed'] && $h['visible'])
+if ($h['visible'] != "")
{
if ($this->inTypeC($h['header']))
{
$table->cell($value,array('name'=>$h['header'], 'display'=>'table-cell'));
}
}
-else
+else
$table->cell("??", array('name'=>$h['header'], 'display'=>'none'));
-
+}
}
}
*/
-function javascript_vars() {
+function javascript_init() {
print("<input type='hidden' id='reference_node' value='".$this->reference_node."' />");
-$all_columns_string = "";
-foreach ($this->all_headers as $h)
- $all_columns_string.= $h['header'].",";
-
print("<script type='text/javascript'>");
+print("highlightOption('AU');");
+print("overrideTitles();");
+print("</script>");
-print("var column_table = new Array();");
-print ("var column_index=0;");
-print("var column_table2 = new Array();");
-print("var column_headers = new Array();");
-print("var columns_to_fetch = new Array();");
-//document.onkeyup = scrollList('test');
+}
+
+
+
+function quickselect_html() {
+
+//return '<p>This link uses the onclick event handler.<br><a href="#" onclick="setVisible(\'quicklist\');return false" target="_self">Open popup</a></p>';
+
+
+$quickselection = "<select id='quicklist' multiple size=10 onChange=changeSelectStatus(this.value)><option value''>Add/remove columns</option>";
+$prev_label="";
+$optionclass = "out";
foreach ($this->all_headers as $h)
{
-/*
- print("column_table2[column_index] = new Array();");
- print("column_table2[column_index]['header'] = ".$h['header'].";");
- print("column_table2[column_index]['label'] = ".$h['label'].";");
- if ($h['visible'])
+ if ($h['header'] == "hostname")
+ continue;
+
+ if ($h['fixed'])
+ $disabled = "disabled=true";
+ else
+ $disabled = "";
+
+ if ($this->headerIsVisible($h['label']))
{
- print("column_table2[column_index]['visible'] = true;");
- print("column_table2[column_index]['fetched'] = true;");
+ $optionclass = "in";
+ //$selected = "selected=selected";
}
- else
+ else
{
- print("column_table2[column_index]['visible'] = false;");
- print("column_table2[column_index]]['fetch'] = false;");
+ $optionclass = "out";
+ //$selected = "";
}
- print("column_table2[column_index]['tagname'] = '".$h['tagname']."';");
- print("column_table2[column_index]['description'] = '".$h['description']."';");
-*/
- print("column_table[\"".$h['header']."\"] = new Array();");
- if ($h['visible'])
+ if ($prev_label == $h['label'])
+ continue;
+
+ $prev_label = $h['label'];
+
+
+$quickselection.="<option id='option'".$h['label']." class='".$optionclass."' '".$selected."' value='".$h['label']."'>".$h['label'].": ".$h['title']."</option>";
+}
+
+
+$quickselection.="</select>";
+$quickselection.=" <input type='button' id='fetchbutton' onclick='fetchData()' value='Fetch data' disabled=true />";
+
+return $quickselection;
+
+}
+
+
+function quickselect_popup_html() {
+
+print('<div id="quickdiv">');
+print ("<select size='12' id='quicklist' onChange=changeSelectStatus(this.value)>");
+
+$prev_label="";
+$optionclass = "out";
+foreach ($this->all_headers as $h)
+{
+ if ($h['header'] == "hostname")
+ continue;
+
+ if ($h['fixed'])
+ $disabled = "disabled=true";
+ else
+ $disabled = "";
+
+ if ($this->headerIsVisible($h['label']))
{
- print("column_table['".$h['header']."']['visible'] = true;");
- print("column_table['".$h['header']."']['fetched'] = true;");
+ $optionclass = "in";
+ //$selected = "selected=selected";
}
- else
+ else
{
- print("column_table['".$h['header']."']['visible'] = false;");
- print("column_table['".$h['header']."']['fetch'] = false;");
+ $optionclass = "out";
+ //$selected = "";
}
- print("column_table['".$h['header']."']['tagname'] = '".$h['tagname']."';");
- print("column_table['".$h['header']."']['description'] = '".$h['description']."';");
-}
+ if ($prev_label == $h['label'])
+ continue;
-foreach ($this->all_headers as $h)
- print("column_headers['".$h['label']."'] = '0';");
+ $prev_label = $h['label'];
-print("var all_columns_string = '".substr($all_columns_string,0,strlen($all_columns_string)-1)."';");
-//if ($first_time == true)
- //print("resetConfiguration();");
-//print("debugfilter('vars are OK');");
+ print ("<option id='option'".$h['label']." class='".$optionclass."' '".$selected."' value='".$h['label']."'>".$h['label'].": ".$h['title']."</option>");
+}
-print("</script>");
+
+print("</select></div>");
+print(" <input type='button' id='fetchbutton' onclick='fetchData()' value='Fetch data' disabled=true />");
}
$table_width = 350;
print("<table align=center cellpadding=10 width=".$table_width.">");
-print("<tr><th>Add/delete columns</th>");
+print("<tr><th>Add/remove columns</th>");
if ($showDescription)
print("<th>Column description and configuration</th>");
print("</tr><tr><td valign=top width=300>");
- print('<div id="scrolldiv" onFocusOut="debugfilter(this.id);" style="border : solid 2px grey; padding:4px; width:300px; height:180px; overflow:auto;">');
+ print('<div id="scrolldiv" style="border : solid 2px grey; padding:4px; width:300px; height:180px; overflow:auto;">');
print ("<table>");
$prev_label="";
$optionclass = "out";
if ($this->headerIsVisible($h['label']))
{
$selected = "checked=true";
+ $fetch = "true";
//print("header ".$h['label']." checked!");
}
else
{
$selected = "";
+ $fetch = "false";
}
+ print("<input type='hidden' id='tagname".$h['header']."' value='".$h['tagname']."'></input>");
+
if ($prev_label == $h['label'])
continue;
$prev_label = $h['label'];
-
- print ("<tr><td><div id='".$h['label']."' class='".$optionclass."' onkeyup='debugfilter(this.id)' onclick='highlightOption(this.id)'><table width=280 id='table".$h['label']."'><tr><td align=left width=30>".$h['label']."</td><td align=left> <span style='height:10px' id ='htitle".$h['label']."'>".$h['title']."</span> </td><td align=right width=20><input id='check".$h['label']."' type='checkbox' ".$selected." ".$disabled." autocomplete='off' value='".$h['label']."' onclick='changeCheckStatus(this.id)'></input></td></tr></table></div></td></tr>");
+ $period = $this->get_selected_period($h['label']);
+
+//<input type='hidden' id='fdesc".$h['label']."' value='".$h['description']."'></input>
+ print ("<tr><td>
+<input type='hidden' id='fetched".$h['label']."' value=',".$period.",".$fetch."'></input>
+<input type='hidden' id='period".$h['label']."' value='".$period."'></input>
+ <div id='".$h['label']."' name='columnlist' class='".$optionclass."' onclick='highlightOption(this.id)'>
+<table width=280 id='table".$h['label']."'><tr>
+<td bgcolor=#CAE8EA align=center width=30><b><span style='color:#3399CC'>".$h['label']."</span></b></td>
+<td align=left> <span style='height:10px' id ='htitle".$h['label']."'>".$h['title']."</span> </td>
+<td align=right width=20> <span style='height:10px' id ='loading".$h['label']."'></span> </td>
+<td align=right width=20><input id='check".$h['label']."' name='".$h['tagname']."' type='checkbox' ".$selected." ".$disabled." autocomplete='off' value='".$h['label']."' onclick='changeCheckStatus(this.id)'></input></td>
+</tr></table></div></td></tr>");
}
print("</table> </div></td>");
print("<div class='myslice' id='selectdescr'> </div></td>");
}
-print("</tr><tr><td align=center>");
+print("</tr>");
+//print("<tr><td align=center>");
//print("<input type='button' value='Reset' onclick=resetCols('previousConf') />");
//print("<input type='button' value='Default' onclick=saveConfiguration('defaultConf') />");
-print("<input type='button' value='Reset table' onclick=\"resetConfiguration('defaultConf')\" />");
-print(" <input type='button' value='Save configuration' onclick=saveConfiguration('column_configuration') />");
-print(" <input type='button' id='fetchbutton' onclick='fetchData()' value='Fetch data' disabled=true /> </td>");
+//print("<input type='button' value='Reset table' onclick=\"resetConfiguration()\" />");
+//print("</td>");
+//print(" <input type='button' value='Save configuration' onclick=saveConfiguration('column_configuration') />");
+//print(" <input type='button' id='fetchbutton' onclick='fetchData()' value='Fetch data' disabled=true /> </td>");
if ($showDescription)
print("<td></td>");
print(" </tr> </table>");
}
+
+
function column_filter () {
echo <<< EOF