Permalink
Browse files

SCORM MDL-26201 setting to allow admin to force users to enable JS in…

… their browser before allowing them to view/use SCORM objects.
  • Loading branch information...
1 parent 8cdc85a commit 30bce58eb9ed5a5da8c95112d7710bc52701e8fe @danmarsden danmarsden committed Jan 31, 2011
Showing with 28 additions and 1 deletion.
  1. +2 −0 mod/scorm/lang/en/scorm.php
  2. +1 −1 mod/scorm/locallib.php
  3. +7 −0 mod/scorm/player.php
  4. +2 −0 mod/scorm/settings.php
  5. +9 −0 mod/scorm/styles.css
  6. +7 −0 mod/scorm/view.php
View
2 mod/scorm/lang/en/scorm.php
@@ -98,6 +98,8 @@
$string['forcenewattempt'] = 'Force new attempt';
$string['forcenewattempt_help'] = 'If enabled, each time a SCORM package is accessed will be counted as a new attempt.';
$string['forcenewattemptdesc'] = 'This preference sets the default value for the force new attempt setting';
+$string['forcejavascript'] = 'Force users to enable JavaScript';
+$string['forcejavascriptmessage'] = 'JavaScript is required to view this object, Please enable JavaScript in your browser and try again.';
$string['found'] = 'Manifest found';
$string['frameheight'] = 'This preference set the default height for stage frame or window';
$string['framewidth'] = 'This preference set the default width for stage frame or window';
View
2 mod/scorm/locallib.php
@@ -715,7 +715,7 @@ function scorm_view_display ($user, $scorm, $action, $cm, $boxwidth='') {
$organization = optional_param('organization', '', PARAM_INT);
if($scorm->displaycoursestructure == 1) {
- echo $OUTPUT->box_start('generalbox boxaligncenter');
+ echo $OUTPUT->box_start('generalbox boxaligncenter toc');
?>
<div class="structurehead"><?php print_string('contents','scorm') ?></div>
<?php
View
7 mod/scorm/player.php
@@ -56,6 +56,10 @@
$url->param('newattempt', $newattempt);
}
$PAGE->set_url($url);
+ $forcejs = get_config('scorm','forcejavascript');
+ if (!empty($forcejs)) {
+ $PAGE->add_body_class('forcejavascript');
+ }
require_login($course->id, false, $cm);
@@ -249,4 +253,7 @@
$completion=new completion_info($course);
$completion->set_module_viewed($cm);
+if (!empty($forcejs)) {
+ echo $OUTPUT->box(get_string("forcejavascriptmessage", "scorm"), "generalbox boxaligncenter forcejavascriptmessage");
+}
echo $OUTPUT->footer();
View
2 mod/scorm/settings.php
@@ -58,6 +58,8 @@
$settings->add(new admin_setting_configcheckbox('scorm/allowtypeimsrepository', get_string('allowtypeimsrepository', 'scorm'), '', 0));
+ $settings->add(new admin_setting_configcheckbox('scorm/forcejavascript', get_string('forcejavascript', 'scorm'), '', 0));
+
$settings->add(new admin_setting_configcheckbox('scorm/allowapidebug', get_string('allowapidebug', 'scorm'), '', 0));
$settings->add(new admin_setting_configtext('scorm/apidebugmask', get_string('apidebugmask', 'scorm'), '', '.*'));
View
9 mod/scorm/styles.css
@@ -26,3 +26,12 @@
#page-mod-scorm-player #altfinishlink {float: right; border: 0px; padding: 0px; }
#page-mod-scorm-player #altpopuplink {position: left; padding: 5px; border: 0px; }
#page-mod-scorm-player #scormmode {float: left; border: 0px; }
+
+.path-mod-scorm.forcejavascript .scorm-center { display:none;}
+.path-mod-scorm.forcejavascript .toc { display:none;}
+.path-mod-scorm.forcejavascript #scormpage #tocbox { display:none;}
+
+.path-mod-scorm.jsenabled .forcejavascriptmessage {display: none;}
+.path-mod-scorm.jsenabled .scorm-center { display:block;}
+.path-mod-scorm.jsenabled .toc { display:block;}
+.path-mod-scorm.jsenabled #scormpage #tocbox { display:block;}
View
7 mod/scorm/view.php
@@ -36,6 +36,10 @@
$url->param('organization', $organization);
}
$PAGE->set_url($url);
+ $forcejs = get_config('scorm','forcejavascript');
+ if (!empty($forcejs)) {
+ $PAGE->add_body_class('forcejavascript');
+ }
require_login($course->id, false, $cm);
@@ -88,5 +92,8 @@
if ($scormopen) {
scorm_view_display($USER, $scorm, 'view.php?id='.$cm->id, $cm);
}
+ if (!empty($forcejs)) {
+ echo $OUTPUT->box(get_string("forcejavascriptmessage", "scorm"), "generalbox boxaligncenter forcejavascriptmessage");
+ }
echo $OUTPUT->footer();

0 comments on commit 30bce58

Please sign in to comment.