From: <se...@us...> - 2008-05-06 09:48:44
|
Revision: 91 http://acmcontester.svn.sourceforge.net/acmcontester/?rev=91&view=rev Author: sem62 Date: 2008-05-06 02:48:50 -0700 (Tue, 06 May 2008) Log Message: ----------- Moved resources files Added Paths: ----------- WebEditor/resources/ WebEditor/resources/api.js WebEditor/resources/images/ WebEditor/resources/index.html WebEditor/service/ WebEditor/template/ WebEditor/template/SummaryPageModel.html WebEditor/template/global/SummaryPage.js Removed Paths: ------------- WebEditor/resources/index.html WebEditor/src/resources/ WebEditor/src/service/ WebEditor/src/template/ WebEditor/template/SummaryPageModel.html WebEditor/template/global/SummaryPage.js Copied: WebEditor/resources (from rev 74, WebEditor/src/resources) Copied: WebEditor/resources/api.js (from rev 90, WebEditor/src/resources/api.js) =================================================================== --- WebEditor/resources/api.js (rev 0) +++ WebEditor/resources/api.js 2008-05-06 09:48:50 UTC (rev 91) @@ -0,0 +1,63 @@ +function Initialize(param) +{ + return document.player.Initialize(param); +} + +function Terminate(param) +{ + return document.player.Terminate(param); +} + +function SetValue(name,value) +{ + return document.player.SetValue(name, value); +} +function GetValue(name) +{ + return document.player.GetValue(name); +} +function Commit(param) +{ + var returnVal = document.player.Commit(param); + var status = GetValue("cmi.core.lesson_status"); + if (status=="passed" || status=="failed") + navigation.location.reload(); + return returnVal; +} +function GetLastError() +{ + return document.player.GetLastError(); +} +function GetErrorString(code) +{ + return document.player.GetErrorString(code); +} +function GetDiagnostic(param) +{ + return document.player.GetDiagnostic(param); +} +function GetVersion() +{ + return "1.0 "; +} + +var API = new Object(); //previous version support +API.Initialize = Initialize; +API.Terminate = Terminate; +API.SetValue = SetValue; +API.GetValue = GetValue; +API.Commit = Commit; +API.GetLastError = GetLastError; +API.GetErrorString = GetErrorString; +API.GetDiagnostic = GetDiagnostic; + +var API_1484_11 = new Object(); //SCORM 2004 support +API_1484_11.Initialize = Initialize; +API_1484_11.Terminate = Terminate; +API_1484_11.SetValue = SetValue; +API_1484_11.GetValue = GetValue; +API_1484_11.Commit = Commit; +API_1484_11.GetLastError = GetLastError; +API_1484_11.GetErrorString = GetErrorString; +API_1484_11.GetDiagnostic = GetDiagnostic; +API_1484_11.version = GetVersion; Copied: WebEditor/resources/images (from rev 75, WebEditor/src/resources/images) Deleted: WebEditor/resources/index.html =================================================================== --- WebEditor/src/resources/index.html 2008-05-02 16:39:58 UTC (rev 74) +++ WebEditor/resources/index.html 2008-05-06 09:48:50 UTC (rev 91) @@ -1,53 +0,0 @@ -<html><head> - - <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> - <link rel="stylesheet" href="main.css" type="text/css"> - - <title>FireFly SCORM 2004 Course Player</title> -<script type="text/javascript" src="api.js"></script> -<script type="text/javascript" src="navigation.js"></script> - -</head> -<body topmargin="0" leftmargin="0" onUnload="exit_clicked(false);" bgcolor="#EBFAFE" link="#ff0000" marginheight="0" marginwidth="0" text="#ffffff" vlink="#505050"> - -<table border="0" cellpadding="0" cellspacing="0" height="100%" width="100%"> - <tbody><tr height="20"> - <td><img src="images/left_elipse.jpg"/></td><td bgcolor=#6A9AE2> <img src="images/FireFly.gif"><div class="header">Education System</div> </td> - <td colspan="5" align="right" bgcolor=#6A9AE2 valign="bottom"> - <img src="images/close.jpg" onClick="exit_clicked(true);" alt="Close"> - </td> - <td><image src="images/right_elipse.jpg"/></td> - </tr><tr height="*"> - <td></td> - <td width="150"> - <applet mayscript="" name="player" archive="webeditor.jar,RTEValidators.jar,FFManifest.jar, dom4j.jar" code=edu.lnu.FireFly.WebEditor.WebEditor.class width="100%" height="100%"> - </applet> - </td> - <td colspan="5" style="padding-left: 5px; padding-right: 3px; width: 100%;" width="*"> - <iframe name="ContentFrame" marginwidth="0" marginheight="0" frameborder="1" height="100%" scrolling="auto" width="100%"></iframe> - </td> - <td></td> - </tr><tr height="30" valign="center"> - <td><image src="images/left_elipse.jpg"/></td> - <td width="150" bgcolor=#6A9AE2> </td> - <td width="100" bgcolor=#6A9AE2></td> - <form name="navForm" action=""></form> - <td width="50" bgcolor=#6A9AE2> - <input style="display: none;" name="prevBtn" src="images/prev.jpg" onClick="previous()" type="image"> - <input name="prevBtn_disabled" style="display: block;" src="images/prev_disabled.jpg" onClick="return false;" type="image"></td> - <td bgcolor=#6A9AE2 style="padding-left: 10px; padding-right: 10px;" width="70"> - <td bgcolor=#6A9AE2 width="50"> - <input style="display: none;" name="nextBtn" src="images/next.jpg" onClick="next()" type="image"> - <input name="nextBtn_disabled" style="display: block;" src="images/next_disabled.jpg" onClick="return false;" type="image"> - </td> - <td bgcolor=#6A9AE2 width="100%"> <span id=TimeLeft name=TimeLeft> </span></td> - <td><image src="images/right_elipse.jpg"/></td> - - </tr> - - - -</tbody> -</table> -</body> -</html> \ No newline at end of file Copied: WebEditor/resources/index.html (from rev 89, WebEditor/src/resources/index.html) =================================================================== --- WebEditor/resources/index.html (rev 0) +++ WebEditor/resources/index.html 2008-05-06 09:48:50 UTC (rev 91) @@ -0,0 +1,125 @@ +<html><head> + <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> + <title>Learning system :: Editor of courses</title> + <script type="text/javascript" src="api.js"></script> + <script type="text/javascript" src="navigation.js"></script> + + <style> +.left-corn { + width: 20px; + height: 39px; + background-color: #f5fab8; + background-image: url(images/left-corn.gif); + background-repeat: no-repeat; +} + +.right-corn { + width: 20px; + height: 39px; + background-color: #f5fab8; + background-image: url(images/right-corn.gif); + background-repeat: no-repeat; +} +.capmain { + font-family: Verdana, Tahoma, Arial, sans-serif; + font-size: 11px; + font-weight: bold; + color: #555; + width: 100%; + height: 39px; + background-color: #f1fa07; + background-image: url(images/cellpic.gif); + border-bottom: 1px solid #e1e1e1; + padding: 2px 4px 4px 4px; +} +.border { + border-left: 1px ridge #579c48; + border-right: 1px ridge #579c48; + border-bottom: 1px ridge #579c48; +} + +.main-body { + font-size: 11px; + color: #333; + background-color: #fdfced; + padding: 4px 4px 5px 4px; +} +.scapmain { + font-family: Verdana, Tahoma, Arial, sans-serif; + font-size: 10px; + font-weight: bold; + width: 100%; + height: 39px; + color: #777; + background-color: #b0dbbe; + background-image: url(images/cellpic2.gif); + border-bottom: 1px solid #e1e1e1; + padding: 4px; +} + </style> + +</head> + +<body onUnload="exit_clicked(false);" bgcolor='#215E21'> + <table width=100% height=100% border="0" bgcolor='#f5fab8'> + <tr height='1px'><td> + <table cellpadding='0' cellspacing='0' width='100%'> + <tr> + <td align='center' class='capmain'>Web course editor</td> + </tr> + </table> + <tr><td> + <table border="0" cellpadding="0" cellspacing="0" height="100%" width="100%"> + <tbody> + <tr height="*"> + <td width="250"> + <table cellpadding='0' cellspacing='0' height='97%' width='100%' class='border'> + <tr height='1px'> + <td> + <table cellpadding='0' cellspacing='0' width='100%'> + <tr> + <td class='scapmain'>Course structure</td> + </tr> + </table> + </td> + </tr> + <tr height='*'> + <td class='side-body'> + <applet mayscript="" name="player" archive="webeditor.jar,RTEValidators.jar,FFManifest.jar, dom4j.jar" code=edu.lnu.FireFly.WebEditor.WebEditor.class width="100%" height="100%"> + <PARAM NAME="courseLocation" VALUE="http://127.0.0.1/sem/course/"> + <PARAM NAME="serviceLocation" VALUE="http://127.0.0.1/sem/WebEditor/service/"> + <PARAM NAME="templateLocation" VALUE="http://127.0.0.1/sem/WebEditor/template"> + </applet> + </td> + </tr> + </table> + </td> + + <td colspan="5" style="padding-left: 5px; padding-right: 3px;" width="*"> + <table cellpadding='0' cellspacing='0' width='100%' height='97%'> + <tr height='1px'><td> + <table cellpadding='0' cellspacing='0' width='100%'> + <tr> + <td class='left-corn'><img src='images/blank.gif' width='23' height='39' alt='' style='display:block'></td> + <td class='capmain'>Content</td> + <td class='right-corn'><img src='images/blank.gif' width='23' height='39' alt='' style='display:block'></td> + </tr> + </table> + <tr height='*'><td> + <table align='center' cellpadding='0' cellspacing='0' width='95%' class='border' height='100%'> + <tr> + <td class='main-body'> + <iframe name="ContentFrame" frameborder="0" height="100%" scrolling="auto" width="100%"> + </iframe> + </td> + </tr> + </table> + </table> + </td> + </tr> + </tbody> + </table> + </table> +</body> + +</html> \ No newline at end of file Copied: WebEditor/service (from rev 89, WebEditor/src/service) Copied: WebEditor/template (from rev 71, WebEditor/src/template) Deleted: WebEditor/template/SummaryPageModel.html =================================================================== --- WebEditor/src/template/SummaryPageModel.html 2008-05-02 09:54:59 UTC (rev 71) +++ WebEditor/template/SummaryPageModel.html 2008-05-06 09:48:50 UTC (rev 91) @@ -1,17 +0,0 @@ -<html> -<head> - <title>title</title> - <meta http-equiv="Content-Type" content="text/html; charset=utf8" /> - <script type="text/javascript" src="global/APIWrapper.js"></script> - <script type="text/javascript" src="global/SummaryPage.js"></script> -</head> - -<body onload="Initialize();" onunload="Terminate();"> - <div id="page_content"> - <script type="text/javascript"> - <!--content start--> - <!--content end--> - </script> - </div> -</body> -</html> \ No newline at end of file Copied: WebEditor/template/SummaryPageModel.html (from rev 79, WebEditor/src/template/SummaryPageModel.html) =================================================================== --- WebEditor/template/SummaryPageModel.html (rev 0) +++ WebEditor/template/SummaryPageModel.html 2008-05-06 09:48:50 UTC (rev 91) @@ -0,0 +1,56 @@ +<html> +<head> + <title>title</title> + <meta http-equiv="Content-Type" content="text/html; charset=utf8" /> + <script type="text/javascript" src="global/APIWrapper.js"></script> + <script type="text/javascript" src="global/SummaryPage.js"></script> + +<style> +.tbl-border { + color: #555; + background-color: #bbb; +} + +.tbl { + font-size: 11px; + color: #555; + background-color: #fdfced; + padding: 4px; +} + +.tbl1 { + font-size: 11px; + background-color: #fdfced; + padding: 4px; +} + +.tbl2 { + font-size: 11px; + background-color: #fbf8ca; + padding: 4px; +} + +</style> +</head> + +<body onload="Initialize();" onunload="Terminate();"> + <div id="page_content"> + <Center><h1><!--title start--> + <!--title end--></Center></h1> + + <table align='center' cellpadding='0' cellspacing='1' width='85%' class='tbl-border'> + <tr> + <td align='center' width='35' class='tbl2' style='white-space:nowrap'><b>#</b></td> + <td align='center' width='*' class='tbl2' style='white-space:nowrap'><b>Item title</b></td> + <td align='center' width='70' class='tbl2' style='white-space:nowrap'><b>Min</b></td> + <td align='center' width='70' class='tbl2' style='white-space:nowrap'><b>Max</b></td> + <td align='center' width='70' class='tbl2' style='white-space:nowrap'><b>Raw score</b></td> + <td align='center' width='70' class='tbl2' style='white-space:nowrap'><b>%</b></td> + </tr> + + <!--content start--> + <!--content end--> + </table> + </div> +</body> +</html> \ No newline at end of file Deleted: WebEditor/template/global/SummaryPage.js =================================================================== Copied: WebEditor/template/global/SummaryPage.js (from rev 79, WebEditor/src/template/global/SummaryPage.js) =================================================================== --- WebEditor/template/global/SummaryPage.js (rev 0) +++ WebEditor/template/global/SummaryPage.js 2008-05-06 09:48:50 UTC (rev 91) @@ -0,0 +1,58 @@ +var deep = 0; +var rowNum = 0; + +function out(s){ + document.write(s); +} + +function ins(title, min, max, raw){ + var percents = 100*(raw-min)/(max-min) + " %"; + rowNum++; + + var td = "<td class='tbl"; + td += 1 - (rowNum % 2) + 1; + td += "'>"; + + document.write("<TR>" + td + rowNum); + document.write(td + title); + document.write(td + min); + document.write(td + max); + document.write(td + raw); + document.write(td + percents); +} + +function openBlock(title, model, id){ + title = "<b>" + title + "</b>"; + add(title, model, id); + deep++; +} + +function closeBlock(title){ + deep--; +} + + +function add(title, modelName, id){ + for (i=0; i < deep; i++){ + title = " " + title; + } + + ins(title, getScore(id, "min"), getScore(id, "max"), getScore(id, "raw")); +} + +function getObjectiveIndex(id){ + var count = GetValue("cmi.objectives._count"); + for (i = 0; i < count; i++){ + var curr = GetValue("cmi.objectives." + i + ".id"); + if (curr == id){ + return i; + } + } + return -1; +} + +function getScore(objectiveID, field){ + var index = getObjectiveIndex(objectiveID); + 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. |
From: <se...@us...> - 2008-05-06 11:22:54
|
Revision: 92 http://acmcontester.svn.sourceforge.net/acmcontester/?rev=92&view=rev Author: sem62 Date: 2008-05-06 04:22:53 -0700 (Tue, 06 May 2008) Log Message: ----------- Modified summary page. Modified Paths: -------------- WebEditor/src/edu/lnu/FireFly/WebEditor/WebEditor.java WebEditor/template/LectureModel.html WebEditor/template/global/SummaryPage.js Added Paths: ----------- WebEditor/template/global/images/ WebEditor/template/global/images/completed.gif WebEditor/template/global/images/incomplete.gif WebEditor/template/global/images/undefined.gif Modified: WebEditor/src/edu/lnu/FireFly/WebEditor/WebEditor.java =================================================================== --- WebEditor/src/edu/lnu/FireFly/WebEditor/WebEditor.java 2008-05-06 09:48:50 UTC (rev 91) +++ WebEditor/src/edu/lnu/FireFly/WebEditor/WebEditor.java 2008-05-06 11:22:53 UTC (rev 92) @@ -41,7 +41,7 @@ public static WebEditor instance = null; - protected Manifest manifest = ManifestFactory.createManifest(); + protected Manifest manifest = null; protected JMenuItem openMenuItem = null; @@ -84,7 +84,6 @@ @Override public void init() { - Settings.getInstance().setCourseLocation(getParameter("courseLocation")); Settings.getInstance().setServiceLocation(getParameter("serviceLocation")); Settings.getInstance().setTemplateLocation(getParameter("templateLocation")); Modified: WebEditor/template/LectureModel.html =================================================================== --- WebEditor/template/LectureModel.html 2008-05-06 09:48:50 UTC (rev 91) +++ WebEditor/template/LectureModel.html 2008-05-06 11:22:53 UTC (rev 92) @@ -3,9 +3,15 @@ <title>title</title> <meta http-equiv="Content-Type" content="text/html; charset=utf8" /> <script type="text/javascript" src="global/APIWrapper.js"></script> + <script type="text/javascript"> + function finish(){ + SetValue("cmi.completionStatus", "completed"); + Terminate(); + } + </script> </head> -<body onload="Initialize();" onunload="Terminate();"> +<body onload="Initialize();" onunload="finish();"> <div id="lecture_caption"> <!--caption start-->New caption<!--caption end--> </div> Modified: WebEditor/template/global/SummaryPage.js =================================================================== --- WebEditor/template/global/SummaryPage.js 2008-05-06 09:48:50 UTC (rev 91) +++ WebEditor/template/global/SummaryPage.js 2008-05-06 11:22:53 UTC (rev 92) @@ -5,7 +5,7 @@ document.write(s); } -function ins(title, min, max, raw){ +function ins(title, min, max, raw, completionStatus){ var percents = 100*(raw-min)/(max-min) + " %"; rowNum++; @@ -13,7 +13,7 @@ td += 1 - (rowNum % 2) + 1; td += "'>"; - document.write("<TR>" + td + rowNum); + document.write("<TR>" + td + rowNum + "<img src='global/images/" + completionStatus + ".gif'>"); document.write(td + title); document.write(td + min); document.write(td + max); @@ -37,7 +37,7 @@ title = " " + title; } - ins(title, getScore(id, "min"), getScore(id, "max"), getScore(id, "raw")); + ins(title, getScore(id, "min"), getScore(id, "max"), getScore(id, "raw"), getCompletionStatus(id)); } function getObjectiveIndex(id){ @@ -51,6 +51,13 @@ return -1; } +function getCompletionStatus(objectiveID){ + var index = getObjectiveIndex(objectiveID); + var res = GetValue("cmi.objectives." + index + ".completionStatus"); + + return res != null ? res : "undefined"; +} + function getScore(objectiveID, field){ var index = getObjectiveIndex(objectiveID); var res = GetValue("cmi.objectives." + index + ".score." + field); Added: WebEditor/template/global/images/completed.gif =================================================================== (Binary files differ) Property changes on: WebEditor/template/global/images/completed.gif ___________________________________________________________________ Name: svn:mime-type + application/octet-stream Added: WebEditor/template/global/images/incomplete.gif =================================================================== (Binary files differ) Property changes on: WebEditor/template/global/images/incomplete.gif ___________________________________________________________________ Name: svn:mime-type + application/octet-stream Added: WebEditor/template/global/images/undefined.gif =================================================================== (Binary files differ) Property changes on: WebEditor/template/global/images/undefined.gif ___________________________________________________________________ Name: svn:mime-type + application/octet-stream This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <se...@us...> - 2008-05-06 22:43:52
|
Revision: 96 http://acmcontester.svn.sourceforge.net/acmcontester/?rev=96&view=rev Author: sem62 Date: 2008-05-06 15:43:58 -0700 (Tue, 06 May 2008) Log Message: ----------- modofied creating resource process. Modified Paths: -------------- WebEditor/service/getFileContent.php WebEditor/src/edu/lnu/FireFly/WebEditor/ItemModels/ChapterModel.java WebEditor/src/edu/lnu/FireFly/WebEditor/ItemModels/ItemModel.java WebEditor/src/edu/lnu/FireFly/WebEditor/ItemModels/Lecture/LectureModel.java WebEditor/src/edu/lnu/FireFly/WebEditor/ItemModels/ResourcedItemModel.java WebEditor/src/edu/lnu/FireFly/WebEditor/ItemModels/SimpleQuestion/SimpleQuestionModel.java WebEditor/src/edu/lnu/FireFly/WebEditor/ItemModels/Template.java WebEditor/src/edu/lnu/FireFly/WebEditor/WSClients/WebEditorServiceClient.java WebEditor/src/edu/lnu/FireFly/WebEditor/WebEditor.java Removed Paths: ------------- WebEditor/service/copyFromTemplate.php Deleted: WebEditor/service/copyFromTemplate.php =================================================================== --- WebEditor/service/copyFromTemplate.php 2008-05-06 21:59:28 UTC (rev 95) +++ WebEditor/service/copyFromTemplate.php 2008-05-06 22:43:58 UTC (rev 96) @@ -1,10 +0,0 @@ -<? - require_once("config.inc.php"); - - if (isset($_POST['fNameInTemplate']) && isset($_POST['fNameInCourse'])){ - $log = fopen('service.txt', 'a'); - $source = $template_location . $_POST['fNameInTemplate']; - $dest = $course_location . $_POST['fNameInCourse']; - echo copy($source, $dest); - } -?> \ No newline at end of file Modified: WebEditor/service/getFileContent.php =================================================================== --- WebEditor/service/getFileContent.php 2008-05-06 21:59:28 UTC (rev 95) +++ WebEditor/service/getFileContent.php 2008-05-06 22:43:58 UTC (rev 96) @@ -1,7 +1,11 @@ <? require_once("config.inc.php"); - if (isset($_POST['fName'])){ - readfile ($course_location . $_POST['fName']); + if (isset($_POST['fName']) && isset($_POST['location'])){ + if ($_POST['location'] == "course"){ + readfile ($course_location . $_POST['fName']); + } else { + readfile ($template_location . $_POST['fName']); + } } ?> \ No newline at end of file Modified: WebEditor/src/edu/lnu/FireFly/WebEditor/ItemModels/ChapterModel.java =================================================================== --- WebEditor/src/edu/lnu/FireFly/WebEditor/ItemModels/ChapterModel.java 2008-05-06 21:59:28 UTC (rev 95) +++ WebEditor/src/edu/lnu/FireFly/WebEditor/ItemModels/ChapterModel.java 2008-05-06 22:43:58 UTC (rev 96) @@ -145,7 +145,7 @@ identifier = ((Organization) anItem).identifier; } String res = WebEditorServiceClient - .getFileContent(identifier + ".conf"); + .getFileContent(identifier + ".conf", "course"); if (res == null || res.trim().equals("")){ return false; Modified: WebEditor/src/edu/lnu/FireFly/WebEditor/ItemModels/ItemModel.java =================================================================== --- WebEditor/src/edu/lnu/FireFly/WebEditor/ItemModels/ItemModel.java 2008-05-06 21:59:28 UTC (rev 95) +++ WebEditor/src/edu/lnu/FireFly/WebEditor/ItemModels/ItemModel.java 2008-05-06 22:43:58 UTC (rev 96) @@ -13,7 +13,6 @@ import edu.lnu.FireFly.FFManifest.resource.Resource; import edu.lnu.FireFly.WebEditor.WebEditor; import edu.lnu.FireFly.WebEditor.ItemModels.SummaryPageModel.SummaryPageModel; -import edu.lnu.FireFly.WebEditor.WSClients.WebEditorServiceClient; public abstract class ItemModel { protected static HashMap<TreeItem, ItemData> questionsData = new HashMap<TreeItem, ItemData>(); @@ -77,17 +76,7 @@ String fName = resource.identifier + ".html"; resource.setHref(fName); - boolean copied = WebEditorServiceClient.copyFromTemplate(this - .getClass().getSimpleName() - + ".html", fName); - copied = copied - && WebEditorServiceClient.copyFromTemplate(this.getClass() - .getSimpleName() - + ".conf", resource.identifier + ".conf"); - - System.out.println("copied: " + copied); - WebEditor.instance.getManifest().resources.resources.add(resource); return resource.identifier; Modified: WebEditor/src/edu/lnu/FireFly/WebEditor/ItemModels/Lecture/LectureModel.java =================================================================== --- WebEditor/src/edu/lnu/FireFly/WebEditor/ItemModels/Lecture/LectureModel.java 2008-05-06 21:59:28 UTC (rev 95) +++ WebEditor/src/edu/lnu/FireFly/WebEditor/ItemModels/Lecture/LectureModel.java 2008-05-06 22:43:58 UTC (rev 96) @@ -51,7 +51,7 @@ .findResourceByIdentifier(((Item)anItem).identifierref); String res = WebEditorServiceClient.getFileContent(resource.identifier - + ".conf"); + + ".conf", "course"); SAXReader reader = new SAXReader(); @@ -60,6 +60,7 @@ doc = reader.read(new StringReader(res)); } catch (Exception e) { e.printStackTrace(); + return false; } Element root = doc.getRootElement(); @@ -90,8 +91,6 @@ @Override public void ConfigureItem(TreeItem item) { - synchronizeItemWithResource((Item) item); - new LecturePropertiestsDlg().showDialog(item); TreeDataModel.getInstance().treeNodesChanged(item); WebEditor.tree.setSelectionPath(null); Modified: WebEditor/src/edu/lnu/FireFly/WebEditor/ItemModels/ResourcedItemModel.java =================================================================== --- WebEditor/src/edu/lnu/FireFly/WebEditor/ItemModels/ResourcedItemModel.java 2008-05-06 21:59:28 UTC (rev 95) +++ WebEditor/src/edu/lnu/FireFly/WebEditor/ItemModels/ResourcedItemModel.java 2008-05-06 22:43:58 UTC (rev 96) @@ -29,9 +29,6 @@ return; } - synchronizeItemWithResource(item); - updateItemResource(item, true); - ConfigureItem(item); } Modified: WebEditor/src/edu/lnu/FireFly/WebEditor/ItemModels/SimpleQuestion/SimpleQuestionModel.java =================================================================== --- WebEditor/src/edu/lnu/FireFly/WebEditor/ItemModels/SimpleQuestion/SimpleQuestionModel.java 2008-05-06 21:59:28 UTC (rev 95) +++ WebEditor/src/edu/lnu/FireFly/WebEditor/ItemModels/SimpleQuestion/SimpleQuestionModel.java 2008-05-06 22:43:58 UTC (rev 96) @@ -105,7 +105,7 @@ .findResourceByIdentifier(((Item)anItem).identifierref); String res = WebEditorServiceClient.getFileContent(resource.identifier - + ".conf"); + + ".conf", "course"); SAXReader reader = new SAXReader(); Modified: WebEditor/src/edu/lnu/FireFly/WebEditor/ItemModels/Template.java =================================================================== --- WebEditor/src/edu/lnu/FireFly/WebEditor/ItemModels/Template.java 2008-05-06 21:59:28 UTC (rev 95) +++ WebEditor/src/edu/lnu/FireFly/WebEditor/ItemModels/Template.java 2008-05-06 22:43:58 UTC (rev 96) @@ -51,22 +51,17 @@ } public boolean updateResource() { - boolean copied = WebEditorServiceClient.copyFromTemplate(model - .getClass().getSimpleName() - + ".html", fileName); + String templateFileName = model.getClass().getSimpleName() + ".html"; - if (!copied){ - return false; - } - - String res = WebEditorServiceClient.getFileContent(fileName); + String res = WebEditorServiceClient.getFileContent(templateFileName, + "template"); Iterator<String> iter = propertiests.keySet().iterator(); while (iter.hasNext()) { String name = iter.next(); res = insertPropertyIntoResource(res, name, propertiests.get(name)); - - if (res == null){ + + if (res == null) { System.out.print("Property \"" + name + "\" isn't present.\n"); return false; } Modified: WebEditor/src/edu/lnu/FireFly/WebEditor/WSClients/WebEditorServiceClient.java =================================================================== --- WebEditor/src/edu/lnu/FireFly/WebEditor/WSClients/WebEditorServiceClient.java 2008-05-06 21:59:28 UTC (rev 95) +++ WebEditor/src/edu/lnu/FireFly/WebEditor/WSClients/WebEditorServiceClient.java 2008-05-06 22:43:58 UTC (rev 96) @@ -10,13 +10,23 @@ import edu.lnu.FireFly.WebEditor.Settings; public class WebEditorServiceClient { - public static String getFileContent(String fName) { + /** + * @param fName File name + * @param location Location name = template | course + * @return + */ + public static String getFileContent(String fName, String location) { + System.out.println("Getting file's content (fName=" + fName + "; location=" + location + ")..."); + String result = ""; try { // Construct data String data = URLEncoder.encode("fName", "UTF-8") + "=" + URLEncoder.encode(fName, "UTF-8"); + data += "&" + URLEncoder.encode("location", "UTF-8") + "=" + + URLEncoder.encode(location, "UTF-8"); + // Send data URL url = new URL(Settings.getInstance().getServiceLocation() + "getFileContent.php"); @@ -43,10 +53,13 @@ e.printStackTrace(); } + System.out.print("result: " + result); return result; } public static void setFileContent(String fName, String content) { + System.out.println("Setting file's content (fName=" + fName + ")..."); + String result = ""; try { // Construct data @@ -85,45 +98,45 @@ System.out.println(result); } - public static boolean copyFromTemplate(String fNameInTemplate, - String fNameInCourse) { - String result = ""; - try { - // Construct data - String data = URLEncoder.encode("fNameInTemplate", "UTF-8") + "=" - + URLEncoder.encode(fNameInTemplate, "UTF-8"); - data += "&" + URLEncoder.encode("fNameInCourse", "UTF-8") + "=" - + URLEncoder.encode(fNameInCourse, "UTF-8"); - - // Send data - URL url = new URL(Settings.getInstance().getServiceLocation() - + "copyFromTemplate.php"); - - URLConnection conn = url.openConnection(); - conn.setDoOutput(true); - - OutputStreamWriter wr = new OutputStreamWriter(conn - .getOutputStream()); - - wr.write(data); - wr.flush(); - - // Get the response - BufferedReader rd = new BufferedReader(new InputStreamReader(conn - .getInputStream())); - String line; - while ((line = rd.readLine()) != null) { - result += line + "\n"; - } - wr.close(); - rd.close(); - } catch (Exception e) { - e.printStackTrace(); - } - - System.out.println("copyFromTemplate(). result is:"); - System.out.println(result); - - return true; - } +// public static boolean copyFromTemplate(String fNameInTemplate, +// String fNameInCourse) { +// String result = ""; +// try { +// // Construct data +// String data = URLEncoder.encode("fNameInTemplate", "UTF-8") + "=" +// + URLEncoder.encode(fNameInTemplate, "UTF-8"); +// data += "&" + URLEncoder.encode("fNameInCourse", "UTF-8") + "=" +// + URLEncoder.encode(fNameInCourse, "UTF-8"); +// +// // Send data +// URL url = new URL(Settings.getInstance().getServiceLocation() +// + "copyFromTemplate.php"); +// +// URLConnection conn = url.openConnection(); +// conn.setDoOutput(true); +// +// OutputStreamWriter wr = new OutputStreamWriter(conn +// .getOutputStream()); +// +// wr.write(data); +// wr.flush(); +// +// // Get the response +// BufferedReader rd = new BufferedReader(new InputStreamReader(conn +// .getInputStream())); +// String line; +// while ((line = rd.readLine()) != null) { +// result += line + "\n"; +// } +// wr.close(); +// rd.close(); +// } catch (Exception e) { +// e.printStackTrace(); +// } +// +// System.out.println("copyFromTemplate(). result is:"); +// System.out.println(result); +// +// return true; +// } } Modified: WebEditor/src/edu/lnu/FireFly/WebEditor/WebEditor.java =================================================================== --- WebEditor/src/edu/lnu/FireFly/WebEditor/WebEditor.java 2008-05-06 21:59:28 UTC (rev 95) +++ WebEditor/src/edu/lnu/FireFly/WebEditor/WebEditor.java 2008-05-06 22:43:58 UTC (rev 96) @@ -71,7 +71,7 @@ private void openManifest() throws TestDocException { Parser parser = new Parser(); manifest = parser.fromXML(WebEditorServiceClient - .getFileContent("imsmanifest.xml")); + .getFileContent("imsmanifest.xml", "course")); TreeDataModel.initInstance(manifest); ItemModels.initializeAllItemDatas(manifest.getRoot()); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <se...@us...> - 2008-05-07 19:24:20
|
Revision: 101 http://acmcontester.svn.sourceforge.net/acmcontester/?rev=101&view=rev Author: sem62 Date: 2008-05-07 12:24:22 -0700 (Wed, 07 May 2008) Log Message: ----------- Fixed bugs with updating course tree Modified Paths: -------------- WebEditor/resources/index.html WebEditor/src/edu/lnu/FireFly/WebEditor/AppletWithApiHandle.java WebEditor/src/edu/lnu/FireFly/WebEditor/Data/SummaryPageManager.java WebEditor/src/edu/lnu/FireFly/WebEditor/GUI/TreeDataModel.java WebEditor/src/edu/lnu/FireFly/WebEditor/ItemModels/ResourcedItemModel.java WebEditor/src/edu/lnu/FireFly/WebEditor/Settings.java WebEditor/src/edu/lnu/FireFly/WebEditor/WebEditor.java Modified: WebEditor/resources/index.html =================================================================== --- WebEditor/resources/index.html 2008-05-07 17:51:30 UTC (rev 100) +++ WebEditor/resources/index.html 2008-05-07 19:24:22 UTC (rev 101) @@ -88,7 +88,8 @@ <applet mayscript="" name="player" archive="webeditor.jar,RTEValidators.jar,FFManifest.jar, dom4j.jar" code=edu.lnu.FireFly.WebEditor.WebEditor.class width="100%" height="100%"> <PARAM NAME="courseLocation" VALUE="http://127.0.0.1/sem/course/"> <PARAM NAME="serviceLocation" VALUE="http://127.0.0.1/sem/WebEditor/service/"> - <PARAM NAME="templateLocation" VALUE="http://127.0.0.1/sem/WebEditor/template"> + <PARAM NAME="templateLocation" VALUE="http://127.0.0.1/sem/WebEditor/template/"> + <PARAM NAME="resourceLocation" VALUE="http://127.0.0.1/sem/WebEditor/"> </applet> </td> </tr> Modified: WebEditor/src/edu/lnu/FireFly/WebEditor/AppletWithApiHandle.java =================================================================== --- WebEditor/src/edu/lnu/FireFly/WebEditor/AppletWithApiHandle.java 2008-05-07 17:51:30 UTC (rev 100) +++ WebEditor/src/edu/lnu/FireFly/WebEditor/AppletWithApiHandle.java 2008-05-07 19:24:22 UTC (rev 101) @@ -27,6 +27,11 @@ static public String GetValue(String parameter){ System.out.print("GetValue(" + parameter + ");\n"); + + if (parameter.endsWith("completionStatus")){ + return "incomplete"; + } + return ""; } Modified: WebEditor/src/edu/lnu/FireFly/WebEditor/Data/SummaryPageManager.java =================================================================== --- WebEditor/src/edu/lnu/FireFly/WebEditor/Data/SummaryPageManager.java 2008-05-07 17:51:30 UTC (rev 100) +++ WebEditor/src/edu/lnu/FireFly/WebEditor/Data/SummaryPageManager.java 2008-05-07 19:24:22 UTC (rev 101) @@ -11,7 +11,7 @@ import edu.lnu.FireFly.FFManifest.item.sequencing.objectives.Objective; import edu.lnu.FireFly.FFManifest.item.sequencing.objectives.Objectives; import edu.lnu.FireFly.FFManifest.parser.TestDocException; -import edu.lnu.FireFly.WebEditor.GUI.TreeDataModel; +import edu.lnu.FireFly.WebEditor.GUI.Reorganizer; import edu.lnu.FireFly.WebEditor.ItemModels.ChapterModel; import edu.lnu.FireFly.WebEditor.ItemModels.ItemModel; import edu.lnu.FireFly.WebEditor.ItemModels.ItemModels; @@ -209,12 +209,12 @@ "Count of summary pages is graiter than one!!!"); } - ((Item) item).moveDown(); + Reorganizer.getInstance().moveDown(item); } } } - TreeDataModel.getInstance().updateAllTree(); + //TreeDataModel.getInstance().updateAllTree(); } public void updateSummaryPages() { Modified: WebEditor/src/edu/lnu/FireFly/WebEditor/GUI/TreeDataModel.java =================================================================== --- WebEditor/src/edu/lnu/FireFly/WebEditor/GUI/TreeDataModel.java 2008-05-07 17:51:30 UTC (rev 100) +++ WebEditor/src/edu/lnu/FireFly/WebEditor/GUI/TreeDataModel.java 2008-05-07 19:24:22 UTC (rev 101) @@ -96,7 +96,7 @@ return getItemPath(item.getParent()).pathByAddingChild(item); } - public void updateAllTree(){ + private void updateAllTree(){ for (int i=0; i < listeners.size(); i++){ TreeModelListener listener = listeners.get(i); TreeModelEvent event = new TreeModelEvent(this, new TreePath(TreeDataModel.getInstance().getRoot())); Modified: WebEditor/src/edu/lnu/FireFly/WebEditor/ItemModels/ResourcedItemModel.java =================================================================== --- WebEditor/src/edu/lnu/FireFly/WebEditor/ItemModels/ResourcedItemModel.java 2008-05-07 17:51:30 UTC (rev 100) +++ WebEditor/src/edu/lnu/FireFly/WebEditor/ItemModels/ResourcedItemModel.java 2008-05-07 19:24:22 UTC (rev 101) @@ -38,7 +38,7 @@ return; } - ConfigureItem(item); + ConfigureItem(item); } protected final String loadResource(String location, String identifier) { Modified: WebEditor/src/edu/lnu/FireFly/WebEditor/Settings.java =================================================================== --- WebEditor/src/edu/lnu/FireFly/WebEditor/Settings.java 2008-05-07 17:51:30 UTC (rev 100) +++ WebEditor/src/edu/lnu/FireFly/WebEditor/Settings.java 2008-05-07 19:24:22 UTC (rev 101) @@ -4,6 +4,7 @@ private String courseLocation = ""; private String templateLocation = ""; private String serviceLocation = ""; + private String resourceLocation = ""; public static Settings obj = null; @@ -39,4 +40,12 @@ public void setServiceLocation(String serviceLocation) { this.serviceLocation = serviceLocation; } + + public String getResourceLocation() { + return resourceLocation; + } + + public void setResourceLocation(String resourceLocation) { + this.resourceLocation = resourceLocation; + } } Modified: WebEditor/src/edu/lnu/FireFly/WebEditor/WebEditor.java =================================================================== --- WebEditor/src/edu/lnu/FireFly/WebEditor/WebEditor.java 2008-05-07 17:51:30 UTC (rev 100) +++ WebEditor/src/edu/lnu/FireFly/WebEditor/WebEditor.java 2008-05-07 19:24:22 UTC (rev 101) @@ -157,8 +157,8 @@ if (e.getNewLeadSelectionPath() == null) { try { getAppletContext().showDocument( - new URL("http://localhost:8080/WebEditor/empty.htm"), - "ContentFrame"); + new URL(Settings.getInstance().getResourceLocation() + + "/empty.htm"), "ContentFrame"); System.out.print("browse to empty document.\n"); Thread.sleep(300); } catch (Exception e1) { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <se...@us...> - 2008-05-08 19:02:54
|
Revision: 104 http://acmcontester.svn.sourceforge.net/acmcontester/?rev=104&view=rev Author: sem62 Date: 2008-05-08 12:02:32 -0700 (Thu, 08 May 2008) Log Message: ----------- Inserting already existing text into WYSIWYG editor at opening. Modified Paths: -------------- WebEditor/resources/HTMLedit.php WebEditor/resources/HTMLeditor.js WebEditor/resources/api.js WebEditor/src/edu/lnu/FireFly/WebEditor/WebEditor.java Added Paths: ----------- WebEditor/src/edu/lnu/FireFly/WebEditor/AppletWithWYSIWYGEditor.java Modified: WebEditor/resources/HTMLedit.php =================================================================== --- WebEditor/resources/HTMLedit.php 2008-05-08 17:25:04 UTC (rev 103) +++ WebEditor/resources/HTMLedit.php 2008-05-08 19:02:32 UTC (rev 104) @@ -6,20 +6,28 @@ var s=document.getElementById("spaw_edit_field").value; opener.document.webeditor.setEditedHTML(s); close(); + return false; } </script> </head> <body> - +<form name='editFrm' onSubmit='javascript:save();'> <? include("spaw2/spaw.inc.php"); -$spaw = new SpawEditor('spaw_edit_field'); +$spaw = new SpawEditor('spaw_edit_field', "123"); $spaw->show(); ?> -<input type='button' value='save' onClick='javascript:save();'> +<input type='submit' value='save' onClick='javascript:save();'> +</form> + <script type="text/javascript"> + var s = opener.document.webeditor.getEditedHTML(); + document.getElementById("spaw_edit_field").value = s; + alert(s, false); + + </script> </body> </html> \ No newline at end of file Modified: WebEditor/resources/HTMLeditor.js =================================================================== --- WebEditor/resources/HTMLeditor.js 2008-05-08 17:25:04 UTC (rev 103) +++ WebEditor/resources/HTMLeditor.js 2008-05-08 19:02:32 UTC (rev 104) @@ -1,3 +1,3 @@ -function showEditor(){ +function showEditor(currentText){ myWin=window.open("HTMLedit.php", "wind1", "width=800,height=350"); } Modified: WebEditor/resources/api.js =================================================================== --- WebEditor/resources/api.js 2008-05-08 17:25:04 UTC (rev 103) +++ WebEditor/resources/api.js 2008-05-08 19:02:32 UTC (rev 104) @@ -1,24 +1,24 @@ function Initialize(param) { - return document.player.Initialize(param); + return document.webeditor.Initialize(param); } function Terminate(param) { - return document.player.Terminate(param); + return document.webeditor.Terminate(param); } function SetValue(name,value) { - return document.player.SetValue(name, value); + return document.webeditor.SetValue(name, value); } function GetValue(name) { - return document.player.GetValue(name); + return document.webeditor.GetValue(name); } function Commit(param) { - var returnVal = document.player.Commit(param); + var returnVal = document.webeditor.Commit(param); var status = GetValue("cmi.core.lesson_status"); if (status=="passed" || status=="failed") navigation.location.reload(); @@ -26,15 +26,15 @@ } function GetLastError() { - return document.player.GetLastError(); + return document.webeditor.GetLastError(); } function GetErrorString(code) { - return document.player.GetErrorString(code); + return document.webeditor.GetErrorString(code); } function GetDiagnostic(param) { - return document.player.GetDiagnostic(param); + return document.webeditor.GetDiagnostic(param); } function GetVersion() { Added: WebEditor/src/edu/lnu/FireFly/WebEditor/AppletWithWYSIWYGEditor.java =================================================================== --- WebEditor/src/edu/lnu/FireFly/WebEditor/AppletWithWYSIWYGEditor.java (rev 0) +++ WebEditor/src/edu/lnu/FireFly/WebEditor/AppletWithWYSIWYGEditor.java 2008-05-08 19:02:32 UTC (rev 104) @@ -0,0 +1,46 @@ +package edu.lnu.FireFly.WebEditor; + +import javax.swing.JTextField; + +import netscape.javascript.JSObject; +import edu.lnu.FireFly.WebEditor.GUI.Dialogs.PropertyDlg; + +public class AppletWithWYSIWYGEditor extends AppletWithApiHandle{ + private boolean htmlEditing = false; + private JTextField textField = null; + + public void htmlEdit(JTextField captionTextField2, PropertyDlg dlg) { + JSObject win = JSObject.getWindow(this); + Object[] params = new String[1]; + params[0] = captionTextField2.getText(); + + dlg.setModal(false); + + htmlEditing = true; + textField = captionTextField2; + + win.call("showEditor", params); + } + + public String getEditedHTML(){ + return textField.getText(); + } + + public void setEditedHTML(String newHTML){ + if (!htmlEditing){ + return; + } + textField.setText(newHTML); + + htmlEditing = false; + } + + /** + * + */ + private static final long serialVersionUID = 1L; + + public boolean isHtmlEditing() { + return htmlEditing; + } +} Modified: WebEditor/src/edu/lnu/FireFly/WebEditor/WebEditor.java =================================================================== --- WebEditor/src/edu/lnu/FireFly/WebEditor/WebEditor.java 2008-05-08 17:25:04 UTC (rev 103) +++ WebEditor/src/edu/lnu/FireFly/WebEditor/WebEditor.java 2008-05-08 19:02:32 UTC (rev 104) @@ -8,12 +8,10 @@ import javax.swing.JMenuBar; import javax.swing.JMenuItem; import javax.swing.JScrollPane; -import javax.swing.JTextField; import javax.swing.JTree; import javax.swing.event.TreeSelectionEvent; import javax.swing.event.TreeSelectionListener; -import netscape.javascript.JSObject; import edu.lnu.FireFly.FFManifest.Manifest; import edu.lnu.FireFly.FFManifest.TreeItem; import edu.lnu.FireFly.FFManifest.item.Item; @@ -24,7 +22,6 @@ import edu.lnu.FireFly.WebEditor.Data.SummaryPageManager; import edu.lnu.FireFly.WebEditor.GUI.CourseTreePopupMenu; import edu.lnu.FireFly.WebEditor.GUI.TreeDataModel; -import edu.lnu.FireFly.WebEditor.GUI.Dialogs.PropertyDlg; import edu.lnu.FireFly.WebEditor.ItemModels.ChapterModel; import edu.lnu.FireFly.WebEditor.ItemModels.ItemModels; import edu.lnu.FireFly.WebEditor.ItemModels.OrganizationModel; @@ -33,7 +30,7 @@ import edu.lnu.FireFly.WebEditor.ItemModels.SummaryPageModel.SummaryPageModel; import edu.lnu.FireFly.WebEditor.WSClients.WebEditorServiceClient; -public class WebEditor extends AppletWithApiHandle implements ActionListener, +public class WebEditor extends AppletWithWYSIWYGEditor implements ActionListener, TreeSelectionListener { /** @@ -190,29 +187,4 @@ } } } - - private boolean htmlEditing = false; - private JTextField textField = null; - - public void htmlEdit(JTextField captionTextField2, PropertyDlg dlg) { - JSObject win = JSObject.getWindow(instance); - Object[] params = new String[0]; - - dlg.setModal(false); - - htmlEditing = true; - textField = captionTextField2; - - win.call("showEditor", params); - } - - public void setEditedHTML(String newHTML){ - if (!htmlEditing){ - return; - } - - textField.setText(newHTML); - - htmlEditing = false; - } } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <se...@us...> - 2008-05-07 22:19:04
|
Revision: 102 http://acmcontester.svn.sourceforge.net/acmcontester/?rev=102&view=rev Author: sem62 Date: 2008-05-07 15:19:10 -0700 (Wed, 07 May 2008) Log Message: ----------- Added spaw2 wysiwyg editor to Lecture caption edit. Modified Paths: -------------- WebEditor/resources/index.html WebEditor/src/edu/lnu/FireFly/WebEditor/GUI/Dialogs/LecturePropertiestsDlg.java WebEditor/src/edu/lnu/FireFly/WebEditor/GUI/Dialogs/PropertyDlg.java WebEditor/src/edu/lnu/FireFly/WebEditor/GUI/Dialogs/SimpleQuestionPropertiestsDlg.java WebEditor/src/edu/lnu/FireFly/WebEditor/WebEditor.java Added Paths: ----------- WebEditor/resources/HTMLedit.php WebEditor/resources/HTMLeditor.js WebEditor/resources/spaw2/ WebEditor/resources/spaw2/class/ WebEditor/resources/spaw2/class/config.class.php WebEditor/resources/spaw2/class/editor.class.php WebEditor/resources/spaw2/class/lang.class.php WebEditor/resources/spaw2/class/output.class.php WebEditor/resources/spaw2/class/theme.class.php WebEditor/resources/spaw2/class/toolbar.class.php WebEditor/resources/spaw2/class/util.class.php WebEditor/resources/spaw2/config/ WebEditor/resources/spaw2/config/config.php WebEditor/resources/spaw2/demo/ WebEditor/resources/spaw2/demo/demo.php WebEditor/resources/spaw2/dialogs/ WebEditor/resources/spaw2/dialogs/dialog.php WebEditor/resources/spaw2/dialogs/img/ WebEditor/resources/spaw2/dialogs/img/spacer.gif WebEditor/resources/spaw2/docs/ WebEditor/resources/spaw2/docs/changelog.txt WebEditor/resources/spaw2/docs/documentation/ WebEditor/resources/spaw2/docs/documentation/documentation.css WebEditor/resources/spaw2/docs/documentation/integrators.html WebEditor/resources/spaw2/docs/documentation/plugins.html WebEditor/resources/spaw2/docs/license.txt WebEditor/resources/spaw2/docs/readme.txt WebEditor/resources/spaw2/docs/releasenotes.txt WebEditor/resources/spaw2/empty/ WebEditor/resources/spaw2/empty/empty.html WebEditor/resources/spaw2/img/ WebEditor/resources/spaw2/img/flash.gif WebEditor/resources/spaw2/img/spacer100.gif WebEditor/resources/spaw2/js/ WebEditor/resources/spaw2/js/common/ WebEditor/resources/spaw2/js/common/color.js WebEditor/resources/spaw2/js/common/contextmenu.js WebEditor/resources/spaw2/js/common/editor.js WebEditor/resources/spaw2/js/common/editorpage.js WebEditor/resources/spaw2/js/common/engine.js WebEditor/resources/spaw2/js/common/entities.js WebEditor/resources/spaw2/js/common/events.js WebEditor/resources/spaw2/js/common/tab.js WebEditor/resources/spaw2/js/common/toolbar.js WebEditor/resources/spaw2/js/common/utils.js WebEditor/resources/spaw2/js/gecko/ WebEditor/resources/spaw2/js/gecko/editor.js WebEditor/resources/spaw2/js/ie/ WebEditor/resources/spaw2/js/ie/editor.js WebEditor/resources/spaw2/js/opera/ WebEditor/resources/spaw2/js/opera/editor.js WebEditor/resources/spaw2/js/spaw.js.php WebEditor/resources/spaw2/plugins/ WebEditor/resources/spaw2/plugins/core/ WebEditor/resources/spaw2/plugins/core/dialogs/ WebEditor/resources/spaw2/plugins/core/dialogs/colorpicker.inc.php WebEditor/resources/spaw2/plugins/core/dialogs/colorpicker.js WebEditor/resources/spaw2/plugins/core/dialogs/flash_prop.inc.php WebEditor/resources/spaw2/plugins/core/dialogs/flash_prop.js WebEditor/resources/spaw2/plugins/core/dialogs/hyperlink.inc.php WebEditor/resources/spaw2/plugins/core/dialogs/hyperlink.js WebEditor/resources/spaw2/plugins/core/dialogs/image_prop.inc.php WebEditor/resources/spaw2/plugins/core/dialogs/image_prop.js WebEditor/resources/spaw2/plugins/core/dialogs/img/ WebEditor/resources/spaw2/plugins/core/dialogs/img/crosshair.gif WebEditor/resources/spaw2/plugins/core/dialogs/img/huesaturation.jpg WebEditor/resources/spaw2/plugins/core/dialogs/img/leftarrow.gif WebEditor/resources/spaw2/plugins/core/dialogs/img/spacer.gif WebEditor/resources/spaw2/plugins/core/dialogs/table_cell_prop.inc.php WebEditor/resources/spaw2/plugins/core/dialogs/table_cell_prop.js WebEditor/resources/spaw2/plugins/core/dialogs/table_prop.inc.php WebEditor/resources/spaw2/plugins/core/dialogs/table_prop.js WebEditor/resources/spaw2/plugins/core/js/ WebEditor/resources/spaw2/plugins/core/js/common/ WebEditor/resources/spaw2/plugins/core/js/common/format.js WebEditor/resources/spaw2/plugins/core/js/common/general.js WebEditor/resources/spaw2/plugins/core/js/common/insert.js WebEditor/resources/spaw2/plugins/core/js/common/mode.js WebEditor/resources/spaw2/plugins/core/js/common/table.js WebEditor/resources/spaw2/plugins/core/js/common/tools.js WebEditor/resources/spaw2/plugins/core/js/gecko/ WebEditor/resources/spaw2/plugins/core/js/gecko/format_gecko.js WebEditor/resources/spaw2/plugins/core/js/ie/ WebEditor/resources/spaw2/plugins/core/js/ie/format_ie.js WebEditor/resources/spaw2/plugins/core/js/opera/ WebEditor/resources/spaw2/plugins/core/js/opera/format_opera.js WebEditor/resources/spaw2/plugins/core/lib/ WebEditor/resources/spaw2/plugins/core/lib/lang/ WebEditor/resources/spaw2/plugins/core/lib/lang/ar.lang.inc.php WebEditor/resources/spaw2/plugins/core/lib/lang/az.lang.inc.php WebEditor/resources/spaw2/plugins/core/lib/lang/bg.lang.inc.php WebEditor/resources/spaw2/plugins/core/lib/lang/br.lang.inc.php WebEditor/resources/spaw2/plugins/core/lib/lang/ca.lang.inc.php WebEditor/resources/spaw2/plugins/core/lib/lang/cz.lang.inc.php WebEditor/resources/spaw2/plugins/core/lib/lang/de.lang.inc.php WebEditor/resources/spaw2/plugins/core/lib/lang/dk.lang.inc.php WebEditor/resources/spaw2/plugins/core/lib/lang/en.lang.inc.php WebEditor/resources/spaw2/plugins/core/lib/lang/es.lang.inc.php WebEditor/resources/spaw2/plugins/core/lib/lang/et.lang.inc.php WebEditor/resources/spaw2/plugins/core/lib/lang/fi.lang.inc.php WebEditor/resources/spaw2/plugins/core/lib/lang/fr.lang.inc.php WebEditor/resources/spaw2/plugins/core/lib/lang/gr.lang.inc.php WebEditor/resources/spaw2/plugins/core/lib/lang/gz.lang.inc.php WebEditor/resources/spaw2/plugins/core/lib/lang/he.lang.inc.php WebEditor/resources/spaw2/plugins/core/lib/lang/hr.lang.inc.php WebEditor/resources/spaw2/plugins/core/lib/lang/hu.lang.inc.php WebEditor/resources/spaw2/plugins/core/lib/lang/it.lang.inc.php WebEditor/resources/spaw2/plugins/core/lib/lang/ja.lang.inc.php WebEditor/resources/spaw2/plugins/core/lib/lang/lt.lang.inc.php WebEditor/resources/spaw2/plugins/core/lib/lang/lv.lang.inc.php WebEditor/resources/spaw2/plugins/core/lib/lang/nl.lang.inc.php WebEditor/resources/spaw2/plugins/core/lib/lang/no.lang.inc.php WebEditor/resources/spaw2/plugins/core/lib/lang/pl.lang.inc.php WebEditor/resources/spaw2/plugins/core/lib/lang/pt.lang.inc.php WebEditor/resources/spaw2/plugins/core/lib/lang/ru.lang.inc.php WebEditor/resources/spaw2/plugins/core/lib/lang/se.lang.inc.php WebEditor/resources/spaw2/plugins/core/lib/lang/si.lang.inc.php WebEditor/resources/spaw2/plugins/core/lib/lang/sk.lang.inc.php WebEditor/resources/spaw2/plugins/core/lib/lang/sr.lang.inc.php WebEditor/resources/spaw2/plugins/core/lib/lang/tr.lang.inc.php WebEditor/resources/spaw2/plugins/core/lib/lang/uk.lang.inc.php WebEditor/resources/spaw2/plugins/core/lib/lang/vn.lang.inc.php WebEditor/resources/spaw2/plugins/core/lib/lang/zh-big5.lang.inc.php WebEditor/resources/spaw2/plugins/core/lib/lang/zh-gb2312.lang.inc.php WebEditor/resources/spaw2/plugins/core/lib/theme/ WebEditor/resources/spaw2/plugins/core/lib/theme/spaw2/ WebEditor/resources/spaw2/plugins/core/lib/theme/spaw2/config/ WebEditor/resources/spaw2/plugins/core/lib/theme/spaw2/config/theme.config.php WebEditor/resources/spaw2/plugins/core/lib/theme/spaw2/css/ WebEditor/resources/spaw2/plugins/core/lib/theme/spaw2/css/dialog.css WebEditor/resources/spaw2/plugins/core/lib/theme/spaw2/css/theme.css WebEditor/resources/spaw2/plugins/core/lib/theme/spaw2/img/ WebEditor/resources/spaw2/plugins/core/lib/theme/spaw2/img/atab_bg.gif WebEditor/resources/spaw2/plugins/core/lib/theme/spaw2/img/atab_left.gif WebEditor/resources/spaw2/plugins/core/lib/theme/spaw2/img/atab_right.gif WebEditor/resources/spaw2/plugins/core/lib/theme/spaw2/img/bg_pattern.jpg WebEditor/resources/spaw2/plugins/core/lib/theme/spaw2/img/btbg.gif WebEditor/resources/spaw2/plugins/core/lib/theme/spaw2/img/checkmark.gif WebEditor/resources/spaw2/plugins/core/lib/theme/spaw2/img/graydot.gif WebEditor/resources/spaw2/plugins/core/lib/theme/spaw2/img/sizing_grip.gif WebEditor/resources/spaw2/plugins/core/lib/theme/spaw2/img/spacer.gif WebEditor/resources/spaw2/plugins/core/lib/theme/spaw2/img/tab_bg.gif WebEditor/resources/spaw2/plugins/core/lib/theme/spaw2/img/tab_left.gif WebEditor/resources/spaw2/plugins/core/lib/theme/spaw2/img/tab_right.gif WebEditor/resources/spaw2/plugins/core/lib/theme/spaw2/img/tb__empty.gif WebEditor/resources/spaw2/plugins/core/lib/theme/spaw2/img/tb__empty_down.gif WebEditor/resources/spaw2/plugins/core/lib/theme/spaw2/img/tb__empty_off.gif WebEditor/resources/spaw2/plugins/core/lib/theme/spaw2/img/tb__empty_over.gif WebEditor/resources/spaw2/plugins/core/lib/theme/spaw2/img/tb__plugin.gif WebEditor/resources/spaw2/plugins/core/lib/theme/spaw2/img/tb__plugin_down.gif WebEditor/resources/spaw2/plugins/core/lib/theme/spaw2/img/tb__plugin_off.gif WebEditor/resources/spaw2/plugins/core/lib/theme/spaw2/img/tb__plugin_over.gif WebEditor/resources/spaw2/plugins/core/lib/theme/spaw2/img/tb_baseline.gif WebEditor/resources/spaw2/plugins/core/lib/theme/spaw2/img/tb_baseline_down.gif WebEditor/resources/spaw2/plugins/core/lib/theme/spaw2/img/tb_baseline_off.gif WebEditor/resources/spaw2/plugins/core/lib/theme/spaw2/img/tb_baseline_over.gif WebEditor/resources/spaw2/plugins/core/lib/theme/spaw2/img/tb_bg_color.gif WebEditor/resources/spaw2/plugins/core/lib/theme/spaw2/img/tb_bg_color_down.gif WebEditor/resources/spaw2/plugins/core/lib/theme/spaw2/img/tb_bg_color_off.gif WebEditor/resources/spaw2/plugins/core/lib/theme/spaw2/img/tb_bg_color_over.gif WebEditor/resources/spaw2/plugins/core/lib/theme/spaw2/img/tb_bold.gif WebEditor/resources/spaw2/plugins/core/lib/theme/spaw2/img/tb_bold_down.gif WebEditor/resources/spaw2/plugins/core/lib/theme/spaw2/img/tb_bold_off.gif WebEditor/resources/spaw2/plugins/core/lib/theme/spaw2/img/tb_bold_over.gif WebEditor/resources/spaw2/plugins/core/lib/theme/spaw2/img/tb_bottom.gif WebEditor/resources/spaw2/plugins/core/lib/theme/spaw2/img/tb_bottom_down.gif WebEditor/resources/spaw2/plugins/core/lib/theme/spaw2/img/tb_bottom_off.gif WebEditor/resources/spaw2/plugins/core/lib/theme/spaw2/img/tb_bottom_over.gif WebEditor/resources/spaw2/plugins/core/lib/theme/spaw2/img/tb_cleanup.gif WebEditor/resources/spaw2/plugins/core/lib/theme/spaw2/img/tb_cleanup_down.gif WebEditor/resources/spaw2/plugins/core/lib/theme/spaw2/img/tb_cleanup_off.gif WebEditor/resources/spaw2/plugins/core/lib/theme/spaw2/img/tb_cleanup_over.gif WebEditor/resources/spaw2/plugins/core/lib/theme/spaw2/img/tb_colorpicker.gif WebEditor/resources/spaw2/plugins/core/lib/theme/spaw2/img/tb_colorpicker_down.gif WebEditor/resources/spaw2/plugins/core/lib/theme/spaw2/img/tb_colorpicker_off.gif WebEditor/resources/spaw2/plugins/core/lib/theme/spaw2/img/tb_colorpicker_over.gif WebEditor/resources/spaw2/plugins/core/lib/theme/spaw2/img/tb_copy.gif WebEditor/resources/spaw2/plugins/core/lib/theme/spaw2/img/tb_copy_down.gif WebEditor/resources/spaw2/plugins/core/lib/theme/spaw2/img/tb_copy_off.gif WebEditor/resources/spaw2/plugins/core/lib/theme/spaw2/img/tb_copy_over.gif WebEditor/resources/spaw2/plugins/core/lib/theme/spaw2/img/tb_cut.gif WebEditor/resources/spaw2/plugins/core/lib/theme/spaw2/img/tb_cut_down.gif WebEditor/resources/spaw2/plugins/core/lib/theme/spaw2/img/tb_cut_off.gif WebEditor/resources/spaw2/plugins/core/lib/theme/spaw2/img/tb_cut_over.gif WebEditor/resources/spaw2/plugins/core/lib/theme/spaw2/img/tb_delete.gif WebEditor/resources/spaw2/plugins/core/lib/theme/spaw2/img/tb_delete_down.gif WebEditor/resources/spaw2/plugins/core/lib/theme/spaw2/img/tb_delete_off.gif WebEditor/resources/spaw2/plugins/core/lib/theme/spaw2/img/tb_delete_over.gif WebEditor/resources/spaw2/plugins/core/lib/theme/spaw2/img/tb_design.gif WebEditor/resources/spaw2/plugins/core/lib/theme/spaw2/img/tb_design_down.gif WebEditor/resources/spaw2/plugins/core/lib/theme/spaw2/img/tb_design_off.gif WebEditor/resources/spaw2/plugins/core/lib/theme/spaw2/img/tb_design_over.gif WebEditor/resources/spaw2/plugins/core/lib/theme/spaw2/img/tb_flash_prop.gif WebEditor/resources/spaw2/plugins/core/lib/theme/spaw2/img/tb_flash_prop_down.gif WebEditor/resources/spaw2/plugins/core/lib/theme/spaw2/img/tb_flash_prop_off.gif WebEditor/resources/spaw2/plugins/core/lib/theme/spaw2/img/tb_flash_prop_over.gif WebEditor/resources/spaw2/plugins/core/lib/theme/spaw2/img/tb_fore_color.gif WebEditor/resources/spaw2/plugins/core/lib/theme/spaw2/img/tb_fore_color_down.gif WebEditor/resources/spaw2/plugins/core/lib/theme/spaw2/img/tb_fore_color_off.gif WebEditor/resources/spaw2/plugins/core/lib/theme/spaw2/img/tb_fore_color_over.gif WebEditor/resources/spaw2/plugins/core/lib/theme/spaw2/img/tb_html.gif WebEditor/resources/spaw2/plugins/core/lib/theme/spaw2/img/tb_html_down.gif WebEditor/resources/spaw2/plugins/core/lib/theme/spaw2/img/tb_html_off.gif WebEditor/resources/spaw2/plugins/core/lib/theme/spaw2/img/tb_html_over.gif WebEditor/resources/spaw2/plugins/core/lib/theme/spaw2/img/tb_hyperlink.gif WebEditor/resources/spaw2/plugins/core/lib/theme/spaw2/img/tb_hyperlink_down.gif WebEditor/resources/spaw2/plugins/core/lib/theme/spaw2/img/tb_hyperlink_off.gif WebEditor/resources/spaw2/plugins/core/lib/theme/spaw2/img/tb_hyperlink_over.gif WebEditor/resources/spaw2/plugins/core/lib/theme/spaw2/img/tb_image.gif WebEditor/resources/spaw2/plugins/core/lib/theme/spaw2/img/tb_image_down.gif WebEditor/resources/spaw2/plugins/core/lib/theme/spaw2/img/tb_image_map.gif WebEditor/resources/spaw2/plugins/core/lib/theme/spaw2/img/tb_image_map_down.gif WebEditor/resources/spaw2/plugins/core/lib/theme/spaw2/img/tb_image_map_off.gif WebEditor/resources/spaw2/plugins/core/lib/theme/spaw2/img/tb_image_map_over.gif WebEditor/resources/spaw2/plugins/core/lib/theme/spaw2/img/tb_image_off.gif WebEditor/resources/spaw2/plugins/core/lib/theme/spaw2/img/tb_image_over.gif WebEditor/resources/spaw2/plugins/core/lib/theme/spaw2/img/tb_image_popup.gif WebEditor/resources/spaw2/plugins/core/lib/theme/spaw2/img/tb_image_popup_down.gif WebEditor/resources/spaw2/plugins/core/lib/theme/spaw2/img/tb_image_popup_off.gif WebEditor/resources/spaw2/plugins/core/lib/theme/spaw2/img/tb_image_popup_over.gif WebEditor/resources/spaw2/plugins/core/lib/theme/spaw2/img/tb_image_prop.gif WebEditor/resources/spaw2/plugins/core/lib/theme/spaw2/img/tb_image_prop_down.gif WebEditor/resources/spaw2/plugins/core/lib/theme/spaw2/img/tb_image_prop_off.gif WebEditor/resources/spaw2/plugins/core/lib/theme/spaw2/img/tb_image_prop_over.gif WebEditor/resources/spaw2/plugins/core/lib/theme/spaw2/img/tb_indent.gif WebEditor/resources/spaw2/plugins/core/lib/theme/spaw2/img/tb_indent_down.gif WebEditor/resources/spaw2/plugins/core/lib/theme/spaw2/img/tb_indent_off.gif WebEditor/resources/spaw2/plugins/core/lib/theme/spaw2/img/tb_indent_over.gif WebEditor/resources/spaw2/plugins/core/lib/theme/spaw2/img/tb_inserthorizontalrule.gif WebEditor/resources/spaw2/plugins/core/lib/theme/spaw2/img/tb_inserthorizontalrule_down.gif WebEditor/resources/spaw2/plugins/core/lib/theme/spaw2/img/tb_inserthorizontalrule_off.gif WebEditor/resources/spaw2/plugins/core/lib/theme/spaw2/img/tb_inserthorizontalrule_over.gif WebEditor/resources/spaw2/plugins/core/lib/theme/spaw2/img/tb_insertorderedlist.gif WebEditor/resources/spaw2/plugins/core/lib/theme/spaw2/img/tb_insertorderedlist_down.gif WebEditor/resources/spaw2/plugins/core/lib/theme/spaw2/img/tb_insertorderedlist_off.gif WebEditor/resources/spaw2/plugins/core/lib/theme/spaw2/img/tb_insertorderedlist_over.gif WebEditor/resources/spaw2/plugins/core/lib/theme/spaw2/img/tb_insertunorderedlist.gif WebEditor/resources/spaw2/plugins/core/lib/theme/spaw2/img/tb_insertunorderedlist_down.gif WebEditor/resources/spaw2/plugins/core/lib/theme/spaw2/img/tb_insertunorderedlist_off.gif WebEditor/resources/spaw2/plugins/core/lib/theme/spaw2/img/tb_insertunorderedlist_over.gif WebEditor/resources/spaw2/plugins/core/lib/theme/spaw2/img/tb_internal_link.gif WebEditor/resources/spaw2/plugins/core/lib/theme/spaw2/img/tb_internal_link_down.gif WebEditor/resources/spaw2/plugins/core/lib/theme/spaw2/img/tb_internal_link_off.gif WebEditor/resources/spaw2/plugins/core/lib/theme/spaw2/img/tb_internal_link_over.gif WebEditor/resources/spaw2/plugins/core/lib/theme/spaw2/img/tb_italic.gif WebEditor/resources/spaw2/plugins/core/lib/theme/spaw2/img/tb_italic_down.gif WebEditor/resources/spaw2/plugins/core/lib/theme/spaw2/img/tb_italic_off.gif WebEditor/resources/spaw2/plugins/core/lib/theme/spaw2/img/tb_italic_over.gif WebEditor/resources/spaw2/plugins/core/lib/theme/spaw2/img/tb_justifycenter.gif WebEditor/resources/spaw2/plugins/core/lib/theme/spaw2/img/tb_justifycenter_down.gif WebEditor/resources/spaw2/plugins/core/lib/theme/spaw2/img/tb_justifycenter_off.gif WebEditor/resources/spaw2/plugins/core/lib/theme/spaw2/img/tb_justifycenter_over.gif WebEditor/resources/spaw2/plugins/core/lib/theme/spaw2/img/tb_justifyfull.gif WebEditor/resources/spaw2/plugins/core/lib/theme/spaw2/img/tb_justifyfull_down.gif WebEditor/resources/spaw2/plugins/core/lib/theme/spaw2/img/tb_justifyfull_off.gif WebEditor/resources/spaw2/plugins/core/lib/theme/spaw2/img/tb_justifyfull_over.gif WebEditor/resources/spaw2/plugins/core/lib/theme/spaw2/img/tb_justifyleft.gif WebEditor/resources/spaw2/plugins/core/lib/theme/spaw2/img/tb_justifyleft_down.gif WebEditor/resources/spaw2/plugins/core/lib/theme/spaw2/img/tb_justifyleft_off.gif WebEditor/resources/spaw2/plugins/core/lib/theme/spaw2/img/tb_justifyleft_over.gif WebEditor/resources/spaw2/plugins/core/lib/theme/spaw2/img/tb_justifyright.gif WebEditor/resources/spaw2/plugins/core/lib/theme/spaw2/img/tb_justifyright_down.gif WebEditor/resources/spaw2/plugins/core/lib/theme/spaw2/img/tb_justifyright_off.gif WebEditor/resources/spaw2/plugins/core/lib/theme/spaw2/img/tb_justifyright_over.gif WebEditor/resources/spaw2/plugins/core/lib/theme/spaw2/img/tb_middle.gif WebEditor/resources/spaw2/plugins/core/lib/theme/spaw2/img/tb_middle_down.gif WebEditor/resources/spaw2/plugins/core/lib/theme/spaw2/img/tb_middle_off.gif WebEditor/resources/spaw2/plugins/core/lib/theme/spaw2/img/tb_middle_over.gif WebEditor/resources/spaw2/plugins/core/lib/theme/spaw2/img/tb_new.gif WebEditor/resources/spaw2/plugins/core/lib/theme/spaw2/img/tb_new_down.gif WebEditor/resources/spaw2/plugins/core/lib/theme/spaw2/img/tb_new_off.gif WebEditor/resources/spaw2/plugins/core/lib/theme/spaw2/img/tb_new_over.gif WebEditor/resources/spaw2/plugins/core/lib/theme/spaw2/img/tb_outdent.gif WebEditor/resources/spaw2/plugins/core/lib/theme/spaw2/img/tb_outdent_down.gif WebEditor/resources/spaw2/plugins/core/lib/theme/spaw2/img/tb_outdent_off.gif WebEditor/resources/spaw2/plugins/core/lib/theme/spaw2/img/tb_outdent_over.gif WebEditor/resources/spaw2/plugins/core/lib/theme/spaw2/img/tb_page_prop.gif WebEditor/resources/spaw2/plugins/core/lib/theme/spaw2/img/tb_page_prop_down.gif WebEditor/resources/spaw2/plugins/core/lib/theme/spaw2/img/tb_page_prop_off.gif WebEditor/resources/spaw2/plugins/core/lib/theme/spaw2/img/tb_page_prop_over.gif WebEditor/resources/spaw2/plugins/core/lib/theme/spaw2/img/tb_paste.gif WebEditor/resources/spaw2/plugins/core/lib/theme/spaw2/img/tb_paste_down.gif WebEditor/resources/spaw2/plugins/core/lib/theme/spaw2/img/tb_paste_off.gif WebEditor/resources/spaw2/plugins/core/lib/theme/spaw2/img/tb_paste_over.gif WebEditor/resources/spaw2/plugins/core/lib/theme/spaw2/img/tb_preview.gif WebEditor/resources/spaw2/plugins/core/lib/theme/spaw2/img/tb_preview_down.gif WebEditor/resources/spaw2/plugins/core/lib/theme/spaw2/img/tb_preview_off.gif WebEditor/resources/spaw2/plugins/core/lib/theme/spaw2/img/tb_preview_over.gif WebEditor/resources/spaw2/plugins/core/lib/theme/spaw2/img/tb_redo.gif WebEditor/resources/spaw2/plugins/core/lib/theme/spaw2/img/tb_redo_down.gif WebEditor/resources/spaw2/plugins/core/lib/theme/spaw2/img/tb_redo_off.gif WebEditor/resources/spaw2/plugins/core/lib/theme/spaw2/img/tb_redo_over.gif WebEditor/resources/spaw2/plugins/core/lib/theme/spaw2/img/tb_save.gif WebEditor/resources/spaw2/plugins/core/lib/theme/spaw2/img/tb_save_all.gif WebEditor/resources/spaw2/plugins/core/lib/theme/spaw2/img/tb_save_all_down.gif WebEditor/resources/spaw2/plugins/core/lib/theme/spaw2/img/tb_save_all_off.gif WebEditor/resources/spaw2/plugins/core/lib/theme/spaw2/img/tb_save_all_over.gif WebEditor/resources/spaw2/plugins/core/lib/theme/spaw2/img/tb_save_down.gif WebEditor/resources/spaw2/plugins/core/lib/theme/spaw2/img/tb_save_off.gif WebEditor/resources/spaw2/plugins/core/lib/theme/spaw2/img/tb_save_over.gif WebEditor/resources/spaw2/plugins/core/lib/theme/spaw2/img/tb_separator.gif WebEditor/resources/spaw2/plugins/core/lib/theme/spaw2/img/tb_special_chars.gif WebEditor/resources/spaw2/plugins/core/lib/theme/spaw2/img/tb_special_chars_down.gif WebEditor/resources/spaw2/plugins/core/lib/theme/spaw2/img/tb_special_chars_off.gif WebEditor/resources/spaw2/plugins/core/lib/theme/spaw2/img/tb_special_chars_over.gif WebEditor/resources/spaw2/plugins/core/lib/theme/spaw2/img/tb_strikethrough.gif WebEditor/resources/spaw2/plugins/core/lib/theme/spaw2/img/tb_strikethrough_down.gif WebEditor/resources/spaw2/plugins/core/lib/theme/spaw2/img/tb_strikethrough_off.gif WebEditor/resources/spaw2/plugins/core/lib/theme/spaw2/img/tb_strikethrough_over.gif WebEditor/resources/spaw2/plugins/core/lib/theme/spaw2/img/tb_subscript.gif WebEditor/resources/spaw2/plugins/core/lib/theme/spaw2/img/tb_subscript_down.gif WebEditor/resources/spaw2/plugins/core/lib/theme/spaw2/img/tb_subscript_off.gif WebEditor/resources/spaw2/plugins/core/lib/theme/spaw2/img/tb_subscript_over.gif WebEditor/resources/spaw2/plugins/core/lib/theme/spaw2/img/tb_superscript.gif WebEditor/resources/spaw2/plugins/core/lib/theme/spaw2/img/tb_superscript_down.gif WebEditor/resources/spaw2/plugins/core/lib/theme/spaw2/img/tb_superscript_off.gif WebEditor/resources/spaw2/plugins/core/lib/theme/spaw2/img/tb_superscript_over.gif WebEditor/resources/spaw2/plugins/core/lib/theme/spaw2/img/tb_table_cell_merge_down.gif WebEditor/resources/spaw2/plugins/core/lib/theme/spaw2/img/tb_table_cell_merge_down_down.gif WebEditor/resources/spaw2/plugins/core/lib/theme/spaw2/img/tb_table_cell_merge_down_off.gif WebEditor/resources/spaw2/plugins/core/lib/theme/spaw2/img/tb_table_cell_merge_down_over.gif WebEditor/resources/spaw2/plugins/core/lib/theme/spaw2/img/tb_table_cell_merge_right.gif WebEditor/resources/spaw2/plugins/core/lib/theme/spaw2/img/tb_table_cell_merge_right_down.gif WebEditor/resources/spaw2/plugins/core/lib/theme/spaw2/img/tb_table_cell_merge_right_off.gif WebEditor/resources/spaw2/plugins/core/lib/theme/spaw2/img/tb_table_cell_merge_right_over.gif WebEditor/resources/spaw2/plugins/core/lib/theme/spaw2/img/tb_table_cell_prop.gif WebEditor/resources/spaw2/plugins/core/lib/theme/spaw2/img/tb_table_cell_prop_down.gif WebEditor/resources/spaw2/plugins/core/lib/theme/spaw2/img/tb_table_cell_prop_off.gif WebEditor/resources/spaw2/plugins/core/lib/theme/spaw2/img/tb_table_cell_prop_over.gif WebEditor/resources/spaw2/plugins/core/lib/theme/spaw2/img/tb_table_cell_split_horizontal.gif WebEditor/resources/spaw2/plugins/core/lib/theme/spaw2/img/tb_table_cell_split_horizontal_down.gif WebEditor/resources/spaw2/plugins/core/lib/theme/spaw2/img/tb_table_cell_split_horizontal_off.gif WebEditor/resources/spaw2/plugins/core/lib/theme/spaw2/img/tb_table_cell_split_horizontal_over.gif WebEditor/resources/spaw2/plugins/core/lib/theme/spaw2/img/tb_table_cell_split_vertical.gif WebEditor/resources/spaw2/plugins/core/lib/theme/spaw2/img/tb_table_cell_split_vertical_down.gif WebEditor/resources/spaw2/plugins/core/lib/theme/spaw2/img/tb_table_cell_split_vertical_off.gif WebEditor/resources/spaw2/plugins/core/lib/theme/spaw2/img/tb_table_cell_split_vertical_over.gif WebEditor/resources/spaw2/plugins/core/lib/theme/spaw2/img/tb_table_column_delete.gif WebEditor/resources/spaw2/plugins/core/lib/theme/spaw2/img/tb_table_column_delete_down.gif WebEditor/resources/spaw2/plugins/core/lib/theme/spaw2/img/tb_table_column_delete_off.gif WebEditor/resources/spaw2/plugins/core/lib/theme/spaw2/img/tb_table_column_delete_over.gif WebEditor/resources/spaw2/plugins/core/lib/theme/spaw2/img/tb_table_column_insert.gif WebEditor/resources/spaw2/plugins/core/lib/theme/spaw2/img/tb_table_column_insert_down.gif WebEditor/resources/spaw2/plugins/core/lib/theme/spaw2/img/tb_table_column_insert_off.gif WebEditor/resources/spaw2/plugins/core/lib/theme/spaw2/img/tb_table_column_insert_over.gif WebEditor/resources/spaw2/plugins/core/lib/theme/spaw2/img/tb_table_create.gif WebEditor/resources/spaw2/plugins/core/lib/theme/spaw2/img/tb_table_create_down.gif WebEditor/resources/spaw2/plugins/core/lib/theme/spaw2/img/tb_table_create_off.gif WebEditor/resources/spaw2/plugins/core/lib/theme/spaw2/img/tb_table_create_over.gif WebEditor/resources/spaw2/plugins/core/lib/theme/spaw2/img/tb_table_prop.gif WebEditor/resources/spaw2/plugins/core/lib/theme/spaw2/img/tb_table_prop_down.gif WebEditor/resources/spaw2/plugins/core/lib/theme/spaw2/img/tb_table_prop_off.gif WebEditor/resources/spaw2/plugins/core/lib/theme/spaw2/img/tb_table_prop_over.gif WebEditor/resources/spaw2/plugins/core/lib/theme/spaw2/img/tb_table_row_delete.gif WebEditor/resources/spaw2/plugins/core/lib/theme/spaw2/img/tb_table_row_delete_down.gif WebEditor/resources/spaw2/plugins/core/lib/theme/spaw2/img/tb_table_row_delete_off.gif WebEditor/resources/spaw2/plugins/core/lib/theme/spaw2/img/tb_table_row_delete_over.gif WebEditor/resources/spaw2/plugins/core/lib/theme/spaw2/img/tb_table_row_insert.gif WebEditor/resources/spaw2/plugins/core/lib/theme/spaw2/img/tb_table_row_insert_down.gif WebEditor/resources/spaw2/plugins/core/lib/theme/spaw2/img/tb_table_row_insert_off.gif WebEditor/resources/spaw2/plugins/core/lib/theme/spaw2/img/tb_table_row_insert_over.gif WebEditor/resources/spaw2/plugins/core/lib/theme/spaw2/img/tb_table_row_prop.gif WebEditor/resources/spaw2/plugins/core/lib/theme/spaw2/img/tb_table_row_prop_down.gif WebEditor/resources/spaw2/plugins/core/lib/theme/spaw2/img/tb_table_row_prop_off.gif WebEditor/resources/spaw2/plugins/core/lib/theme/spaw2/img/tb_table_row_prop_over.gif WebEditor/resources/spaw2/plugins/core/lib/theme/spaw2/img/tb_toggle_borders.gif WebEditor/resources/spaw2/plugins/core/lib/theme/spaw2/img/tb_toggle_borders_down.gif WebEditor/resources/spaw2/plugins/core/lib/theme/spaw2/img/tb_toggle_borders_off.gif WebEditor/resources/spaw2/plugins/core/lib/theme/spaw2/img/tb_toggle_borders_over.gif WebEditor/resources/spaw2/plugins/core/lib/theme/spaw2/img/tb_top.gif WebEditor/resources/spaw2/plugins/core/lib/theme/spaw2/img/tb_top_down.gif WebEditor/resources/spaw2/plugins/core/lib/theme/spaw2/img/tb_top_off.gif WebEditor/resources/spaw2/plugins/core/lib/theme/spaw2/img/tb_top_over.gif WebEditor/resources/spaw2/plugins/core/lib/theme/spaw2/img/tb_underline.gif WebEditor/resources/spaw2/plugins/core/lib/theme/spaw2/img/tb_underline_down.gif WebEditor/resources/spaw2/plugins/core/lib/theme/spaw2/img/tb_underline_off.gif WebEditor/resources/spaw2/plugins/core/lib/theme/spaw2/img/tb_underline_over.gif WebEditor/resources/spaw2/plugins/core/lib/theme/spaw2/img/tb_undo.gif WebEditor/resources/spaw2/plugins/core/lib/theme/spaw2/img/tb_undo_down.gif WebEditor/resources/spaw2/plugins/core/lib/theme/spaw2/img/tb_undo_off.gif WebEditor/resources/spaw2/plugins/core/lib/theme/spaw2/img/tb_undo_over.gif WebEditor/resources/spaw2/plugins/core/lib/theme/spaw2/img/tb_unlink.gif WebEditor/resources/spaw2/plugins/core/lib/theme/spaw2/img/tb_unlink_down.gif WebEditor/resources/spaw2/plugins/core/lib/theme/spaw2/img/tb_unlink_off.gif WebEditor/resources/spaw2/plugins/core/lib/theme/spaw2/img/tb_unlink_over.gif WebEditor/resources/spaw2/plugins/core/lib/theme/spaw2/js/ WebEditor/resources/spaw2/plugins/core/lib/theme/spaw2/js/common/ WebEditor/resources/spaw2/plugins/core/lib/theme/spaw2/js/common/spaw2.js WebEditor/resources/spaw2/plugins/core/lib/theme/spaw2/templates/ WebEditor/resources/spaw2/plugins/core/lib/theme/spaw2/templates/dialog_footer.tpl WebEditor/resources/spaw2/plugins/core/lib/theme/spaw2/templates/dialog_header.tpl WebEditor/resources/spaw2/plugins/core/lib/theme/spaw2/templates/editor.tpl WebEditor/resources/spaw2/plugins/core/lib/theme/spaw2/templates/editor_floating.tpl WebEditor/resources/spaw2/plugins/core/lib/theme/spaw2/templates/toolbar_floating.tpl WebEditor/resources/spaw2/plugins/core/lib/toolbars/ WebEditor/resources/spaw2/plugins/core/lib/toolbars/edit.toolbar.php WebEditor/resources/spaw2/plugins/core/lib/toolbars/font.toolbar.php WebEditor/resources/spaw2/plugins/core/lib/toolbars/format.toolbar.php WebEditor/resources/spaw2/plugins/core/lib/toolbars/format_mini.toolbar.php WebEditor/resources/spaw2/plugins/core/lib/toolbars/insert.toolbar.php WebEditor/resources/spaw2/plugins/core/lib/toolbars/mode_strip.toolbar.php WebEditor/resources/spaw2/plugins/core/lib/toolbars/style.toolbar.php WebEditor/resources/spaw2/plugins/core/lib/toolbars/table.toolbar.php WebEditor/resources/spaw2/plugins/core/lib/toolbars/tools.toolbar.php WebEditor/resources/spaw2/plugins/spawfm/ WebEditor/resources/spaw2/plugins/spawfm/class/ WebEditor/resources/spaw2/plugins/spawfm/class/spawfm.class.php WebEditor/resources/spaw2/plugins/spawfm/config/ WebEditor/resources/spaw2/plugins/spawfm/config/config.php WebEditor/resources/spaw2/plugins/spawfm/dialogs/ WebEditor/resources/spaw2/plugins/spawfm/dialogs/spawfm.inc.php WebEditor/resources/spaw2/plugins/spawfm/dialogs/spawfm.js WebEditor/resources/spaw2/plugins/spawfm/img/ WebEditor/resources/spaw2/plugins/spawfm/img/btn_new_folder.gif WebEditor/resources/spaw2/plugins/spawfm/img/btn_new_folder_off.gif WebEditor/resources/spaw2/plugins/spawfm/img/btn_up.gif WebEditor/resources/spaw2/plugins/spawfm/img/btn_up_off.gif WebEditor/resources/spaw2/plugins/spawfm/img/ico_default.gif WebEditor/resources/spaw2/plugins/spawfm/img/ico_default_big.gif WebEditor/resources/spaw2/plugins/spawfm/img/ico_flash.gif WebEditor/resources/spaw2/plugins/spawfm/img/ico_flash_big.gif WebEditor/resources/spaw2/plugins/spawfm/img/ico_folder.gif WebEditor/resources/spaw2/plugins/spawfm/img/ico_image.gif WebEditor/resources/spaw2/plugins/spawfm/img/ico_image_big.gif WebEditor/resources/spaw2/plugins/spawfm/lib/ WebEditor/resources/spaw2/plugins/spawfm/lib/filelist0.css WebEditor/resources/spaw2/plugins/spawfm/lib/filelist1.css WebEditor/resources/spaw2/plugins/spawfm/lib/lang/ WebEditor/resources/spaw2/plugins/spawfm/lib/lang/en.lang.inc.php WebEditor/resources/spaw2/plugins/spawfm/lib/lang/hu.lang.inc.php WebEditor/resources/spaw2/plugins/spawfm/lib/lang/lt.lang.inc.php WebEditor/resources/spaw2/plugins/spawfm/lib/lang/nl.lang.inc.php WebEditor/resources/spaw2/plugins/spawfm/lib/lang/ru.lang.inc.php WebEditor/resources/spaw2/plugins/spawfm/lib/theme/ WebEditor/resources/spaw2/plugins/spawfm/lib/theme/spaw2/ WebEditor/resources/spaw2/plugins/spawfm/lib/theme/spaw2/img/ WebEditor/resources/spaw2/plugins/spawfm/lib/theme/spaw2/img/btn_view_details.gif WebEditor/resources/spaw2/plugins/spawfm/lib/theme/spaw2/img/btn_view_list.gif WebEditor/resources/spaw2/plugins/spawfm/lib/theme/spaw2/img/btn_view_thumbs.gif WebEditor/resources/spaw2/spacer.gif WebEditor/resources/spaw2/spaw.inc.php WebEditor/resources/spaw2/spaw_control.class.php WebEditor/resources/spaw2/uploads/ WebEditor/resources/spaw2/uploads/files/ WebEditor/resources/spaw2/uploads/files/180px-UniwersytetJanaKazimierzaLw?\208?\147_w1.jpg WebEditor/resources/spaw2/uploads/files/banner.GIF WebEditor/resources/spaw2/uploads/files/lnu.doc WebEditor/resources/spaw2/wysiwyg.css WebEditor/template/ChapterModel.conf WebEditor/template/OrganizationModel.conf Added: WebEditor/resources/HTMLedit.php =================================================================== --- WebEditor/resources/HTMLedit.php (rev 0) +++ WebEditor/resources/HTMLedit.php 2008-05-07 22:19:10 UTC (rev 102) @@ -0,0 +1,25 @@ +<html> +<head> + <script type="text/javascript"> + + function save(){ + var s=document.getElementById("spaw_edit_field").value; + opener.document.webeditor.setEditedHTML(s); + close(); + } + + </script> +</head> +<body> + +<? +include("spaw2/spaw.inc.php"); + +$spaw = new SpawEditor('spaw_edit_field'); +$spaw->show(); +?> + +<input type='button' value='save' onClick='javascript:save();'> + +</body> +</html> \ No newline at end of file Added: WebEditor/resources/HTMLeditor.js =================================================================== --- WebEditor/resources/HTMLeditor.js (rev 0) +++ WebEditor/resources/HTMLeditor.js 2008-05-07 22:19:10 UTC (rev 102) @@ -0,0 +1,3 @@ +function showEditor(){ + myWin=window.open("HTMLedit.php", "wind1", "width=800,height=350"); +} Modified: WebEditor/resources/index.html =================================================================== --- WebEditor/resources/index.html 2008-05-07 19:24:22 UTC (rev 101) +++ WebEditor/resources/index.html 2008-05-07 22:19:10 UTC (rev 102) @@ -2,7 +2,7 @@ <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> <title>Learning system :: Editor of courses</title> <script type="text/javascript" src="api.js"></script> - <script type="text/javascript" src="navigation.js"></script> + <script type="text/javascript" src="HTMLeditor.js"></script> <style> .left-corn { @@ -85,7 +85,7 @@ </tr> <tr height='*'> <td class='side-body'> - <applet mayscript="" name="player" archive="webeditor.jar,RTEValidators.jar,FFManifest.jar, dom4j.jar" code=edu.lnu.FireFly.WebEditor.WebEditor.class width="100%" height="100%"> + <applet mayscript="" name="webeditor" archive="webeditor.jar,RTEValidators.jar,FFManifest.jar, dom4j.jar" code=edu.lnu.FireFly.WebEditor.WebEditor.class width="100%" height="100%"> <PARAM NAME="courseLocation" VALUE="http://127.0.0.1/sem/course/"> <PARAM NAME="serviceLocation" VALUE="http://127.0.0.1/sem/WebEditor/service/"> <PARAM NAME="templateLocation" VALUE="http://127.0.0.1/sem/WebEditor/template/"> Added: WebEditor/resources/spaw2/class/config.class.php =================================================================== --- WebEditor/resources/spaw2/class/config.class.php (rev 0) +++ WebEditor/resources/spaw2/class/config.class.php 2008-05-07 22:19:10 UTC (rev 102) @@ -0,0 +1,332 @@ +<?php +/** + * SPAW Editor v.2 Config classes + * + * Configuration related classes + * + * @package spaw2 + * @subpackage Configuration + * @author Alan Mendelevich <al...@so...> + * @copyright UAB Solmetra + */ + +/** + * Specifies that value for the config item is not transfered to external parts of spaw + */ +define("SPAW_CFG_TRANSFER_NONE", 0); +/** + * Specifies that value for the config item is transfered via JavaScript variables + */ +define("SPAW_CFG_TRANSFER_JS", 1); +/** + * Specifies that value for the config item is appended to request url + */ +define("SPAW_CFG_TRANSFER_REQUEST", 2); +/** + * Specifies that value for the config item is stored on the server + */ +define("SPAW_CFG_TRANSFER_SECURE", 4); + +/** + * Configuration item class + * + * Class defines single configuration item + * @package spaw2 + * @subpackage Configuration + */ +class SpawConfigItem +{ + /** + * Sets config item values + * @param string $name Config item's name + * @param mixed $value Config item's value + * @param integer $tranfer_type The way item should be transfered to other parts of the editor (one of SPAW_CFG_TRANSFER_* constants) + * @return SpawConfigItem + */ + function SpawConfigItem($name, $value, $transfer_type) + { + $this->name = $name; + $this->value = $value; + $this->transfer_type = $transfer_type; + } + /** + * item name + * @var string + */ + var $name; + /** + * item value + * @var mixed + */ + var $value; + /** + * the way item is transferred to dialogs, etc. + * Holds information on the prefered method to transfer this value to external + * of the editor like dialogs. Should be set to one (or several combined with OR) + * of SPAW_CFG_TRANFER_* constants. + * @var integer + */ + var $transfer_type; +} + +/** + * Configuration class + * + * Holds global (when accessed through class) SPAW configuration and + * instance configuration when insantiated + * @package spaw2 + * @subpackage Configuration + */ +class SpawConfig +{ + /** + * array for instance config settings + * @access private + */ + var $config; + + /** + * Copies global SPAW configuration to instance + */ + function SpawConfig() + { + // copy static config to this instance + $this->config = SpawConfig::configVar(); + } + + /** + * Workaround for "static" class variable under php4 + * @access private + */ + function &configVar() + { + static $config; + + return $config; + } + + /** + * Sets global config item + * @param string $name Config item's name + * @param mixed $value Config item's value + * @param integer $transfer_type Transfer type for the value (One or several of SPAW_CFG_TRANSFER_* constants). Default value - SPAW_CFG_TRANSFER_NONE + * @see SPAW_CFG_TRANSFER_NONE, SPAW_CFG_TRANSFER_JS, SPAW_CFG_TRANSFER_REQUEST, SPAW_CFG_TRANSFER_SECURE + * @static + */ + function setStaticConfigItem($name, $value, $transfer_type=SPAW_CFG_TRANSFER_NONE) + { + $cfg = &SpawConfig::configVar(); + $cfg[$name] = new SpawConfigItem($name, $value, $transfer_type); + } + + /** + * Sets instance config item + * @param string $name Config item's name + * @param mixed $value Config item's value + * @param integer $transfer_type Transfer type for the value (One or several of SPAW_CFG_TRANSFER_* constants). Default value - SPAW_CFG_TRANSFER_NONE + * @see SPAW_CFG_TRANSFER_NONE, SPAW_CFG_TRANSFER_JS, SPAW_CFG_TRANSFER_REQUEST, SPAW_CFG_TRANSFER_SECURE + */ + function setConfigItem($name, $value, $transfer_type=SPAW_CFG_TRANSFER_NONE) + { + $this->config[$name] = new SpawConfigItem($name, $value, $transfer_type); + } + + /** + * Gets global config item + * @param string $name Config item name + * @returns SpawConfigItem + * @static + */ + function getStaticConfigItem($name) + { + $cfg = &SpawConfig::configVar(); + if (isset($cfg[$name])) + return $cfg[$name]; + else + return NULL; + } + + /** + * Gets instance config item + * @param string $name Config item name + * @returns SpawConfigItem + */ + function getConfigItem($name) + { + $cfg = $this->config; + if (isset($cfg[$name])) + return $cfg[$name]; + else + return NULL; + } + + /** + * Sets global config item value + * @param string $name Config item name + * @param mixed $value Config item value + * @static + */ + function setStaticConfigValue($name, $value) + { + $cfg_item = SpawConfig::getStaticConfigItem($name); + if ($cfg_item) + { + $cfg_item->value = $value; + SpawConfig::setStaticConfigItem($cfg_item->name, $cfg_item->value, $cfg_item->transfer_type); + } + } + + /** + * Sets global value for the element of config item provided item's value is an array + * @param string $name Config item name + * @param mixed $index Array index + * @param mixed $value Element value + */ + function setStaticConfigValueElement($name, $index, $value) + { + $cfg_item = SpawConfig::getStaticConfigItem($name); + if ($cfg_item && is_array($cfg_item->value)) + { + $cfg_item->value[$index] = $value; + SpawConfig::setStaticConfigItem($cfg_item->name, $cfg_item->value, $cfg_item->transfer_type); + } + } + + /** + * Sets instance config item value + * @param string $name Config item name + * @param mixed $value Config item value + */ + function setConfigValue($name, $value) + { + $cfg_item = $this->getConfigItem($name); + + if ($cfg_item) + { + $cfg_item->value = $value; + $this->setConfigItem($cfg_item->name, $cfg_item->value, $cfg_item->transfer_type); + } + } + + /** + * Sets instance value for the element of config item provided item's value is an array + * @param string $name Config item name + * @param mixed $index Array index + * @param mixed $value Element value + */ + function setConfigValueElement($name, $index, $value) + { + $cfg_item = $this->getConfigItem($name); + if ($cfg_item && is_array($cfg_item->value)) + { + $cfg_item->value[$index] = $value; + $this->setConfigItem($cfg_item->name, $cfg_item->value, $cfg_item->transfer_type); + } + } + + /** + * Gets global config item value + * @param string $name Config item name + * @returns mixed Config item value + * @static + */ + function getStaticConfigValue($name) + { + $cfg_item = SpawConfig::getStaticConfigItem($name); + + if ($cfg_item) + return $cfg_item->value; + else + return NULL; + } + + /** + * Gets global value for the element of config item provided item's value is an array + * @param string $name Config item name + * @param mixed $index Array index + * @returns mixed Element value + */ + function getStaticConfigValueElement($name, $index) + { + $cfg_item = SpawConfig::getStaticConfigItem($name); + if ($cfg_item && is_array($cfg_item->value) && !empty($cfg_item->value[$index])) + return $cfg_item->value[$index]; + else + return NULL; + } + + + /** + * Gets instance config item value + * @param string $name Config item name + * @returns mixed Config item value + */ + function getConfigValue($name) + { + $cfg_item = $this->getConfigItem($name); + + if ($cfg_item) + return $cfg_item->value; + else + return NULL; + } + + /** + * Gets instance value for the element of config item provided item's value is an array + * @param string $name Config item name + * @param mixed $index Array index + * @returns mixed Element value + */ + function getConfigValueElement($name, $index) + { + $cfg_item = $this->getConfigItem($name); + if ($cfg_item && is_array($cfg_item->value) && !empty($cfg_item->value[$index])) + return $cfg_item->value[$index]; + else + return NULL; + } + + /** + * Stores "secure" config items in session and returns md5 of serialized config variables + * @returns string + */ + function storeSecureConfig() + { + $strcfg = ''; + $cfg = $this->config; + $sec_cfg = array(); + $result = ''; + $stored_cfg = SpawVars::getSessionVar("spaw_configs"); + + foreach($cfg as $key => $cfg_item) + { + if ($cfg_item->transfer_type & SPAW_CFG_TRANSFER_SECURE) + { + $strcfg .= $key . serialize($cfg_item); + $sec_cfg[$key] = $cfg_item; + } + } + if ($strcfg != '') + { + $result = md5($strcfg); + $stored_cfg[$result] = $sec_cfg; + SpawVars::setSessionVar("spaw_configs", $stored_cfg); + } + return $result; + } + + /** + * Restores "secure" config items from session + * @params string $scid Config id + */ + function restoreSecureConfig($scid) + { + $sec_cfg = SpawVars::getSessionVar("spaw_configs"); + if ($sec_cfg != '' && is_array($sec_cfg[$scid])) + { + foreach($sec_cfg[$scid] as $key => $cfg_item) + $this->setConfigItem($cfg_item->name, $cfg_item->value, $cfg_item->transfer_type); + } + } +} +?> Added: WebEditor/resources/spaw2/class/editor.class.php =================================================================== --- WebEditor/resources/spaw2/class/editor.class.php (rev 0) +++ WebEditor/resources/spaw2/class/editor.class.php 2008-05-07 22:19:10 UTC (rev 102) @@ -0,0 +1,834 @@ +<?php +/** + * SPAW Editor v.2 Editor classes + * + * Main editor classes + * @package spaw2 + * @subpackage Editor + * @author Alan Mendelevich <al...@so...> + * @copyright UAB Solmetra + */ + +require_once(str_replace('\\\\','/',dirname(__FILE__)).'/config.class.php'); +require_once(str_replace('\\\\','/',dirname(__FILE__)).'/toolbar.class.php'); +require_once(str_replace('\\\\','/',dirname(__FILE__)).'/theme.class.php'); +require_once(str_replace('\\\\','/',dirname(__FILE__)).'/lang.class.php'); + +/** + * Represetns editor page + * @package spaw2 + * @subpackage Editor + */ +class SpawEditorPage +{ + /** + * Page name + * @var string + */ + var $name; + + /** + * Name of the page input (textarea) + * @var string + */ + var $intputName; + + /** + * Page caption + * @var string + */ + var $caption; + + /** + * Page direction + * @var string + */ + var $direction; + + /** + * Page content + * @var string + */ + var $value; + + /** + * Constructor + * @param string $name Name + * @param string $caption Caption + * @param string $value Initial content + */ + function SpawEditorPage($name, $caption, $value = '', $direction = 'ltr') + { + // workaround for names with [ and ] + $_page_count = SpawConfig::getStaticConfigItem('_page_count'); + if ($_page_count != null) + { + SpawConfig::setStaticConfigItem('_page_count', $_page_count->value + 1); + } + else + { + SpawConfig::setStaticConfigItem('_page_count', 1); + } + $_pn = SpawConfig::getStaticConfigValue('_page_count'); + + $ctrl_id = str_replace(']','_', str_replace('[', '_', $name)); + if ($ctrl_id != $name) + $ctrl_id = $ctrl_id . '_' . $_pn; + + $this->name = $ctrl_id; + $this->inputName = $name; + $this->caption = $caption; + $this->value = $value; + $this->direction = $direction; + } +} + +/** + * Represents the editor as a whole + * @package spaw2 + * @subpackage Editor + */ +class SpawEditor +{ + /** + * Holds editor name + * @var string + */ + var $name; + + + /** + * Workaround for "static" class variable under php4 + * @access private + */ + function &scriptSent() + { + static $script_sent; + + return $script_sent; + } + + /** + * Constructor + * @param string $name Editor name + */ + function SpawEditor($name, $value='', $lang='', $toolbarset='', + $theme='', $width='', $height='', $stylesheet='', $page_caption='') + { + $this->name = $name; + + // add first page + $page_caption = ($page_caption != '')?$page_caption:$name; + $page = new SpawEditorPage($name, $page_caption, $value); + if ($page->name != $this->name) + $this->name = $page->name; + $this->addPage($page); + $this->setActivePage($page); + + if ($lang != '') + $this->setLanguage($lang); +// if ($toolbarset != '') +// $this->addToolbarSet($toolbarset); + if ($theme != '') + $this->setTheme($theme); + if ($width != '') + $this->setDimensions($width, null); + if ($height != '') + $this->setDimensions(null, $height); + if ($stylesheet != '') + $this->setStylesheet($stylesheet); + + // load static config + $this->config = new SpawConfig(); + + if ($toolbarset != '') + $this->setConfigValue('default_toolbarset',$toolbarset); + } + + /** + * Stores instance config + * @var SpawConfig + */ + var $config; + + /** + * Stores instance width + * @var string + */ + var $width; + + /** + * Stores instance height + * @var string + */ + var $height; + + /** + * Sets editor dimensions + * @param string width + * @param string height + */ + function setDimensions($width, $height) + { + if ($width != null && $width != '') + $this->width = $width; + if ($height != null && $height != '') + $this->height = $height; + } + + /** + * Stores toolbars used in this instance + * @var array + */ + var $toolbars; + + /** + * Adds toolbars to current instance (unlimited number of arguments could be passed) + * + * Specify a comma separated list of toolbars that should be displayed (ie. "format","table",etc.). + * @param string $toolbar,... list of toolbar names + */ + function addToolbars($toolbar='') + { + $numargs = func_num_args(); + if ($numargs) + { + // add specified toolbars + $args = func_get_args(); + for ($i=0; $i<$numargs; $i++) + { + $this->toolbars[$args[$i]] = SpawToolbar::getToolbar($args[$i]); + $this->toolbars[$args[$i]]->editor = &$this; + } + } + } + + /** + * Adds toolbar set + * @param string toolbar set name + */ + function addToolbarSet($toolbarset) + { + $tset = SpawConfig::getStaticConfigValue("toolbarset_".$toolbarset); + if (is_array($tset)) + { + foreach($tset as $substitute => $toolbar) + { + $this->addToolbar($toolbar, $substitute); + } + } + } + + /** + * Adds toolbar (substitutes other toolbar if $substiture is specified) + * @param string $toolbar name of the toolbar to add + * @param string $substitute place this toolbar in place of specified + */ + function addToolbar($toolbar, $substitute='') + { + $index = empty($substitute)?$toolbar:$substitute; + + $this->toolbars[$index] = SpawToolbar::getToolbar($toolbar); + $this->toolbars[$index]->editor = &$this; + } + + /** + * Theme/skin + * @var SpawTheme + */ + var $theme; + + /** + * Sets theme/skin for the instance + * @param string $theme Theme name + */ + function setTheme($theme) + { + $this->theme = SpawTheme::getTheme($theme); + } + + /** + * Language + * @var SpawLang + */ + var $lang; + + /** + * Sets editor language + * @param string $lang abbreviation of the language code + * @param string $out_charset output charset + */ + function setLanguage($lang='', $out_charset='') + { + $this->lang = new SpawLang($lang); + if ($out_charset != null && $out_charset != '') + $this->lang->setOutputCharset($out_charset); + } + + /** + * Editing area stylesheet + * @param string path to stylesheet file + */ + var $stylesheet; + + /** + * Sets editing area stylesheet + * @param string $filename path to stylesheet file + */ + function setStylesheet($filename) + { + $this->stylesheet = $filename; + } + + /** + * Pages collection + * @var array + */ + var $pages; + + /** + * Adds page + * @param SpawEditorPage page Page object + */ + function addPage($page) + { + $this->pages[$page->name] = $page; + } + + /** + * Returns page + * @param string $name Page name + * @returns SpawEditorPage + */ + function getPage($name) + { + if (!empty($this->pages[$name])) + return $this->pages[$name]; + else + return NULL; + } + + /** + * Holds currently active page + * @var SpawEditorPage + */ + var $active_page; + + /** + * Sets active page + * @param SpawEditorPage $page + */ + function setActivePage($page) + { + $this->active_page = $page; + } + + /** + * Returns active page + * @returns SpawEditorPage + */ + function getActivePage() + { + return $this->active_page; + } + + /** + * Floating toolbar mode flag + * @var bool + */ + var $floating_mode = false; + + /** + * Sets floating toolbar mode on or off + * @param bool $value Should floating mode be enabled + */ + function setFloatingMode($controlled_by = '', $value = true) + { + $this->floating_mode = $value; + if ($value) + $this->setToolbarFrom($controlled_by); + } + + /** + * Returs true if floating toolbar mode is enabled + * @returns bool + */ + function getFloatingMode() + { + return $this->floating_mode; + } + + /** + * Holds instance of another SpawEditor which controls floating toolbar used for this instance + * + * If empty, this is the "main" instance for floating toolbar + * @var SpawEditor + */ + var $toolbar_from; + + /** + * Sets variable holding instance of another SpawEditor which controls floating toolbar used for this instance + * @param SpawEditor $controlled_by + */ + function setToolbarFrom($controlled_by = '') + { + if ($controlled_by == '') + $controlled_by = $this; + $this->toolbar_from = $controlled_by; + } + + /** + * Returns instance of another SpawEditor which controls floating toolbar used for this instance + * @returns SpawEditor + */ + function getToolbarFrom() + { + if ($this->toolbar_from) + return $this->toolbar_from; + else + return $this; + } + + /** + * Holds value whether mode strip should be displayed or not + * @var bool + */ + var $is_mode_strip_visible = true; + /** + * Sets value indicating that mode strip should be shown + */ + function showModeStrip() + { + $this->is_mode_strip_visible = true; + } + /** + * Sets value indicating that mode strip shouldn't be shown + */ + function hideModeStrip() + { + $this->is_mode_strip_visible = false; + } + /** + * Returns value indicating whether mode strip should be shown or not + * @returns bool + */ + function isModeStripVisible() + { + return $this->is_mode_strip_visible; + } + + /** + * Holds value whether status bar should be displayed or not + * @var bool + */ + var $is_status_bar_visible = true; + /** + * Sets value indicating that status bar should be shown + */ + function showStatusBar() + { + $this->is_status_bar_visible = true; + } + /** + * Sets value indicating that status bar shouldn't be shown + */ + function hideStatusBar() + { + $this->is_status_bar_visible = false; + } + /** + * Returns value indicating whether status bar should be shown or not + * @returns bool + */ + function isStatusBarVisible() + { + return $this->is_status_bar_visible; + } + + /** + * Holds value whether resizing grip should be displayed or not + * @var bool + */ + var $is_resizable = true; + /** + * Sets value indicating that resizing grip should be shown + */ + function showResizingGrip() + { + $this->is_resizable = true; + } + /** + * Sets value indicating that resizing grip shouldn't be shown + */ + function hideResizingGrip() + { + $this->is_resizable = false; + } + /** + * Returns value indicating whether resizing grip should be shown or not + * @returns bool + */ + function isResizingGripVisible() + { + return $this->is_resizable; + } + + /** + * Set's instance config item + * @param string $name Config item's name + * @param mixed $value Config item's value + * @param integer $transfer_type Transfer type for the value (One or several of SPAW_CFG_TRANSFER_* constants). Default value - SPAW_CFG_TRANSFER_NONE + */ + function setConfigItem($name, $value, $transfer_type=SPAW_CFG_TRANSFER_NONE) + { + $this->config->setConfigItem($name, $value, $transfer_type); + } + + /** + * Gets instance config item + * @param string $name Config item name + * @returns SpawConfigItem + */ + function getConfigItem($name) + { + return $this->config->getConfigItem($name); + } + + /** + * Sets instance config item value + * @param string $name Config item name + * @param mixed $value Config item value + */ + function setConfigValue($name, $value) + { + $this->config->setConfigValue($name, $value); + } + + /** + * Sets instance value for the element of config item provided item's value is an array + * @param string $name Config item name + * @param mixed $index Array index + * @param mixed $value Element value + */ + function setConfigValueElement($name, $index, $value) + { + $this->config->setConfigValueElement($name, $index, $value); + } + + /** + * Gets instance config item value + * @param string $name Config item name + * @returns mixed Config item value + */ + function getConfigValue($name) + { + return $this->config->getConfigValue($name); + } + + /** + * Gets instance value for the element of config item provided item's value is an array + * @param string $name Config item name + * @param mixed $index Array index + * @returns mixed Element value + */ + function getConfigValueElement($name, $index) + { + return $this->config->getConfigValueElement($name, $index); + } + + /** + * Sets default property values if they were not explicitly specified + */ + function setDefaults() + { + if ($this->theme == null) + $this->setTheme($this->config->getConfigValue('default_theme')); + if ($this->toolbars == null) + $this->addToolbarSet($this->config->getConfigValue('default_toolbarset')); + if ($this->stylesheet == null) + $this->setStylesheet($this->config->getConfigValue('default_stylesheet')); + if ($this->width == null) + $this->setDimensions($this->config->getConfigValue('default_width'), null); + if ($this->height == null) + $this->setDimensions(null, $this->config->getConfigValue('default_height')); + if ($this->lang == null) + $this->setLanguage($this->config->getConfigValue('default_lang'), $this->config->getConfigValue('default_output_charset')); + } + + /** + * Returns HTML and JavaScript code for the editor + * @returns string + */ + function getHtml() + { + $res = ''; + $this->setDefaults(); + if (SpawAgent::getAgent() != SPAW_AGENT_UNSUPPORTED) + { + // supported browser + $head_res = ''; + $js_res = ''; + $html_res = ''; + $ssent = &SpawEditor::scriptSent(); + if (!$ssent) + { + $head_res .= '<script type="text/javascript" src="'.SpawConfig::getStaticConfigValue("SPAW_DIR").'js/spaw.js.php" charset="utf-8"></script>'; + $js_res .= 'SpawEngine.setSpawDir("'. SpawConfig::getStaticConfigValue("SPAW_DIR") . '");'; + $ssent = true; + } + $objname = $this->name.'_obj'; + $js_res .= 'var '.... [truncated message content] |
From: <se...@us...> - 2008-05-09 13:20:38
|
Revision: 109 http://acmcontester.svn.sourceforge.net/acmcontester/?rev=109&view=rev Author: sem62 Date: 2008-05-09 06:20:21 -0700 (Fri, 09 May 2008) Log Message: ----------- added confirm dialog to body onUnload event. Modified Paths: -------------- WebEditor/resources/HTMLedit.php WebEditor/src/edu/lnu/FireFly/WebEditor/AppletWithWYSIWYGEditor.java Modified: WebEditor/resources/HTMLedit.php =================================================================== --- WebEditor/resources/HTMLedit.php 2008-05-08 21:09:50 UTC (rev 108) +++ WebEditor/resources/HTMLedit.php 2008-05-09 13:20:21 UTC (rev 109) @@ -8,10 +8,19 @@ close(); return false; } + + function closing(){ + if (confirm('Course not saved. Do you want to save it now?') == true){ + save(); + } else { + opener.document.webeditor.cancelHtmlEditing(); + } + } </script> </head> -<body> + +<body onUnload="closing();"> <form name='editFrm' onSubmit='javascript:save();'> <? include("spaw2/spaw.inc.php"); @@ -26,7 +35,6 @@ var s = opener.document.webeditor.getEditedHTML(); document.getElementById("spaw_edit_field").value = s; - alert(s, false); </script> </body> Modified: WebEditor/src/edu/lnu/FireFly/WebEditor/AppletWithWYSIWYGEditor.java =================================================================== --- WebEditor/src/edu/lnu/FireFly/WebEditor/AppletWithWYSIWYGEditor.java 2008-05-08 21:09:50 UTC (rev 108) +++ WebEditor/src/edu/lnu/FireFly/WebEditor/AppletWithWYSIWYGEditor.java 2008-05-09 13:20:21 UTC (rev 109) @@ -15,20 +15,36 @@ Object[] params = new String[1]; params[0] = captionTextField2.getText(); - dlg.setModal(false); +// dlg.setModal(false); htmlEditing = true; textField = captionTextField2; editingDlg = dlg; - editingDlg.setEnabled(false); + lockPropertyDlg(); win.call("showEditor", params); + +// dlg.setModal(true); } public String getEditedHTML(){ return textField.getText(); } + public void cancelHtmlEditing(){ + unlockPropertyDlg(); + + textField = null; + editingDlg = null; + htmlEditing = false; + + System.out.println("Canceled html editing"); + } + + private void unlockPropertyDlg() { + editingDlg.setEnabled(true); + } + public void setEditedHTML(String newHTML){ if (!htmlEditing){ return; @@ -36,9 +52,13 @@ textField.setText(newHTML); htmlEditing = false; - editingDlg.setEnabled(true); + unlockPropertyDlg(); } + private void lockPropertyDlg() { + editingDlg.setEnabled(false); + } + /** * */ This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
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. |
From: <se...@us...> - 2008-05-09 19:36:03
|
Revision: 113 http://acmcontester.svn.sourceforge.net/acmcontester/?rev=113&view=rev Author: sem62 Date: 2008-05-09 12:36:00 -0700 (Fri, 09 May 2008) Log Message: ----------- fixed bug with confirm dialog in WYSIWYG editor Modified Paths: -------------- WebEditor/resources/HTMLedit.php WebEditor/template/LectureModel.conf Modified: WebEditor/resources/HTMLedit.php =================================================================== --- WebEditor/resources/HTMLedit.php 2008-05-09 18:43:59 UTC (rev 112) +++ WebEditor/resources/HTMLedit.php 2008-05-09 19:36:00 UTC (rev 113) @@ -2,18 +2,22 @@ <head> <script type="text/javascript"> + var saved = false; function save(){ var s=document.getElementById("spaw_edit_field").value; opener.document.webeditor.setEditedHTML(s); + saved=true; close(); return false; } function closing(){ - if (confirm('Course not saved. Do you want to save it now?') == true){ - save(); - } else { - opener.document.webeditor.cancelHtmlEditing(); + if (!saved){ + if (confirm('Course not saved. Do you want to save it now?') == true){ + save(); + } else { + opener.document.webeditor.cancelHtmlEditing(); + } } } Modified: WebEditor/template/LectureModel.conf =================================================================== --- WebEditor/template/LectureModel.conf 2008-05-09 18:43:59 UTC (rev 112) +++ WebEditor/template/LectureModel.conf 2008-05-09 19:36:00 UTC (rev 113) @@ -1,5 +1,5 @@ <?xml version = "1.0" ?> <LectureModel> - <caption>New caption</caption> + <caption>New lecture</caption> <content>New content.</content> </LectureModel> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <se...@us...> - 2008-05-10 13:18:45
|
Revision: 122 http://acmcontester.svn.sourceforge.net/acmcontester/?rev=122&view=rev Author: sem62 Date: 2008-05-10 06:18:47 -0700 (Sat, 10 May 2008) Log Message: ----------- * Added publish method to service. * Set defaults buttons at property dialogs. Modified Paths: -------------- WebEditor/src/edu/lnu/FireFly/WebEditor/GUI/Dialogs/LecturePropertiestsDlg.java WebEditor/src/edu/lnu/FireFly/WebEditor/GUI/Dialogs/SimpleQuestionPropertiestsDlg.java WebEditor/src/edu/lnu/FireFly/WebEditor/WSClients/WebEditorServiceClient.java WebEditor/src/edu/lnu/FireFly/WebEditor/WebEditor.java Added Paths: ----------- WebEditor/service/publishCourse.php Added: WebEditor/service/publishCourse.php =================================================================== --- WebEditor/service/publishCourse.php (rev 0) +++ WebEditor/service/publishCourse.php 2008-05-10 13:18:47 UTC (rev 122) @@ -0,0 +1,8 @@ +<? + require_once("config.inc.php"); + + if (isset($_POST['publish']) && $_POST['publish'] == "1"){ + echo "start publishing..."; + } + +?> \ No newline at end of file Modified: WebEditor/src/edu/lnu/FireFly/WebEditor/GUI/Dialogs/LecturePropertiestsDlg.java =================================================================== --- WebEditor/src/edu/lnu/FireFly/WebEditor/GUI/Dialogs/LecturePropertiestsDlg.java 2008-05-10 13:03:46 UTC (rev 121) +++ WebEditor/src/edu/lnu/FireFly/WebEditor/GUI/Dialogs/LecturePropertiestsDlg.java 2008-05-10 13:18:47 UTC (rev 122) @@ -289,6 +289,7 @@ 20, 20, 20)) .addContainerGap())); + this.getRootPane().setDefaultButton(okButton); pack(); } Modified: WebEditor/src/edu/lnu/FireFly/WebEditor/GUI/Dialogs/SimpleQuestionPropertiestsDlg.java =================================================================== --- WebEditor/src/edu/lnu/FireFly/WebEditor/GUI/Dialogs/SimpleQuestionPropertiestsDlg.java 2008-05-10 13:03:46 UTC (rev 121) +++ WebEditor/src/edu/lnu/FireFly/WebEditor/GUI/Dialogs/SimpleQuestionPropertiestsDlg.java 2008-05-10 13:18:47 UTC (rev 122) @@ -341,6 +341,8 @@ javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))); + this.getRootPane().setDefaultButton(okButton); + pack(); } Modified: WebEditor/src/edu/lnu/FireFly/WebEditor/WSClients/WebEditorServiceClient.java =================================================================== --- WebEditor/src/edu/lnu/FireFly/WebEditor/WSClients/WebEditorServiceClient.java 2008-05-10 13:03:46 UTC (rev 121) +++ WebEditor/src/edu/lnu/FireFly/WebEditor/WSClients/WebEditorServiceClient.java 2008-05-10 13:18:47 UTC (rev 122) @@ -110,13 +110,6 @@ return result; } - /** - * @param fName - * File name - * @param location - * Location name = template | course - * @return - */ public boolean deleteFile(String fName) { System.out.println("Deleting file (fName=" + fName + ")..."); @@ -139,6 +132,28 @@ return true; } + public boolean publish() { + System.out.println("Publishing course ..."); + + // Construct data + String data; + try { + data = URLEncoder.encode("publish", "UTF-8") + "=" + + URLEncoder.encode("1", "UTF-8"); + + } catch (UnsupportedEncodingException e) { + e.printStackTrace(); + return false; + } + + String result = getResponse(data, "publishCourse.php"); + + System.out.println("deleting result: " + result); + + lastCommunicationTime = System.currentTimeMillis(); + return true; + } + private String getResponse(String data, String action) { String result = ""; try { Modified: WebEditor/src/edu/lnu/FireFly/WebEditor/WebEditor.java =================================================================== --- WebEditor/src/edu/lnu/FireFly/WebEditor/WebEditor.java 2008-05-10 13:03:46 UTC (rev 121) +++ WebEditor/src/edu/lnu/FireFly/WebEditor/WebEditor.java 2008-05-10 13:18:47 UTC (rev 122) @@ -53,6 +53,8 @@ private AutoSaveThread autoSaveThread; + private JMenuItem publishMenuItem; + @Override public void actionPerformed(ActionEvent arg0) { try { @@ -60,6 +62,10 @@ openManifest(); } + if (arg0.getSource() == publishMenuItem) { + WebEditorServiceClient.getInstance().publish(); + } + if (arg0.getSource() == saveMenuItem) { saveManifest(); } @@ -182,6 +188,11 @@ saveMenuItem.addActionListener(this); menu.add(saveMenuItem); + // Create a menu item + publishMenuItem = new JMenuItem("Publish"); + publishMenuItem.addActionListener(this); + menu.add(publishMenuItem); + // Install the menu bar in the frame this.setJMenuBar(menuBar); } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <se...@us...> - 2008-05-10 20:48:33
|
Revision: 126 http://acmcontester.svn.sourceforge.net/acmcontester/?rev=126&view=rev Author: sem62 Date: 2008-05-10 13:48:29 -0700 (Sat, 10 May 2008) Log Message: ----------- * configured spaw2 to using resource directory in course. * fixed templates * added code for updating summary pages after removing items Modified Paths: -------------- WebEditor/resources/HTMLedit.php WebEditor/src/edu/lnu/FireFly/WebEditor/ItemModels/Chapter/ChapterModel.java WebEditor/src/edu/lnu/FireFly/WebEditor/ItemModels/ResourcedItemModel.java WebEditor/src/edu/lnu/FireFly/WebEditor/ItemModels/SimpleQuestion/SimpleQuestionModel.java WebEditor/template/LectureModel.conf WebEditor/template/SimpleQuestionModel.conf Added Paths: ----------- WebEditor/template/resources/ Modified: WebEditor/resources/HTMLedit.php =================================================================== --- WebEditor/resources/HTMLedit.php 2008-05-10 17:33:34 UTC (rev 125) +++ WebEditor/resources/HTMLedit.php 2008-05-10 20:48:29 UTC (rev 126) @@ -10,7 +10,7 @@ close(); return false; } - + function closing(){ if (!saved){ if (confirm('Course not saved. Do you want to save it now?') == true){ @@ -27,10 +27,11 @@ <body onUnload="closing();"> <form name='editFrm' onSubmit='javascript:save();'> <? -include("spaw2/spaw.inc.php"); +include("spaw2/spaw.inc.php"); -$spaw = new SpawEditor('spaw_edit_field', "123"); -$spaw->show(); +$spaw = new SpawEditor('spaw_edit_field', ""); + +$spaw->show(); ?> <input type='submit' value='save' onClick='javascript:save();'> Modified: WebEditor/src/edu/lnu/FireFly/WebEditor/ItemModels/Chapter/ChapterModel.java =================================================================== --- WebEditor/src/edu/lnu/FireFly/WebEditor/ItemModels/Chapter/ChapterModel.java 2008-05-10 17:33:34 UTC (rev 125) +++ WebEditor/src/edu/lnu/FireFly/WebEditor/ItemModels/Chapter/ChapterModel.java 2008-05-10 20:48:29 UTC (rev 126) @@ -2,6 +2,7 @@ import edu.lnu.FireFly.FFManifest.TreeItem; import edu.lnu.FireFly.FFManifest.item.Item; +import edu.lnu.FireFly.WebEditor.Data.SummaryPageManager; import edu.lnu.FireFly.WebEditor.GUI.TreeDataModel; import edu.lnu.FireFly.WebEditor.GUI.Dialogs.ChapterPropertiestsDlg; import edu.lnu.FireFly.WebEditor.ItemModels.ItemData; @@ -124,6 +125,7 @@ aChapter.getParent().removeChild(aChapter); WebEditorServiceClient.getInstance().deleteFile(getConfFileName(aChapter)); + SummaryPageManager.getInstance().updateSummaryPages(); } /** Modified: WebEditor/src/edu/lnu/FireFly/WebEditor/ItemModels/ResourcedItemModel.java =================================================================== --- WebEditor/src/edu/lnu/FireFly/WebEditor/ItemModels/ResourcedItemModel.java 2008-05-10 17:33:34 UTC (rev 125) +++ WebEditor/src/edu/lnu/FireFly/WebEditor/ItemModels/ResourcedItemModel.java 2008-05-10 20:48:29 UTC (rev 126) @@ -97,6 +97,8 @@ WebEditorServiceClient.getInstance().deleteFile(getConfFileName(anItem)); manifest.resources.deleteResource(identifier); + + SummaryPageManager.getInstance().updateSummaryPages(); } } Modified: WebEditor/src/edu/lnu/FireFly/WebEditor/ItemModels/SimpleQuestion/SimpleQuestionModel.java =================================================================== --- WebEditor/src/edu/lnu/FireFly/WebEditor/ItemModels/SimpleQuestion/SimpleQuestionModel.java 2008-05-10 17:33:34 UTC (rev 125) +++ WebEditor/src/edu/lnu/FireFly/WebEditor/ItemModels/SimpleQuestion/SimpleQuestionModel.java 2008-05-10 20:48:29 UTC (rev 126) @@ -78,12 +78,6 @@ } @Override - public void remove(TreeItem item) { - TreeDataModel.getInstance().treeNodesDeleted(item); - item.getParent().removeChild(item); - } - - @Override public void rename(TreeItem item, String newTitle) { ((Item) item).title = newTitle; TreeDataModel.getInstance().treeNodesChanged(item); Modified: WebEditor/template/LectureModel.conf =================================================================== --- WebEditor/template/LectureModel.conf 2008-05-10 17:33:34 UTC (rev 125) +++ WebEditor/template/LectureModel.conf 2008-05-10 20:48:29 UTC (rev 126) @@ -1,5 +1,2 @@ -<?xml version = "1.0" ?> -<LectureModel> - <caption>New lecture</caption> - <content>New content.</content> -</LectureModel> +<?xml version="1.0" encoding="UTF-8"?> +<LectureData><caption>New lecture</caption><content>New content.</content><ShowOnSummaryPage>false</ShowOnSummaryPage></LectureData> \ No newline at end of file Modified: WebEditor/template/SimpleQuestionModel.conf =================================================================== --- WebEditor/template/SimpleQuestionModel.conf 2008-05-10 17:33:34 UTC (rev 125) +++ WebEditor/template/SimpleQuestionModel.conf 2008-05-10 20:48:29 UTC (rev 126) @@ -1,9 +1,10 @@ -<?xml version = "1.0" ?> -<SimpleQuestionModel> - <caption>New caption</caption> - <question>Answer "Yes" to question, please.</question> - <answers singleVariant="false"> - <answer point="0">Yes</answer> - <answer point="1">No</answer> - </answers> -</SimpleQuestionModel> +<?xml version="1.0" encoding="UTF-8"?> +<SimpleQuestion> +<caption>New caption</caption> +<question>Answer "Yes" to question, please.</question> +<ShowOnSummaryPage>true</ShowOnSummaryPage> +<answers singleVariant="false"> +<answer point="0.0">Yes</answer> +<answer point="1.0">No</answer> +</answers> +</SimpleQuestion> \ No newline at end of file This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <se...@us...> - 2008-05-10 21:00:24
|
Revision: 127 http://acmcontester.svn.sourceforge.net/acmcontester/?rev=127&view=rev Author: sem62 Date: 2008-05-10 14:00:12 -0700 (Sat, 10 May 2008) Log Message: ----------- fixed bug with "same as title" at SimpleQuestion property dialog. Modified Paths: -------------- WebEditor/src/edu/lnu/FireFly/WebEditor/GUI/Dialogs/SimpleQuestionPropertiestsDlg.java WebEditor/template/SimpleQuestionModel.conf Modified: WebEditor/src/edu/lnu/FireFly/WebEditor/GUI/Dialogs/SimpleQuestionPropertiestsDlg.java =================================================================== --- WebEditor/src/edu/lnu/FireFly/WebEditor/GUI/Dialogs/SimpleQuestionPropertiestsDlg.java 2008-05-10 20:48:29 UTC (rev 126) +++ WebEditor/src/edu/lnu/FireFly/WebEditor/GUI/Dialogs/SimpleQuestionPropertiestsDlg.java 2008-05-10 21:00:12 UTC (rev 127) @@ -9,6 +9,7 @@ import javax.swing.table.DefaultTableColumnModel; import edu.lnu.FireFly.WebEditor.ItemModels.SimpleQuestion.SimpleQuestionAnswersDataModel; +import edu.lnu.FireFly.WebEditor.ItemModels.SimpleQuestion.SimpleQuestionData; import edu.lnu.FireFly.WebEditor.ItemModels.SimpleQuestion.SimpleQuestionModel; /** @@ -445,12 +446,17 @@ manifestItem.setTitle(titleTextField.getText()); - itemModel.getData(manifestItem).setCaption(captionTextField.getText()); + SimpleQuestionData data = itemModel.getData(manifestItem); - itemModel.getData(manifestItem) - .setQuestion(questionTextField.getText()); + if (sameAsTitleCheckBox.isSelected()){ + data.setCaption(titleTextField.getText()); + } else { + data.setCaption(captionTextField.getText()); + } - itemModel.getData(manifestItem).setAnswers( + data.setQuestion(questionTextField.getText()); + + data.setAnswers( simpleQuestionAnswersDataModel); itemModel.updateItemResource(manifestItem, true); Modified: WebEditor/template/SimpleQuestionModel.conf =================================================================== --- WebEditor/template/SimpleQuestionModel.conf 2008-05-10 20:48:29 UTC (rev 126) +++ WebEditor/template/SimpleQuestionModel.conf 2008-05-10 21:00:12 UTC (rev 127) @@ -1,6 +1,6 @@ <?xml version="1.0" encoding="UTF-8"?> <SimpleQuestion> -<caption>New caption</caption> +<caption>New simple question</caption> <question>Answer "Yes" to question, please.</question> <ShowOnSummaryPage>true</ShowOnSummaryPage> <answers singleVariant="false"> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
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. |
From: <se...@us...> - 2008-05-14 18:05:29
|
Revision: 137 http://acmcontester.svn.sourceforge.net/acmcontester/?rev=137&view=rev Author: sem62 Date: 2008-05-14 11:01:48 -0700 (Wed, 14 May 2008) Log Message: ----------- Added deleting, inserting and moving answer variant in SimpleQ model Modified Paths: -------------- WebEditor/src/edu/lnu/FireFly/WebEditor/GUI/Dialogs/SimpleQuestionPropertiestsDlg.java WebEditor/src/edu/lnu/FireFly/WebEditor/ItemModels/SimpleQuestion/SimpleQuestionAnswersDataModel.java WebEditor/template/global/SummaryPage.js Modified: WebEditor/src/edu/lnu/FireFly/WebEditor/GUI/Dialogs/SimpleQuestionPropertiestsDlg.java =================================================================== --- WebEditor/src/edu/lnu/FireFly/WebEditor/GUI/Dialogs/SimpleQuestionPropertiestsDlg.java 2008-05-13 19:33:14 UTC (rev 136) +++ WebEditor/src/edu/lnu/FireFly/WebEditor/GUI/Dialogs/SimpleQuestionPropertiestsDlg.java 2008-05-14 18:01:48 UTC (rev 137) @@ -4,6 +4,7 @@ import java.awt.event.ActionListener; import javax.swing.JButton; +import javax.swing.ListSelectionModel; import javax.swing.event.ChangeEvent; import javax.swing.event.ChangeListener; import javax.swing.table.DefaultTableColumnModel; @@ -36,6 +37,10 @@ private javax.swing.JButton editCaptionInHtmlBtn; private javax.swing.JButton editQuestionInHtmlBtn; private javax.swing.JButton editAnswerVariantInHtmlEditor; + private javax.swing.JButton insertAnswerVariantBtn; + private javax.swing.JButton deleteAnswerVariantBtn; + private javax.swing.JButton moveUpAnswerVariantBtn; + private javax.swing.JButton moveDownAnswerVariantBtn; private SimpleQuestionAnswersDataModel simpleQuestionAnswersDataModel; private javax.swing.JTextField currentAnswerVariant; @@ -57,20 +62,72 @@ if (arg0.getSource() == editCaptionInHtmlBtn) { editTextFieldInHtmlEditor(captionTextField); } - + if (arg0.getSource() == editAnswerVariantInHtmlEditor) { int selectedRow = answersTable.getSelectedRow(); - - if (selectedRow < 0){ + + if (selectedRow < 0) { return; } - - String text = answersTable.getModel().getValueAt(selectedRow, 1).toString(); - + + String text = answersTable.getModel().getValueAt(selectedRow, 1) + .toString(); + currentAnswerVariant.setText(text); editTextFieldInHtmlEditor(currentAnswerVariant); } + + if (arg0.getSource() == insertAnswerVariantBtn) { + int selectedRow = answersTable.getSelectedRow(); + + if (selectedRow < 0) { + return; + } + + simpleQuestionAnswersDataModel.insertRow(selectedRow); + answersTable.getSelectionModel().setSelectionInterval(selectedRow + 1, selectedRow + 1); + } + + if (arg0.getSource() == deleteAnswerVariantBtn) { + int selectedRow = answersTable.getSelectedRow(); + + if (selectedRow < 0) { + return; + } + + simpleQuestionAnswersDataModel.deleteRow(selectedRow); + + if (selectedRow >= simpleQuestionAnswersDataModel.getRowCount()){ + selectedRow--; + } + + answersTable.getSelectionModel().setSelectionInterval(selectedRow, + selectedRow); + } + if (arg0.getSource() == moveUpAnswerVariantBtn) { + int selectedRow = answersTable.getSelectedRow(); + + if (selectedRow < 0) { + return; + } + + if (simpleQuestionAnswersDataModel.moveUp(selectedRow)){ + answersTable.getSelectionModel().setSelectionInterval(selectedRow - 1, selectedRow - 1); + } + } + + if (arg0.getSource() == moveDownAnswerVariantBtn) { + int selectedRow = answersTable.getSelectedRow(); + + if (selectedRow < 0) { + return; + } + + if (simpleQuestionAnswersDataModel.moveDown(selectedRow)){ + answersTable.getSelectionModel().setSelectionInterval(selectedRow + 1, selectedRow+1); + } + } } @Override @@ -91,18 +148,19 @@ .getAnswers(); dlg.answersTable.setModel(dlg.simpleQuestionAnswersDataModel); - DefaultTableColumnModel columnModel = (DefaultTableColumnModel)dlg.answersTable.getColumnModel(); + DefaultTableColumnModel columnModel = (DefaultTableColumnModel) dlg.answersTable + .getColumnModel(); columnModel.getColumn(0).setPreferredWidth(1); columnModel.getColumn(1).setPreferredWidth(300); columnModel.getColumn(2).setPreferredWidth(1); - + dlg.titleTextField.selectAll(); } @Override public void editedHtmlTextWasSet() { super.editedHtmlTextWasSet(); - + String text = currentAnswerVariant.getText(); int selectedRow = answersTable.getSelectedRow(); answersTable.getModel().setValueAt(text, selectedRow, 1); @@ -110,7 +168,7 @@ private void initComponents() { setTitle("Propertiests..."); - + generalPanel = new javax.swing.JPanel(); titleLabel = new javax.swing.JLabel(); titleTextField = new javax.swing.JTextField(); @@ -127,7 +185,17 @@ editCaptionInHtmlBtn = new JButton("..."); editQuestionInHtmlBtn = new JButton("..."); editAnswerVariantInHtmlEditor = new JButton("HTML Editor"); + insertAnswerVariantBtn = new JButton("Insert"); + deleteAnswerVariantBtn = new JButton("Delete"); + moveDownAnswerVariantBtn = new JButton("Down"); + moveUpAnswerVariantBtn = new JButton("Up"); + + insertAnswerVariantBtn.addActionListener(this); + deleteAnswerVariantBtn.addActionListener(this); + moveDownAnswerVariantBtn.addActionListener(this); + moveUpAnswerVariantBtn.addActionListener(this); + currentAnswerVariant = new javax.swing.JTextField(); captionTextField.addActionListener(this); @@ -138,8 +206,9 @@ editCaptionInHtmlBtn.addActionListener(this); editQuestionInHtmlBtn.addActionListener(this); editAnswerVariantInHtmlEditor.addActionListener(this); - + answersTable = new javax.swing.JTable(); + answersTable.setSelectionMode(ListSelectionModel.SINGLE_SELECTION); setDefaultCloseOperation(javax.swing.WindowConstants.HIDE_ON_CLOSE); @@ -318,31 +387,57 @@ answersPanel); answersPanel.setLayout(jPanel4Layout); jPanel4Layout.setHorizontalGroup(jPanel4Layout.createParallelGroup( - javax.swing.GroupLayout.Alignment.TRAILING) - .addGroup( - jPanel4Layout.createSequentialGroup() - .addComponent(editAnswerVariantInHtmlEditor) - .addContainerGap() - ) - .addGroup( + javax.swing.GroupLayout.Alignment.TRAILING).addGroup( jPanel4Layout.createSequentialGroup() - .addContainerGap() + .addComponent(moveUpAnswerVariantBtn) + .addContainerGap(10, 10) + .addComponent(moveDownAnswerVariantBtn) + .addContainerGap(10, 10) + .addComponent(insertAnswerVariantBtn) + .addContainerGap(10, 10) + .addComponent(deleteAnswerVariantBtn) + .addContainerGap(10, 10) + .addComponent( + editAnswerVariantInHtmlEditor) + .addContainerGap()).addGroup( + jPanel4Layout.createSequentialGroup().addContainerGap() .addComponent(jScrollPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 364, - Short.MAX_VALUE) - .addContainerGap() - )); + Short.MAX_VALUE).addContainerGap())); - jPanel4Layout.setVerticalGroup(jPanel4Layout.createParallelGroup( - javax.swing.GroupLayout.Alignment.LEADING).addGroup( - jPanel4Layout.createSequentialGroup().addContainerGap() - .addComponent(jScrollPane1, - javax.swing.GroupLayout.DEFAULT_SIZE, 111, - Short.MAX_VALUE) - .addContainerGap(10, 10) - .addComponent(editAnswerVariantInHtmlEditor, 20, 20, 20) - .addContainerGap() - )); + jPanel4Layout + .setVerticalGroup(jPanel4Layout + .createParallelGroup( + javax.swing.GroupLayout.Alignment.LEADING) + .addGroup( + jPanel4Layout + .createSequentialGroup() + .addContainerGap() + .addComponent( + jScrollPane1, + javax.swing.GroupLayout.DEFAULT_SIZE, + 111, Short.MAX_VALUE) + .addContainerGap(10, 10) + .addGroup( + jPanel4Layout + .createParallelGroup( + javax.swing.GroupLayout.Alignment.BASELINE) + .addComponent( + moveUpAnswerVariantBtn, + 20, 20, 20) + .addComponent( + moveDownAnswerVariantBtn, + 20, 20, 20) + .addComponent( + insertAnswerVariantBtn, + 20, 20, 20) + .addComponent( + deleteAnswerVariantBtn, + 20, 20, 20) + .addComponent( + editAnswerVariantInHtmlEditor, + 20, 20, 20)) + .addContainerGap())); javax.swing.GroupLayout layout = new javax.swing.GroupLayout( getContentPane()); @@ -431,8 +526,10 @@ .createParallelGroup( javax.swing.GroupLayout.Alignment.BASELINE) .addComponent( - cancelButton) - .addComponent(okButton)) + cancelButton, + 20, 20, 20) + .addComponent(okButton, + 20, 20, 20)) .addContainerGap( javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))); @@ -450,7 +547,7 @@ SimpleQuestionData data = itemModel.getData(manifestItem); - if (sameAsTitleCheckBox.isSelected()){ + if (sameAsTitleCheckBox.isSelected()) { data.setCaption(titleTextField.getText()); } else { data.setCaption(captionTextField.getText()); @@ -458,8 +555,7 @@ data.setQuestion(questionTextField.getText()); - data.setAnswers( - simpleQuestionAnswersDataModel); + data.setAnswers(simpleQuestionAnswersDataModel); itemModel.updateItemResource(manifestItem, true); } Modified: WebEditor/src/edu/lnu/FireFly/WebEditor/ItemModels/SimpleQuestion/SimpleQuestionAnswersDataModel.java =================================================================== --- WebEditor/src/edu/lnu/FireFly/WebEditor/ItemModels/SimpleQuestion/SimpleQuestionAnswersDataModel.java 2008-05-13 19:33:14 UTC (rev 136) +++ WebEditor/src/edu/lnu/FireFly/WebEditor/ItemModels/SimpleQuestion/SimpleQuestionAnswersDataModel.java 2008-05-14 18:01:48 UTC (rev 137) @@ -1,24 +1,21 @@ package edu.lnu.FireFly.WebEditor.ItemModels.SimpleQuestion; import java.util.ArrayList; +import java.util.List; -import javax.swing.event.TableModelEvent; -import javax.swing.event.TableModelListener; -import javax.swing.table.TableModel; +import javax.swing.table.DefaultTableModel; +public class SimpleQuestionAnswersDataModel extends DefaultTableModel { + /** + * + */ + private static final long serialVersionUID = 1L; -public class SimpleQuestionAnswersDataModel implements TableModel { private boolean singleVariant = false; - public ArrayList<SimpleQuestionAnswer> answers = new ArrayList<SimpleQuestionAnswer>(); - private ArrayList<TableModelListener> listeners = new ArrayList<TableModelListener>(); + public List<SimpleQuestionAnswer> answers = new ArrayList<SimpleQuestionAnswer>(); @Override - public void addTableModelListener(TableModelListener arg0) { - listeners.add(arg0); - } - - @Override public Class<?> getColumnClass(int arg0) { return Object.class; } @@ -42,7 +39,16 @@ @Override public int getRowCount() { - return answers.size() + 1; + + if (answers == null) { + return 0; + } + + int answersCount = answers.size(); + + + + return answersCount > 0 ? answersCount : 1; } @Override @@ -72,11 +78,6 @@ return singleVariant; } - @Override - public void removeTableModelListener(TableModelListener arg0) { - listeners.remove(arg0); - } - public void setSingleVariant(boolean singleVariant) { this.singleVariant = singleVariant; } @@ -107,10 +108,51 @@ } break; } + + fireTableRowsUpdated(arg1, arg1); + } + + public void deleteRow(int selectedRow) { + if (selectedRow < answers.size() && selectedRow >= 0) { + answers.remove(selectedRow); + fireTableRowsDeleted(selectedRow, selectedRow); + } + } + + public void insertRow(int selectedRow) { + if (selectedRow >= answers.size()){ + selectedRow--; + } - for (int i=0; i < listeners.size(); i++){ - TableModelEvent event = new TableModelEvent(this, arg1, arg1, arg2); - listeners.get(i).tableChanged(event); + answers.add(selectedRow + 1, new SimpleQuestionAnswer("")); + fireTableRowsInserted(selectedRow + 1, selectedRow + 1); + } + + public boolean moveUp(int selectedRow) { + if (selectedRow < 1 || selectedRow >= answers.size()){ + return false; } + + SimpleQuestionAnswer answer = answers.get(selectedRow); + answers.set(selectedRow, answers.get(selectedRow - 1)); + answers.set(selectedRow - 1, answer); + + fireTableRowsUpdated(selectedRow - 1, selectedRow); + + return true; } + + public boolean moveDown(int selectedRow) { + if (selectedRow < 0 || selectedRow >= answers.size() - 1){ + return false; + } + + SimpleQuestionAnswer answer = answers.get(selectedRow); + answers.set(selectedRow, answers.get(selectedRow + 1)); + answers.set(selectedRow + 1, answer); + + fireTableRowsUpdated(selectedRow + 1, selectedRow); + + return true; + } } Modified: WebEditor/template/global/SummaryPage.js =================================================================== --- WebEditor/template/global/SummaryPage.js 2008-05-13 19:33:14 UTC (rev 136) +++ WebEditor/template/global/SummaryPage.js 2008-05-14 18:01:48 UTC (rev 137) @@ -101,10 +101,10 @@ function write(completionStatus, title, min, max, raw, modelName){ rowNum++; - var percents = "0"; + var percents = "0 %"; if ((parseInt(min) || min == 0) && (parseInt(max) || max == 0) && (parseInt(raw) || raw == 0)){ if (max == min){ - percents = "? %"; + percents = "0 %"; } else { percents = 100 * (raw - min) / (max - min) + " %"; } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <se...@us...> - 2008-05-18 15:27:56
|
Revision: 144 http://acmcontester.svn.sourceforge.net/acmcontester/?rev=144&view=rev Author: sem62 Date: 2008-05-18 08:27:58 -0700 (Sun, 18 May 2008) Log Message: ----------- deleted unnecessary files Removed Paths: ------------- WebEditor/resources/spaw2/uploads/files/180px-UniwersytetJanaKazimierzaLw?\208?\147_w1.jpg WebEditor/resources/spaw2/uploads/files/banner.GIF Property Changed: ---------------- WebEditor/ Property changes on: WebEditor ___________________________________________________________________ Name: svn:ignore - *.classpath *.project + *.classpath *.project .settings Deleted: WebEditor/resources/spaw2/uploads/files/180px-UniwersytetJanaKazimierzaLw?\208?\147_w1.jpg =================================================================== (Binary files differ) Deleted: WebEditor/resources/spaw2/uploads/files/banner.GIF =================================================================== (Binary files differ) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <se...@us...> - 2008-05-18 17:35:24
|
Revision: 145 http://acmcontester.svn.sourceforge.net/acmcontester/?rev=145&view=rev Author: sem62 Date: 2008-05-18 10:35:26 -0700 (Sun, 18 May 2008) Log Message: ----------- Normally marshal and unmarshal compileQ propertiests. Modified Paths: -------------- WebEditor/src/edu/lnu/FireFly/WebEditor/GUI/Dialogs/CompileQ/CompileQPropertiestsDlg.java WebEditor/src/edu/lnu/FireFly/WebEditor/ItemModels/CompileQ/CompileQData.java WebEditor/src/edu/lnu/FireFly/WebEditor/ItemModels/CompileQ/CompileQPart.java WebEditor/template/CompileQModel.conf Modified: WebEditor/src/edu/lnu/FireFly/WebEditor/GUI/Dialogs/CompileQ/CompileQPropertiestsDlg.java =================================================================== --- WebEditor/src/edu/lnu/FireFly/WebEditor/GUI/Dialogs/CompileQ/CompileQPropertiestsDlg.java 2008-05-18 15:27:58 UTC (rev 144) +++ WebEditor/src/edu/lnu/FireFly/WebEditor/GUI/Dialogs/CompileQ/CompileQPropertiestsDlg.java 2008-05-18 17:35:26 UTC (rev 145) @@ -173,16 +173,19 @@ CompileQModel itemModel = new CompileQModel(); - // dlg.captionTextField.setText(itemModel.getData(manifestItem) - // .getCaption()); + dlg.captionTextField.setText(itemModel.getData(manifestItem) + .getCaption()); + dlg.sameAsTitleCheckBox.setSelected(dlg.titleTextField.getText() .equals(dlg.captionTextField.getText())); dlg.compileQTableDataModel = itemModel.getData(manifestItem).getParts(); - + dlg.programmingLanguage.addItem("Any"); dlg.programmingLanguage.addItem("C++"); dlg.programmingLanguage.addItem("Pascal"); + + dlg.programmingLanguage.setSelectedItem(itemModel.getData(manifestItem).getLanguge()); dlg.partsTable.setModel(dlg.compileQTableDataModel); @@ -219,7 +222,8 @@ generalPanel = new javax.swing.JPanel(); titleLabel = new javax.swing.JLabel(); - programminglanguageLabel = new javax.swing.JLabel("Programming language:"); + programminglanguageLabel = new javax.swing.JLabel( + "Programming language:"); titleTextField = new javax.swing.JTextField(); captionPanel = new javax.swing.JPanel(); captionTextField = new javax.swing.JTextField(); @@ -356,8 +360,7 @@ captionTextField, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, - javax.swing.GroupLayout.PREFERRED_SIZE - )) + javax.swing.GroupLayout.PREFERRED_SIZE)) .addContainerGap())); oneAnswerCheckBox.setText("Only one correct answer"); @@ -366,47 +369,36 @@ .createTitledBorder("Variants of answer")); jScrollPane1.setViewportView(partsTable); - jScrollPane1.setVerticalScrollBarPolicy(ScrollPaneConstants.VERTICAL_SCROLLBAR_ALWAYS); + jScrollPane1 + .setVerticalScrollBarPolicy(ScrollPaneConstants.VERTICAL_SCROLLBAR_ALWAYS); javax.swing.GroupLayout jPanel4Layout = new javax.swing.GroupLayout( partsPanel); partsPanel.setLayout(jPanel4Layout); - jPanel4Layout.setHorizontalGroup( - jPanel4Layout - .createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING) - .addGroup(jPanel4Layout.createSequentialGroup() - .addComponent(moveUpAnswerVariantBtn) - .addContainerGap(10, 10) - .addComponent(moveDownAnswerVariantBtn) - .addContainerGap(10, 10) - .addComponent(insertAnswerVariantBtn) - .addContainerGap(10, 10) - .addComponent(deleteAnswerVariantBtn) - .addContainerGap(10, 10) - .addComponent(editAnswerVariantInHtmlEditor) - .addContainerGap() - ) - .addGroup( - jPanel4Layout.createSequentialGroup().addContainerGap() - .addComponent(jScrollPane1, - javax.swing.GroupLayout.DEFAULT_SIZE, 364, - Short.MAX_VALUE) - .addContainerGap() - ) - .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, - jPanel4Layout - .createSequentialGroup() - .addContainerGap() - .addComponent(programminglanguageLabel, - javax.swing.GroupLayout.PREFERRED_SIZE, - javax.swing.GroupLayout.DEFAULT_SIZE, - javax.swing.GroupLayout.PREFERRED_SIZE - ) - .addContainerGap(10, 10) - .addComponent(programmingLanguage, 118, 118, 118) - .addContainerGap() - ) - ); + jPanel4Layout.setHorizontalGroup(jPanel4Layout.createParallelGroup( + javax.swing.GroupLayout.Alignment.TRAILING).addGroup( + jPanel4Layout.createSequentialGroup().addComponent( + moveUpAnswerVariantBtn).addContainerGap(10, 10) + .addComponent(moveDownAnswerVariantBtn) + .addContainerGap(10, 10).addComponent( + insertAnswerVariantBtn).addContainerGap(10, 10) + .addComponent(deleteAnswerVariantBtn).addContainerGap( + 10, 10).addComponent( + editAnswerVariantInHtmlEditor) + .addContainerGap()).addGroup( + jPanel4Layout.createSequentialGroup().addContainerGap() + .addComponent(jScrollPane1, + javax.swing.GroupLayout.DEFAULT_SIZE, 364, + Short.MAX_VALUE).addContainerGap()).addGroup( + javax.swing.GroupLayout.Alignment.TRAILING, + jPanel4Layout.createSequentialGroup().addContainerGap() + .addComponent(programminglanguageLabel, + javax.swing.GroupLayout.PREFERRED_SIZE, + javax.swing.GroupLayout.DEFAULT_SIZE, + javax.swing.GroupLayout.PREFERRED_SIZE) + .addContainerGap(10, 10).addComponent( + programmingLanguage, 118, 118, 118) + .addContainerGap())); jPanel4Layout .setVerticalGroup(jPanel4Layout @@ -420,16 +412,20 @@ jPanel4Layout .createParallelGroup( javax.swing.GroupLayout.Alignment.BASELINE) - .addGroup( - jPanel4Layout - .createParallelGroup( - javax.swing.GroupLayout.Alignment.BASELINE) - .addComponent(programminglanguageLabel, - 20, 20, 20) - .addComponent(programmingLanguage, - 20, 20, 20) - ) - ) + .addGroup( + jPanel4Layout + .createParallelGroup( + javax.swing.GroupLayout.Alignment.BASELINE) + .addComponent( + programminglanguageLabel, + 20, + 20, + 20) + .addComponent( + programmingLanguage, + 20, + 20, + 20))) .addContainerGap(10, 10) .addComponent( jScrollPane1, @@ -558,6 +554,7 @@ } data.setParts(compileQTableDataModel); + data.setLanguge(programmingLanguage.getSelectedItem().toString()); itemModel.updateItemResource(manifestItem, true); } Modified: WebEditor/src/edu/lnu/FireFly/WebEditor/ItemModels/CompileQ/CompileQData.java =================================================================== --- WebEditor/src/edu/lnu/FireFly/WebEditor/ItemModels/CompileQ/CompileQData.java 2008-05-18 15:27:58 UTC (rev 144) +++ WebEditor/src/edu/lnu/FireFly/WebEditor/ItemModels/CompileQ/CompileQData.java 2008-05-18 17:35:26 UTC (rev 145) @@ -1,44 +1,47 @@ package edu.lnu.FireFly.WebEditor.ItemModels.CompileQ; import java.io.Reader; +import java.util.Iterator; +import org.dom4j.Document; +import org.dom4j.DocumentHelper; +import org.dom4j.Element; +import org.dom4j.io.SAXReader; + import edu.lnu.FireFly.FFManifest.TreeItem; import edu.lnu.FireFly.WebEditor.ItemModels.ItemData; public class CompileQData extends ItemData { @Override public String marshal(TreeItem anItem) { - return ""; + Document doc = DocumentHelper.createDocument(); + Element root = doc.addElement("CompileQuestion"); + root.addElement("caption").setText(getCaption()); - // Document doc = DocumentHelper.createDocument(); -// Element root = doc.addElement("SimpleQuestion"); -// root.addElement("caption").setText(getCaption()); -// root.addElement("question").setText(getQuestion()); -// -// root.addElement("ShowOnSummaryPage").setText( -// String.valueOf(getShowOnSummaryPage())); -// -// Element ans = root.addElement("answers"); -// -// ans.addAttribute("singleVariant", String.valueOf(getAnswers() -// .getSingleVariant())); -// -// Iterator<CompileQPart> iter = getAnswers().answers.iterator(); -// -// while (iter.hasNext()) { -// CompileQPart answer = iter.next(); -// -// Element ansEl = ans.addElement("answer"); -// ansEl -// .addAttribute("point", String.valueOf(answer -// .getAnswerPoint())); -// ansEl.setText(answer.getAnswerText()); -// } -// -// return doc.asXML(); + root.addElement("ShowOnSummaryPage").setText(String.valueOf(getShowOnSummaryPage())); + + Element parts = root.addElement("parts"); + + parts.addAttribute("language", String.valueOf(getLanguge())); + + Iterator<CompileQPart> iter = getParts().questionParts.iterator(); + + while (iter.hasNext()) { + CompileQPart part = iter.next(); + + Element partElement = parts.addElement("part"); + partElement.addAttribute("isAnswer", String.valueOf(part.getPartAttributes().isAnswer())); + partElement.addAttribute("isReadOnly", String.valueOf(part.getPartAttributes().isReadOnly())); + partElement.addAttribute("isVivsble", String.valueOf(part.getPartAttributes().isVisible())); + + partElement.setText(part.getAnswerText()); + } + + return doc.asXML(); } private String caption = ""; + private String languge = "Any"; public String getCaption() { return caption; @@ -53,42 +56,40 @@ @SuppressWarnings("unchecked") public boolean unmarshal(Reader res, TreeItem anItem) { -// SAXReader reader = new SAXReader(); -// -// Document doc = null; -// try { -// doc = reader.read(res); -// -// Element root = doc.getRootElement(); -// Element answers = root.element("answers"); -// -// setCaption(root.elementTextTrim("caption")); -// setQuestion(root.elementTextTrim("question")); -// -// boolean showOnSP = Boolean.valueOf(root -// .elementTextTrim("ShowOnSummaryPage")); -// setShowOnSummaryPage(showOnSP); -// -// getAnswers().setSingleVariant( -// answers.attributeValue("singleVariant").equalsIgnoreCase( -// "true")); -// -// getAnswers().answers.clear(); -// -// Iterator<Element> iter = answers.elementIterator("answer"); -// while (iter.hasNext()) { -// Element answer = iter.next(); -// CompileQPart ans = new CompileQPart(answer -// .getText()); -// ans.setAnswerPoint(Double.valueOf(answer -// .attributeValue("point"))); -// getAnswers().answers.add(ans); -// } -// } catch (Exception e) { -// e.printStackTrace(); -// return false; -// } -// + SAXReader reader = new SAXReader(); + + Document doc = null; + try { + doc = reader.read(res); + + Element root = doc.getRootElement(); + Element answers = root.element("parts"); + + setCaption(root.elementTextTrim("caption")); + + boolean showOnSP = Boolean.valueOf(root.elementTextTrim("ShowOnSummaryPage")); + setShowOnSummaryPage(showOnSP); + + setLanguge(answers.attributeValue("language")); + + getParts().questionParts.clear(); + + Iterator<Element> iter = answers.elementIterator("part"); + while (iter.hasNext()) { + Element partElement = iter.next(); + CompileQPart part = new CompileQPart(partElement.getText()); + + part.getPartAttributes().setAnswer(partElement.attributeValue("isAnswer").equalsIgnoreCase("true")); + part.getPartAttributes().setReadOnly(partElement.attributeValue("isReadOnly").equalsIgnoreCase("true")); + part.getPartAttributes().setVisible(partElement.attributeValue("isVivsble").equalsIgnoreCase("true")); + + getParts().questionParts.add(part); + } + } catch (Exception e) { + e.printStackTrace(); + return false; + } + return true; } @@ -99,4 +100,12 @@ public void setParts(CompileQPartsTableModel parts) { this.parts = parts; } + + public String getLanguge() { + return languge; + } + + public void setLanguge(String languge) { + this.languge = languge; + } } Modified: WebEditor/src/edu/lnu/FireFly/WebEditor/ItemModels/CompileQ/CompileQPart.java =================================================================== --- WebEditor/src/edu/lnu/FireFly/WebEditor/ItemModels/CompileQ/CompileQPart.java 2008-05-18 15:27:58 UTC (rev 144) +++ WebEditor/src/edu/lnu/FireFly/WebEditor/ItemModels/CompileQ/CompileQPart.java 2008-05-18 17:35:26 UTC (rev 145) @@ -9,7 +9,6 @@ private static final long serialVersionUID = 1L; private String answerText = ""; - private double answerPoint = 0; private PartAttributes partAttributes = new PartAttributes(); @@ -25,18 +24,10 @@ this.answerText = answerText; } - public double getAnswerPoint() { - return answerPoint; - } - public String getAnswerText() { return answerText; } - public void setAnswerPoint(double answerPoint) { - this.answerPoint = answerPoint; - } - public void setAnswerText(String answerText) { this.answerText = answerText; } Modified: WebEditor/template/CompileQModel.conf =================================================================== --- WebEditor/template/CompileQModel.conf 2008-05-18 15:27:58 UTC (rev 144) +++ WebEditor/template/CompileQModel.conf 2008-05-18 17:35:26 UTC (rev 145) @@ -1,10 +1,2 @@ -<?xml version="1.0" encoding="UTF-8"?> -<SimpleQuestion> -<caption>New simple question</caption> -<question>Answer "Yes" to question, please.</question> -<ShowOnSummaryPage>true</ShowOnSummaryPage> -<answers singleVariant="false"> -<answer point="0.0">Yes</answer> -<answer point="1.0">No</answer> -</answers> -</SimpleQuestion> \ No newline at end of file +<?xml version="1.0" encoding="UTF-8"?> +<CompileQuestion><caption>New compile question</caption><ShowOnSummaryPage>false</ShowOnSummaryPage><parts language="null"><part isAnswer="false" isReadOnly="true" isVivsble="true">Please write program.</part><part isAnswer="true" isReadOnly="false" isVivsble="true">...</part></parts></CompileQuestion> \ No newline at end of file This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <se...@us...> - 2008-05-19 21:35:49
|
Revision: 146 http://acmcontester.svn.sourceforge.net/acmcontester/?rev=146&view=rev Author: sem62 Date: 2008-05-19 14:30:10 -0700 (Mon, 19 May 2008) Log Message: ----------- * added template for cimpileQ model * Moved all logic for tree into new class CourseTree Modified Paths: -------------- WebEditor/src/edu/lnu/FireFly/WebEditor/AppletWithApiHandle.java WebEditor/src/edu/lnu/FireFly/WebEditor/ItemModels/CompileQ/CompileQModel.java WebEditor/src/edu/lnu/FireFly/WebEditor/Settings.java WebEditor/src/edu/lnu/FireFly/WebEditor/WebEditor.java Added Paths: ----------- WebEditor/src/edu/lnu/FireFly/WebEditor/CourseTree.java WebEditor/template/CompileQModel.html WebEditor/template/global/compileQ.js Modified: WebEditor/src/edu/lnu/FireFly/WebEditor/AppletWithApiHandle.java =================================================================== --- WebEditor/src/edu/lnu/FireFly/WebEditor/AppletWithApiHandle.java 2008-05-18 17:35:26 UTC (rev 145) +++ WebEditor/src/edu/lnu/FireFly/WebEditor/AppletWithApiHandle.java 2008-05-19 21:30:10 UTC (rev 146) @@ -9,58 +9,59 @@ */ public class AppletWithApiHandle extends JApplet { /** - * - */ - private static final long serialVersionUID = 5396705469025038804L; - public static boolean initialized = false; + * + */ + private static final long serialVersionUID = 5396705469025038804L; + public static boolean initialized = false; public static boolean terminated = false; - static public String Initialize(String parameter){ - System.out.print("Initialize(" + parameter + ");\n"); - return "true"; + static public String Initialize(String parameter) { + System.out.print("Initialize(" + parameter + ");\n"); + return "true"; } - static public String Terminate(String parameter){ - System.out.print("Terminate(" + parameter + ");\n"); - return "true"; + static public String Terminate(String parameter) { + System.out.print("Terminate(" + parameter + ");\n"); + return "true"; } - static public String GetValue(String parameter){ - System.out.print("GetValue(" + parameter + ");\n"); - - if (parameter.endsWith("completionStatus")){ - return "incomplete"; - } - - return "6"; + static public String GetValue(String parameter) { + System.out.print("GetValue(" + parameter + ");\n"); + + if (parameter.endsWith("completionStatus")) { + return "incomplete"; + } + + return "6"; } - static public boolean SetValue(String parameter, String value){ - System.out.print("SetValue(" + parameter + ", " + value + ");\n"); - return true; + static public boolean SetValue(String parameter, String value) { + System.out.print("SetValue(" + parameter + ", " + value + ");\n"); + return true; } - static public String Commit(String parameter){ - System.out.print("Commit(" + parameter + ");\n"); - return "true"; + static public String Commit(String parameter) { + System.out.print("Commit(" + parameter + ");\n"); + return "true"; } - static public int GetLastError(){ - System.out.print("GetLastError();\n"); - return 0; + static public int GetLastError() { + System.out.print("GetLastError();\n"); + return 0; } - static public String GetErrorString(String parameter){ - int code = Integer.parseInt(parameter); + static public String GetErrorString(String parameter) { + int code = Integer.parseInt(parameter); - String result = ""; - if (code == 0) result = "No Error"; + String result = ""; + if (code == 0) + result = "No Error"; - return result; + return result; } - static public String GetDiagnostic(String parameter){ - System.out.print("GetDiagnostic(" + parameter + ");\n"); - return ""; + static public String GetDiagnostic(String parameter) { + System.out.print("GetDiagnostic(" + parameter + ");\n"); + return ""; } } Added: WebEditor/src/edu/lnu/FireFly/WebEditor/CourseTree.java =================================================================== --- WebEditor/src/edu/lnu/FireFly/WebEditor/CourseTree.java (rev 0) +++ WebEditor/src/edu/lnu/FireFly/WebEditor/CourseTree.java 2008-05-19 21:30:10 UTC (rev 146) @@ -0,0 +1,69 @@ +package edu.lnu.FireFly.WebEditor; + +import java.applet.AppletContext; +import java.net.URL; + +import javax.swing.JTree; +import javax.swing.event.TreeSelectionEvent; +import javax.swing.event.TreeSelectionListener; + +import edu.lnu.FireFly.FFManifest.item.Item; +import edu.lnu.FireFly.FFManifest.resource.Resource; +import edu.lnu.FireFly.WebEditor.GUI.TreeDataModel; + +public class CourseTree extends JTree implements TreeSelectionListener { + + /** + * + */ + private static final long serialVersionUID = -8762602746961040949L; + + private AppletContext appletContext; + + public AppletContext getAppletContext() { + return appletContext; + } + + public void setAppletContext(AppletContext appletContext) { + this.appletContext = appletContext; + } + + public CourseTree(TreeDataModel dataModel, AppletContext appletContext) { + this.appletContext = appletContext; + this.addTreeSelectionListener(this); + } + + @Override + public void valueChanged(TreeSelectionEvent e) { + if (e.getNewLeadSelectionPath() == null) { + try { + getAppletContext().showDocument( + new URL(Settings.getInstance().getResourceLocation() + + "/empty.htm"), "ContentFrame"); + System.out.print("browse to empty document.\n"); + Thread.sleep(300); + } catch (Exception e1) { + // TODO Auto-generated catch block + e1.printStackTrace(); + } + return; + } + + if (e.getNewLeadSelectionPath().getLastPathComponent().getClass() == Item.class) { + Item item = (Item) e.getNewLeadSelectionPath() + .getLastPathComponent(); + try { + Resource resource = WebEditor.instance.getManifest().resources + .findResourceByIdentifier(item.identifierref); + if (resource != null) { + getAppletContext().showDocument( + new URL(Settings.getInstance().getCourseLocation() + + resource.getFullHref()), "ContentFrame"); + System.out.print("redirected\n"); + } + } catch (Exception exc) { + exc.printStackTrace(); + } + } + } +} Modified: WebEditor/src/edu/lnu/FireFly/WebEditor/ItemModels/CompileQ/CompileQModel.java =================================================================== --- WebEditor/src/edu/lnu/FireFly/WebEditor/ItemModels/CompileQ/CompileQModel.java 2008-05-18 17:35:26 UTC (rev 145) +++ WebEditor/src/edu/lnu/FireFly/WebEditor/ItemModels/CompileQ/CompileQModel.java 2008-05-19 21:30:10 UTC (rev 146) @@ -1,11 +1,16 @@ package edu.lnu.FireFly.WebEditor.ItemModels.CompileQ; +import java.util.Iterator; + import edu.lnu.FireFly.FFManifest.TreeItem; +import edu.lnu.FireFly.FFManifest.item.Item; +import edu.lnu.FireFly.FFManifest.resource.Resource; import edu.lnu.FireFly.WebEditor.WebEditor; import edu.lnu.FireFly.WebEditor.GUI.TreeDataModel; import edu.lnu.FireFly.WebEditor.GUI.Dialogs.CompileQ.CompileQPropertiestsDlg; import edu.lnu.FireFly.WebEditor.ItemModels.ItemData; import edu.lnu.FireFly.WebEditor.ItemModels.ResourcedItemModel; +import edu.lnu.FireFly.WebEditor.ItemModels.Template; public class CompileQModel extends ResourcedItemModel { @Override @@ -64,29 +69,29 @@ @Override protected void updateResourceFile(TreeItem anItem) { -// Resource resource = WebEditor.instance.getManifest().resources -// .findResourceByIdentifier(((Item) anItem).identifierref); -// -// Template template = new Template(resource.getFullHref(), this); -// -// CompileQData itemData = getData(anItem); -// -// template.setProperty("Caption", itemData.getCaption()); -// template.setProperty("Question", itemData.getQuestion()); -// -// Iterator<CompileQPart> iter = itemData.getAnswers().questionParts -// .iterator(); -// String answers = "\r\nsetSingleVariant(" -// + itemData.getAnswers().getSingleVariant() + ");\r\n"; -// -// while (iter.hasNext()) { -// CompileQPart answer = iter.next(); -// answers += "addAnswer(\"" + answer.getAnswerText().replace("\"", "\\\"") + "\", " -// + answer.getAnswerPoint() + ");" + "\r\n"; -// } -// -// template.setProperty("answers", answers); -// template.updateResource(); + Resource resource = WebEditor.instance.getManifest().resources + .findResourceByIdentifier(((Item) anItem).identifierref); + + Template template = new Template(resource.getFullHref(), this); + + CompileQData itemData = getData(anItem); + + template.setProperty("Caption", itemData.getCaption()); + + Iterator<CompileQPart> iter = itemData.getParts().questionParts.iterator(); + String answers = "\r\nsetProgrammingLanguage(\"" + + itemData.getLanguge() + "\");\r\n"; + + while (iter.hasNext()) { + CompileQPart part = iter.next(); + answers += "addPart(\"" + part.getAnswerText().replace("\"", "\\\"") + "\", " + + part.getPartAttributes().isAnswer() + ", " + + part.getPartAttributes().isReadOnly() + ", " + + part.getPartAttributes().isVisible() + ");" + "\r\n"; + } + + template.setProperty("parts", answers); + template.updateResource(); } @Override Modified: WebEditor/src/edu/lnu/FireFly/WebEditor/Settings.java =================================================================== --- WebEditor/src/edu/lnu/FireFly/WebEditor/Settings.java 2008-05-18 17:35:26 UTC (rev 145) +++ WebEditor/src/edu/lnu/FireFly/WebEditor/Settings.java 2008-05-19 21:30:10 UTC (rev 146) @@ -9,7 +9,7 @@ private long autoSaveInterval = 5 * 60 * 1000; private long nopInterval = 60 * 1000; - public static Settings obj = null; + private static Settings obj = null; public static Settings getInstance(){ Modified: WebEditor/src/edu/lnu/FireFly/WebEditor/WebEditor.java =================================================================== --- WebEditor/src/edu/lnu/FireFly/WebEditor/WebEditor.java 2008-05-18 17:35:26 UTC (rev 145) +++ WebEditor/src/edu/lnu/FireFly/WebEditor/WebEditor.java 2008-05-19 21:30:10 UTC (rev 146) @@ -2,22 +2,17 @@ import java.awt.event.ActionEvent; import java.awt.event.ActionListener; -import java.net.URL; import javax.swing.JMenu; import javax.swing.JMenuBar; import javax.swing.JMenuItem; import javax.swing.JScrollPane; import javax.swing.JTree; -import javax.swing.event.TreeSelectionEvent; -import javax.swing.event.TreeSelectionListener; import edu.lnu.FireFly.FFManifest.Manifest; import edu.lnu.FireFly.FFManifest.TreeItem; -import edu.lnu.FireFly.FFManifest.item.Item; import edu.lnu.FireFly.FFManifest.parser.Parser; import edu.lnu.FireFly.FFManifest.parser.TestDocException; -import edu.lnu.FireFly.FFManifest.resource.Resource; import edu.lnu.FireFly.WebEditor.Data.AutoSaveThread; import edu.lnu.FireFly.WebEditor.Data.ManifestFactory; import edu.lnu.FireFly.WebEditor.Data.SummaryPageManager; @@ -28,7 +23,7 @@ import edu.lnu.FireFly.WebEditor.WSClients.WebEditorServiceClient; public class WebEditor extends AppletWithWYSIWYGEditor implements - ActionListener, TreeSelectionListener { + ActionListener { /** * @@ -115,11 +110,9 @@ CreateNewCourse(); } - tree = new JTree(TreeDataModel.getInstance()); + tree = new CourseTree(TreeDataModel.getInstance(), getAppletContext()); this.add(new JScrollPane(tree)); - tree.addTreeSelectionListener(this); - tree.addMouseListener(new CourseTreePopupMenu()); } @@ -186,38 +179,4 @@ // Install the menu bar in the frame this.setJMenuBar(menuBar); } - - @Override - public void valueChanged(TreeSelectionEvent e) { - if (e.getNewLeadSelectionPath() == null) { - try { - getAppletContext().showDocument( - new URL(Settings.getInstance().getResourceLocation() - + "/empty.htm"), "ContentFrame"); - System.out.print("browse to empty document.\n"); - Thread.sleep(300); - } catch (Exception e1) { - // TODO Auto-generated catch block - e1.printStackTrace(); - } - return; - } - - if (e.getNewLeadSelectionPath().getLastPathComponent().getClass() == Item.class) { - Item item = (Item) e.getNewLeadSelectionPath() - .getLastPathComponent(); - try { - Resource resource = manifest.resources - .findResourceByIdentifier(item.identifierref); - if (resource != null) { - getAppletContext().showDocument( - new URL(Settings.getInstance().getCourseLocation() - + resource.getFullHref()), "ContentFrame"); - System.out.print("redirected\n"); - } - } catch (Exception exc) { - exc.printStackTrace(); - } - } - } } Added: WebEditor/template/CompileQModel.html =================================================================== --- WebEditor/template/CompileQModel.html (rev 0) +++ WebEditor/template/CompileQModel.html 2008-05-19 21:30:10 UTC (rev 146) @@ -0,0 +1,26 @@ +<html> +<head> + <title>title</title> + <meta http-equiv="Content-Type" content="text/html; charset=utf8" /> + <script type="text/javascript" src="global/APIWrapper.js"></script> + <script type="text/javascript" src="global/compileQ.js"></script> +</head> + +<body onLoad="Initialize()" onunload="Terminate();"> + <div id="compileQ_caption"> + <!--caption start-->New caption<!--caption end--> + </div> + <div id="compileQ_content"> + <form onsubmit="return checkAnswer(this);"> + <div id="compileQ_part"> + <script language="javascript"> + <!--parts start--> + <!--parts end--> + show(); + </script> + </div> + <input type=submit value="Check"> + </form> + </div> +</body> +</html> \ No newline at end of file Added: WebEditor/template/global/compileQ.js =================================================================== --- WebEditor/template/global/compileQ.js (rev 0) +++ WebEditor/template/global/compileQ.js 2008-05-19 21:30:10 UTC (rev 146) @@ -0,0 +1,38 @@ +var singlepart = false; +var parts = new Array(); + +function setProgrammingLanguage(language){ +} + +function addPart(_text, _ispart, _isReadOnly, _isVisible){ + var part = { + text: _text, + ispart: _ispart, + isReadOnly: _isReadOnly, + isVisible: _isVisible, + id: "part" + parts.length + }; + parts.push(part); +} + +function show(){ + for (i=0; i < parts.length; i++){ + if (parts[i].isVisible){ + document.write("<div name='" + parts[i].id + "' id='" + parts[i].id + "'>"); + if (!parts[i].isReadOnly){ + document.write("<textarea rows='15' cols='60' id='part" + parts[i].id + "' name='part" + parts[i].id + "'>"); + } + document.write(parts[i].text); + if (!parts[i].isReadOnly){ + document.write("</textarea>"); + } + document.write("<div>"); + } + } +} + +function check7Answer(frm){ + Terminate(); + + return false; +} \ No newline at end of file This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <se...@us...> - 2008-05-20 20:25:42
|
Revision: 152 http://acmcontester.svn.sourceforge.net/acmcontester/?rev=152&view=rev Author: sem62 Date: 2008-05-20 13:25:50 -0700 (Tue, 20 May 2008) Log Message: ----------- Integrated rte.jar Modified Paths: -------------- WebEditor/resources/index.html WebEditor/src/edu/lnu/FireFly/WebEditor/AppletWithApiHandle.java WebEditor/src/edu/lnu/FireFly/WebEditor/CourseTree.java WebEditor/src/edu/lnu/FireFly/WebEditor/GUI/CourseTreePopupMenu.java WebEditor/src/edu/lnu/FireFly/WebEditor/WebEditor.java Modified: WebEditor/resources/index.html =================================================================== --- WebEditor/resources/index.html 2008-05-20 20:25:02 UTC (rev 151) +++ WebEditor/resources/index.html 2008-05-20 20:25:50 UTC (rev 152) @@ -85,7 +85,7 @@ </tr> <tr height='*'> <td class='side-body'> - <applet mayscript="" name="webeditor" archive="webeditor.jar,RTEValidators.jar,FFManifest.jar, dom4j.jar" code=edu.lnu.FireFly.WebEditor.WebEditor.class width="100%" height="100%"> + <applet mayscript="" name="webeditor" archive="webeditor.jar,RTEValidators.jar,FFManifest.jar,dom4j.jar,rte.jar" code=edu.lnu.FireFly.WebEditor.WebEditor.class width="100%" height="100%"> <PARAM NAME="courseLocation" VALUE="http://127.0.0.1/sem/course/"> <PARAM NAME="serviceLocation" VALUE="http://127.0.0.1/sem/WebEditor/service/"> <PARAM NAME="templateLocation" VALUE="http://127.0.0.1/sem/WebEditor/template/"> Modified: WebEditor/src/edu/lnu/FireFly/WebEditor/AppletWithApiHandle.java =================================================================== --- WebEditor/src/edu/lnu/FireFly/WebEditor/AppletWithApiHandle.java 2008-05-20 20:25:02 UTC (rev 151) +++ WebEditor/src/edu/lnu/FireFly/WebEditor/AppletWithApiHandle.java 2008-05-20 20:25:50 UTC (rev 152) @@ -2,6 +2,11 @@ import javax.swing.JApplet; +import edu.lnu.FireFly.Rte.Activity; +import edu.lnu.FireFly.Rte.Cmi; +import edu.lnu.FireFly.Rte.CmiManager; +import edu.lnu.FireFly.Rte.GlobalStateInformation; + /** * It is an Applet, but it contain API handlers. * @@ -14,43 +19,64 @@ private static final long serialVersionUID = 5396705469025038804L; public static boolean initialized = false; public static boolean terminated = false; - - static public String Initialize(String parameter) { + + public String Initialize(String parameter) { System.out.print("Initialize(" + parameter + ");\n"); + return "true"; } - static public String Terminate(String parameter) { + public String Terminate(String parameter) { System.out.print("Terminate(" + parameter + ");\n"); + return "true"; } - static public String GetValue(String parameter) { + public String GetValue(String parameter) { System.out.print("GetValue(" + parameter + ");\n"); - if (parameter.endsWith("completionStatus")) { - return "incomplete"; + Cmi cmi = getCmiModel(); + + if (parameter.toLowerCase().startsWith("cmi.")){ + return cmi.getValue(parameter.substring(4)); + } else { + return ""; } + } - return "6"; + private Cmi getCmiModel() { + + Activity activity = GlobalStateInformation.getCurrentActivity(); + + Cmi cmi = CmiManager.getInstance().getModelForActivity(activity); + return cmi; } - static public boolean SetValue(String parameter, String value) { + public boolean SetValue(String parameter, String value) { System.out.print("SetValue(" + parameter + ", " + value + ");\n"); - return true; + + Cmi cmi = getCmiModel(); + + if (parameter.toLowerCase().startsWith("cmi.")){ + cmi.setValue(parameter.substring(4), value); + return true; + } else { + return false; + } + } - static public String Commit(String parameter) { + public String Commit(String parameter) { System.out.print("Commit(" + parameter + ");\n"); return "true"; } - static public int GetLastError() { + public int GetLastError() { System.out.print("GetLastError();\n"); return 0; } - static public String GetErrorString(String parameter) { + public String GetErrorString(String parameter) { int code = Integer.parseInt(parameter); String result = ""; @@ -60,7 +86,7 @@ return result; } - static public String GetDiagnostic(String parameter) { + public String GetDiagnostic(String parameter) { System.out.print("GetDiagnostic(" + parameter + ");\n"); return ""; } Modified: WebEditor/src/edu/lnu/FireFly/WebEditor/CourseTree.java =================================================================== --- WebEditor/src/edu/lnu/FireFly/WebEditor/CourseTree.java 2008-05-20 20:25:02 UTC (rev 151) +++ WebEditor/src/edu/lnu/FireFly/WebEditor/CourseTree.java 2008-05-20 20:25:50 UTC (rev 152) @@ -9,6 +9,8 @@ import edu.lnu.FireFly.FFManifest.item.Item; import edu.lnu.FireFly.FFManifest.resource.Resource; +import edu.lnu.FireFly.Rte.Activity; +import edu.lnu.FireFly.Rte.GlobalStateInformation; import edu.lnu.FireFly.WebEditor.GUI.TreeDataModel; public class CourseTree extends JTree implements TreeSelectionListener { @@ -38,6 +40,7 @@ public void valueChanged(TreeSelectionEvent e) { if (e.getNewLeadSelectionPath() == null) { try { + GlobalStateInformation.setCurrentActivity(null); getAppletContext().showDocument( new URL(Settings.getInstance().getResourceLocation() + "/empty.htm"), "ContentFrame"); @@ -53,6 +56,9 @@ if (e.getNewLeadSelectionPath().getLastPathComponent().getClass() == Item.class) { Item item = (Item) e.getNewLeadSelectionPath() .getLastPathComponent(); + + GlobalStateInformation.setCurrentActivity(Activity.findActivityByIdentifier(item.identifier)); + try { Resource resource = WebEditor.instance.getManifest().resources .findResourceByIdentifier(item.identifierref); Modified: WebEditor/src/edu/lnu/FireFly/WebEditor/GUI/CourseTreePopupMenu.java =================================================================== --- WebEditor/src/edu/lnu/FireFly/WebEditor/GUI/CourseTreePopupMenu.java 2008-05-20 20:25:02 UTC (rev 151) +++ WebEditor/src/edu/lnu/FireFly/WebEditor/GUI/CourseTreePopupMenu.java 2008-05-20 20:25:50 UTC (rev 152) @@ -181,9 +181,9 @@ private void displayMenu(MouseEvent e) { if (e.isPopupTrigger()) { Point pt = e.getPoint(); - TreePath path = WebEditor.tree + TreePath path = WebEditor.getCourseTree() .getClosestPathForLocation(pt.x, pt.y); - WebEditor.tree.setSelectionPath(path); + WebEditor.getCourseTree().setSelectionPath(path); manifestItem = (TreeItem) path.getLastPathComponent(); ItemModel model = ItemModels.getModelFromItem(manifestItem); Modified: WebEditor/src/edu/lnu/FireFly/WebEditor/WebEditor.java =================================================================== --- WebEditor/src/edu/lnu/FireFly/WebEditor/WebEditor.java 2008-05-20 20:25:02 UTC (rev 151) +++ WebEditor/src/edu/lnu/FireFly/WebEditor/WebEditor.java 2008-05-20 20:25:50 UTC (rev 152) @@ -7,12 +7,12 @@ import javax.swing.JMenuBar; import javax.swing.JMenuItem; import javax.swing.JScrollPane; -import javax.swing.JTree; import edu.lnu.FireFly.FFManifest.Manifest; import edu.lnu.FireFly.FFManifest.TreeItem; import edu.lnu.FireFly.FFManifest.parser.Parser; import edu.lnu.FireFly.FFManifest.parser.TestDocException; +import edu.lnu.FireFly.Rte.Activity; import edu.lnu.FireFly.WebEditor.Data.AutoSaveThread; import edu.lnu.FireFly.WebEditor.Data.ManifestFactory; import edu.lnu.FireFly.WebEditor.Data.SummaryPageManager; @@ -30,7 +30,7 @@ */ private static final long serialVersionUID = 1144429894709918030L; - public static JTree tree; + protected static CourseTree courseTree; public static WebEditor instance = null; @@ -85,6 +85,8 @@ ItemModels.synchronizeAllItemDatas(manifest.getRoot()); SummaryPageManager.getInstance().setManifest(manifest); + + Activity.fullUpdate(manifest); } public Manifest getManifest() { @@ -110,10 +112,10 @@ CreateNewCourse(); } - tree = new CourseTree(TreeDataModel.getInstance(), getAppletContext()); - this.add(new JScrollPane(tree)); + courseTree = new CourseTree(TreeDataModel.getInstance(), getAppletContext()); + this.add(new JScrollPane(courseTree)); - tree.addMouseListener(new CourseTreePopupMenu()); + courseTree.addMouseListener(new CourseTreePopupMenu()); } private void parseParameter() { @@ -149,6 +151,8 @@ model.synchronizeItemWithResource(root, "template"); SummaryPageManager.getInstance().updateSummaryPages(); + + Activity.fullUpdate(manifest); } catch (Exception e) { e.printStackTrace(); } @@ -179,4 +183,8 @@ // Install the menu bar in the frame this.setJMenuBar(menuBar); } + + public static CourseTree getCourseTree() { + return courseTree; + } } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <se...@us...> - 2008-05-23 14:27:49
|
Revision: 161 http://acmcontester.svn.sourceforge.net/acmcontester/?rev=161&view=rev Author: sem62 Date: 2008-05-23 07:27:49 -0700 (Fri, 23 May 2008) Log Message: ----------- modifying code for checking user answer internally in applet Modified Paths: -------------- WebEditor/resources/index.html WebEditor/src/deploy.jardesc WebEditor/src/edu/lnu/FireFly/WebEditor/AppletWithApiHandle.java WebEditor/src/edu/lnu/FireFly/WebEditor/CourseTree.java WebEditor/src/edu/lnu/FireFly/WebEditor/ItemModels/Chapter/ChapterModel.java WebEditor/src/edu/lnu/FireFly/WebEditor/ItemModels/CompileQ/CompileQModel.java WebEditor/src/edu/lnu/FireFly/WebEditor/ItemModels/ItemModel.java WebEditor/src/edu/lnu/FireFly/WebEditor/ItemModels/Lecture/LectureModel.java WebEditor/src/edu/lnu/FireFly/WebEditor/ItemModels/LectureUserAnswerStatus.java WebEditor/src/edu/lnu/FireFly/WebEditor/ItemModels/SimpleQuestion/SimpleQuestionModel.java WebEditor/src/edu/lnu/FireFly/WebEditor/ItemModels/SummaryPageModel/SummaryPageModel.java WebEditor/src/edu/lnu/FireFly/WebEditor/ItemModels/UnknownItemModel.java WebEditor/src/edu/lnu/FireFly/WebEditor/ItemModels/UnknownModelAnswerStatus.java WebEditor/src/edu/lnu/FireFly/WebEditor/ItemModels/UserAnswerStatus.java WebEditor/src/edu/lnu/FireFly/WebEditor/WebEditor.java WebEditor/template/LectureModel.html Added Paths: ----------- WebEditor/src/edu/lnu/FireFly/WebEditor/Data/AnswersStatusManager.java WebEditor/src/edu/lnu/FireFly/WebEditor/ItemModels/Utils.java Modified: WebEditor/resources/index.html =================================================================== --- WebEditor/resources/index.html 2008-05-23 14:26:18 UTC (rev 160) +++ WebEditor/resources/index.html 2008-05-23 14:27:49 UTC (rev 161) @@ -57,6 +57,14 @@ padding: 4px; } </style> + + <script type="text/javascript"> + function getVal(){ + var result = ""; + result = GetValue(document.getElementById('getval').value); + document.getElementById('getvalres').value = result + ""; + } + </script> </head> @@ -85,7 +93,7 @@ </tr> <tr height='*'> <td class='side-body'> - <applet mayscript="" name="webeditor" archive="webeditor.jar,RTEValidators.jar,FFManifest.jar,dom4j.jar,rte.jar" code=edu.lnu.FireFly.WebEditor.WebEditor.class width="100%" height="100%"> + <applet mayscript="" name="webeditor" id="webeditor" archive="webeditor.jar,RTEValidators.jar,FFManifest.jar,dom4j.jar,rte.jar" code=edu.lnu.FireFly.WebEditor.WebEditor.class width="100%" height="100%"> <PARAM NAME="courseLocation" VALUE="http://127.0.0.1/sem/course/"> <PARAM NAME="serviceLocation" VALUE="http://127.0.0.1/sem/WebEditor/service/"> <PARAM NAME="templateLocation" VALUE="http://127.0.0.1/sem/WebEditor/template/"> @@ -120,7 +128,8 @@ </tr> </tbody> </table> - </table> + <tr><td><input type=text id='getval'><input type='button' onclick="getVal();"><td><input id='getvalres'></td></tr> + </table> </body> </html> \ No newline at end of file Modified: WebEditor/src/deploy.jardesc =================================================================== --- WebEditor/src/deploy.jardesc 2008-05-23 14:26:18 UTC (rev 160) +++ WebEditor/src/deploy.jardesc 2008-05-23 14:27:49 UTC (rev 161) @@ -11,6 +11,9 @@ </sealing> </manifest> <selectedElements exportClassFiles="true" exportJavaFiles="true" exportOutputFolder="false"> - <javaElement handleIdentifier="=webEditor"/> + <file path="/webEditor/.classpath"/> + <javaElement handleIdentifier="=webEditor/src"/> + <file path="/webEditor/webEditor.eap"/> + <file path="/webEditor/.project"/> </selectedElements> </jardesc> Modified: WebEditor/src/edu/lnu/FireFly/WebEditor/AppletWithApiHandle.java =================================================================== --- WebEditor/src/edu/lnu/FireFly/WebEditor/AppletWithApiHandle.java 2008-05-23 14:26:18 UTC (rev 160) +++ WebEditor/src/edu/lnu/FireFly/WebEditor/AppletWithApiHandle.java 2008-05-23 14:27:49 UTC (rev 161) @@ -2,10 +2,13 @@ import javax.swing.JApplet; -import edu.lnu.FireFly.Rte.Activity; +import edu.lnu.FireFly.FFManifest.TreeItem; import edu.lnu.FireFly.Rte.Cmi; import edu.lnu.FireFly.Rte.CmiManager; +import edu.lnu.FireFly.Rte.ElementName; import edu.lnu.FireFly.Rte.GlobalStateInformation; +import edu.lnu.FireFly.WebEditor.Data.AnswersStatusManager; +import edu.lnu.FireFly.WebEditor.Data.SummaryPageManager; /** * It is an Applet, but it contain API handlers. @@ -19,51 +22,73 @@ private static final long serialVersionUID = 5396705469025038804L; public static boolean initialized = false; public static boolean terminated = false; - + + private static String nextItemIdentifier = null; + + public static void setNextItemIdentifier(String itemIdentifier) { + nextItemIdentifier = itemIdentifier; + } + public String Initialize(String parameter) { System.out.print("Initialize(" + parameter + ");\n"); - + + GlobalStateInformation.setCurrentActivity(SummaryPageManager.getInstance().getManifest().findItemByIdentifier(nextItemIdentifier)); + return "true"; } public String Terminate(String parameter) { System.out.print("Terminate(" + parameter + ");\n"); + GlobalStateInformation.setCurrentActivity(null); + return "true"; } public String GetValue(String parameter) { - System.out.print("GetValue(" + parameter + ");\n"); + System.out.print("GetValue(" + parameter + ")"); - Cmi cmi = getCmiModel(); - - if (parameter.toLowerCase().startsWith("cmi.")){ - return cmi.getValue(parameter.substring(4)); - } else { - return ""; + Cmi cmi = getCmiModel(); + + String result = ""; + if (parameter.toLowerCase().startsWith("cmi.")) { + result = cmi.getValue(new ElementName(parameter.substring(4))); } + + System.out.println(" returned " + result); + return result; } private Cmi getCmiModel() { - - Activity activity = GlobalStateInformation.getCurrentActivity(); - + + TreeItem activity = GlobalStateInformation.getCurrentActivity(); + Cmi cmi = CmiManager.getInstance().getModelForActivity(activity); return cmi; } public boolean SetValue(String parameter, String value) { System.out.print("SetValue(" + parameter + ", " + value + ");\n"); - - Cmi cmi = getCmiModel(); - if (parameter.toLowerCase().startsWith("cmi.")){ - cmi.setValue(parameter.substring(4), value); - return true; + Cmi cmi = getCmiModel(); + + if (parameter.toLowerCase().startsWith("cmi.")) { + cmi.setValue(new ElementName(parameter.substring(4)), value); + + if (parameter.startsWith("cmi.answers.")) { + String itemIdentifier = GlobalStateInformation + .getCurrentActivity().getIdentifier(); + + TreeItem item = SummaryPageManager.getInstance().getManifest() + .findItemByIdentifier(itemIdentifier); + + AnswersStatusManager.getInstance().cmiAnswersChanged(item); + } + + return true; } else { return false; } - } public String Commit(String parameter) { Modified: WebEditor/src/edu/lnu/FireFly/WebEditor/CourseTree.java =================================================================== --- WebEditor/src/edu/lnu/FireFly/WebEditor/CourseTree.java 2008-05-23 14:26:18 UTC (rev 160) +++ WebEditor/src/edu/lnu/FireFly/WebEditor/CourseTree.java 2008-05-23 14:27:49 UTC (rev 161) @@ -9,8 +9,6 @@ import edu.lnu.FireFly.FFManifest.item.Item; import edu.lnu.FireFly.FFManifest.resource.Resource; -import edu.lnu.FireFly.Rte.Activity; -import edu.lnu.FireFly.Rte.GlobalStateInformation; import edu.lnu.FireFly.WebEditor.GUI.TreeDataModel; public class CourseTree extends JTree implements TreeSelectionListener { @@ -40,7 +38,8 @@ public void valueChanged(TreeSelectionEvent e) { if (e.getNewLeadSelectionPath() == null) { try { - GlobalStateInformation.setCurrentActivity(null); + AppletWithApiHandle.setNextItemIdentifier(""); + getAppletContext().showDocument( new URL(Settings.getInstance().getResourceLocation() + "/empty.htm"), "ContentFrame"); @@ -57,7 +56,7 @@ Item item = (Item) e.getNewLeadSelectionPath() .getLastPathComponent(); - GlobalStateInformation.setCurrentActivity(Activity.findActivityByIdentifier(item.identifier)); + AppletWithApiHandle.setNextItemIdentifier(item.identifier); try { Resource resource = WebEditor.instance.getManifest().resources Added: WebEditor/src/edu/lnu/FireFly/WebEditor/Data/AnswersStatusManager.java =================================================================== --- WebEditor/src/edu/lnu/FireFly/WebEditor/Data/AnswersStatusManager.java (rev 0) +++ WebEditor/src/edu/lnu/FireFly/WebEditor/Data/AnswersStatusManager.java 2008-05-23 14:27:49 UTC (rev 161) @@ -0,0 +1,78 @@ +package edu.lnu.FireFly.WebEditor.Data; + +import java.util.HashMap; + +import edu.lnu.FireFly.FFManifest.Manifest; +import edu.lnu.FireFly.FFManifest.TreeItem; +import edu.lnu.FireFly.FFManifest.parser.TestDocException; +import edu.lnu.FireFly.Rte.Cmi; +import edu.lnu.FireFly.Rte.CmiManager; +import edu.lnu.FireFly.WebEditor.ItemModels.ItemModel; +import edu.lnu.FireFly.WebEditor.ItemModels.ItemModels; +import edu.lnu.FireFly.WebEditor.ItemModels.UserAnswerStatus; + +public class AnswersStatusManager { + private HashMap<TreeItem, UserAnswerStatus> answerStatus = new HashMap<TreeItem, UserAnswerStatus>(); + private static AnswersStatusManager obj = null; + + private AnswersStatusManager() { + + } + + public void resetAllAnswers(){ + answerStatus.clear(); + + Manifest manifest = SummaryPageManager.getInstance().getManifest(); + + TreeItem root = null; + try { + root = manifest.getRoot(); + } catch (TestDocException e) { + e.printStackTrace(); + + return ; + } + + updateAllCmiModels(root); + } + + public void updateAllCmiModels(TreeItem root) { + ItemModel itemModel = ItemModels.getModelFromItem(root); + + Cmi cmi = CmiManager.getInstance().getModelForActivity(root); + + cmi.clearAnswers(); + + itemModel.handleUserAnswer(root); + + for (int i=0; i < root.getChildCount(); i++){ + updateAllCmiModels(root.getChild(i)); + } + } + + public UserAnswerStatus getAnswerStatus(TreeItem anItem) { + UserAnswerStatus userAnswerStatus = answerStatus.get(anItem); + + if (userAnswerStatus == null) { + ItemModel itemModel = ItemModels.getModelFromItem(anItem); + + answerStatus.put(anItem, itemModel.createUserAnswerInstance(anItem)); + userAnswerStatus = answerStatus.get(anItem); + } + + return userAnswerStatus; + } + + public static AnswersStatusManager getInstance() { + if (obj == null) { + obj = new AnswersStatusManager(); + } + + return obj; + } + + public void cmiAnswersChanged(TreeItem anItem) { + ItemModel itemModel = ItemModels.getModelFromItem(anItem); + itemModel.handleUserAnswer(anItem); + } +} Modified: WebEditor/src/edu/lnu/FireFly/WebEditor/ItemModels/Chapter/ChapterModel.java =================================================================== --- WebEditor/src/edu/lnu/FireFly/WebEditor/ItemModels/Chapter/ChapterModel.java 2008-05-23 14:26:18 UTC (rev 160) +++ WebEditor/src/edu/lnu/FireFly/WebEditor/ItemModels/Chapter/ChapterModel.java 2008-05-23 14:27:49 UTC (rev 161) @@ -15,7 +15,7 @@ public class ChapterModel extends ResourcedItemModel { @Override - protected UserAnswerStatus createUserAnswerInstance(TreeItem anItem) { + public UserAnswerStatus createUserAnswerInstance(TreeItem anItem) { return null; } Modified: WebEditor/src/edu/lnu/FireFly/WebEditor/ItemModels/CompileQ/CompileQModel.java =================================================================== --- WebEditor/src/edu/lnu/FireFly/WebEditor/ItemModels/CompileQ/CompileQModel.java 2008-05-23 14:26:18 UTC (rev 160) +++ WebEditor/src/edu/lnu/FireFly/WebEditor/ItemModels/CompileQ/CompileQModel.java 2008-05-23 14:27:49 UTC (rev 161) @@ -16,7 +16,7 @@ public class CompileQModel extends ResourcedItemModel { @Override - protected UserAnswerStatus createUserAnswerInstance(TreeItem anItem) { + public UserAnswerStatus createUserAnswerInstance(TreeItem anItem) { return new ScoredUserAnswerStatus(anItem); } Modified: WebEditor/src/edu/lnu/FireFly/WebEditor/ItemModels/ItemModel.java =================================================================== --- WebEditor/src/edu/lnu/FireFly/WebEditor/ItemModels/ItemModel.java 2008-05-23 14:26:18 UTC (rev 160) +++ WebEditor/src/edu/lnu/FireFly/WebEditor/ItemModels/ItemModel.java 2008-05-23 14:27:49 UTC (rev 161) @@ -14,12 +14,11 @@ import edu.lnu.FireFly.FFManifest.item.sequencing.objectives.MapInfo; import edu.lnu.FireFly.FFManifest.item.sequencing.objectives.Objectives; import edu.lnu.FireFly.FFManifest.resource.Resource; -import edu.lnu.FireFly.Rte.Activity; import edu.lnu.FireFly.Rte.Cmi; import edu.lnu.FireFly.Rte.CmiManager; import edu.lnu.FireFly.WebEditor.WebEditor; +import edu.lnu.FireFly.WebEditor.Data.AnswersStatusManager; import edu.lnu.FireFly.WebEditor.Data.ManifestFactory; -import edu.lnu.FireFly.WebEditor.Data.SummaryPageManager; import edu.lnu.FireFly.WebEditor.GUI.TreeDataModel; import edu.lnu.FireFly.WebEditor.GUI.Dialogs.PropertyDlg; import edu.lnu.FireFly.WebEditor.ItemModels.SummaryPageModel.SummaryPageModel; @@ -90,9 +89,6 @@ // .getItemPath(item)); TreeDataModel.getInstance().treeNodesChanged(item); - - Activity.synchronizeActivitiesStructure(SummaryPageManager - .getInstance().getManifest()); } public final void registerConfigDlg(PropertyDlg dlg) { @@ -274,19 +270,22 @@ protected abstract ItemData createItemDataInstance(); - public void handleUserAnswer(String answer, TreeItem anItem){ - Activity activity = Activity.findActivityByIdentifier(anItem.getIdentifier()); - - Cmi cmi =CmiManager.getInstance().getModelForActivity(activity); - if (cmi == null){ - throw new NullPointerException("Cmi model for activity is null at ItemModel.handleUserAnswer()"); + public void handleUserAnswer(TreeItem anItem) { + Cmi cmi = CmiManager.getInstance().getModelForActivity(anItem); + if (cmi == null) { + throw new NullPointerException( + "Cmi model for activity is null at ItemModel.handleUserAnswer()"); } - - UserAnswerStatus userAnswer = createUserAnswerInstance(anItem); - userAnswer.setRawAnswer(answer); - - userAnswer.updateRteFields(cmi); + + UserAnswerStatus userAnswer = AnswersStatusManager.getInstance().getAnswerStatus(anItem); + if (userAnswer != null) { + String[] rawAnswer = cmi.getAnswers(); + + userAnswer.setRawAnswer(rawAnswer); + + userAnswer.updateRteFields(cmi); + } } - protected abstract UserAnswerStatus createUserAnswerInstance(TreeItem anItem); + public abstract UserAnswerStatus createUserAnswerInstance(TreeItem anItem); } Modified: WebEditor/src/edu/lnu/FireFly/WebEditor/ItemModels/Lecture/LectureModel.java =================================================================== --- WebEditor/src/edu/lnu/FireFly/WebEditor/ItemModels/Lecture/LectureModel.java 2008-05-23 14:26:18 UTC (rev 160) +++ WebEditor/src/edu/lnu/FireFly/WebEditor/ItemModels/Lecture/LectureModel.java 2008-05-23 14:27:49 UTC (rev 161) @@ -13,7 +13,7 @@ public class LectureModel extends ResourcedItemModel { @Override - protected UserAnswerStatus createUserAnswerInstance(TreeItem anItem) { + public UserAnswerStatus createUserAnswerInstance(TreeItem anItem) { return new LectureUserAnswerStatus(anItem); } Modified: WebEditor/src/edu/lnu/FireFly/WebEditor/ItemModels/LectureUserAnswerStatus.java =================================================================== --- WebEditor/src/edu/lnu/FireFly/WebEditor/ItemModels/LectureUserAnswerStatus.java 2008-05-23 14:26:18 UTC (rev 160) +++ WebEditor/src/edu/lnu/FireFly/WebEditor/ItemModels/LectureUserAnswerStatus.java 2008-05-23 14:27:49 UTC (rev 161) @@ -2,6 +2,9 @@ import edu.lnu.FireFly.FFManifest.TreeItem; import edu.lnu.FireFly.Rte.Cmi; +import edu.lnu.FireFly.Rte.ElementName; +import edu.lnu.FireFly.Rte.GlobalStateInformation; +import edu.lnu.FireFly.WebEditor.Data.SummaryPageManager; public class LectureUserAnswerStatus extends UserAnswerStatus { @@ -11,14 +14,37 @@ @Override public void updateRteFields(Cmi cmi) { - // TODO Auto-generated method stub + + TreeItem currentActivity = GlobalStateInformation.getCurrentActivity(); + + GlobalStateInformation.setCurrentActivity(SummaryPageManager.getInstance().getManifest().findItemByIdentifier(item.getIdentifier())); + + String[] answers = getRawAnswer(); + String status = "incomplete"; + + cmi.setValue(new ElementName("score.min"), "0"); + cmi.setValue(new ElementName("score.max"), "0"); + cmi.setValue(new ElementName("score.raw"), "0"); + cmi.setValue(new ElementName("score.scaled"), "0"); + + cmi.setValue(new ElementName("objectives.0.score.min"), "0"); + cmi.setValue(new ElementName("objectives.0.score.max"), "0"); + cmi.setValue(new ElementName("objectives.0.score.raw"), "0"); + cmi.setValue(new ElementName("objectives.0.score.scaled"), "0"); + + if (answers != null && answers.length == 1 && answers[0].equals("read")) { + status = "completed"; + } + + cmi.setValue(new ElementName("completion_status"), status); + cmi.setValue(new ElementName("objectives.0.completion_status"), status); + cmi.setValue(new ElementName("objectives.0.score.scaled"), "1"); + + GlobalStateInformation.setCurrentActivity(currentActivity); } @Override protected void updateValues() { - // TODO Auto-generated method stub - } - } Modified: WebEditor/src/edu/lnu/FireFly/WebEditor/ItemModels/SimpleQuestion/SimpleQuestionModel.java =================================================================== --- WebEditor/src/edu/lnu/FireFly/WebEditor/ItemModels/SimpleQuestion/SimpleQuestionModel.java 2008-05-23 14:26:18 UTC (rev 160) +++ WebEditor/src/edu/lnu/FireFly/WebEditor/ItemModels/SimpleQuestion/SimpleQuestionModel.java 2008-05-23 14:27:49 UTC (rev 161) @@ -15,7 +15,7 @@ public class SimpleQuestionModel extends ResourcedItemModel { @Override - protected UserAnswerStatus createUserAnswerInstance(TreeItem anItem) { + public UserAnswerStatus createUserAnswerInstance(TreeItem anItem) { return new ScoredUserAnswerStatus(anItem); } Modified: WebEditor/src/edu/lnu/FireFly/WebEditor/ItemModels/SummaryPageModel/SummaryPageModel.java =================================================================== --- WebEditor/src/edu/lnu/FireFly/WebEditor/ItemModels/SummaryPageModel/SummaryPageModel.java 2008-05-23 14:26:18 UTC (rev 160) +++ WebEditor/src/edu/lnu/FireFly/WebEditor/ItemModels/SummaryPageModel/SummaryPageModel.java 2008-05-23 14:27:49 UTC (rev 161) @@ -17,7 +17,7 @@ public class SummaryPageModel extends ResourcedItemModel { @Override - protected UserAnswerStatus createUserAnswerInstance(TreeItem anItem) { + public UserAnswerStatus createUserAnswerInstance(TreeItem anItem) { return null; } Modified: WebEditor/src/edu/lnu/FireFly/WebEditor/ItemModels/UnknownItemModel.java =================================================================== --- WebEditor/src/edu/lnu/FireFly/WebEditor/ItemModels/UnknownItemModel.java 2008-05-23 14:26:18 UTC (rev 160) +++ WebEditor/src/edu/lnu/FireFly/WebEditor/ItemModels/UnknownItemModel.java 2008-05-23 14:27:49 UTC (rev 161) @@ -7,7 +7,7 @@ public class UnknownItemModel extends ItemModel { @Override - protected UserAnswerStatus createUserAnswerInstance(TreeItem anItem) { + public UserAnswerStatus createUserAnswerInstance(TreeItem anItem) { return new UnknownModelAnswerStatus(anItem); } Modified: WebEditor/src/edu/lnu/FireFly/WebEditor/ItemModels/UnknownModelAnswerStatus.java =================================================================== --- WebEditor/src/edu/lnu/FireFly/WebEditor/ItemModels/UnknownModelAnswerStatus.java 2008-05-23 14:26:18 UTC (rev 160) +++ WebEditor/src/edu/lnu/FireFly/WebEditor/ItemModels/UnknownModelAnswerStatus.java 2008-05-23 14:27:49 UTC (rev 161) @@ -2,6 +2,7 @@ import edu.lnu.FireFly.FFManifest.TreeItem; import edu.lnu.FireFly.Rte.Cmi; +import edu.lnu.FireFly.Rte.ElementName; public class UnknownModelAnswerStatus extends UserAnswerStatus { @@ -13,7 +14,8 @@ public void updateRteFields(Cmi cmi){ int interaction = 0; String cmiElement = "interactions." + interaction + ".learner_response"; - cmi.setValue(cmiElement, getRawAnswer()); + + cmi.setValue(new ElementName(cmiElement), "{" + Utils.getInstance().marge(getRawAnswer(), ",") + "}"); } @Override Modified: WebEditor/src/edu/lnu/FireFly/WebEditor/ItemModels/UserAnswerStatus.java =================================================================== --- WebEditor/src/edu/lnu/FireFly/WebEditor/ItemModels/UserAnswerStatus.java 2008-05-23 14:26:18 UTC (rev 160) +++ WebEditor/src/edu/lnu/FireFly/WebEditor/ItemModels/UserAnswerStatus.java 2008-05-23 14:27:49 UTC (rev 161) @@ -4,18 +4,18 @@ import edu.lnu.FireFly.Rte.Cmi; public abstract class UserAnswerStatus { - private String rawAnswer = ""; + private String[] rawAnswer = null; protected TreeItem item = null; public UserAnswerStatus(TreeItem anItem){ item = anItem; } - public String getRawAnswer() { + public String[] getRawAnswer() { return rawAnswer; } - public void setRawAnswer(String rawAnswer) { + public void setRawAnswer(String[] rawAnswer) { this.rawAnswer = rawAnswer; updateValues(); Added: WebEditor/src/edu/lnu/FireFly/WebEditor/ItemModels/Utils.java =================================================================== --- WebEditor/src/edu/lnu/FireFly/WebEditor/ItemModels/Utils.java (rev 0) +++ WebEditor/src/edu/lnu/FireFly/WebEditor/ItemModels/Utils.java 2008-05-23 14:27:49 UTC (rev 161) @@ -0,0 +1,31 @@ +package edu.lnu.FireFly.WebEditor.ItemModels; + +public class Utils { + public static Utils obj = null; + + private Utils(){ + + } + + public static Utils getInstance(){ + if (obj == null){ + obj = new Utils(); + } + + return obj; + } + + public String marge(String[] parts, String delimiter) { + String result = ""; + + for (int i = 0; i < parts.length; i++){ + result += parts[i]; + + if (i == parts.length - 1){ + result += delimiter; + } + } + + return result; + } +} Modified: WebEditor/src/edu/lnu/FireFly/WebEditor/WebEditor.java =================================================================== --- WebEditor/src/edu/lnu/FireFly/WebEditor/WebEditor.java 2008-05-23 14:26:18 UTC (rev 160) +++ WebEditor/src/edu/lnu/FireFly/WebEditor/WebEditor.java 2008-05-23 14:27:49 UTC (rev 161) @@ -12,7 +12,7 @@ import edu.lnu.FireFly.FFManifest.TreeItem; import edu.lnu.FireFly.FFManifest.parser.Parser; import edu.lnu.FireFly.FFManifest.parser.TestDocException; -import edu.lnu.FireFly.Rte.Activity; +import edu.lnu.FireFly.WebEditor.Data.AnswersStatusManager; import edu.lnu.FireFly.WebEditor.Data.AutoSaveThread; import edu.lnu.FireFly.WebEditor.Data.ManifestFactory; import edu.lnu.FireFly.WebEditor.Data.SummaryPageManager; @@ -23,168 +23,182 @@ import edu.lnu.FireFly.WebEditor.WSClients.WebEditorServiceClient; public class WebEditor extends AppletWithWYSIWYGEditor implements - ActionListener { + ActionListener { - /** - * - */ - private static final long serialVersionUID = 1144429894709918030L; + /** + * + */ + private static final long serialVersionUID = 1144429894709918030L; - protected static CourseTree courseTree; + protected static CourseTree courseTree; - public static WebEditor instance = null; + public static WebEditor instance = null; - protected Manifest manifest = null; + protected Manifest manifest = null; - protected JMenuItem openMenuItem = null; + protected JMenuItem openMenuItem = null; - protected JMenuItem saveMenuItem = null; + protected JMenuItem resetMenuItem = null; - private Thread threadForAautoSave; + protected JMenuItem saveMenuItem = null; - private AutoSaveThread autoSaveThread; + private Thread threadForAautoSave; - private JMenuItem publishMenuItem; + private AutoSaveThread autoSaveThread; - @Override - public void actionPerformed(ActionEvent arg0) { - try { - if (arg0.getSource() == openMenuItem) { - openManifest(); - } + private JMenuItem publishMenuItem; - if (arg0.getSource() == publishMenuItem) { - WebEditorServiceClient.getInstance().publish(); - } + @Override + public void actionPerformed(ActionEvent arg0) { + try { + if (arg0.getSource() == openMenuItem) { + openManifest(); + } - if (arg0.getSource() == saveMenuItem) { - saveManifest(); - } - } catch (Exception e) { - e.printStackTrace(); - } + if (arg0.getSource() == resetMenuItem) { + AnswersStatusManager.getInstance().resetAllAnswers(); + } + + if (arg0.getSource() == publishMenuItem) { + WebEditorServiceClient.getInstance().publish(); + } + + if (arg0.getSource() == saveMenuItem) { + saveManifest(); + } + } catch (Exception e) { + e.printStackTrace(); } + } - public void saveManifest() throws TestDocException { - Parser parser = new Parser(); - - autoSaveThread.reset(); + public void saveManifest() throws TestDocException { + Parser parser = new Parser(); - WebEditorServiceClient.getInstance().setFileContent("imsmanifest.xml", - parser.toXML(manifest)); - } + autoSaveThread.reset(); - public void openManifest() throws TestDocException { - Parser parser = new Parser(); - - autoSaveThread.reset(); - - manifest = parser.fromXML(WebEditorServiceClient.getInstance() - .getFileContent("imsmanifest.xml", "course")); - TreeDataModel.initInstance(manifest); + WebEditorServiceClient.getInstance().setFileContent("imsmanifest.xml", + parser.toXML(manifest)); + } - ItemModels.synchronizeAllItemDatas(manifest.getRoot()); - SummaryPageManager.getInstance().setManifest(manifest); - - Activity.fullsynchronizeActivitiesStructure(manifest); - } + public void openManifest() throws TestDocException { + Parser parser = new Parser(); - public Manifest getManifest() { - return manifest; - } + autoSaveThread.reset(); - @Override - public void init() { - parseParameter(); + manifest = parser.fromXML(WebEditorServiceClient.getInstance() + .getFileContent("imsmanifest.xml", "course")); + TreeDataModel.initInstance(manifest); - instance = this; + ItemModels.synchronizeAllItemDatas(manifest.getRoot()); + SummaryPageManager.getInstance().setManifest(manifest); - autoSaveThread = new AutoSaveThread(); - threadForAautoSave = new Thread(autoSaveThread); - threadForAautoSave.start(); + AnswersStatusManager.getInstance().resetAllAnswers(); + } - initMenu(); + public Manifest getManifest() { + return manifest; + } - try { - openManifest(); - } catch (TestDocException e) { - System.out.println("Can't load course. Creating new..."); - CreateNewCourse(); - } + @Override + public void init() { + parseParameter(); - courseTree = new CourseTree(TreeDataModel.getInstance(), getAppletContext()); - this.add(new JScrollPane(courseTree)); + instance = this; - courseTree.addMouseListener(new CourseTreePopupMenu()); + autoSaveThread = new AutoSaveThread(); + threadForAautoSave = new Thread(autoSaveThread); + threadForAautoSave.start(); + + initMenu(); + + try { + openManifest(); + } catch (TestDocException e) { + System.out.println("Can't load course. Creating new..."); + CreateNewCourse(); } - private void parseParameter() { - String paramCourseLocation = getParameter("courseLocation"); - String paramServiceLocation = getParameter("serviceLocation"); - String paramTemplateLocation = getParameter("templateLocation"); - String paramResourceLocation = getParameter("resourceLocation"); + courseTree = new CourseTree(TreeDataModel.getInstance(), + getAppletContext()); + this.add(new JScrollPane(courseTree)); - if (paramCourseLocation != null){ - Settings.getInstance().setCourseLocation(paramCourseLocation); - } - if (paramServiceLocation != null){ - Settings.getInstance().setServiceLocation(paramServiceLocation); - } - if (paramTemplateLocation != null){ - Settings.getInstance().setTemplateLocation(paramTemplateLocation); - } - if (paramResourceLocation != null){ - Settings.getInstance().setResourceLocation(paramResourceLocation); - } + courseTree.addMouseListener(new CourseTreePopupMenu()); + } + + private void parseParameter() { + String paramCourseLocation = getParameter("courseLocation"); + String paramServiceLocation = getParameter("serviceLocation"); + String paramTemplateLocation = getParameter("templateLocation"); + String paramResourceLocation = getParameter("resourceLocation"); + + if (paramCourseLocation != null) { + Settings.getInstance().setCourseLocation(paramCourseLocation); } + if (paramServiceLocation != null) { + Settings.getInstance().setServiceLocation(paramServiceLocation); + } + if (paramTemplateLocation != null) { + Settings.getInstance().setTemplateLocation(paramTemplateLocation); + } + if (paramResourceLocation != null) { + Settings.getInstance().setResourceLocation(paramResourceLocation); + } + } - private void CreateNewCourse() { - try { - manifest = ManifestFactory.createManifest(); - SummaryPageManager.getInstance().setManifest(manifest); - ItemModels.synchronizeAllItemDatas(manifest.getRoot()); - TreeDataModel.initInstance(manifest); + private void CreateNewCourse() { + try { + manifest = ManifestFactory.createManifest(); + SummaryPageManager.getInstance().setManifest(manifest); + ItemModels.synchronizeAllItemDatas(manifest.getRoot()); + TreeDataModel.initInstance(manifest); - TreeItem root = manifest.getRoot(); - OrganizationModel model = (OrganizationModel) ItemModels - .getModelFromItem(root); + TreeItem root = manifest.getRoot(); + OrganizationModel model = (OrganizationModel) ItemModels + .getModelFromItem(root); - model.synchronizeItemWithResource(root, "template"); - SummaryPageManager.getInstance().updateSummaryPages(); - - Activity.fullsynchronizeActivitiesStructure(manifest); - } catch (Exception e) { - e.printStackTrace(); - } + model.synchronizeItemWithResource(root, "template"); + SummaryPageManager.getInstance().updateSummaryPages(); + + AnswersStatusManager.getInstance().resetAllAnswers(); + } catch (Exception e) { + e.printStackTrace(); } + } - public void initMenu() { - // Create the menu bar - JMenuBar menuBar = new JMenuBar(); + public void initMenu() { + // Create the menu bar + JMenuBar menuBar = new JMenuBar(); - // Create a menu - JMenu menu = new JMenu("File"); - menuBar.add(menu); + // Create a menu + JMenu fileMenu = new JMenu("File"); + menuBar.add(fileMenu); - openMenuItem = new JMenuItem("Open"); - openMenuItem.addActionListener(this); - menu.add(openMenuItem); + JMenu editMenu = new JMenu("Edit"); + menuBar.add(editMenu); - // Create a menu item - saveMenuItem = new JMenuItem("Save"); - saveMenuItem.addActionListener(this); - menu.add(saveMenuItem); + resetMenuItem = new JMenuItem("Reset user activity"); + resetMenuItem.addActionListener(this); + fileMenu.add(resetMenuItem); - // Create a menu item - publishMenuItem = new JMenuItem("Publish"); - publishMenuItem.addActionListener(this); - menu.add(publishMenuItem); + openMenuItem = new JMenuItem("Open"); + openMenuItem.addActionListener(this); + fileMenu.add(openMenuItem); - // Install the menu bar in the frame - this.setJMenuBar(menuBar); - } + // Create a menu item + saveMenuItem = new JMenuItem("Save"); + saveMenuItem.addActionListener(this); + fileMenu.add(saveMenuItem); - public static CourseTree getCourseTree() { - return courseTree; - } + // Create a menu item + publishMenuItem = new JMenuItem("Publish"); + publishMenuItem.addActionListener(this); + fileMenu.add(publishMenuItem); + + // Install the menu bar in the frame + this.setJMenuBar(menuBar); + } + + public static CourseTree getCourseTree() { + return courseTree; + } } Modified: WebEditor/template/LectureModel.html =================================================================== --- WebEditor/template/LectureModel.html 2008-05-23 14:26:18 UTC (rev 160) +++ WebEditor/template/LectureModel.html 2008-05-23 14:27:49 UTC (rev 161) @@ -5,7 +5,7 @@ <script type="text/javascript" src="global/APIWrapper.js"></script> <script type="text/javascript"> function finish(){ - SetValue("cmi.completion_status", "completed"); + SetValue("cmi.answers.0.value", "read"); Terminate(); } </script> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <se...@us...> - 2008-05-23 17:44:46
|
Revision: 162 http://acmcontester.svn.sourceforge.net/acmcontester/?rev=162&view=rev Author: sem62 Date: 2008-05-23 10:44:49 -0700 (Fri, 23 May 2008) Log Message: ----------- * Using new RTE library. * Realizing mechanism for checking user answer. * CleenUp code. Modified Paths: -------------- WebEditor/resources/index.html WebEditor/src/edu/lnu/FireFly/WebEditor/AppletWithApiHandle.java WebEditor/src/edu/lnu/FireFly/WebEditor/AppletWithWYSIWYGEditor.java WebEditor/src/edu/lnu/FireFly/WebEditor/CourseTree.java WebEditor/src/edu/lnu/FireFly/WebEditor/Data/AnswersStatusManager.java WebEditor/src/edu/lnu/FireFly/WebEditor/Data/AutoSaveThread.java WebEditor/src/edu/lnu/FireFly/WebEditor/Data/ManifestFactory.java WebEditor/src/edu/lnu/FireFly/WebEditor/Data/SummaryPageManager.java WebEditor/src/edu/lnu/FireFly/WebEditor/GUI/CourseTreePopupMenu.java WebEditor/src/edu/lnu/FireFly/WebEditor/GUI/Dialogs/ChapterPropertiestsDlg.java WebEditor/src/edu/lnu/FireFly/WebEditor/GUI/Dialogs/CompileQ/CompileQPropertiestsDlg.java WebEditor/src/edu/lnu/FireFly/WebEditor/GUI/Dialogs/CompileQ/MultiLineCellRenderer.java WebEditor/src/edu/lnu/FireFly/WebEditor/GUI/Dialogs/CompileQ/MultiLineTableCellEditor.java WebEditor/src/edu/lnu/FireFly/WebEditor/GUI/Dialogs/CompileQ/PartAttributesCellEditor.java WebEditor/src/edu/lnu/FireFly/WebEditor/GUI/Dialogs/CompileQ/PartNumber.java WebEditor/src/edu/lnu/FireFly/WebEditor/GUI/Dialogs/CompileQ/PartNumberCellRenderer.java WebEditor/src/edu/lnu/FireFly/WebEditor/GUI/Dialogs/CompileQ/PartOptionsPanel.java WebEditor/src/edu/lnu/FireFly/WebEditor/GUI/Dialogs/LectureException.java WebEditor/src/edu/lnu/FireFly/WebEditor/GUI/Dialogs/LecturePropertiestsDlg.java WebEditor/src/edu/lnu/FireFly/WebEditor/GUI/Dialogs/PropertyDlg.java WebEditor/src/edu/lnu/FireFly/WebEditor/GUI/Dialogs/RenameDlg.java WebEditor/src/edu/lnu/FireFly/WebEditor/GUI/Dialogs/SimpleQuestionPropertiestsDlg.java WebEditor/src/edu/lnu/FireFly/WebEditor/GUI/JMenuItemContainedModel.java WebEditor/src/edu/lnu/FireFly/WebEditor/GUI/Reorganizer.java WebEditor/src/edu/lnu/FireFly/WebEditor/GUI/TreeDataModel.java WebEditor/src/edu/lnu/FireFly/WebEditor/ItemModels/Chapter/ChapterItemData.java WebEditor/src/edu/lnu/FireFly/WebEditor/ItemModels/Chapter/ChapterModel.java WebEditor/src/edu/lnu/FireFly/WebEditor/ItemModels/CompileQ/CompileQData.java WebEditor/src/edu/lnu/FireFly/WebEditor/ItemModels/CompileQ/CompileQModel.java WebEditor/src/edu/lnu/FireFly/WebEditor/ItemModels/CompileQ/CompileQPart.java WebEditor/src/edu/lnu/FireFly/WebEditor/ItemModels/CompileQ/PartAttributes.java WebEditor/src/edu/lnu/FireFly/WebEditor/ItemModels/ItemData.java WebEditor/src/edu/lnu/FireFly/WebEditor/ItemModels/ItemModel.java WebEditor/src/edu/lnu/FireFly/WebEditor/ItemModels/ItemModels.java WebEditor/src/edu/lnu/FireFly/WebEditor/ItemModels/Lecture/LectureData.java WebEditor/src/edu/lnu/FireFly/WebEditor/ItemModels/Lecture/LectureModel.java WebEditor/src/edu/lnu/FireFly/WebEditor/ItemModels/OrganizationModel.java WebEditor/src/edu/lnu/FireFly/WebEditor/ItemModels/ResourcedItemModel.java WebEditor/src/edu/lnu/FireFly/WebEditor/ItemModels/SimpleQuestion/SimpleQuestionAnswer.java WebEditor/src/edu/lnu/FireFly/WebEditor/ItemModels/SimpleQuestion/SimpleQuestionAnswersDataModel.java WebEditor/src/edu/lnu/FireFly/WebEditor/ItemModels/SimpleQuestion/SimpleQuestionData.java WebEditor/src/edu/lnu/FireFly/WebEditor/ItemModels/SimpleQuestion/SimpleQuestionException.java WebEditor/src/edu/lnu/FireFly/WebEditor/ItemModels/SimpleQuestion/SimpleQuestionModel.java WebEditor/src/edu/lnu/FireFly/WebEditor/ItemModels/SummaryPageModel/SummaryPageData.java WebEditor/src/edu/lnu/FireFly/WebEditor/ItemModels/SummaryPageModel/SummaryPageModel.java WebEditor/src/edu/lnu/FireFly/WebEditor/ItemModels/Template.java WebEditor/src/edu/lnu/FireFly/WebEditor/ItemModels/UnknownItemModel.java WebEditor/src/edu/lnu/FireFly/WebEditor/ItemModels/UnknownModelAnswerStatus.java WebEditor/src/edu/lnu/FireFly/WebEditor/ItemModels/Utils.java WebEditor/src/edu/lnu/FireFly/WebEditor/Settings.java WebEditor/src/edu/lnu/FireFly/WebEditor/WSClients/WebEditorServiceClient.java WebEditor/src/edu/lnu/FireFly/WebEditor/WebEditor.java WebEditor/template/global/SummaryPage.js WebEditor/template/global/simpleQ.js Added Paths: ----------- WebEditor/src/edu/lnu/FireFly/WebEditor/UserAnswerStatus/ WebEditor/src/edu/lnu/FireFly/WebEditor/UserAnswerStatus/LectureUserAnswerStatus.java WebEditor/src/edu/lnu/FireFly/WebEditor/UserAnswerStatus/ScoredUserAnswerStatus.java WebEditor/src/edu/lnu/FireFly/WebEditor/UserAnswerStatus/UserAnswerStatus.java WebEditor/template/global/images/failed.gif WebEditor/template/global/images/passed.gif Removed Paths: ------------- WebEditor/src/edu/lnu/FireFly/WebEditor/ItemModels/LectureUserAnswerStatus.java WebEditor/src/edu/lnu/FireFly/WebEditor/ItemModels/ScoredUserAnswerStatus.java WebEditor/src/edu/lnu/FireFly/WebEditor/ItemModels/UserAnswerStatus.java Modified: WebEditor/resources/index.html =================================================================== --- WebEditor/resources/index.html 2008-05-23 14:27:49 UTC (rev 161) +++ WebEditor/resources/index.html 2008-05-23 17:44:49 UTC (rev 162) @@ -128,7 +128,7 @@ </tr> </tbody> </table> - <tr><td><input type=text id='getval'><input type='button' onclick="getVal();"><td><input id='getvalres'></td></tr> + <!--tr><td><input type=text id='getval'><input type='button' value='SetValue' onclick="getVal();"><input id='getvalres'></td></tr--> </table> </body> Modified: WebEditor/src/edu/lnu/FireFly/WebEditor/AppletWithApiHandle.java =================================================================== --- WebEditor/src/edu/lnu/FireFly/WebEditor/AppletWithApiHandle.java 2008-05-23 14:27:49 UTC (rev 161) +++ WebEditor/src/edu/lnu/FireFly/WebEditor/AppletWithApiHandle.java 2008-05-23 17:44:49 UTC (rev 162) @@ -32,7 +32,9 @@ public String Initialize(String parameter) { System.out.print("Initialize(" + parameter + ");\n"); - GlobalStateInformation.setCurrentActivity(SummaryPageManager.getInstance().getManifest().findItemByIdentifier(nextItemIdentifier)); + GlobalStateInformation.setCurrentActivity(SummaryPageManager + .getInstance().getManifest().findItemByIdentifier( + nextItemIdentifier)); return "true"; } Modified: WebEditor/src/edu/lnu/FireFly/WebEditor/AppletWithWYSIWYGEditor.java =================================================================== --- WebEditor/src/edu/lnu/FireFly/WebEditor/AppletWithWYSIWYGEditor.java 2008-05-23 14:27:49 UTC (rev 161) +++ WebEditor/src/edu/lnu/FireFly/WebEditor/AppletWithWYSIWYGEditor.java 2008-05-23 17:44:49 UTC (rev 162) @@ -5,63 +5,63 @@ import netscape.javascript.JSObject; import edu.lnu.FireFly.WebEditor.GUI.Dialogs.PropertyDlg; -public class AppletWithWYSIWYGEditor extends AppletWithApiHandle{ - private boolean htmlEditing = false; - private JTextComponent textField = null; - private PropertyDlg editingDlg = null; +public class AppletWithWYSIWYGEditor extends AppletWithApiHandle { + private boolean htmlEditing = false; + private JTextComponent textField = null; + private PropertyDlg editingDlg = null; - public void htmlEdit(JTextComponent captionTextField2, PropertyDlg dlg) { - JSObject win = JSObject.getWindow(this); - Object[] params = new String[1]; - params[0] = captionTextField2.getText(); - - htmlEditing = true; - textField = captionTextField2; - editingDlg = dlg; - - lockPropertyDlg(); - win.call("showEditor", params); - } - - public String getEditedHTML(){ - return textField.getText(); - } + public void htmlEdit(JTextComponent captionTextField2, PropertyDlg dlg) { + JSObject win = JSObject.getWindow(this); + Object[] params = new String[1]; + params[0] = captionTextField2.getText(); - public void cancelHtmlEditing(){ - unlockPropertyDlg(); + htmlEditing = true; + textField = captionTextField2; + editingDlg = dlg; - textField = null; - editingDlg = null; - htmlEditing = false; - - System.out.println("Canceled html editing"); - } + lockPropertyDlg(); + win.call("showEditor", params); + } - private void unlockPropertyDlg() { - editingDlg.setEnabled(true); - } - - public void setEditedHTML(String newHTML){ - if (!htmlEditing){ - return; - } - textField.setText(newHTML); - editingDlg.editedHtmlTextWasSet(); - - htmlEditing = false; - unlockPropertyDlg(); - } + public String getEditedHTML() { + return textField.getText(); + } - private void lockPropertyDlg() { - editingDlg.setEnabled(false); + public void cancelHtmlEditing() { + unlockPropertyDlg(); + + textField = null; + editingDlg = null; + htmlEditing = false; + + System.out.println("Canceled html editing"); + } + + private void unlockPropertyDlg() { + editingDlg.setEnabled(true); + } + + public void setEditedHTML(String newHTML) { + if (!htmlEditing) { + return; } + textField.setText(newHTML); + editingDlg.editedHtmlTextWasSet(); - /** - * - */ - private static final long serialVersionUID = 1L; + htmlEditing = false; + unlockPropertyDlg(); + } - public boolean isHtmlEditing() { - return htmlEditing; - } + private void lockPropertyDlg() { + editingDlg.setEnabled(false); + } + + /** + * + */ + private static final long serialVersionUID = 1L; + + public boolean isHtmlEditing() { + return htmlEditing; + } } Modified: WebEditor/src/edu/lnu/FireFly/WebEditor/CourseTree.java =================================================================== --- WebEditor/src/edu/lnu/FireFly/WebEditor/CourseTree.java 2008-05-23 14:27:49 UTC (rev 161) +++ WebEditor/src/edu/lnu/FireFly/WebEditor/CourseTree.java 2008-05-23 17:44:49 UTC (rev 162) @@ -39,7 +39,7 @@ if (e.getNewLeadSelectionPath() == null) { try { AppletWithApiHandle.setNextItemIdentifier(""); - + getAppletContext().showDocument( new URL(Settings.getInstance().getResourceLocation() + "/empty.htm"), "ContentFrame"); @@ -55,7 +55,7 @@ if (e.getNewLeadSelectionPath().getLastPathComponent().getClass() == Item.class) { Item item = (Item) e.getNewLeadSelectionPath() .getLastPathComponent(); - + AppletWithApiHandle.setNextItemIdentifier(item.identifier); try { Modified: WebEditor/src/edu/lnu/FireFly/WebEditor/Data/AnswersStatusManager.java =================================================================== --- WebEditor/src/edu/lnu/FireFly/WebEditor/Data/AnswersStatusManager.java 2008-05-23 14:27:49 UTC (rev 161) +++ WebEditor/src/edu/lnu/FireFly/WebEditor/Data/AnswersStatusManager.java 2008-05-23 17:44:49 UTC (rev 162) @@ -9,7 +9,7 @@ import edu.lnu.FireFly.Rte.CmiManager; import edu.lnu.FireFly.WebEditor.ItemModels.ItemModel; import edu.lnu.FireFly.WebEditor.ItemModels.ItemModels; -import edu.lnu.FireFly.WebEditor.ItemModels.UserAnswerStatus; +import edu.lnu.FireFly.WebEditor.UserAnswerStatus.UserAnswerStatus; public class AnswersStatusManager { private HashMap<TreeItem, UserAnswerStatus> answerStatus = new HashMap<TreeItem, UserAnswerStatus>(); @@ -18,34 +18,34 @@ private AnswersStatusManager() { } - - public void resetAllAnswers(){ + + public void resetAllAnswers() { answerStatus.clear(); - + Manifest manifest = SummaryPageManager.getInstance().getManifest(); - + TreeItem root = null; try { root = manifest.getRoot(); } catch (TestDocException e) { e.printStackTrace(); - - return ; + + return; } - + updateAllCmiModels(root); } public void updateAllCmiModels(TreeItem root) { ItemModel itemModel = ItemModels.getModelFromItem(root); - + Cmi cmi = CmiManager.getInstance().getModelForActivity(root); cmi.clearAnswers(); - + itemModel.handleUserAnswer(root); - - for (int i=0; i < root.getChildCount(); i++){ + + for (int i = 0; i < root.getChildCount(); i++) { updateAllCmiModels(root.getChild(i)); } } @@ -56,7 +56,8 @@ if (userAnswerStatus == null) { ItemModel itemModel = ItemModels.getModelFromItem(anItem); - answerStatus.put(anItem, itemModel.createUserAnswerInstance(anItem)); + answerStatus + .put(anItem, itemModel.createUserAnswerInstance(anItem)); userAnswerStatus = answerStatus.get(anItem); } Modified: WebEditor/src/edu/lnu/FireFly/WebEditor/Data/AutoSaveThread.java =================================================================== --- WebEditor/src/edu/lnu/FireFly/WebEditor/Data/AutoSaveThread.java 2008-05-23 14:27:49 UTC (rev 161) +++ WebEditor/src/edu/lnu/FireFly/WebEditor/Data/AutoSaveThread.java 2008-05-23 17:44:49 UTC (rev 162) @@ -6,36 +6,37 @@ public class AutoSaveThread implements Runnable { - private long nextSaveAt = 0; - - @Override - public void run() { - reset(); + private long nextSaveAt = 0; - try { - while (true) { - Thread.sleep(5000); - if (System.currentTimeMillis() > nextSaveAt){ - processSave(); - reset(); - } - } - } catch (InterruptedException e) { - // If interrupt sleepping. - // Do nothing + @Override + public void run() { + reset(); + + try { + while (true) { + Thread.sleep(5000); + if (System.currentTimeMillis() > nextSaveAt) { + processSave(); + reset(); } + } + } catch (InterruptedException e) { + // If interrupt sleepping. + // Do nothing } + } - public void reset() { - nextSaveAt = System.currentTimeMillis() + Settings.getInstance().getAutoSaveInterval(); - } + public void reset() { + nextSaveAt = System.currentTimeMillis() + + Settings.getInstance().getAutoSaveInterval(); + } - private void processSave() { - try { - WebEditor.instance.saveManifest(); - } catch (TestDocException e) { - System.out.println("WARNING: Can't save manifest."); - } + private void processSave() { + try { + WebEditor.instance.saveManifest(); + } catch (TestDocException e) { + System.out.println("WARNING: Can't save manifest."); } + } } Modified: WebEditor/src/edu/lnu/FireFly/WebEditor/Data/ManifestFactory.java =================================================================== --- WebEditor/src/edu/lnu/FireFly/WebEditor/Data/ManifestFactory.java 2008-05-23 14:27:49 UTC (rev 161) +++ WebEditor/src/edu/lnu/FireFly/WebEditor/Data/ManifestFactory.java 2008-05-23 17:44:49 UTC (rev 162) @@ -17,70 +17,69 @@ import edu.lnu.FireFly.WebEditor.ItemModels.Chapter.ChapterItemData; public class ManifestFactory { - static public Manifest createManifest(){ - Manifest manifest = new Manifest(); - - manifest.setIdentifier(UUID.randomUUID().toString()); - manifest.setOrganizations(createOrganizations()); - manifest.setResources(new Resources()); + static public Manifest createManifest() { + Manifest manifest = new Manifest(); - OrganizationModel model = null; - TreeItem root = null; - try{ - root = manifest.getRoot(); - model = new OrganizationModel(); - } - catch (Exception e) { - e.printStackTrace(); - return null; - } + manifest.setIdentifier(UUID.randomUUID().toString()); + manifest.setOrganizations(createOrganizations()); + manifest.setResources(new Resources()); - model.setItemData(root, new ChapterItemData()); - model.updateItemResource(root, false); - - return manifest; + OrganizationModel model = null; + TreeItem root = null; + try { + root = manifest.getRoot(); + model = new OrganizationModel(); + } catch (Exception e) { + e.printStackTrace(); + return null; } - - static public Organizations createOrganizations(){ - Organizations organizations = new Organizations(); - Organization organization = new Organization(); - organization.setIdentifier(UUID.randomUUID().toString()); - organization.setTitle("New organization"); - organizations.addDefaultOrganization(organization); - - return organizations; - } - - static public Sequencing createSequencing(){ - return new Sequencing(); - } + model.setItemData(root, new ChapterItemData()); + model.updateItemResource(root, false); - static public LimitConditions createLimitConditions(){ - return new LimitConditions(); - } + return manifest; + } - public static Objectives createObjectives() { - return new Objectives(); - } + static public Organizations createOrganizations() { + Organizations organizations = new Organizations(); + Organization organization = new Organization(); + organization.setIdentifier(UUID.randomUUID().toString()); + organization.setTitle("New organization"); - public static Objective createObjective() { - return new Objective(); - } + organizations.addDefaultOrganization(organization); - public static ArrayList<MapInfo> createMapInfos() { - return new ArrayList<MapInfo>(); - } + return organizations; + } - public static MapInfo createMapInfo() { - return new MapInfo(); - } + static public Sequencing createSequencing() { + return new Sequencing(); + } - public static MapInfo createMapInfo(String targetObjectiveID) { - MapInfo mapInfo = new MapInfo(); - - mapInfo.targetObjectiveID = targetObjectiveID; - - return mapInfo; - } + static public LimitConditions createLimitConditions() { + return new LimitConditions(); + } + + public static Objectives createObjectives() { + return new Objectives(); + } + + public static Objective createObjective() { + return new Objective(); + } + + public static ArrayList<MapInfo> createMapInfos() { + return new ArrayList<MapInfo>(); + } + + public static MapInfo createMapInfo() { + return new MapInfo(); + } + + public static MapInfo createMapInfo(String targetObjectiveID) { + MapInfo mapInfo = new MapInfo(); + + mapInfo.targetObjectiveID = targetObjectiveID; + + return mapInfo; + } } Modified: WebEditor/src/edu/lnu/FireFly/WebEditor/Data/SummaryPageManager.java =================================================================== --- WebEditor/src/edu/lnu/FireFly/WebEditor/Data/SummaryPageManager.java 2008-05-23 14:27:49 UTC (rev 161) +++ WebEditor/src/edu/lnu/FireFly/WebEditor/Data/SummaryPageManager.java 2008-05-23 17:44:49 UTC (rev 162) @@ -16,205 +16,205 @@ import edu.lnu.FireFly.WebEditor.ItemModels.SummaryPageModel.SummaryPageModel; public class SummaryPageManager { - private SummaryPageManager() { - } + private SummaryPageManager() { + } - private static SummaryPageManager obj = null; + private static SummaryPageManager obj = null; - public static SummaryPageManager getInstance() { - if (obj == null) { - obj = new SummaryPageManager(); - } - - return obj; + public static SummaryPageManager getInstance() { + if (obj == null) { + obj = new SummaryPageManager(); } - protected Manifest manifest = null; + return obj; + } - public Manifest getManifest() { - return manifest; - } + protected Manifest manifest = null; - public void setManifest(Manifest manifest) { - this.manifest = manifest; - } + public Manifest getManifest() { + return manifest; + } - public void updateSummaryPages(TreeItem root) throws TestDocException { - pushDownSummaryPage(root); + public void setManifest(Manifest manifest) { + this.manifest = manifest; + } - for (int i = 0; i < root.getChildCount(); i++) { - TreeItem item = root.getChild(i); - ItemModel model = ItemModels.getModelFromItem(item); + public void updateSummaryPages(TreeItem root) throws TestDocException { + pushDownSummaryPage(root); - if (model.getClass() == OrganizationModel.class - || model.getClass() == ChapterModel.class) { - updateSummaryPages(item); - } - } + for (int i = 0; i < root.getChildCount(); i++) { + TreeItem item = root.getChild(i); + ItemModel model = ItemModels.getModelFromItem(item); - boolean showSummaryPage = isShowSummaryPageForItem(root); + if (model.getClass() == OrganizationModel.class + || model.getClass() == ChapterModel.class) { + updateSummaryPages(item); + } + } - if (showSummaryPage) { - createSummaryPageIfNotExists(root); - Item summaryPage = (Item) root.getChild(root.getChildCount() - 1); - ItemModel model = ItemModels.getModelFromItem(summaryPage); + boolean showSummaryPage = isShowSummaryPageForItem(root); - insertAllNeededObjectivesIntoSummaryPage(root); + if (showSummaryPage) { + createSummaryPageIfNotExists(root); + Item summaryPage = (Item) root.getChild(root.getChildCount() - 1); + ItemModel model = ItemModels.getModelFromItem(summaryPage); - ((SummaryPageModel) model).updateItemResource(summaryPage, false); - } else { - deleteSummaryPageIfExists(root); - } + insertAllNeededObjectivesIntoSummaryPage(root); + + ((SummaryPageModel) model).updateItemResource(summaryPage, false); + } else { + deleteSummaryPageIfExists(root); } + } - private void insertAllNeededObjectivesIntoSummaryPage(TreeItem root) { - Item summaryPage = (Item) root.getChild(root.getChildCount() - 1); + private void insertAllNeededObjectivesIntoSummaryPage(TreeItem root) { + Item summaryPage = (Item) root.getChild(root.getChildCount() - 1); - ArrayList<String> objectiveIds = getShowingItemsIds(root); + ArrayList<String> objectiveIds = getShowingItemsIds(root); - ItemModel model = ItemModels.getModelFromItem(summaryPage); - Objectives objectives = model.getObjectivesInstance(summaryPage); - objectives.objective = new ArrayList<Objective>(); + ItemModel model = ItemModels.getModelFromItem(summaryPage); + Objectives objectives = model.getObjectivesInstance(summaryPage); + objectives.objective = new ArrayList<Objective>(); - for (int i = 0; i < objectiveIds.size(); i++) { - String objectiveId = objectiveIds.get(i); - Objective objective = ManifestFactory.createObjective(); + for (int i = 0; i < objectiveIds.size(); i++) { + String objectiveId = objectiveIds.get(i); + Objective objective = ManifestFactory.createObjective(); - objective.objectiveID = objectiveId; - objective.mapInfo.add(ManifestFactory.createMapInfo(objectiveId)); + objective.objectiveID = objectiveId; + objective.mapInfo.add(ManifestFactory.createMapInfo(objectiveId)); - summaryPage.sequencing.objectives.objective.add(objective); - } + summaryPage.sequencing.objectives.objective.add(objective); } + } - private ArrayList<String> getShowingItemsIds(TreeItem root) { - ArrayList<String> result = new ArrayList<String>(); + private ArrayList<String> getShowingItemsIds(TreeItem root) { + ArrayList<String> result = new ArrayList<String>(); - for (int i = 0; i < root.getChildCount(); i++) { - TreeItem item = root.getChild(i); - ItemModel model = ItemModels.getModelFromItem(item); - if (model.getShowOnSummaryPage(item)) { - result.add(model.getIdentifier(item)); - } + for (int i = 0; i < root.getChildCount(); i++) { + TreeItem item = root.getChild(i); + ItemModel model = ItemModels.getModelFromItem(item); + if (model.getShowOnSummaryPage(item)) { + result.add(model.getIdentifier(item)); + } - for (int j = 0; j < item.getChildCount(); j++) { - TreeItem child = item.getChild(j); - ItemModel childModel = ItemModels.getModelFromItem(child); + for (int j = 0; j < item.getChildCount(); j++) { + TreeItem child = item.getChild(j); + ItemModel childModel = ItemModels.getModelFromItem(child); - if (childModel.getShowOnSummaryPage(child)) { - result.add(model.getIdentifier(child)); - result.addAll(getShowingItemsIds(child)); - } - } + if (childModel.getShowOnSummaryPage(child)) { + result.add(model.getIdentifier(child)); + result.addAll(getShowingItemsIds(child)); } - - return result; + } } - private void recursivlyUpdateObjectives(TreeItem root) { - - ItemModel model = ItemModels.getModelFromItem(root); - model.updateItemObjectives(root); + return result; + } - for (int i = 0; i < root.getChildCount(); i++) { - recursivlyUpdateObjectives(root.getChild(i)); - } + private void recursivlyUpdateObjectives(TreeItem root) { + + ItemModel model = ItemModels.getModelFromItem(root); + model.updateItemObjectives(root); + + for (int i = 0; i < root.getChildCount(); i++) { + recursivlyUpdateObjectives(root.getChild(i)); } + } - private void createSummaryPageIfNotExists(TreeItem root) { - int childsCount = root.getChildCount(); + private void createSummaryPageIfNotExists(TreeItem root) { + int childsCount = root.getChildCount(); - if (childsCount > 0) { - TreeItem lastItem = root.getChild(childsCount - 1); - ItemModel lastItemModel = ItemModels.getModelFromItem(lastItem); - if (lastItemModel.getClass() == SummaryPageModel.class) { - return; - } - } - SummaryPageModel model = new SummaryPageModel(); - model.addItem(root); + if (childsCount > 0) { + TreeItem lastItem = root.getChild(childsCount - 1); + ItemModel lastItemModel = ItemModels.getModelFromItem(lastItem); + if (lastItemModel.getClass() == SummaryPageModel.class) { + return; + } } + SummaryPageModel model = new SummaryPageModel(); + model.addItem(root); + } - private void deleteSummaryPageIfExists(TreeItem root) { - int childsCount = root.getChildCount(); + private void deleteSummaryPageIfExists(TreeItem root) { + int childsCount = root.getChildCount(); - if (childsCount == 0) { - return; - } + if (childsCount == 0) { + return; + } - TreeItem lastItem = root.getChild(childsCount - 1); - ItemModel lastItemModel = ItemModels.getModelFromItem(lastItem); - if (lastItemModel.getClass() == SummaryPageModel.class) { - SummaryPageModel model = new SummaryPageModel(); - model.remove(lastItem); - } + TreeItem lastItem = root.getChild(childsCount - 1); + ItemModel lastItemModel = ItemModels.getModelFromItem(lastItem); + if (lastItemModel.getClass() == SummaryPageModel.class) { + SummaryPageModel model = new SummaryPageModel(); + model.remove(lastItem); } + } - private boolean isShowSummaryPageForItem(TreeItem root) - throws TestDocException { + private boolean isShowSummaryPageForItem(TreeItem root) + throws TestDocException { - boolean showSummaryPage = false; - ItemModel rootModel = ItemModels.getModelFromItem(root); + boolean showSummaryPage = false; + ItemModel rootModel = ItemModels.getModelFromItem(root); - if (rootModel.getClass() == ChapterModel.class - || rootModel.getClass() == OrganizationModel.class) { - ChapterModel model = (ChapterModel) rootModel; + if (rootModel.getClass() == ChapterModel.class + || rootModel.getClass() == OrganizationModel.class) { + ChapterModel model = (ChapterModel) rootModel; - showSummaryPage = model.getShowSummaryPage(root); - } else { - throw new TestDocException( - "Root element must be a chapter or an organization"); - } - - return showSummaryPage; + showSummaryPage = model.getShowSummaryPage(root); + } else { + throw new TestDocException( + "Root element must be a chapter or an organization"); } - private void recursivlyUpdateChapters(TreeItem root) - throws TestDocException { - int childsCount = root.getChildCount(); - for (int i = 0; i < childsCount; i++) { - Item item = (Item) root.getChild(i); - ItemModel itemModel = ItemModels.getModelFromItem(item); + return showSummaryPage; + } - if (itemModel.getClass() == ChapterModel.class) { - updateSummaryPages(item); - } - } + private void recursivlyUpdateChapters(TreeItem root) + throws TestDocException { + int childsCount = root.getChildCount(); + for (int i = 0; i < childsCount; i++) { + Item item = (Item) root.getChild(i); + ItemModel itemModel = ItemModels.getModelFromItem(item); + + if (itemModel.getClass() == ChapterModel.class) { + updateSummaryPages(item); + } } + } - private void pushDownSummaryPage(TreeItem root) throws TestDocException { - int childsCount = root.getChildCount(); + private void pushDownSummaryPage(TreeItem root) throws TestDocException { + int childsCount = root.getChildCount(); - for (int i = 0; i < childsCount; i++) { - Item item = (Item) root.getChild(i); - ItemModel itemModel = ItemModels.getModelFromItem(item); + for (int i = 0; i < childsCount; i++) { + Item item = (Item) root.getChild(i); + ItemModel itemModel = ItemModels.getModelFromItem(item); - if (itemModel.getClass() == SummaryPageModel.class) { - if (i != childsCount - 1) { - ItemModel lastItemModel = ItemModels.getModelFromItem(root - .getChild(childsCount - 1)); + if (itemModel.getClass() == SummaryPageModel.class) { + if (i != childsCount - 1) { + ItemModel lastItemModel = ItemModels.getModelFromItem(root + .getChild(childsCount - 1)); - if (lastItemModel.getClass() == SummaryPageModel.class) { - throw new TestDocException( - "Count of summary pages is graiter than one!!!"); - } + if (lastItemModel.getClass() == SummaryPageModel.class) { + throw new TestDocException( + "Count of summary pages is graiter than one!!!"); + } - Reorganizer.getInstance().moveDown(item); - } - } + Reorganizer.getInstance().moveDown(item); } - - //TreeDataModel.getInstance().updateAllTree(); + } } - public void updateSummaryPages() { - try { - recursivlyUpdateChapters(manifest.getRoot()); - recursivlyUpdateObjectives(manifest.getRoot()); - updateSummaryPages(manifest.getRoot()); - } catch (TestDocException e) { - e.printStackTrace(); - } + // TreeDataModel.getInstance().updateAllTree(); + } + + public void updateSummaryPages() { + try { + recursivlyUpdateChapters(manifest.getRoot()); + recursivlyUpdateObjectives(manifest.getRoot()); + updateSummaryPages(manifest.getRoot()); + } catch (TestDocException e) { + e.printStackTrace(); } + } } Modified: WebEditor/src/edu/lnu/FireFly/WebEditor/GUI/CourseTreePopupMenu.java =================================================================== --- WebEditor/src/edu/lnu/FireFly/WebEditor/GUI/CourseTreePopupMenu.java 2008-05-23 14:27:49 UTC (rev 161) +++ WebEditor/src/edu/lnu/FireFly/WebEditor/GUI/CourseTreePopupMenu.java 2008-05-23 17:44:49 UTC (rev 162) @@ -32,531 +32,531 @@ import edu.lnu.FireFly.WebEditor.ItemModels.SummaryPageModel.SummaryPageModel; public class CourseTreePopupMenu extends MouseAdapter implements - ActionListener, ChangeListener { + ActionListener, ChangeListener { - protected JMenu addItemMenu; - protected JMenu changeTypeMenu; - protected TreeItem manifestItem = null; - protected JPopupMenu menu; - protected JMenuItem moveDownItemMenu; - protected JMenuItem moveUpItemMenu; - protected JMenuItem propertyItemMenu; - protected JMenuItem removeItemMenu; - protected JMenuItem renameItemMenu; - protected JCheckBoxMenuItem showOnSummaryPageMenuItem; - protected JCheckBoxMenuItem showSummaryPageMenuItem; - protected JMenu limitConditionsMenu; - protected JMenu attemptLimitMenu; - protected JRadioButtonMenuItem attemptLimitNoneItemMenu; - protected JRadioButtonMenuItem attemptLimit1ItemMenu; - protected JRadioButtonMenuItem attemptLimit3ItemMenu; - protected JRadioButtonMenuItem attemptLimit5ItemMenu; - protected JRadioButtonMenuItem attemptLimit10ItemMenu; - protected JRadioButtonMenuItem attemptLimitOtherItemMenu; - protected JMenu attemptAbsoluteDurationMenu; - protected JRadioButtonMenuItem attemptAbsoluteDuration1minItemMenu; - protected JRadioButtonMenuItem attemptAbsoluteDurationNoneItemMenu; - protected JRadioButtonMenuItem attemptAbsoluteDuration3minItemMenu; - protected JRadioButtonMenuItem attemptAbsoluteDuration30minItemMenu; - protected JRadioButtonMenuItem attemptAbsoluteDuration1hourItemMenu; - protected JRadioButtonMenuItem attemptAbsoluteDuration5hourItemMenu; - protected JRadioButtonMenuItem attemptAbsoluteDurationOtherItemMenu; + protected JMenu addItemMenu; + protected JMenu changeTypeMenu; + protected TreeItem manifestItem = null; + protected JPopupMenu menu; + protected JMenuItem moveDownItemMenu; + protected JMenuItem moveUpItemMenu; + protected JMenuItem propertyItemMenu; + protected JMenuItem removeItemMenu; + protected JMenuItem renameItemMenu; + protected JCheckBoxMenuItem showOnSummaryPageMenuItem; + protected JCheckBoxMenuItem showSummaryPageMenuItem; + protected JMenu limitConditionsMenu; + protected JMenu attemptLimitMenu; + protected JRadioButtonMenuItem attemptLimitNoneItemMenu; + protected JRadioButtonMenuItem attemptLimit1ItemMenu; + protected JRadioButtonMenuItem attemptLimit3ItemMenu; + protected JRadioButtonMenuItem attemptLimit5ItemMenu; + protected JRadioButtonMenuItem attemptLimit10ItemMenu; + protected JRadioButtonMenuItem attemptLimitOtherItemMenu; + protected JMenu attemptAbsoluteDurationMenu; + protected JRadioButtonMenuItem attemptAbsoluteDuration1minItemMenu; + protected JRadioButtonMenuItem attemptAbsoluteDurationNoneItemMenu; + protected JRadioButtonMenuItem attemptAbsoluteDuration3minItemMenu; + protected JRadioButtonMenuItem attemptAbsoluteDuration30minItemMenu; + protected JRadioButtonMenuItem attemptAbsoluteDuration1hourItemMenu; + protected JRadioButtonMenuItem attemptAbsoluteDuration5hourItemMenu; + protected JRadioButtonMenuItem attemptAbsoluteDurationOtherItemMenu; - public CourseTreePopupMenu() { - initReorganizeMenus(); - initSummaryPageMenus(); - initLimitConditionsMenu(); + public CourseTreePopupMenu() { + initReorganizeMenus(); + initSummaryPageMenus(); + initLimitConditionsMenu(); - menu = new JPopupMenu(); - addItemMenu = new JMenu("Add item"); + menu = new JPopupMenu(); + addItemMenu = new JMenu("Add item"); - changeTypeMenu = new JMenu("Chage type"); + changeTypeMenu = new JMenu("Chage type"); - propertyItemMenu = new JMenuItem("Property"); - propertyItemMenu.addActionListener(this); + propertyItemMenu = new JMenuItem("Property"); + propertyItemMenu.addActionListener(this); - menu.add(addItemMenu); - menu.add(changeTypeMenu); + menu.add(addItemMenu); + menu.add(changeTypeMenu); - menu.addSeparator(); + menu.addSeparator(); - menu.add(moveUpItemMenu); - menu.add(moveDownItemMenu); - menu.add(removeItemMenu); - menu.add(renameItemMenu); + menu.add(moveUpItemMenu); + menu.add(moveDownItemMenu); + menu.add(removeItemMenu); + menu.add(renameItemMenu); - menu.addSeparator(); + menu.addSeparator(); - menu.add(propertyItemMenu); - menu.add(limitConditionsMenu); - menu.add(showOnSummaryPageMenuItem); - menu.add(showSummaryPageMenuItem); + menu.add(propertyItemMenu); + menu.add(limitConditionsMenu); + menu.add(showOnSummaryPageMenuItem); + menu.add(showSummaryPageMenuItem); + } + + public void actionPerformed(java.awt.event.ActionEvent e) { + JMenuItem menuItem = (JMenuItem) e.getSource(); + + if (menuItem.getClass() == JMenuItemContainedModel.class) { + JMenuItemContainedModel myMenuItem = (JMenuItemContainedModel) menuItem; + if (myMenuItem.type == JMenuItemContainedModel.ADD_ITEM) { + myMenuItem.itemModel.addItem(manifestItem); + return; + } } - public void actionPerformed(java.awt.event.ActionEvent e) { - JMenuItem menuItem = (JMenuItem) e.getSource(); + ItemModel itemModel = ItemModels.getModelFromItem(manifestItem); + if (itemModel == null) { + System.out.print("Can't get model for item.\n"); + return; + } - if (menuItem.getClass() == JMenuItemContainedModel.class) { - JMenuItemContainedModel myMenuItem = (JMenuItemContainedModel) menuItem; - if (myMenuItem.type == JMenuItemContainedModel.ADD_ITEM) { - myMenuItem.itemModel.addItem(manifestItem); - return; - } - } + if (menuItem == renameItemMenu) { + itemModel.rename(manifestItem, RenameDlg.showDialog(manifestItem + .toString())); + } - ItemModel itemModel = ItemModels.getModelFromItem(manifestItem); - if (itemModel == null) { - System.out.print("Can't get model for item.\n"); - return; - } + if (menuItem == removeItemMenu) { + itemModel.remove(manifestItem); + } - if (menuItem == renameItemMenu) { - itemModel.rename(manifestItem, RenameDlg.showDialog(manifestItem - .toString())); - } + if (menuItem == propertyItemMenu) { + itemModel.ConfigureItem(manifestItem); + } - if (menuItem == removeItemMenu) { - itemModel.remove(manifestItem); - } + if (menuItem == moveUpItemMenu) { + Reorganizer.getInstance().moveUp(manifestItem); + } - if (menuItem == propertyItemMenu) { - itemModel.ConfigureItem(manifestItem); - } + if (menuItem == moveDownItemMenu) { + Reorganizer.getInstance().moveDown(manifestItem); + } + } - if (menuItem == moveUpItemMenu) { - Reorganizer.getInstance().moveUp(manifestItem); - } + private void attemptAbsoluteDurationStateChanged(ChangeEvent arg0) { + boolean attemptAbsoluteDurationPerformed = isAttemptAbsoluteDurationPerformed(arg0); - if (menuItem == moveDownItemMenu) { - Reorganizer.getInstance().moveDown(manifestItem); - } + if (attemptAbsoluteDurationPerformed) { + Duration duration = extractDurationLimitValue(arg0); + + setDurationLimit(duration); } + } - private void attemptAbsoluteDurationStateChanged(ChangeEvent arg0) { - boolean attemptAbsoluteDurationPerformed = isAttemptAbsoluteDurationPerformed(arg0); + private void attemptsLimitStateChanged(ChangeEvent arg0) { + boolean attemptLimitPerformed = isAttemptLimitPerformed(arg0); - if (attemptAbsoluteDurationPerformed) { - Duration duration = extractDurationLimitValue(arg0); + if (attemptLimitPerformed) { + Integer attemptLimit = extractAttemptLimitValue(arg0); - setDurationLimit(duration); - } + setAttemptLimitCount(attemptLimit); } - private void attemptsLimitStateChanged(ChangeEvent arg0) { - boolean attemptLimitPerformed = isAttemptLimitPerformed(arg0); + } - if (attemptLimitPerformed) { - Integer attemptLimit = extractAttemptLimitValue(arg0); + public void createAddAndChangeMenuItems() { + ArrayList<ItemModel> models = ItemModels.getAllModels(); + addItemMenu.removeAll(); + changeTypeMenu.removeAll(); - setAttemptLimitCount(attemptLimit); - } + JMenuItemContainedModel item; + for (int i = 0; i < models.size(); i++) { + if (models.get(i).canConvertItem(manifestItem)) { + item = new JMenuItemContainedModel(models.get(i), + JMenuItemContainedModel.CHANGE_ITEM_TYPE); + item.addActionListener(this); + changeTypeMenu.add(item); + } + if (models.get(i).canAddToItem(manifestItem)) { + item = new JMenuItemContainedModel(models.get(i), + JMenuItemContainedModel.ADD_ITEM); + item.addActionListener(this); + addItemMenu.add(item); + } } - public void createAddAndChangeMenuItems() { - ArrayList<ItemModel> models = ItemModels.getAllModels(); - addItemMenu.removeAll(); - changeTypeMenu.removeAll(); + changeTypeMenu.setVisible(changeTypeMenu.getComponentCount() != 0); + } - JMenuItemContainedModel item; - for (int i = 0; i < models.size(); i++) { - if (models.get(i).canConvertItem(manifestItem)) { - item = new JMenuItemContainedModel(models.get(i), - JMenuItemContainedModel.CHANGE_ITEM_TYPE); - item.addActionListener(this); - changeTypeMenu.add(item); - } + private void displayMenu(MouseEvent e) { + if (e.isPopupTrigger()) { + Point pt = e.getPoint(); + TreePath path = WebEditor.getCourseTree() + .getClosestPathForLocation(pt.x, pt.y); + WebEditor.getCourseTree().setSelectionPath(path); + manifestItem = (TreeItem) path.getLastPathComponent(); - if (models.get(i).canAddToItem(manifestItem)) { - item = new JMenuItemContainedModel(models.get(i), - JMenuItemContainedModel.ADD_ITEM); - item.addActionListener(this); - addItemMenu.add(item); - } - } + ItemModel model = ItemModels.getModelFromItem(manifestItem); + if (model == null) { + System.out.print("Can't find model for selected item !!!"); + return; + } - changeTypeMenu.setVisible(changeTypeMenu.getComponentCount() != 0); - } + prepareOrganizeMenuItems(); - private void displayMenu(MouseEvent e) { - if (e.isPopupTrigger()) { - Point pt = e.getPoint(); - TreePath path = WebEditor.getCourseTree() - .getClosestPathForLocation(pt.x, pt.y); - WebEditor.getCourseTree().setSelectionPath(path); - manifestItem = (TreeItem) path.getLastPathComponent(); + createAddAndChangeMenuItems(); - ItemModel model = ItemModels.getModelFromItem(manifestItem); - if (model == null) { - System.out.print("Can't find model for selected item !!!"); - return; - } + showOnSummaryPageMenuItem.setState(model + .getShowOnSummaryPage(manifestItem)); + showOnSummaryPageMenuItem.setVisible(model + .getShowOnSummaryPageMenuVisible()); - prepareOrganizeMenuItems(); + limitConditionsMenu.setVisible(model + .getLimitConditionsMenuVisible(manifestItem)); - createAddAndChangeMenuItems(); + showSummaryPageMenuItem.setVisible(model + .getShowSummaryPageMenuVisible()); - showOnSummaryPageMenuItem.setState(model - .getShowOnSummaryPage(manifestItem)); - showOnSummaryPageMenuItem.setVisible(model - .getShowOnSummaryPageMenuVisible()); + if (model.getShowSummaryPageMenuVisible()) { + ChapterModel chapterModel = (ChapterModel) model; - limitConditionsMenu.setVisible(model - .getLimitConditionsMenuVisible(manifestItem)); + showSummaryPageMenuItem.setState(chapterModel + .getShowSummaryPage(manifestItem)); + } - showSummaryPageMenuItem.setVisible(model - .getShowSummaryPageMenuVisible()); + addItemMenu.setVisible(model.isContainer() + && ItemModels.getAllModels().size() > 0); - if (model.getShowSummaryPageMenuVisible()) { - ChapterModel chapterModel = (ChapterModel) model; - - showSummaryPageMenuItem.setState(chapterModel - .getShowSummaryPage(manifestItem)); - } + removeItemMenu.setVisible(model.isRemovable()); - addItemMenu.setVisible(model.isContainer() - && ItemModels.getAllModels().size() > 0); + menu.show(e.getComponent(), e.getX(), e.getY()); + } + } - removeItemMenu.setVisible(model.isRemovable()); + private Integer extractAttemptLimitValue(ChangeEvent arg0) { + Integer attemptLimit = null; + if (arg0.getSource() == attemptLimitNoneItemMenu) { + if (((JRadioButtonMenuItem) arg0.getSource()).isSelected()) { + attemptLimit = null; + } + } - menu.show(e.getComponent(), e.getX(), e.getY()); - } + if (arg0.getSource() == attemptLimit1ItemMenu) { + if (((JRadioButtonMenuItem) arg0.getSource()).isSelected()) { + attemptLimit = 1; + } } - private Integer extractAttemptLimitValue(ChangeEvent arg0) { - Integer attemptLimit = null; - if (arg0.getSource() == attemptLimitNoneItemMenu) { - if (((JRadioButtonMenuItem) arg0.getSource()).isSelected()) { - attemptLimit = null; - } - } + if (arg0.getSource() == attemptLimit3ItemMenu) { + if (((JRadioButtonMenuItem) arg0.getSource()).isSelected()) { + attemptLimit = 3; + } + } - if (arg0.getSource() == attemptLimit1ItemMenu) { - if (((JRadioButtonMenuItem) arg0.getSource()).isSelected()) { - attemptLimit = 1; - } - } + if (arg0.getSource() == attemptLimit5ItemMenu) { + if (((JRadioButtonMenuItem) arg0.getSource()).isSelected()) { + attemptLimit = 5; + } + } - if (arg0.getSource() == attemptLimit3ItemMenu) { - if (((JRadioButtonMenuItem) arg0.getSource()).isSelected()) { - attemptLimit = 3; - } - } + if (arg0.getSource() == attemptLimit10ItemMenu) { + if (((JRadioButtonMenuItem) arg0.getSource()).isSelected()) { + attemptLimit = 10; + } + } - if (arg0.getSource() == attemptLimit5ItemMenu) { - if (((JRadioButtonMenuItem) arg0.getSource()).isSelected()) { - attemptLimit = 5; - } - } + if (arg0.getSource() == attemptLimitOtherItemMenu) { + if (((JRadioButtonMenuItem) arg0.getSource()).isSelected()) { + // TODO Need realize dialog box. + attemptLimit = 7; + } + } + return attemptLimit; + } - if (arg0.getSource() == attemptLimit10ItemMenu) { - if (((JRadioButtonMenuItem) arg0.getSource()).isSelected()) { - attemptLimit = 10; - } - } + private Duration extractDurationLimitValue(ChangeEvent arg0) { + Duration result = null; + DurationConverter converter = new DurationConverter(); - if (arg0.getSource() == attemptLimitOtherItemMenu) { - if (((JRadioButtonMenuItem) arg0.getSource()).isSelected()) { - // TODO Need realize dialog box. - attemptLimit = 7; - } - } - return attemptLimit; + if (arg0.getSource() == attemptAbsoluteDurationNoneItemMenu) { + if (((JRadioButtonMenuItem) arg0.getSource()).isSelected()) { + result = null; + } } - private Duration extractDurationLimitValue(ChangeEvent arg0) { - Duration result = null; - DurationConverter converter = new DurationConverter(); + if (arg0.getSource() == attemptAbsoluteDuration1minItemMenu) { + if (((JRadioButtonMenuItem) arg0.getSource()).isSelected()) { + result = (Duration) converter.fromString("PT1M"); + } + } - if (arg0.getSource() == attemptAbsoluteDurationNoneItemMenu) { - if (((JRadioButtonMenuItem) arg0.getSource()).isSelected()) { - result = null; - } - } + if (arg0.getSource() == attemptAbsoluteDuration3minItemMenu) { + if (((JRadioButtonMenuItem) arg0.getSource()).isSelected()) { + result = (Duration) converter.fromString("PT3M"); + } + } - if (arg0.getSource() == attemptAbsoluteDuration1minItemMenu) { - if (((JRadioButtonMenuItem) arg0.getSource()).isSelected()) { - result = (Duration) converter.fromString("PT1M"); - } - } + if (arg0.getSource() == attemptAbsoluteDuration30minItemMenu) { + if (((JRadioButtonMenuItem) arg0.getSource()).isSelected()) { + result = (Duration) converter.fromString("PT30M"); + } + } - if (arg0.getSource() == attemptAbsoluteDuration3minItemMenu) { - if (((JRadioButtonMenuItem) arg0.getSource()).isSelected()) { - result = (Duration) converter.fromString("PT3M"); - } - } + if (arg0.getSource() == attemptAbsoluteDuration1hourItemMenu) { + if (((JRadioButtonMenuItem) arg0.getSource()).isSelected()) { + result = (Duration) converter.fromString("PT1H"); + } + } - if (arg0.getSource() == attemptAbsoluteDuration30minItemMenu) { - if (((JRadioButtonMenuItem) arg0.getSource()).isSelected()) { - result = (Duration) converter.fromString("PT30M"); - } - } + if (arg0.getSource() == attemptAbsoluteDuration5hourItemMenu) { + if (((JRadioButtonMenuItem) arg0.getSource()).isSelected()) { + result = (Duration) converter.fromString("PT5H"); + } + } - if (arg0.getSource() == attemptAbsoluteDuration1hourItemMenu) { - if (((JRadioButtonMenuItem) arg0.getSource()).isSelected()) { - result = (Duration) converter.fromString("PT1H"); - } - } + if (arg0.getSource() == attemptAbsoluteDurationOtherItemMenu) { + if (((JRadioButtonMenuItem) arg0.getSource()).isSelected()) { + // TODO need realize dialogBox - if (arg0.getSource() == attemptAbsoluteDuration5hourItemMenu) { - if (((JRadioButtonMenuItem) arg0.getSource()).isSelected()) { - result = (Duration) converter.fromString("PT5H"); - } - } + result = (Duration) converter.fromString("PT7H"); + } + } - if (arg0.getSource() == attemptAbsoluteDurationOtherItemMenu) { - if (((JRadioButtonMenuItem) arg0.getSource()).isSelected()) { - // TODO need realize dialogBox + return result; + } - result = (Duration) converter.fromString("PT7H"); - } - } + private Sequencing getSequencingInstance() { + Sequencing sequencing = null; - return result; + if (manifestItem.getClass() == Organization.class) { + if (((Organization) manifestItem).sequencing == null) { + ((Organization) manifestItem).sequencing = ManifestFactory + .createSequencing(); + } + + sequencing = ((Organization) manifestItem).sequencing; } - private Sequencing getSequencingInstance() { - Sequencing sequencing = null; + if (manifestItem.getClass() == Item.class) { + if (((Item) manifestItem).sequencing == null) { + ((Item) manifestItem).sequencing = ManifestFactory + .createSequencing(); + } - if (manifestItem.getClass() == Organization.class) { - if (((Organization) manifestItem).sequencing == null) { - ((Organization) manifestItem).sequencing = ManifestFactory - .createSequencing(); - } + sequencing = ((Item) manifestItem).sequencing; + } + return sequencing; + } - sequencing = ((Organization) manifestItem).sequencing; - } + private void initAttemptAbsoluteDurationMenu() { + attemptAbsoluteDurationNoneItemMenu = new JRadioButtonMenuItem("None", + true); + attemptAbsoluteDuration1minItemMenu = new JRadioButtonMenuItem("1 min"); + attemptAbsoluteDuration3minItemMenu = new JRadioButtonMenuItem("3 min"); + attemptAbsoluteDuration30minItemMenu = new JRadioButtonMenuItem( + "30 min"); + attemptAbsoluteDuration1hourItemMenu = new JRadioButtonMenuItem( + "1 hour"); + attemptAbsoluteDuration5hourItemMenu = new JRadioButtonMenuItem( + "5 hour"); + attemptAbsoluteDurationOtherItemMenu = new JRadioButtonMenuItem("Other"); - if (manifestItem.getClass() == Item.class) { - if (((Item) manifestItem).sequencing == null) { - ((Item) manifestItem).sequencing = ManifestFactory - .createSequencing(); - } + ButtonGroup buttonGroup = new ButtonGroup(); + buttonGroup.add(attemptAbsoluteDurationNoneItemMenu); + buttonGroup.add(attemptAbsoluteDuration1minItemMenu); + buttonGroup.add(attemptAbsoluteDuration3minItemMenu); + buttonGroup.add(attemptAbsoluteDuration30minItemMenu); + buttonGroup.add(attemptAbsoluteDuration1hourItemMenu); + buttonGroup.add(attemptAbsoluteDuration5hourItemMenu); + buttonGroup.add(attemptAbsoluteDurationOtherItemMenu); - sequencing = ((Item) manifestItem).sequencing; - } - return sequencing; - } + attemptAbsoluteDurationNoneItemMenu.addChangeListener(this); + attemptAbsoluteDuration1minItemMenu.addChangeListener(this); + attemptAbsoluteDuration3minItemMenu.addChangeListener(this); + attemptAbsoluteDuration30minItemMenu.addChangeListener(this); + attemptAbsoluteDuration1hourItemMenu.addChangeListener(this); + attemptAbsoluteDuration5hourItemMenu.addChangeListener(this); + attemptAbsoluteDurationOtherItemMenu.addChangeListener(this); - private void initAttemptAbsoluteDurationMenu() { - attemptAbsoluteDurationNoneItemMenu = new JRadioButtonMenuItem("None", - true); - attemptAbsoluteDuration1minItemMenu = new JRadioButtonMenuItem("1 min"); - attemptAbsoluteDuration3minItemMenu = new JRadioButtonMenuItem("3 min"); - attemptAbsoluteDuration30minItemMenu = new JRadioButtonMenuItem( - "30 min"); - attemptAbsoluteDuration1hourItemMenu = new JRadioButtonMenuItem( - "1 hour"); - attemptAbsoluteDuration5hourItemMenu = new JRadioButtonMenuItem( - "5 hour"); - attemptAbsoluteDurationOtherItemMenu = new JRadioButtonMenuItem("Other"); + attemptAbsoluteDurationMenu = new JMenu("Attempt duration"); + attemptAbsoluteDurationMenu.add(attemptAbsoluteDurationNoneItemMenu); + attemptAbsoluteDurationMenu.add(attemptAbsoluteDuration1minItemMenu); + attemptAbsoluteDurationMenu.add(attemptAbsoluteDuration3minItemMenu); + attemptAbsoluteDurationMenu.add(attemptAbsoluteDuration30minItemMenu); + attemptAbsoluteDurationMenu.add(attemptAbsoluteDuration1hourItemMenu); + attemptAbsoluteDurationMenu.add(attemptAbsoluteDuration5hourItemMenu); + attemptAbsoluteDurationMenu.add(attemptAbsoluteDurationOtherItemMenu); + } - ButtonGroup buttonGroup = new ButtonGroup(); - buttonGroup.add(attemptAbsoluteDurationNoneItemMenu); - buttonGroup.add(attemptAbsoluteDuration1minItemMenu); - buttonGroup.add(attemptAbsoluteDuration3minItemMenu); - buttonGroup.add(attemptAbsoluteDuration30minItemMenu); - buttonGroup.add(attemptAbsoluteDuration1hourItemMenu); - buttonGroup.add(attemptAbsoluteDuration5hourItemMenu); - buttonGroup.add(attemptAbsoluteDurationOtherItemMenu); + private void initAttemptLimitMenu() { + attemptLimitMenu = new JMenu("Attempts count"); + attemptLimitNoneItemMenu = new JRadioButtonMenuItem("None", true); + attemptLimit1ItemMenu = new JRadioButtonMenuItem("1"); + attemptLimit3ItemMenu = new JRadioButtonMenuItem("3"); + attemptLimit5ItemMenu = new JRadioButtonMenuItem("5"); + attemptLimit10ItemMenu = new JRadioButtonMenuItem("10"); + attemptLimitOtherItemMenu = new JRadioButtonMenuItem("Other..."); - attemptAbsoluteDurationNoneItemMenu.addChangeListener(this); - attemptAbsoluteDuration1minItemMenu.addChangeListener(this); - attemptAbsoluteDuration3minItemMenu.addChangeListener(this); - attemptAbsoluteDuration30minItemMenu.addChangeListener(this); - attemptAbsoluteDuration1hourItemMenu.addChangeListener(this); - attemptAbsoluteDuration5hourItemMenu.addChangeListener(this); - attemptAbsoluteDurationOtherItemMenu.addChangeListener(this); + attemptLimitNoneItemMenu.addChangeListener(this); + attemptLimit1ItemMenu.addChangeListener(this); + attemptLimit3ItemMenu.addChangeListener(this); + attemptLimit5ItemMenu.addChangeListener(this); + attemptLimit10ItemMenu.addChangeListener(this); + attemptLimitOtherItemMenu.addChangeListener(this); - attemptAbsoluteDurationMenu = new JMenu("Attempt duration"); - attemptAbsoluteDurationMenu.add(attemptAbsoluteDurationNoneItemMenu); - attemptAbsoluteDurationMenu.add(attemptAbsoluteDuration1minItemMenu); - attemptAbsoluteDurationMenu.add(attemptAbsoluteDuration3minItemMenu); - attemptAbsoluteDurationMenu.add(attemptAbsoluteDuration30minItemMenu); - attemptAbsoluteDurationMenu.add(attemptAbsoluteDuration1hourItemMenu); - attemptAbsoluteDurationMenu.add(attemptAbsoluteDuration5hourItemMenu); - attemptAbsoluteDurationMenu.add(attemptAbsoluteDurationOtherItemMenu); - } + ButtonGroup buttonGroup = new ButtonGroup(); - private void initAttemptLimitMenu() { - attemptLimitMenu = new JMenu("Attempts count"); - attemptLimitNoneItemMenu = new JRadioButtonMenuItem("None", true); - attemptLimit1ItemMenu = new JRadioButtonMenuItem("1"); - attemptLimit3ItemMenu = new JRadioButtonMenuItem("3"); - attemptLimit5ItemMenu = new JRadioButtonMenuItem("5"); - attemptLimit10ItemMenu = new JRadioButtonMenuItem("10"); - attemptLimitOtherItemMenu = new JRadioButtonMenuItem("Other..."); + buttonGroup.add(attemptLimitNoneItemMenu); + buttonGroup.add(attemptLimit1ItemMenu); + buttonGroup.add(attemptLimit3ItemMenu); + buttonGroup.add(attemptLimit5ItemMenu); + buttonGroup.add(attemptLimit10ItemMenu); + buttonGroup.add(attemptLimitOtherItemMenu); - attemptLimitNoneItemMenu.addChangeListener(this); - attemptLimit1ItemMenu.addChangeListener(this); - attemptLimit3ItemMenu.addChangeListener(this); - attemptLimit5ItemMenu.addChangeListener(this); - attemptLimit10ItemMenu.addChangeListener(this); - attemptLimitOtherItemMenu.addChangeListener(this); + attemptLimitMenu.add(attemptLimitNoneItemMenu); + attemptLimitMenu.add(attemptLimit1ItemMenu); + attemptLimitMenu.add(attemptLimit3ItemMenu); + attemptLimitMenu.add(attemptLimit5ItemMenu); + attemptLimitMenu.add(attemptLimit10ItemMenu); + attemptLimitMenu.add(attemptLimitOtherItemMenu); + } - ButtonGroup buttonGroup = new ButtonGroup(); + private void initLimitConditionsMenu() { + limitConditionsMenu = new JMenu("Limit Conditions"); - buttonGroup.add(attemptLimitNoneItemMenu); - buttonGroup.add(attemptLimit1ItemMenu); - buttonGroup.add(attemptLimit3ItemMenu); - buttonGroup.add(attemptLimit5ItemMenu); - buttonGroup.add(attemptLimit10ItemMenu); - buttonGroup.add(attemptLimitOtherItemMenu); + initAttemptLimitMenu(); + initAttemptAbsoluteDurationMenu(); - attemptLimitMenu.add(attemptLimitNoneItemMenu); - attemptLimitMenu.add(attemptLimit1ItemMenu); - attemptLimitMenu.add(attemptLimit3ItemMenu); - attemptLimitMenu.add(attemptLimit5ItemMenu); - attemptLimitMenu.add(attemptLimit10ItemMenu); - attemptLimitMenu.add(attemptLimitOtherItemMenu); - } + limitConditionsMenu.add(attemptLimitMenu); + limitConditionsMenu.add(attemptAbsoluteDurationMenu); + } - private void initLimitConditionsMenu() { - limitConditionsMenu = new JMenu("Limit Conditions"); + private void initReorganizeMenus() { + moveUpItemMenu = new JMenuItem("Move up"); + moveUpItemMenu.addActionListener(this); - initAttemptLimitMenu(); - initAttemptAbsoluteDurationMenu(); + moveDownItemMenu = new JMenuItem("Move down"); + moveDownItemMenu.addActionListener(this); - limitConditionsMenu.add(attemptLimitMenu); - limitConditionsMenu.add(attemptAbsoluteDurationMenu); - } + removeItemMenu = new JMenuItem("Delete"); + removeItemMenu.addActionListener(this); - private void initReorganizeMenus() { - moveUpItemMenu = new JMenuItem("Move up"); - moveUpItemMenu.addActionListener(this); + renameItemMenu = new JMenuItem("Rename"); + renameItemMenu.addActionListener(this); + } - moveDownItemMenu = new JMenuItem("Move down"); - moveDownItemMenu.addActionListener(this); + private void initSummaryPageMenus() { + showOnSummaryPageMenuItem = new JCheckBoxMenuItem( + "Show on summary page", false); + showOnSummaryPageMenuItem.addChangeListener(this); - removeItemMenu = new JMenuItem("Delete"); - removeItemMenu.addActionListener(this); + showSummaryPageMenuItem = new JCheckBoxMenuItem("Show summary page", + true); + showSummaryPageMenuItem.addChangeListener(this); + } - renameItemMenu = new JMenuItem("Rename"); - renameItemMenu.addActionListener(this); + private boolean isAttemptAbsoluteDurationPerformed(ChangeEvent arg0) { + if (arg0.getSource() == attemptAbsoluteDurationNoneItemMenu + || arg0.getSource() == attemptAbsoluteDuration1minItemMenu + || arg0.getSource() == attemptAbsoluteDuration3minItemMenu + || arg0.getSource() == attemptAbsoluteDuration30minItemMenu + || arg0.getSource() == attemptAbsoluteDuration1hourItemMenu + || arg0.getSource() == attemptAbsoluteDuration5hourItemMenu + || arg0.getSource() == attemptAbsoluteDurationOtherItemMenu) { + return true; } - private void initSummaryPageMenus() { - showOnSummaryPageMenuItem = new JCheckBoxMenuItem( - "Show on summary page", false); - showOnSummaryPageMenuItem.addChangeListener(this); + return false; + } - showSummaryPageMenuItem = new JCheckBoxMenuItem("Show summary page", - true); - showSummaryPageMenuItem.addChangeListener(this); + private boolean isAttemptLimitPerformed(ChangeEvent arg0) { + if (arg0.getSource() == attemptLimitNoneItemMenu + || arg0.getSource() == attemptLimit1ItemMenu + || arg0.getSource() == attemptLimit3ItemMenu + || arg0.getSource() == attemptLimit5ItemMenu + || arg0.getSource() == attemptLimit10ItemMenu + || arg0.getSource() == attemptLimitOtherItemMenu) { + return true; } - private boolean isAttemptAbsoluteDurationPerformed(ChangeEvent arg0) { - if (arg0.getSource() == attemptAbsoluteDurationNoneItemMenu - || arg0.getSource() == attemptAbsoluteDuration1minItemMenu - || arg0.getSource() == attemptAbsoluteDuration3minItemMenu - || arg0.getSource() == attemptAbsoluteDuration30minItemMenu - || arg0.getSource() == attemptAbsoluteDuration1hourItemMenu - || arg0.getSource() == attemptAbsoluteDuration5hourItemMenu - || arg0.getSource() == attemptAbsoluteDurationOtherItemMenu) { - return true; - } + return false; + } - return false; - } + @Override + public void mousePressed(java.awt.event.MouseEvent e) { + displayMenu(e); + } - private boolean isAttemptLimitPerformed(ChangeEvent arg0) { - if (arg0.getSource() == attemptLimitNoneItemMenu - || arg0.getSource() == attemptLimit1ItemMenu - || arg0.getSource() == attemptLimit3ItemMenu - || arg0.getSource() == attemptLimit5ItemMenu - || arg0.getSource() == attemptLimit10ItemMenu - || arg0.getSource() == attemptLimitOtherItemMenu) { - return true; - } + @Override + public void mouseReleased(java.awt.event.MouseEvent e) { + displayMenu(e); + } - return false; + private void prepareOrganizeMenuItems() { + if (manifestItem.getParent() == null) { + return; } - @Override - public void mousePressed(java.awt.event.MouseEvent e) { - displayMenu(e); - } + int itemIndex = manifestItem.getParent().getChildIndex(manifestItem); + int childCount = manifestItem.getParent().getChildCount(); - @Override - public void mouseReleased(java.awt.event.MouseEvent e) { - displayMenu(e); - } + boolean upEnabled = true; + boolean downEnabled = true; - private void prepareOrganizeMenuItems() { - if (manifestItem.getParent() == ... [truncated message content] |
From: <se...@us...> - 2008-05-24 17:14:08
|
Revision: 165 http://acmcontester.svn.sourceforge.net/acmcontester/?rev=165&view=rev Author: sem62 Date: 2008-05-24 10:14:09 -0700 (Sat, 24 May 2008) Log Message: ----------- * Change OnlyOneAnswer to QuestionType comboBox and added logic for it. Modified Paths: -------------- WebEditor/src/edu/lnu/FireFly/WebEditor/GUI/Dialogs/SimpleQuestionPropertiestsDlg.java WebEditor/src/edu/lnu/FireFly/WebEditor/ItemModels/SimpleQuestion/SimpleQuestionAnswersDataModel.java WebEditor/src/edu/lnu/FireFly/WebEditor/ItemModels/SimpleQuestion/SimpleQuestionData.java WebEditor/src/edu/lnu/FireFly/WebEditor/ItemModels/SimpleQuestion/SimpleQuestionModel.java WebEditor/src/edu/lnu/FireFly/WebEditor/UserAnswerStatus/ScoredUserAnswerStatus.java WebEditor/template/global/simpleQ.js Modified: WebEditor/src/edu/lnu/FireFly/WebEditor/GUI/Dialogs/SimpleQuestionPropertiestsDlg.java =================================================================== --- WebEditor/src/edu/lnu/FireFly/WebEditor/GUI/Dialogs/SimpleQuestionPropertiestsDlg.java 2008-05-24 14:29:24 UTC (rev 164) +++ WebEditor/src/edu/lnu/FireFly/WebEditor/GUI/Dialogs/SimpleQuestionPropertiestsDlg.java 2008-05-24 17:14:09 UTC (rev 165) @@ -3,8 +3,15 @@ import java.awt.event.ActionEvent; import java.awt.event.ActionListener; +import javax.swing.BorderFactory; +import javax.swing.GroupLayout; import javax.swing.JButton; +import javax.swing.JLabel; +import javax.swing.JPanel; +import javax.swing.JScrollPane; import javax.swing.ListSelectionModel; +import javax.swing.GroupLayout.Alignment; +import javax.swing.LayoutStyle.ComponentPlacement; import javax.swing.event.ChangeEvent; import javax.swing.event.ChangeListener; import javax.swing.table.DefaultTableColumnModel; @@ -23,7 +30,7 @@ private static final long serialVersionUID = 1961383080461718171L; private javax.swing.JCheckBox sameAsTitleCheckBox; - private javax.swing.JCheckBox oneAnswerCheckBox; + private javax.swing.JComboBox answerTypeComboBox; private javax.swing.JLabel titleLabel; private javax.swing.JPanel generalPanel; private javax.swing.JPanel captionPanel; @@ -132,15 +139,16 @@ titleTextField.setText(manifestItem.getTitle()); SimpleQuestionModel itemModel = new SimpleQuestionModel(); + SimpleQuestionData data = itemModel.getData(manifestItem); - captionTextField.setText(itemModel.getData(manifestItem).getCaption()); + captionTextField.setText(data.getCaption()); sameAsTitleCheckBox.setSelected(titleTextField.getText().equals( captionTextField.getText())); - questionTextField - .setText(itemModel.getData(manifestItem).getQuestion()); + questionTextField.setText(data.getQuestion()); - simpleQuestionAnswersDataModel = itemModel.getData(manifestItem) - .getAnswers(); + answerTypeComboBox.setSelectedIndex(data.getAnswers().getAnswerType()); + + simpleQuestionAnswersDataModel = data.getAnswers(); answersTable.setModel(simpleQuestionAnswersDataModel); DefaultTableColumnModel columnModel = (DefaultTableColumnModel) answersTable @@ -173,10 +181,18 @@ sameAsTitleCheckBox = new javax.swing.JCheckBox(); questionPanel = new javax.swing.JPanel(); questionTextField = new javax.swing.JTextField(); - oneAnswerCheckBox = new javax.swing.JCheckBox(); - answersPanel = new javax.swing.JPanel(); - jScrollPane1 = new javax.swing.JScrollPane(); - cancelButton = new javax.swing.JButton("Cancel"); + + String[] types = new String[3]; + types[0] = "Select one variant"; + types[1] = "Check corrent variants"; + types[2] = "Type your answer"; + + answerTypeComboBox = new javax.swing.JComboBox(types); + answerTypeComboBox.setSelectedIndex(0); + + answersPanel = new JPanel(); + jScrollPane1 = new JScrollPane(); + cancelButton = new JButton("Cancel"); okButton = new javax.swing.JButton("Ok"); editCaptionInHtmlBtn = new JButton("..."); editQuestionInHtmlBtn = new JButton("..."); @@ -184,6 +200,8 @@ insertAnswerVariantBtn = new JButton("Insert"); deleteAnswerVariantBtn = new JButton("Delete"); + JLabel QTypeLabel = new JLabel("Question type :"); + moveDownAnswerVariantBtn = new JButton("Down"); moveUpAnswerVariantBtn = new JButton("Up"); @@ -198,7 +216,6 @@ cancelButton.addActionListener(this); okButton.addActionListener(this); sameAsTitleCheckBox.addChangeListener(this); - oneAnswerCheckBox.addChangeListener(this); editCaptionInHtmlBtn.addActionListener(this); editQuestionInHtmlBtn.addActionListener(this); editAnswerVariantInHtmlEditor.addActionListener(this); @@ -220,34 +237,22 @@ jPanel1Layout.createSequentialGroup().addContainerGap() .addComponent(titleLabel)).addGroup( jPanel1Layout.createSequentialGroup().addContainerGap() + .addComponent(titleTextField, GroupLayout.DEFAULT_SIZE, + 364, Short.MAX_VALUE).addContainerGap())); + jPanel1Layout.setVerticalGroup(jPanel1Layout.createParallelGroup( + Alignment.LEADING).addGroup( + jPanel1Layout.createSequentialGroup().addComponent(titleLabel) + .addPreferredGap(ComponentPlacement.RELATED, + GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addComponent(titleTextField, - javax.swing.GroupLayout.DEFAULT_SIZE, 364, - Short.MAX_VALUE).addContainerGap())); - jPanel1Layout - .setVerticalGroup(jPanel1Layout - .createParallelGroup( - javax.swing.GroupLayout.Alignment.LEADING) - .addGroup( - jPanel1Layout - .createSequentialGroup() - .addComponent(titleLabel) - .addPreferredGap( - javax.swing.LayoutStyle.ComponentPlacement.RELATED, - javax.swing.GroupLayout.DEFAULT_SIZE, - Short.MAX_VALUE) - .addComponent( - titleTextField, - javax.swing.GroupLayout.PREFERRED_SIZE, - javax.swing.GroupLayout.DEFAULT_SIZE, - javax.swing.GroupLayout.PREFERRED_SIZE) - .addContainerGap())); + GroupLayout.PREFERRED_SIZE, + GroupLayout.DEFAULT_SIZE, + GroupLayout.PREFERRED_SIZE).addContainerGap())); - captionPanel.setBorder(javax.swing.BorderFactory - .createTitledBorder("Caption")); + captionPanel.setBorder(BorderFactory.createTitledBorder("Caption")); sameAsTitleCheckBox.setText("Some as the title"); - javax.swing.GroupLayout jPanel2Layout = new javax.swing.GroupLayout( - captionPanel); + GroupLayout jPanel2Layout = new GroupLayout(captionPanel); captionPanel.setLayout(jPanel2Layout); jPanel2Layout .setHorizontalGroup(jPanel2Layout @@ -281,97 +286,70 @@ 30, javax.swing.GroupLayout.PREFERRED_SIZE) .addContainerGap())); - jPanel2Layout - .setVerticalGroup(jPanel2Layout - .createParallelGroup( - javax.swing.GroupLayout.Alignment.LEADING) - .addGroup( - jPanel2Layout - .createSequentialGroup() - .addComponent(sameAsTitleCheckBox) - .addPreferredGap( - javax.swing.LayoutStyle.ComponentPlacement.RELATED) - .addGroup( - jPanel2Layout - .createParallelGroup( - javax.swing.GroupLayout.Alignment.BASELINE) - .addComponent( - editCaptionInHtmlBtn, - javax.swing.GroupLayout.PREFERRED_SIZE, - 20, - javax.swing.GroupLayout.PREFERRED_SIZE) - .addComponent( - captionTextField, - javax.swing.GroupLayout.PREFERRED_SIZE, - javax.swing.GroupLayout.DEFAULT_SIZE, - javax.swing.GroupLayout.PREFERRED_SIZE)) - .addContainerGap())); + jPanel2Layout.setVerticalGroup(jPanel2Layout.createParallelGroup( + Alignment.LEADING).addGroup( + jPanel2Layout.createSequentialGroup().addComponent( + sameAsTitleCheckBox).addPreferredGap( + ComponentPlacement.RELATED).addGroup( + jPanel2Layout.createParallelGroup(Alignment.BASELINE) + .addComponent(editCaptionInHtmlBtn, + javax.swing.GroupLayout.PREFERRED_SIZE, + 20, GroupLayout.PREFERRED_SIZE) + .addComponent(captionTextField, + GroupLayout.PREFERRED_SIZE, + GroupLayout.DEFAULT_SIZE, + GroupLayout.PREFERRED_SIZE)) + .addContainerGap())); questionPanel.setBorder(javax.swing.BorderFactory .createTitledBorder("Question")); - oneAnswerCheckBox.setText("Only one correct answer"); - javax.swing.GroupLayout jPanel3Layout = new javax.swing.GroupLayout( - questionPanel); + javax.swing.GroupLayout jPanel3Layout = new GroupLayout(questionPanel); questionPanel.setLayout(jPanel3Layout); + jPanel3Layout.setHorizontalGroup(jPanel3Layout.createParallelGroup( + Alignment.LEADING).addGroup( + jPanel3Layout + .createSequentialGroup() + .addContainerGap() + .addComponent(QTypeLabel) + .addContainerGap(10, 10) + .addComponent(answerTypeComboBox) + .addContainerGap(283, Short.MAX_VALUE) + ).addGroup( + Alignment.TRAILING, + jPanel3Layout.createSequentialGroup().addContainerGap() + .addComponent(questionTextField, GroupLayout.DEFAULT_SIZE, 370, Short.MAX_VALUE) + .addPreferredGap(ComponentPlacement.RELATED) + .addComponent(editQuestionInHtmlBtn, GroupLayout.PREFERRED_SIZE, 30, GroupLayout.PREFERRED_SIZE) + .addContainerGap())); jPanel3Layout - .setHorizontalGroup(jPanel3Layout - .createParallelGroup( - javax.swing.GroupLayout.Alignment.LEADING) - .addGroup( - jPanel3Layout - .createSequentialGroup() - .addContainerGap() - .addGroup( - jPanel3Layout - .createParallelGroup( - javax.swing.GroupLayout.Alignment.LEADING) - .addComponent( - oneAnswerCheckBox)) - .addContainerGap(283, Short.MAX_VALUE)) - .addGroup( - javax.swing.GroupLayout.Alignment.TRAILING, - jPanel3Layout - .createSequentialGroup() - .addContainerGap() - .addComponent( - questionTextField, - javax.swing.GroupLayout.DEFAULT_SIZE, - 370, Short.MAX_VALUE) - .addPreferredGap( - javax.swing.LayoutStyle.ComponentPlacement.RELATED) - .addComponent( - editQuestionInHtmlBtn, - javax.swing.GroupLayout.PREFERRED_SIZE, - 30, - javax.swing.GroupLayout.PREFERRED_SIZE) - .addContainerGap())); - jPanel3Layout .setVerticalGroup(jPanel3Layout - .createParallelGroup( - javax.swing.GroupLayout.Alignment.LEADING) + .createParallelGroup(Alignment.LEADING) .addGroup( jPanel3Layout .createSequentialGroup() .addPreferredGap( - javax.swing.LayoutStyle.ComponentPlacement.RELATED) - .addComponent(oneAnswerCheckBox) + ComponentPlacement.RELATED) + .addGroup( + jPanel3Layout.createParallelGroup(Alignment.BASELINE) + .addComponent(answerTypeComboBox, 20, 20, 20) + .addComponent(QTypeLabel) + ) .addPreferredGap( - javax.swing.LayoutStyle.ComponentPlacement.RELATED) + ComponentPlacement.RELATED) .addGroup( jPanel3Layout - .createParallelGroup( - javax.swing.GroupLayout.Alignment.BASELINE) + .createParallelGroup(Alignment.BASELINE) .addComponent( editQuestionInHtmlBtn, - javax.swing.GroupLayout.PREFERRED_SIZE, + GroupLayout.PREFERRED_SIZE, 20, - javax.swing.GroupLayout.PREFERRED_SIZE) + GroupLayout.PREFERRED_SIZE) .addComponent( questionTextField, - javax.swing.GroupLayout.PREFERRED_SIZE, - javax.swing.GroupLayout.DEFAULT_SIZE, - javax.swing.GroupLayout.PREFERRED_SIZE)) + GroupLayout.PREFERRED_SIZE, + GroupLayout.DEFAULT_SIZE, + GroupLayout.PREFERRED_SIZE)) .addContainerGap())); answersPanel.setBorder(javax.swing.BorderFactory @@ -535,6 +513,8 @@ @Override protected void saveChanges() { SimpleQuestionModel itemModel = new SimpleQuestionModel(); + simpleQuestionAnswersDataModel.setAnswerType(answerTypeComboBox + .getSelectedIndex()); manifestItem.setTitle(titleTextField.getText()); @@ -562,11 +542,5 @@ } captionTextField.setEnabled(!sameAsTitleCheckBox.isSelected()); } - - if (e.getSource() == oneAnswerCheckBox) { - simpleQuestionAnswersDataModel.setSingleVariant(oneAnswerCheckBox - .isSelected()); - } } - } Modified: WebEditor/src/edu/lnu/FireFly/WebEditor/ItemModels/SimpleQuestion/SimpleQuestionAnswersDataModel.java =================================================================== --- WebEditor/src/edu/lnu/FireFly/WebEditor/ItemModels/SimpleQuestion/SimpleQuestionAnswersDataModel.java 2008-05-24 14:29:24 UTC (rev 164) +++ WebEditor/src/edu/lnu/FireFly/WebEditor/ItemModels/SimpleQuestion/SimpleQuestionAnswersDataModel.java 2008-05-24 17:14:09 UTC (rev 165) @@ -11,8 +11,12 @@ */ private static final long serialVersionUID = 1L; - private boolean singleVariant = false; + private int answerType = ANSWER_TYPE_CHOOSE_FEW; + public static final int ANSWER_TYPE_SELECT_ONE = 0; + public static final int ANSWER_TYPE_CHOOSE_FEW = 1; + public static final int ANSWER_TYPE_TYPE = 2; + public List<SimpleQuestionAnswer> answers = new ArrayList<SimpleQuestionAnswer>(); @Override @@ -72,18 +76,14 @@ return arg1 > 0; } - public boolean isSingleVariant() { - return singleVariant; + public int getAnswerType() { + return answerType; } - public void setSingleVariant(boolean singleVariant) { - this.singleVariant = singleVariant; + public void setAnswerType(int answerType) { + this.answerType = answerType; } - public boolean getSingleVariant() { - return this.singleVariant; - } - @Override public void setValueAt(Object arg0, int arg1, int arg2) { if (arg1 == answers.size()) { Modified: WebEditor/src/edu/lnu/FireFly/WebEditor/ItemModels/SimpleQuestion/SimpleQuestionData.java =================================================================== --- WebEditor/src/edu/lnu/FireFly/WebEditor/ItemModels/SimpleQuestion/SimpleQuestionData.java 2008-05-24 14:29:24 UTC (rev 164) +++ WebEditor/src/edu/lnu/FireFly/WebEditor/ItemModels/SimpleQuestion/SimpleQuestionData.java 2008-05-24 17:14:09 UTC (rev 165) @@ -24,8 +24,7 @@ Element ans = root.addElement("answers"); - ans.addAttribute("singleVariant", String.valueOf(getAnswers() - .getSingleVariant())); + ans.addAttribute("answerType", String.valueOf(getAnswers().getAnswerType())); Iterator<SimpleQuestionAnswer> iter = getAnswers().answers.iterator(); @@ -89,9 +88,7 @@ .elementTextTrim("ShowOnSummaryPage")); setShowOnSummaryPage(showOnSP); - getAnswers().setSingleVariant( - answers.attributeValue("singleVariant").equalsIgnoreCase( - "true")); + getAnswers().setAnswerType(Integer.valueOf(answers.attributeValue("answerType"))); getAnswers().answers.clear(); Modified: WebEditor/src/edu/lnu/FireFly/WebEditor/ItemModels/SimpleQuestion/SimpleQuestionModel.java =================================================================== --- WebEditor/src/edu/lnu/FireFly/WebEditor/ItemModels/SimpleQuestion/SimpleQuestionModel.java 2008-05-24 14:29:24 UTC (rev 164) +++ WebEditor/src/edu/lnu/FireFly/WebEditor/ItemModels/SimpleQuestion/SimpleQuestionModel.java 2008-05-24 17:14:09 UTC (rev 165) @@ -1,6 +1,7 @@ package edu.lnu.FireFly.WebEditor.ItemModels.SimpleQuestion; import java.util.Iterator; +import java.util.List; import edu.lnu.FireFly.FFManifest.TreeItem; import edu.lnu.FireFly.FFManifest.item.Item; @@ -13,12 +14,11 @@ import edu.lnu.FireFly.WebEditor.UserAnswerStatus.ScoredUserAnswerStatus; import edu.lnu.FireFly.WebEditor.UserAnswerStatus.UserAnswerStatus; +/** + * @author Yura + * + */ public class SimpleQuestionModel extends ResourcedItemModel { - @Override - public void showAnswerStatus(UserAnswerStatus answerStatus) { - ((ScoredUserAnswerStatus)answerStatus).showStatus(); - } - public SimpleQuestionModel() { modelName = "SimpleQuestionModel"; registerConfigDlg(new SimpleQuestionPropertiestsDlg()); @@ -52,14 +52,15 @@ SimpleQuestionData data = getData(item); - for (int i = 0; i < data.getAnswers().answers.size(); i++) { - double answerPoint = data.getAnswers().answers.get(i) - .getAnswerPoint(); - if (answerPoint > 0) { - result += answerPoint; + List<SimpleQuestionAnswer> answers = data.getAnswers().answers; + + if (data.getAnswers().getAnswerType() != SimpleQuestionAnswersDataModel.ANSWER_TYPE_SELECT_ONE) { + result = getSum(result, answers, +1); + } else { + if (answers.size() > 0) { + result = getMax(answers); } } - return result; } @@ -69,34 +70,48 @@ SimpleQuestionData data = getData(item); - for (int i = 0; i < data.getAnswers().answers.size(); i++) { - double answerPoint = data.getAnswers().answers.get(i) - .getAnswerPoint(); - if (answerPoint < 0) { - result += answerPoint; + List<SimpleQuestionAnswer> answers = data.getAnswers().answers; + + if (data.getAnswers().getAnswerType() != SimpleQuestionAnswersDataModel.ANSWER_TYPE_SELECT_ONE) { + result = getSum(result, answers, -1); + } else { + if (answers.size() > 0) { + result = getMin(answers); } } - return result; } @Override public double getAnswerRawScore(TreeItem anItem, String[] userAnswers) { - SimpleQuestionData data = getData(anItem); - if (userAnswers.length != 1 - || userAnswers[0].length() != data.getAnswers().answers.size()) { + List<SimpleQuestionAnswer> answers = data.getAnswers().answers; + if (userAnswers.length != 1 || (userAnswers[0].length() != answers.size() && data.getAnswers().getAnswerType() != SimpleQuestionAnswersDataModel.ANSWER_TYPE_TYPE)) { return getAnswerMinScore(anItem); } String answer = userAnswers[0]; double result = 0d; - for (int i = 0; i < data.getAnswers().answers.size(); i++) { - if (answer.charAt(i) == '1') { - result += data.getAnswers().answers.get(i).getAnswerPoint(); + if (data.getAnswers().getAnswerType() != SimpleQuestionAnswersDataModel.ANSWER_TYPE_TYPE) { + for (int i = 0; i < answers.size(); i++) { + if (answer.charAt(i) == '1') { + result += answers.get(i).getAnswerPoint(); + + if (data.getAnswers().getAnswerType() != SimpleQuestionAnswersDataModel.ANSWER_TYPE_CHOOSE_FEW) { + // Need to avoid some king of hacking + break; + } + } } + } else { + for (int i = 0; i < answers.size(); i++) { + if (answers.get(i).getAnswerText().equalsIgnoreCase(answer)){ + result = answers.get(i).getAnswerPoint(); + break; + } + } } return result; @@ -116,6 +131,34 @@ return true; } + private double getMax(List<SimpleQuestionAnswer> answers) { + double result; + result = answers.get(0).getAnswerPoint(); + + for (int i = 0; i < answers.size(); i++) { + double currentAnswerPoint = answers.get(i).getAnswerPoint(); + + if (currentAnswerPoint > result) { + result = currentAnswerPoint; + } + } + return result; + } + + private double getMin(List<SimpleQuestionAnswer> answers) { + double result; + result = answers.get(0).getAnswerPoint(); + + for (int i = 0; i < answers.size(); i++) { + double currentAnswerPoint = answers.get(i).getAnswerPoint(); + + if (currentAnswerPoint < result) { + result = currentAnswerPoint; + } + } + return result; + } + @Override public boolean getShowOnSummaryPageMenuVisible() { return true; @@ -126,12 +169,39 @@ return false; } + /** + * @param result + * @param answers + * @param order + * If sign is 0, result is a sum of all elements. Else, + * result is a sum only of elements with the same sign with + * this "sign". + * @return + */ + private double getSum(double result, List<SimpleQuestionAnswer> answers, + int sign) { + for (int i = 0; i < answers.size(); i++) { + double answerPoint = answers.get(i).getAnswerPoint(); + + if (sign == 0 || sign * answerPoint > 0) { + result += answerPoint; + } + } + + return result; + } + @Override public boolean isRemovable() { return true; } @Override + public void showAnswerStatus(UserAnswerStatus answerStatus) { + ((ScoredUserAnswerStatus) answerStatus).showStatus(); + } + + @Override protected void updateResourceFile(TreeItem anItem) { Resource resource = WebEditor.instance.getManifest().resources .findResourceByIdentifier(((Item) anItem).identifierref); @@ -145,8 +215,8 @@ Iterator<SimpleQuestionAnswer> iter = itemData.getAnswers().answers .iterator(); - String answers = "\r\nsetSingleVariant(" - + itemData.getAnswers().getSingleVariant() + ");\r\n"; + String answers = "\r\nsetAnswerType(" + + itemData.getAnswers().getAnswerType() + ");\r\n"; while (iter.hasNext()) { SimpleQuestionAnswer answer = iter.next(); Modified: WebEditor/src/edu/lnu/FireFly/WebEditor/UserAnswerStatus/ScoredUserAnswerStatus.java =================================================================== --- WebEditor/src/edu/lnu/FireFly/WebEditor/UserAnswerStatus/ScoredUserAnswerStatus.java 2008-05-24 14:29:24 UTC (rev 164) +++ WebEditor/src/edu/lnu/FireFly/WebEditor/UserAnswerStatus/ScoredUserAnswerStatus.java 2008-05-24 17:14:09 UTC (rev 165) @@ -11,7 +11,7 @@ public class ScoredUserAnswerStatus extends UserAnswerStatus { private String completion_status = "unknown"; private String success_status = "unknown"; - + public ScoredUserAnswerStatus(TreeItem anItem) { super(anItem); } Modified: WebEditor/template/global/simpleQ.js =================================================================== --- WebEditor/template/global/simpleQ.js 2008-05-24 14:29:24 UTC (rev 164) +++ WebEditor/template/global/simpleQ.js 2008-05-24 17:14:09 UTC (rev 165) @@ -1,7 +1,7 @@ -var singleAnswer=false; +var answerType; var answers=new Array(); -function setSingleVariant(singleVariant){ - singleAnswer = singleVariant; +function setAnswerType(type){ + answerType = type; } function addAnswer(_text, _point){ var answer = { @@ -15,14 +15,21 @@ function show(){ var i; - for (i=0; i < answers.length; i++){ - if (singleAnswer){ - document.write("<input type='radio' name='answer' id='" + answers[i].id + "' value='" + answers[i].id + "'>"); - } else { - document.write("<input type='checkbox' id='" + answers[i].id + "'>"); - } - document.write(answers[i].text); - document.write("<BR>"); + if (answerType != 2){ + for (i=0; i < answers.length; i++){ + if (answerType == 0){ + document.write("<input type='radio' name='answer' id='" + answers[i].id + "' value='" + answers[i].id + "'>"); + } else { + if (answerType == 1){ + document.write("<input type='checkbox' id='" + answers[i].id + "'>"); + } + } + + document.write(answers[i].text); + document.write("<BR>"); + } + } else { + document.write("<input type='text' name='answer' id='answer' value=''><br>"); } } @@ -31,14 +38,19 @@ var i; var answer = ""; - for (i=0; i < answers.length; i++){ - var ans = document.getElementById(answers[i].id); - if (ans.checked){ - answer += "1"; - } else { - answer += "0"; - } - } + + if (answerType != 2){ + for (i=0; i < answers.length; i++){ + var ans = document.getElementById(answers[i].id); + if (ans.checked){ + answer += "1"; + } else { + answer += "0"; + } + } + } else { + answer = document.getElementById("answer").value; + } SetValue("cmi.answers.0.value", answer); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <se...@us...> - 2008-05-29 09:30:24
|
Revision: 178 http://acmcontester.svn.sourceforge.net/acmcontester/?rev=178&view=rev Author: sem62 Date: 2008-05-29 02:30:08 -0700 (Thu, 29 May 2008) Log Message: ----------- * Added ItemConfigurationManager that must manage all item configurations. * Saving all item configurations in one file at saving course. It's some optimization. Modified Paths: -------------- WebEditor/src/deploy.jardesc WebEditor/src/edu/lnu/FireFly/WebEditor/Data/ManifestFactory.java WebEditor/src/edu/lnu/FireFly/WebEditor/ItemModels/Chapter/ChapterItemData.java WebEditor/src/edu/lnu/FireFly/WebEditor/ItemModels/Chapter/ChapterModel.java WebEditor/src/edu/lnu/FireFly/WebEditor/ItemModels/CompileQ/CompileQData.java WebEditor/src/edu/lnu/FireFly/WebEditor/ItemModels/ItemData.java WebEditor/src/edu/lnu/FireFly/WebEditor/ItemModels/ItemModel.java WebEditor/src/edu/lnu/FireFly/WebEditor/ItemModels/ItemModels.java WebEditor/src/edu/lnu/FireFly/WebEditor/ItemModels/Lecture/LectureData.java WebEditor/src/edu/lnu/FireFly/WebEditor/ItemModels/ResourcedItemModel.java WebEditor/src/edu/lnu/FireFly/WebEditor/ItemModels/SimpleQuestion/SimpleQuestionData.java WebEditor/src/edu/lnu/FireFly/WebEditor/ItemModels/SummaryPageModel/SummaryPageData.java WebEditor/src/edu/lnu/FireFly/WebEditor/ItemModels/UnknownItemModel.java WebEditor/src/edu/lnu/FireFly/WebEditor/WebEditor.java Added Paths: ----------- WebEditor/src/edu/lnu/FireFly/WebEditor/ItemModels/ItemDataFactory.java WebEditor/src/edu/lnu/FireFly/WebEditor/itemConfiguration/ WebEditor/src/edu/lnu/FireFly/WebEditor/itemConfiguration/ItemConfigurationManager.java Property Changed: ---------------- WebEditor/ Property changes on: WebEditor ___________________________________________________________________ Name: svn:ignore - *.classpath *.project .settings + Modified: WebEditor/src/deploy.jardesc =================================================================== --- WebEditor/src/deploy.jardesc 2008-05-28 10:29:19 UTC (rev 177) +++ WebEditor/src/deploy.jardesc 2008-05-29 09:30:08 UTC (rev 178) @@ -11,9 +11,6 @@ </sealing> </manifest> <selectedElements exportClassFiles="true" exportJavaFiles="true" exportOutputFolder="false"> - <file path="/webEditor/.classpath"/> <javaElement handleIdentifier="=webEditor/src"/> - <file path="/webEditor/webEditor.eap"/> - <file path="/webEditor/.project"/> </selectedElements> </jardesc> Modified: WebEditor/src/edu/lnu/FireFly/WebEditor/Data/ManifestFactory.java =================================================================== --- WebEditor/src/edu/lnu/FireFly/WebEditor/Data/ManifestFactory.java 2008-05-28 10:29:19 UTC (rev 177) +++ WebEditor/src/edu/lnu/FireFly/WebEditor/Data/ManifestFactory.java 2008-05-29 09:30:08 UTC (rev 178) @@ -15,6 +15,7 @@ import edu.lnu.FireFly.FFManifest.resource.Resources; import edu.lnu.FireFly.WebEditor.ItemModels.OrganizationModel; import edu.lnu.FireFly.WebEditor.ItemModels.Chapter.ChapterItemData; +import edu.lnu.FireFly.WebEditor.itemConfiguration.ItemConfigurationManager; public class ManifestFactory { static public Manifest createManifest() { @@ -33,8 +34,9 @@ e.printStackTrace(); return null; } - - model.setItemData(root, new ChapterItemData()); + + ItemConfigurationManager.getInstance().clear(); + ItemConfigurationManager.getInstance().update(root, new ChapterItemData()); model.updateItemResource(root, false); return manifest; Modified: WebEditor/src/edu/lnu/FireFly/WebEditor/ItemModels/Chapter/ChapterItemData.java =================================================================== --- WebEditor/src/edu/lnu/FireFly/WebEditor/ItemModels/Chapter/ChapterItemData.java 2008-05-28 10:29:19 UTC (rev 177) +++ WebEditor/src/edu/lnu/FireFly/WebEditor/ItemModels/Chapter/ChapterItemData.java 2008-05-29 09:30:08 UTC (rev 178) @@ -1,22 +1,17 @@ package edu.lnu.FireFly.WebEditor.ItemModels.Chapter; -import java.io.Reader; - -import org.dom4j.Document; import org.dom4j.DocumentHelper; import org.dom4j.Element; -import org.dom4j.io.SAXReader; -import edu.lnu.FireFly.FFManifest.TreeItem; import edu.lnu.FireFly.WebEditor.ItemModels.ItemData; public class ChapterItemData extends ItemData { private boolean showSummaryPage = true; @Override - public String marshal(TreeItem anItem) { - Document doc = DocumentHelper.createDocument(); - Element root = doc.addElement("ChapterItemData"); + public Element marshal() { + Element root = DocumentHelper.createElement("ItemData"); + root.addElement("ShowSummaryPage").setText( String.valueOf(isShowSummaryPage())); @@ -26,7 +21,7 @@ root.addElement("Configuration").setText( String.valueOf(getConfiguration())); - return doc.asXML(); + return root; } private boolean flow; @@ -86,23 +81,9 @@ } @Override - public boolean unmarshal(Reader aXmlInputStream, TreeItem anItem) { - SAXReader reader = new SAXReader(); - - Document doc = null; - Element root = null; + public boolean unmarshal(Element root) { try { - doc = reader.read(aXmlInputStream); - - root = doc.getRootElement(); - } catch (Exception e) { - e.printStackTrace(); - return false; - } - - try { - boolean showSP = Boolean.valueOf(root - .elementTextTrim("ShowSummaryPage")); + boolean showSP = Boolean.valueOf(root.elementTextTrim("ShowSummaryPage")); setShowSummaryPage(showSP); boolean showOnSP = Boolean.valueOf(root Modified: WebEditor/src/edu/lnu/FireFly/WebEditor/ItemModels/Chapter/ChapterModel.java =================================================================== --- WebEditor/src/edu/lnu/FireFly/WebEditor/ItemModels/Chapter/ChapterModel.java 2008-05-28 10:29:19 UTC (rev 177) +++ WebEditor/src/edu/lnu/FireFly/WebEditor/ItemModels/Chapter/ChapterModel.java 2008-05-29 09:30:08 UTC (rev 178) @@ -164,12 +164,6 @@ public void setShowSummaryPage(TreeItem anItem, boolean state) { ChapterItemData itemData = getData(anItem); - if (itemData == null) { - ItemData data = new ChapterItemData(); - setItemData(anItem, data); - itemData = (ChapterItemData) getItemData(anItem); - } - if (itemData.isShowSummaryPage() != state) { itemData.setShowSummaryPage(state); updateItemResource(anItem, true); Modified: WebEditor/src/edu/lnu/FireFly/WebEditor/ItemModels/CompileQ/CompileQData.java =================================================================== --- WebEditor/src/edu/lnu/FireFly/WebEditor/ItemModels/CompileQ/CompileQData.java 2008-05-28 10:29:19 UTC (rev 177) +++ WebEditor/src/edu/lnu/FireFly/WebEditor/ItemModels/CompileQ/CompileQData.java 2008-05-29 09:30:08 UTC (rev 178) @@ -1,21 +1,16 @@ package edu.lnu.FireFly.WebEditor.ItemModels.CompileQ; -import java.io.Reader; import java.util.Iterator; -import org.dom4j.Document; import org.dom4j.DocumentHelper; import org.dom4j.Element; -import org.dom4j.io.SAXReader; -import edu.lnu.FireFly.FFManifest.TreeItem; import edu.lnu.FireFly.WebEditor.ItemModels.ItemData; public class CompileQData extends ItemData { @Override - public String marshal(TreeItem anItem) { - Document doc = DocumentHelper.createDocument(); - Element root = doc.addElement("CompileQuestion"); + public Element marshal() { + Element root = DocumentHelper.createElement("ItemData"); root.addElement("caption").setText(getCaption()); root.addElement("ShowOnSummaryPage").setText( @@ -41,7 +36,7 @@ partElement.setText(part.getAnswerText()); } - return doc.asXML(); + return root; } private String caption = ""; @@ -59,14 +54,8 @@ @Override @SuppressWarnings("unchecked") - public boolean unmarshal(Reader res, TreeItem anItem) { - SAXReader reader = new SAXReader(); - - Document doc = null; + public boolean unmarshal(Element root) { try { - doc = reader.read(res); - - Element root = doc.getRootElement(); Element answers = root.element("parts"); setCaption(root.elementTextTrim("caption")); Modified: WebEditor/src/edu/lnu/FireFly/WebEditor/ItemModels/ItemData.java =================================================================== --- WebEditor/src/edu/lnu/FireFly/WebEditor/ItemModels/ItemData.java 2008-05-28 10:29:19 UTC (rev 177) +++ WebEditor/src/edu/lnu/FireFly/WebEditor/ItemModels/ItemData.java 2008-05-29 09:30:08 UTC (rev 178) @@ -1,9 +1,7 @@ package edu.lnu.FireFly.WebEditor.ItemModels; -import java.io.Reader; +import org.dom4j.Element; -import edu.lnu.FireFly.FFManifest.TreeItem; - public abstract class ItemData { private Boolean showOnSummaryPage = false; @@ -15,7 +13,7 @@ this.showOnSummaryPage = showOnSummaryPage; } - public abstract boolean unmarshal(Reader res, TreeItem anItem); + public abstract boolean unmarshal(Element root); - public abstract String marshal(TreeItem anItem); + public abstract Element marshal(); } Added: WebEditor/src/edu/lnu/FireFly/WebEditor/ItemModels/ItemDataFactory.java =================================================================== --- WebEditor/src/edu/lnu/FireFly/WebEditor/ItemModels/ItemDataFactory.java (rev 0) +++ WebEditor/src/edu/lnu/FireFly/WebEditor/ItemModels/ItemDataFactory.java 2008-05-29 09:30:08 UTC (rev 178) @@ -0,0 +1,45 @@ +package edu.lnu.FireFly.WebEditor.ItemModels; + +import edu.lnu.FireFly.WebEditor.ItemModels.Chapter.ChapterItemData; +import edu.lnu.FireFly.WebEditor.ItemModels.CompileQ.CompileQData; +import edu.lnu.FireFly.WebEditor.ItemModels.Lecture.LectureData; +import edu.lnu.FireFly.WebEditor.ItemModels.SimpleQuestion.SimpleQuestionData; +import edu.lnu.FireFly.WebEditor.ItemModels.SummaryPageModel.SummaryPageData; + +public class ItemDataFactory { + private static ItemDataFactory obj = null; + + private ItemDataFactory(){} + + public static ItemDataFactory getInstance(){ + if (obj == null){ + obj = new ItemDataFactory(); + } + + return obj; + } + + public ItemData createItemData(String type){ + if (LectureData.class.getSimpleName().equalsIgnoreCase(type)){ + return new LectureData(); + } + + if (ChapterItemData.class.getSimpleName().equalsIgnoreCase(type)){ + return new ChapterItemData(); + } + + if (SimpleQuestionData.class.getSimpleName().equalsIgnoreCase(type)){ + return new SimpleQuestionData(); + } + + if (SummaryPageData.class.getSimpleName().equalsIgnoreCase(type)){ + return new SummaryPageData(); + } + + if (CompileQData.class.getSimpleName().equalsIgnoreCase(type)){ + return new CompileQData(); + } + + return null; + } +} Modified: WebEditor/src/edu/lnu/FireFly/WebEditor/ItemModels/ItemModel.java =================================================================== --- WebEditor/src/edu/lnu/FireFly/WebEditor/ItemModels/ItemModel.java 2008-05-28 10:29:19 UTC (rev 177) +++ WebEditor/src/edu/lnu/FireFly/WebEditor/ItemModels/ItemModel.java 2008-05-29 09:30:08 UTC (rev 178) @@ -4,7 +4,6 @@ import java.io.InputStream; import java.io.InputStreamReader; import java.net.URL; -import java.util.HashMap; import java.util.UUID; import edu.lnu.FireFly.FFManifest.Organization; @@ -23,18 +22,13 @@ import edu.lnu.FireFly.WebEditor.GUI.Dialogs.PropertyDlg; import edu.lnu.FireFly.WebEditor.ItemModels.SummaryPageModel.SummaryPageModel; import edu.lnu.FireFly.WebEditor.UserAnswerStatus.UserAnswerStatus; +import edu.lnu.FireFly.WebEditor.itemConfiguration.ItemConfigurationManager; public abstract class ItemModel { - protected static HashMap<TreeItem, ItemData> questionsData = new HashMap<TreeItem, ItemData>(); - protected String modelName = "Abstract model"; protected abstract String getDefaultTitle(); - public void setItemData(TreeItem anItem, ItemData data) { - questionsData.put(anItem, data); - } - protected boolean isContainerItem = false; private PropertyDlg propertyDlg = null; @@ -119,11 +113,7 @@ } public ItemData getItemData(TreeItem anItem) { - if (questionsData.containsKey(anItem)) { - return questionsData.get(anItem); - } - - return null; + return ItemConfigurationManager.getInstance().get(anItem); } public final String getModelName() { @@ -180,12 +170,8 @@ TreeDataModel.getInstance().treeNodesChanged(item); } - public abstract boolean synchronizeItemWithResource(TreeItem anItem, - String location); + public abstract boolean updateItemResource(TreeItem item, boolean updateSummaryPages); - public abstract boolean updateItemResource(TreeItem item, - boolean updateSummaryPages); - public abstract boolean getLimitConditionsMenuVisible(TreeItem anItem); public abstract boolean getShowOnSummaryPageMenuVisible(); Modified: WebEditor/src/edu/lnu/FireFly/WebEditor/ItemModels/ItemModels.java =================================================================== --- WebEditor/src/edu/lnu/FireFly/WebEditor/ItemModels/ItemModels.java 2008-05-28 10:29:19 UTC (rev 177) +++ WebEditor/src/edu/lnu/FireFly/WebEditor/ItemModels/ItemModels.java 2008-05-29 09:30:08 UTC (rev 178) @@ -2,7 +2,6 @@ import java.util.ArrayList; -import edu.lnu.FireFly.FFManifest.Organization; import edu.lnu.FireFly.FFManifest.TreeItem; import edu.lnu.FireFly.WebEditor.ItemModels.Chapter.ChapterModel; import edu.lnu.FireFly.WebEditor.ItemModels.CompileQ.CompileQModel; @@ -52,30 +51,6 @@ return getUnknownModel(); } - public static void synchronizeAllItemDatas(TreeItem root) { - int childsCount = root.getChildCount(); - - if (root.getClass() == Organization.class) { - // this is a root of tree. - synchronizeItemDatas(root, false); - } - - for (int i = 0; i < childsCount; i++) { - synchronizeItemDatas(root.getChild(i), true); - } - } - - private static void synchronizeItemDatas(TreeItem item, boolean recursivly) { - ItemModel model = ItemModels.getModelFromItem(item); - - model.synchronizeItemWithResource(item, "course"); - - if ((model.getClass() == ChapterModel.class || model.getClass() == OrganizationModel.class) - && recursivly) { - synchronizeAllItemDatas(item); - } - } - public static void clear() { registeredModels.clear(); } Modified: WebEditor/src/edu/lnu/FireFly/WebEditor/ItemModels/Lecture/LectureData.java =================================================================== --- WebEditor/src/edu/lnu/FireFly/WebEditor/ItemModels/Lecture/LectureData.java 2008-05-28 10:29:19 UTC (rev 177) +++ WebEditor/src/edu/lnu/FireFly/WebEditor/ItemModels/Lecture/LectureData.java 2008-05-29 09:30:08 UTC (rev 178) @@ -1,13 +1,8 @@ package edu.lnu.FireFly.WebEditor.ItemModels.Lecture; -import java.io.Reader; - -import org.dom4j.Document; import org.dom4j.DocumentHelper; import org.dom4j.Element; -import org.dom4j.io.SAXReader; -import edu.lnu.FireFly.FFManifest.TreeItem; import edu.lnu.FireFly.WebEditor.ItemModels.ItemData; public class LectureData extends ItemData { @@ -31,19 +26,7 @@ } @Override - public boolean unmarshal(Reader stringReader, TreeItem anItem) { - SAXReader reader = new SAXReader(); - - Document doc = null; - try { - doc = reader.read(stringReader); - } catch (Exception e) { - e.printStackTrace(); - return false; - } - - Element root = doc.getRootElement(); - + public boolean unmarshal(Element root) { setCaption(root.elementTextTrim("caption")); setContent(root.elementTextTrim("content")); @@ -56,15 +39,14 @@ } @Override - public String marshal(TreeItem anItem) { - Document doc = DocumentHelper.createDocument(); - Element root = doc.addElement("LectureData"); + public Element marshal() { + Element root = DocumentHelper.createElement("ItemData"); root.addElement("caption").setText(getCaption()); root.addElement("content").setText(getContent()); root.addElement("ShowOnSummaryPage").setText( String.valueOf(getShowOnSummaryPage())); - return doc.asXML(); + return root; } } Modified: WebEditor/src/edu/lnu/FireFly/WebEditor/ItemModels/ResourcedItemModel.java =================================================================== --- WebEditor/src/edu/lnu/FireFly/WebEditor/ItemModels/ResourcedItemModel.java 2008-05-28 10:29:19 UTC (rev 177) +++ WebEditor/src/edu/lnu/FireFly/WebEditor/ItemModels/ResourcedItemModel.java 2008-05-29 09:30:08 UTC (rev 178) @@ -1,6 +1,5 @@ package edu.lnu.FireFly.WebEditor.ItemModels; -import java.io.StringReader; import java.util.UUID; import edu.lnu.FireFly.FFManifest.Manifest; @@ -12,6 +11,7 @@ import edu.lnu.FireFly.WebEditor.Data.SummaryPageManager; import edu.lnu.FireFly.WebEditor.GUI.TreeDataModel; import edu.lnu.FireFly.WebEditor.WSClients.WebEditorServiceClient; +import edu.lnu.FireFly.WebEditor.itemConfiguration.ItemConfigurationManager; public abstract class ResourcedItemModel extends ItemModel { @@ -46,7 +46,7 @@ ConfigureItem(item); } - protected final String loadResource(String location, TreeItem anItem) { + protected final String getConfFileContent(String location, TreeItem anItem) { String res = ""; if (location.equalsIgnoreCase("course")) { @@ -125,27 +125,6 @@ return !isSubTreeUsingResource(root, getIdentifier(anItem), anItem); } - @Override - public final boolean synchronizeItemWithResource(TreeItem anItem, - String location) { - String res = loadResource(location, anItem); - - ItemData itemData = getItemData(anItem); - - if (itemData == null) { - itemData = createItemDataInstance(); - setItemData(anItem, itemData); - } - - if (res == null || res.trim().equals("")) { - return false; - } - - itemData.unmarshal(new StringReader(res), anItem); - - return true; - } - protected String getConfFileName(TreeItem anItem) { Resource resource = WebEditor.instance.getManifest().resources .findResourceByIdentifier(getIdentifierRef(anItem)); @@ -157,11 +136,11 @@ protected final void initializeDataForItem(Item anItem) { ItemData itemData = createItemDataInstance(); - String res = loadResource("template", anItem); + //String res = getConfFileContent("template", anItem); - itemData.unmarshal(new StringReader(res), anItem); + //itemData.unmarshal(new StringReader(res), anItem); - setItemData(anItem, itemData); + ItemConfigurationManager.getInstance().update(anItem, itemData); } protected abstract void updateResourceFile(TreeItem anItem); @@ -171,11 +150,7 @@ boolean updateSummaryPages) { updateResourceFile(anItem); - ItemData itemData = getItemData(anItem); - WebEditorServiceClient.getInstance().setFileContent( - getConfFileName(anItem), itemData.marshal(anItem)); - if (updateSummaryPages) { SummaryPageManager.getInstance().updateSummaryPages(); } Modified: WebEditor/src/edu/lnu/FireFly/WebEditor/ItemModels/SimpleQuestion/SimpleQuestionData.java =================================================================== --- WebEditor/src/edu/lnu/FireFly/WebEditor/ItemModels/SimpleQuestion/SimpleQuestionData.java 2008-05-28 10:29:19 UTC (rev 177) +++ WebEditor/src/edu/lnu/FireFly/WebEditor/ItemModels/SimpleQuestion/SimpleQuestionData.java 2008-05-29 09:30:08 UTC (rev 178) @@ -1,21 +1,16 @@ package edu.lnu.FireFly.WebEditor.ItemModels.SimpleQuestion; -import java.io.Reader; import java.util.Iterator; -import org.dom4j.Document; import org.dom4j.DocumentHelper; import org.dom4j.Element; -import org.dom4j.io.SAXReader; -import edu.lnu.FireFly.FFManifest.TreeItem; import edu.lnu.FireFly.WebEditor.ItemModels.ItemData; public class SimpleQuestionData extends ItemData { @Override - public String marshal(TreeItem anItem) { - Document doc = DocumentHelper.createDocument(); - Element root = doc.addElement("SimpleQuestion"); + public Element marshal() { + Element root = DocumentHelper.createElement("ItemData"); root.addElement("caption").setText(getCaption()); root.addElement("question").setText(getQuestion()); @@ -38,7 +33,7 @@ ansEl.setText(answer.getAnswerText()); } - return doc.asXML(); + return root; } private SimpleQuestionAnswersDataModel answers = new SimpleQuestionAnswersDataModel(); @@ -71,14 +66,8 @@ @Override @SuppressWarnings("unchecked") - public boolean unmarshal(Reader res, TreeItem anItem) { - SAXReader reader = new SAXReader(); - - Document doc = null; + public boolean unmarshal(Element root) { try { - doc = reader.read(res); - - Element root = doc.getRootElement(); Element answers = root.element("answers"); setCaption(root.elementTextTrim("caption")); Modified: WebEditor/src/edu/lnu/FireFly/WebEditor/ItemModels/SummaryPageModel/SummaryPageData.java =================================================================== --- WebEditor/src/edu/lnu/FireFly/WebEditor/ItemModels/SummaryPageModel/SummaryPageData.java 2008-05-28 10:29:19 UTC (rev 177) +++ WebEditor/src/edu/lnu/FireFly/WebEditor/ItemModels/SummaryPageModel/SummaryPageData.java 2008-05-29 09:30:08 UTC (rev 178) @@ -1,25 +1,21 @@ package edu.lnu.FireFly.WebEditor.ItemModels.SummaryPageModel; -import java.io.Reader; - -import org.dom4j.Document; import org.dom4j.DocumentHelper; +import org.dom4j.Element; -import edu.lnu.FireFly.FFManifest.TreeItem; import edu.lnu.FireFly.WebEditor.ItemModels.ItemData; public class SummaryPageData extends ItemData { @Override - public String marshal(TreeItem anItem) { - Document doc = DocumentHelper.createDocument(); - doc.addElement(this.getClass().getSimpleName()); + public Element marshal() { + Element root = DocumentHelper.createElement("ItemData"); - return doc.asXML(); + return root; } @Override - public boolean unmarshal(Reader res, TreeItem anItem) { + public boolean unmarshal(Element root) { // TODO Auto-generated method stub return true; } Modified: WebEditor/src/edu/lnu/FireFly/WebEditor/ItemModels/UnknownItemModel.java =================================================================== --- WebEditor/src/edu/lnu/FireFly/WebEditor/ItemModels/UnknownItemModel.java 2008-05-28 10:29:19 UTC (rev 177) +++ WebEditor/src/edu/lnu/FireFly/WebEditor/ItemModels/UnknownItemModel.java 2008-05-29 09:30:08 UTC (rev 178) @@ -81,10 +81,10 @@ TreeDataModel.getInstance().treeNodesDeleted(anItem); } - @Override - public boolean synchronizeItemWithResource(TreeItem anItem, String location) { - return false; - } +// @Override +// public boolean synchronizeItemWithResource(TreeItem anItem, String location) { +// return false; +// } @Override public boolean updateItemResource(TreeItem item, boolean updateSummaryPages) { Modified: WebEditor/src/edu/lnu/FireFly/WebEditor/WebEditor.java =================================================================== --- WebEditor/src/edu/lnu/FireFly/WebEditor/WebEditor.java 2008-05-28 10:29:19 UTC (rev 177) +++ WebEditor/src/edu/lnu/FireFly/WebEditor/WebEditor.java 2008-05-29 09:30:08 UTC (rev 178) @@ -17,9 +17,8 @@ import edu.lnu.FireFly.WebEditor.Data.SummaryPageManager; import edu.lnu.FireFly.WebEditor.GUI.CourseTreePopupMenu; import edu.lnu.FireFly.WebEditor.GUI.TreeDataModel; -import edu.lnu.FireFly.WebEditor.ItemModels.ItemModels; -import edu.lnu.FireFly.WebEditor.ItemModels.OrganizationModel; import edu.lnu.FireFly.WebEditor.WSClients.WebEditorServiceClient; +import edu.lnu.FireFly.WebEditor.itemConfiguration.ItemConfigurationManager; public class WebEditor extends AppletWithWYSIWYGEditor implements MainMenuListenet { @@ -47,6 +46,8 @@ WebEditorServiceClient.getInstance().setFileContent("imsmanifest.xml", parser.toXML(manifest)); + + ItemConfigurationManager.getInstance().save(); } @Override @@ -59,7 +60,7 @@ .getFileContent("imsmanifest.xml", "course")); TreeDataModel.initInstance(manifest); - ItemModels.synchronizeAllItemDatas(manifest.getRoot()); + ItemConfigurationManager.getInstance().load(); SummaryPageManager.getInstance().setManifest(manifest); AnswersStatusManager.getInstance().resetAllAnswers(); @@ -100,7 +101,7 @@ public void showEmptyDocument() throws MalformedURLException { AppletWithApiHandle.setNextItemIdentifier(""); - getAppletContext().showDocument(new URL("/empty.html"), "ContentFrame"); + getAppletContext().showDocument(new URL(Settings.getInstance().getResourceLocation() + "/empty.html"), "ContentFrame"); System.out.println("redirected to empty page"); } @@ -135,14 +136,9 @@ try { manifest = ManifestFactory.createManifest(); SummaryPageManager.getInstance().setManifest(manifest); - ItemModels.synchronizeAllItemDatas(manifest.getRoot()); + TreeDataModel.initInstance(manifest); - TreeItem root = manifest.getRoot(); - OrganizationModel model = (OrganizationModel) ItemModels - .getModelFromItem(root); - - model.synchronizeItemWithResource(root, "template"); SummaryPageManager.getInstance().updateSummaryPages(); AnswersStatusManager.getInstance().resetAllAnswers(); Added: WebEditor/src/edu/lnu/FireFly/WebEditor/itemConfiguration/ItemConfigurationManager.java =================================================================== --- WebEditor/src/edu/lnu/FireFly/WebEditor/itemConfiguration/ItemConfigurationManager.java (rev 0) +++ WebEditor/src/edu/lnu/FireFly/WebEditor/itemConfiguration/ItemConfigurationManager.java 2008-05-29 09:30:08 UTC (rev 178) @@ -0,0 +1,99 @@ +package edu.lnu.FireFly.WebEditor.itemConfiguration; + +import java.io.StringReader; +import java.util.HashMap; +import java.util.Iterator; + +import org.dom4j.Document; +import org.dom4j.DocumentHelper; +import org.dom4j.Element; +import org.dom4j.io.SAXReader; + +import edu.lnu.FireFly.FFManifest.TreeItem; +import edu.lnu.FireFly.WebEditor.ItemModels.ItemData; +import edu.lnu.FireFly.WebEditor.ItemModels.ItemDataFactory; +import edu.lnu.FireFly.WebEditor.WSClients.WebEditorServiceClient; + +public class ItemConfigurationManager { + protected HashMap<String, ItemData> itemDatas = new HashMap<String, ItemData>(); + + private ItemConfigurationManager() { + } + + private static ItemConfigurationManager obj = null; + + public static ItemConfigurationManager getInstance() { + if (obj == null) { + obj = new ItemConfigurationManager(); + } + + return obj; + } + + public void update(TreeItem anItem, ItemData anItemData) { + itemDatas.put(anItem.getIdentifier(), anItemData); + } + + public ItemData get(TreeItem anItem) { + return itemDatas.get(anItem.getIdentifier()); + } + + @SuppressWarnings("unchecked") + public void load() { + String xml = WebEditorServiceClient.getInstance().getFileContent( + "config.xml", "course"); + + Document document = null; + try { + SAXReader reader = new SAXReader(); + document = reader.read(new StringReader(xml)); + } catch (Exception e) { + e.printStackTrace(); + return; + } + + Element root = document.getRootElement(); + + itemDatas.clear(); + + Iterator<Element> iter = root.elementIterator("ItemData"); + while (iter.hasNext()) { + Element itemDataElement = iter.next(); + ItemData itemData = ItemDataFactory.getInstance().createItemData(itemDataElement.attributeValue("type")); + itemData.unmarshal(itemDataElement); + + itemDatas.put(itemDataElement.attributeValue("id"), itemData); + } + } + + public void save() { + String config = ""; + + Document doc = DocumentHelper.createDocument(); + + Element root = DocumentHelper.createElement("ItemConfigurations"); + doc.add(root); + + String[] keys = new String[itemDatas.size()]; + itemDatas.keySet().toArray(keys); + for (String key : keys) { + ItemData itemData = itemDatas.get(key); + Element itemElement = itemData.marshal(); + + itemElement.add(DocumentHelper.createAttribute(root, "type", + itemData.getClass().getSimpleName())); + itemElement.add(DocumentHelper.createAttribute(root, "id", key)); + + root.add(itemElement); + } + + config = doc.asXML(); + + WebEditorServiceClient.getInstance().setFileContent("config.xml", + config); + } + + public void clear() { + itemDatas.clear(); + } +} This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <se...@us...> - 2008-05-29 09:39:55
|
Revision: 179 http://acmcontester.svn.sourceforge.net/acmcontester/?rev=179&view=rev Author: sem62 Date: 2008-05-29 02:39:57 -0700 (Thu, 29 May 2008) Log Message: ----------- Fixed bugs with calculation min/max score when type of simple question is TYPE Modified Paths: -------------- WebEditor/src/edu/lnu/FireFly/WebEditor/ItemModels/SimpleQuestion/SimpleQuestionModel.java Added Paths: ----------- WebEditor/.classpath WebEditor/.project WebEditor/.settings/ WebEditor/.settings/org.eclipse.jdt.core.prefs WebEditor/.settings/org.eclipse.jdt.ui.prefs Added: WebEditor/.classpath =================================================================== --- WebEditor/.classpath (rev 0) +++ WebEditor/.classpath 2008-05-29 09:39:57 UTC (rev 179) @@ -0,0 +1,11 @@ +<?xml version="1.0" encoding="UTF-8"?> +<classpath> + <classpathentry kind="src" path="src"/> + <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/> + <classpathentry kind="lib" path="S:/WebEditor/RTEValidators.jar"/> + <classpathentry kind="lib" path="C:/Documents and Settings/Yura/Мои документы/NetBeansProjects/WebEditor/web/WebEditor/dom4j.jar"/> + <classpathentry kind="lib" path="S:/WebEditor/FFManifest.jar" sourcepath="S:/WebEditor/FFManifest.jar"/> + <classpathentry kind="lib" path="C:/Program Files/Java/jre1.6.0_05/lib/plugin.jar"/> + <classpathentry kind="lib" path="S:/WebEditor/rte.jar" sourcepath="/RTE"/> + <classpathentry kind="output" path="bin"/> +</classpath> Added: WebEditor/.project =================================================================== --- WebEditor/.project (rev 0) +++ WebEditor/.project 2008-05-29 09:39:57 UTC (rev 179) @@ -0,0 +1,17 @@ +<?xml version="1.0" encoding="UTF-8"?> +<projectDescription> + <name>webEditor</name> + <comment></comment> + <projects> + </projects> + <buildSpec> + <buildCommand> + <name>org.eclipse.jdt.core.javabuilder</name> + <arguments> + </arguments> + </buildCommand> + </buildSpec> + <natures> + <nature>org.eclipse.jdt.core.javanature</nature> + </natures> +</projectDescription> Added: WebEditor/.settings/org.eclipse.jdt.core.prefs =================================================================== --- WebEditor/.settings/org.eclipse.jdt.core.prefs (rev 0) +++ WebEditor/.settings/org.eclipse.jdt.core.prefs 2008-05-29 09:39:57 UTC (rev 179) @@ -0,0 +1,256 @@ +#Sun May 18 12:00:25 EEST 2008 +eclipse.preferences.version=1 +org.eclipse.jdt.core.formatter.align_type_members_on_columns=false +org.eclipse.jdt.core.formatter.alignment_for_arguments_in_allocation_expression=16 +org.eclipse.jdt.core.formatter.alignment_for_arguments_in_enum_constant=16 +org.eclipse.jdt.core.formatter.alignment_for_arguments_in_explicit_constructor_call=16 +org.eclipse.jdt.core.formatter.alignment_for_arguments_in_method_invocation=16 +org.eclipse.jdt.core.formatter.alignment_for_arguments_in_qualified_allocation_expression=16 +org.eclipse.jdt.core.formatter.alignment_for_assignment=0 +org.eclipse.jdt.core.formatter.alignment_for_binary_expression=16 +org.eclipse.jdt.core.formatter.alignment_for_compact_if=16 +org.eclipse.jdt.core.formatter.alignment_for_conditional_expression=80 +org.eclipse.jdt.core.formatter.alignment_for_enum_constants=0 +org.eclipse.jdt.core.formatter.alignment_for_expressions_in_array_initializer=16 +org.eclipse.jdt.core.formatter.alignment_for_multiple_fields=16 +org.eclipse.jdt.core.formatter.alignment_for_parameters_in_constructor_declaration=16 +org.eclipse.jdt.core.formatter.alignment_for_parameters_in_method_declaration=16 +org.eclipse.jdt.core.formatter.alignment_for_selector_in_method_invocation=16 +org.eclipse.jdt.core.formatter.alignment_for_superclass_in_type_declaration=16 +org.eclipse.jdt.core.formatter.alignment_for_superinterfaces_in_enum_declaration=16 +org.eclipse.jdt.core.formatter.alignment_for_superinterfaces_in_type_declaration=16 +org.eclipse.jdt.core.formatter.alignment_for_throws_clause_in_constructor_declaration=16 +org.eclipse.jdt.core.formatter.alignment_for_throws_clause_in_method_declaration=16 +org.eclipse.jdt.core.formatter.blank_lines_after_imports=1 +org.eclipse.jdt.core.formatter.blank_lines_after_package=1 +org.eclipse.jdt.core.formatter.blank_lines_before_field=0 +org.eclipse.jdt.core.formatter.blank_lines_before_first_class_body_declaration=0 +org.eclipse.jdt.core.formatter.blank_lines_before_imports=1 +org.eclipse.jdt.core.formatter.blank_lines_before_member_type=1 +org.eclipse.jdt.core.formatter.blank_lines_before_method=1 +org.eclipse.jdt.core.formatter.blank_lines_before_new_chunk=1 +org.eclipse.jdt.core.formatter.blank_lines_before_package=0 +org.eclipse.jdt.core.formatter.blank_lines_between_import_groups=1 +org.eclipse.jdt.core.formatter.blank_lines_between_type_declarations=1 +org.eclipse.jdt.core.formatter.brace_position_for_annotation_type_declaration=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_anonymous_type_declaration=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_array_initializer=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_block=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_block_in_case=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_constructor_declaration=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_enum_constant=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_enum_declaration=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_method_declaration=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_switch=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_type_declaration=end_of_line +org.eclipse.jdt.core.formatter.comment.clear_blank_lines_in_block_comment=false +org.eclipse.jdt.core.formatter.comment.clear_blank_lines_in_javadoc_comment=false +org.eclipse.jdt.core.formatter.comment.format_block_comments=true +org.eclipse.jdt.core.formatter.comment.format_header=false +org.eclipse.jdt.core.formatter.comment.format_html=true +org.eclipse.jdt.core.formatter.comment.format_javadoc_comments=true +org.eclipse.jdt.core.formatter.comment.format_line_comments=true +org.eclipse.jdt.core.formatter.comment.format_source_code=true +org.eclipse.jdt.core.formatter.comment.indent_parameter_description=true +org.eclipse.jdt.core.formatter.comment.indent_root_tags=true +org.eclipse.jdt.core.formatter.comment.insert_new_line_before_root_tags=insert +org.eclipse.jdt.core.formatter.comment.insert_new_line_for_parameter=insert +org.eclipse.jdt.core.formatter.comment.line_length=80 +org.eclipse.jdt.core.formatter.compact_else_if=true +org.eclipse.jdt.core.formatter.continuation_indentation=2 +org.eclipse.jdt.core.formatter.continuation_indentation_for_array_initializer=2 +org.eclipse.jdt.core.formatter.format_guardian_clause_on_one_line=false +org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_annotation_declaration_header=true +org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_enum_constant_header=true +org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_enum_declaration_header=true +org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_type_header=true +org.eclipse.jdt.core.formatter.indent_breaks_compare_to_cases=true +org.eclipse.jdt.core.formatter.indent_empty_lines=false +org.eclipse.jdt.core.formatter.indent_statements_compare_to_block=true +org.eclipse.jdt.core.formatter.indent_statements_compare_to_body=true +org.eclipse.jdt.core.formatter.indent_switchstatements_compare_to_cases=true +org.eclipse.jdt.core.formatter.indent_switchstatements_compare_to_switch=false +org.eclipse.jdt.core.formatter.indentation.size=4 +org.eclipse.jdt.core.formatter.insert_new_line_after_annotation=insert +org.eclipse.jdt.core.formatter.insert_new_line_after_opening_brace_in_array_initializer=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_at_end_of_file_if_missing=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_before_catch_in_try_statement=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_before_closing_brace_in_array_initializer=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_before_else_in_if_statement=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_before_finally_in_try_statement=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_before_while_in_do_statement=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_in_empty_annotation_declaration=insert +org.eclipse.jdt.core.formatter.insert_new_line_in_empty_anonymous_type_declaration=insert +org.eclipse.jdt.core.formatter.insert_new_line_in_empty_block=insert +org.eclipse.jdt.core.formatter.insert_new_line_in_empty_enum_constant=insert +org.eclipse.jdt.core.formatter.insert_new_line_in_empty_enum_declaration=insert +org.eclipse.jdt.core.formatter.insert_new_line_in_empty_method_body=insert +org.eclipse.jdt.core.formatter.insert_new_line_in_empty_type_declaration=insert +org.eclipse.jdt.core.formatter.insert_space_after_and_in_type_parameter=insert +org.eclipse.jdt.core.formatter.insert_space_after_assignment_operator=insert +org.eclipse.jdt.core.formatter.insert_space_after_at_in_annotation=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_at_in_annotation_type_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_binary_operator=insert +org.eclipse.jdt.core.formatter.insert_space_after_closing_angle_bracket_in_type_arguments=insert +org.eclipse.jdt.core.formatter.insert_space_after_closing_angle_bracket_in_type_parameters=insert +org.eclipse.jdt.core.formatter.insert_space_after_closing_brace_in_block=insert +org.eclipse.jdt.core.formatter.insert_space_after_closing_paren_in_cast=insert +org.eclipse.jdt.core.formatter.insert_space_after_colon_in_assert=insert +org.eclipse.jdt.core.formatter.insert_space_after_colon_in_case=insert +org.eclipse.jdt.core.formatter.insert_space_after_colon_in_conditional=insert +org.eclipse.jdt.core.formatter.insert_space_after_colon_in_for=insert +org.eclipse.jdt.core.formatter.insert_space_after_colon_in_labeled_statement=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_allocation_expression=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_annotation=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_array_initializer=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_constructor_declaration_parameters=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_constructor_declaration_throws=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_enum_constant_arguments=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_enum_declarations=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_explicitconstructorcall_arguments=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_for_increments=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_for_inits=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_declaration_parameters=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_declaration_throws=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_invocation_arguments=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_multiple_field_declarations=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_multiple_local_declarations=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_parameterized_type_reference=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_superinterfaces=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_type_arguments=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_type_parameters=insert +org.eclipse.jdt.core.formatter.insert_space_after_ellipsis=insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_parameterized_type_reference=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_type_arguments=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_type_parameters=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_brace_in_array_initializer=insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_bracket_in_array_allocation_expression=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_bracket_in_array_reference=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_annotation=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_cast=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_catch=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_constructor_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_enum_constant=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_for=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_if=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_method_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_method_invocation=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_parenthesized_expression=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_switch=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_synchronized=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_while=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_postfix_operator=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_prefix_operator=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_question_in_conditional=insert +org.eclipse.jdt.core.formatter.insert_space_after_question_in_wildcard=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_semicolon_in_for=insert +org.eclipse.jdt.core.formatter.insert_space_after_unary_operator=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_and_in_type_parameter=insert +org.eclipse.jdt.core.formatter.insert_space_before_assignment_operator=insert +org.eclipse.jdt.core.formatter.insert_space_before_at_in_annotation_type_declaration=insert +org.eclipse.jdt.core.formatter.insert_space_before_binary_operator=insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_parameterized_type_reference=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_type_arguments=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_type_parameters=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_brace_in_array_initializer=insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_bracket_in_array_allocation_expression=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_bracket_in_array_reference=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_annotation=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_cast=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_catch=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_constructor_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_enum_constant=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_for=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_if=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_method_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_method_invocation=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_parenthesized_expression=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_switch=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_synchronized=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_while=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_colon_in_assert=insert +org.eclipse.jdt.core.formatter.insert_space_before_colon_in_case=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_colon_in_conditional=insert +org.eclipse.jdt.core.formatter.insert_space_before_colon_in_default=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_colon_in_for=insert +org.eclipse.jdt.core.formatter.insert_space_before_colon_in_labeled_statement=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_allocation_expression=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_annotation=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_array_initializer=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_constructor_declaration_parameters=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_constructor_declaration_throws=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_enum_constant_arguments=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_enum_declarations=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_explicitconstructorcall_arguments=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_for_increments=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_for_inits=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_declaration_parameters=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_declaration_throws=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_invocation_arguments=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_multiple_field_declarations=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_multiple_local_declarations=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_parameterized_type_reference=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_superinterfaces=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_type_arguments=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_type_parameters=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_ellipsis=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_parameterized_type_reference=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_type_arguments=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_type_parameters=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_annotation_type_declaration=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_anonymous_type_declaration=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_array_initializer=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_block=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_constructor_declaration=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_enum_constant=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_enum_declaration=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_method_declaration=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_switch=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_type_declaration=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_allocation_expression=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_reference=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_type_reference=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_annotation=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_annotation_type_member_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_catch=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_constructor_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_enum_constant=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_for=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_if=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_method_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_method_invocation=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_parenthesized_expression=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_switch=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_synchronized=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_while=insert +org.eclipse.jdt.core.formatter.insert_space_before_parenthesized_expression_in_return=insert +org.eclipse.jdt.core.formatter.insert_space_before_parenthesized_expression_in_throw=insert +org.eclipse.jdt.core.formatter.insert_space_before_postfix_operator=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_prefix_operator=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_question_in_conditional=insert +org.eclipse.jdt.core.formatter.insert_space_before_question_in_wildcard=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_semicolon=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_semicolon_in_for=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_unary_operator=do not insert +org.eclipse.jdt.core.formatter.insert_space_between_brackets_in_array_type_reference=do not insert +org.eclipse.jdt.core.formatter.insert_space_between_empty_braces_in_array_initializer=do not insert +org.eclipse.jdt.core.formatter.insert_space_between_empty_brackets_in_array_allocation_expression=do not insert +org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_annotation_type_member_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_constructor_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_enum_constant=do not insert +org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_method_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_method_invocation=do not insert +org.eclipse.jdt.core.formatter.keep_else_statement_on_same_line=false +org.eclipse.jdt.core.formatter.keep_empty_array_initializer_on_one_line=false +org.eclipse.jdt.core.formatter.keep_imple_if_on_one_line=false +org.eclipse.jdt.core.formatter.keep_then_statement_on_same_line=false +org.eclipse.jdt.core.formatter.lineSplit=80 +org.eclipse.jdt.core.formatter.never_indent_block_comments_on_first_column=false +org.eclipse.jdt.core.formatter.never_indent_line_comments_on_first_column=false +org.eclipse.jdt.core.formatter.number_of_blank_lines_at_beginning_of_method_body=0 +org.eclipse.jdt.core.formatter.number_of_empty_lines_to_preserve=1 +org.eclipse.jdt.core.formatter.put_empty_statement_on_new_line=true +org.eclipse.jdt.core.formatter.tabulation.char=mixed +org.eclipse.jdt.core.formatter.tabulation.size=8 +org.eclipse.jdt.core.formatter.use_tabs_only_for_leading_indentations=false +org.eclipse.jdt.core.formatter.wrap_before_binary_operator=true Added: WebEditor/.settings/org.eclipse.jdt.ui.prefs =================================================================== --- WebEditor/.settings/org.eclipse.jdt.ui.prefs (rev 0) +++ WebEditor/.settings/org.eclipse.jdt.ui.prefs 2008-05-29 09:39:57 UTC (rev 179) @@ -0,0 +1,4 @@ +#Sun May 18 12:00:25 EEST 2008 +eclipse.preferences.version=1 +formatter_profile=org.eclipse.jdt.ui.default.sun_profile +formatter_settings_version=11 Modified: WebEditor/src/edu/lnu/FireFly/WebEditor/ItemModels/SimpleQuestion/SimpleQuestionModel.java =================================================================== --- WebEditor/src/edu/lnu/FireFly/WebEditor/ItemModels/SimpleQuestion/SimpleQuestionModel.java 2008-05-29 09:30:08 UTC (rev 178) +++ WebEditor/src/edu/lnu/FireFly/WebEditor/ItemModels/SimpleQuestion/SimpleQuestionModel.java 2008-05-29 09:39:57 UTC (rev 179) @@ -61,6 +61,13 @@ result = getMax(answers); } } + + if (data.getAnswers().getAnswerType() == SimpleQuestionAnswersDataModel.ANSWER_TYPE_TYPE) { + if (result < 0){ + result = 0; + } + } + return result; } @@ -79,6 +86,13 @@ result = getMin(answers); } } + + if (data.getAnswers().getAnswerType() == SimpleQuestionAnswersDataModel.ANSWER_TYPE_TYPE) { + if (result > 0){ + result = 0; + } + } + return result; } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <se...@us...> - 2008-06-02 21:41:48
|
Revision: 203 http://acmcontester.svn.sourceforge.net/acmcontester/?rev=203&view=rev Author: sem62 Date: 2008-06-02 14:41:52 -0700 (Mon, 02 Jun 2008) Log Message: ----------- Fixed bug with showing compileQParts in template. Modified Paths: -------------- WebEditor/src/edu/lnu/FireFly/WebEditor/ItemModels/CompileQ/CompileQModel.java WebEditor/src/edu/lnu/FireFly/WebEditor/ItemModels/SummaryPageModel/SummaryPageModel.java WebEditor/template/global/compileQ.js Modified: WebEditor/src/edu/lnu/FireFly/WebEditor/ItemModels/CompileQ/CompileQModel.java =================================================================== --- WebEditor/src/edu/lnu/FireFly/WebEditor/ItemModels/CompileQ/CompileQModel.java 2008-06-02 21:02:17 UTC (rev 202) +++ WebEditor/src/edu/lnu/FireFly/WebEditor/ItemModels/CompileQ/CompileQModel.java 2008-06-02 21:41:52 UTC (rev 203) @@ -83,15 +83,16 @@ template.setProperty("Caption", itemData.getCaption()); - Iterator<CompileQPart> iter = itemData.getParts().questionParts - .iterator(); + Iterator<CompileQPart> iter; + iter = itemData.getParts().questionParts.iterator(); + String answers = "\r\nsetProgrammingLanguage(\"" + itemData.getLanguge() + "\");\r\n"; while (iter.hasNext()) { CompileQPart part = iter.next(); answers += "addPart(\"" - + part.getAnswerText().replace("\"", "\\\"") + "\", " + + convertToParameter(part.getAnswerText()) + "\", " + part.getPartAttributes().isAnswer() + ", " + part.getPartAttributes().isReadOnly() + ", " + part.getPartAttributes().isVisible() + ");" + "\r\n"; @@ -101,6 +102,14 @@ template.updateResource(); } + private String convertToParameter(String answerText) { + answerText = answerText.replace("\"", "\\\""); + + answerText = answerText.replace("\n", "\\n"); + + return answerText; + } + @Override public boolean getShowSummaryPageMenuVisible() { return false; @@ -121,6 +130,6 @@ @Override public void showAnswerStatus(UserAnswerStatus answerStatus) { // TODO Auto-generated method stub - + } } \ No newline at end of file Modified: WebEditor/src/edu/lnu/FireFly/WebEditor/ItemModels/SummaryPageModel/SummaryPageModel.java =================================================================== --- WebEditor/src/edu/lnu/FireFly/WebEditor/ItemModels/SummaryPageModel/SummaryPageModel.java 2008-06-02 21:02:17 UTC (rev 202) +++ WebEditor/src/edu/lnu/FireFly/WebEditor/ItemModels/SummaryPageModel/SummaryPageModel.java 2008-06-02 21:41:52 UTC (rev 203) @@ -10,9 +10,6 @@ import edu.lnu.FireFly.WebEditor.ItemModels.ResourcedItemModel; import edu.lnu.FireFly.WebEditor.ItemModels.Template; import edu.lnu.FireFly.WebEditor.ItemModels.Chapter.ChapterModel; -import edu.lnu.FireFly.WebEditor.ItemModels.CompileQ.CompileQModel; -import edu.lnu.FireFly.WebEditor.ItemModels.Lecture.LectureModel; -import edu.lnu.FireFly.WebEditor.ItemModels.SimpleQuestion.SimpleQuestionModel; import edu.lnu.FireFly.WebEditor.UserAnswerStatus.UserAnswerStatus; import edu.lnu.FireFly.WebEditor.itemConfiguration.ItemData; import edu.lnu.FireFly.WebEditor.itemConfiguration.SummaryPageData; @@ -119,9 +116,9 @@ return ""; } - if (model.getClass() == SimpleQuestionModel.class - || model.getClass() == LectureModel.class - || model.getClass() == CompileQModel.class + if (model.getClass() != ChapterModel.class + || model.getClass() == OrganizationModel.class + || model.getClass() == SummaryPageModel.class ) { return "add(\"" + anItem.getTitle() + "\", \"" Modified: WebEditor/template/global/compileQ.js =================================================================== --- WebEditor/template/global/compileQ.js 2008-06-02 21:02:17 UTC (rev 202) +++ WebEditor/template/global/compileQ.js 2008-06-02 21:41:52 UTC (rev 203) @@ -16,22 +16,36 @@ } function show(){ - for (i=0; i < parts.length; i++){ - if (parts[i].isVisible){ + for (i=0; i < parts.length; i++){ + var visible = parts[i].isVisible; + var readOnly = parts[i].isReadOnly; + var answer = parts[i].ispart; + + if (visible){ document.write("<div name='" + parts[i].id + "' id='" + parts[i].id + "'>"); - if (!parts[i].isReadOnly){ - document.write("<textarea rows='15' cols='60' id='part" + parts[i].id + "' name='part" + parts[i].id + "'>"); + if (!readOnly){ + document.write("<textarea rows='10' cols='60' id='part" + parts[i].id + "' name='part" + parts[i].id + "'>"); + } else { + if (answer){ + document.write("<pre>"); + } } + document.write(parts[i].text); - if (!parts[i].isReadOnly){ + + if (!readOnly){ document.write("</textarea>"); + } else { + if (answer){ + document.write("<pre>"); + } } document.write("<div>"); } } } -function check7Answer(frm){ +function checkAnswer(frm){ Terminate(); return false; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <se...@us...> - 2008-05-10 13:02:27
|
Revision: 120 http://acmcontester.svn.sourceforge.net/acmcontester/?rev=120&view=rev Author: sem62 Date: 2008-05-10 06:02:31 -0700 (Sat, 10 May 2008) Log Message: ----------- * Realized deleting resources files from server when deleting item from course tree. * Added method "canDeleteChapter" that determine if you can delete some chapter. * refactoring WSClient's code. Modified Paths: -------------- WebEditor/src/edu/lnu/FireFly/WebEditor/ItemModels/Chapter/ChapterModel.java WebEditor/src/edu/lnu/FireFly/WebEditor/ItemModels/ResourcedItemModel.java WebEditor/src/edu/lnu/FireFly/WebEditor/WSClients/WebEditorServiceClient.java Added Paths: ----------- WebEditor/service/deleteFile.php Added: WebEditor/service/deleteFile.php =================================================================== --- WebEditor/service/deleteFile.php (rev 0) +++ WebEditor/service/deleteFile.php 2008-05-10 13:02:31 UTC (rev 120) @@ -0,0 +1,7 @@ +<? + require_once("config.inc.php"); + + if (isset($_POST['fName'])){ + delete ($course_location . $_POST['fName']); + } +?> \ No newline at end of file Modified: WebEditor/src/edu/lnu/FireFly/WebEditor/ItemModels/Chapter/ChapterModel.java =================================================================== --- WebEditor/src/edu/lnu/FireFly/WebEditor/ItemModels/Chapter/ChapterModel.java 2008-05-10 10:09:14 UTC (rev 119) +++ WebEditor/src/edu/lnu/FireFly/WebEditor/ItemModels/Chapter/ChapterModel.java 2008-05-10 13:02:31 UTC (rev 120) @@ -5,9 +5,14 @@ import edu.lnu.FireFly.WebEditor.GUI.TreeDataModel; import edu.lnu.FireFly.WebEditor.GUI.Dialogs.ChapterPropertiestsDlg; import edu.lnu.FireFly.WebEditor.ItemModels.ItemData; +import edu.lnu.FireFly.WebEditor.ItemModels.ItemModel; +import edu.lnu.FireFly.WebEditor.ItemModels.ItemModels; import edu.lnu.FireFly.WebEditor.ItemModels.ResourcedItemModel; +import edu.lnu.FireFly.WebEditor.ItemModels.SummaryPageModel.SummaryPageModel; +import edu.lnu.FireFly.WebEditor.WSClients.WebEditorServiceClient; public class ChapterModel extends ResourcedItemModel { + public ChapterModel() { super(); modelName = "ChapterModel"; @@ -101,17 +106,50 @@ } @Override - public void remove(TreeItem item) { - if (item.getChildCount() > 0) { + public void remove(TreeItem aChapter) { + if (!canDeleteChapter(aChapter)) { System.out .print("This chapter contain items. Please, remove all childs and try again.\n"); return; } + + for (int i=0; i < aChapter.getChildCount(); i++){ + TreeItem item = aChapter.getChild(i); + ItemModel model = ItemModels.getModelFromItem(item); + + model.remove(item); + } - TreeDataModel.getInstance().treeNodesDeleted(item); - item.getParent().removeChild(item); + TreeDataModel.getInstance().treeNodesDeleted(aChapter); + aChapter.getParent().removeChild(aChapter); + + WebEditorServiceClient.getInstance().deleteFile(getConfFileName(aChapter)); } + /** + * Determine if this chapter can deleted.<br> + * Chapter can be deleted, if it have no childs or it containe only summary page. + * + * @param aChapter + * @return true, if this chapter can be deleted. + */ + private boolean canDeleteChapter(TreeItem aChapter) { + boolean result = aChapter.getChildCount() == 0; + + if (!result){ + if (aChapter.getChildCount() == 1){ + TreeItem child = aChapter.getChild(0); + ItemModel model = ItemModels.getModelFromItem(child); + + if (model.getClass() == SummaryPageModel.class){ + return true; + } + } + } + + return result; + } + @Override public void rename(TreeItem item, String newTitle) { ((Item) item).title = newTitle; Modified: WebEditor/src/edu/lnu/FireFly/WebEditor/ItemModels/ResourcedItemModel.java =================================================================== --- WebEditor/src/edu/lnu/FireFly/WebEditor/ItemModels/ResourcedItemModel.java 2008-05-10 10:09:14 UTC (rev 119) +++ WebEditor/src/edu/lnu/FireFly/WebEditor/ItemModels/ResourcedItemModel.java 2008-05-10 13:02:31 UTC (rev 120) @@ -3,6 +3,7 @@ import java.io.StringReader; import java.util.UUID; +import edu.lnu.FireFly.FFManifest.Manifest; import edu.lnu.FireFly.FFManifest.TreeItem; import edu.lnu.FireFly.FFManifest.item.Item; import edu.lnu.FireFly.FFManifest.resource.Resource; @@ -44,11 +45,11 @@ ConfigureItem(item); } - protected final String loadResource(String location, String identifier) { + protected final String loadResource(String location, TreeItem anItem) { String res = ""; if (location.equalsIgnoreCase("course")) { - res = WebEditorServiceClient.getInstance().getFileContent(identifier + ".conf", + res = WebEditorServiceClient.getInstance().getFileContent(getConfFileName(anItem), location); } else { res = WebEditorServiceClient.getInstance().getFileContent(modelName + ".conf", @@ -78,11 +79,33 @@ } @Override - public void remove(TreeItem item) { - TreeDataModel.getInstance().treeNodesDeleted(item); - item.getParent().removeChild(item); + public void remove(TreeItem anItem) { + TreeDataModel.getInstance().treeNodesDeleted(anItem); + anItem.getParent().removeChild(anItem); + + deleteResource(anItem); } + private void deleteResource(TreeItem anItem) { + if (canDeleteResource(anItem)){ + Manifest manifest = SummaryPageManager.getInstance().getManifest(); + + String identifier = getIdentifierRef(anItem); + Resource resource = manifest.resources.findResourceByIdentifier(identifier); + + WebEditorServiceClient.getInstance().deleteFile(resource.getFullHref()); + WebEditorServiceClient.getInstance().deleteFile(getConfFileName(anItem)); + + manifest.resources.deleteResource(identifier); + } + } + + private boolean canDeleteResource(TreeItem anItem) { + // TODO need check links to resource from other items in course tree. + + return true; + } + @Override public void rename(TreeItem item, String newTitle) { ((Item) item).title = newTitle; @@ -91,7 +114,7 @@ public final boolean synchronizeItemWithResource(TreeItem anItem, String location) { - String res = loadResource(location, getConfFileName(anItem)); + String res = loadResource(location, anItem); if (res == null || res.trim().equals("")) { return false; @@ -113,13 +136,13 @@ Resource resource = WebEditor.instance.getManifest().resources .findResourceByIdentifier(getIdentifierRef(anItem)); - return resource.identifier; + return resource.identifier + ".conf"; } protected final void initializeDataForItem(Item anItem){ ItemData itemData = createItemDataInstance(); - String res = loadResource("template", getIdentifier(anItem)); + String res = loadResource("template", anItem); itemData.unmarshal(new StringReader(res), anItem); @@ -135,7 +158,7 @@ ItemData itemData = getItemData(anItem); WebEditorServiceClient.getInstance().setFileContent( - getConfFileName(anItem) + ".conf", itemData.marshal(anItem)); + getConfFileName(anItem), itemData.marshal(anItem)); if (updateSummaryPages) { SummaryPageManager.getInstance().updateSummaryPages(); Modified: WebEditor/src/edu/lnu/FireFly/WebEditor/WSClients/WebEditorServiceClient.java =================================================================== --- WebEditor/src/edu/lnu/FireFly/WebEditor/WSClients/WebEditorServiceClient.java 2008-05-10 10:09:14 UTC (rev 119) +++ WebEditor/src/edu/lnu/FireFly/WebEditor/WSClients/WebEditorServiceClient.java 2008-05-10 13:02:31 UTC (rev 120) @@ -3,6 +3,7 @@ import java.io.BufferedReader; import java.io.InputStreamReader; import java.io.OutputStreamWriter; +import java.io.UnsupportedEncodingException; import java.net.URL; import java.net.URLConnection; import java.net.URLEncoder; @@ -33,8 +34,9 @@ long lastCommunication = WebEditorServiceClient .getInstance().getLastCommunicationTime(); - - if (System.currentTimeMillis() - lastCommunication > Settings.getInstance().getNopInterval()){ + + if (System.currentTimeMillis() - lastCommunication > Settings + .getInstance().getNopInterval()) { WebEditorServiceClient.getInstance().nop(); } } @@ -59,35 +61,89 @@ * @return */ public String getFileContent(String fName, String location) { + return getFileContent(fName, location, true); + } + + public String getFileContent(String fName, String location, boolean useHash) { System.out.println("Getting file's content (fName=" + fName + "; location=" + location + ")..."); - if (location.equalsIgnoreCase("template")) { - String template = templates.get(fName); - if (template != null) { - System.out.println("Founded in templates hash."); - return template; + if (useHash) { + if (location.equalsIgnoreCase("template")) { + String template = templates.get(fName); + if (template != null) { + System.out.println("Founded in templates hash."); + return template; + } + } else { + String content = contents.get(fName); + if (content != null) { + System.out.println("Founded in contents hash."); + return content; + } } - } else { - String content = contents.get(fName); - if (content != null) { - System.out.println("Founded in contents hash."); - return content; - } } - String result = ""; + String data; try { // Construct data - String data = URLEncoder.encode("fName", "UTF-8") + "=" + data = URLEncoder.encode("fName", "UTF-8") + "=" + URLEncoder.encode(fName, "UTF-8"); data += "&" + URLEncoder.encode("location", "UTF-8") + "=" + URLEncoder.encode(location, "UTF-8"); - // Send data + } catch (Exception e) { + e.printStackTrace(); + return null; + } + + String result = getResponse(data, "getFileContent.php"); + + if (location.equalsIgnoreCase("template")) { + templates.put(fName, result); + } else { + contents.put(fName, result); + } + + lastCommunicationTime = System.currentTimeMillis(); + return result; + } + + /** + * @param fName + * File name + * @param location + * Location name = template | course + * @return + */ + public boolean deleteFile(String fName) { + System.out.println("Deleting file (fName=" + fName + ")..."); + + // Construct data + String data; + try { + data = URLEncoder.encode("fName", "UTF-8") + "=" + + URLEncoder.encode(fName, "UTF-8"); + + } catch (UnsupportedEncodingException e) { + e.printStackTrace(); + return false; + } + + String result = getResponse(data, "deleteFile.php"); + + System.out.println("deleting result: " + result); + + lastCommunicationTime = System.currentTimeMillis(); + return true; + } + + private String getResponse(String data, String action) { + String result = ""; + try { URL url = new URL(Settings.getInstance().getServiceLocation() - + "getFileContent.php"); + + action); URLConnection conn = url.openConnection(); conn.setDoOutput(true); @@ -109,15 +165,9 @@ rd.close(); } catch (Exception e) { e.printStackTrace(); + return null; } - if (location.equalsIgnoreCase("template")) { - templates.put(fName, result); - } else { - contents.put(fName, result); - } - - lastCommunicationTime = System.currentTimeMillis(); return result; } @@ -132,48 +182,27 @@ contents.put(fName, content); - String result = ""; + String data = ""; try { // Construct data - String data = URLEncoder.encode("fName", "UTF-8") + "=" + data = URLEncoder.encode("fName", "UTF-8") + "=" + URLEncoder.encode(fName, "UTF-8"); data += "&" + URLEncoder.encode("content", "UTF-8") + "=" + URLEncoder.encode(content, "UTF-8"); - - // Send data - URL url = new URL(Settings.getInstance().getServiceLocation() - + "setFileContent.php"); - - URLConnection conn = url.openConnection(); - conn.setDoOutput(true); - - OutputStreamWriter wr = new OutputStreamWriter(conn - .getOutputStream()); - - wr.write(data); - wr.flush(); - - // Get the response - BufferedReader rd = new BufferedReader(new InputStreamReader(conn - .getInputStream())); - String line; - while ((line = rd.readLine()) != null) { - result += line + "\n"; - } - wr.close(); - rd.close(); } catch (Exception e) { e.printStackTrace(); } + getResponse(data, "setFileContent.php"); + lastCommunicationTime = System.currentTimeMillis(); } protected void nop() { lastCommunicationTime = System.currentTimeMillis(); System.out.println("Nop"); - - getFileContent("LectureModel.conf", "template"); + + getFileContent("ChapterModel.conf", "template", false); } protected Thread nopThread; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |