Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
path: root/Explore/elr/Science/S0502/shared/scripts/csl_navigation.js
diff options
context:
space:
mode:
Diffstat (limited to 'Explore/elr/Science/S0502/shared/scripts/csl_navigation.js')
-rwxr-xr-xExplore/elr/Science/S0502/shared/scripts/csl_navigation.js405
1 files changed, 0 insertions, 405 deletions
diff --git a/Explore/elr/Science/S0502/shared/scripts/csl_navigation.js b/Explore/elr/Science/S0502/shared/scripts/csl_navigation.js
deleted file mode 100755
index 619f079..0000000
--- a/Explore/elr/Science/S0502/shared/scripts/csl_navigation.js
+++ /dev/null
@@ -1,405 +0,0 @@
-
-
-// version --- CSL_1.3.0.0
-
-
-
-var resume = false;
-
-
-var calculateStatus = true;
-
-var loadFirstPage = true;
-
-
-//
-// Public functions
-//
-
-
-
-
-function setContentFrame(pFrame){
- contentFrame = pFrame;
-}
-
-
-
-function getContentFrame(){
- return contentFrame;
-}
-
-
-
-
-function addPage(pageId,pageURL){
- var tPage = new Page(pageId,pageURL);
- pages[pages.length] = tPage;
- tPage.index = Page.counter++;
- iAllowedScore += 1.0;
-}
-
-
-
-
-
-
-function gotoFirstPage(){
- saveCurrentPageData();
- var tPage = pages[0];
- if( tPage ){
- currentPage = 0;
- if(setValue){
- setValue(LESSON_LOCATION,tPage.pageURL);
- }
- contentFrame.document.location.href = selfLocation + tPage.pageURL;
- }
-}
-
-// This function will take the user to the last visited page in the SCO.
-function gotoLastVisitedPage(){
- if( getValue && resume){
- var resumeLocation = getValue(LESSON_LOCATION);
- if(checkResume(resumeLocation)){
- setCurrentPage(resumeLocation);
- contentFrame.document.location.href = resumeLocation;
- }
- else{
- var tPage = pages[0];
-
- if( tPage ){
- currentPage = 0;
- if(setValue){
- setValue(LESSON_LOCATION,tPage.pageURL);
- }
- contentFrame.document.location.href = selfLocation + tPage.pageURL;
- }
- }
- }
- else{
- gotoFirstPage();
- }
-}
-
-
-
-function gotoLastPage(){
- saveCurrentPageData();
- var tPage = pages[pages.length - 1];
- if(tPage){
- currentPage = pages.length - 1;
- if(setValue){
- setValue(LESSON_LOCATION,tPage.pageURL);
- }
- contentFrame.document.location.href = selfLocation + tPage.pageURL;
- }
-}
-
-
-
-
-
-function gotoPreviousPage(){
- saveCurrentPageData();
- if( currentPage > 0 ){
- var tIndex = currentPage - 1;
- var tPage = pages[tIndex];
- if( tPage ){
- currentPage = tIndex;
- if(setValue){
- setValue(LESSON_LOCATION,tPage.pageURL);
- }
- contentFrame.document.location.href = selfLocation + tPage.pageURL;
- }
- }
-}
-
-
-
-
-function gotoNextPage(){
- saveCurrentPageData();
- if( (currentPage + 1) < pages.length ){
- var tIndex = currentPage + 1;
- var tPage = pages[tIndex];
- if( tPage ){
- currentPage = tIndex;
- if(setValue){
- setValue(LESSON_LOCATION,tPage.pageURL);
- }
- contentFrame.document.location.href = selfLocation + tPage.pageURL;
- }
- }
-}
-
-
-function gotoPage(pageid){
-
- saveCurrentPageData();
- pageid = getPageIndex(pageid);
- if( pageid < pages.length && pageid >= 0){
- var tPage = pages[pageid];
- if( tPage ){
- currentPage = pageid;
- if(setValue){
- setValue(LESSON_LOCATION,tPage.pageURL);
- }
- contentFrame.document.location.href = selfLocation + tPage.pageURL;
- }
- }
-
-
-}
-
-function launchSCO(){
- getDataFromPersistence();
- selfLocation = self.location.href.substring(0, self.location.href.lastIndexOf("/") +1 ) ;
- if( loadFirstPage ){
- gotoLastVisitedPage();
- }
-}
-
-function exitSCO(){
- updateData();
-}
-
-
-
-function setCurrentPageStatus(status){
-
- var tPage = pages[currentPage];
- if( tPage ){
- if( status == "VISITED" ){
- tPage.userScore = 1.0;
- tPage.userStatus = VISITED;
- }
- else if( status == "PASSED" ){
- tPage.userScore = 1.0;
- tPage.userStatus = PASSED;
- }
- else if( status == "REVIEW" ){
- tPage.userScore = 0.0;
- tPage.userStatus = REVIEW;
- }
- else{
- tPage.userStatus = VISITED;
- }
- }
-}
-
-// The following variable and functions are used internally within this Javascripts and hence
-// should not be used outside this Javascript.
-
-
-var pages = new Array();
-// Current Page Index //
-var currentPage = -1;
-// Content Frame , Represents the frame in which the SCO's html pages will be launched
-var contentFrame = null;
-
-// Resume Location //
-var LESSON_LOCATION = "cmi.core.lesson_location";
-
-var iAllowedScore = 0.0;
-
-var iTotalUserScore = 0.0;
-var selfLocation = "";
-
-var UNVISITED = -1;
-var REVIEW = 0;
-var VISITED = 1;
-var PASSED = 2;
-
-var iUserStatus = "incomplete";
-
-
-
-function Page(pageId,pageURL){
- this.pageId = pageId;
- this.pageURL = pageURL;
- this.index = 0;
-
- this.userStatus = UNVISITED;
- this.userScore = 0.0;
-}
-Page.counter = 0;
-
-//
-// This function is added so that the navigation controls can change their
-// Appearance if there isnt any next page
-//
-
-function hasNextPage(){
- var retValue = false;
- var tIndex = currentPage + 1;
- if(pages[tIndex]){
- retValue = true;
- }
- return retValue;
-}
-
-//
-// This function is added so that the navigation controls can change their
-// Appearance if there isnt any previous page
-//
-
-function hasPreviousPage(){
- var retValue = false;
- var tIndex = currentPage - 1;
-
- if(pages[tIndex]){
- retValue = true;
- }
- return retValue;
-}
-
-
-function setCurrentPage(launchURL){
- var size = pages.length;
- var counter = 0;
- var tPage = null;
- matchFound = true;
-
- while(counter < size){
- tPage = pages[counter];
- if(tPage.pageURL == launchURL){
- matchFound = true;
- break;
- }
- counter++;
- }
- if(!matchFound){
- currentPage = 0;
- }else{
- currentPage = counter;
- }
-}
-
-function saveCurrentPageData(){
- if( currentPage > -1 ){
- setCurrentPageStatus("VISITED");
- }
-}
-
-function setPageStatus(pPageData){
- //debugger;
- var statusesData= pPageData.split(';');
- var length = statusesData.length;
- var counter = 0;
-
- var tData = "";
- var tDataArray = null;
- var pageId = "";
- var pageStatus = "";
- var pageStatuses= new Object();
-
- // get all the statuses.
- while( counter < length ){
- tData = statusesData[counter] + "";
- if(tData){
- tDataArray= tData.split(',');
- pageId = tDataArray[0];// pageid is first .
- pageStatus= tDataArray[1];// status is next .
-
- pageStatuses[pageId] = pageStatus;
- }
- counter++;
- }
-
- // now set all of them.
- for(pageindex = 0; pageindex < pages.length; pageindex++){
- var tPage = pages[pageindex];
- var tPageId = tPage.pageId + "";
- var tStatus;
-
- if( tPage ){
- tStatus = pageStatuses[tPageId];
-
- if(tStatus){
- tStatus= parseInt(tStatus);
- }
- else{
- tStatus = UNVISITED;
- }
-
- tPage.userStatus= tStatus;
- if( tPage.userStatus > REVIEW ){
- tPage.userScore = 1.0;
- }
- else{
- tPage.userScore = 0.0;
- }
- }
- }
-}
-
-
-function getDataFromPersistence(){
- var tPageData = "";
- if( self.getElementFromSuspendData ){
- tPageData = getElementFromSuspendData("page_data");
- }
- setPageStatus(tPageData);
-}
-
-function updateData(){
- saveCurrentPageData();
- var tString ="";
- iTotalUserScore = 0;
- for( i=0; i< pages.length; i++){
- tPage = pages[i];
- if( tPage ){
- if( tPage.userStatus > REVIEW ){
- iTotalUserScore += tPage.userScore;
- }
- tString += tPage.pageId + "," + tPage.userStatus + ";";
- }
- }
-
- if( calculateStatus && iAllowedScore > 0 ){
- if( iTotalUserScore >= iAllowedScore ){
- iUserStatus = "completed";
- }
- else{
- iUserStatus = "incomplete";
- }
- //setValue("cmi.core.score.raw",iTotalUserScore);
- setValue("cmi.core.lesson_status",iUserStatus );
- }
- if( self.addToSuspendData ){
- addToSuspendData("page_data",tString);
- }
-}
-
-
-function getPageIndex(pageid){
- var tPage;
- for( i=0; i < pages.length; i++){
- tPage = pages[i];
-
- if( tPage ){
- if( tPage.pageId == pageid ){
- return i;
- }
- }
- }
- return -1;
-}
-
-function checkResume(pLocation){
- var isValid = false;
- var counter = 0;
- var length = pages.length;
- var location = null;
-
- while(counter < length){
- location= pages[counter].pageURL;
- if(pLocation == location){
- isValid = true;
- break;
- }
- counter++;
- }
-
- return isValid;
-}