Changing RosterDiag colors is actually really easy, you can also easily alter or add severity levels and rollup categories.
The only file that needs to be altered is rosterdiag.lib.php
Original Code:
- Code: Select all
// Set the severity information
$problemsev['description'] = 6;
$problemsev['revisiongreater'] = 6;
$problemsev['revisionsmaller'] = 6;
$problemsev['dateolder'] = 6;
$problemsev['dateyounger'] = 6;
$problemsev['author'] = 5;
$problemsev['MD5'] = 0;
$problemsev['MD5binary'] = 4;
$problemsev['nosvn'] = 1;
$problemsev['nolocal'] = 6;
$problemsev['unknown'] = 2;
$severity[0] = array('style' => 'sgreen', 'color' => '#12C312', 'weight' => 0, 'severityname' => 'No Issues');
$severity[1] = array('style' => 'sgray', 'color' => '#AFAFAF', 'weight' => 0, 'severityname' => 'Unknown');
$severity[2] = array('style' => 'sblue', 'color' => '#312CF8', 'weight' => 1, 'severityname' => 'Initial');
$severity[3] = array('style' => 'spurple', 'color' => '#E920CF', 'weight' => 1, 'severityname' => 'Strange');
$severity[4] = array('style' => 'syellow', 'color' => '#F1B10E', 'weight' => 3, 'severityname' => 'Minor');
$severity[5] = array('style' => 'sorange', 'color' => '#EE870D', 'weight' => 7, 'severityname' => 'Major');
$severity[6] = array('style' => 'sred', 'color' => '#FF0000', 'weight' => 15, 'severityname' => 'Critical');
$rollups[] = array('rollup' => 2, 'severity' => 4);
$rollups[] = array('rollup' => 5, 'severity' => 5);
$rollups[] = array('rollup' => 14, 'severity' => 6);
This is the code that defines the severity of issues detected and contains the arrays that define the colors and titles to be assigned for those severities. The $rollups define the break off points at which to change the color of a file name in the list.
The way is which the severity to use is determined is pretty simple too. When one of the issues defined in $problemsev is encountered it look up the weight of the severity as defined in $severity. The color and severity assigned to a file is then based off of a running total of the weights for each of the issues encountered for that file, and where that total lands in the $rollups array. The Directory color and severity is based similarly on the running total of of the weighted values of severity levels of all files in the directory.
If you feel that having a newer file is not a problem, but you would like to be notified which files are newer than the SVN you can make the following change:
- Code: Select all
// Set the severity information
$problemsev['description'] = 7;
$problemsev['revisiongreater'] = 1;
$problemsev['revisionsmaller'] = 7;
$problemsev['dateolder'] = 7;
$problemsev['dateyounger'] = 1;
$problemsev['author'] = 6;
$problemsev['MD5'] = 0;
$problemsev['MD5binary'] = 5;
$problemsev['nosvn'] = 2;
$problemsev['nolocal'] = 7;
$problemsev['unknown'] = 2;
$severity[0] = array('style' => 'sgreen', 'color' => '#12C312', 'weight' => 0, 'severityname' => 'No Issues');
$severity[1] = array('style' => 'sblue', 'color' => '#312CF8', 'weight' => 1, 'severityname' => 'Newer Files');
$severity[2] = array('style' => 'sgray', 'color' => '#AFAFAF', 'weight' => 0, 'severityname' => 'Unknown');
$severity[3] = array('style' => 'sblue', 'color' => '#312CF8', 'weight' => 6, 'severityname' => 'Initial');
$severity[4] = array('style' => 'spurple', 'color' => '#E920CF', 'weight' => 6, 'severityname' => 'Strange');
$severity[5] = array('style' => 'syellow', 'color' => '#F1B10E', 'weight' => 15, 'severityname' => 'Minor');
$severity[6] = array('style' => 'sorange', 'color' => '#EE870D', 'weight' => 30, 'severityname' => 'Major');
$severity[7] = array('style' => 'sred', 'color' => '#FF0000', 'weight' => 60, 'severityname' => 'Critical');
$rollups[] = array('rollup' => 1, 'severity' => 1);
$rollups[] = array('rollup' => 14, 'severity' => 5);
$rollups[] = array('rollup' => 29, 'severity' => 6);
$rollups[] = array('rollup' => 59, 'severity' => 7);
Granted, with how the rating system works if you have more than 14 newer files in the same directory it will get flagged as a minor issue.
You can also add valid.inc to:
- Code: Select all
// Files to ignore
$ignored_files = array('conf.php','.htaccess');
Doing so will keep its absence from flagging as a critical issue.