Changeset 1702
- Timestamp:
- 03/19/10 19:32:38 (23 months ago)
- Location:
- trunk/model/sources/academic/gen/_scorm
- Files:
-
- 1 added
- 1 deleted
- 2 edited
-
svc/annotSvc.doss/annotSvc.js (modified) (2 diffs)
-
widg/annotBtn.doss/annot.js (deleted)
-
widg/annotBtn.doss/annotMgr.js (added)
-
widg/annotBtn.uiwidget (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/model/sources/academic/gen/_scorm/svc/annotSvc.doss/annotSvc.js
r1701 r1702 22 22 * Contributor(s): 23 23 * samuel.monsarrat@kelis.fr 24 * 24 25 * 25 26 * Alternatively, the contents of this file may be used under the terms of … … 47 48 getAnnot(pId) 48 49 50 hasAnnot(pId) 51 49 52 */ 50 53 51 54 //Instanciation du service 52 55 scServices.annotSvc = scOnLoads[scOnLoads.length] = { 53 54 isActive : function(){return this._isActive}, 55 56 _isActive : false, 57 onLoad: function(){ 58 if(scServices.scorm2k4 && scServices.scorm2k4.isScorm2k4Active()) { 59 this._isActive = true; 60 var vApi = scServices.scorm2k4.getScorm2k4API(); 61 var vCount = vApi.GetValue("cmi.comments_from_learner._count"); 62 this._annotMap = {}; 63 for(var i = 0; i < vCount; i++) this._annotMap[vApi.GetValue("cmi.comments_from_learner."+i+".location")] = i; 64 this.getAnnot = function(pId){ 56 _isActive : false, 57 isActive : function(){return this._isActive}, 58 onLoad: function(){ 59 if(scServices.scorm2k4 && scServices.scorm2k4.isScorm2k4Active()) { 60 this._isActive = true; 65 61 var vApi = scServices.scorm2k4.getScorm2k4API(); 66 if(pId in this._annotMap) return vApi.GetValue("cmi.comments_from_learner."+this._annotMap[pId]+".comment"); 67 return null; 68 }; 69 this.setAnnot = function(pId, pAnnot){ 70 var vApi = scServices.scorm2k4.getScorm2k4API(); 71 if(pId in this._annotMap) { 72 vApi.SetValue("cmi.comments_from_learner."+this._annotMap[pId]+".comment", pAnnot); 73 vApi.Commit(""); 74 } else { 75 var vIdx = vApi.GetValue("cmi.comments_from_learner._count"); 76 vApi.SetValue("cmi.comments_from_learner."+vIdx+".location", pId); 77 vApi.SetValue("cmi.comments_from_learner."+vIdx+".comment", pAnnot); 78 this._annotMap[pId] = vIdx; 79 vApi.Commit(""); 80 } 81 }; 82 } else if(scServices.storage && scServices.storage.isStorageActive()) { 83 this._isActive = true; 84 this.getAnnot = function(pId){ 85 var vItem = scServices.storage.getStorage().getItem(scServices.storage.getRootKey()+"annot/"+pId); 86 return vItem ? vItem.value : null; 87 }; 88 this.setAnnot = function(pId, pAnnot){ 89 scServices.storage.getStorage().setItem(scServices.storage.getRootKey()+"annot/"+pId, pAnnot); 90 }; 91 } else { 92 //Pour tests : mettre this._isActive = true; 93 this._isActive = false; 94 this._annot = {}; 95 this.getAnnot = function(pId){return this._annot[pId] || "";}; 96 this.setAnnot = function(pId, pAnnot){this._annot[pId] = pAnnot;}; 97 } 98 }, 99 loadSortKey: "2annotSvc" 62 var vCount = vApi.GetValue("cmi.comments_from_learner._count"); 63 this._annotMap = {}; 64 for(var i = 0; i < vCount; i++) this._annotMap[vApi.GetValue("cmi.comments_from_learner."+i+".location")] = i; 65 this.getAnnot = function(pId){ 66 var vApi = scServices.scorm2k4.getScorm2k4API(); 67 if(pId in this._annotMap) return vApi.GetValue("cmi.comments_from_learner."+this._annotMap[pId]+".comment"); 68 return null; 69 }; 70 this.setAnnot = function(pId, pAnnot){ 71 var vApi = scServices.scorm2k4.getScorm2k4API(); 72 if(pId in this._annotMap) { 73 vApi.SetValue("cmi.comments_from_learner."+this._annotMap[pId]+".comment", pAnnot); 74 vApi.Commit(""); 75 } else { 76 var vIdx = vApi.GetValue("cmi.comments_from_learner._count"); 77 vApi.SetValue("cmi.comments_from_learner."+vIdx+".location", pId); 78 vApi.SetValue("cmi.comments_from_learner."+vIdx+".comment", pAnnot); 79 this._annotMap[pId] = vIdx; 80 vApi.Commit(""); 81 } 82 }; 83 this.hasAnnot = function(pId){if (pId in this._annotMap) return true;return false;}; 84 } else if(scServices.scorm12 && scServices.scorm12.isScorm12Active()) { 85 this._isActive = true; 86 var vApi = scServices.scorm12.getScorm12API(); 87 try { 88 var vComments = vApi.LMSGetValue("cmi.comments"); 89 this._annot = scServices.dataUtil.deserialiseObjJs(vApi.LMSGetValue("cmi.comments")); 90 } catch(e){alert("WARNING : an error occured while retreiving student annotations.")} 91 if (!this._annot) this._annot = {}; 92 this.getAnnot = function(pId){return this._annot[pId] || "";}; 93 this.setAnnot = function(pId, pAnnot){ 94 var vApi = scServices.scorm12.getScorm12API(); 95 this._annot[pId] = pAnnot; 96 vApi.LMSSetValue("cmi.comments", scServices.dataUtil.serialiseObjJs(this._annot)); 97 vApi.LMSCommit(""); 98 }; 99 this.hasAnnot = function(pId){if (pId in this._annot) return true;return false;}; 100 this.getAnnotLength = function(){return scServices.dataUtil.serialiseObjJs(this._annot).length;}; 101 } else if(scServices.storage && scServices.storage.isStorageActive()) { 102 this._isActive = true; 103 this.getAnnot = function(pId){ 104 var vItem = scServices.storage.getStorage().getItem(scServices.storage.getRootKey()+"annot/"+pId); 105 return vItem ? vItem : null; 106 }; 107 this.setAnnot = function(pId, pAnnot){ 108 scServices.storage.getStorage().setItem(scServices.storage.getRootKey()+"annot/"+pId, pAnnot); 109 }; 110 this.hasAnnot = function(pId){if (pId in this._annot) return true;return false;}; 111 } else { 112 //Pour tests : mettre this._isActive = true; 113 this._isActive = false; 114 this._annot = {}; 115 this.getAnnot = function(pId){return this._annot[pId] || null;}; 116 this.setAnnot = function(pId, pAnnot){this._annot[pId] = pAnnot;}; 117 this.hasAnnot = function(pId){if (pId in this._annot) return true;return false;}; 118 } 119 }, 120 loadSortKey: "2annotSvc" 100 121 }; -
trunk/model/sources/academic/gen/_scorm/widg/annotBtn.uiwidget
r1701 r1702 8 8 <xsl:value-of select="execute(java:ensureIdOnCurrentResultElt($vDialog))"/> 9 9 </xsl:overlay></sm:postXslFragment> 10 <sm:linkScript path="annot .js" pathFrom="localPublishFiles" sortKey="annot"/>10 <sm:linkScript path="annotMgr.js" pathFrom="localPublishFiles" sortKey="annot"/> 11 11 </sm:fillTemplateBuffers> 12 12 <sm:content> 13 13 <span xmlns="http://www.w3.org/1999/xhtml" id="annotBtn"> 14 <a href="#" onclick="annot .toggleEditMode(this); return false;">14 <a href="#" onclick="annotMgr.toggleEditMode(this); return false;"> 15 15 <span>;Annotations</span> 16 16 </a>
Note: See TracChangeset
for help on using the changeset viewer.