adding some strings
[moodle-linuxchix.git] / mod / hotpot / template / v6 / fjmatch6.js_
blob988ac5435a5f8e416229442855e2a72bd9c1e292
2 [inclScorm1.2]
3 //JMATCH-SPECIFIC SCORM-RELATED JAVASCRIPT CODE
5 function SetScormBrowseTime(){
6 if (API != null){
7                 API.LMSSetValue('cmi.core.session_time', MillisecondsToTime((new Date()).getTime() - ScormStartTime));
8                 API.LMSCommit('');
9         }
11 [/inclScorm1.2]
13 //JMATCH-SPECIFIC CORE JAVASCRIPT CODE
15 var CurrItem = null;
16 var Stage = 2;
17 var QList = new Array();
18 var ShuffleQs = [boolShuffleQs];
19         
20 function SetUpItems(){
22         var i;
23         var Row = null;
25 //Remove all the table rows and put them in an array for processing
26         var Qs = document.getElementById('Questions');
28 //Remove the table rows to an array
29         while (Qs.getElementsByTagName('tr').length > 0){
30                 Row = Qs.getElementsByTagName('tr')[0];
31                 Row.getElementsByTagName('td')[0].className = 'Hidden';
32                 Row.getElementsByTagName('td')[1].className = 'Hidden';
33                 QList.push(Qs.removeChild(Row));
34         }
35         
36 //Shuffle the rows
37         if (ShuffleQs == true){
38                 QList = Shuffle(QList);
39         }
41 //Write the rows back to the table body
42         for (i=0; i<QList.length; i++){
43                 Qs.appendChild(QList[i]);
44         }
47 function StartUp(){
49         SetUpItems();
50         
51 [inclScorm1.2]
52         initAPI(window);
53         if (API != null){
54                 API.LMSInitialize(''); 
55                 API.LMSSetValue('cmi.core.lesson_status', 'browsed');
56                 API.LMSSetValue('cmi.comments', 'This exercise has no checking or scoring features.');
57                 API.LMSCommit('');
58         }
59 [/inclScorm1.2]
62 [inclPreloadImages]
63         PreloadImages([PreloadImageList]);
64 [/inclPreloadImages]
66 [inclPreloadImages]
67         RefreshImages();
68 [/inclPreloadImages]
71 var Started = false;
73 function DeleteItem(){
74         if ((CurrItem == null)||(document.getElementById('Questions').getElementsByTagName('tr').length < 1)){return;}
75         
76 //Delete the current item
77         var DelItem = CurrItem;
78         Stage = 2;
79         ShowItem();
80         document.getElementById('Questions').removeChild(DelItem);
83 function ShowItem(){
84         var Qs = document.getElementById('Questions');
86         var Len = Qs.getElementsByTagName('tr').length;
88 //Bail if no more items
89         if (Len < 1){
90                 return;
91         }
92         
93 //if no current item, get the last item so we roll forward
94         if (CurrItem == null){
95                 CurrItem = Qs.getElementsByTagName('tr')[Len-1];
96                 if (CurrItem == null){
97                         return;
98                 }
99         }
100         
101 //if CurrItem has been fully shown, move to the next one
102         if (Stage == 2){
103                 CurrItem.getElementsByTagName('td')[0].className = 'Hidden';
104                 CurrItem.getElementsByTagName('td')[1].className = 'Hidden';
105                 if (CurrItem.nextSibling != null){
106                         CurrItem = CurrItem.nextSibling;
107                 }
108                 else{
109                         CurrItem = Qs.getElementsByTagName('tr')[0];
110                 }
111         }
112         
113 //Show the appropriate bits
114         if (Stage == 2){
115 //Show the first item and hide the second
116                 CurrItem.getElementsByTagName('td')[0].className = 'Showing';
117                 CurrItem.getElementsByTagName('td')[1].className = 'Hidden';
118                 Stage = 1;
119         }
120         else{
121 //Show both items
122                 CurrItem.getElementsByTagName('td')[0].className = 'Showing';
123                 CurrItem.getElementsByTagName('td')[1].className = 'Showing';
124                 Stage = 2;              
125         }
126         
127 [inclPreloadImages]
128         RefreshImages();
129 [/inclPreloadImages]