landing more bug fixes for reporter, client side.

This commit is contained in:
robert%accettura.com 2006-01-19 22:30:32 +00:00
Родитель 358233bd15
Коммит ab8f5e1642
5 изменённых файлов: 36 добавлений и 32 удалений

Просмотреть файл

@ -110,7 +110,7 @@ if (isset($_GET['selected'])){
$content->assign('selected', $_GET['selected']);
}
else {
$content->assign('selected', array('report_id', 'host_hostname'));
$content->assign('selected', array('report_id', 'host_hostname', 'report_file_date'));
}
displayPage($content, 'index', 'index.tpl');

Просмотреть файл

@ -49,7 +49,9 @@ session_start();
header("Cache-control: private"); //IE 6 Fix
printheaders();
$method = 'html';
if(!$_GET['method']){
$method = 'html';
}
$title = "Searching Results";
@ -91,7 +93,7 @@ if (sizeof($output['data']) == 0){
* We cap the navigation at 2000 items because php sometimes acts wierd
* when sessions get to big. In most cases, this won't effect anyone.
*******/
if($result['totalResults'] < 2000){
if($result['totalResults'] < $config['max_nav_count']){
$_SESSION['reportList'] = $result['reportList'];
} else {
unset($_SESSION['reportList']);

Просмотреть файл

@ -94,9 +94,9 @@ if(isset($_SESSION['reportList'])){
$query = new query;
$query_input = $query->getQueryInputs();
$continuity_params = $query->continuityParams($query_input);
$continuity_params = $query->continuityParams($query_input, null);
$content->assign('continuity_params', $continuity_params[0]);
$content->assign('continuity_params', $continuity_params);
$reportIndex = array_search($_GET['report_id'], $_SESSION['reportList']);

Просмотреть файл

@ -100,6 +100,10 @@ $config['products'][1] = 'Firefox/1.0+';
// How many items to show by default
$config['show'] = 25;
$config['max_show'] = 200;
// Max items to remember for next/prev navigation
$config['max_nav_count'] = 2000;
// Field Names, and how they should appear in the UI
$config['fields']['report_id'] = 'Report ID';

Просмотреть файл

@ -21,8 +21,7 @@ class query
'report_description',
/* 'report_email',
'report_ip',
*/
'report_host_id',
*/ 'report_host_id',
'host_id',
);
var $approved_wheres = array('count',
@ -65,7 +64,7 @@ class query
*******************/
if (!isset($_GET['show']) ||
$_GET['show'] == null ||
$_GET['show'] > 200)
$_GET['show'] > $config['max_show'])
{
$show = $config['show'];
} else {
@ -88,7 +87,7 @@ class query
*******************/
$count = null;
if (isset($_GET['count'])){
$count = 'host_id'; // XX limitation for now
$count = 'report_id'; // XX limitation for now
}
// if nothing... it's nothing
@ -111,13 +110,13 @@ class query
} else {
// Otherwise, we do it for them
$selected[] = array('field' => 'host_hostname',
'title' => 'Host');
'title' => $config['fields']['host_hostname']);
}
if(!isset($_GET['count']) &&
$this->_searchQueryInput($selected, 'report_id') === false){
$artificialReportID = true;
$selected[] = array('field' => 'report_id',
'title' => 'Report ID');
'title' => $config['fields']['report_id']);
}
/*******************
@ -128,6 +127,10 @@ class query
if(isset($_GET['orderby']) && in_array(strtolower($_GET['orderby']), $this->approved_selects)){
$orderby[$_GET['orderby']] = $ascdesc;
}
/*******************
* COUNT
*******************/
// After, we append those who werere selected previously and order desc.
if(!isset($_GET['count'])){
$orderby = array_merge($orderby, $this->_calcOrderBy($selected, $orderby));
@ -136,12 +139,12 @@ class query
// If we are counting, we need to add A column for it
if (isset($_GET['count'])){
// set the count variable
$selected['count'] = 'Number';
unset($selected['report_id']);
$next =sizeof($selected)+1;
$selected[$next]['field'] = 'count';
$selected[$next]['title'] = 'Amount';
// Hardcode host_id
$_GET['count'] = 'host_id'; // XXX we just hardcode this (just easier for now, and all people will be doing).
$_GET['count'] = 'report_id'; // XXX we just hardcode this (just easier for now, and all people will be doing).
// XX NOTE: We don't escape count below because 'host_id' != `host_id`.
/*******************
@ -183,7 +186,6 @@ class query
}
}
}
return array('selected' => $selected,
'where' => $where,
'orderby' => $orderby,
@ -204,7 +206,7 @@ class query
foreach($select as $select_child){
// we don't $db->quote here since unless it's in our approved array (exactly), we drop it anyway. i.e. report_id is on our list, 'report_id' is not.
// we sanitize on our own
if ($select_child == 'count'){
if ($select_child['field'] == 'count'){
$sql_select .= 'COUNT( '.$count.' ) AS count';
if(!isset($orderby['count'])){
$orderby = array_merge(array('count'=> 'DESC'), $orderby);
@ -229,6 +231,7 @@ class query
************/
$sql_where = 'WHERE ';
foreach($where as $where_child){
// we make sure to use quote() here to escape any evil
$sql_where .= $where_child[0].' '.$where_child[1].' '.$db->quote($where_child[2]).' AND ';
}
@ -281,7 +284,7 @@ class query
*******************/
$sql_groupby = null;
if (isset($_GET['count'])){
$sql_groupby = 'GROUP BY host_id DESC ';
$sql_groupby = 'GROUP BY host_hostname DESC ';
}
$sql = $sql_select." \r".$sql_from." \r".$sql_where." \r".$sql_groupby.$sql_orderby;
@ -345,10 +348,12 @@ class query
if(isset($query_input['selected']) && sizeof($query_input['selected']) > 0 && !in_array('selected', $omit)){
foreach($query_input['selected'] as $selectedNode){
if(!($selectedNode['field'] == 'report_id' && $query_input['artificialReportID'])){
if($selectedNode['field'] != 'count' && in_array('count', $omit)){
$standard .= 'selected%5B%5D='.$selectedNode['field'].'&amp;';
}
}
}
}
// Orderby
@ -373,6 +378,7 @@ class query
}
// lets return
return $standard;
}
@ -393,7 +399,7 @@ class query
$o_ascdesc = 'desc';
}
if((isset($query_input['count']) && $title_name == 'count') || !isset($query_input['count'])){
if((isset($query_input['count'])) || !isset($query_input['count'])){
$column[$columnCount]['url'] = '?'.$continuityParams.'&amp;orderby='.$o_orderby.'&amp;ascdesc='.$o_ascdesc;
}
$columnCount++;
@ -402,9 +408,10 @@ class query
return $column;
}
function outputHTML($result, $query_input, $continuity_params, $columnHeaders){
function outputHTML($result, $query_input, $columnHeaders){
global $iolib;
$continuity_params = $this->continuityParams($query_input, array('count'));
// Data
$data = array();
$rowNum = 0;
@ -415,10 +422,10 @@ class query
// Prepend if new_front;
$data[$rowNum][0]['text'] = 'Detail';
if (isset($row['count'])){
$data[$rowNum][0]['url'] = '/query/?host_hostname='.$row['host_hostname'].'&amp;selected%5B%5D=host_hostname&amp;'.$continuity_params[0];
$data[$rowNum][0]['url'] = '/query/?host_hostname='.$row['host_hostname'].'&amp;selected%5B%5D=host_hostname&amp;'.$continuity_params;
}
else {
$data[$rowNum][0]['url'] = '/report/?report_id='.$row['report_id'].'&amp;'.$continuity_params[0];
$data[$rowNum][0]['url'] = '/report/?report_id='.$row['report_id'].'&amp;'.$continuity_params;
}
$colNum++;
@ -458,15 +465,6 @@ class query
}
}
/*
foreach($selected as $selectedChild){
if(in_array($selectedChild['field'], $this->approved_selects) &&
!array_key_exists($selectedChild['field'], $orderby))
{
$result[$selectedChild['field']] = 'desc';
}
}
*/
return $result;
}