Skip to content

Commit ebe1e97

Browse files
Merge branch 'ILIAS-eLearning:release_10' into ilias10_survey_language_thresholds
2 parents a8b72df + 555420b commit ebe1e97

File tree

140 files changed

+2192
-1111
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

140 files changed

+2192
-1111
lines changed

components/ILIAS/Accordion/resources/accordion.js

Lines changed: 16 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,18 @@
1-
/* */
1+
/**
2+
* This file is part of ILIAS, a powerful learning management system
3+
* published by ILIAS open source e-Learning e.V.
4+
*
5+
* ILIAS is licensed with the GPL-3.0,
6+
* see https://www.gnu.org/licenses/gpl-3.0.en.html
7+
* You should have received a copy of said license along with the
8+
* source code, too.
9+
*
10+
* If this is not the case or you just want to try ILIAS, you'll find
11+
* us at:
12+
* https://www.ilias.de
13+
* https://github.com/ILIAS-eLearning
14+
*
15+
******************************************************************** */
216

317
il.Accordion = {
418

@@ -474,10 +488,7 @@ il.Accordion = {
474488
rerenderContent: function(acc_el) {
475489

476490
// rerender mathjax
477-
if (typeof MathJax != "undefined" && typeof MathJax.Hub != "undefined") {
478-
MathJax.Hub.Queue(["Reprocess",MathJax.Hub, acc_el[0]]);
479-
}
480-
// see http://docs.mathjax.org/en/latest/typeset.html
491+
il.Util.renderMathJax([acc_el[0]], true);
481492

482493
// rerender google maps
483494
if (typeof ilMapRerender != "undefined") {

components/ILIAS/Authentication/classes/Frontend/class.ilAuthFrontend.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -282,8 +282,8 @@ protected function handleAuthenticationSuccess(ilAuthProviderInterface $provider
282282
return false;
283283
}
284284

285-
// check simultaneos logins
286-
$this->logger->debug('Check simutaneous login');
285+
// check simultaneous logins
286+
$this->logger->debug('Check simultaneous login');
287287
if (!$this->checkSimultaneousLogins($user)) {
288288
$this->logger->info('Authentication failed: simultaneous logins forbidden for user: ' . $this->getStatus()->getAuthenticatedUserId());
289289
$this->getStatus()->setStatus(ilAuthStatus::STATUS_AUTHENTICATION_FAILED);

components/ILIAS/Authentication/classes/class.ilSessionReminder.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,7 @@ public function getMaxPossibleLeadTime(): int
109109
{
110110
$expires = ilSession::getSessionExpireValue();
111111

112-
return max(self::MIN_LEAD_TIME, ($expires / 60) - 1);
112+
return max(self::MIN_LEAD_TIME, (int) (floor($expires / 60) - 1));
113113
}
114114

115115
private function init(): void

components/ILIAS/COPage/templates/default/tpl.question_export.html

Lines changed: 12 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,8 @@
1919
jQuery('div#container{VAL_ID}').autoRender(questions[{VAL_ID}]);
2020
{HANDLE_IMAGES}
2121

22-
if (typeof MathJax != "undefined" && typeof MathJax.Hub != "undefined") {
23-
MathJax.Hub.Queue(["Typeset",MathJax.Hub, "container{VAL_ID}"]);
24-
}
22+
const el = document.getElementById("container{VAL_ID}");
23+
il.Util.renderMathJax([el]);
2524
}
2625
</script>
2726
<!-- END singlechoice -->
@@ -54,9 +53,8 @@
5453

5554
question.init();
5655

57-
if (typeof MathJax != "undefined" && typeof MathJax.Hub != "undefined") {
58-
MathJax.Hub.Queue(["Typeset", MathJax.Hub, "container{VAL_ID}"]);
59-
}
56+
const el = document.getElementById("container{VAL_ID}");
57+
il.Util.renderMathJax([el]);
6058
};
6159
</script>
6260
<!-- END multiplechoice -->
@@ -107,9 +105,8 @@
107105

108106
{HANDLE_IMAGES}
109107

110-
if (typeof MathJax != "undefined") {
111-
MathJax.Hub.Queue(["Typeset", MathJax.Hub, "container{VAL_ID}"]);
112-
}
108+
const el = document.getElementById("container{VAL_ID}");
109+
il.Util.renderMathJax([el]);
113110

114111
})(questions[{VAL_ID}]);
115112
};
@@ -134,10 +131,9 @@
134131
ilias.questions.shuffle(questions[{VAL_ID}]);
135132
jQuery('div#container{VAL_ID}').autoRender(questions[{VAL_ID}]);
136133
{HANDLE_IMAGES}
137-
if (typeof MathJax != "undefined") {
138-
MathJax.Hub.Queue(["Typeset", MathJax.Hub, "container{VAL_ID}"]);
139-
}
140-
il.test.orderingvertical.init(document.querySelector('#container{VAL_ID}'));
134+
const el = document.getElementById("#container{VAL_ID}");
135+
il.Util.renderMathJax([el]);
136+
il.test.orderingvertical.init(document.querySelector('#container{VAL_ID}'));
141137
}
142138
</script>
143139
<!-- END orderingquestion -->
@@ -287,10 +283,9 @@
287283

