Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

MDL-10168 improvements to display of results from environment checks

  • Loading branch information...
commit 9d8453becd4b5c7b5adc7e80a0754e5523fea30f 1 parent 52f79e8
jamiesensei authored
View
11 .project
@@ -0,0 +1,11 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>moodle-MOODLE_16_STABLE</name>
+ <comment></comment>
+ <projects>
+ </projects>
+ <buildSpec>
+ </buildSpec>
+ <natures>
+ </natures>
+</projectDescription>
View
8 lang/en_utf8/admin.php
@@ -1,4 +1,4 @@
-<?PHP // $Id$
+<?PHP // $Id$
// admin.php - created with Moodle 1.6 development (2005053000)
@@ -50,7 +50,7 @@
$string['configerrorlevel'] = 'Choose the amount of PHP warnings that you want to be displayed. Normal is usually the best choice.';
$string['configextendedusernamechars'] = 'Enable this setting to allow students to use any characters in their usernames (note this does not affect their actual names). The default is \"false\" which restricts usernames to be alphanumeric characters only';
$string['configfilterall'] = 'Filter all strings, including headings, titles, navigation bar and so on. This is mostly useful when using the multilang filter, otherwise it will just create extra load on your site for little gain.';
-$string['configfiltermatchoneperpage'] = 'Automatic linking filters will only generate a single link for the first matching text instance found on the complete page. All others are ignored.';
+$string['configfiltermatchoneperpage'] = 'Automatic linking filters will only generate a single link for the first matching text instance found on the complete page. All others are ignored.';
$string['configfiltermatchonepertext'] = 'Automatic linking filters will only generate a single link for the first matching text instance found in each item of text (e.g., resource, block) on the page. All others are ignored. This setting is ignored if the one per page setting is <i>yes</i>.';
$string['configfilteruploadedfiles'] = 'Process all uploaded HTML and text files with the filters before displaying them, only uploaded HTML files or none at all.';
$string['configforcelogin'] = 'Normally, the front page of the site and the course listings (but not courses) can be read by people without logging in to the site. If you want to force people to log in before they do ANYTHING on the site, then you should enable this setting.';
@@ -121,7 +121,7 @@
$string['configstatsruntimestart'] = 'What time should the cronjob that does the stats processing <b>start</b>?';
$string['configstatsuserthreshold'] = 'If you enter a non-zero, non numeric value here, for ranking courses, courses with less than this number of enrolled users (students + teachers) will be ignored';
$string['configteacherassignteachers'] = 'Should ordinary teachers be allowed to assign other teachers within courses they teach? If \'No\', then only course creators and admins can assign teachers.';
-$string['configthemelist'] = 'Leave this blank to allow any valid theme to be used. If you want to shorten the theme menu, you can specify a comma-separated list of names here (Don\'t use spaces!).
+$string['configthemelist'] = 'Leave this blank to allow any valid theme to be used. If you want to shorten the theme menu, you can specify a comma-separated list of names here (Don\'t use spaces!).
For example: standard,orangewhite.';
$string['configtimezone'] = 'You can set the default timezone here. This is the only the DEFAULT timezone for displaying dates - each user can override this by setting their own in their profile. \"Server time\" here will make Moodle default to the server\'s operating system setting, but \"Server time\" in the user profile will make the user default to this timezone setting. Cronjobs that depend on a time of day to run will use this timezone.';
$string['configunzip'] = 'Indicate the location of your unzip program (Unix only, optional). If specified, this will be used to unpack zip archives on the server. If you leave this blank, then Moodle will use internal routines.';
@@ -131,6 +131,7 @@
$string['confirmation'] = 'Confirmation';
$string['confirminstall'] = 'You are about to install language pack ($a), are you sure?';
$string['cronwarning'] = 'The <a href=\"cron.php\">cron.php maintenance script</a> has not been run for at least 24 hours.';
+$string['customcheck'] = 'Other Checks';
$string['datarootsecuritywarning'] = 'Your site configuration might not be secure. Please make sure that your dataroot directory ($a) is not directly accessible via web.';
$string['dbmigrate'] = 'Moodle Database Migration';
$string['dbmigrationdeprecateddb'] = '<font color=\"#ff0000\">This database is migrated to a new UTF8 database and deprecated. Please edit your config.php and use the new database for this moodle.</font>';
@@ -220,6 +221,7 @@
$string['pgclusterdescription'] = 'PostgreSQL version/cluster parameter for command line operations. If you only have one postgresql on your system or you are not sure what this is, leave this blank.';
$string['php50restricted'] = 'PHP 5.0.x has a number of known problems, please upgrade to 5.1.x or downgrade to 4.3.x or 4.4.x';
$string['remotelangnotavailable'] = 'Because Moodle can not connect to download.moodle.org, we are unable to do language pack installation automatically. Please download the appropriate zip file(s) from the list below, copy them to your $a directory and unzip them manually.';
+$string['serverchecks'] = 'Server Checks';
$string['sitelangchanged'] = 'Site language setting changed successfully';
$string['sitemaintenance'] = 'The site is undergoing maintenance and is currently not available';
$string['sitemaintenancemode'] = 'Maintenance mode';
View
117 lib/environmentlib.php
@@ -54,8 +54,9 @@
* The function looks for the best version to compare and
* everything. This is the only function that should be called
* ever from the rest of Moodle.
- * @param string version version to check.
+ * @param string version version to check.
* @param array results array of results checked.
+ * @param boolean true/false, whether to print the table or just return results array
* @return boolean true/false, depending of results
*/
function check_moodle_environment($version, &$environment_results, $print_table=true) {
@@ -110,7 +111,7 @@ function check_moodle_environment($version, &$environment_results, $print_table=
return ($result && $status);
}
-/**
+/**
* This function will print one beautiful table with all the environmental
* configuration and how it suits Moodle needs.
* @param boolean final result of the check (true/false)
@@ -130,16 +131,28 @@ function print_moodle_environment($result, $environment_results) {
$strrestricted = get_string('restricted');
$strenvironmenterrortodo = get_string('environmenterrortodo', 'admin');
-/// Here we'll store all the feedback found
- $feedbacktext = '';
-/// Table header
- $table->head = array ($strname, $strinfo, $strreport, $strstatus);
- $table->align = array ('center', 'center', 'left', 'center');
- $table->wrap = array ('nowrap', '', '', 'nowrap');
- $table->size = array ('10', 10, '100%', '10');
- $table->width = '90%';
- $table->class = 'environmenttable generaltable';
+/// Table headers
+ $servertable = new stdClass;//table for server checks
+ $servertable->head = array ($strname, $strinfo, $strreport, $strstatus);
+ $servertable->align = array ('center', 'center', 'left', 'center');
+ $servertable->wrap = array ('nowrap', '', '', 'nowrap');
+ $servertable->size = array ('10', 10, '100%', '10');
+ $servertable->width = '90%';
+ $servertable->class = 'environmenttable generaltable';
+
+ $serverdata = array('ok'=>array(), 'warn'=>array(), 'error'=>array());
+
+ $othertable = new stdClass;//table for custom checks
+ $othertable->head = array ($strinfo, $strreport, $strstatus);
+ $othertable->align = array ('center', 'left', 'center');
+ $othertable->wrap = array ('', '', 'nowrap');
+ $othertable->size = array (10, '100%', '10');
+ $othertable->width = '90%';
+ $othertable->class = 'environmenttable generaltable';
+
+ $otherdata = array('ok'=>array(), 'warn'=>array(), 'error'=>array());
+
/// Iterate over each environment_result
$continue = true;
@@ -194,46 +207,66 @@ function print_moodle_environment($result, $environment_results) {
$status = $strcheck;
$warningline = true;
} else { //Handle error result (error)
- $status = $strcheck;
+ $status = $strcheck;
$errorline = true;
}
}
}
}
-
+
/// Build the text
- $report = get_string($stringtouse, 'admin', $rec);
+ $linkparts = array();
+ $linkparts[] = 'admin/environment';
+ $linkparts[] = $type;
+ if (!empty($info)){
+ $linkparts[] = $info;
+ }
+ $report = doc_link(join($linkparts, '/'), get_string($stringtouse, 'admin', $rec));
+
/// Format error or warning line
if ($errorline || $warningline) {
- $styletoapply = $errorline? 'error':'warn';
- $type = '<span class="'.$styletoapply.'">'.$type.'</span>';
- $info = '<span class="'.$styletoapply.'">'.$info.'</span>';
- $report = '<span class="'.$styletoapply.'">'.$report.'</span>';
- $status = '<span class="'.$styletoapply.'">'.$status.'</span>';
+ $messagetype = $errorline? 'error':'warn';
+ } else {
+ $messagetype = 'ok';
}
- /// Add the row to the table
- $table->data[] = array ($type, $info, $report, $status);
- ///Process the feedback if necessary
+ $status = '<span class="'.$messagetype.'">'.$status.'</span>';
+ /// Here we'll store all the feedback found
+ $feedbacktext = '';
+ ///Process the feedback if necessary
if ($feedbackstr = $environment_result->getFeedbackStr()) {
- $feedbacktext .= '<li class="environmenttable">'.get_string($feedbackstr, 'admin').'</li>';
+ $feedbacktext .= '<p class="'.$messagetype.'">'.get_string($feedbackstr, 'admin').'</p>';
}
///Process the bypass if necessary
if ($bypassstr = $environment_result->getBypassStr()) {
- $feedbacktext .= '<li class="environmenttable">'.get_string($bypassstr, 'admin').'</li>';
+ $feedbacktext .= '<p class="warn">'.get_string($bypassstr, 'admin').'</p>';
}
///Process the restrict if necessary
if ($restrictstr = $environment_result->getRestrictStr()) {
- $feedbacktext .= '<li class="environmenttable">'.get_string($restrictstr, 'admin').'</li>';
+ $feedbacktext .= '<p class="error">'.get_string($restrictstr, 'admin').'</p>';
+ }
+ if ($feedbacktext) {
+ $report = $report .$feedbacktext;
+ }
+ /// Add the row to the table
+
+ if ($environment_result->getPart() == 'custom_check'){
+ $otherdata[$messagetype][] = array ($info, $report, $status);
+
+ } else {
+ $serverdata[$messagetype][] = array ($type, $info, $report, $status);
}
}
}
-
-/// Print table
- print_table($table);
+ //put errors first in
+ $servertable->data = array_merge($serverdata['error'], $serverdata['warn'], $serverdata['ok']);
+ $othertable->data = array_merge($otherdata['error'], $otherdata['warn'], $otherdata['ok']);
-/// And feedback accumulated text
- if ($feedbacktext) {
- print_simple_box('<ul>'.$feedbacktext.'</ul>', 'center', '90%');
+/// Print table
+ print_heading(get_string('serverchecks', 'admin'));
+ print_table($servertable);
+ if (count($othertable->data)){
+ print_heading(get_string('customcheck', 'admin'));
+ print_table($othertable);
}
/// Finally, if any error has happened, print the summary box
@@ -266,7 +299,7 @@ function normalize_version($version) {
* @return mixed the xmlized structure or false on error
*/
function load_environment_xml() {
-
+
global $CFG;
static $data; //Only load and xmlize once by request
@@ -351,12 +384,12 @@ function get_latest_version_available ($version) {
}
-/**
+/**
* This function will return the xmlized data belonging to one Moodle version
* @return mixed the xmlized structure or false on error
*/
function get_environment_for_version($version) {
-
+
/// Normalize the version requested
$version = normalize_version($version);
@@ -377,12 +410,12 @@ function get_environment_for_version($version) {
/// We now we have it. Extract from full contents.
$fl_arr = array_flip($versions);
-
+
return $contents['COMPATIBILITY_MATRIX']['#']['MOODLE'][$fl_arr[$version]];
}
-/**
+/**
* This function will check for everything (DB, PHP and PHP extensions for now)
* returning an array of environment_result objects.
* @param string $version xml version we are going to use to test this server
@@ -522,7 +555,7 @@ function environment_check_php($version) {
} else {
$result->setStatus(false);
}
- $result->setLevel($level);
+ $result->setLevel($level);
$result->setCurrentVersion($current_version);
$result->setNeededVersion($needed_version);
/// Process messages, modifying the $result if needed.
@@ -626,7 +659,7 @@ function environment_check_database($version) {
} else {
$result->setStatus(false);
}
- $result->setLevel($level);
+ $result->setLevel($level);
$result->setCurrentVersion($current_version);
$result->setNeededVersion($needed_version);
$result->setInfo($current_vendor);
@@ -745,7 +778,7 @@ function process_environment_messages($xml, &$result) {
//--- Helper Class to return results to caller ---//
-/**
+/**
* This class is used to return the results of the environment
* main functions (environment_check_xxxx)
*/
@@ -828,7 +861,7 @@ function setNeededVersion($needed_version) {
function setInfo($info) {
$this->info=$info;
}
-
+
/**
* Set the feedback string
* @param string the feedback string
@@ -878,7 +911,7 @@ function getLevel() {
}
/**
- * Get the current version
+ * Get the current version
* @return string current version
*/
function getCurrentVersion() {
@@ -958,7 +991,7 @@ function bypass_mysql416_reqs ($result) {
/// checker. All those functions will receive the result object and will
/// return it modified as needed (status and bypass string)
-/**
+/**
* This function will restrict PHP reqs if:
* - We are using PHP 5.0.x, informing about the buggy version
*
View
64 theme/standard/styles_color.css
@@ -1,7 +1,7 @@
/*******************************************************************
styles_color.css
-
- This CSS file contains all color definitions like
+
+ This CSS file contains all color definitions like
background-color, font-color, border-color etc.
Styles are organised into the following sections:
@@ -89,11 +89,11 @@ table.formtable tbody th {
}
/* Alternate rows even */
-.r0 {
+.r0 {
}
/* Alternate rows odd */
-.r1 {
+.r1 {
}
/* notification messages (can be good or bad) */
@@ -109,20 +109,20 @@ table.formtable tbody th {
}
.generalbox {
- border-color:#DDDDDD;
+ border-color:#DDDDDD;
}
.informationbox {
- border-color:#DDDDDD;
+ border-color:#DDDDDD;
}
.feedbackbox {
- border-color: #888888;
+ border-color: #888888;
}
.feedbackby {
background-color:#BBBBBB;
}
.noticebox {
- border-color:#DDDDDD;
+ border-color:#DDDDDD;
}
.errorbox {
@@ -157,7 +157,7 @@ table.formtable tbody th {
.unread {
background: #FFD991;
-}
+}
.censoredtext {
color:#000000;
@@ -180,11 +180,11 @@ table.formtable tbody th {
.generaltable .cell {
background-color:#FFFFFF;
- border-color:#EEEEEE;
+ border-color:#EEEEEE;
}
.generaltable {
- border-color:#EEEEEE;
+ border-color:#EEEEEE;
}
@@ -235,16 +235,16 @@ table.formtable tbody th {
***/
.admin .generalboxcontent {
- background-color:#EEEEEE;
+ background-color:#EEEEEE;
}
.admin .generalbox {
- border-color:#BBBBBB;
+ border-color:#BBBBBB;
}
.admin .informationbox {
- border-color:#BBBBBB;
- background-color:#FFFFFF;
+ border-color:#BBBBBB;
+ background-color:#FFFFFF;
}
body#admin-index .c0 {
@@ -265,6 +265,18 @@ body#admin-blocks table#incompatible td.c0 {
color: #ff0000;
}
+body#admin-environment .error {
+ background-color : red;
+ color : inherit;
+}
+
+body#admin-environment .warn {
+ background-color : yellow;
+}
+
+body#admin-environment .ok {
+ background-color : lightgreen;
+}
table.flexible .r0 {
background-color: #f0f0f0;
}
@@ -598,26 +610,26 @@ table.message_search_results td {
***/
.que {
- border-color: #DDD;
+ border-color: #DDD;
}
.que .r0 {
- background-color: #F5F5F5;
+ background-color: #F5F5F5;
}
.que .r1 {
- background-color: #EEE;
+ background-color: #EEE;
}
.calculated .answer,
.numerical .answer,
.shortanswer .answer,
.truefalse .answer {
- background-color: #EEE;
+ background-color: #EEE;
}
.calculated .feedback,
.numerical .feedback,
.shortanswer .feedback,
.truefalse .feedback {
border-color: #DDD;
-}
+}
.que.multianswer .incorrect {
background-color: #faa;
}
@@ -731,7 +743,7 @@ table.message_search_results td {
}
.forumpost .left {
- background:#EEEEEE;
+ background:#EEEEEE;
}
.forumpost .topic {
@@ -739,11 +751,11 @@ table.message_search_results td {
}
.forumpost .starter {
- background:#DDDDDD;
+ background:#DDDDDD;
}
.forumheaderlist .discussion .starter {
- background:#DDDDDD;
+ background:#DDDDDD;
}
.forumheaderlist td {
@@ -762,11 +774,11 @@ table.message_search_results td {
}
#mod-forum-discuss .forumpost.unread .content {
- border-color: #FFD991;
-}
+ border-color: #FFD991;
+}
#mod-forum-discuss .forumthread .unread {
-}
+}
#mod-forum-index .unread {
}
Please sign in to comment.
Something went wrong with that request. Please try again.