This repository was archived by the owner on Sep 19, 2022. It is now read-only.
File tree Expand file tree Collapse file tree 3 files changed +24
-3
lines changed
Expand file tree Collapse file tree 3 files changed +24
-3
lines changed Original file line number Diff line number Diff 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 )
Original file line number Diff line number Diff line change 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 ' ];
Original file line number Diff line number Diff line change 164164}
165165
166166$ allServices = array_merge ($ samlServices , $ oidcServices );
167- usort ($ allServices , 'ListOfSps::sortByName ' );
168167
169168if (isset ($ _GET ['output ' ]) && $ _GET ['output ' ] === 'json ' ) {
170169 $ json = [];
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 ;
You can’t perform that action at this time.
0 commit comments