',body='";ModalFactory.create({type:ModalFactory.types.SAVE_CANCEL,title:ismassaction?langstrings[10]:langstrings[5],body:body},void 0).then((function(modal){pauseLiveUpdate(liveupdate),modal.setSaveButtonText(langstrings[5]);var root=modal.getRoot();root.on(ModalEvents.save,(function(e){$("#config-frame").is(":visible")?(document.getElementById("config-frame").contentWindow.postMessage("getdata","*"),e.preventDefault()):$("#startWorkflowForm").submit()})),root.on(ModalEvents.hidden,(function(){resumeLiveUpdate(ocinstanceid,contextid,liveupdate),modal.destroy(),resetVideosTableBulkActions()})),modal.show().then((function(){const workflowselect=$("#workflowselect");let workflowid=workflowselect.val();displayWorkflowDescription(workflows[workflowid]),displayWorkflowConfigPanel(ocinstanceid,courseid,workflowid),displayWorkflowPrivacyNotice(privacyworkflows,workflowid),workflowselect.change((function(){let workflowid=$(this).val();displayWorkflowDescription(workflows[workflowid]),displayWorkflowConfigPanel(ocinstanceid,courseid,workflowid),displayWorkflowPrivacyNotice(privacyworkflows,workflowid)}))})).catch(Notification.exception)})).catch(Notification.exception)}))}}(ocinstanceid,courseid,results,contextid,liveupdate),function(ocinstanceid,courseid,langstrings,contextid,liveupdate){$(".report-problem").on("click",(function(e){e.preventDefault();var clickedVideo=$(e.currentTarget);ModalFactory.create({type:ModalFactory.types.SAVE_CANCEL,title:langstrings[0],body:'"}).then((function(modal){pauseLiveUpdate(liveupdate),modal.setSaveButtonText(langstrings[4]);var root=modal.getRoot();root.on(ModalEvents.save,(function(e){$("#inputMessage").val()?$("#reportProblemForm").submit():($("#inputMessage").addClass("is-invalid"),$("#messageValidation").removeClass("d-none")),e.preventDefault()})),root.on(ModalEvents.hidden,(function(){resumeLiveUpdate(ocinstanceid,contextid,liveupdate),modal.destroy()})),modal.show()})).catch(Notification.exception)}))}(ocinstanceid,courseid,results,contextid,liveupdate)})).catch(Notification.exception),window.addEventListener("message",(function(event){"null"===event.origin&&(event.data===parseInt(event.data)?$("#config-frame").height(event.data):($("#configparams").val(event.data),$("#startWorkflowForm").submit()))})),liveupdate.enabled&&initLiveUpdate(ocinstanceid,contextid,liveupdate.timeout),$(".access-link-copytoclipboard").on("click",(function(e){e.preventDefault();var link=e.currentTarget.getAttribute("href");link?navigator.clipboard?navigator.clipboard.writeText(link).then((()=>{str.get_string("directaccess_copy_success","block_opencast").done((function(result){Toast.add(result)})).fail(Notification.exception)})).catch():str.get_string("directaccess_copytoclipboard_unavialable","block_opencast").done((function(result){Toast.add(result,{type:"danger",autohide:!1,closeButton:!0})})).fail(Notification.exception):str.get_string("directaccess_copy_no_link","block_opencast").done((function(result){Toast.add(result,{type:"warning"})})).fail(Notification.exception)}))}}}));
//# sourceMappingURL=block_index.min.js.map
\ No newline at end of file
diff --git a/amd/build/block_index.min.js.map b/amd/build/block_index.min.js.map
index c9713bf5..c5618391 100644
--- a/amd/build/block_index.min.js.map
+++ b/amd/build/block_index.min.js.map
@@ -1 +1 @@
-{"version":3,"file":"block_index.min.js","sources":["../src/block_index.js"],"sourcesContent":["// This file is part of Moodle - http://moodle.org/\n//\n// Moodle is free software: you can redistribute it and/or modify\n// it under the terms of the GNU General Public License as published by\n// the Free Software Foundation, either version 3 of the License, or\n// (at your option) any later version.\n//\n// Moodle is distributed in the hope that it will be useful,\n// but WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n// GNU General Public License for more details.\n//\n// You should have received a copy of the GNU General Public License\n// along with Moodle. If not, see .\n\n/**\n * Javascript to initialise the opencast block.\n *\n * @module block_opencast\n * @copyright 2021 Tamara Gunkel, University of Münster\n * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later\n */\n\ndefine(['jquery', 'core/modal_factory', 'core/modal_events',\n 'core/str', 'core/url', 'core/notification', 'core/toast', 'core/ajax'],\n function($, ModalFactory, ModalEvents, str, url, Notification, Toast, Ajax) {\n /**\n * Instantiate the window variable in order to work with Intervals\n *\n */\n window.liveUpdateInterval = null;\n window.liveUpdateItemsWithError = [];\n window.liveUpdateState = null;\n\n var pauseLiveUpdate = function(liveupdate) {\n if (!liveupdate.enabled) {\n return;\n }\n if (window.liveUpdateInterval !== null) {\n clearInterval(window.liveUpdateInterval);\n window.liveUpdateState = 'paused';\n }\n };\n\n var resumeLiveUpdate = function(ocinstanceid, contextid, liveupdate) {\n if (!liveupdate.enabled) {\n return;\n }\n if (window.liveUpdateState == 'paused') {\n initLiveUpdate(ocinstanceid, contextid, liveupdate.timeout);\n window.liveUpdateState = 'resumed';\n }\n };\n\n var initWorkflowModal = function(ocinstanceid, courseid, langstrings, contextid, liveupdate) {\n if (document.getElementById('workflowsjson')) {\n var workflows = JSON.parse($('#workflowsjson').text());\n var privacyinfohtml = null;\n var privacytitle = null;\n var privacyworkflows = null;\n var hasprivacyinfo = false;\n if (document.getElementById('workflowprivacynotice')) {\n hasprivacyinfo = true;\n privacyinfohtml = $('#swprivacynoticeinfotext').html();\n privacytitle = $('#swprivacynoticetitle').text();\n privacyworkflows = JSON.parse($('#swprivacynoticewfds').text());\n }\n\n $('.start-workflow').on('click', function(e) {\n e.preventDefault();\n var clickedVideo = $(e.currentTarget);\n var select = '';\n\n var privacynoticediv = '';\n if (hasprivacyinfo) {\n privacynoticediv = '
';\n\n var body = '';\n\n ModalFactory.create({\n type: ModalFactory.types.SAVE_CANCEL,\n title: langstrings[5],\n body: body\n }, undefined)\n .then(function(modal) {\n // Pause the live update if it is running.\n pauseLiveUpdate(liveupdate);\n modal.setSaveButtonText(langstrings[5]);\n var root = modal.getRoot();\n root.on(ModalEvents.save, function(e) {\n // Handle form submission after receiving data, if the workflow has config panel.\n if ($('#config-frame').is(':visible')) {\n document.getElementById('config-frame').contentWindow.postMessage('getdata', '*');\n e.preventDefault();\n } else {\n // If the workflow has no config panel, we submit it directly.\n $('#startWorkflowForm').submit();\n }\n });\n root.on(ModalEvents.hidden, function() {\n // Resume the live update if it was paused.\n resumeLiveUpdate(ocinstanceid, contextid, liveupdate);\n // Destroy when hidden/closed.\n modal.destroy();\n });\n\n // Show description for initial value.\n modal.show().then(function() {\n const workflowselect = $('#workflowselect');\n let workflowid = workflowselect.val();\n displayWorkflowDescription(workflows[workflowid]);\n displayWorkflowConfigPanel(ocinstanceid, courseid, workflowid);\n // The first time to check if the privacy notice must be displayed.\n displayWorkflowPrivacyNotice(privacyworkflows, workflowid);\n\n // Show workflow description when selected.\n workflowselect.change(function() {\n let workflowid = $(this).val();\n displayWorkflowDescription(workflows[workflowid]);\n displayWorkflowConfigPanel(ocinstanceid, courseid, workflowid);\n // After each change, check if the selected workflow has to be displayed.\n displayWorkflowPrivacyNotice(privacyworkflows, workflowid);\n });\n return;\n }).catch(Notification.exception);\n return;\n }).catch(Notification.exception);\n });\n }\n };\n\n /**\n * Helper function to display the privacy notice in workflow modal dialog.\n * @param {Array} privacyworkflows an array list of workflows to display privacy notice for.\n * @param {string} workflowid workflow def id\n */\n var displayWorkflowPrivacyNotice = function(privacyworkflows, workflowid) {\n if (Array.isArray(privacyworkflows) && (privacyworkflows.length === 0 || privacyworkflows.includes(workflowid))) {\n $('#privacynoticediv').removeClass('d-none');\n } else {\n $('#privacynoticediv').addClass('d-none');\n }\n };\n\n /**\n * Helper function to display the description of the workflow.\n * @param {Object} workflowobj the workflow object\n */\n var displayWorkflowDescription = function(workflowobj) {\n if (workflowobj?.description) {\n $('#workflowdescdiv').removeClass('d-none');\n $('#workflowdesc').html(workflowobj.description);\n } else {\n $('#workflowdescdiv').addClass('d-none');\n }\n };\n\n /**\n * Helper function to display Workflow configurration panel.\n * @param {string} ocinstanceid oc instance id\n * @param {string} courseid course id\n * @param {string} workflowid workflow def id\n */\n var displayWorkflowConfigPanel = function(ocinstanceid, courseid, workflowid) {\n $('#workflowconfigpaneldiv').addClass('d-none');\n $('#workflowconfigpanelloading').removeClass('d-none');\n $('#config-frame').attr('src', '');\n var configpanelsrc = url.relativeUrl('blocks/opencast/serveworkflowconfigpanel.php', {\n 'ocinstanceid': ocinstanceid,\n 'courseid': courseid,\n 'workflowid': workflowid\n });\n $.ajax({\n url: configpanelsrc,\n success: (data) => {\n if (data.trim() !== '') {\n $('#workflowconfigpaneldiv').removeClass('d-none');\n $('#config-frame').attr('src', configpanelsrc);\n }\n },\n async: false\n });\n };\n\n var initReportModal = function(ocinstanceid, courseid, langstrings, contextid, liveupdate) {\n $('.report-problem').on('click', function(e) {\n e.preventDefault();\n var clickedVideo = $(e.currentTarget);\n ModalFactory.create({\n type: ModalFactory.types.SAVE_CANCEL,\n title: langstrings[0],\n body: ''\n })\n .then(function(modal) {\n // Pause the live update if it is running.\n pauseLiveUpdate(liveupdate);\n modal.setSaveButtonText(langstrings[4]);\n var root = modal.getRoot();\n root.on(ModalEvents.save, function(e) {\n if ($('#inputMessage').val()) {\n $('#reportProblemForm').submit();\n } else {\n $('#inputMessage').addClass('is-invalid');\n $('#messageValidation').removeClass('d-none');\n }\n e.preventDefault();\n });\n root.on(ModalEvents.hidden, function() {\n // Resume the live update if it was paused.\n resumeLiveUpdate(ocinstanceid, contextid, liveupdate);\n // Destroy when hidden/closed.\n modal.destroy();\n });\n modal.show();\n return;\n }).catch(Notification.exception);\n });\n };\n\n /*\n * Initialise the status live update in the overview page.\n */\n var initLiveUpdate = function(ocinstanceid, contextid, reloadtimeout) {\n if (window.liveUpdateInterval !== null) {\n clearInterval(window.liveUpdateInterval);\n }\n window.liveUpdateItemsWithError = [];\n var items = getLiveUpdateItems();\n if (items.length) {\n window.liveUpdateInterval = setInterval(function() {\n var processingItems = getLiveUpdateProcessingItems();\n var uploadingItems = getLiveUpdateUploadingItems();\n if (processingItems.length == 0 && uploadingItems.length == 0) {\n clearInterval(window.liveUpdateInterval);\n if (window.liveUpdateItemsWithError.length > 0) {\n var titles = window.liveUpdateItemsWithError.join('
');\n str.get_string('liveupdate_fail_notification_message', 'block_opencast', titles)\n .done(function(result) {\n Notification.addNotification({\n message: result,\n type: 'error'\n });\n })\n .fail(Notification.exception);\n }\n return;\n }\n for (var processingItem of processingItems) {\n liveUpdatePerformAjax('processing', ocinstanceid, contextid, processingItem, reloadtimeout);\n }\n for (var uploadingItem of uploadingItems) {\n liveUpdatePerformAjax('uploading', ocinstanceid, contextid, uploadingItem, reloadtimeout);\n }\n }, 5000, ocinstanceid, contextid, url, reloadtimeout);\n }\n };\n\n /*\n * Gets all status live updates items (flags).\n */\n var getLiveUpdateItems = function() {\n var processingItems = getLiveUpdateProcessingItems();\n var uploadingItems = getLiveUpdateUploadingItems();\n return processingItems.concat(uploadingItems);\n };\n\n /*\n * Gets all status live updates items for Processing states.\n */\n var getLiveUpdateProcessingItems = function() {\n var itemsNodeList = document.getElementsByName('liveupdate_processing_item');\n return Array.from(itemsNodeList);\n };\n\n /*\n * Gets all status live updates items for uploading status.\n */\n var getLiveUpdateUploadingItems = function() {\n var itemsNodeList = document.getElementsByName('liveupdate_uploading_item');\n return Array.from(itemsNodeList);\n };\n\n /*\n * Perform status live update Ajax call to the backend to get the related info.\n */\n var liveUpdatePerformAjax = function(type, ocinstanceid, contextid, item, reloadtimeout) {\n var identifier = item.value;\n var title = item?.dataset?.title ? item.dataset.title : '';\n if (identifier == undefined || title == '') {\n window.liveUpdateItemsWithError.push(title);\n item.remove();\n return;\n }\n Ajax.call([{\n methodname: 'block_opencast_get_liveupdate_info',\n args: {contextid: contextid, ocinstanceid: ocinstanceid, type: type, identifier: identifier},\n done: function(status) {\n if (status == '') {\n window.liveUpdateItemsWithError.push(title);\n item.remove();\n return;\n }\n var statusObject = JSON.parse(status);\n if (statusObject.replace != '') {\n replaceLiveUpdateInfo(item, statusObject.replace);\n }\n if (statusObject.remove == true) {\n item.remove();\n var stringparams = {\n timeout: reloadtimeout,\n title: title\n };\n str.get_string('liveupdate_toast_notification', 'block_opencast', stringparams)\n .done(function(result) {\n Toast.add(result);\n })\n .fail(Notification.exception);\n setTimeout(function() {\n window.location.reload();\n }, reloadtimeout * 1000);\n }\n },\n fail: function() {\n window.liveUpdateItemsWithError.push(title);\n item.remove();\n }\n }]);\n };\n\n /*\n * Replace the new live update status with the current one for both text and DOM element.\n */\n var replaceLiveUpdateInfo = function(item, replace) {\n if (item == undefined || replace == '' || typeof replace != 'string') {\n return;\n }\n var newDiv = document.createElement('div');\n newDiv.innerHTML = replace.trim();\n var replaceElm = newDiv.firstChild;\n if (replaceElm.nodeName == '#text') {\n var prevText = item.parentNode.firstChild;\n prevText.remove();\n var newText = document.createTextNode(replace.trim());\n item.parentNode.insertBefore(newText, item);\n } else if (item.previousElementSibling) {\n var prevElm = item.previousElementSibling;\n newDiv.innerHTML = replace.trim();\n if (!areElementsEqual(replaceElm, prevElm)) {\n prevElm.remove();\n item.parentNode.insertBefore(replaceElm, item);\n }\n }\n };\n\n /*\n * Checks if the liev update DOM elements (new vs old) are equal.\n */\n var areElementsEqual = function(baseElm, checkElm) {\n var isEqual = true;\n var attributes = baseElm.getAttributeNames();\n for (var attributeName of attributes) {\n var baseAttributeValue = baseElm.getAttribute(attributeName).trim();\n var checkAttributeValue = '';\n if (checkElm.hasAttribute(attributeName)) {\n checkAttributeValue = checkElm.getAttribute(attributeName).trim();\n }\n if (checkAttributeValue == '') {\n continue;\n }\n if (checkAttributeValue != baseAttributeValue) {\n isEqual = false;\n }\n }\n return isEqual;\n };\n\n /*\n * Copies the direct access link into the clipboard.\n */\n var initCopyAccessLinkToClipboard = function() {\n $('.access-link-copytoclipboard').on('click', function(e) {\n e.preventDefault();\n var element = e.currentTarget;\n var link = element.getAttribute('href');\n if (!link) {\n str.get_string('directaccess_copy_no_link', 'block_opencast')\n .done(function(result) {\n Toast.add(result, {type: 'warning'});\n })\n .fail(Notification.exception);\n return;\n }\n\n if (navigator.clipboard) {\n navigator.clipboard.writeText(link)\n .then(() => {\n str.get_string('directaccess_copy_success', 'block_opencast')\n .done(function(result) {\n Toast.add(result);\n })\n .fail(Notification.exception);\n return;\n }).catch();\n return;\n } else {\n str.get_string('directaccess_copytoclipboard_unavialable', 'block_opencast')\n .done(function(result) {\n Toast.add(result, {type: 'danger', autohide: false, closeButton: true});\n })\n .fail(Notification.exception);\n }\n });\n };\n\n /*\n * Initialise all of the modules for the opencast block.\n */\n var init = function(courseid, ocinstanceid, contextid, liveupdate) {\n // Load strings\n var strings = [\n {\n key: 'reportproblem_modal_title',\n component: 'block_opencast'\n },\n {\n key: 'reportproblem_modal_body',\n component: 'block_opencast'\n },\n {\n key: 'reportproblem_modal_placeholder',\n component: 'block_opencast'\n },\n {\n key: 'reportproblem_modal_required',\n component: 'block_opencast'\n },\n {\n key: 'reportproblem_modal_submit',\n component: 'block_opencast'\n },\n {\n key: 'startworkflow',\n component: 'block_opencast'\n },\n {\n key: 'startworkflow_modal_body',\n component: 'block_opencast'\n },\n {\n key: 'startworkflow_modal_description_title',\n component: 'block_opencast'\n },\n {\n key: 'startworkflow_modal_configpanel_title',\n component: 'block_opencast'\n }\n ];\n str.get_strings(strings).then(function(results) {\n initWorkflowModal(ocinstanceid, courseid, results, contextid, liveupdate);\n initReportModal(ocinstanceid, courseid, results, contextid, liveupdate);\n return;\n }).catch(Notification.exception);\n window.addEventListener('message', function(event) {\n if (event.origin !== \"null\") {\n return;\n }\n\n if (event.data === parseInt(event.data)) {\n $('#config-frame').height(event.data);\n } else {\n $('#configparams').val(event.data);\n $('#startWorkflowForm').submit();\n }\n });\n if (liveupdate.enabled) {\n initLiveUpdate(ocinstanceid, contextid, liveupdate.timeout);\n }\n initCopyAccessLinkToClipboard();\n };\n\n return {\n init: init\n };\n });\n\n"],"names":["define","$","ModalFactory","ModalEvents","str","url","Notification","Toast","Ajax","window","liveUpdateInterval","liveUpdateItemsWithError","liveUpdateState","pauseLiveUpdate","liveupdate","enabled","clearInterval","resumeLiveUpdate","ocinstanceid","contextid","initLiveUpdate","timeout","displayWorkflowPrivacyNotice","privacyworkflows","workflowid","Array","isArray","length","includes","removeClass","addClass","displayWorkflowDescription","workflowobj","description","html","displayWorkflowConfigPanel","courseid","attr","configpanelsrc","relativeUrl","ajax","success","data","trim","async","reloadtimeout","getLiveUpdateItems","setInterval","processingItems","getLiveUpdateProcessingItems","uploadingItems","getLiveUpdateUploadingItems","processingItem","liveUpdatePerformAjax","uploadingItem","titles","join","get_string","done","result","addNotification","message","type","fail","exception","concat","itemsNodeList","document","getElementsByName","from","item","identifier","value","title","dataset","undefined","push","remove","call","methodname","args","status","statusObject","JSON","parse","replace","replaceLiveUpdateInfo","stringparams","add","setTimeout","location","reload","newDiv","createElement","innerHTML","replaceElm","firstChild","nodeName","parentNode","newText","createTextNode","insertBefore","previousElementSibling","prevElm","areElementsEqual","baseElm","checkElm","isEqual","attributes","getAttributeNames","attributeName","baseAttributeValue","getAttribute","checkAttributeValue","hasAttribute","init","get_strings","key","component","then","results","langstrings","getElementById","workflows","text","privacyinfohtml","privacytitle","hasprivacyinfo","on","e","preventDefault","clickedVideo","currentTarget","select","workflow","privacynoticediv","workflowdescdiv","workflowconfigpaneldiv","body","create","types","SAVE_CANCEL","modal","setSaveButtonText","root","getRoot","save","is","contentWindow","postMessage","submit","hidden","destroy","show","workflowselect","val","change","this","catch","initWorkflowModal","initReportModal","addEventListener","event","origin","parseInt","height","link","navigator","clipboard","writeText","autohide","closeButton"],"mappings":";;;;;;;AAuBAA,oCAAO,CAAC,SAAU,qBAAsB,oBACpC,WAAY,WAAY,oBAAqB,aAAc,cAC3D,SAASC,EAAGC,aAAcC,YAAaC,IAAKC,IAAKC,aAAcC,MAAOC,MAKlEC,OAAOC,mBAAqB,KAC5BD,OAAOE,yBAA2B,GAClCF,OAAOG,gBAAkB,SAErBC,gBAAkB,SAASC,YACtBA,WAAWC,SAGkB,OAA9BN,OAAOC,qBACPM,cAAcP,OAAOC,oBACrBD,OAAOG,gBAAkB,WAI7BK,iBAAmB,SAASC,aAAcC,UAAWL,YAChDA,WAAWC,SAGc,UAA1BN,OAAOG,kBACPQ,eAAeF,aAAcC,UAAWL,WAAWO,SACnDZ,OAAOG,gBAAkB,YAqH7BU,6BAA+B,SAASC,iBAAkBC,YACtDC,MAAMC,QAAQH,oBAAkD,IAA5BA,iBAAiBI,QAAgBJ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iBoK,OAAOH,MAAMxH,OAEhCzC,EAAE,iBAAiB0J,IAAIO,MAAMxH,MAC7BzC,EAAE,sBAAsBqJ,cAG5BxI,WAAWC,SACXK,eAAeF,aAAcC,UAAWL,WAAWO,SA/FvDpB,EAAE,gCAAgC+H,GAAG,SAAS,SAASC,GACnDA,EAAEC,qBAEEoC,KADUrC,EAAEG,cACGpB,aAAa,QAC3BsD,KASDC,UAAUC,UACVD,UAAUC,UAAUC,UAAUH,MAC7B/C,MAAK,KACFnH,IAAIqD,WAAW,4BAA6B,kBACvCC,MAAK,SAASC,QACXpD,MAAMiF,IAAI7B,WAEbI,KAAKzD,aAAa0D,cAExB8F,QAGH1J,IAAIqD,WAAW,2CAA4C,kBACtDC,MAAK,SAASC,QACXpD,MAAMiF,IAAI7B,OAAQ,CAACG,KAAM,SAAU4G,UAAU,EAAOC,aAAa,OAEpE5G,KAAKzD,aAAa0D,WAxBvB5D,IAAIqD,WAAW,4BAA6B,kBACvCC,MAAK,SAASC,QACXpD,MAAMiF,IAAI7B,OAAQ,CAACG,KAAM,eAE5BC,KAAKzD,aAAa0D"}
\ No newline at end of file
+{"version":3,"file":"block_index.min.js","sources":["../src/block_index.js"],"sourcesContent":["// This file is part of Moodle - http://moodle.org/\n//\n// Moodle is free software: you can redistribute it and/or modify\n// it under the terms of the GNU General Public License as published by\n// the Free Software Foundation, either version 3 of the License, or\n// (at your option) any later version.\n//\n// Moodle is distributed in the hope that it will be useful,\n// but WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n// GNU General Public License for more details.\n//\n// You should have received a copy of the GNU General Public License\n// along with Moodle. If not, see .\n\n/**\n * Javascript to initialise the opencast block.\n *\n * @module block_opencast\n * @copyright 2021 Tamara Gunkel, University of Münster\n * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later\n */\n\ndefine(['jquery', 'core/modal_factory', 'core/modal_events',\n 'core/str', 'core/url', 'core/notification', 'core/toast', 'core/ajax'],\n function($, ModalFactory, ModalEvents, str, url, Notification, Toast, Ajax) {\n /**\n * Instantiate the window variable in order to work with Intervals\n *\n */\n window.liveUpdateInterval = null;\n window.liveUpdateItemsWithError = [];\n window.liveUpdateState = null;\n\n var pauseLiveUpdate = function(liveupdate) {\n if (!liveupdate.enabled) {\n return;\n }\n if (window.liveUpdateInterval !== null) {\n clearInterval(window.liveUpdateInterval);\n window.liveUpdateState = 'paused';\n }\n };\n\n var resumeLiveUpdate = function(ocinstanceid, contextid, liveupdate) {\n if (!liveupdate.enabled) {\n return;\n }\n if (window.liveUpdateState == 'paused') {\n initLiveUpdate(ocinstanceid, contextid, liveupdate.timeout);\n window.liveUpdateState = 'resumed';\n }\n };\n\n var initWorkflowModal = function(ocinstanceid, courseid, langstrings, contextid, liveupdate) {\n if (document.getElementById('workflowsjson')) {\n var workflows = JSON.parse($('#workflowsjson').text());\n var privacyinfohtml = null;\n var privacytitle = null;\n var privacyworkflows = null;\n var hasprivacyinfo = false;\n if (document.getElementById('workflowprivacynotice')) {\n hasprivacyinfo = true;\n privacyinfohtml = $('#swprivacynoticeinfotext').html();\n privacytitle = $('#swprivacynoticetitle').text();\n privacyworkflows = JSON.parse($('#swprivacynoticewfds').text());\n }\n\n $('.start-workflow').on('click', function(e) {\n e.preventDefault();\n const detail = e?.detail || {};\n\n var clickedVideo = $(e.currentTarget);\n var actionurl = url.relativeUrl('blocks/opencast/startworkflow.php', {\n 'ocinstanceid': ocinstanceid,\n 'courseid': courseid,\n 'videoid': clickedVideo.data('id')\n });\n var ismassaction = false;\n var bulkinfodiv = '';\n if (detail?.type === 'bulk' && detail?.selectedids) {\n ismassaction = true;\n bulkinfodiv = '
';\n\n var body = '';\n\n ModalFactory.create({\n type: ModalFactory.types.SAVE_CANCEL,\n title: ismassaction ? langstrings[10] : langstrings[5],\n body: body\n }, undefined)\n .then(function(modal) {\n // Pause the live update if it is running.\n pauseLiveUpdate(liveupdate);\n modal.setSaveButtonText(langstrings[5]);\n var root = modal.getRoot();\n root.on(ModalEvents.save, function(e) {\n // Handle form submission after receiving data, if the workflow has config panel.\n if ($('#config-frame').is(':visible')) {\n document.getElementById('config-frame').contentWindow.postMessage('getdata', '*');\n e.preventDefault();\n } else {\n // If the workflow has no config panel, we submit it directly.\n $('#startWorkflowForm').submit();\n }\n });\n root.on(ModalEvents.hidden, function() {\n // Resume the live update if it was paused.\n resumeLiveUpdate(ocinstanceid, contextid, liveupdate);\n // Destroy when hidden/closed.\n modal.destroy();\n // Change the bulk action select back to choose...\n resetVideosTableBulkActions();\n });\n\n // Show description for initial value.\n modal.show().then(function() {\n const workflowselect = $('#workflowselect');\n let workflowid = workflowselect.val();\n displayWorkflowDescription(workflows[workflowid]);\n displayWorkflowConfigPanel(ocinstanceid, courseid, workflowid);\n // The first time to check if the privacy notice must be displayed.\n displayWorkflowPrivacyNotice(privacyworkflows, workflowid);\n\n // Show workflow description when selected.\n workflowselect.change(function() {\n let workflowid = $(this).val();\n displayWorkflowDescription(workflows[workflowid]);\n displayWorkflowConfigPanel(ocinstanceid, courseid, workflowid);\n // After each change, check if the selected workflow has to be displayed.\n displayWorkflowPrivacyNotice(privacyworkflows, workflowid);\n });\n return;\n }).catch(Notification.exception);\n return;\n }).catch(Notification.exception);\n });\n }\n };\n\n /**\n * Helper function to display the privacy notice in workflow modal dialog.\n * @param {Array} privacyworkflows an array list of workflows to display privacy notice for.\n * @param {string} workflowid workflow def id\n */\n var displayWorkflowPrivacyNotice = function(privacyworkflows, workflowid) {\n if (Array.isArray(privacyworkflows) && (privacyworkflows.length === 0 || privacyworkflows.includes(workflowid))) {\n $('#privacynoticediv').removeClass('d-none');\n } else {\n $('#privacynoticediv').addClass('d-none');\n }\n };\n\n /**\n * Helper function to display the description of the workflow.\n * @param {Object} workflowobj the workflow object\n */\n var displayWorkflowDescription = function(workflowobj) {\n if (workflowobj?.description) {\n $('#workflowdescdiv').removeClass('d-none');\n $('#workflowdesc').html(workflowobj.description);\n } else {\n $('#workflowdescdiv').addClass('d-none');\n }\n };\n\n /**\n * Helper function to display Workflow configurration panel.\n * @param {string} ocinstanceid oc instance id\n * @param {string} courseid course id\n * @param {string} workflowid workflow def id\n */\n var displayWorkflowConfigPanel = function(ocinstanceid, courseid, workflowid) {\n $('#workflowconfigpaneldiv').addClass('d-none');\n $('#workflowconfigpanelloading').removeClass('d-none');\n $('#config-frame').attr('src', '');\n var configpanelsrc = url.relativeUrl('blocks/opencast/serveworkflowconfigpanel.php', {\n 'ocinstanceid': ocinstanceid,\n 'courseid': courseid,\n 'workflowid': workflowid\n });\n $.ajax({\n url: configpanelsrc,\n success: (data) => {\n if (data.trim() !== '') {\n $('#workflowconfigpaneldiv').removeClass('d-none');\n $('#config-frame').attr('src', configpanelsrc);\n }\n },\n async: false\n });\n };\n\n var initReportModal = function(ocinstanceid, courseid, langstrings, contextid, liveupdate) {\n $('.report-problem').on('click', function(e) {\n e.preventDefault();\n var clickedVideo = $(e.currentTarget);\n ModalFactory.create({\n type: ModalFactory.types.SAVE_CANCEL,\n title: langstrings[0],\n body: ''\n })\n .then(function(modal) {\n // Pause the live update if it is running.\n pauseLiveUpdate(liveupdate);\n modal.setSaveButtonText(langstrings[4]);\n var root = modal.getRoot();\n root.on(ModalEvents.save, function(e) {\n if ($('#inputMessage').val()) {\n $('#reportProblemForm').submit();\n } else {\n $('#inputMessage').addClass('is-invalid');\n $('#messageValidation').removeClass('d-none');\n }\n e.preventDefault();\n });\n root.on(ModalEvents.hidden, function() {\n // Resume the live update if it was paused.\n resumeLiveUpdate(ocinstanceid, contextid, liveupdate);\n // Destroy when hidden/closed.\n modal.destroy();\n });\n modal.show();\n return;\n }).catch(Notification.exception);\n });\n };\n\n /*\n * Initialise the status live update in the overview page.\n */\n var initLiveUpdate = function(ocinstanceid, contextid, reloadtimeout) {\n if (window.liveUpdateInterval !== null) {\n clearInterval(window.liveUpdateInterval);\n }\n window.liveUpdateItemsWithError = [];\n var items = getLiveUpdateItems();\n if (items.length) {\n window.liveUpdateInterval = setInterval(function() {\n // Adding the state checker here, in order to pause the live update from other js modules like block_massaction.\n if (window.liveUpdateState === 'paused') {\n return;\n }\n var processingItems = getLiveUpdateProcessingItems();\n var uploadingItems = getLiveUpdateUploadingItems();\n if (processingItems.length == 0 && uploadingItems.length == 0) {\n clearInterval(window.liveUpdateInterval);\n if (window.liveUpdateItemsWithError.length > 0) {\n var titles = window.liveUpdateItemsWithError.join('
');\n str.get_string('liveupdate_fail_notification_message', 'block_opencast', titles)\n .done(function(result) {\n Notification.addNotification({\n message: result,\n type: 'error'\n });\n })\n .fail(Notification.exception);\n }\n return;\n }\n for (var processingItem of processingItems) {\n liveUpdatePerformAjax('processing', ocinstanceid, contextid, processingItem, reloadtimeout);\n }\n for (var uploadingItem of uploadingItems) {\n liveUpdatePerformAjax('uploading', ocinstanceid, contextid, uploadingItem, reloadtimeout);\n }\n }, 5000, ocinstanceid, contextid, url, reloadtimeout);\n }\n };\n\n /*\n * Gets all status live updates items (flags).\n */\n var getLiveUpdateItems = function() {\n var processingItems = getLiveUpdateProcessingItems();\n var uploadingItems = getLiveUpdateUploadingItems();\n return processingItems.concat(uploadingItems);\n };\n\n /*\n * Gets all status live updates items for Processing states.\n */\n var getLiveUpdateProcessingItems = function() {\n var itemsNodeList = document.getElementsByName('liveupdate_processing_item');\n return Array.from(itemsNodeList);\n };\n\n /*\n * Gets all status live updates items for uploading status.\n */\n var getLiveUpdateUploadingItems = function() {\n var itemsNodeList = document.getElementsByName('liveupdate_uploading_item');\n return Array.from(itemsNodeList);\n };\n\n /*\n * Perform status live update Ajax call to the backend to get the related info.\n */\n var liveUpdatePerformAjax = function(type, ocinstanceid, contextid, item, reloadtimeout) {\n var identifier = item.value;\n var title = item?.dataset?.title ? item.dataset.title : '';\n if (identifier == undefined || title == '') {\n window.liveUpdateItemsWithError.push(title);\n item.remove();\n return;\n }\n Ajax.call([{\n methodname: 'block_opencast_get_liveupdate_info',\n args: {contextid: contextid, ocinstanceid: ocinstanceid, type: type, identifier: identifier},\n done: function(status) {\n if (status == '') {\n window.liveUpdateItemsWithError.push(title);\n item.remove();\n return;\n }\n var statusObject = JSON.parse(status);\n if (statusObject.replace != '') {\n replaceLiveUpdateInfo(item, statusObject.replace);\n }\n if (statusObject.remove == true) {\n item.remove();\n var stringparams = {\n timeout: reloadtimeout,\n title: title\n };\n str.get_string('liveupdate_toast_notification', 'block_opencast', stringparams)\n .done(function(result) {\n Toast.add(result);\n })\n .fail(Notification.exception);\n setTimeout(function() {\n window.location.reload();\n }, reloadtimeout * 1000);\n }\n },\n fail: function() {\n window.liveUpdateItemsWithError.push(title);\n item.remove();\n }\n }]);\n };\n\n /*\n * Replace the new live update status with the current one for both text and DOM element.\n */\n var replaceLiveUpdateInfo = function(item, replace) {\n if (item == undefined || replace == '' || typeof replace != 'string') {\n return;\n }\n var newDiv = document.createElement('div');\n newDiv.innerHTML = replace.trim();\n var replaceElm = newDiv.firstChild;\n if (replaceElm.nodeName == '#text') {\n var prevText = item.parentNode.firstChild;\n prevText.remove();\n var newText = document.createTextNode(replace.trim());\n item.parentNode.insertBefore(newText, item);\n } else if (item.previousElementSibling) {\n var prevElm = item.previousElementSibling;\n newDiv.innerHTML = replace.trim();\n if (!areElementsEqual(replaceElm, prevElm)) {\n prevElm.remove();\n item.parentNode.insertBefore(replaceElm, item);\n }\n }\n };\n\n /*\n * Checks if the liev update DOM elements (new vs old) are equal.\n */\n var areElementsEqual = function(baseElm, checkElm) {\n var isEqual = true;\n var attributes = baseElm.getAttributeNames();\n for (var attributeName of attributes) {\n var baseAttributeValue = baseElm.getAttribute(attributeName).trim();\n var checkAttributeValue = '';\n if (checkElm.hasAttribute(attributeName)) {\n checkAttributeValue = checkElm.getAttribute(attributeName).trim();\n }\n if (checkAttributeValue == '') {\n continue;\n }\n if (checkAttributeValue != baseAttributeValue) {\n isEqual = false;\n }\n }\n return isEqual;\n };\n\n /*\n * Copies the direct access link into the clipboard.\n */\n var initCopyAccessLinkToClipboard = function() {\n $('.access-link-copytoclipboard').on('click', function(e) {\n e.preventDefault();\n var element = e.currentTarget;\n var link = element.getAttribute('href');\n if (!link) {\n str.get_string('directaccess_copy_no_link', 'block_opencast')\n .done(function(result) {\n Toast.add(result, {type: 'warning'});\n })\n .fail(Notification.exception);\n return;\n }\n\n if (navigator.clipboard) {\n navigator.clipboard.writeText(link)\n .then(() => {\n str.get_string('directaccess_copy_success', 'block_opencast')\n .done(function(result) {\n Toast.add(result);\n })\n .fail(Notification.exception);\n return;\n }).catch();\n return;\n } else {\n str.get_string('directaccess_copytoclipboard_unavialable', 'block_opencast')\n .done(function(result) {\n Toast.add(result, {type: 'danger', autohide: false, closeButton: true});\n })\n .fail(Notification.exception);\n }\n });\n };\n\n /*\n * Resets the bulk action select dropdowns and unchecks the select items.\n */\n var resetVideosTableBulkActions = function () {\n $('.opencast-videos-table-massactions').val('');\n $('.opencast-videos-table-massactions').attr('disabled', true);\n $('input.opencast-videos-selectall, input.opencast-video-select').prop('checked', false);\n };\n\n /*\n * Initialise all of the modules for the opencast block.\n */\n var init = function(courseid, ocinstanceid, contextid, liveupdate) {\n // Load strings\n var strings = [\n {\n key: 'reportproblem_modal_title',\n component: 'block_opencast'\n },\n {\n key: 'reportproblem_modal_body',\n component: 'block_opencast'\n },\n {\n key: 'reportproblem_modal_placeholder',\n component: 'block_opencast'\n },\n {\n key: 'reportproblem_modal_required',\n component: 'block_opencast'\n },\n {\n key: 'reportproblem_modal_submit',\n component: 'block_opencast'\n },\n {\n key: 'startworkflow',\n component: 'block_opencast'\n },\n {\n key: 'startworkflow_modal_body',\n component: 'block_opencast'\n },\n {\n key: 'startworkflow_modal_description_title',\n component: 'block_opencast'\n },\n {\n key: 'startworkflow_modal_configpanel_title',\n component: 'block_opencast'\n },\n {\n key: 'videostable_massaction_startworkflow_modal_body',\n component: 'block_opencast'\n },\n {\n key: 'videostable_massaction_startworkflow_modal_title',\n component: 'block_opencast'\n }\n ];\n str.get_strings(strings).then(function(results) {\n initWorkflowModal(ocinstanceid, courseid, results, contextid, liveupdate);\n initReportModal(ocinstanceid, courseid, results, contextid, liveupdate);\n return;\n }).catch(Notification.exception);\n window.addEventListener('message', function(event) {\n if (event.origin !== \"null\") {\n return;\n }\n\n if (event.data === parseInt(event.data)) {\n $('#config-frame').height(event.data);\n } else {\n $('#configparams').val(event.data);\n $('#startWorkflowForm').submit();\n }\n });\n if (liveupdate.enabled) {\n initLiveUpdate(ocinstanceid, contextid, liveupdate.timeout);\n }\n initCopyAccessLinkToClipboard();\n };\n\n return {\n init: init\n };\n });\n\n"],"names":["define","$","ModalFactory","ModalEvents","str","url","Notification","Toast","Ajax","window","liveUpdateInterval","liveUpdateItemsWithError","liveUpdateState","pauseLiveUpdate","liveupdate","enabled","clearInterval","resumeLiveUpdate","ocinstanceid","contextid","initLiveUpdate","timeout","displayWorkflowPrivacyNotice","privacyworkflows","workflowid","Array","isArray","length","includes","removeClass","addClass","displayWorkflowDescription","workflowobj","description","html","displayWorkflowConfigPanel","courseid","attr","configpanelsrc","relativeUrl","ajax","success","data","trim","async","reloadtimeout","getLiveUpdateItems","setInterval","processingItems","getLiveUpdateProcessingItems","uploadingItems","getLiveUpdateUploadingItems","processingItem","liveUpdatePerformAjax","uploadingItem","titles","join","get_string","done","result","addNotification","message","type","fail","exception","concat","itemsNodeList","document","getElementsByName","from","item","identifier","value","title","dataset","undefined","push","remove","call","methodname","args","status","statusObject","JSON","parse","replace","replaceLiveUpdateInfo","stringparams","add","setTimeout","location","reload","newDiv","createElement","innerHTML","replaceElm","firstChild","nodeName","parentNode","newText","createTextNode","insertBefore","previousElementSibling","prevElm","areElementsEqual","baseElm","checkElm","isEqual","attributes","getAttributeNames","attributeName","baseAttributeValue","getAttribute","checkAttributeValue","hasAttribute","resetVideosTableBulkActions","val","prop","init","get_strings","key","component","then","results","langstrings","getElementById","workflows","text","privacyinfohtml","privacytitle","hasprivacyinfo","on","e","preventDefault","detail","clickedVideo","currentTarget","actionurl","ismassaction","bulkinfodiv","selectedids","selectedtitles","videoid","select","workflow","privacynoticediv","workflowdescdiv","workflowconfigpaneldiv","body","create","types","SAVE_CANCEL","modal","setSaveButtonText","root","getRoot","save","is","contentWindow","postMessage","submit","hidden","destroy","show","workflowselect","change","this","catch","initWorkflowModal","initReportModal","addEventListener","event","origin","parseInt","height","link","navigator","clipboard","writeText","autohide","closeButton"],"mappings":";;;;;;;AAuBAA,oCAAO,CAAC,SAAU,qBAAsB,oBACpC,WAAY,WAAY,oBAAqB,aAAc,cAC3D,SAASC,EAAGC,aAAcC,YAAaC,IAAKC,IAAKC,aAAcC,MAAOC,MAKlEC,OAAOC,mBAAqB,KAC5BD,OAAOE,yBAA2B,GAClCF,OAAOG,gBAAkB,SAErBC,gBAAkB,SAASC,YACtBA,WAAWC,SAGkB,OAA9BN,OAAOC,qBACPM,cAAcP,OAAOC,oBACrBD,OAAOG,gBAAkB,WAI7BK,iBAAmB,SAASC,aAAcC,UAAWL,YAChDA,WAAWC,SAGc,UAA1BN,OAAOG,kBACPQ,eAAeF,aAAcC,UAAWL,WAAWO,SACnDZ,OAAOG,gBAAkB,YA6I7BU,6BAA+B,SAASC,iBAAkBC,YACtDC,MAAMC,QAAQH,oBAAkD,IAA5BA,iBAAiBI,QAAgBJ,iBAAiBK,SAASJ,aAC/FvB,EAAE,qBAAqB4B,YAAY,UAEnC5B,EAAE,qBAAqB6B,SAAS,WAQpCC,2BAA6B,SAASC,aAClCA,MAAAA,aAAAA,YAAaC,aACbhC,EAAE,oBAAoB4B,YAAY,UAClC5B,EAAE,iBAAiBiC,KAAKF,YAAYC,cAEpChC,EAAE,oBAAoB6B,SAAS,WAUnCK,2BAA6B,SAASjB,aAAckB,SAAUZ,YAC9DvB,EAAE,2BAA2B6B,SAAS,UACtC7B,EAAE,+BAA+B4B,YAAY,UAC7C5B,EAAE,iBAAiBoC,KAAK,MAAO,QAC3BC,eAAiBjC,IAAIkC,YAAY,+CAAgD,cACjErB,sBACJkB,oBACEZ,aAElBvB,EAAEuC,KA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K,aAAa0D,cAyQ1ByG,CAAgBvJ,aAAckB,SAAUuF,QAASxG,UAAWL,eAE7DyJ,MAAMjK,aAAa0D,WACtBvD,OAAOiK,iBAAiB,WAAW,SAASC,OACnB,SAAjBA,MAAMC,SAIND,MAAMjI,OAASmI,SAASF,MAAMjI,MAC9BzC,EAAE,iBAAiB6K,OAAOH,MAAMjI,OAEhCzC,EAAE,iBAAiBmH,IAAIuD,MAAMjI,MAC7BzC,EAAE,sBAAsB+J,cAG5BlJ,WAAWC,SACXK,eAAeF,aAAcC,UAAWL,WAAWO,SAhHvDpB,EAAE,gCAAgCkI,GAAG,SAAS,SAASC,GACnDA,EAAEC,qBAEE0C,KADU3C,EAAEI,cACGxB,aAAa,QAC3B+D,KASDC,UAAUC,UACVD,UAAUC,UAAUC,UAAUH,MAC7BrD,MAAK,KACFtH,IAAIqD,WAAW,4BAA6B,kBACvCC,MAAK,SAASC,QACXpD,MAAMiF,IAAI7B,WAEbI,KAAKzD,aAAa0D,cAExBuG,QAGHnK,IAAIqD,WAAW,2CAA4C,kBACtDC,MAAK,SAASC,QACXpD,MAAMiF,IAAI7B,OAAQ,CAACG,KAAM,SAAUqH,UAAU,EAAOC,aAAa,OAEpErH,KAAKzD,aAAa0D,WAxBvB5D,IAAIqD,WAAW,4BAA6B,kBACvCC,MAAK,SAASC,QACXpD,MAAMiF,IAAI7B,OAAQ,CAACG,KAAM,eAE5BC,KAAKzD,aAAa0D"}
\ No newline at end of file
diff --git a/amd/build/block_massaction.min.js b/amd/build/block_massaction.min.js
new file mode 100644
index 00000000..7a6107cc
--- /dev/null
+++ b/amd/build/block_massaction.min.js
@@ -0,0 +1,10 @@
+define("block_opencast/block_massaction",["exports","jquery","core/str","core/notification","core/modal_save_cancel","core/modal_events","core/url"],(function(_exports,_jquery,str,_notification,_modal_save_cancel,_modal_events,_url){function _getRequireWildcardCache(nodeInterop){if("function"!=typeof WeakMap)return null;var cacheBabelInterop=new WeakMap,cacheNodeInterop=new WeakMap;return(_getRequireWildcardCache=function(nodeInterop){return nodeInterop?cacheNodeInterop:cacheBabelInterop})(nodeInterop)}function _interopRequireDefault(obj){return obj&&obj.__esModule?obj:{default:obj}}
+/**
+ * Javascript module to instantiate the Mass-Action functionality.
+ *
+ * @module block_opencast
+ * @copyright 2024 Farbod Zamani Boroujeni (elan e.V.) (zamani@elan-ev.de)
+ * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
+ */Object.defineProperty(_exports,"__esModule",{value:!0}),_exports.init=void 0,_jquery=_interopRequireDefault(_jquery),str=function(obj,nodeInterop){if(!nodeInterop&&obj&&obj.__esModule)return obj;if(null===obj||"object"!=typeof obj&&"function"!=typeof obj)return{default:obj};var cache=_getRequireWildcardCache(nodeInterop);if(cache&&cache.has(obj))return cache.get(obj);var newObj={},hasPropertyDescriptor=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var key in obj)if("default"!==key&&Object.prototype.hasOwnProperty.call(obj,key)){var desc=hasPropertyDescriptor?Object.getOwnPropertyDescriptor(obj,key):null;desc&&(desc.get||desc.set)?Object.defineProperty(newObj,key,desc):newObj[key]=obj[key]}newObj.default=obj,cache&&cache.set(obj,newObj);return newObj}(str),_notification=_interopRequireDefault(_notification),_modal_save_cancel=_interopRequireDefault(_modal_save_cancel),_modal_events=_interopRequireDefault(_modal_events),_url=_interopRequireDefault(_url);_exports.init=(courseid,ocinstanceid,selectors)=>{[...document.querySelectorAll(selectors.dropdown)].forEach((dropdown=>{dropdown.addEventListener("change",(e=>{var _actionsmapping$actio,_actionsmapping$actio2,_actionsmapping$actio3;const element=e.currentTarget,id=element.getAttribute("id"),action=element.value,populatedselector="".concat(selectors.dropdown,":not(#").concat(id,")"),otherdropdowns=[...document.querySelectorAll(populatedselector)];if(otherdropdowns.length&&otherdropdowns.forEach((otherdropdown=>{otherdropdown.value=action})),""===action)return;const selectedvideos=[...document.querySelectorAll("".concat(selectors.selectitem,":checked"))];if(!selectedvideos.length)return;const selectedids=selectedvideos.map((element=>element.id.substring(7))),selectedtitles=selectedvideos.map((element=>element.name.substring(7))),actionsmappinginput=document.getElementById(selectors.actionmapping),actionsmappingraw=actionsmappinginput?actionsmappinginput.value:null;if(null===actionsmappingraw)return;const actionsmapping=JSON.parse(actionsmappingraw);if(null==actionsmapping||null===(_actionsmapping$actio=actionsmapping[action])||void 0===_actionsmapping$actio||null===(_actionsmapping$actio2=_actionsmapping$actio.path)||void 0===_actionsmapping$actio2||!_actionsmapping$actio2.url)return;if("startworkflow"===action){const data={type:"bulk",selectedids:selectedids,selectedtitles:selectedtitles,url:actionsmapping[action].path.url},event=new CustomEvent("click",{detail:data});return void document.querySelector(".start-workflow").dispatchEvent(event)}const stringskeys=[{key:"videostable_massaction_"+action+"_modal_title",component:"block_opencast"},{key:"videostable_massaction_"+action+"_modal_body",component:"block_opencast",param:selectedtitles.join("
")},{key:"videostable_massaction_"+action,component:"block_opencast"}],strPromise=str.get_strings(stringskeys),modalPromise=_modal_save_cancel.default.create({});var urlParams={ocinstanceid:ocinstanceid,courseid:courseid};null!==(_actionsmapping$actio3=actionsmapping[action].path)&&void 0!==_actionsmapping$actio3&&_actionsmapping$actio3.params&&(urlParams=Object.assign(urlParams,actionsmapping[action].path.params));const actionUrl=_url.default.relativeUrl(actionsmapping[action].path.url,urlParams);_jquery.default.when(strPromise,modalPromise).then((function(strings,modal){window.liveUpdateState="paused",modal.setTitle(strings[0]);var body='",modal.setBody(body),modal.setSaveButtonText(strings[2]),modal.getRoot().on(_modal_events.default.save,(function(){window.liveUpdateState="resumed",document.getElementById("mass_action_confirmation_form").submit()})),modal.getRoot().on(_modal_events.default.hidden,(function(){window.liveUpdateState="resumed",modal.destroy(),resetVideosTableBulkActions(selectors)})),modal.show(),modal})).fail(_notification.default.exception)}))}))};const resetVideosTableBulkActions=selectors=>{[...document.querySelectorAll(selectors.dropdown)].forEach((dropdown=>{dropdown.value="",dropdown.setAttribute("disabled",!0)}));[...document.querySelectorAll("".concat(selectors.selectall,", ").concat(selectors.selectitem))].forEach((input=>{input.checked=!1}))}}));
+
+//# sourceMappingURL=block_massaction.min.js.map
\ No newline at end of file
diff --git a/amd/build/block_massaction.min.js.map b/amd/build/block_massaction.min.js.map
new file mode 100644
index 00000000..5535ebf1
--- /dev/null
+++ b/amd/build/block_massaction.min.js.map
@@ -0,0 +1 @@
+{"version":3,"file":"block_massaction.min.js","sources":["../src/block_massaction.js"],"sourcesContent":["// This file is part of Moodle - http://moodle.org/\n//\n// Moodle is free software: you can redistribute it and/or modify\n// it under the terms of the GNU General Public License as published by\n// the Free Software Foundation, either version 3 of the License, or\n// (at your option) any later version.\n//\n// Moodle is distributed in the hope that it will be useful,\n// but WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n// GNU General Public License for more details.\n//\n// You should have received a copy of the GNU General Public License\n// along with Moodle. If not, see .\n\n/**\n * Javascript module to instantiate the Mass-Action functionality.\n *\n * @module block_opencast\n * @copyright 2024 Farbod Zamani Boroujeni (elan e.V.) (zamani@elan-ev.de)\n * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later\n */\n\nimport $ from 'jquery';\nimport * as str from 'core/str';\nimport Notification from 'core/notification';\nimport ModalSaveCancel from 'core/modal_save_cancel';\nimport ModalEvents from 'core/modal_events';\nimport url from 'core/url';\n\n/**\n * Initializes the mass action functionality for the Opencast block.\n * This function sets up event listeners for dropdown changes, handles video selection,\n * and manages the modal dialogs for different actions.\n *\n * @param {number} courseid - The ID of the current course.\n * @param {number} ocinstanceid - The ID of the Opencast instance.\n * @param {Object} selectors - An object containing CSS/Id selectors for various elements.\n * @param {string} selectors.dropdown - Selector for the action dropdown elements.\n * @param {string} selectors.selectitem - Selector for the checkbox elements to select individual videos.\n * @param {string} selectors.actionmapping - Selector for the element containing action mapping data.\n * @param {string} selectors.selectall - Selector for the \"select all\" checkbox.\n * @returns {void} This function does not return a value.\n */\nexport const init = (courseid, ocinstanceid, selectors) => {\n\n const dropdowns = [...document.querySelectorAll(selectors.dropdown)];\n dropdowns.forEach(dropdown => {\n dropdown.addEventListener('change', e => {\n const element = e.currentTarget;\n const id = element.getAttribute('id');\n const action = element.value;\n\n // Make sure other bulk select get the same value.\n const populatedselector = `${selectors.dropdown}:not(#${id})`;\n const otherdropdowns = [...document.querySelectorAll(populatedselector)];\n if (otherdropdowns.length) {\n otherdropdowns.forEach(otherdropdown => {\n otherdropdown.value = action;\n });\n }\n\n if (action === '') {\n return;\n }\n\n const selectedvideos = [...document.querySelectorAll(`${selectors.selectitem}:checked`)];\n if (!selectedvideos.length) {\n return;\n }\n const selectedids = selectedvideos.map(element => element.id.substring(7));\n const selectedtitles = selectedvideos.map(element => element.name.substring(7));\n\n const actionsmappinginput = document.getElementById(selectors.actionmapping);\n const actionsmappingraw = actionsmappinginput ? actionsmappinginput.value : null;\n if (actionsmappingraw === null) {\n return;\n }\n const actionsmapping = JSON.parse(actionsmappingraw);\n // Make sure that the action url is there.\n if (!actionsmapping?.[action]?.path?.url) {\n return;\n }\n\n // Because of using Modal for start workflow tasks, we don't provide a confirmation modal beforehand,\n // but instead we provide the confirmation texts in existing startworkflow modal.\n if (action === 'startworkflow') {\n\n const data = {\n type: 'bulk',\n selectedids: selectedids,\n selectedtitles: selectedtitles,\n url: actionsmapping[action].path.url\n };\n\n // Create and dispatch the custom event on start-workflow element with detail data.\n const event = new CustomEvent('click', {detail: data});\n document.querySelector('.start-workflow').dispatchEvent(event);\n return; // We stop the function here!\n }\n\n const stringskeys = [\n {\n key: 'videostable_massaction_' + action + '_modal_title',\n component: 'block_opencast'\n },\n {\n key: 'videostable_massaction_' + action + '_modal_body',\n component: 'block_opencast',\n param: selectedtitles.join('
')\n },\n {\n key: 'videostable_massaction_' + action,\n component: 'block_opencast'\n },\n ];\n const strPromise = str.get_strings(stringskeys);\n\n const modalPromise = ModalSaveCancel.create({});\n\n var urlParams = {\n 'ocinstanceid': ocinstanceid,\n 'courseid': courseid\n };\n\n if (actionsmapping[action].path?.params) {\n urlParams = Object.assign(urlParams, actionsmapping[action].path.params);\n }\n\n const actionUrl = url.relativeUrl(actionsmapping[action].path.url, urlParams);\n\n $.when(strPromise, modalPromise).then(function(strings, modal) {\n // Pause the live update if it is running.\n window.liveUpdateState = 'paused';\n modal.setTitle(strings[0]);\n var body = '';\n modal.setBody(body);\n modal.setSaveButtonText(strings[2]);\n modal.getRoot().on(ModalEvents.save, function() {\n // Resume the live update if it was paused.\n window.liveUpdateState = 'resumed';\n document.getElementById('mass_action_confirmation_form').submit();\n });\n modal.getRoot().on(ModalEvents.hidden, function() {\n // Resume the live update if it was paused.\n window.liveUpdateState = 'resumed';\n // Destroy when hidden/closed.\n modal.destroy();\n // Change the bulk action select back to choose...\n resetVideosTableBulkActions(selectors);\n });\n modal.show();\n return modal;\n }).fail(Notification.exception);\n });\n });\n};\n\n/**\n * Resets the bulk action select dropdowns and unchecks the select items.\n * This function is called when the modal is hidden/closed.\n *\n * @param {Object} selectors - An object containing CSS/Id selectors for various elements.\n * @param {string} selectors.dropdown - Selector for the action dropdown elements.\n * @param {string} selectors.selectitem - Selector for the checkbox elements to select individual videos.\n * @param {string} selectors.actionmapping - Selector for the element containing action mapping data.\n * @param {string} selectors.selectall - Selector for the \"select all\" checkbox.\n * @returns {void} This function does not return a value.\n */\nconst resetVideosTableBulkActions = (selectors) => {\n const dropdowns = [...document.querySelectorAll(selectors.dropdown)];\n dropdowns.forEach(dropdown => {\n dropdown.value = '';\n dropdown.setAttribute('disabled', true);\n });\n\n const ckinputs = [...document.querySelectorAll(`${selectors.selectall}, ${selectors.selectitem}`)];\n ckinputs.forEach(input => {\n input.checked = false;\n });\n};\n"],"names":["courseid","ocinstanceid","selectors","document","querySelectorAll","dropdown","forEach","addEventListener","e","element","currentTarget","id","getAttribute","action","value","populatedselector","otherdropdowns","length","otherdropdown","selectedvideos","selectitem","selectedids","map","substring","selectedtitles","name","actionsmappinginput","getElementById","actionmapping","actionsmappingraw","actionsmapping","JSON","parse","_actionsmapping$actio","path","_actionsmapping$actio2","url","data","type","event","CustomEvent","detail","querySelector","dispatchEvent","stringskeys","key","component","param","join","strPromise","str","get_strings","modalPromise","ModalSaveCancel","create","urlParams","_actionsmapping$actio3","params","Object","assign","actionUrl","relativeUrl","when","then","strings","modal","window","liveUpdateState","setTitle","body","selectedid","setBody","setSaveButtonText","getRoot","on","ModalEvents","save","submit","hidden","destroy","resetVideosTableBulkActions","show","fail","Notification","exception","setAttribute","selectall","input","checked"],"mappings":";;;;;;;s+BA4CoB,CAACA,SAAUC,aAAcC,aAEvB,IAAIC,SAASC,iBAAiBF,UAAUG,WAChDC,SAAQD,WACdA,SAASE,iBAAiB,UAAUC,kFAC1BC,QAAUD,EAAEE,cACZC,GAAKF,QAAQG,aAAa,MAC1BC,OAASJ,QAAQK,MAGjBC,4BAAuBb,UAAUG,0BAAiBM,QAClDK,eAAiB,IAAIb,SAASC,iBAAiBW,uBACjDC,eAAeC,QACfD,eAAeV,SAAQY,gBACnBA,cAAcJ,MAAQD,UAIf,KAAXA,oBAIEM,eAAiB,IAAIhB,SAASC,2BAAoBF,UAAUkB,6BAC7DD,eAAeF,oBAGdI,YAAcF,eAAeG,KAAIb,SAAWA,QAAQE,GAAGY,UAAU,KACjEC,eAAiBL,eAAeG,KAAIb,SAAWA,QAAQgB,KAAKF,UAAU,KAEtEG,oBAAsBvB,SAASwB,eAAezB,UAAU0B,eACxDC,kBAAoBH,oBAAsBA,oBAAoBZ,MAAQ,QAClD,OAAtBe,+BAGEC,eAAiBC,KAAKC,MAAMH,sBAE7BC,MAAAA,8CAAAA,eAAiBjB,yEAAjBoB,sBAA0BC,yCAA1BC,uBAAgCC,cAMtB,kBAAXvB,OAA4B,OAEtBwB,KAAO,CACTC,KAAM,OACNjB,YAAaA,YACbG,eAAgBA,eAChBY,IAAKN,eAAejB,QAAQqB,KAAKE,KAI/BG,MAAQ,IAAIC,YAAY,QAAS,CAACC,OAAQJ,mBAChDlC,SAASuC,cAAc,mBAAmBC,c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 No newline at end of file
diff --git a/amd/src/block_index.js b/amd/src/block_index.js
index 198de1fc..52a208fc 100644
--- a/amd/src/block_index.js
+++ b/amd/src/block_index.js
@@ -68,7 +68,31 @@ define(['jquery', 'core/modal_factory', 'core/modal_events',
$('.start-workflow').on('click', function(e) {
e.preventDefault();
+ const detail = e?.detail || {};
+
var clickedVideo = $(e.currentTarget);
+ var actionurl = url.relativeUrl('blocks/opencast/startworkflow.php', {
+ 'ocinstanceid': ocinstanceid,
+ 'courseid': courseid,
+ 'videoid': clickedVideo.data('id')
+ });
+ var ismassaction = false;
+ var bulkinfodiv = '';
+ if (detail?.type === 'bulk' && detail?.selectedids) {
+ ismassaction = true;
+ bulkinfodiv = '