288284
$(document).ready(
289285
function () {
290-
if (typeof MathJax != "undefined" && typeof MathJax.Hub != "undefined") {
291-
MathJax.Hub.Queue(["Typeset", MathJax.Hub, "container{VAL_ID}"]);
292-
}
293-
il.test.matching.init(document.querySelector('#ilMatchingQuestionContainer_{VAL_ID}'), questionData.matching_mode);
286+
const el = document.getElementById("container{VAL_ID}");
287+
il.Util.renderMathJax([el]);
288+
il.test.matching.init(document.querySelector('#ilMatchingQuestionContainer_{VAL_ID}'), questionData.matching_mode);
294289
}
295290
);
296291

components/ILIAS/Cache/README.md

Lines changed: 107 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,107 @@
1-
# Cache
1+
ILIAS Caching Service
2+
=====================
3+
4+
The ILIAS Caching Service replaces the old GlobalCache Service with ILIAS 9.
5+
Internally, the GlobalCache service currently also uses the new cache service,
6+
but will be removed in the medium term.
7+
8+
# Cache data
9+
10+
## When does it make sense to cache data?
11+
12+
Data caching should be used when simple data does not change between two
13+
requests and is not user-independent. It must also be clear when the data in the
14+
cache becomes invalid and needs to be updated. Caching must also always include
15+
reading the data from a persistence layer (database, file system) as a fallback.
16+
17+
## Differentiation from artifacts
18+
19+
Artifacts are always suitable when the data not only does not change between two
20+
requests, but is always the same depending on the exact version of the ILIAS
21+
source code. Artifacts are generated when ILIAS is built, cache is filled at
22+
runtime. This can be easily explained using the following example:
23+
24+
The translations in ILIAS (Language Service) would be a candidate for artifacts
25+
under the following circumstances:
26+
27+
> The exact content of the translations in ILIAS is only available in the form
28+
> of language files. In this case, this content could be built as an Artifact
29+
> and
30+
> thus be available with high performance.
31+
32+
But then why are translations not in Artifacts?
33+
34+
> ILIAS offers administration in the GUI for the translations, i.e. the exact
35+
> translations do not necessarily have to come from the language files, but can
36+
> change through customization.
37+
38+
Would the translations be a candidate for the cache?
39+
40+
> Yes, under the following circumstances: It is known exactly when the content
41+
> of the translations changes (e.g. through changes to the language files
42+
> through
43+
> an ILIAS update or through manual adjustments in the administration. If these
44+
> situations are known, the language service can invalidate the cache at the
45+
> right
46+
> moment, read the correct content and rebuild the cache.
47+
48+
## How to use the cache service
49+
50+
The data is stored in a cache container. To obtain such a container, a cache
51+
container request is implemented. This is very simple and can also be
52+
implemented on existing classes, for example, which is often useful for
53+
repositories.
54+
55+
```php
56+
use ILIAS\Cache\Container\Request;
57+
58+
class MyRepository implements Request {
59+
public function getContainerKey() : string{
60+
return 'my_repository';
61+
}
62+
public function isForced() : bool{
63+
return true;
64+
}
65+
}
66+
```
67+
68+
The two methods to be implemented can be described as follows:
69+
70+
`getContainerKey`: This is the namespace for your container. ILIAS will
71+
check that two components are not using the same namespace and can therefore
72+
overwrite each other's cache.
73+
74+
`isForced`: Individual containers can be activated via the setup, see the README
75+
for the setup. However, this can be overwritten with isForces if the cotnaienr
76+
is to be active in any case. This should not be used in the core but only in
77+
plugins.
78+
79+
The container can then be obtained via the cache service:
80+
81+
```php
82+
global DIC;
83+
84+
$container = $DIC->chache()->get(new MyRepository());
85+
```
86+
The following methods are then available in the container:
87+
88+
```php
89+
use ILIAS\Cache\Container\Container;
90+
/** @var Container $container */
91+
$container = $DIC->globalCache()->get(new MyRepository());
92+
93+
$container->has('key'); // Check if a key exists
94+
$container->get('key'); // Get a value
95+
$container->set('key', 'value'); // Set a value
96+
$container->delete('key'); // Delete a value
97+
$container->flush(); // Delete all values
98+
$container->lock(3.5); // Lock the container, see below
99+
```
100+
101+
## Storable Values
102+
The service only supports simple scalar values for storage, e.g. no objects
103+
can be stored. The values can be stored individually or as an array.
104+
105+
## Locking
106+
The COntainer can be locked for a certain period of time, i.e. `has` always
107+
returns false during this time, `get` always returns null.

components/ILIAS/Contact/BuddySystem/classes/class.ilBuddySystemGUI.php

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,11 @@
1818

1919
declare(strict_types=1);
2020

21+
use ILIAS\Filesystem\Stream\Streams;
22+
use ILIAS\HTTP\Response\ResponseHeader;
2123
use ILIAS\HTTP\Services;
24+
use ILIAS\UI\Factory as UIFactory;
25+
use ILIAS\UI\Renderer as UIRenderer;
2226

2327
/**
2428
* Class ilBuddySystemGUI
@@ -39,6 +43,8 @@ class ilBuddySystemGUI
3943
protected ilLanguage $lng;
4044
protected Services $http;
4145
private readonly ilGlobalTemplateInterface $main_tpl;
46+
private UIFactory $ui_factory;
47+
private UIRenderer $ui_renderer;
4248

4349
public function __construct()
4450
{
@@ -49,6 +55,8 @@ public function __construct()
4955
$this->ctrl = $DIC['ilCtrl'];
5056
$this->user = $DIC['ilUser'];
5157
$this->lng = $DIC['lng'];
58+
$this->ui_factory = $DIC->ui()->factory();
59+
$this->ui_renderer = $DIC->ui()->renderer();
5260

5361
$this->buddyList = ilBuddyList::getInstanceByGlobalUser();
5462
$this->stateFactory = ilBuddySystemRelationStateFactory::getInstance();
@@ -68,8 +76,14 @@ public static function initializeFrontend(ilGlobalTemplateInterface $page): void
6876
$DIC->language()->loadLanguageModule('buddysystem');
6977

7078
$page->addJavaScript('./assets/js/buddy_system.js');
79+
$page->addJavaScript('./assets/js/modal.min.js');
7180

7281
$config = new stdClass();
82+
$config->async_get_unlink_modal_confirmation_html = $DIC->ctrl()->getLinkTargetByClass([
83+
ilUIPluginRouterGUI::class,
84+
self::class
85+
], 'asyncGetUnlinkModalConfirmationHtml', '', true, false);
86+
7387
$config->http_post_url = $DIC->ctrl()->getFormActionByClass([
7488
ilUIPluginRouterGUI::class,
7589
self::class
@@ -87,6 +101,40 @@ public static function initializeFrontend(ilGlobalTemplateInterface $page): void
87101
}
88102
}
89103

104+
public function asyncGetUnlinkModalConfirmationHtmlCommand(): never
105+
{
106+
$modal_id = null;
107+
$confirmation_modal = $this
108+
->ui_factory
109+
->modal()
110+
->interruptive(
111+
$this->lng->txt('confirmation'),
112+
$this->lng->txt('buddy_confirm_unlink'),
113+
''
114+
)
115+
->withActionButtonLabel($this->lng->txt('confirm'))
116+
->withAdditionalOnLoadCode(function ($id) use (&$modal_id) {
117+
$modal_id = $id;
118+
return '';
119+
});
120+
121+
$this->http->saveResponse(
122+
$this->http->response()->withBody(
123+
Streams::ofString(
124+
json_encode([
125+
'html' => $this->ui_renderer->renderAsync($confirmation_modal),
126+
'signals' => [
127+
'close' => $confirmation_modal->getCloseSignal()->getId()
128+
],
129+
'modalId' => $modal_id
130+
], JSON_THROW_ON_ERROR)
131+
)
132+
)->withHeader(ResponseHeader::CONTENT_TYPE, 'application/json')
133+
);
134+
$this->http->sendResponse();
135+
$this->http->close();
136+
}
137+
90138
/**
91139
* @throws RuntimeException
92140
*/

0 commit comments

Comments
 (0)