removed extra result tables for timetable results

added combobox for result view switching (normal table / timetable)
This commit is contained in:
Michael Clemens 2009-05-14 09:19:21 +00:00
parent 9d84e239e0
commit f83ed97a42
5 changed files with 107 additions and 100 deletions

View File

@ -27,9 +27,8 @@
* @package tsmmonitor
*/
if ($_POST["css"] != "") {
$_SESSION['stylesheet'] = $_POST["css"];
}
if ($_POST["css"] != "") $_SESSION['stylesheet'] = $_POST["css"];
if ($_POST["tabletype"] != "") $_SESSION["tabletype"] = $_POST["tabletype"];
?>
<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01 Transitional//EN\" \"http://www.w3.org/TR/html4/loose.dtd\">

View File

@ -36,6 +36,20 @@
//if ($tsmmonitor->GETVars['qq'] != "admin" && !$_POST["edit"] == "edit") {
if ($tsmmonitor->GETVars['qq'] != "index" && $tsmmonitor->GETVars['qq'] != "overview" && $tsmmonitor->GETVars['qq'] != "serverlist") {
echo "<input type='button' value='PDF' onclick='genPDF()' class='button'>";
if ($tsmmonitor->configarray["queryarray"][$tsmmonitor->GETVars['qq']]["timetablefields"] != "") {
echo "<select name='tabletype' size=1 onChange='submit();' class='button'>";
$types = array('normal view', 'timetable');
foreach ($types as $type) {
echo '<option value="'.$type.'"';
if ($_SESSION['tabletype'] == $type){echo "SELECTED";}
echo '> '.$type.'</option>';
}
echo "</select>";
}
}
if ($tsmmonitor->GETVars['qq'] != "polldstat" && $tsmmonitor->GETVars['qq'] != "serverlist") {

View File

@ -108,7 +108,8 @@ class TSMMonitor {
if ($this->GETVars['server'] == "") { $this->GETVars['server']=$this->configarray["defaultserver"]; }
if ($this->GETVars['orderdir'] == "") { $this->GETVars['orderdir'] = "asc"; }
if ($_SESSION['timeshift'] == '' || !strstr($this->GETVars["qq"], 'dynamictimetable')) {
//if ($_SESSION['timeshift'] == '' || !strstr($this->GETVars["qq"], 'dynamictimetable')) {
if ($_SESSION['timeshift'] == '' || $this->configarray["queryarray"][$this->GETVars['qq']]["timetablefields"] == "") {
$_SESSION['timeshift'] = 0 ;
}
@ -119,12 +120,13 @@ class TSMMonitor {
$_SESSION["GETVars"] = $this->GETVars;
// BEGIN Timemachine
//Cleanup
if ($_SESSION["from"] != $_GET['q']) {
$_SESSION['timemachine'] = "";
$_SESSION['tabletype'] = "";
}
// BEGIN Timemachine
if ($_POST['dateinput'] != "") $_SESSION['timemachine']['date'] = strtotime($_POST['dateinput']);
if ($_POST['timestamps'] != "") $_SESSION['timemachine']['time'] = $_POST['timestamps'];
@ -443,6 +445,42 @@ class TSMMonitor {
/**
* getStylesheetSwitcher - returns HTML Code for Stylesheetswitchdropdownbox ;)
*
* @return string
*/
function getStylesheetSwitcher() {
$ret = "";
$ret .= "<div class='sidebarinfo'>";
$ret .= "<b>Stylesheet Switcher</b><br><br>";
$ret .= "<form action=".$_SERVER['PHP_SELF']."?q=".$tsmmonitor->GETVars['qq']."&m=".$tsmmonitor->GETVars['menu']."&s=".$tsmmonitor->GETVars['server']." method='post'>\n";
$ret .= "<select name='css' size=1 onChange='submit();' class='button'>\n";
if ($handle = opendir('css')) {
while (false !== ($file = readdir($handle))) {
if ($file != '.' && $file != '..' && substr($file, 0, 6) == 'style_') {
$fileName = str_replace('.css', '', $file);
$fileName = str_replace('style_', '', $fileName);
$ret .= '<option value="' . $file . '"';
if ($_SESSION['stylesheet'] == $file){ $ret .= "SELECTED"; }
$ret .= '>' . $fileName . '</option>';
}
}
closedir($handle);
}
$ret .= "</select>\n";
$ret .= "</form>\n";
$ret .= "</div>";
return $ret;
}
/**
* getTableheader - generates and returns headers for query result HTML tables.
@ -781,7 +819,11 @@ class TSMMonitor {
$wc= " ";
}
$columnnames = $this->getTableFields("res_".$qtable."_".$server);
if ($type == "timetable") {
$columnnames = $this->configarray["queryarray"][$this->GETVars['qq']]["timetablefields"];
} else {
$columnnames = $this->getTableFields("res_".$qtable."_".$server);
}
if ($columnnames == "") $bContinue = FALSE;
@ -837,11 +879,11 @@ class TSMMonitor {
}
else if ($type == "timetable") {
$sqlres = $this->adodb->fetchArrayDB($sql);
$outp = array();;
$outp = array();
foreach ($sqlres as $row) {
$rowarray2 = array();
while(list($keycell, $valcell) = each($row)) {
if ($keycell == "Start Time" || $keycell == "End Time") {
if ($keycell == "Start Time" || $keycell == "Actual Start" || $keycell == "End Time") {
$date = $row[$keycell];
$rowarray2[] = mktime(substr($date,11,2),substr($date,14,2),substr($date,17,2),substr($date,5,2),substr($date,8,2),substr($date,0,4));
} else {

109
index.php
View File

@ -76,27 +76,7 @@ include_once "includes/page_head.php";
-->
<br>
<div class="menuelinks">
<div class='sidebarinfo'>
<b>Stylesheet Switcher</b><br><br>
<?php
echo "<form action=".$_SERVER['PHP_SELF']."?q=".$tsmmonitor->GETVars['qq']."&m=".$tsmmonitor->GETVars['menu']."&s=".$tsmmonitor->GETVars['server']." method='post'>\n";
echo "<select name='css' size=1 onChange='submit();' class='button'>\n";
if ($handle = opendir('css')) {
while (false !== ($file = readdir($handle))) {
if ($file != '.' && $file != '..' && substr($file, 0, 6) == 'style_') {
$fileName = str_replace('.css', '', $file);
$fileName = str_replace('style_', '', $fileName);
echo '<option value="' . $file . '"';
if ($_SESSION['stylesheet'] == $file){ echo "SELECTED"; }
echo '>' . $fileName . '</option>';
}
}
closedir($handle);
}
echo "</select>\n";
echo "</form>\n";
?>
</div>
<?php echo $tsmmonitor->getStylesheetSwitcher(); ?>
</div>
<img src="/images/trans.gif" alt="" width="150" height="1" border="0"><br>
</td>
@ -108,7 +88,7 @@ include_once "includes/page_head.php";
// main content, right of menu
if (isset($_SESSION["logindata"]["user"]) && isset($_SESSION["logindata"]["pass"]) && $tsmmonitor->GETVars['qq'] != "logout" && $_SESSION["logindata"]["loggedin"]){
if ($tsmmonitor->GETVars['qq'] != "" && $tsmmonitor->GETVars['qq'] != "overview"){
// show overview page
if ($tsmmonitor->GETVars['qq'] == "index") {
include_once "includes/overview.php" ;
@ -121,24 +101,6 @@ if (isset($_SESSION["logindata"]["user"]) && isset($_SESSION["logindata"]["pass"
} else if ( $tsmmonitor->GETVars['qq'] == "serverlist" ) {
echo $tsmmonitor->getServerlist();
// show graphical chart (timetable)
} else if ( strstr($tsmmonitor->GETVars['qq'], 'timetable')) {
if ($_POST["back"] != "") {
$_SESSION['timeshift'] += $_SESSION['selectedtimestep'];
}
if ($_POST["forward"] != "") {
$_SESSION['timeshift'] -= $_SESSION['selectedtimestep'];
}
if ($_SESSION['timeshift'] < 0) {
$_SESSION['timeshift'] = 0;
}
$tablearray = $tsmmonitor->execute('timetable');
$headerarray = $queryarray[$tsmmonitor->GETVars['qq']]["header"]["column"];
echo $tsmmonitor->generateTimetable($tablearray, $headerarray[0]);
// "vertical" table
} else if ( strstr($tsmmonitor->GETVars['qq'], 'vertical')) {
@ -157,7 +119,6 @@ if (isset($_SESSION["logindata"]["user"]) && isset($_SESSION["logindata"]["pass"
}
echo "<td><b>".$keycell."</b></td><td>".$valcell."</td></tr>";
}
//}
}
echo "</table>";
@ -165,36 +126,52 @@ if (isset($_SESSION["logindata"]["user"]) && isset($_SESSION["logindata"]["pass"
// show normal table layout
} else {
if ($_SESSION["tabletype"]!="" && $_SESSION["tabletype"] == "timetable") {
$whereclause = array();
//if (!$_POST["Clear"] == "Clear") {
$whereclause["field"] = $_POST["wcfield"];
$whereclause["val"] = $_POST["wcval"];
$whereclause["op"] = $_POST["wcop"];
//}
if ($whereclause["field"]!="" && $whereclause["val"]!="") {
if ($_POST["Clear"] == "Clear") {
$_SESSION["search"][$tsmmonitor->GETVars['qq']] = "";
} else {
if (!isset($_SESSION["search"])){
$temp = array();
$temp[$tsmmonitor->GETVars['qq']] = $whereclause;
$_SESSION["search"] = $temp;
if ($_POST["back"] != "") {
$_SESSION['timeshift'] += $_SESSION['selectedtimestep'];
}
if ($_POST["forward"] != "") {
$_SESSION['timeshift'] -= $_SESSION['selectedtimestep'];
}
if ($_SESSION['timeshift'] < 0) {
$_SESSION['timeshift'] = 0;
}
$tablearray = $tsmmonitor->execute('timetable');
$headerarray = $queryarray[$tsmmonitor->GETVars['qq']]["header"]["column"];
echo $tsmmonitor->generateTimetable($tablearray, $headerarray[0]);
} else {
$whereclause = array();
$whereclause["field"] = $_POST["wcfield"];
$whereclause["val"] = $_POST["wcval"];
$whereclause["op"] = $_POST["wcop"];
//}
if ($whereclause["field"]!="" && $whereclause["val"]!="") {
if ($_POST["Clear"] == "Clear") {
$_SESSION["search"][$tsmmonitor->GETVars['qq']] = "";
} else {
$_SESSION["search"][$tsmmonitor->GETVars['qq']] = $whereclause;
if (!isset($_SESSION["search"])){
$temp = array();
$temp[$tsmmonitor->GETVars['qq']] = $whereclause;
$_SESSION["search"] = $temp;
} else {
$_SESSION["search"][$tsmmonitor->GETVars['qq']] = $whereclause;
}
}
}
echo "<table class='zebra'>";
echo $tsmmonitor->getTableheader();
echo $tsmmonitor->execute('table');
$nav = $tsmmonitor->showPageNavigation("40");
if ($nav!="") {
echo "<tr><td colspan='999' align='center' class='footer'><a class='navhead'>".$nav."</a></td></tr>";
}
echo "</table>";
}
echo "<table class='zebra'>";
//echo get_tableheader($queryarray[$tsmmonitor->GETVars['qq']]["header"]["column"]);
echo $tsmmonitor->getTableheader();
echo $tsmmonitor->execute('table');
$nav = $tsmmonitor->showPageNavigation("40");
if ($nav!="") {
echo "<tr><td colspan='999' align='center' class='footer'><a class='navhead'>".$nav."</a></td></tr>";
}
echo "</table>";
}
}

View File

@ -32,33 +32,8 @@
* @package tsmmonitor
*/
// ** Default database settings ** //
/**
$db_type = 'mysql';
$db_name = 'tsmmonitor';
$db_user = 'tsmmonitor';
$db_password = 'tsmmonitor';
$db_host = 'localhost';
$db_port = '3306';
$db_charset = 'utf8';
$db_collate = '';
*/
// ** Include user configureable definitions ** //
//include(dirname(__FILE__) . "/../includes/config.php");
// ** Global configuration array ** //
//$config = array();
// ** Display ALL PHP errors ** //
//error_reporting(E_ALL);
// ** Include generic code and external libraries ** //
//include ("../extlib/adodb5/adodb.inc.php");
//include_once("../includes/adodb.php");
include_once("../includes/global.php");
// ** Connect to the database ** //
//$adodb = new ADOdb($db_host, $db_port, $db_user, $db_password, $db_name, $db_type, '' ,FALSE);
$tmonpolld = new PollD($adodb);
$tmonpolld->poll();