diff --git a/application.css b/application.css index 15b99dc..0746379 100644 --- a/application.css +++ b/application.css @@ -63,6 +63,12 @@ div.info_contents { padding:10px; background-color: #eee; } div.title_class { font-weight: bold; border-bottom: 1px solid; padding: 4px; font-size: 140%; background-color: #ddd; } +/* Classes for a note box */ +div.note_container { margin:6px; border: 1px solid; } +div.note_body { padding: 10px; background-color: #ffe732; } +div.note_title { font-weight: bold; border-bottom: 1px solid; padding: 4px; + font-size: 140%; background-color: #ffc004; } + /* classes for the main page */ div.rating_header { padding: 8px; } div.rating_title { padding-bottom: 4px; font-weight: bold; font-size: 160%; } diff --git a/include/html.php b/include/html.php index e8cdfdb..b0aa6c8 100644 --- a/include/html.php +++ b/include/html.php @@ -286,4 +286,18 @@ function make_inx_option_list($varname, $inx = null) } +/* Displays a note box */ +function html_note($shTitle, $shBody) +{ + $shRet = '
'; + $shRet .= '
'; + $shRet .= $shTitle; + $shRet .= '
'; + $shRet .= '
'; + $shRet .= $shBody; + $shRet .= '
'; + + return $shRet; +} + ?> diff --git a/include/version.php b/include/version.php index 3b9bd2f..ea8c121 100644 --- a/include/version.php +++ b/include/version.php @@ -987,11 +987,7 @@ class version { ////////////////////// // Show test data - echo "
\n"; - echo "\t
\n"; - echo "\t\tSelected test results (selected in 'Test Results' table below)\n"; - echo "\t
\n"; /* Set if the use chose to display a particular test report */ if($iTestingId) @@ -999,18 +995,45 @@ class version { else if($this->iVersionId) /* Let's query for the latest rest report */ { $iTestingId = testData::getNewestTestIdFromVersionId($this->iVersionId); - $oTest = new testData($iTestingId); + + if($iTestingId) /* We want all entries to have test data, but old versions might lack + it, or data may have been deleted */ + $oTest = new testData($iTestingId); } else /* Perhaps we have a cached entry? There should be */ { $aTests = $this->getTestResults(); - $oTest = $aTests[0]; + + if(sizeof($aTests)) /* ... but we cannot be certain */ + $oTest = $aTests[0]; } - echo "
\n"; - $oTest->ShowTestResult(); - echo "
\n"; + if($oTest) + { + echo "
\n"; - echo "
\n"; // end the 'info_container' div + echo "\t
\n"; + echo "\t\tSelected test results (selected in 'Test Results' table below)\n"; + echo "\t
\n"; + + echo "
\n"; + + $oTest->ShowTestResult(); + + echo "
\n"; + + echo "
\n"; + } else /* Show a note saying that no test results are present, + and encourage the user to take action */ + { + echo html_note('No Test Results', + 'This version has no test results, please consider submitting some.
'. + 'They may be part of the '. + 'version or application description. If they are, please '. + 'consider becoming a maintainer and remove them, submitting '. + 'a proper test report instead.'); + } + + // end the 'info_container' div // end show test data ///////////////////// @@ -1020,7 +1043,7 @@ class version { if($oTest->iTestingId) { $oTest->ShowVersionsTestingTable($this->objectMakeUrl()."&iTestingId=", 5); - } else /* We are previewing the version */ + } else if($oTest) /* We are previewing the version */ { $oTable = $oTest->CreateTestTable(); $oTable->AddRow($oTest->CreateTestTableRow(0, ""));