19 declare(strict_types=1);
42 private \ILIAS\HTTP\Services
$http;
56 $this->
ctrl = $DIC->ctrl();
57 $this->
access = $DIC->access();
58 $this->
http = $DIC->http();
60 $this->
lng = $DIC->language();
61 $this->
lng->loadLanguageModule(
"wopi");
62 $this->maint_tpl = $DIC->ui()->mainTemplate();
63 $this->ref_id = $this->
http->wrapper()->query()->has(
"ref_id")
64 ? (
int) $this->
http->wrapper()->query()->retrieve(
66 $DIC->refinery()->to()->string()
73 $this->ui_factory = $DIC->ui()->factory();
74 $this->ui_renderer = $DIC->ui()->renderer();
79 if (!$this->
access->checkAccess(
"read",
"", $this->ref_id)) {
80 $this->maint_tpl->setOnScreenMessage(
'failure', $this->
lng->txt(
"permission_denied"),
true);
81 $this->
ctrl->redirectByClass(ilObjExternalToolsSettingsGUI::class);
84 $cmd = $this->
ctrl->getCmd(self::CMD_DEFAULT);
86 self::CMD_DEFAULT => $this->
index(),
87 self::CMD_SHOW => $this->
show(),
88 self::CMD_STORE => $this->
store(),
89 default =>
throw new ilException(
"command not found: " . $cmd),
96 if (!empty($supported_suffixes)) {
97 $this->maint_tpl->setOnScreenMessage(
100 $this->
lng->txt(
"currently_supported"),
101 implode(
", ", $supported_suffixes)
108 $this->maint_tpl->setContent(
115 $wopi_activated = (bool) $this->
settings->get(
"wopi_activated",
'0');
116 if (!$wopi_activated) {
119 return $this->action_repo->getSupportedSuffixes(ActionTarget::EDIT);
124 $actions = array_map(
125 function (
Action $action) {
126 return $this->ui_factory->item()->standard($action->
getExtension())->withProperties([
128 $this->
lng->txt(
'action') => $action->
getName()
131 $this->action_repo->getActionsForTargets(ActionTarget::EDIT, ActionTarget::EMBED_EDIT)
134 $this->maint_tpl->setContent(
135 $this->ui_renderer->render(
136 $this->ui_factory->item()->group(
137 $this->
lng->txt(
'actions'),
148 if ($form->proceed($this->http->request())) {
151 $this->maint_tpl->setOnScreenMessage(
'success', $this->
lng->txt(
"msg_wopi_settings_modified"),
true);
154 $discovery_url = $this->
settings->get(
"wopi_discovery_url");
155 if ($discovery_url === null) {
156 $this->app_repo->clear($this->action_repo);
158 $apps = $this->crawler->crawl(
new URI($discovery_url));
159 if ($apps !== null) {
160 $this->app_repo->storeCollection($apps, $this->action_repo);
164 $this->
ctrl->redirect($this, self::CMD_DEFAULT);
167 $this->maint_tpl->setContent($form->getHTML());
ILIAS UI Renderer $ui_renderer
ActionRepository $action_repo
ILIAS HTTP Services $http
ilGlobalTemplateInterface $maint_tpl
static http()
Fetches the global http state from ILIAS.
The scope of this class is split ilias-conform URI's into components.
ILIAS UI Factory $ui_factory
ActionTarget
Officialy supported action targets, see https://learn.microsoft.com/en-us/openspecs/office_protocols/...
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...