Bonjour,

J'ai un document index.html qui contient du javascript. J'essais d'ajouter une variable cmi.core.lesson_location.

Cette variable est compris dans le scorm 1.2

Lors de l'ouverture d'une formation web je fais un getvalue pour aller chercher le numéro de la page ou l'apprenant était rendu

Par la suite je fais un setvalue au logiciel de formation mais lors de l'ouverture je suis toujours à la page 1

Je vous joins mon ducument, si quelqu'un peut m'aider car je suis vraiment perdu dans tout ça

Merci


Code html : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Frameset//EN">
<!--(c)2002 HUMENG International Inc (1-866-444-1612) (2005/02/22)-->
<HTML>
<HEAD><TITLE>T-Prof II</TITLE>
<META HTTP-EQUIV="Content-Style-Type" CONTENT="text/css">
<SCRIPT LANGUAGE=JAVASCRIPT TYPE="text/javascript">
var _ScormActive = 1;
var _NoError = 0;
var _GeneralException = 101;
var _ServerBusy = 102;
var _InvalidArgumentError = 201;
var _ElementCannotHaveChildren = 202;
var _ElementIsNotAnArray = 203;
var _NotInitialized = 301;
var _NotImplementedError = 401;
var _InvalidSetValue = 402;
var _ElementIsReadOnly = 403;
var _ElementIsWriteOnly = 404;
var _IncorrectDataType = 405;
var apiHandle = null;
var API = null;
var findAPITries = 0;
var Global = 0;
var ExerCnt = 0;
var ExerMax = 0;
var BigStartTime;
var BigEndTime;
var _Debug = false;
var exerindex = new Array(250);
var exercounter = 0;
var LastLocation;
function getAPIHandle()
{
 if (apiHandle == null)
 {
  apiHandle = getAPI();
 }
 return apiHandle;
}
 
