mirror of
https://github.com/mediacms-io/mediacms.git
synced 2026-03-08 22:24:48 -04:00
a
This commit is contained in:
@@ -208,6 +208,7 @@ class text_filter extends \core_filters\text_filter {
|
|||||||
$launch_url = new moodle_url('/filter/mediacms/launch.php', [
|
$launch_url = new moodle_url('/filter/mediacms/launch.php', [
|
||||||
'token' => $token,
|
'token' => $token,
|
||||||
'courseid' => isset($COURSE->id) ? (int)$COURSE->id : 0,
|
'courseid' => isset($COURSE->id) ? (int)$COURSE->id : 0,
|
||||||
|
'show_media_page' => 'true',
|
||||||
]);
|
]);
|
||||||
|
|
||||||
if (!self::$textlink_js_added) {
|
if (!self::$textlink_js_added) {
|
||||||
|
|||||||
@@ -28,6 +28,7 @@ $showRelated = optional_param('showRelated', '', PARAM_TEXT);
|
|||||||
$showUserAvatar = optional_param('showUserAvatar', '', PARAM_TEXT);
|
$showUserAvatar = optional_param('showUserAvatar', '', PARAM_TEXT);
|
||||||
$linkTitle = optional_param('linkTitle', '', PARAM_TEXT);
|
$linkTitle = optional_param('linkTitle', '', PARAM_TEXT);
|
||||||
$startTime = optional_param('t', '', PARAM_TEXT);
|
$startTime = optional_param('t', '', PARAM_TEXT);
|
||||||
|
$show_media_page = optional_param('show_media_page', '', PARAM_TEXT);
|
||||||
|
|
||||||
// Get configuration
|
// Get configuration
|
||||||
$mediacmsurl = get_config('filter_mediacms', 'mediacmsurl');
|
$mediacmsurl = get_config('filter_mediacms', 'mediacmsurl');
|
||||||
@@ -89,6 +90,9 @@ if ($linkTitle !== '') {
|
|||||||
if ($startTime !== '') {
|
if ($startTime !== '') {
|
||||||
$custom_params[] = "embed_start_time=" . $startTime;
|
$custom_params[] = "embed_start_time=" . $startTime;
|
||||||
}
|
}
|
||||||
|
if ($show_media_page === 'true') {
|
||||||
|
$custom_params[] = "show_media_page=true";
|
||||||
|
}
|
||||||
|
|
||||||
$instance->instructorcustomparameters = implode("\n", $custom_params);
|
$instance->instructorcustomparameters = implode("\n", $custom_params);
|
||||||
$instance->name = 'MediaCMS Video: ' . $mediatoken;
|
$instance->name = 'MediaCMS Video: ' . $mediatoken;
|
||||||
@@ -117,6 +121,9 @@ if ($linkTitle !== '') {
|
|||||||
if ($startTime !== '') {
|
if ($startTime !== '') {
|
||||||
$page_params['t'] = $startTime;
|
$page_params['t'] = $startTime;
|
||||||
}
|
}
|
||||||
|
if ($show_media_page === 'true') {
|
||||||
|
$page_params['show_media_page'] = 'true';
|
||||||
|
}
|
||||||
|
|
||||||
$PAGE->set_url(new moodle_url('/filter/mediacms/launch.php', $page_params));
|
$PAGE->set_url(new moodle_url('/filter/mediacms/launch.php', $page_params));
|
||||||
$PAGE->set_context($context);
|
$PAGE->set_context($context);
|
||||||
@@ -149,6 +156,9 @@ if ($linkTitle !== '') {
|
|||||||
if ($startTime !== '') {
|
if ($startTime !== '') {
|
||||||
$hidden_fields .= '<input type="hidden" name="embed_start_time" value="' . htmlspecialchars($startTime, ENT_QUOTES) . '" />';
|
$hidden_fields .= '<input type="hidden" name="embed_start_time" value="' . htmlspecialchars($startTime, ENT_QUOTES) . '" />';
|
||||||
}
|
}
|
||||||
|
if ($show_media_page === 'true') {
|
||||||
|
$hidden_fields .= '<input type="hidden" name="show_media_page" value="true" />';
|
||||||
|
}
|
||||||
if ($width) {
|
if ($width) {
|
||||||
$hidden_fields .= '<input type="hidden" name="embed_width" value="' . htmlspecialchars($width, ENT_QUOTES) . '" />';
|
$hidden_fields .= '<input type="hidden" name="embed_width" value="' . htmlspecialchars($width, ENT_QUOTES) . '" />';
|
||||||
}
|
}
|
||||||
|
|||||||
15
lti/views.py
15
lti/views.py
@@ -90,6 +90,7 @@ class OIDCLoginView(View):
|
|||||||
embed_start_time = request.GET.get('embed_start_time') or request.POST.get('embed_start_time')
|
embed_start_time = request.GET.get('embed_start_time') or request.POST.get('embed_start_time')
|
||||||
embed_width = request.GET.get('embed_width') or request.POST.get('embed_width')
|
embed_width = request.GET.get('embed_width') or request.POST.get('embed_width')
|
||||||
embed_height = request.GET.get('embed_height') or request.POST.get('embed_height')
|
embed_height = request.GET.get('embed_height') or request.POST.get('embed_height')
|
||||||
|
show_media_page = request.GET.get('show_media_page') or request.POST.get('show_media_page')
|
||||||
|
|
||||||
if not all([target_link_uri, iss, client_id]):
|
if not all([target_link_uri, iss, client_id]):
|
||||||
return JsonResponse({'error': 'Missing required OIDC parameters'}, status=400)
|
return JsonResponse({'error': 'Missing required OIDC parameters'}, status=400)
|
||||||
@@ -139,6 +140,8 @@ class OIDCLoginView(View):
|
|||||||
state_data['embed_width'] = embed_width
|
state_data['embed_width'] = embed_width
|
||||||
if embed_height:
|
if embed_height:
|
||||||
state_data['embed_height'] = embed_height
|
state_data['embed_height'] = embed_height
|
||||||
|
if show_media_page:
|
||||||
|
state_data['show_media_page'] = show_media_page
|
||||||
|
|
||||||
# Encode as base64 URL-safe string
|
# Encode as base64 URL-safe string
|
||||||
state = base64.urlsafe_b64encode(json.dumps(state_data).encode()).decode().rstrip('=')
|
state = base64.urlsafe_b64encode(json.dumps(state_data).encode()).decode().rstrip('=')
|
||||||
@@ -218,6 +221,7 @@ class LaunchView(View):
|
|||||||
't': 't',
|
't': 't',
|
||||||
'width': 'width',
|
'width': 'width',
|
||||||
'height': 'height',
|
'height': 'height',
|
||||||
|
'show_media_page': 'show_media_page',
|
||||||
}
|
}
|
||||||
|
|
||||||
for key, param_name in param_mapping.items():
|
for key, param_name in param_mapping.items():
|
||||||
@@ -265,7 +269,7 @@ class LaunchView(View):
|
|||||||
media_token_from_state = state_data.get('media_token')
|
media_token_from_state = state_data.get('media_token')
|
||||||
|
|
||||||
# Extract embed parameters from state
|
# Extract embed parameters from state
|
||||||
for key in ['embed_show_title', 'embed_show_related', 'embed_show_user_avatar', 'embed_link_title', 'embed_start_time', 'embed_width', 'embed_height']:
|
for key in ['embed_show_title', 'embed_show_related', 'embed_show_user_avatar', 'embed_link_title', 'embed_start_time', 'embed_width', 'embed_height', 'show_media_page']:
|
||||||
if key in state_data:
|
if key in state_data:
|
||||||
embed_params_from_state[key] = state_data[key]
|
embed_params_from_state[key] = state_data[key]
|
||||||
except Exception:
|
except Exception:
|
||||||
@@ -704,6 +708,13 @@ class EmbedMediaLTIView(View):
|
|||||||
|
|
||||||
# Build embed URL with parameters from the request
|
# Build embed URL with parameters from the request
|
||||||
embed_params = LaunchView.extract_embed_params_from_dict(request.GET)
|
embed_params = LaunchView.extract_embed_params_from_dict(request.GET)
|
||||||
embed_url = LaunchView.build_url_with_embed_params(f"/embed?m={friendly_token}", embed_params)
|
show_media_page = request.GET.get('show_media_page')
|
||||||
|
|
||||||
|
if show_media_page == 'true':
|
||||||
|
base_path = f"/view?m={friendly_token}"
|
||||||
|
else:
|
||||||
|
base_path = f"/embed?m={friendly_token}"
|
||||||
|
|
||||||
|
embed_url = LaunchView.build_url_with_embed_params(base_path, embed_params)
|
||||||
|
|
||||||
return HttpResponseRedirect(embed_url)
|
return HttpResponseRedirect(embed_url)
|
||||||
|
|||||||
Reference in New Issue
Block a user