From: <se...@us...> - 2008-05-12 20:06:32
|
Revision: 130 http://acmcontester.svn.sourceforge.net/acmcontester/?rev=130&view=rev Author: sem62 Date: 2008-05-12 13:05:40 -0700 (Mon, 12 May 2008) Log Message: ----------- Some modifications in templates. Summary page now can calculate informations for chapters. Modified Paths: -------------- WebEditor/src/edu/lnu/FireFly/WebEditor/AppletWithApiHandle.java WebEditor/template/LectureModel.html WebEditor/template/SimpleQuestionModel.html WebEditor/template/global/SummaryPage.js WebEditor/template/global/simpleQ.js Modified: WebEditor/src/edu/lnu/FireFly/WebEditor/AppletWithApiHandle.java =================================================================== --- WebEditor/src/edu/lnu/FireFly/WebEditor/AppletWithApiHandle.java 2008-05-12 18:23:49 UTC (rev 129) +++ WebEditor/src/edu/lnu/FireFly/WebEditor/AppletWithApiHandle.java 2008-05-12 20:05:40 UTC (rev 130) @@ -32,7 +32,7 @@ return "incomplete"; } - return ""; + return "6"; } static public boolean SetValue(String parameter, String value){ Modified: WebEditor/template/LectureModel.html =================================================================== --- WebEditor/template/LectureModel.html 2008-05-12 18:23:49 UTC (rev 129) +++ WebEditor/template/LectureModel.html 2008-05-12 20:05:40 UTC (rev 130) @@ -11,7 +11,7 @@ </script> </head> -<body onload="Initialize();" onunload="finish();"> +<body onLoad="Initialize()" onunload="finish()"> <div id="lecture_caption"> <!--caption start-->New caption<!--caption end--> </div> Modified: WebEditor/template/SimpleQuestionModel.html =================================================================== --- WebEditor/template/SimpleQuestionModel.html 2008-05-12 18:23:49 UTC (rev 129) +++ WebEditor/template/SimpleQuestionModel.html 2008-05-12 20:05:40 UTC (rev 130) @@ -6,7 +6,7 @@ <script type="text/javascript" src="global/simpleQ.js"></script> </head> -<body onload="Initialize();" onunload="Terminate();"> +<body onLoad="Initialize()" onunload="Terminate();"> <div id="simpleQ_caption"> <!--caption start-->New caption<!--caption end--> </div> Modified: WebEditor/template/global/SummaryPage.js =================================================================== --- WebEditor/template/global/SummaryPage.js 2008-05-12 18:23:49 UTC (rev 129) +++ WebEditor/template/global/SummaryPage.js 2008-05-12 20:05:40 UTC (rev 130) @@ -23,16 +23,76 @@ } function recalcChaptersScores(){ + var record = new Array(7); + record[2] = 0; + record[3] = 0; + record[4] = 0; + record[6] = 1; + + records[curr_record] = record; + curr_record++; + + var stack = new Array(curr_record); + stack[0] = 0; + var stackPos = 0; + + record = records[0]; + record[2] = 0; + record[3] = 0; + record[4] = 0; + var i; - for (i = 0; i < curr_record; i++){ - var record = records[i]; - write(record[0], record[1], record[2], record[3], record[4], record[5]); + for (i = 1; i < curr_record; i++){ + record = records[i]; + var prevRec = records[i-1]; + + var parentRec = records[stack[stackPos]]; + + while (record[6] < prevRec[6]){ + stackPos--; + var parent_parent = records[stackPos]; + + if (parseInt(parentRec[2])){ + parent_parent[2] += parseInt(parentRec[2]); + } + if (parseInt(parentRec[3])){ + parent_parent[3] += parseInt(parentRec[3]); + } + if (parseInt(parentRec[4])){ + parent_parent[4] += parseInt(parentRec[4]); + } + + prevRec = parentRec; + } + + if (record[5] == "ChapterModel"){ + stackPos++; + stack[stackPos] = i; + + record[2] = 0; + record[3] = 0; + record[4] = 0; + + continue; + } + + if (parseInt(record[2])){ + parentRec[2] += parseInt(record[2]); + } + if (parseInt(record[3])){ + parentRec[3] += parseInt(record[3]); + } + if (parseInt(record[4])){ + parentRec[4] += parseInt(record[4]); + } } } function writeAll(){ + recalcChaptersScores(); + var i; - for (i = 0; i < curr_record; i++){ + for (i = 0; i < curr_record - 1; i++){ var record = records[i]; write(record[0], record[1], record[2], record[3], record[4], record[5]); } Modified: WebEditor/template/global/simpleQ.js =================================================================== --- WebEditor/template/global/simpleQ.js 2008-05-12 18:23:49 UTC (rev 129) +++ WebEditor/template/global/simpleQ.js 2008-05-12 20:05:40 UTC (rev 130) @@ -106,7 +106,7 @@ SetValue("cmi.objectives.0.score.raw", raw); SetValue("cmi.objectives.0.score.scaled", scaled); - var pref = "cmi.interactions." + (GetValue("cmi.interactions._count") - 1); + var pref = "cmi.interactions." + (GetValue("cmi.interactions._count")); if (singleAnswer){ var i; for (i=0; i < answers.length; i++){ This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |