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. |