From e6e89e21d181d8f2a66c280e748f0dee9f988cba Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Till=20Gl=C3=B6ggler?= Date: Tue, 29 Aug 2023 10:00:13 +0200 Subject: [PATCH] fix scheduling --- composer.json | 2 +- composer.lock | 18 +++-- lib/Models/REST/IngestClient.php | 30 +++----- lib/Models/REST/SeriesClient.php | 3 +- lib/Models/ScheduleHelper.php | 73 +++++++++++-------- lib/Routes/Course/CourseConfig.php | 2 +- lib/Routes/Course/CourseListSchedule.php | 9 +-- lib/Routes/Schedule/ScheduleAdd.php | 27 +------ lib/Routes/Schedule/ScheduleBulk.php | 9 ++- ..._add_course_date_fields_for_events_pre.php | 31 ++++++++ ...me.php => 050_new_scheme_and_cronjobs.php} | 59 +++++++++++++-- migrations/050_scheduling_cronjob.php | 69 ------------------ .../076_add_course_date_fields_for_events.php | 31 ++++++++ vueapp/components/Config/EditServer.vue | 7 -- vueapp/components/Schedule/ScheduleList.vue | 9 +-- vueapp/store/schedule.module.js | 16 +--- 16 files changed, 200 insertions(+), 195 deletions(-) create mode 100644 migrations/049_add_course_date_fields_for_events_pre.php rename migrations/{049_new_scheme.php => 050_new_scheme_and_cronjobs.php} (82%) delete mode 100644 migrations/050_scheduling_cronjob.php create mode 100644 migrations/076_add_course_date_fields_for_events.php diff --git a/composer.json b/composer.json index 1b5e45abd..ba74fb366 100644 --- a/composer.json +++ b/composer.json @@ -8,7 +8,7 @@ }, "require": { "slim/slim": "^3.12", - "elan-ev/opencast-api": "^1.3", + "elan-ev/opencast-api": "^1.4", "symfony/console": "^5.3" }, "require-dev": { diff --git a/composer.lock b/composer.lock index b24457e24..33424a5ef 100644 --- a/composer.lock +++ b/composer.lock @@ -4,20 +4,20 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "cd66818a11b06328d586eadff493804a", + "content-hash": "bb1fce4c2ee975b8093e732c43bb80da", "packages": [ { "name": "elan-ev/opencast-api", - "version": "1.3.0", + "version": "1.4.0", "source": { "type": "git", "url": "https://github.com/elan-ev/opencast-php-library.git", - "reference": "49a91cc3f4c8560e7c8ee7c4fd074f01b794c6f9" + "reference": "34b46fb9c0986fc7e4ecd05a45038612da7409c9" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/elan-ev/opencast-php-library/zipball/49a91cc3f4c8560e7c8ee7c4fd074f01b794c6f9", - "reference": "49a91cc3f4c8560e7c8ee7c4fd074f01b794c6f9", + "url": "https://api.github.com/repos/elan-ev/opencast-php-library/zipball/34b46fb9c0986fc7e4ecd05a45038612da7409c9", + "reference": "34b46fb9c0986fc7e4ecd05a45038612da7409c9", "shasum": "" }, "require": { @@ -25,7 +25,9 @@ "php": ">=7.2.5" }, "require-dev": { - "phpunit/phpunit": "^9.5" + "phpcompatibility/php-compatibility": "^9.3", + "phpunit/phpunit": "^9.5", + "squizlabs/php_codesniffer": "^3.7" }, "type": "library", "extra": { @@ -59,9 +61,9 @@ ], "support": { "issues": "https://github.com/elan-ev/opencast-php-library/issues", - "source": "https://github.com/elan-ev/opencast-php-library/tree/1.3.0" + "source": "https://github.com/elan-ev/opencast-php-library/tree/1.4.0" }, - "time": "2023-05-12T14:05:26+00:00" + "time": "2023-07-21T11:58:16+00:00" }, { "name": "guzzlehttp/guzzle", diff --git a/lib/Models/REST/IngestClient.php b/lib/Models/REST/IngestClient.php index 188dfc23f..607ff006a 100644 --- a/lib/Models/REST/IngestClient.php +++ b/lib/Models/REST/IngestClient.php @@ -27,7 +27,7 @@ public function __construct($config_id = 1) public function createMediaPackage() { $response = $this->opencastApi->ingest->createMediaPackage(); - + if ($response['code'] == 200) { return $response['body']; } @@ -46,7 +46,7 @@ public function createMediaPackage() public function addDCCatalog($mediaPackage, $dublinCore, $flavor = '') { $response = $this->opencastApi->ingest->addDCCatalog($mediaPackage, $dublinCore, $flavor); - + if ($response['code'] == 200) { return $response['body']; } @@ -65,7 +65,7 @@ public function addDCCatalog($mediaPackage, $dublinCore, $flavor = '') public function ingest($mediaPackage, $workflowDefinitionId = '', $workflowInstanceId = '') { $response = $this->opencastApi->ingest->ingest($mediaPackage, $workflowDefinitionId, $workflowInstanceId); - + if ($response['code'] == 200) { return $response['body']; } @@ -78,13 +78,13 @@ public function ingest($mediaPackage, $workflowDefinitionId = '', $workflowInsta * @param string $mediaPackage The media package * @param string $trackURI The location of the media * @param string $flavor The kind of media track - * + * * @return string augmented media package in xml format, or false if unable to add */ public function addTrack($mediaPackage, $trackURI, $flavor) { $response = $this->opencastApi->ingest->addTrackUrl($mediaPackage, $flavor, $trackURI); - + if ($response['code'] == 200) { return $response['body']; } @@ -93,21 +93,18 @@ public function addTrack($mediaPackage, $trackURI, $flavor) /** * Schedule an event based on the given media package. - * + * * @param string $mediaPackage The media package * @param string $workflowDefinitionId Workflow definition id * @param string $capabilities Device Capabilities - * @param boolean $livestream Whether to schedule with publishLive param - * + * * @return boolean whether the event is scheduled or not */ - public function schedule($mediaPackage, $workflowDefinitionId = '', $capabilities = '', $livestream = false) + public function schedule($mediaPackage, $workflowDefinitionId = '', $capabilities = '') { - // This part has been taken out from the old SOP which is intended to schedule an event - // with livestreaming capability, which does not work properly and must have further R&D! - if (!empty($capabilities) || $livestream) { + if (!empty($capabilities)) { $uri = "/ingest/schedule"; - + if (!empty($workflowDefinitionId)) { $uri .= "/{$workflowDefinitionId}"; } @@ -120,18 +117,15 @@ public function schedule($mediaPackage, $workflowDefinitionId = '', $capabilitie $query['capture.device.names'] = $capabilities; } - if ($livestream) { - $query['publishLive'] = 'True'; - } - $options = $this->ocRestClient->getQueryParams($query); $response = $this->ocRestClient->performGet($uri, $options); return $response['code'] == 200; } else { $response = $this->opencastApi->ingest->schedule($mediaPackage, $workflowDefinitionId); - return $response['code'] == 201; + return (in_array($response['code'], [200, 201]) !== false); } + return false; } } diff --git a/lib/Models/REST/SeriesClient.php b/lib/Models/REST/SeriesClient.php index d0dae71a5..b34aedf8f 100644 --- a/lib/Models/REST/SeriesClient.php +++ b/lib/Models/REST/SeriesClient.php @@ -72,7 +72,6 @@ public function createSeriesForSeminar($course_id) ]; $metadata = self::getSeriesDC($course_id); - $response = $this->opencastApi->seriesApi->create($metadata, $acl); if ((int)$response['code'] === 201) { @@ -95,7 +94,7 @@ private static function getSeriesDC($course_id) $license = "© " . gmdate('Y') . " " . $GLOBALS['UNI_NAME_CLEAN']; $inst = \Institute::find($course->institut_id); - $publisher = $inst->name; + $publisher = (string)$inst->name; $instructors = $course->getMembers('dozent'); $instructor = array_shift($instructors); $contributor = $GLOBALS['UNI_NAME_CLEAN'] ?: 'unbekannt'; diff --git a/lib/Models/ScheduleHelper.php b/lib/Models/ScheduleHelper.php index 291b0f305..c12ecdba2 100644 --- a/lib/Models/ScheduleHelper.php +++ b/lib/Models/ScheduleHelper.php @@ -338,21 +338,22 @@ private static function getDCTime($timestamp) * * @param string $course_id - course identifier * @param string $termin_id - termin identifier - * @param bool $livestream - livestream flag * * @return bool success or not */ - public static function scheduleEventForSeminar($course_id, $termin_id, $livestream = false) + public static function scheduleEventForSeminar($course_id, $termin_id) { $date = new \SingleDate($termin_id); $resource_id = $date->getResourceID(); if (!$resource_id) { return false; } + $oc_resource = Resources::findByResource_id($resource_id); if (!$oc_resource || !self::checkCaptureAgent($oc_resource['config_id'], $oc_resource['capture_agent']) - || !self::validateCourseAndResource($course_id, $oc_resource['config_id'])) { + || !self::validateCourseAndResource($course_id, $oc_resource['config_id']) + ) { return false; } @@ -361,10 +362,9 @@ public static function scheduleEventForSeminar($course_id, $termin_id, $livestre $metadata = self::createEventMetadata($course_id, $resource_id, $oc_resource['config_id'], $termin_id, null); $media_package = $ingest_client->addDCCatalog($media_package, $metadata['dublincore']); - $result = $ingest_client->schedule($media_package, $metadata['workflow'], $metadata['device_capabilities'], $livestream); + $result = $ingest_client->schedule($media_package, $metadata['workflow'], $metadata['device_capabilities']); if ($result) { - $xml = simplexml_load_string($media_package); $event_id = (string)$xml['id']; $scheduled = self::scheduleRecording($course_id, $resource_id, $termin_id, $event_id); @@ -376,6 +376,7 @@ public static function scheduleEventForSeminar($course_id, $termin_id, $livestre $scheduler_client = SchedulerClient::getInstance($oc_resource['config_id']); $scheduler_client->deleteEvent($event_id); } + return false; } @@ -679,23 +680,6 @@ public static function updateEventForSeminar($course_id, $termin_id, $start = nu } } - /** - * Gets the livestream parameter of the course's server config (if any) - * - * @param string $course_id course id - * - * @return bool - */ - public static function checkCourseConfigLivestream($course_id) - { - $livestream = false; - $config = Config::getConfigForCourse($course_id); - if ($config && isset($config['settings']['livestream'])) { - $livestream = $config['settings']['livestream']; - } - return $livestream; - } - /** * Gets the list of scheduling dates for a course to be displayed in the scheduling list in a course * @@ -707,7 +691,6 @@ public static function checkCourseConfigLivestream($course_id) public static function getScheduleList($course_id, $semester_filter) { $allow_schedule_alternate = \Config::get()->OPENCAST_ALLOW_ALTERNATE_SCHEDULE; - $allow_livestream = self::checkCourseConfigLivestream($course_id); $dates = self::getDatesForSemester($course_id, $semester_filter); $events = self::getCourseEvents($course_id); @@ -814,14 +797,6 @@ public static function getScheduleList($course_id, $semester_filter) 'role' => 'clickable', 'title' => _('Aufzeichnung planen') ]; - if ($allow_livestream) { - $actions['scheduleLive'] = [ - 'shape' => 'video', - 'role' => 'clickable', - 'title' => _('Livestream+Aufzeichnung planen'), - 'info' => 'LIVE' - ]; - } } else { $actions['expire'] = [ 'shape' => 'video+decline', @@ -961,4 +936,40 @@ public static function deleteResource($resource_id) return $success; } + + /** + * Send personal recording notifications to users for passed course + * + * @param string $course_id + * + * @return void + */ + public static function sendRecordingNotifications($course_id) + { + $course = \Course::find($course_id); + $members = $course->members; + $users = []; + + foreach ($members as $member) { + $users[] = $member->user_id; + } + + $notification = sprintf( + _('Die Veranstaltung "%s" wird für Sie mit Bild und Ton automatisiert aufgezeichnet.'), + htmlReady($course->name) + ); + + $plugin = \PluginEngine::getPlugin('OpenCast'); + $assetsUrl = rtrim($plugin->getPluginURL(), '/') . '/assets'; + $icon = \Icon::create($assetsUrl . '/images/opencast-black.svg'); + + \PersonalNotifications::add( + $users, + \PluginEngine::getURL('opencast', ['cid' => $course_id], 'course'), + $notification, + $course_id, + $icon + ); + } + } diff --git a/lib/Routes/Course/CourseConfig.php b/lib/Routes/Course/CourseConfig.php index 178f0915a..db489c91f 100644 --- a/lib/Routes/Course/CourseConfig.php +++ b/lib/Routes/Course/CourseConfig.php @@ -35,7 +35,7 @@ public function __invoke(Request $request, Response $response, $args) if (empty($series)) { // only tutor or above should be able to trigger this series creation! - if ($perm->have_studip_perm('user', $course_id)) { // TODO: Set this to tutor! + if ($perm->have_studip_perm('tutor', $course_id)) { // No series for this course yet! Create one! $config_id = \Config::get()->OPENCAST_DEFAULT_SERVER; $series_client = new SeriesClient($config_id); diff --git a/lib/Routes/Course/CourseListSchedule.php b/lib/Routes/Course/CourseListSchedule.php index c92770a3b..a79033d3f 100644 --- a/lib/Routes/Course/CourseListSchedule.php +++ b/lib/Routes/Course/CourseListSchedule.php @@ -16,19 +16,18 @@ public function __invoke(Request $request, Response $response, $args) { $course_id = $args['course_id']; $semester_filter = $args['semester_filter']; - + $semester_list = ScheduleHelper::getSemesterList($course_id); $allow_schedule_alternate = \Config::get()->OPENCAST_ALLOW_ALTERNATE_SCHEDULE; - $allow_livestream = ScheduleHelper::checkCourseConfigLivestream($course_id); $schedule_list = ScheduleHelper::getScheduleList($course_id, $semester_filter); - + $response_data = [ 'semester_list' => $semester_list, 'schedule_list' => $schedule_list, - 'allow_schedule_alternate' => $allow_schedule_alternate, - 'allow_livestream' => $allow_livestream + 'allow_schedule_alternate' => $allow_schedule_alternate ]; + return $this->createResponse($response_data, $response); } } \ No newline at end of file diff --git a/lib/Routes/Schedule/ScheduleAdd.php b/lib/Routes/Schedule/ScheduleAdd.php index b333087c7..562546cd4 100644 --- a/lib/Routes/Schedule/ScheduleAdd.php +++ b/lib/Routes/Schedule/ScheduleAdd.php @@ -29,40 +29,19 @@ public function __invoke(Request $request, Response $response, $args) } $json = $this->getRequestData($request); - $livestream = isset($json['livestream']) ? $json['livestream'] : false; $message = [ 'type' => 'error', 'text' => _('Aufzeichnung konnte nicht geplant werden.') ]; - if (ScheduleHelper::scheduleEventForSeminar($course_id, $termin_id, $livestream)) { + if (ScheduleHelper::scheduleEventForSeminar($course_id, $termin_id)) { $message = [ 'type' => 'success', - 'text' => $livestream ? _('Livestream mit Aufzeichnung wurde geplant.') : _('Aufzeichnung wurde geplant.') + 'text' => _('Aufzeichnung wurde geplant.') ]; - - $course = \Course::find($course_id); - $members = $course->members; - $users = []; - foreach ($members as $member) { - $users[] = $member->user_id; - } - $notification = sprintf( - _('Die Veranstaltung "%s" wird für Sie mit Bild und Ton automatisiert aufgezeichnet.'), - htmlReady($course->name) - ); - $plugin = \PluginEngine::getPlugin('OpenCast'); - $assetsUrl = rtrim($plugin->getPluginURL(), '/') . '/assets'; - $icon = \Icon::create($assetsUrl . '/images/opencast-black.svg'); - \PersonalNotifications::add( - $users, - \PluginEngine::getURL('opencast', ['cid' => $course_id], 'course'), - $notification, - $course_id, - $icon - ); + ScheduleHelper::sendRecordingNotifications($course_id); \StudipLog::log('OC_SCHEDULE_EVENT', $termin_id, $course_id); } diff --git a/lib/Routes/Schedule/ScheduleBulk.php b/lib/Routes/Schedule/ScheduleBulk.php index 987533726..dd099fa36 100644 --- a/lib/Routes/Schedule/ScheduleBulk.php +++ b/lib/Routes/Schedule/ScheduleBulk.php @@ -30,8 +30,6 @@ public function __invoke(Request $request, Response $response, $args) throw new Error('Es fehlen Parameter!', 422); } - $livestream = $action == 'live' ? true : false; - $message_type = 'success'; $message_text = _('Die angeforderte Massenaktion wurde ausgeführt.'); $errors = []; @@ -42,8 +40,7 @@ public function __invoke(Request $request, Response $response, $args) $result = false; switch ($action) { case 'schedule': - case 'live': - $result = ScheduleHelper::scheduleEventForSeminar($course_id, $termin_id, $livestream); + $result = ScheduleHelper::scheduleEventForSeminar($course_id, $termin_id); break; case 'unschedule': $result = ScheduleHelper::deleteEventForSeminar($course_id, $termin_id); @@ -59,6 +56,10 @@ public function __invoke(Request $request, Response $response, $args) } } + if ($action == 'schedule') { + ScheduleHelper::sendRecordingNotifications($course_id); + } + if (!empty($errors)) { $message_type = count($errors) == count($termin_ids) ? 'error' : 'warning'; $message_text = count($errors) == count($termin_ids) diff --git a/migrations/049_add_course_date_fields_for_events_pre.php b/migrations/049_add_course_date_fields_for_events_pre.php new file mode 100644 index 000000000..d6d6c831b --- /dev/null +++ b/migrations/049_add_course_date_fields_for_events_pre.php @@ -0,0 +1,31 @@ +query("SHOW COLUMNS FROM `oc_scheduled_recordings` LIKE 'coursedate_start'"); + if (empty($results->fetchAll())) { + $db->exec('ALTER TABLE oc_scheduled_recordings + ADD `coursedate_end` int(11) AFTER `end`, + ADD `coursedate_start` int(11) AFTER `end` + '); + + // update all entries to fill new coursedate-fields + $db->exec('UPDATE oc_scheduled_recordings + SET coursedate_start = start, coursedate_end = end + WHERE 1 + '); + } + } + + public function down() + { + $db->exec('ALTER TABLE oc_scheduled_recordings + DROP `coursedate_end` , + DROP `coursedate_start` + '); + } +} \ No newline at end of file diff --git a/migrations/049_new_scheme.php b/migrations/050_new_scheme_and_cronjobs.php similarity index 82% rename from migrations/049_new_scheme.php rename to migrations/050_new_scheme_and_cronjobs.php index c10c184dd..1d8d28f5f 100644 --- a/migrations/049_new_scheme.php +++ b/migrations/050_new_scheme_and_cronjobs.php @@ -1,9 +1,12 @@ task_id) { + $scheduler->cancelByTask($task_id); + $scheduler->unregisterTask($task_id); + } + } + + // add video discovery cronjob + if (!$task_id = CronjobTask::findByFilename(self::BASE_DIR . 'opencast_discover_videos.php')[0]->task_id) { + $task_id = $scheduler->registerTask(self::BASE_DIR . 'opencast_discover_videos.php', true); + } + + // add the new cronjobs + if ($task_id) { + $scheduler->cancelByTask($task_id); + $scheduler->schedulePeriodic($task_id, -10); // negative value means "every x minutes" + CronjobSchedule::findByTask_id($task_id)[0]->activate(); + } + + + // add worker cronjob + if (!$task_id = CronjobTask::findByFilename(self::BASE_DIR . 'opencast_worker.php')[0]->task_id) { + $task_id = $scheduler->registerTask(self::BASE_DIR . 'opencast_worker.php', true); + } + + // add the new cronjobs + if ($task_id) { + $scheduler->cancelByTask($task_id); + $scheduler->schedulePeriodic($task_id, -5); // negative value means "every x minutes" + CronjobSchedule::findByTask_id($task_id)[0]->activate(); + } + + // add new scheduling cronjob + $task_id = $scheduler->registerTask(self::FILENAME, true); + + // Schedule job to run every 360 minutes + if ($task_id) { + $scheduler->schedulePeriodic($task_id, -120); // negative value means "every x minutes" + } } function down() { // There is no going back from this migration!!! - $db = DBManager::get(); - - $db->query("DELETE FROM config WHERE field = 'OPENCAST_API_TOKEN'"); } } diff --git a/migrations/050_scheduling_cronjob.php b/migrations/050_scheduling_cronjob.php deleted file mode 100644 index 37a6f56b4..000000000 --- a/migrations/050_scheduling_cronjob.php +++ /dev/null @@ -1,69 +0,0 @@ -task_id) { - $scheduler->cancelByTask($task_id); - $scheduler->unregisterTask($task_id); - } - } - - // add video discovery cronjob - if (!$task_id = CronjobTask::findByFilename(self::BASE_DIR . 'opencast_discover_videos.php')[0]->task_id) { - $task_id = $scheduler->registerTask(self::BASE_DIR . 'opencast_discover_videos.php', true); - } - - // add the new cronjobs - if ($task_id) { - $scheduler->cancelByTask($task_id); - $scheduler->schedulePeriodic($task_id, -10); // negative value means "every x minutes" - CronjobSchedule::findByTask_id($task_id)[0]->activate(); - } - - - // add worker cronjob - if (!$task_id = CronjobTask::findByFilename(self::BASE_DIR . 'opencast_worker.php')[0]->task_id) { - $task_id = $scheduler->registerTask(self::BASE_DIR . 'opencast_worker.php', true); - } - - // add the new cronjobs - if ($task_id) { - $scheduler->cancelByTask($task_id); - $scheduler->schedulePeriodic($task_id, -5); // negative value means "every x minutes" - CronjobSchedule::findByTask_id($task_id)[0]->activate(); - } - - // add new scheduling cronjob - $task_id = $scheduler->registerTask(self::FILENAME, true); - - // Schedule job to run every 360 minutes - if ($task_id) { - $scheduler->schedulePeriodic($task_id, -120); // negative value means "every x minutes" - } - } - - function down() { - $scheduler = CronjobScheduler::getInstance(); - - if ($task_id = CronjobTask::findByFilename(self::FILENAME)->task_id) { - $scheduler->unregisterTask($task_id); - } - } -} diff --git a/migrations/076_add_course_date_fields_for_events.php b/migrations/076_add_course_date_fields_for_events.php new file mode 100644 index 000000000..64d3ab58c --- /dev/null +++ b/migrations/076_add_course_date_fields_for_events.php @@ -0,0 +1,31 @@ +query("SHOW COLUMNS FROM `oc_scheduled_recordings` LIKE 'coursedate_start'"); + if (empty($results->fetchAll())) { + $db->exec('ALTER TABLE oc_scheduled_recordings + ADD `coursedate_end` int(11) AFTER `end`, + ADD `coursedate_start` int(11) AFTER `end` + '); + + // update all entries to fill new coursedate-fields + $db->exec('UPDATE oc_scheduled_recordings + SET coursedate_start = start, coursedate_end = end + WHERE 1 + '); + } + } + + public function down() + { + $db->exec('ALTER TABLE oc_scheduled_recordings + DROP `coursedate_end` , + DROP `coursedate_start` + '); + } +} \ No newline at end of file diff --git a/vueapp/components/Config/EditServer.vue b/vueapp/components/Config/EditServer.vue index a13dc7809..7f089f0d0 100644 --- a/vueapp/components/Config/EditServer.vue +++ b/vueapp/components/Config/EditServer.vue @@ -138,13 +138,6 @@ export default { placeholder: 'CONSUMERSECRET', required: true }, - /* { # this option is currently not safe to be used - description: this.$gettext('Soll das Live-Streaming aktiviert werden?'), - name: 'livestream', - value: this.currentConfig.livestream ? this.currentConfig.livestream : false, - type: 'boolean', - required: false - }, */ { description: this.$gettext('Zeitpuffer (in Sekunden) um Überlappungen zu verhindern'), name: 'time_buffer_overlap', diff --git a/vueapp/components/Schedule/ScheduleList.vue b/vueapp/components/Schedule/ScheduleList.vue index 38001fac3..59a03eabe 100644 --- a/vueapp/components/Schedule/ScheduleList.vue +++ b/vueapp/components/Schedule/ScheduleList.vue @@ -131,7 +131,7 @@ export default { }, computed: { - ...mapGetters(["schedule_list", "allow_schedule_alternate", "allow_livestream", "cid", 'schedule_loading']), + ...mapGetters(["schedule_list", "allow_schedule_alternate", "cid", 'schedule_loading']), get_bulk_actions() { let bulk_actions = [ @@ -139,9 +139,6 @@ export default { {value: 'update', text: this.$gettext('Aufzeichnungen aktualisieren')}, {value: 'unschedule', text: this.$gettext('Aufzeichnungen stornieren')}, ]; - if (this.allow_livestream) { - bulk_actions.push({value: 'live', text: this.$gettext('Livestream+Aufzeichnung planen')}); - } return bulk_actions; } @@ -246,7 +243,9 @@ export default { this.$store.dispatch('getScheduleList'); } } else { - this.addMesssage('success', this.$gettext('Die geplante Aufzeichnung wurde entfernt'), true); + if (dispatchAction == 'unschedule') { + this.addMesssage('success', this.$gettext('Die geplante Aufzeichnung wurde entfernt.'), true); + } this.$store.dispatch('getScheduleList'); } }); diff --git a/vueapp/store/schedule.module.js b/vueapp/store/schedule.module.js index 782afcc4d..4301e90a4 100644 --- a/vueapp/store/schedule.module.js +++ b/vueapp/store/schedule.module.js @@ -5,7 +5,6 @@ const state = { semester_list: [], semester_filter: 'all', allow_schedule_alternate: false, - allow_livestream: false, schedule_loading: false } @@ -22,10 +21,6 @@ const getters = { return state.allow_schedule_alternate; }, - allow_livestream(state) { - return state.allow_livestream; - }, - semester_filter() { return state.semester_filter; }, @@ -56,9 +51,6 @@ const actions = { if (data?.allow_schedule_alternate) { context.commit('setAllowAlternate', data.allow_schedule_alternate); } - if (data?.allow_livestream) { - context.commit('setAllowLivestream', data.allow_livestream); - } }).finally(() => { context.commit('setScheduleLoading', false); }); @@ -82,9 +74,7 @@ const actions = { return; } context.commit('setScheduleLoading', true); - return ApiService.post('schedule/' + $cid + '/' + termin_id, { - livestream: true - }).finally(() => { + return ApiService.post('schedule/' + $cid + '/' + termin_id).finally(() => { context.commit('setScheduleLoading', false); }); }, @@ -166,10 +156,6 @@ const mutations = { state.allow_schedule_alternate = allow; }, - setAllowLivestream(state, allow) { - state.allow_livestream = allow; - }, - setSemesterFilter(state, semester_filter) { state.semester_filter = semester_filter; },