diff --git a/lib/API.php b/lib/API.php index 045d1775a5b334dda6081b3c6649136fd4e7ed1c..34b03ac72f31e37fb0711d8ea37b701c15fb90e4 100644 --- a/lib/API.php +++ b/lib/API.php @@ -134,15 +134,13 @@ class API { } break; case 'eccs_status': - switch ($optValue) { // these values can be only 0,1,2,3 + switch ($optValue) { // these values can be only 0,1,2,3,4 case 'NOTSET': $optValue = 0; - case 0; - case 1; - case 2; - case 3; - break; default: + if (isset(Constants::ECCS_Colours[$optValue])) { + break; + } $this->optionError($optName); break; } diff --git a/lib/Constants.php b/lib/Constants.php index 536c9ccf52f81489057412d36e1c7a21906e6eba..f831ee78102b2efd2557da12c0ef86b9c4fa3272 100644 --- a/lib/Constants.php +++ b/lib/Constants.php @@ -13,12 +13,12 @@ class Constants { const EC = 'http://macedir.org/entity-category'; // entity category support const ECs = 'http://macedir.org/entity-category-support'; -// ECSS_colours +// ECCS_colours const ECCS_Colours = [ - 1 => ['white', 'green'], - 2 => ['black', '#D3D3D3'], - 3 => ['white', 'red'], - 4 => ['black', '#FFDB58'], + 1 => ['white', 'green', 'OK'], + 2 => ['black', '#D3D3D3', 'Disabled'], + 3 => ['white', 'red', 'Error'], + 4 => ['black', '#FFDB58', 'Unknown'], ]; // Code of Conduct Support const COCO = 'http://www.geant.net/uri/dataprotection-code-of-conduct/v1'; diff --git a/lib/eduGAIN_entity.php b/lib/eduGAIN_entity.php index 0ae466db3a109380203a15ec7636511bb05b7acb..69ceee81e186d39ac2e32eb53b17fe0ea24de680 100644 --- a/lib/eduGAIN_entity.php +++ b/lib/eduGAIN_entity.php @@ -860,18 +860,8 @@ class eduGAIN_entity extends eduGAIN { $V = array_shift($TR); $row_class = 'CLASS_REPLACE'; if ($V['type'] == 'IdP' && $entity['eccs_status'] != 0) { - if ($entity['eccs_status'] == 1) { - $td_s = "background:green; text-align:center"; - $a_s = "color:white"; - } - if ($entity['eccs_status'] == 2) { - $td_s = "background:#D3D3D3; text-align:center"; - $a_s = "color:black"; - } - if ($entity['eccs_status'] == 3) { - $td_s = "background:red; text-align:center"; - $a_s = "color:white"; - } + $td_s = "background:".Constants::ECCS_Colours[$entity['eccs_status']][1]."; text-align:center"; + $a_s = "color:".Constants::ECCS_Colours[$entity['eccs_status']][0]; $eccs = "<div class='status_box' style='$td_s'><a style='$a_s' href='javascript:show_eccs(\"" . urlencode($entity['entityid']) . "\")'>ECCS</a></div>"; } else { $eccs = ''; @@ -1226,4 +1216,4 @@ class eduGAIN_entity extends eduGAIN { private $ec_filter; private $show_warnings; -} \ No newline at end of file +}