Changeset 1269


Ignore:
Timestamp:
03/14/08 11:16:02 (4 years ago)
Author:
stp
Message:

application du patch [1253] pour retrouver l'état de la release 3.0.6 dans le tag

File:
1 edited

Legend:

Unmodified
Added
Removed
  • tags/3.0.6/model/sources/academic/gen/_scorm/genDeploy/claroline.doss/svc/lmsHack/lmsHack.js

    r1117 r1269  
    33        scServices.scorm2k4.xInitScorm2k4 = function(){ return false;}; 
    44} 
     5 
     6//optimisation : Désactivation des events unload inopérants sur Claroline 
     7scServices.scorm12.onUnload = function(){}; 
     8scServices.suspendDataStorage.onUnload = function(){}; 
     9scServices.exitModeStorage.onUnload = function(){}; 
     10scServices.assmntMgr.onUnload = function(){}; 
     11 
     12//optimisation : Bug Scenari 3.4.1.02 : ajout de this._Dirty = false; 
     13scServices.suspendDataStorage.commit = function() { 
     14        if( ! this._Dirty) return; 
     15        if(scServices.scorm2k4 && scServices.scorm2k4.isScorm2k4Active()) { 
     16                var vApi = scServices.scorm2k4.getScorm2k4API(); 
     17                vApi.SetValue("cmi.suspend_data", scServices.dataUtil.serialiseObjJs(this._Fields)); 
     18                vApi.Commit(""); 
     19        } else if(scServices.scorm12 && scServices.scorm12.isScorm12Active()) { 
     20                var vApi = scServices.scorm12.getScorm12API(); 
     21                vApi.LMSSetValue("cmi.suspend_data", scServices.dataUtil.serialiseObjJs(this._Fields)); 
     22                vApi.LMSCommit(""); 
     23        } else if(scServices.storage && scServices.storage.isStorageActive()) { 
     24                scServices.storage.getStorage().setItem(scServices.storage.getRootKey()+"suspend_data", scServices.dataUtil.serialiseObjJs(this._Fields)); 
     25        } 
     26        this._Dirty = false; 
     27} 
     28 
     29//Enregistrement régulier pour compenser l'echec durant l'évènement unload. 
     30function clarolineCycle(){ 
     31        if(scServices.scorm12 && scServices.scorm12.isScorm12Active()) { 
     32                var vApi = scServices.scorm12.getScorm12API(); 
     33                 
     34                //en multi-SCO : on passe en completed, incomplete en mono-SCO 
     35                var vStatus = vApi.LMSGetValue("cmi.core.lesson_status"); 
     36                if( ! vStatus || vStatus == "not attempted" ) vApi.LMSSetValue("cmi.core.lesson_status", scServices.storage ? "incomplete" : "completed"); 
     37                 
     38                if(scServices.suspendDataStorage._Dirty) { 
     39                        vApi.LMSSetValue("cmi.suspend_data", scServices.dataUtil.serialiseObjJs(scServices.suspendDataStorage._Fields)); 
     40                        scServices.suspendDataStorage._Dirty = false; 
     41                } 
     42                 
     43                var vDur = new Date().getTime() - scServices.exitModeStorage._timeStart; 
     44                var vH = vDur > 3600000 ? Math.floor(vDur / 3600000) : 0; 
     45                var vM = Math.floor(vDur / 60000) % 60; 
     46                var vS = Math.floor(vDur / 1000) % 60; 
     47                var vMs = Math.round(Math.floor(vDur % 1000)/10); 
     48                var vTime = (vH<10 ? "0"+vH : vH) + ":" + (vM<10 ? "0"+vM : vM) + ":" + (vS<10 ? "0"+vS : vS) + "." + (vMs<10 ? "0"+vMs : vMs); 
     49                vApi.LMSSetValue("cmi.core.session_time", vTime); 
     50                vApi.LMSSetValue("cmi.core.exit", ""); 
     51                 
     52                vApi.LMSCommit(""); 
     53        } 
     54} 
     55window.setInterval(clarolineCycle, 5000); 
Note: See TracChangeset for help on using the changeset viewer.