Permalink
Browse files

Added the new popup window mode

  • Loading branch information...
bobopinna
bobopinna committed Sep 26, 2005
1 parent 27a10b8 commit 77f18d3936089b45cb8888b34e1336c7e3bd3686
View
@@ -34,7 +34,7 @@
if (confirm_sesskey() && (!empty($scoid))) {
$result = true;
- if (isstudent($course->id)) {
+ if (isstudent($course->id) || (isteacher($course->id) && !isadmin()) {
foreach ($_POST as $element => $value) {
if (substr($element,0,3) == 'cmi') {
$element = str_replace('__','.',$element);
View
@@ -197,6 +197,11 @@ function scorm_upgrade($oldversion) {
}
}
+
+ if ($oldversion < 2005092500) {
+ table_column("scorm", "", "hidenav", "TINYINT", "1", "UNSIGNED", "0", "NOT NULL", "hidetoc");
+ table_column("scorm", "", "options", "VARCHAR", "255", "", "", "NOT NULL","popup");
+ }
return true;
}
?>
View
@@ -14,8 +14,10 @@ CREATE TABLE prefix_scorm (
summary text NOT NULL,
hidebrowse tinyint(1) NOT NULL default '0',
hidetoc tinyint(1) NOT NULL default '0',
+ hidenav tinyint(1) NOT NULL default '0',
auto tinyint(1) unsigned NOT NULL default '0',
popup tinyint(1) unsigned NOT NULL default '0',
+ options varchar(255) NOT NULL default '',
width int(10) unsigned NOT NULL default '800',
height int(10) unsigned NOT NULL default '600',
timemodified int(10) unsigned NOT NULL default '0',
@@ -210,6 +210,11 @@ function scorm_upgrade($oldversion) {
}
}
}
+
+ if ($oldversion < 2005092500) {
+ table_column("scorm", "", "hidenav", "integer", "", "", "0", "NOT NULL", "hidetoc");
+ table_column("scorm", "", "options", "varchar", "255", "", "", "NOT NULL","popup");
+ }
return true;
}
@@ -13,8 +13,10 @@ CREATE TABLE prefix_scorm (
summary text NOT NULL default '',
hidebrowse integer NOT NULL default '0',
hidetoc integer NOT NULL default '0',
+ hidenav integer NOT NULL default '0',
auto integer NOT NULL default '0',
popup integer NOT NULL default '0',
+ options varchar(255) NOT NULL default '',
width integer NOT NULL default '800',
height integer NOT NULL default '600',
timemodified integer NOT NULL default '0'
View
@@ -10,6 +10,15 @@
VALUEHIGHEST => get_string('gradehighest', 'scorm'),
VALUEAVERAGE => get_string('gradeaverage', 'scorm'),
VALUESUM => get_string('gradesum', 'scorm'));
+$SCORM_POPUP_OPTIONS = array('resizable', 'scrollbars', 'directories', 'location',
+ 'menubar', 'toolbar', 'status');
+$stdoptions = '';
+foreach ($SCORM_POPUP_OPTIONS as $popupopt) {
+ $stdoptions .= $popupopt.'=1';
+ if ($popupopt != 'status') {
+ $stdoptions .= ',';
+ }
+}
/*if (!isset($CFG->scorm_validate)) {
$scormvalidate = 'none';
@@ -41,10 +50,27 @@
*/
function scorm_add_instance($scorm) {
+ global $CFG,$SCORM_POPUP_OPTIONS;
$scorm->timemodified = time();
- # May have to add extra stuff in here #
- global $CFG;
+ if (isset($scorm->popup)) {
+ if ($scorm->popup) {
+ $optionlist = array();
+ foreach ($SCORM_POPUP_OPTIONS as $option) {
+ if (isset($scorm->$option)) {
+ $optionlist[] = $option.'='.$scorm->$option;
+ } else {
+ $optionlist[] = $option.'=0';
+ }
+ }
+ $scorm->options = implode(',', $optionlist);
+ } else {
+ $scorm->options = '';
+ }
+ } else {
+ $scorm->popup = 0;
+ $scorm->options = '';
+ }
$id = insert_record('scorm', $scorm);
@@ -82,10 +108,29 @@ function scorm_add_instance($scorm) {
*/
function scorm_update_instance($scorm) {
+ global $CFG,$SCORM_POPUP_OPTIONS;
+
$scorm->timemodified = time();
$scorm->id = $scorm->instance;
- global $CFG;
+ if (isset($scorm->popup)) {
+ if ($scorm->popup) {
+ $optionlist = array();
+ foreach ($SCORM_POPUP_OPTIONS as $option) {
+ if (isset($scorm->$option)) {
+ $optionlist[] = $option.'='.$scorm->$option;
+ } else {
+ $optionlist[] = $option.'=0';
+ }
+ }
+ $scorm->options = implode(',', $optionlist);
+ } else {
+ $scorm->options = '';
+ }
+ } else {
+ $scorm->popup = 0;
+ $scorm->options = '';
+ }
// Check if scorm manifest needs to be reparsed
if ($scorm->launch == 0) {
@@ -1466,6 +1511,7 @@ function scorm_get_toc($scorm,$liststyle,$currentorg='',$scoid='',$mode='normal'
$sco->showprev = $showprev;
$sco->shownext = $shownext;
$result->sco = $sco;
+ $result->incomplete = $incomplete;
} else {
$result->incomplete = $incomplete;
}
View
@@ -4,7 +4,7 @@
$id = optional_param('id', '', PARAM_INT); // Course Module ID, or
$a = optional_param('a', '', PARAM_INT); // scorm ID
- $scoid = optional_param('scoid', '', PARAM_INT); // sco ID
+ $scoid = required_param('scoid', '', PARAM_INT); // sco ID
$mode = optional_param('mode', '', PARAM_ALPHA); // navigation mode
if (!empty($id)) {
View
@@ -33,12 +33,31 @@
if (empty($form->hidetoc)) {
$form->hidetoc = "0";
}
+ if (empty($form->hidenav)) {
+ $form->hidenav = "0";
+ }
if (empty($form->width)) {
$form->width = $CFG->scorm_framewidth;
}
+ if ($form->width <= 100) {
+ $form->width .= '%';
+ }
if (empty($form->height)) {
$form->height = $CFG->scorm_frameheight;
}
+ if ($form->height <= 100) {
+ $form->height .= '%';
+ }
+ if (empty($form->options)) {
+ $form->options = $stdoptions;
+ }
+ $options = explode(',',$form->options);
+ $window = new stdClass();
+ foreach ($options as $option) {
+ list($element,$value) = explode('=',$option);
+ $element = trim($element);
+ $window->$element = trim($value)==1?'checked':'';
+ }
$scormid = '';
if (!empty($form->instance)) {
@@ -55,6 +74,19 @@
$strfilename = get_string("coursepacket", "scorm");
$strchooseafile = get_string("chooseapacket", "scorm");
+ $striframe = get_string("iframe", "scorm");
+ $striframedisplay = get_string("iframedisplay", "scorm");
+ $strnewwindow = get_string("popup", "scorm");
+ $strnewwindowopen = get_string("popupopen", "scorm");
+ $strheight = get_string("height", "scorm");
+ $strwidth = get_string("width", "scorm");
+ $strresizable = get_string("resizable", "scorm");
+ $strscrollbars = get_string("scrollbars", "scorm");
+ $strdirectories = get_string("directories", "scorm");
+ $strlocation = get_string("location", "scorm");
+ $strmenubar = get_string("menubar", "scorm");
+ $strtoolbar = get_string("toolbar", "scorm");
+ $strstatus = get_string("statusbar", "scorm");
?>
<script type="text/javascript" src="<?php p($CFG->wwwroot) ?>/mod/scorm/request.js" ></script>
@@ -220,7 +252,6 @@
$options[0]=get_string("no");
$options[1]=get_string("yes");
choose_from_menu ($options, "auto", $form->auto,'');
- helpbutton("autocontinue", get_string("autocontinue", "scorm"), "scorm", true);
?>
</td>
</tr>
@@ -232,7 +263,6 @@
$options[0]=get_string("no");
$options[1]=get_string("yes");
choose_from_menu ($options, "hidebrowse", $form->hidebrowse, '');
- helpbutton("browsemode", get_string("hidebrowse", "scorm"), "scorm", true);
?>
</td>
</tr>
@@ -244,7 +274,17 @@
$options[0]=get_string("no");
$options[1]=get_string("yes");
choose_from_menu ($options, "hidetoc", $form->hidetoc, '');
- helpbutton("tocdisplay", get_string("hidetoc", "scorm"), "scorm", true);
+ ?>
+ </td>
+ </tr>
+ <tr>
+ <td align="right"><b><?php print_string("hidenav","scorm") ?>:</b></td>
+ <td>
+ <?php
+ $options = array();
+ $options[0]=get_string("no");
+ $options[1]=get_string("yes");
+ choose_from_menu ($options, "hidenav", $form->hidenav, '');
?>
</td>
</tr>
@@ -264,6 +304,59 @@
<tr>
<td colspan="2">
<div id="windowsettings">
+ <table align="center">
+ <tr valign="top">
+ <td>
+ <b><?php print_string('stagesize','scorm'); ?></b><br />
+ <input name="width" type="text" size="4" value="<?php p($form->width) ?>" alt="<?php p($strwidth) ?>" />
+ <label for="width"><?php p($strwidth) ?></label><br />
+ <input name="height" type="text" size="4" value="<?php p($form->height) ?>" alt="<?php p($strheight) ?>" />
+ <label for="height"><?php p($strheight) ?></label>
+ </td>
+ </tr>
+ <tr valign="top">
+ <td>
+ <script type="text/javascript">
+ var popupitems = ["<?php echo implode('","',$SCORM_POPUP_OPTIONS); ?>"];
+ </script>
+ <br /><b><?php print_string('display','scorm'); ?>:</b><br />
+ <input type="radio"
+ name="popup"
+ value="0" alt="<?php p($striframe) ?>"
+ <?php echo ($form->popup == 0) ? "checked=\"checked\"" : "" ?>
+ onclick="return lockoptions('form', 'popup[1]', popupitems);"
+ />
+ <b title="<?php p($striframedisplay) ?>"><?php p($striframe) ?></b>
+ </td>
+ </tr>
+ <tr valign="top">
+ <td>
+ <input name="popup"
+ type="radio"
+ value="1"
+ alt="<?php p($strnewwindow)?>"
+ <?php echo ($form->popup == 1) ? "checked=\"checked\"" : "" ?>
+ onclick="return lockoptions('form', 'popup[1]', popupitems);"
+ />
+ <b title="<?php p($strnewwindowopen) ?>"><?php p($strnewwindow) ?></b>
+ <blockquote>
+ <?php
+ foreach ($window as $name => $value) {
+ echo "<input name=\"h$name\" type=\"hidden\" value=\"0\"/>\n";
+ echo "<input name=\"$name\" type=\"checkbox\" value=\"1\" ".$window->$name." alt=\"$name\" />\n";
+ $stringname = "str$name";
+ echo $$stringname."<br />\n";
+ }
+ ?>
+ <script type="text/javascript">
+ lockoptions('form','popup[1]', popupitems);
+ </script>
+ </blockquote>
+ </td>
+ </tr>
+ </table>
+ </div>
+<!-- <div id="windowsettings">
<table align="center">
<tr>
<td align="right"><b><?php print_string("popup","scorm") ?>:</b></td>
@@ -297,7 +390,7 @@
</td>
</tr>
</table>
- </div>
+ </div> -->
<script language="javascript" type="text/javascript">
showhide('advancedsettings', true);
showhide('windowsettings', true);
Oops, something went wrong.

0 comments on commit 77f18d3

Please sign in to comment.