Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Add option to turn on or off fullscreen button in SCORM content #83

Merged
merged 3 commits into from
Oct 18, 2024
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions openedxscorm/scormxblock.py
Original file line number Diff line number Diff line change
Expand Up @@ -164,6 +164,12 @@ def scorm_storage(xblock):
default=False,
scope=Scope.settings,
)
enable_fullscreen_button = Boolean(
display_name=_("Show Fullscreen Button"),
help=_("Select True to show fullscreen button in the SCORM content"),
default=False,
zameel7 marked this conversation as resolved.
Show resolved Hide resolved
scope=Scope.settings,
)

navigation_menu = String(scope=Scope.settings, default="")

Expand Down Expand Up @@ -278,6 +284,7 @@ def studio_view(self, context=None):
"field_height": self.fields["height"],
"field_popup_on_launch": self.fields["popup_on_launch"],
"field_enable_navigation_menu": self.fields["enable_navigation_menu"],
"field_enable_fullscreen_button": self.fields["enable_fullscreen_button"],
"field_navigation_menu_width": self.fields["navigation_menu_width"],
"popup_on_launch": self.fields["popup_on_launch"],
"scorm_xblock": self,
Expand All @@ -303,6 +310,7 @@ def studio_submit(self, request, _suffix):
self.height = parse_int(request.params["height"], None)
self.has_score = request.params["has_score"] == "1"
self.enable_navigation_menu = request.params["enable_navigation_menu"] == "1"
self.enable_fullscreen_button = request.params["enable_fullscreen_button"] == "1"
self.navigation_menu_width = parse_int(
request.params["navigation_menu_width"], None
)
Expand Down Expand Up @@ -344,6 +352,7 @@ def popup_window(self, request, _suffix):
"navigation_menu": self.navigation_menu,
"navigation_menu_width": self.navigation_menu_width,
"enable_navigation_menu": self.enable_navigation_menu,
"enable_fullscreen_button": self.enable_fullscreen_button,
},
)
return Response(body=rendered)
Expand Down
5 changes: 3 additions & 2 deletions openedxscorm/static/html/scormxblock.html
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,13 @@
{% endif %}

<div class="scorm-content">

{% if scorm_xblock.enable_fullscreen_button %}
<div class="fullscreen-controls">
<button class="enter-fullscreen">{% trans "Fullscreen" %}</button>
<button class="exit-fullscreen">{% trans "Exit fullscreen" %}</button>
</div>

{% endif %}

<div class="scorm-panel">

{% if scorm_xblock.enable_navigation_menu and not scorm_xblock.popup_on_launch%}
Expand Down
11 changes: 11 additions & 0 deletions openedxscorm/static/html/studio.html
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,17 @@
<span class="tip setting-help">{% trans field_enable_navigation_menu.help %}</span>
</li>

<li class="field comp-setting-entry is-set">
<div class="wrapper-comp-setting">
<label class="label setting-label" for="enable_fullscreen_button">{% trans field_enable_fullscreen_button.display_name %}</label>
<select name="enable_fullscreen_button" id="enable_fullscreen_button">
<option value="1" {% if scorm_xblock.enable_fullscreen_button %}selected{% endif %}>{% trans "True" %}</option>
<option value="0" {% if not scorm_xblock.enable_fullscreen_button %}selected{% endif %}>{% trans "False" %}</option>
</select>
</div>
<span class="tip setting-help">{% trans field_enable_fullscreen_button.help %}</span>
</li>

<li class="field comp-setting-entry is-set">
<div class="wrapper-comp-setting">
<label class="label setting-label" for="weight">{% trans field_weight.display_name %}</label>
Expand Down
2 changes: 2 additions & 0 deletions openedxscorm/static/js/src/studio.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ function ScormStudioXBlock(runtime, element) {
var display_name = $(element).find('input[name=display_name]').val();
var has_score = $(element).find('select[name=has_score]').val();
var enable_navigation_menu = $(element).find('select[name=enable_navigation_menu]').val();
var enable_fullscreen_button = $(element).find('select[name=enable_fullscreen_button]').val();
var weight = $(element).find('input[name=weight]').val();
var width = $(element).find('input[name=width]').val();
var height = $(element).find('input[name=height]').val();
Expand All @@ -18,6 +19,7 @@ function ScormStudioXBlock(runtime, element) {
form_data.append('display_name', display_name);
form_data.append('has_score', has_score);
form_data.append('enable_navigation_menu', enable_navigation_menu);
form_data.append('enable_fullscreen_button', enable_fullscreen_button);
form_data.append('weight', weight);
form_data.append('width', width);
form_data.append('height', height);
Expand Down