Skip to content
This repository was archived by the owner on Sep 19, 2022. It is now read-only.

Commit a264738

Browse files
author
Dominik František Bučík
authored
Merge branch 'master' into metadata_expiration
2 parents 0ac5a9f + 487511c commit a264738

File tree

8 files changed

+61
-26
lines changed

8 files changed

+61
-26
lines changed

CHANGELOG.md

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,10 @@
1+
## [6.0.7](https://github.com/CESNET/perun-simplesamlphp-module/compare/v6.0.6...v6.0.7) (2021-09-10)
2+
3+
4+
### Bug Fixes
5+
6+
* bugfixes in list of SPs ([1cd84a8](https://github.com/CESNET/perun-simplesamlphp-module/commit/1cd84a8bdbe879bdec568b1952b8756f29d99f94))
7+
18
## [6.0.6](https://github.com/CESNET/perun-simplesamlphp-module/compare/v6.0.5...v6.0.6) (2021-08-19)
29

310

@@ -41,11 +48,6 @@
4148

4249
* fix processing attr val of map type in LDAP ([d892ca9](https://github.com/CESNET/perun-simplesamlphp-module/commit/d892ca944d92b0de2e821d4a4421cce84bc5b514))
4350

44-
# Change Log
45-
All notable changes to this project will be documented in this file.
46-
47-
## [Unreleased]
48-
4951
## [v6.0.0]
5052
#### Changed
5153
- Improve WAYF searching by localized name and domain

composer.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,6 @@
2525
"require": {
2626
"simplesamlphp/simplesamlphp": "~1.17",
2727
"simplesamlphp/composer-module-installer": "~1.0",
28-
"cesnet/simplesamlphp-module-chartjs": "~2.8.0",
2928
"symfony/var-exporter": "^5.0",
3029
"phpseclib/phpseclib": "~3.0",
3130
"ext-curl": "*",

lib/ListOfSps.php

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,10 @@ class ListOfSps
88
{
99
public static function sortByName($a, $b)
1010
{
11-
return strcmp(strtolower($a['name']['value']), strtolower($b['name']['value']));
11+
return strnatcasecmp(
12+
transliterator_transliterate('Any-Latin; Latin-ASCII', $a['name']['value']),
13+
transliterator_transliterate('Any-Latin; Latin-ASCII', $b['name']['value'])
14+
);
1215
}
1316

1417
public static function getClass($type)

lib/NagiosStatusConnector.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ public function getStatus()
6464
$result = [];
6565

6666
$key = file_get_contents($this->keyPath);
67-
if ($key === false) {
67+
if (! $key) {
6868
throw new Exception('Cannot load ket from path: \'' . $this->keyPath . '\' !');
6969
}
7070

templates/listOfSps-tpl.php

Lines changed: 20 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,25 @@
2424
$samlServices = $this->data['samlServices'];
2525
$oidcServices = $this->data['oidcServices'];
2626
$allServices = $this->data['allServices'];
27-
27+
if ($this->data['isNameMultilingual']) {
28+
// translate service name for sorting
29+
$allServices = array_map(function ($service) {
30+
if (empty($service['name']) || empty($service['name']['value']) || ! is_array($service['name']['value'])) {
31+
$service['name'] = [
32+
'type' => 'java.lang.String',
33+
'value' => '-',
34+
];
35+
} else {
36+
$service['name']['type'] = 'java.lang.String';
37+
$service['name']['value'] = ListOfSps::getPreferredTranslation(
38+
$service['name']['value'],
39+
$this->getLanguage()
40+
);
41+
}
42+
return $service;
43+
}, $allServices);
44+
}
45+
usort($allServices, ['\\SimpleSAML\\Module\\perun\\ListOfSps', 'sortByName']);
2846

2947
$productionServicesCount = $statistics['samlServicesCount'] - $statistics['samlTestServicesCount'] +
3048
$statistics['oidcServicesCount'] - $statistics['oidcTestServicesCount'];
@@ -150,6 +168,6 @@
150168

151169
?>
152170

153-
<script src="<?php echo htmlspecialchars(Module::getModuleURL('chartjs/Chart.bundle.min.js')); ?>"></script>
171+
<script src="<?php echo htmlspecialchars(Module::getModuleURL('perun/res/js/chart.min.js')); ?>"></script>
154172

155173
<script src="<?php echo htmlspecialchars(Module::getModuleURL('perun/listOfSps.js')); ?>"></script>

www/listOfSps.js

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,7 @@ function getDataItem(name) {
66
return JSON.parse(document.getElementById('data').getAttribute('content'))[name];
77
}
88

9-
Chart.platform.disableCSSInjection = true;
10-
11-
var ctx = document.getElementById("myChart").getContext('2d');
9+
var ctx = "myChart";
1210
new Chart(ctx, { // eslint-disable-line no-new
1311
type: 'bar',
1412
data: {
@@ -42,26 +40,28 @@ new Chart(ctx, { // eslint-disable-line no-new
4240
}]
4341
},
4442
options: {
43+
plugins: {
44+
legend: {
45+
display: false
46+
},
47+
tooltip: {
48+
callbacks: {
49+
label: function (tooltipItem) {
50+
return tooltipItem.yLabel;
51+
}
52+
}
53+
}
54+
},
4555
scales: {
46-
yAxes: [{
56+
y: {
57+
beginAtZero: true,
4758
ticks: {
48-
beginAtZero: true,
4959
callback: function (value) {
5060
if (Number.isInteger(value)) {
5161
return value;
5262
}
5363
}
5464
}
55-
}]
56-
},
57-
legend: {
58-
display: false
59-
},
60-
tooltips: {
61-
callbacks: {
62-
label: function (tooltipItem) {
63-
return tooltipItem.yLabel;
64-
}
6565
}
6666
}
6767
}

www/listOfSps.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -164,7 +164,6 @@
164164
}
165165

166166
$allServices = array_merge($samlServices, $oidcServices);
167-
usort($allServices, 'ListOfSps::sortByName');
168167

169168
if (isset($_GET['output']) && $_GET['output'] === 'json') {
170169
$json = [];
@@ -201,6 +200,7 @@
201200
$t->data['statistics'] = $statistics;
202201
$t->data['attributesToShow'] = $attributesToShow;
203202
$t->data['multilingualAttributes'] = $multilingualAttributes;
203+
$t->data['isNameMultilingual'] = in_array($perunServiceNameAttr, $multilingualAttributes, true);
204204
$t->data['samlServices'] = $samlServices;
205205
$t->data['oidcServices'] = $oidcServices;
206206
$t->data['allServices'] = $allServices;

www/res/js/chart.min.js

Lines changed: 13 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)