From: <se...@us...> - 2008-05-09 16:45:59
|
Revision: 111 http://acmcontester.svn.sourceforge.net/acmcontester/?rev=111&view=rev Author: sem62 Date: 2008-05-09 09:45:53 -0700 (Fri, 09 May 2008) Log Message: ----------- * Added call Initialize() if not initialized but calling set or getValue() method. * Added title to ChapterPropertyDlg. Modified Paths: -------------- WebEditor/src/edu/lnu/FireFly/WebEditor/GUI/Dialogs/ChapterPropertiestsDlg.java WebEditor/template/SummaryPageModel.html WebEditor/template/global/APIWrapper.js WebEditor/template/global/SummaryPage.js Modified: WebEditor/src/edu/lnu/FireFly/WebEditor/GUI/Dialogs/ChapterPropertiestsDlg.java =================================================================== --- WebEditor/src/edu/lnu/FireFly/WebEditor/GUI/Dialogs/ChapterPropertiestsDlg.java 2008-05-09 13:36:27 UTC (rev 110) +++ WebEditor/src/edu/lnu/FireFly/WebEditor/GUI/Dialogs/ChapterPropertiestsDlg.java 2008-05-09 16:45:53 UTC (rev 111) @@ -49,6 +49,7 @@ private void initComponents() { setDefaultCloseOperation(HIDE_ON_CLOSE); + setTitle("Propertiests..."); generalPanel = new javax.swing.JPanel(); titleLabel = new javax.swing.JLabel(); Modified: WebEditor/template/SummaryPageModel.html =================================================================== --- WebEditor/template/SummaryPageModel.html 2008-05-09 13:36:27 UTC (rev 110) +++ WebEditor/template/SummaryPageModel.html 2008-05-09 16:45:53 UTC (rev 111) @@ -33,7 +33,7 @@ </style> </head> -<body onload="Initialize();" onunload="Terminate();"> +<body onLoad="Initialize()" onunload="Terminate()"> <div id="page_content"> <Center><h1><!--title start--> <!--title end--></Center></h1> @@ -50,6 +50,13 @@ <!--content start--> <!--content end--> + + <script type="text/javascript" > + + writeAll(); + + </script> + </table> </div> </body> Modified: WebEditor/template/global/APIWrapper.js =================================================================== --- WebEditor/template/global/APIWrapper.js 2008-05-09 13:36:27 UTC (rev 110) +++ WebEditor/template/global/APIWrapper.js 2008-05-09 16:45:53 UTC (rev 111) @@ -45,6 +45,7 @@ // local variable used to keep from calling Terminate() more than once var terminated = "false"; +var initialized = "false"; // local variable used by the content developer to debug // This should be set to true during development to find errors. However, @@ -441,18 +442,25 @@ function Terminate() { - terminateCommunication(); + if (terminated == "false"){ + terminateCommunication(); + } } function Initialize() { - initializeCommunication(); + if (initialized == "false"){ + initializeCommunication(); + initialized = "true"; + } } function SetValue(p1, p2){ + Initialize(); storeDataValue(p1, p2); } function GetValue(p1){ + Initialize(); return retrieveDataValue(p1); } Modified: WebEditor/template/global/SummaryPage.js =================================================================== --- WebEditor/template/global/SummaryPage.js 2008-05-09 13:36:27 UTC (rev 110) +++ WebEditor/template/global/SummaryPage.js 2008-05-09 16:45:53 UTC (rev 111) @@ -5,14 +5,68 @@ document.write(s); } -function ins(title, min, max, raw, completionStatus){ - var percents = 100*(raw-min)/(max-min) + " %"; +var records = new Array(1000); +var curr_record = 0; + +function ins(title, min, max, raw, completionStatus, model){ + var record = new Array(7); + record[0] = completionStatus; + record[1] = title; + record[2] = min; + record[3] = max; + record[4] = raw; + record[5] = model; + record[6] = deep; + + records[curr_record] = record; + curr_record++; +} + +function recalcChaptersScores(){ + 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]); + } +} + +function writeAll(){ + 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]); + } +} + +function write(completionStatus, title, min, max, raw, modelName){ rowNum++; + var percents = "0"; + if ((min != null) && (max != null) && (raw != null)){ + percents = 100 * (raw - min) / (max - min) + " %"; + } + + if (modelName == "LectureModel"){ + raw = (completionStatus == "completed") ? "read" : "unread"; + percents = "--"; + } + + if (min == null){ + min = "--"; + } + + if (max == null){ + max = "--"; + } + + if (raw == null){ + raw = "--"; + } + var td = "<td class='tbl"; td += 1 - (rowNum % 2) + 1; - td += "'>"; - + td += "'>"; + document.write("<TR>" + td + rowNum + "<img src='global/images/" + completionStatus + ".gif'>"); document.write(td + title); document.write(td + min); @@ -37,7 +91,7 @@ title = " " + title; } - ins(title, getScore(id, "min"), getScore(id, "max"), getScore(id, "raw"), getCompletionStatus(id)); + ins(title, getScore(id, "min"), getScore(id, "max"), getScore(id, "raw"), getCompletionStatus(id), modelName); } function getObjectiveIndex(id){ @@ -52,14 +106,20 @@ } function getCompletionStatus(objectiveID){ - var index = getObjectiveIndex(objectiveID); - var res = GetValue("cmi.objectives." + index + ".completionStatus"); + var index = getObjectiveIndex(objectiveID); + if (index == -1) return "incomplete"; + + var res = GetValue("cmi.objectives." + index + ".completion_status"); + return res != null ? res : "undefined"; } function getScore(objectiveID, field){ - var index = getObjectiveIndex(objectiveID); + var index = getObjectiveIndex(objectiveID); + + if (index == -1) return null; + var res = GetValue("cmi.objectives." + index + ".score." + field); return res != null ? res : 0; } \ No newline at end of file This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |