MDL-15993 The method to calculate the SCORM area needs to be changed - based on screen size alone does not make sense with big screens. Only allow the overide of the height parameter if it is less than the user specified (user specified is no allowed to be less than 400). Also - removed gratuitous use of whitespace.

This commit is contained in:
piers 2008-08-12 01:26:10 +00:00
parent 4ac912b856
commit d49ad45872
2 changed files with 8 additions and 52 deletions

View File

@ -140,7 +140,7 @@
<script type="text/javascript">
<!--
window.onresize = function() {
scorm_resize();
scorm_resize(<?php echo $scorm->width.", ".$scorm->height; ?>);
};
-->
</script>
@ -163,74 +163,40 @@
<?php
if ($scorm->hidetoc == 0) {
?>
<div id="tocbox">
<?php
if ($scorm->hidenav ==0){
?>
<!-- Bottons nav at left-->
<div id="tochead">
<form name="tochead" method="post" action="player.php?id=<?php echo $cm->id ?>" target="_top">
<?php
$orgstr = '&amp;currentorg='.$currentorg;
if (($scorm->hidenav == 0) && ($sco->previd != 0) && (!isset($sco->previous) || $sco->previous == 0)) {
// Print the prev LO button
$scostr = '&amp;scoid='.$sco->previd;
$url = $CFG->wwwroot.'/mod/scorm/player.php?id='.$cm->id.$orgstr.$modestr.$scostr;
?>
<input name="prev" type="button" value="<?php print_string('prev','scorm') ?>" onClick="document.location.href=' <?php echo $url; ?> '"/>
<?php
}
if (($scorm->hidenav == 0) && ($sco->nextid != 0) && (!isset($sco->next) || $sco->next == 0)) {
// Print the next LO button
$scostr = '&amp;scoid='.$sco->nextid;
$url = $CFG->wwwroot.'/mod/scorm/player.php?id='.$cm->id.$orgstr.$modestr.$scostr;
?>
<input name="next" type="button" value="<?php print_string('next','scorm') ?>" onClick="document.location.href=' <?php echo $url; ?> '"/>
<?php
}
?>
</form>
</div> <!-- tochead -->
<?php
}
?>
<div id="toctree" class="generalbox">
<?php echo $result->toc; ?>
</div> <!-- toctree -->
</div> <!-- tocbox -->
<?php
$class = ' class="toc"';
@ -269,41 +235,29 @@
<?php
$orgstr = '&amp;currentorg='.$currentorg;
if (($scorm->hidenav == 0) && ($sco->previd != 0) && (!isset($sco->previous) || $sco->previous == 0) && (($scorm->hidetoc == 2) || ($scorm->hidetoc == 1)) ) {
// Print the prev LO button
$scostr = '&amp;scoid='.$sco->previd;
$url = $CFG->wwwroot.'/mod/scorm/player.php?id='.$cm->id.$orgstr.$modestr.$scostr;
?>
<form name="scormnavprev" method="post" action="player.php?id=<?php echo $cm->id ?>" target="_top" style= "display:inline">
<input name="prev" type="button" value="<?php print_string('prev','scorm') ?>" onClick="document.location.href=' <?php echo $url; ?> '"/>
</form>
<?php
}
if ($scorm->hidetoc == 2) {
echo $result->tocmenu;
}
if (($scorm->hidenav == 0) && ($sco->nextid != 0) && (!isset($sco->next) || $sco->next == 0) && (($scorm->hidetoc == 2) || ($scorm->hidetoc == 1))) {
// Print the next LO button
$scostr = '&amp;scoid='.$sco->nextid;
$url = $CFG->wwwroot.'/mod/scorm/player.php?id='.$cm->id.$orgstr.$modestr.$scostr;
?>
<form name="scormnavnext" method="post" action="player.php?id=<?php echo $cm->id ?>" target="_top" style= "display:inline">
<input name="next" type="button" value="<?php print_string('next','scorm') ?>" onClick="document.location.href=' <?php echo $url; ?> '"/>
</form>
<?php
}
?>
</div>
<?php
}
@ -322,10 +276,8 @@
<?php
if ($result->prerequisites) {
if ($scorm->popup == 0) {
echo " <script type=\"text/javascript\">scorm_resize();</script>\n";
echo " <script type=\"text/javascript\">scorm_resize(".$scorm->width.", ".$scorm->height.");</script>\n";
$fullurl="loadSCO.php?id=".$cm->id.$scoidstr.$modestr;
echo " <iframe id=\"scoframe1\" class=\"scoframe\" name=\"scoframe1\" src=\"{$fullurl}\"></iframe>\n";
} else {
// Clean the name for the window as IE is fussy
@ -337,7 +289,7 @@
?>
<script type="text/javascript">
//<![CDATA[
scorm_resize();
scorm_resize(<?php echo $scorm->width.", ". $scorm->height; ?>);
function openpopup(url,name,options,width,height) {
fullurl = "<?php echo $CFG->wwwroot.'/mod/scorm/' ?>" + url;
windowobj = window.open(fullurl,name,options);

View File

@ -13,7 +13,7 @@ function scorm_get_element_style(obj, prop, cssProp) {
return ret;
}
function scorm_resize () {
function scorm_resize (cwidth, cheight) {
var winwidth = 0, winheight = 0;
if( typeof( window.innerWidth ) == 'number' ) {
//Non-IE
@ -62,6 +62,10 @@ function scorm_resize () {
bottommargin+10; // +10 to save a minor vertical scroll always present!
var totalheighttoc = totalheight+imsnavheight;
// override total height with configured height if it is smaller
if (cheight >= 400 && winheight > cheight) {
winheight = cheight;
}
var toctree = document.getElementById('toctree');
if (toctree != null){
var toctreeHeight = toctree.offsetHeight;