19declare(strict_types=1);
26use InvalidArgumentException;
45 $f = $this->
ui->factory();
46 $r = $this->
ui->renderer();
50 $js_function_legacy =
$f->legacy()->content(
52 .
'il.UI.showMountInstructions = function (e, id){'
53 .
"obj = $(e['target']);"
54 .
"obj.siblings().removeClass('engaged disabled ilSubmitInactive').attr('aria-pressed', 'false');"
55 .
"obj.siblings().removeAttr('disabled');"
56 .
"obj.addClass('engaged ilSubmitInactive').attr('aria-pressed', 'true');"
57 .
'$(".instructions").hide();'
58 .
'$("#"+id).show();}</script>'
61 if (count($mount_instructions) === 1) {
62 $content =
$f->legacy()->content(
"<div class='instructions'>" . array_shift($mount_instructions) .
"</div>");
64 return $render_async ? $r->renderAsync($content) : $r->render($content);
67 $view_control_actions = [];
69 $selected = array_key_first($mount_instructions);
71 foreach ($mount_instructions as $title =>
$text) {
72 foreach ($os as $os_string) {
73 if (stripos((
string) $title, (
string) $os_string) !==
false) {
80 foreach ($mount_instructions as $title =>
$text) {
81 $hidden = $title === $selected ?
'' :
'style="display: none;"';
83 $legacy =
$f->legacy()->content(
"<div id='$title' class='instructions' $hidden>$text</div>")
84 ->withCustomSignal($title,
"il.UI.showMountInstructions(event, '$title');");
86 $view_control_actions[$title] = $legacy->getCustomSignal($title);
91 $view_control =
$f->viewControl()->mode($view_control_actions,
'mount-instruction-buttons')->withActive(
95 $header_components = [
96 $f->legacy()->content(
"<div class='webdav-view-control'>"),
98 $f->legacy()->content(
'</div>'),
110 $instructions = $this->mount_instruction->getMountInstructionsAsArray();
111 }
catch (InvalidArgumentException) {
115 $instructions = $document_processor->processMountInstructions(
116 $this->lang->txt(
'webfolder_instructions_text')
118 $instructions = $this->mount_instruction->getMountInstructionsAsArray($instructions);
119 if ($instructions ===
'-webfolder_instructions_text-') {
121 "<div class='alert alert-danger'>" . $this->lang->txt(
'error')
122 .
': ' . $this->lang->txt(
'webdav_missing_lang') .
'</div>',
133 $ua = $this->
http->request()->getHeader(
'User-Agent')[0] ??
'';
135 if (stripos($ua,
'windows') !==
false || str_contains($ua,
'microsoft')) {
139 if (stripos($ua,
'darwin') !==
false || stripos($ua,
'macintosh') !==
false) {
140 return [
'mac',
'osx'];
143 if (stripos($ua,
'linux') !==
false
144 || stripos($ua,
'solaris') !==
false
145 || stripos($ua,
'aix') !==
false
146 || stripos($ua,
'unix') !==
false
147 || stripos($ua,
'gvfs') !==
false
Provides fluid interface to RBAC services.
renderMountInstructionsContent()
buildGUIFromGivenMountInstructions(array $mount_instructions, bool $render_async=false)
__construct(protected BaseInstructions $mount_instruction, protected ilLanguage $lang, protected UIServices $ui, protected Services $http)
determineOSfromUserAgent()
static http()
Fetches the global http state from ILIAS.