MDL-38489 SCORM: use course_get_format to obtain info
[moodle.git] / mod / scorm / view.js
1 M.mod_scormform = {};
2 M.mod_scormform.init = function(Y) {
3     var scormform = document.getElementById('scormviewform');
4     var cwidth = scormplayerdata.cwidth;
5     var cheight = scormplayerdata.cheight;
6     var poptions = scormplayerdata.popupoptions;
7     var launch = scormplayerdata.launch;
8     var currentorg = scormplayerdata.currentorg;
9     var sco = scormplayerdata.sco;
10     var scorm = scormplayerdata.scorm;
11     var launch_url = M.cfg.wwwroot+"/mod/scorm/player.php?a="+scorm+"&currentorg="+currentorg+"&scoid="+sco+"&sesskey="+M.cfg.sesskey;
12     var course_url = scormplayerdata.courseurl;
14     if ((cwidth==100) && (cheight==100)) {
15         poptions = poptions+',width='+screen.availWidth+',height='+screen.availHeight+',left=0,top=0';
16     } else {
17         if (cwidth<=100) {
18             cwidth = Math.round(screen.availWidth * cwidth / 100);
19         }
20         if (cheight<=100) {
21             cheight = Math.round(screen.availHeight * cheight / 100);
22         }
23         poptions = poptions+',width='+cwidth+',height='+cheight;
24     }
26     if (launch == true) {
27         launch_url = launch_url+"&display=popup";
28         window.open(launch_url,'Popup', poptions);
29         parent.window.location = course_url;
30     }
31     scormform.onsubmit = function() {window.open('', 'Popup', poptions); this.target='Popup'; parent.window.location = course_url;};
32 }