Skip to content

Commit

Permalink
Merge branch 'main' into ilias7-origins2-update
Browse files Browse the repository at this point in the history
* main:
  Save delete directories recursively (opencast-ilias#158)
  Fix for opencast-ilias#143 (opencast-ilias#145)
  fix opencast-ilias#149 (opencast-ilias#150)
  fix opencast-ilias#144 add course title as Organizer (opencast-ilias#146)
  fixes opencast-ilias#141 (opencast-ilias#142)
  fix for 60 (opencast-ilias#129)
  fixes 132 (opencast-ilias#136)
  • Loading branch information
okaufman committed May 10, 2023
2 parents 68d66c9 + cd51960 commit 093c77c
Show file tree
Hide file tree
Showing 7 changed files with 50 additions and 11 deletions.
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,12 @@
# Change Log

## [4.0.1]
- Fix/Improvement: added more playbackrates in paella-config
- Update Paella to version 6.5.6.
- Improvement: change default order of events in series to start date.
- Improvement: In TileView also use the same default order for events.


## [4.0.0]
- Feature: Completely configurable metadata fields for events and series, used in forms and tables. See Configuration Tab "Metadata".
- Feature: Accept Terms of Use once per User, when creating an Event. See Configuration at "General" -> "Series".
Expand Down
2 changes: 1 addition & 1 deletion classes/Event/class.xoctEventTableGUI.php
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ public function __construct(
}
}
$this->initColumns();
$this->setDefaultOrderField('created_s');
$this->setDefaultOrderField('startDate_s');

if (ilObjOpenCastAccess::checkAction(ilObjOpenCastAccess::ACTION_EXPORT_CSV)) {
$this->setExportFormats([self::EXPORT_CSV]);
Expand Down
2 changes: 1 addition & 1 deletion classes/Event/class.xoctEventTileGUI.php
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ public function __construct(xoctEventGUI $parent_gui, ObjectSettings $objectSett
$this->limit = UserSettingsRepository::getTileLimitForUser(self::dic()->user()->getId(), filter_input(INPUT_GET, 'ref_id'));
$this->events = array_values(array_map(function ($item) {
return $item['object'];
}, $data));
}, $this->sortData($data)));
}

/**
Expand Down
3 changes: 1 addition & 2 deletions classes/Service/class.xoctSeriesAPI.php
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,7 @@ public function create(int $parent_ref_id, string $title, $additional_data = [])
$metadata->getField(MDFieldDefinition::F_TITLE)->setValue($title);
$metadata->getField(MDFieldDefinition::F_DESCRIPTION)->setValue($additional_data['description'] ?? '');
$metadata->getField(MDFieldDefinition::F_LICENSE)->setValue($additional_data['license'] ?? '');
$metadata->getField(MDFieldDefinition::F_CREATOR)->setValue([ilObjOpencast::_getParentCourseOrGroup($ilObjOpenCast->getRefId())->getTitle()]);

$acl = $this->aclUtils->getStandardRolesACL();
if (isset($additional_data['permission_template_id'])) {
Expand Down Expand Up @@ -168,8 +169,6 @@ public function create(int $parent_ref_id, string $title, $additional_data = [])
$acl->merge($this->aclUtils->getUserRolesACL($producer));
}

// $series->addOrganizer(ilObjOpencast::_getParentCourseOrGroup($ilObjOpenCast->getRefId())->getTitle(), true);

$series_id = $this->series_repository->create(new CreateSeriesRequest(new CreateSeriesRequestPayload($metadata, $acl)));

$objectSettings->setSeriesIdentifier($series_id);
Expand Down
13 changes: 7 additions & 6 deletions classes/class.ilObjOpenCastGUI.php
Original file line number Diff line number Diff line change
Expand Up @@ -419,12 +419,13 @@ public function afterSave(ilObject $newObj)
/** @var PermissionTemplate $perm_tpl */
$perm_tpl = PermissionTemplate::find($perm_tpl_id);
}
$acl = $perm_tpl->addToAcls(
$acl,
!$settings->getStreamingOnly(),
$settings->getUseAnnotations()
);

if ($perm_tpl) {
$acl = $perm_tpl->addToAcls(
$acl,
!$settings->getStreamingOnly(),
$settings->getUseAnnotations()
);
}
// TODO: do we need contributor / organizer?
if (!$series_id) {
$series_id = $this->opencast_dic->series_repository()->create(new CreateSeriesRequest(new CreateSeriesRequestPayload(
Expand Down
2 changes: 1 addition & 1 deletion js/paella_player/config.json
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,7 @@
},
"es.upv.paella.playbackRatePlugin": {
"enabled": true,
"availableRates": [0.75, 1, 1.25, 1.5, 1.75, 2.0]
"availableRates": [0.75, 1, 1.25, 1.5, 1.75, 2.0, 2.5, 3.0]
},
"es.upv.paella.playPauseButtonPlugin": {
"enabled": true
Expand Down
34 changes: 34 additions & 0 deletions src/Util/FileTransfer/UploadStorageService.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
use srag\Plugins\Opencast\Model\ACL\ACL;
use srag\Plugins\Opencast\Util\Transformator\ACLtoXML;
use xoctUploadFile;
use ILIAS\Filesystem\DTO\Metadata;

class UploadStorageService
{
Expand Down Expand Up @@ -69,7 +70,40 @@ public function delete(string $identifier): void
}
$dir = $this->idToDirPath($identifier);
if ($this->fileSystem->hasDir($dir)) {
$this->deleteDirRecursive($dir);
}
}

private function deleteDirRecursive(string $dir): void
{
// the folders are sorted based on their path length to ensure that nested folders are deleted first
// thereby preventing any issues due to deletion attempts on no longer existing folders.
$folders = $this->fileSystem->finder()->in([$dir]);
$folders = $folders->directories();
$folders = $folders->sort(function (
Metadata $a,
Metadata $b
): int {
return strlen($a->getPath()) - strlen($b->getPath());
});
$folders = $folders->reverseSorting();
$folders = $folders->getIterator();
$folders->rewind();
while ($folders->valid()) {
try {
$folder_match = $folders->current();
$path = $folder_match->getPath();
if ($folder_match->isDir()) {
$this->fileSystem->deleteDir($path);
}
$folders->next();
} catch (\Throwable $t) {
$folders->next();
}
}
try {
$this->fileSystem->deleteDir($dir);
} catch (\Throwable $t) {
}
}

Expand Down

0 comments on commit 093c77c

Please sign in to comment.