function findAPI(win)
{
 while ((win.API == null) && (win.parent != null) && (win.parent != win))
 {
  findAPITries++;
  if (findAPITries > 7)
  {
   alert("Error finding API -- too deeply nested.");
   return null;
  }
  win = win.parent;
 }
 return win.API;
}
function getAPI()
{
 var theAPI = findAPI(window);
 if ((theAPI == null) && (window.opener != null) && (typeof(window.opener) != "undefined"))
 {
  theAPI = findAPI(window.opener);
 }
 if (theAPI == null)
 {
  alert("Unable to find an API adapter");
 }
return theAPI
}
function doLMSInitialize()
{
 var api = getAPIHandle();
 if (api == null)
 {
  alert("Unable to locate the LMS's API Implementation.\nLMSInitialize was not successful.");
  return "false";
 }
 var result = api.LMSInitialize("");
 
 if (result.toString() != "true")
 {
  var err = ErrorHandler();
 }
 BigStartTime = new Date();
 return result.toString();
}
function doLMSFinish()
{
 var api = getAPIHandle();
 if (api == null)
 {
  alert("Unable to locate the LMS's API Implementation.\nLMSFinish was not successful.");
  return "false";
 }
 else
 {
  var result = api.LMSFinish("");
  if (result.toString() != "true")
  {
   var err = ErrorHandler();
  }
 }
 return result.toString();
}
function doLMSGetValue(name)
{
 var api = getAPIHandle();
 if (api == null)
 {
  alert("Unable to locate the LMS's API Implementation.\nLMSGetValue was not successful.");
  return "";
 }
 else
 {
  var value = api.LMSGetValue(name);
  var errCode = api.LMSGetLastError().toString();
  if (errCode != _NoError)
  {
   var errDescription = api.LMSGetErrorString(errCode);
   return "";
  }
  else
  {
   return value.toString();
  }
 }
}
function doLMSSetValue(name, value)
{
 var api = getAPIHandle();
 if (api == null)
 {
  alert("Unable to locate the LMS's API Implementation.\nLMSSetValue was not successful.");
  return;
 }
 else
 {
  var result = api.LMSSetValue(name, value);
  if (result.toString() != "true")
  {
   var err = ErrorHandler();
  }
 }
 return;
}
function doLMSCommit()
{
 var api = getAPIHandle();
 if (api == null)
 {
  alert("Unable to locate the LMS's API Implementation.\nLMSCommit was not successful.");
  return "false";
 }
 else
 {
  var result = api.LMSCommit("");
  if (result != "true")
  {
   var err = ErrorHandler();
  }
 }
 return result.toString();
}
function doLMSGetLastError()
{
 var api = getAPIHandle();
 if (api == null)
 {
  alert("Unable to locate the LMS's API Implementation.\nLMSGetLastError was not successful.");
  return _GeneralError;
 }
 return api.LMSGetLastError().toString();
}
function doLMSGetErrorString(errorCode)
{
 var api = getAPIHandle();
 if (api == null)
 {
  alert("Unable to locate the LMS's API Implementation.\nLMSGetErrorString was not successful.");
 }
 return api.LMSGetErrorString(errorCode).toString();
}
function doLMSGetDiagnostic(errorCode)
{
 var api = getAPIHandle();
 if (api == null)
 {
  alert("Unable to locate the LMS's API Implementation.\nLMSGetDiagnostic was not successful.");
 }
 return api.LMSGetDiagnostic(errorCode).toString();
}
function LMSIsInitialized()
{
 var api = getAPIHandle();
 if (api == null)
 {
  alert("Unable to locate the LMS's API Implementation.\nLMSIsInitialized() failed.");
  return false;
 }
 else
 {
  var value = api.LMSGetValue("cmi.core.student_name");
  var errCode = api.LMSGetLastError().toString();
  if (errCode == _NotInitialized)
  {
   return false;
  }
  else
  {
   return true;
  }
 }
}
function ErrorHandler()
{
 var api = getAPIHandle();
 if (api == null)
 {
  alert("Unable to locate the LMS's API Implementation.\nCannot determine LMS error code.");
  return;
 }
 var errCode = api.LMSGetLastError().toString();
 if (errCode != _NoError)
 {
  var errDescription = api.LMSGetErrorString(errCode);
  if (_Debug == true)
  {
   errDescription += "\n";
   errDescription += api.LMSGetDiagnostic(null);
  }
  alert(errDescription);
 }
 return errCode;
}
function doElapse(elapse) {
  if(elapse>=1000) {
    secs=Math.round(elapse/1000);
    mins=Math.round(secs/60);
    hrs=Math.round(mins/60);
    secs=secs%60;
    mins=mins%60;
    hrs=hrs%24;
    var stem="";
    if (hrs>9) { stem=hrs+":"; } else { stem="0"+hrs+":"; }
    if (mins>9){ stem+=mins+":"; } else { stem+="0"+mins+":"; }
    if (secs>9){ stem+=secs; } else { stem+="0"+secs; }
    return stem;
  } else {
    return "00:00:00";
  }
}
function CBTClose() {
 BigEndTime = new Date();
 doLMSSetValue("cmi.core.session_time",doElapse(BigEndTime-BigStartTime));
 <!-->LastLocation = doLMSGetValue("cmi.core.lesson_location");-->
 doLMSSetValue("cmi.core.lesson_location",LastLocation);
 if(ExerMax>0) {
  raw=Global / ExerMax;
 } else {
  raw = 0;
 }
 doLMSSetValue("cmi.core.score.raw",Math.round(raw));
 if(ExerCnt>=ExerMax) {
  doLMSSetValue("cmi.core.lesson_status","completed");
 } else {
  doLMSSetValue("cmi.core.lesson_status","incomplete");
 }
 
 if(ExerCnt>=ExerMax) {
  doLMSSetValue("cmi.core.exit", "logout");
 } else {
  doLMSSetValue("cmi.core.exit", "suspend");
 }
 
 doLMSCommit();
 doLMSFinish();
 window.close();
 window.parent.close();
}
doLMSInitialize();
LastLocation = doLMSGetValue("cmi.core.lesson_location");
 
         
doLMSSetValue("cmi.core.lesson_location",LastLocation);
 
 
var PageItems = new Array();
function getPageItem(pageID,itemID)
{
 if (PageItems[pageID]==null) {
  return 0;
 }
 else {
  if (PageItems[pageID][itemID]==null) { return 0; }
  else { return PageItems[pageID][itemID];
                         }
 }
 return 1;
 
}
function setPageItem(pageID,itemID,value)
{
 if (PageItems[pageID]==null) {
  PageItems[pageID] = new Array(21);
        if (pageID > 1) { 
        LastLocation = pageID;
        }
<!--    doLMSSetValue("cmi.core.lesson_location",LastLocation);-->
  }
 PageItems[pageID][itemID]=value;
 return value;
}
function setMaxExer(val) {
  ExerMax=val;
}
function setExer(page_id,exer_id,exer_type,max,good,bad,elapse) {
 if (_ScormActive==1) {
 exerindex[exer_id]=exercounter;
 exer_id = exercounter;
 exercounter++;
  try {
   var options = doLMSGetValue("cmi.interactions._children");
   if(options.indexOf("id")>=0) {
    doLMSSetValue("cmi.interactions."+exer_id+".id",page_id);
   }
   if(options.indexOf("type")>=0) {
    doLMSSetValue("cmi.interactions."+exer_id+".type",exer_type);
   }
   if(options.indexOf("time")>=0) {
    doLMSSetValue("cmi.interactions."+exer_id+".time",doElapse(elapse));
   }
   if(max>bad) {
    value=((max-bad)*100) / max;
    Global += value;
    if(options.indexOf("student_response")>=0) {
     doLMSSetValue("cmi.interactions."+exer_id+".student_response",Math.round(value));
    }
   } else {
    if(options.indexOf("student_response")>=0) {
     doLMSSetValue("cmi.interactions."+exer_id+".student_response",0);
    }
   }
   ExerCnt++;
   if(options.indexOf("result")>=0) {
    if (bad==0) {
     doLMSSetValue("cmi.interactions."+exer_id+".result","correct");
    } else {
     doLMSSetValue("cmi.interactions."+exer_id+".result","wrong");
    }
   }
  }
  catch(e) {
   var msg = (e.message) ? e.message : e.description;
  }
 }
}
 
</SCRIPT>
</HEAD>
<FRAMESET COLS="*,640,*" BORDER=0 FRAMEBORDER=0>
<FRAME FRAMEBORDER=0 SCROLLING="NO" Src="course/documents/border.html" NORESIZE>
<FRAMESET ROWS="40,390,60,*" BORDER=0 FRAMEBORDER=0>
<FRAME NAME="TP2TOP" FRAMEBORDER=0 SCROLLING="NO" Src="" NORESIZE>
<FRAME NAME="TP2CLNT" FRAMEBORDER=0 SCROLLING="YES" Src="course/documents/page0001.html" NORESIZE>
<FRAME NAME="TP2BAR" FRAMEBORDER=0 SCROLLING="NO" Src="course/documents/ctrl.html" NORESIZE>
<FRAME FRAMEBORDER=0 SCROLLING="NO" Src="course/documents/border.html" NORESIZE>
</FRAMESET>
<FRAME FRAMEBORDER=0 SCROLLING="NO" Src="course/documents/border.html" NORESIZE>
</FRAMESET>
</HTML>