-
Notifications
You must be signed in to change notification settings - Fork 343
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[FEATURE] WOPI Configurable Saving Interval
- Loading branch information
Showing
5 changed files
with
129 additions
and
14 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -27,8 +27,6 @@ | |
|
||
/** | ||
* @author Fabian Schmid <[email protected]> | ||
* | ||
* @ilCtrl_isCalledBy ilWOPIAdministrationGUI: ilObjExternalToolsSettingsGUI | ||
*/ | ||
class ilWOPISettingsForm | ||
{ | ||
|
@@ -64,15 +62,17 @@ private function getSection(): Section | |
{ | ||
$wopi_activated = (bool) $this->settings->get("wopi_activated", '0'); | ||
$wopi_discovery_url = $this->settings->get("wopi_discovery_url"); | ||
$saving_interval_value = (int) $this->settings->get("saving_interval", '0'); | ||
$saving_interval_value = $saving_interval_value === 0 ? null : $saving_interval_value; | ||
|
||
$wopi_url = $this->ui_factory->input()->field()->text( | ||
$this->lng->txt("wopi_url"), | ||
$this->lng->txt("wopi_url_byline") | ||
/*. $this->renderLink( | ||
" ➜︎ Wikipedia", | ||
"https://en.wikipedia.org/wiki/Web_Application_Open_Platform_Interface", | ||
true | ||
)*/ | ||
/*. $this->renderLink( | ||
" ➜︎ Wikipedia", | ||
"https://en.wikipedia.org/wiki/Web_Application_Open_Platform_Interface", | ||
true | ||
)*/ | ||
)->withAdditionalTransformation( | ||
$this->refinery->custom()->transformation(function ($v) { | ||
return $v === '' ? null : $v; | ||
|
@@ -94,13 +94,56 @@ private function getSection(): Section | |
$wopi_discovery_url ?? '' | ||
); | ||
|
||
$saving_interval = $this->ui_factory->input()->field()->optionalGroup( | ||
[ | ||
$this->ui_factory | ||
->input() | ||
->field() | ||
->numeric( | ||
$this->lng->txt("saving_interval"), | ||
$this->lng->txt("saving_interval_byline") | ||
) | ||
->withAdditionalTransformation( | ||
$this->refinery->custom()->transformation(function ($v) { | ||
return $v === '' ? null : $v; | ||
}) | ||
)->withAdditionalTransformation( | ||
$this->refinery->custom()->transformation(function ($v) { | ||
if ($v === null || $v === 0) { | ||
$this->settings->delete("saving_interval"); | ||
return true; | ||
} | ||
|
||
$this->settings->set("saving_interval", (string) $v); | ||
|
||
return true; | ||
}) | ||
)->withValue( | ||
$saving_interval_value | ||
) | ||
], | ||
$this->lng->txt("activate_saving_interval") | ||
)->withValue( | ||
$saving_interval_value === null ? null : [$saving_interval_value] | ||
)->withAdditionalTransformation( | ||
$this->refinery->custom()->transformation(function ($v) { | ||
if ($v === null || $v === [null]) { | ||
$this->settings->delete("saving_interval"); | ||
} | ||
return $v; | ||
}) | ||
); | ||
|
||
return $this->ui_factory->input()->field()->section( | ||
[ | ||
$this->ui_factory->input()->field()->optionalGroup( | ||
[$wopi_url], | ||
[$wopi_url, $saving_interval], | ||
$this->lng->txt("activate_wopi") | ||
)->withValue( | ||
$wopi_discovery_url === null ? null : [$wopi_discovery_url] | ||
$wopi_discovery_url === null ? null : [ | ||
$wopi_discovery_url, | ||
$saving_interval_value === null ? null : [$saving_interval_value] | ||
] | ||
)->withAdditionalTransformation( | ||
$this->refinery->custom()->transformation(function ($v) { | ||
if ($v === null || $v === [null]) { | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
<?php | ||
|
||
/** | ||
* This file is part of ILIAS, a powerful learning management system | ||
* published by ILIAS open source e-Learning e.V. | ||
* | ||
* ILIAS is licensed with the GPL-3.0, | ||
* see https://www.gnu.org/licenses/gpl-3.0.en.html | ||
* You should have received a copy of said license along with the | ||
* source code, too. | ||
* | ||
* If this is not the case or you just want to try ILIAS, you'll find | ||
* us at: | ||
* https://www.ilias.de | ||
* https://github.com/ILIAS-eLearning | ||
* | ||
*********************************************************************/ | ||
|
||
declare(strict_types=1); | ||
|
||
/** | ||
* @author Fabian Schmid <[email protected]> | ||
*/ | ||
class ilWOPIDB100 implements \ilDatabaseUpdateSteps | ||
{ | ||
private ?ilDBInterface $db = null; | ||
|
||
public function prepare(ilDBInterface $db): void | ||
{ | ||
$this->db = $db; | ||
} | ||
|
||
public function step_1(): void | ||
{ | ||
if (!$this->db->tableColumnExists('wopi_action', 'target_text')) { | ||
$this->db->addTableColumn( | ||
'wopi_action', | ||
'target_text', | ||
[ | ||
'type' => 'text', | ||
'length' => 256, | ||
'notnull' => false, | ||
], | ||
); | ||
} | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -17,12 +17,15 @@ | |
*********************************************************************/ | ||
|
||
declare(strict_types=1); | ||
|
||
use ILIAS\Setup\Objective\NullObjective; | ||
use ILIAS\Setup\Metrics\Storage; | ||
use ILIAS\Setup\Agent; | ||
use ILIAS\Setup\Objective; | ||
use ILIAS\Refinery\Transformation; | ||
use ILIAS\Setup\Metrics; | ||
use ILIAS\Setup\Config; | ||
use ILIAS\Setup\ObjectiveCollection; | ||
use ILIAS\BookingManager\Setup\AccessRBACOperationClonedObjective; | ||
|
||
/** | ||
* @author Fabian Schmid <[email protected]> | ||
|
@@ -46,15 +49,22 @@ public function getInstallObjective(Config $config = null): Objective | |
|
||
public function getUpdateObjective(Config $config = null): Objective | ||
{ | ||
return new ObjectiveCollection( | ||
"WOPI Updates", | ||
true, | ||
new ilDatabaseUpdateStepsExecutedObjective(new ilWOPIDB90()), | ||
new ilDatabaseUpdateStepsExecutedObjective(new ilWOPIDB100()), | ||
); | ||
|
||
return new \ilDatabaseUpdateStepsExecutedObjective(new ilWOPIDB90()); | ||
} | ||
|
||
public function getBuildObjective(): Objective | ||
{ | ||
return new Objective\NullObjective(); | ||
return new NullObjective(); | ||
} | ||
|
||
public function getStatusObjective(Metrics\Storage $storage): Objective | ||
public function getStatusObjective(Storage $storage): Objective | ||
{ | ||
return new ilDatabaseUpdateStepsMetricsCollectedObjective($storage, new ilWOPIDB90()); | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters