Commit fe226d0d authored by haemmer's avatar haemmer
Browse files

IdPs from other federations are now sorted alphabetically

parent a91dc421
...@@ -221,14 +221,16 @@ var wayf_show_categories = true; ...@@ -221,14 +221,16 @@ var wayf_show_categories = true;
// Whether to load Identity Providers from the Discovery Feed provided by // Whether to load Identity Providers from the Discovery Feed provided by
// the Service Provider. This feature might have to be activated on the SP. // the Service Provider. The discovery feed feature might have to be activated
// The loaded Identity Providers are added to the wayf_additional_idps. // on the SP first.
// The loaded Identity Providers are added to the wayf_additional_idps and the
// whole array will be sorted alphabetically
// [Optional, commented out by default] // [Optional, commented out by default]
// wayf_use_disco_feed = true; // var wayf_use_disco_feed = true;
// URL where to load the Discovery Feed from in case wayf_use_disco_feed is true // URL where to load the Discovery Feed from in case wayf_use_disco_feed is true
// [Optional, commented out by default] // [Optional, commented out by default]
// wayf_discofeed_url = "/Shibboleth.sso/DiscoFeed"; // var wayf_discofeed_url = "/Shibboleth.sso/DiscoFeed";
//////////////////// ADDITIONAL CSS CUSTOMIZATIONS //////////////////// //////////////////// ADDITIONAL CSS CUSTOMIZATIONS ////////////////////
......
...@@ -565,6 +565,21 @@ function loadDiscoFeedIdPs(){ ...@@ -565,6 +565,21 @@ function loadDiscoFeedIdPs(){
} }
} }
// Sorts Discofeed
function sortEntities(a, b){
var nameA = a.name.toLowerCase();
var nameB = b.name.toLowerCase();
if (nameA < nameB){
return -1;
}
if (nameA > nameB){
return 1;
}
return 0;
}
// Returns true if user is logged in // Returns true if user is logged in
function isUserLoggedIn(){ function isUserLoggedIn(){
...@@ -1098,7 +1113,7 @@ SCRIPT; ...@@ -1098,7 +1113,7 @@ SCRIPT;
echo <<<SCRIPT echo <<<SCRIPT
// Load additional IdPs from DiscoFeed if feature is enabled // Load additional IdPs from DiscoFeed if feature is enabled
if (wayf_use_disco_feed){ if (wayf_use_disco_feed){
loadDiscoFeedIdPs(); loadDiscoFeedIdPs();
} }
if (wayf_additional_idps.length > 0){ if (wayf_additional_idps.length > 0){
...@@ -1107,7 +1122,10 @@ SCRIPT; ...@@ -1107,7 +1122,10 @@ SCRIPT;
writeHTML('<optgroup label="{$otherFederationString}">'); writeHTML('<optgroup label="{$otherFederationString}">');
} }
// Show additional IdPs in the order they are defined // Sort Array
wayf_additional_idps.sort(sortEntities)
// Show additional IdPs
for ( var i=0; i < wayf_additional_idps.length ; i++){ for ( var i=0; i < wayf_additional_idps.length ; i++){
if (wayf_additional_idps[i]){ if (wayf_additional_idps[i]){
// Last used IdP is known because of local _saml_idp cookie // Last used IdP is known because of local _saml_idp cookie
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment