Commit 964ddb23 authored by Geoffroy ARNOUD's avatar Geoffroy ARNOUD

Correction bug quand la chaine cherchée n'existe pas et nettoyage

parent 42d2e75b
......@@ -301,4 +301,4 @@
//**************************
// If the development mode is activated, PHP errors and warnings will be displayed
// on pages the SWITCHwayf generates
$developmentMode = true;
//$developmentMode = true;
......@@ -58,7 +58,6 @@
// Perform input validation on WAYF form
function checkForm(){
//console.log("checkForm ", document.IdPList.user_idp, "/", document.IdPList.user_idp.selectedIndex);
if(
document.IdPList.user_idp &&
document.IdPList.user_idp.selectedIndex == 0
......@@ -70,8 +69,6 @@
}
}
// Init WAYF
function init(){
preventIframeEmbedding();
......@@ -81,47 +78,47 @@
<?php if (isUseSelect2()) {
if ($bodyType == "settings" || $bodyType == "WAYF") {
?>
$('.userIdPSelection').select2({
ajax: {
url: <?php echo "'".$apiURL."/idps'" ?>,
delay: 250,
dataType: 'json',
data: function (params) {
var query = {
search: params.term,
page: params.page || 1
}
// Query parameters will be ?search=[term]&page=[page]
return query;
},
error: function(jqxhr, status, exception) {
console.error('Exception:', exception);
<?php
if ($developmentMode) {
echo("alert('Exception:', exception);");
} ?>
}
},
placeholder: "<?php echo getLocalString('select_idp') ?>",
allowClear: true,
language: "<?php echo $language ?>",
templateResult: formatIdp,
templateSelection: formatIdp,
escapeMarkup: function (text) { return text; }
});
// Auto-submit when an idp is selected
$('.userIdPSelection').on('select2:select', function (e) {
document.getElementById("IdPList").submit();
});
$('.userIdPSelection').select2({
ajax: {
url: <?php echo "'".$apiURL."/idps'" ?>,
delay: 250,
dataType: 'json',
data: function (params) {
var query = {
search: params.term,
page: params.page || 1
}
// Query parameters will be ?search=[term]&page=[page]
return query;
},
error: function(jqxhr, status, exception) {
console.error('Exception:', exception);
<?php
if ($developmentMode) {
echo("alert('Exception:', exception);");
} ?>
}
},
placeholder: "<?php echo getLocalString('select_idp') ?>",
allowClear: true,
language: "<?php echo $language ?>",
templateResult: formatIdp,
templateSelection: formatIdp,
escapeMarkup: function (text) { return text; }
});
// Auto-submit when an idp is selected
$('.userIdPSelection').on('select2:select', function (e) {
document.getElementById("IdPList").submit();
});
<?php
} elseif ($bodyType == "notice" && $permanentUserIdP != '') {
?>
$('.userIdPSelectionNotice').select2({
allowClear: false,
templateSelection: formatIdpNotice,
disabled: true,
escapeMarkup: function (text) { return text; }
});
$('.userIdPSelectionNotice').select2({
allowClear: false,
templateSelection: formatIdpNotice,
disabled: true,
escapeMarkup: function (text) { return text; }
});
<?php
}
} elseif ($useImprovedDropDownList) {
......
......@@ -152,7 +152,10 @@ final class IdpRepository
$tmp = array();
$firstGroup = true;
$firstGroupName = $array[0]->type;
$firstGroupName = '';
if (!empty($array)) {
$array[0]->type;
}
foreach ($array as $key => $idpObject) {
$type = $idpObject->type;
......
......@@ -68,29 +68,4 @@ final class IdpApiTest extends TestCase
getImage($imageString)
);
}
// public function testIdpObject()
// {
// require("test.idps.php");
// foreach ($metadataIDProviders as $key => $value) {
// if ($key == "http://idp-condorcet.dev.entrouvert.org/idp/saml2/metadata") {
// // printf("\nkey = %s\n", $key);
// $idp = new IdpObject($key, $value);
// // printf("\nidp = %s\n", json_encode($idp));
// $this->assertEquals(
// "http://idp-condorcet.dev.entrouvert.org/idp/saml2/metadata",
// $idp->entityId
// );
// }
// }
// }
// public function testToJsonByQuery()
// {
// require("test.IDProvider.metadata.php");
//
// $repo = new IdpRepository($metadataIDProviders);
//
// printf("\n%s\n", $repo->toJsonByQuery("arnoud", 1));
// }
}
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