Commit fefe03ef authored by Lukas Haemmerle's avatar Lukas Haemmerle

Added code for #3883

parent 56381640
...@@ -157,6 +157,13 @@ var wayf_return_url = "https://my-app.switch.ch/aai/index.php?page=show_welcome" ...@@ -157,6 +157,13 @@ var wayf_return_url = "https://my-app.switch.ch/aai/index.php?page=show_welcome"
// [Optional, default: false] // [Optional, default: false]
// wayf_disable_remote_idp_logos = false; // wayf_disable_remote_idp_logos = false;
// If true the improved drop-down-list automatic filtering
// of entries while typing content in the search box will
// allow matching IdPs either by their name or entityID,
// whereas otherwise only the name is considered
// [Optional, default: true]
// wayf_enable_entityid_matching = true;
// Force the user's Home Organisation selection to be remembered for the // Force the user's Home Organisation selection to be remembered for the
// current browser session. If wayf_show_remember_checkbox is true // current browser session. If wayf_show_remember_checkbox is true
// the checkbox will be shown but will be read only. // the checkbox will be shown but will be read only.
......
...@@ -31,6 +31,7 @@ var wayf_sp_handlerURL = global.wayf_sp_handlerURL; ...@@ -31,6 +31,7 @@ var wayf_sp_handlerURL = global.wayf_sp_handlerURL;
var wayf_use_discovery_service = global.wayf_use_discovery_service; var wayf_use_discovery_service = global.wayf_use_discovery_service;
var wayf_use_improved_drop_down_list = global.wayf_use_improved_drop_down_list; var wayf_use_improved_drop_down_list = global.wayf_use_improved_drop_down_list;
var wayf_disable_remote_idp_logos = global.wayf_disable_remote_idp_logos; var wayf_disable_remote_idp_logos = global.wayf_disable_remote_idp_logos;
var wayf_enable_entity_matching = global.wayf_enable_entityid_matching;
var wayf_use_small_logo = global.wayf_use_small_logo; var wayf_use_small_logo = global.wayf_use_small_logo;
var wayf_width = global.wayf_width; var wayf_width = global.wayf_width;
var wayf_height = global.wayf_height; var wayf_height = global.wayf_height;
...@@ -629,7 +630,8 @@ function runImproveDropDown() { ...@@ -629,7 +630,8 @@ function runImproveDropDown() {
iconPath:'<?php echo $imageURL ?>/drop_icon.png', iconPath:'<?php echo $imageURL ?>/drop_icon.png',
noMatchesText: '<?php echo $noIdPFoundText ?>', noMatchesText: '<?php echo $noIdPFoundText ?>',
noItemsText: '<?php echo $noIdPAvailableText ?>', noItemsText: '<?php echo $noIdPAvailableText ?>',
disableRemoteLogos: wayf_disable_remote_idp_logos disableRemoteLogos: wayf_disable_remote_idp_logos,
enableValueMatching: wayf_enable_entityid_matching
}); });
} }
...@@ -663,6 +665,13 @@ function runImproveDropDown() { ...@@ -663,6 +665,13 @@ function runImproveDropDown() {
wayf_disable_remote_idp_logos = false; wayf_disable_remote_idp_logos = false;
} }
if(
typeof wayf_enable_entityid_matching === "undefined"
|| typeof wayf_enable_entityid_matching !== "boolean"
){
wayf_enable_entityid_matching = true;
}
// Overwrite entityID with GET argument if present // Overwrite entityID with GET argument if present
var entityIDGETParam = getGETArgument("entityID"); var entityIDGETParam = getGETArgument("entityID");
if (entityIDGETParam !== ""){ if (entityIDGETParam !== ""){
......
...@@ -51,6 +51,7 @@ var suspendTextBoxExitHandler = false; ...@@ -51,6 +51,7 @@ var suspendTextBoxExitHandler = false;
// Stores number of entries that matched for text // Stores number of entries that matched for text
var matchedEntries = 0; var matchedEntries = 0;
var displayLogos = false; var displayLogos = false;
var enableValueMatching = true;
(function ($) { (function ($) {
$.fn.improveDropDown = function (value) { $.fn.improveDropDown = function (value) {
...@@ -75,6 +76,7 @@ var suspendTextBoxExitHandler = false; ...@@ -75,6 +76,7 @@ var suspendTextBoxExitHandler = false;
if ('noMatchesText' in value) {noMatchesText = value.noMatchesText.toString();} if ('noMatchesText' in value) {noMatchesText = value.noMatchesText.toString();}
if ('noItemsText' in value) {noItemsText = value.noItemsText.toString();} if ('noItemsText' in value) {noItemsText = value.noItemsText.toString();}
if ('disableRemoteLogos' in value) {disableRemoteLogos = value.disableRemoteLogos;} if ('disableRemoteLogos' in value) {disableRemoteLogos = value.disableRemoteLogos;}
if ('enableValueMatching' in value) {enableValueMatching = value.enableValueMatching;}
} }
this.each(function () { this.each(function () {
...@@ -797,8 +799,22 @@ function doesListItemMach(listItem, compareText) { ...@@ -797,8 +799,22 @@ function doesListItemMach(listItem, compareText) {
return false; return false;
} }
// Compares a listItem (jQuery object representing item in dropdown list) to compareText // disabled item
return (!listItem.hasClass('idd_listItem_Disabled')) && (stringContainsCaseInsensitive(listItem.text(), compareText) || stringContainsCaseInsensitive(listItem.attr('data'), compareText)); if (listItem.hasClass('idd_listItem_Disabled')) {
return false;
}
// item with matching text
if (stringContainsCaseInsensitive(listItem.text(), compareText)) {
return true;
}
// item with with matching value
if (enableValueMatching && stringContainsCaseInsensitive(listItem.attr('data'), compareText)) {
return true;
}
return false;
} }
function getIsDirty(textControl) { function getIsDirty(textControl) {
......
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