Index: lams_tool_lamc/conf/hibernate/mappings/org/lamsfoundation/lams/tool/mc/McContent.hbm.xml =================================================================== RCS file: /usr/local/cvsroot/lams_tool_lamc/conf/hibernate/mappings/org/lamsfoundation/lams/tool/mc/Attic/McContent.hbm.xml,v diff -u -r1.17 -r1.18 --- lams_tool_lamc/conf/hibernate/mappings/org/lamsfoundation/lams/tool/mc/McContent.hbm.xml 31 Aug 2006 10:32:09 -0000 1.17 +++ lams_tool_lamc/conf/hibernate/mappings/org/lamsfoundation/lams/tool/mc/McContent.hbm.xml 2 Oct 2006 01:59:54 -0000 1.18 @@ -103,29 +103,6 @@ length="1" /> - - - - - - - - + + + + + - - - - - + + + - + - - - + /> + - - - - - + @@ -87,19 +87,6 @@ - - - - - - - - - - - - - @@ -113,18 +100,6 @@ - - - - - - - - - - - - @@ -151,19 +126,6 @@ - - - - - - - - - - - - - @@ -202,19 +164,6 @@ - - - - - - - - - - - - - @@ -263,7 +212,7 @@
- + @@ -278,13 +227,25 @@ - + - - - + + + + + + + + + + + + + + + @@ -311,18 +272,6 @@ - - - - - - - - - - - - @@ -349,6 +298,12 @@ + + + + + + @@ -687,7 +642,7 @@ - + @@ -743,7 +698,7 @@ - + Index: lams_tool_lamc/db/sql/create_lams_tool_mc.sql =================================================================== RCS file: /usr/local/cvsroot/lams_tool_lamc/db/sql/create_lams_tool_mc.sql,v diff -u -r1.16 -r1.17 --- lams_tool_lamc/db/sql/create_lams_tool_mc.sql 31 Aug 2006 10:32:09 -0000 1.16 +++ lams_tool_lamc/db/sql/create_lams_tool_mc.sql 2 Oct 2006 01:59:56 -0000 1.17 @@ -7,18 +7,13 @@ , update_date DATETIME , reflect TINYINT(1) NOT NULL DEFAULT 0 , questions_sequenced TINYINT(1) NOT NULL DEFAULT 0 - , username_visible TINYINT(1) NOT NULL DEFAULT 0 , created_by BIGINT(20) NOT NULL DEFAULT 0 - , monitoring_report_title TEXT NOT NULL - , report_title TEXT NOT NULL , run_offline TINYINT(1) NOT NULL DEFAULT 0 , define_later TINYINT(1) NOT NULL DEFAULT 0 - , synch_in_monitor TINYINT(1) NOT NULL DEFAULT 0 , offline_instructions TEXT , online_instructions TEXT , content_in_use TINYINT(1) NOT NULL DEFAULT 0 , retries TINYINT(1) NOT NULL DEFAULT 0 - , show_feedback TINYINT(1) NOT NULL DEFAULT 0 , pass_mark INTEGER , show_report TINYINT(1) NOT NULL DEFAULT 0 , reflectionSubject TEXT @@ -28,13 +23,13 @@ CREATE TABLE tl_lamc11_que_content ( uid BIGINT(20) NOT NULL AUTO_INCREMENT - , question VARCHAR(255) + , question TEXT + , mark INT(5) NOT NULL DEFAULT 1 , weight INT(5) NOT NULL DEFAULT 0 , disabled TINYINT(1) NOT NULL DEFAULT 1 - , feedbackCorrect TEXT - , feedbackIncorrect TEXT , display_order INT(5) , mc_content_id BIGINT(20) NOT NULL + , feedback TEXT , PRIMARY KEY (uid) , INDEX (mc_content_id) , CONSTRAINT FK_tl_lamc11_que_content_1 FOREIGN KEY (mc_content_id) @@ -106,21 +101,21 @@ )TYPE=InnoDB; CREATE TABLE tl_lamc11_uploadedfile ( - uid BIGINT(20) NOT NULL AUTO_INCREMENT + submissionId BIGINT(20) NOT NULL AUTO_INCREMENT , uuid VARCHAR(255) NOT NULL , mc_content_id BIGINT(20) NOT NULL , isOnline_File TINYINT(1) NOT NULL , filename VARCHAR(255) NOT NULL - , PRIMARY KEY (uid) + , PRIMARY KEY (submissionId) , INDEX (mc_content_id) , CONSTRAINT FK_tl_lamc11_uploadedFile FOREIGN KEY (mc_content_id) REFERENCES tl_lamc11_content (uid) )TYPE=InnoDB; -INSERT INTO tl_lamc11_content(uid, content_id , title, instructions, creation_date , reflect, questions_sequenced , username_visible , created_by , monitoring_report_title , report_title , run_offline , define_later, synch_in_monitor, offline_instructions, online_instructions, content_in_use, retries, show_feedback, show_report, pass_mark) VALUES (1, ${default_content_id} , 'MCQ Title', 'MCQ Instructions', NOW(), 0, 0, 0,1,'Monitoring Report','Report', 0, 0, 0,'offline instructions','online instructions', 0, 0, 0, 0, 50); +INSERT INTO tl_lamc11_content(uid, content_id , title, instructions, creation_date , reflect, questions_sequenced , created_by , run_offline , define_later, offline_instructions, online_instructions, content_in_use, retries, show_report, pass_mark) VALUES (1, ${default_content_id} , 'MCQ Title', 'MCQ Instructions', NOW(), 0, 0, 1, 0, 0, 'offline instructions','online instructions', 0, 0, 0, 0); -INSERT INTO tl_lamc11_que_content (uid,question, weight, disabled, display_order, mc_content_id, feedbackIncorrect, feedbackCorrect) VALUES (1, 'A Sample question?', 100, 0, 1,1, 'Your answer is incorrect', 'Correct'); +INSERT INTO tl_lamc11_que_content (uid,question, mark, weight, disabled, display_order, mc_content_id) VALUES (1, 'A Sample question?', 1, 100, 0, 1,1); INSERT INTO tl_lamc11_options_content (uid, correct_option, mc_que_content_id, mc_que_option_text) VALUES (1, 0, 1,'Candidate Answer 1'); INSERT INTO tl_lamc11_options_content (uid, correct_option, mc_que_content_id, mc_que_option_text) VALUES (2, 1, 1,'Candidate Answer 2'); Index: lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/dao/hibernate/McContentDAO.java =================================================================== RCS file: /usr/local/cvsroot/lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/dao/hibernate/McContentDAO.java,v diff -u -r1.18 -r1.19 --- lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/dao/hibernate/McContentDAO.java 17 Sep 2006 06:23:45 -0000 1.18 +++ lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/dao/hibernate/McContentDAO.java 2 Oct 2006 01:59:59 -0000 1.19 @@ -104,6 +104,13 @@ this.getHibernateTemplate().update(mcContent); } + public void saveOrUpdateMc(McContent mc) + { + this.getSession().setFlushMode(FlushMode.AUTO); + logger.debug("before saveOrUpdateMc: " + mc); + this.getHibernateTemplate().saveOrUpdate(mc); + } + public void removeMcById(Long mcContentId) { Index: lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/pojos/McContent.java =================================================================== RCS file: /usr/local/cvsroot/lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/pojos/McContent.java,v diff -u -r1.12 -r1.13 --- lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/pojos/McContent.java 17 Sep 2006 06:23:45 -0000 1.12 +++ lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/pojos/McContent.java 2 Oct 2006 01:59:55 -0000 1.13 @@ -68,7 +68,6 @@ /** nullable persistent field */ private boolean reflect; - /** nullable persistent field */ private Date creationDate; @@ -79,21 +78,9 @@ private boolean questionsSequenced; /** nullable persistent field */ - private boolean usernameVisible; - - /** nullable persistent field */ - private String reportTitle; - - /** nullable persistent field */ - private String monitoringReportTitle; - - /** nullable persistent field */ private long createdBy; /** nullable persistent field */ - private boolean synchInMonitor; - - /** nullable persistent field */ private boolean contentInUse; /** nullable persistent field */ @@ -108,15 +95,10 @@ private boolean showReport; - /** nullable persistent field */ private Integer passMark; - /** nullable persistent field */ - private boolean showFeedback; - private String reflectionSubject; - /** persistent field */ private Set mcQueContents; @@ -129,10 +111,8 @@ /** full constructor */ public McContent(Long mcContentId, String content, String title, String instructions, boolean defineLater, boolean runOffline, Date creationDate, - Date updateDate, boolean questionsSequenced, boolean usernameVisible, String reportTitle, String monitoringReportTitle, - long createdBy, boolean synchInMonitor, boolean contentInUse, String offlineInstructions, String onlineInstructions, - Integer passMark, boolean showReport, boolean showFeedback, boolean retries, boolean reflect, - String reflectionSubject, Set mcQueContents, Set mcSessions, + Date updateDate, boolean questionsSequenced, long createdBy, boolean contentInUse, String offlineInstructions, String onlineInstructions, + Integer passMark, boolean showReport, boolean retries, boolean reflect, String reflectionSubject, Set mcQueContents, Set mcSessions, Set mcAttachments) { logger.debug("copying properties"); @@ -145,13 +125,8 @@ this.creationDate = creationDate; this.updateDate = updateDate; this.questionsSequenced = questionsSequenced; - this.usernameVisible = usernameVisible; - this.reportTitle = reportTitle; - this.monitoringReportTitle = monitoringReportTitle; this.createdBy = createdBy; - this.synchInMonitor = synchInMonitor; this.contentInUse = contentInUse; - this.showFeedback = showFeedback; this.offlineInstructions = offlineInstructions; this.onlineInstructions = onlineInstructions; this.retries=retries; @@ -200,17 +175,12 @@ mc.getCreationDate(), mc.getUpdateDate(), mc.isQuestionsSequenced(), - mc.isUsernameVisible(), - mc.getReportTitle(), - mc.getMonitoringReportTitle(), mc.getCreatedBy(), - mc.isSynchInMonitor(), mc.isContentInUse(), mc.getOfflineInstructions(), mc.getOnlineInstructions(), mc.getPassMark(), mc.isShowReport(), - mc.isShowFeedback(), mc.isRetries(), mc.isReflect(), mc.getReflectionSubject(), @@ -239,7 +209,6 @@ McQueContent queContent = (McQueContent) i.next(); if (queContent.getMcContent() != null) { - logger.debug("deep copying queContent: " + queContent.getFeedbackIncorrect()); McQueContent mcQueContent=McQueContent.newInstance(queContent, newMcContent); newMcQueContent.add(mcQueContent); @@ -336,30 +305,6 @@ this.questionsSequenced = questionsSequenced; } - public boolean isUsernameVisible() { - return this.usernameVisible; - } - - public void setUsernameVisible(boolean usernameVisible) { - this.usernameVisible = usernameVisible; - } - - public String getReportTitle() { - return this.reportTitle; - } - - public void setReportTitle(String reportTitle) { - this.reportTitle = reportTitle; - } - - public String getMonitoringReportTitle() { - return this.monitoringReportTitle; - } - - public void setMonitoringReportTitle(String monitoringReportTitle) { - this.monitoringReportTitle = monitoringReportTitle; - } - public long getCreatedBy() { return this.createdBy; } @@ -368,14 +313,6 @@ this.createdBy = createdBy; } - public boolean isSynchInMonitor() { - return this.synchInMonitor; - } - - public void setSynchInMonitor(boolean synchInMonitor) { - this.synchInMonitor = synchInMonitor; - } - public boolean isContentInUse() { return this.contentInUse; } @@ -408,14 +345,6 @@ this.passMark = passMark; } - public boolean isShowFeedback() { - return this.showFeedback; - } - - public void setShowFeedback(boolean showFeedback) { - this.showFeedback = showFeedback; - } - public Set getMcQueContents() { if (this.mcQueContents == null) @@ -473,6 +402,9 @@ * @return Returns the mcAttachments. */ public Set getMcAttachments() { + if(mcAttachments == null) + mcAttachments = new TreeSet(); + return mcAttachments; } /** Index: lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/pojos/McQueContent.java =================================================================== RCS file: /usr/local/cvsroot/lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/pojos/McQueContent.java,v diff -u -r1.5 -r1.6 --- lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/pojos/McQueContent.java 17 Sep 2006 06:23:45 -0000 1.5 +++ lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/pojos/McQueContent.java 2 Oct 2006 01:59:55 -0000 1.6 @@ -58,9 +58,9 @@ /** nullable persistent field */ private Integer weight; - private String feedbackCorrect; + private Integer mark; - private String feedbackIncorrect; + private String feedback; /** non persistent field */ @@ -101,19 +101,43 @@ this.mcUsrAttempts = mcUsrAttempts; this.mcOptionsContents = mcOptionsContents; } + - public McQueContent(String question, Integer displayOrder, Integer weight, String feedbackIncorrect, String feedbackCorrect, McContent mcContent, Set mcUsrAttempts, Set mcOptionsContents) { + public McQueContent(String question, Integer displayOrder, Integer weight, Integer mark, McContent mcContent, Set mcUsrAttempts, Set mcOptionsContents) { this.question = question; this.displayOrder = displayOrder; this.weight = weight; - this.feedbackIncorrect = feedbackIncorrect; - this.feedbackCorrect = feedbackCorrect; + this.mark = mark; this.mcContent=mcContent; this.mcUsrAttempts = mcUsrAttempts; this.mcOptionsContents = mcOptionsContents; } + + public McQueContent(String question, Integer displayOrder, Integer weight, String feedback, McContent mcContent, Set mcUsrAttempts, Set mcOptionsContents) { + this.question = question; + this.displayOrder = displayOrder; + this.weight = weight; + this.feedback = feedback; + this.mcContent=mcContent; + this.mcUsrAttempts = mcUsrAttempts; + this.mcOptionsContents = mcOptionsContents; + } + + public McQueContent(String question, Integer displayOrder, Integer weight, Integer mark, String feedback, McContent mcContent, Set mcUsrAttempts, Set mcOptionsContents) { + this.question = question; + this.displayOrder = displayOrder; + this.weight = weight; + this.mark = mark; + this.feedback = feedback; + this.mcContent=mcContent; + this.mcUsrAttempts = mcUsrAttempts; + this.mcOptionsContents = mcOptionsContents; + } + + + public McQueContent(Long mcQueContentId, String question, Integer displayOrder, Set mcUsrAttempts, Set mcOptionsContents) { this.mcQueContentId = mcQueContentId; this.question = question; @@ -131,8 +155,18 @@ this.mcOptionsContents = mcOptionsContents; } + public McQueContent(Long mcQueContentId, String question, Integer displayOrder, Integer weight,Integer mark, Set mcUsrAttempts, Set mcOptionsContents) { + this.mcQueContentId = mcQueContentId; + this.question = question; + this.displayOrder = displayOrder; + this.weight=weight; + this.mark=mark; + this.mcUsrAttempts = mcUsrAttempts; + this.mcOptionsContents = mcOptionsContents; + } + + - public McQueContent(String question, Integer displayOrder, Set mcUsrAttempts, Set mcOptionsContents) { this.question = question; this.displayOrder = displayOrder; @@ -166,12 +200,12 @@ McContent newMcContent) { - logger.debug("deep copying queContent: " + queContent.getFeedbackIncorrect()); + logger.debug("deep copying queContent: " + queContent); McQueContent newQueContent = new McQueContent(queContent.getQuestion(), queContent.getDisplayOrder(), queContent.getWeight(), - queContent.getFeedbackIncorrect(), - queContent.getFeedbackCorrect(), + queContent.getMark(), + queContent.getFeedback(), newMcContent, new TreeSet(), new TreeSet()); @@ -291,31 +325,32 @@ public void setWeight(Integer weight) { this.weight = weight; } - /** - * @return Returns the feedbackCorrect. - */ - public String getFeedbackCorrect() { - return feedbackCorrect; - } - /** - * @param feedbackCorrect The feedbackCorrect to set. - */ - public void setFeedbackCorrect(String feedbackCorrect) { - this.feedbackCorrect = feedbackCorrect; - } - /** - * @return Returns the feedbackIncorrect. - */ - public String getFeedbackIncorrect() { - return feedbackIncorrect; - } - /** - * @param feedbackIncorrect The feedbackIncorrect to set. - */ - public void setFeedbackIncorrect(String feedbackIncorrect) { - this.feedbackIncorrect = feedbackIncorrect; - } + + /** + * @return Returns the logger. + */ + public static Logger getLogger() { + return logger; + } + /** + * @param logger The logger to set. + */ + public static void setLogger(Logger logger) { + McQueContent.logger = logger; + } + /** + * @return Returns the feedback. + */ + public String getFeedback() { + return feedback; + } + /** + * @param feedback The feedback to set. + */ + public void setFeedback(String feedback) { + this.feedback = feedback; + } public int compareTo(Object o) { McQueContent queContent = (McQueContent) o; @@ -325,4 +360,17 @@ else return (int) (mcQueContentId.longValue() - queContent.mcQueContentId.longValue()); } + + /** + * @return Returns the mark. + */ + public Integer getMark() { + return mark; + } + /** + * @param mark The mark to set. + */ + public void setMark(Integer mark) { + this.mark = mark; + } } Index: lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/pojos/McUploadedFile.java =================================================================== RCS file: /usr/local/cvsroot/lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/pojos/Attic/McUploadedFile.java,v diff -u -r1.5 -r1.6 --- lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/pojos/McUploadedFile.java 17 Sep 2006 06:23:45 -0000 1.5 +++ lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/pojos/McUploadedFile.java 2 Oct 2006 01:59:55 -0000 1.6 @@ -20,12 +20,14 @@ * http://www.gnu.org/licenses/gpl.txt * **************************************************************** */ -/* $$Id$$ */ +/* $$Id$$ */ package org.lamsfoundation.lams.tool.mc.pojos; import java.io.Serializable; import org.apache.commons.lang.StringUtils; +import org.apache.commons.lang.builder.EqualsBuilder; +import org.apache.commons.lang.builder.HashCodeBuilder; import org.apache.commons.lang.builder.ToStringBuilder; import org.apache.log4j.Logger; import org.lamsfoundation.lams.contentrepository.ItemNotFoundException; @@ -34,19 +36,26 @@ import org.lamsfoundation.lams.contentrepository.client.IToolContentHandler; /** - *

Persistent object/bean that defines the uploaded file for the MCQ tool. - * Provides accessors and mutators to get/set attributes - * It maps to database table: tl_lamc11_uploadedFile - *

* * @author Ozgur Demirtas + * + * TODO To change the template for this generated type comment go to + * Window - Preferences - Java - Code Style - Code Templates */ + +/** + * McQueContent Value Object + * The value object that maps to our model database table: tl_lamc11_que_content + * The relevant hibernate mapping resides in: McQueContent.hbm.xml + * + * Holds question content within a particular content + */ + public class McUploadedFile implements Serializable, Comparable { static Logger logger = Logger.getLogger(McUploadedFile.class.getName()); - /** identifier field */ - private Long uid; + private Long submissionId; /** persistent field */ private String uuid; @@ -55,53 +64,28 @@ private boolean fileOnline; /** persistent field */ - private String filename; + private String fileName; - - private Long mcContentId; - /** persistent field */ private McContent mcContent; public McUploadedFile(){}; /** full constructor */ - public McUploadedFile(Long uid, + public McUploadedFile(Long submissionId, String uuid, boolean fileOnline, - String filename, + String fileName, McContent mcContent) { - this.uid=uid; + this.submissionId=submissionId; this.uuid = uuid; this.fileOnline = fileOnline; - this.filename = filename; + this.fileName = fileName; this.mcContent=mcContent; } - - public McUploadedFile(String uuid, - boolean fileOnline, - String filename, - McContent mcContent) - { - this.uuid = uuid; - this.fileOnline = fileOnline; - this.filename = filename; - this.mcContent=mcContent; - } - public McUploadedFile(String uuid, - boolean fileOnline, - String filename, - Long mcContentId) - { - this.uuid = uuid; - this.fileOnline = fileOnline; - this.filename = filename; - this.mcContentId=mcContentId; - } - public static McUploadedFile newInstance(IToolContentHandler toolContentHandler, McUploadedFile mcUploadedFile, McContent newMcContent) throws ItemNotFoundException, RepositoryCheckedException @@ -110,16 +94,16 @@ try { - String fileUuid = mcUploadedFile.getUuid(); + String fileUuid = mcUploadedFile.getUuid(); if(toolContentHandler != null){ NodeKey copiedNodeKey = toolContentHandler.copyFile(new Long(mcUploadedFile.getUuid())); - fileUuid = copiedNodeKey.getUuid().toString(); logger.debug("copied NodeKey: " + copiedNodeKey); - logger.debug("copied NodeKey uuid: " + fileUuid); + logger.debug("copied NodeKey uuid: " + copiedNodeKey.getUuid().toString()); + fileUuid = copiedNodeKey.getUuid().toString(); } newMcUploadedFile = new McUploadedFile(fileUuid, - mcUploadedFile.isFileOnline(), - mcUploadedFile.getFilename(), + mcUploadedFile.isFileOnline(), + mcUploadedFile.getFileName(), newMcContent); } @@ -132,12 +116,54 @@ } + + public McUploadedFile(String uuid, + boolean fileOnline, + String fileName, + McContent mcContent) + { + logger.debug("constructor gets called."); + this.uuid = uuid; + this.fileOnline = fileOnline; + this.fileName = fileName; + this.mcContent=mcContent; + } + + public String toString() { return new ToStringBuilder(this) .append("uuid: ", getUuid()) + .append("fileName: ", getFileName()) .toString(); } + + public boolean equals(Object other) { + if ( !(other instanceof McUploadedFile) ) return false; + McUploadedFile castOther = (McUploadedFile) other; + return new EqualsBuilder() + .append(this.getUuid(), castOther.getUuid()) + .isEquals(); + } + + public int hashCode() { + return new HashCodeBuilder() + .append(getUuid()) + .toHashCode(); + } + + /** + * @return Returns the fileName. + */ + public String getFileName() { + return fileName; + } + /** + * @param fileName The fileName to set. + */ + public void setFileName(String fileName) { + this.fileName = fileName; + } /** * @return Returns the mcContent. @@ -151,29 +177,18 @@ public void setMcContent(McContent mcContent) { this.mcContent = mcContent; } + /** - * @return Returns the mcContentId. + * @return Returns the submissionId. */ - public Long getMcContentId() { - return mcContentId; - } - /** - * @param mcContentId The mcContentId to set. - */ - public void setMcContentId(Long mcContentId) { - this.mcContentId = mcContentId; - } - /** - * @return Returns the uid. - */ public Long getSubmissionId() { - return uid; + return submissionId; } /** - * @param uid The uid to set. + * @param submissionId The submissionId to set. */ - public void setSubmissionId(Long uid) { - this.uid = uid; + public void setSubmissionId(Long submissionId) { + this.submissionId = submissionId; } /** * @return Returns the uuid. @@ -199,39 +214,15 @@ public void setFileOnline(boolean fileOnline) { this.fileOnline = fileOnline; } - /** - * @return Returns the uid. - */ - public Long getUid() { - return uid; - } - /** - * @param uid The uid to set. - */ - public void setUid(Long uid) { - this.uid = uid; - } - /** - * @return Returns the filename. - */ - public String getFilename() { - return filename; - } - /** - * @param filename The filename to set. - */ - public void setFilename(String filename) { - this.filename = filename; - } public int compareTo(Object o) { - McUploadedFile optContent = (McUploadedFile) o; + McUploadedFile file = (McUploadedFile) o; //if the object does not exist yet, then just return any one of 0, -1, 1. Should not make a difference. - if (uid == null) + if (submissionId == null) return 1; else - return (int) (uid.longValue() - optContent.uid.longValue()); + return (int) (submissionId.longValue() - file.submissionId.longValue()); } public String getFileProperty() { if (isFileOnline()) @@ -248,5 +239,4 @@ else this.fileOnline = false; } - } Index: lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/service/IMcService.java =================================================================== RCS file: /usr/local/cvsroot/lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/service/IMcService.java,v diff -u -r1.56 -r1.57 --- lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/service/IMcService.java 17 Sep 2006 06:23:44 -0000 1.56 +++ lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/service/IMcService.java 2 Oct 2006 01:59:34 -0000 1.57 @@ -41,6 +41,7 @@ import org.lamsfoundation.lams.tool.mc.pojos.McQueContent; import org.lamsfoundation.lams.tool.mc.pojos.McQueUsr; import org.lamsfoundation.lams.tool.mc.pojos.McSession; +import org.lamsfoundation.lams.tool.mc.pojos.McUploadedFile; import org.lamsfoundation.lams.tool.mc.pojos.McUsrAttempt; import org.lamsfoundation.lams.usermanagement.User; @@ -60,6 +61,10 @@ public void createMcQue(McQueContent mcQueContent) throws McApplicationException; + public void updateMcQueContent(McQueContent mcQueContent) throws McApplicationException; + + public List retrieveMcQueContentsByToolContentId(long mcContentId) throws McApplicationException; + public McQueContent getQuestionContentByDisplayOrder(final Long displayOrder, final Long mcContentUid) throws McApplicationException; public void createMcSession(McSession mcSession) throws McApplicationException; @@ -96,6 +101,8 @@ public List refreshQuestionContent(final Long mcContentId) throws McApplicationException; + public List getAllQuestionEntriesSorted(final long mcContentId) throws McApplicationException; + public List findMcOptionUidsByQueId(Long mcQueContentId) throws McApplicationException; public McOptsContent findMcOptionsContentByUid(Long uid) throws McApplicationException; @@ -230,18 +237,6 @@ public InputStream downloadFile(Long uuid, Long versionID) throws McApplicationException; - public String getFileUuid(String filename) throws McApplicationException; - - public List retrieveMcUploadedOfflineFilesUuid(Long mcContentId) throws McApplicationException; - - public List retrieveMcUploadedOnlineFilesUuid(Long mcContentId) throws McApplicationException; - - public List retrieveMcUploadedOfflineFilesName(Long mcContentId) throws McApplicationException; - - public List retrieveMcUploadedOnlineFilesName(Long mcContentId) throws McApplicationException; - - public List retrieveMcUploadedFiles(Long mcContentId, boolean fileOnline) throws McApplicationException; - public void cleanUploadedFilesMetaData() throws McApplicationException; public void persistFile(String uuid, boolean isOnlineFile, String fileName, McContent mcContent) throws McApplicationException; @@ -272,20 +267,6 @@ public NodeKey copyFile(Long uuid) throws RepositoryCheckedException; - public void removeOffLineFile(String filename, Long mcContentId) throws McApplicationException; - - public void removeOnLineFile(String filename, Long mcContentId) throws McApplicationException; - - public boolean isOffLineFilePersisted(String filename) throws McApplicationException; - - public boolean isOnLineFilePersisted(String filename) throws McApplicationException; - - public boolean isUuidPersisted(String uuid) throws McApplicationException; - - public List getOnlineFilesMetaData(Long mcContentId) throws McApplicationException; - - public List getOfflineFilesMetaData(Long mcContentId) throws McApplicationException; - public List getSessionsFromContent(McContent mcContent) throws McApplicationException; public List findMcOptionCorrectByQueId(Long mcQueContentId) throws McApplicationException; @@ -298,7 +279,13 @@ public NotebookEntry getEntry(Long id, Integer idType, String signature, Integer userID); - + + + public void persistFile(McContent content, McUploadedFile file) throws McApplicationException; + public void removeFile(Long submissionId) throws McApplicationException; + + public List retrieveMcUploadedFiles(McContent mc) throws McApplicationException; + } Index: lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/service/McServicePOJO.java =================================================================== RCS file: /usr/local/cvsroot/lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/service/McServicePOJO.java,v diff -u -r1.77 -r1.78 --- lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/service/McServicePOJO.java 17 Sep 2006 06:23:44 -0000 1.77 +++ lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/service/McServicePOJO.java 2 Oct 2006 01:59:34 -0000 1.78 @@ -77,10 +77,12 @@ import org.lamsfoundation.lams.tool.mc.pojos.McSession; import org.lamsfoundation.lams.tool.mc.pojos.McUploadedFile; import org.lamsfoundation.lams.tool.mc.pojos.McUsrAttempt; +import org.lamsfoundation.lams.tool.mc.McApplicationException; import org.lamsfoundation.lams.tool.service.ILamsToolService; import org.lamsfoundation.lams.usermanagement.User; import org.lamsfoundation.lams.usermanagement.dto.UserDTO; import org.lamsfoundation.lams.usermanagement.service.IUserManagementService; +import org.lamsfoundation.lams.util.audit.IAuditService; import org.lamsfoundation.lams.util.wddx.WDDXProcessor; import org.lamsfoundation.lams.util.wddx.WDDXProcessorConversionException; import org.springframework.dao.DataAccessException; @@ -115,6 +117,7 @@ private IMcUsrAttemptDAO mcUsrAttemptDAO; private IMcUploadedFileDAO mcUploadedFileDAO; + private IAuditService auditService; private IUserManagementService userManagementService; private ILearnerService learnerService; private ILamsToolService toolService; @@ -207,6 +210,38 @@ } } + public void updateMcQueContent(McQueContent mcQueContent) throws McApplicationException + { + try + { + mcQueContentDAO.updateMcQueContent(mcQueContent); + } + catch (DataAccessException e) + { + throw new McApplicationException("Exception occured when lams is updating mc que content: " + + e.getMessage(), + e); + } + + } + + + public List retrieveMcQueContentsByToolContentId(long mcContentId) throws McApplicationException + { + try + { + return mcQueContentDAO.getMcQueContentsByContentId(mcContentId); + } + catch (DataAccessException e) + { + throw new McApplicationException("Exception occured when lams is loading mc que usr: " + + e.getMessage(), + e); + } + } + + + public McQueContent getQuestionContentByDisplayOrder(final Long displayOrder, final Long mcContentUid) throws McApplicationException { try @@ -237,6 +272,22 @@ } + public List getAllQuestionEntriesSorted(final long mcContentId) throws McApplicationException + { + try + { + return mcQueContentDAO.getAllQuestionEntriesSorted(mcContentId); + } + catch (DataAccessException e) + { + throw new McApplicationException("Exception occured when lams is getting all question entries: " + + e.getMessage(), + e); + } + } + + + public void saveOrUpdateMcQueContent(McQueContent mcQueContent) throws McApplicationException { try @@ -1774,7 +1825,7 @@ toolContentObj.setCreatedBy(newUserUid); Set files = toolContentObj.getMcAttachments(); for(McUploadedFile file : files){ - file.setMcContentId(toolContentId); + //file.setMcContentId(toolContentId); file.setMcContent(toolContentObj); } mcContentDAO.saveMcContent(toolContentObj); @@ -2204,94 +2255,7 @@ } - public void removeOffLineFile(String filename, Long mcContentId) throws McApplicationException - { - try - { - mcUploadedFileDAO.removeOffLineFile(filename, mcContentId); - } - catch (DataAccessException e) - { - throw new McApplicationException("Exception occured when lams is removing offline filename" - + e.getMessage(), - e); - } - } - - public void removeOnLineFile(String filename, Long mcContentId) throws McApplicationException - { - try - { - mcUploadedFileDAO.removeOnLineFile(filename, mcContentId); - } - catch (DataAccessException e) - { - throw new McApplicationException("Exception occured when lams is removing online filename" - + e.getMessage(), - e); - } - } - public boolean isOffLineFilePersisted(String filename) throws McApplicationException - { - try - { - return mcUploadedFileDAO.isOffLineFilePersisted(filename); - } - catch (DataAccessException e) - { - throw new McApplicationException("Exception occured when lams is checking if offline filename is persisted: " - + e.getMessage(), - e); - } - } - - public boolean isOnLineFilePersisted(String filename) throws McApplicationException - { - try - { - return mcUploadedFileDAO.isOnLineFilePersisted(filename); - } - catch (DataAccessException e) - { - throw new McApplicationException("Exception occured when lams is checking if online filename is persisted: " - + e.getMessage(), - e); - } - } - - - public String getFileUuid(String filename) throws McApplicationException - { - try - { - return mcUploadedFileDAO.getFileUuid(filename); - } - catch (DataAccessException e) - { - throw new McApplicationException("Exception occured when lams is loading uuid by filename: " - + e.getMessage(), - e); - } - } - - - public List getOnlineFilesMetaData(Long mcContentId) throws McApplicationException - { - return mcUploadedFileDAO.getOnlineFilesMetaData(mcContentId); - } - - - public List getOfflineFilesMetaData(Long mcContentId) throws McApplicationException - { - return mcUploadedFileDAO.getOfflineFilesMetaData(mcContentId); - } - - public boolean isUuidPersisted(String uuid) throws McApplicationException - { - return mcUploadedFileDAO.isUuidPersisted(uuid); - } - /** * adds a new entry to the uploaded files table */ @@ -2315,91 +2279,7 @@ } - public List retrieveMcUploadedFiles(Long mcContentId, boolean fileOnline) throws McApplicationException { - try - { - return mcUploadedFileDAO.retrieveMcUploadedFiles(mcContentId, fileOnline); - } - catch (DataAccessException e) - { - throw new McApplicationException("Exception occured when lams is loading mc uploaded files: " - + e.getMessage(), - e); - } - } - public List retrieveMcUploadedOfflineFilesUuid(Long mcContentId) throws McApplicationException { - try - { - return mcUploadedFileDAO.retrieveMcUploadedOfflineFilesUuid(mcContentId); - } - catch (DataAccessException e) - { - throw new McApplicationException("Exception occured when lams is loading mc uploaded files: offline + uuids " - + e.getMessage(), - e); - } - } - - - public List retrieveMcUploadedOnlineFilesUuid(Long mcContentId) throws McApplicationException { - try - { - return mcUploadedFileDAO.retrieveMcUploadedOnlineFilesUuid(mcContentId); - } - catch (DataAccessException e) - { - throw new McApplicationException("Exception occured when lams is loading mc uploaded files: online + uuids " - + e.getMessage(), - e); - } - } - - - public List retrieveMcUploadedOfflineFilesName(Long mcContentId) throws McApplicationException { - try - { - return mcUploadedFileDAO.retrieveMcUploadedOfflineFilesName(mcContentId); - } - catch (DataAccessException e) - { - throw new McApplicationException("Exception occured when lams is loading mc uploaded files: offline + fileNames " - + e.getMessage(), - e); - } - } - - - public List retrieveMcUploadedOnlineFilesName(Long mcContentId) throws McApplicationException { - try - { - return mcUploadedFileDAO.retrieveMcUploadedOnlineFilesName(mcContentId); - } - catch (DataAccessException e) - { - throw new McApplicationException("Exception occured when lams is loading mc uploaded files: online + fileNames " - + e.getMessage(), - e); - } - } - - - /* - public List retrieveMcUploadedOfflineFilesUuidPlusFilename(Long mcContentId) throws McApplicationException { - try - { - return mcUploadedFileDAO.retrieveMcUploadedOfflineFilesUuidPlusFilename(mcContentId); - } - catch (DataAccessException e) - { - throw new McApplicationException("Exception occured when lams is loading mc uploaded offline file uuid plus filename: " - + e.getMessage(), - e); - } - } - */ - - /** * @return Returns the logger. */ @@ -2427,12 +2307,12 @@ /* !!! COMPLETE THIS !!! - public IQaUploadedFileDAO getQaUploadedFileDAO() { - return qaUploadedFileDAO; + public IMcUploadedFileDAO getMcUploadedFileDAO() { + return mcUploadedFileDAO; } - public void setQaUploadedFileDAO(IQaUploadedFileDAO qaUploadedFileDAO) { - this.qaUploadedFileDAO = qaUploadedFileDAO; + public void setMcUploadedFileDAO(IMcUploadedFileDAO mcUploadedFileDAO) { + this.mcUploadedFileDAO = mcUploadedFileDAO; } */ @@ -2637,14 +2517,9 @@ toolContentObj.setUpdateDate(now); toolContentObj.setMcContentId(toolContentId); toolContentObj.setQuestionsSequenced(false); - toolContentObj.setUsernameVisible(false); // I can't find a use for these. - toolContentObj.setUsernameVisible(false); - toolContentObj.setSynchInMonitor(false); toolContentObj.setShowReport(false); // not supported in 1.0.2 so set to blank. Fields are mandatory in the database - toolContentObj.setReportTitle(""); - toolContentObj.setMonitoringReportTitle(""); //toolContentObj.setEndLearningMessage(""); @@ -2653,7 +2528,7 @@ toolContentObj.setRetries(bool!=null?bool:false); bool = WDDXProcessor.convertToBoolean(importValues, ToolContentImport102Manager.CONTENT_Q_FEEDBACK); - toolContentObj.setShowFeedback(bool!=null?bool:false); + //toolContentObj.setShowFeedback(bool!=null?bool:false); Integer minPassMark = WDDXProcessor.convertToInteger(importValues, ToolContentImport102Manager.CONTENT_Q_MIN_PASSMARK); toolContentObj.setPassMark(minPassMark != null ? minPassMark : new Integer(0)); @@ -2697,8 +2572,8 @@ McQueContent question = new McQueContent(); question.setDisplayOrder( WDDXProcessor.convertToInteger(questionMap, ToolContentImport102Manager.CONTENT_Q_ORDER) ); // only one feedback field in 1.0.2, so use it for both - question.setFeedbackCorrect((String)questionMap.get(CONTENT_Q_FEEDBACK)); - question.setFeedbackIncorrect((String)questionMap.get(CONTENT_Q_FEEDBACK)); + //question.setFeedbackCorrect((String)questionMap.get(CONTENT_Q_FEEDBACK)); + //question.setFeedbackIncorrect((String)questionMap.get(CONTENT_Q_FEEDBACK)); question.setQuestion((String)questionMap.get(CONTENT_Q_QUESTION)); question.setWeight( weight ); @@ -2741,7 +2616,45 @@ toolContentObj.setReflect(Boolean.TRUE); toolContentObj.setReflectionSubject(description); } + + + public List retrieveMcUploadedFiles(McContent mc) throws McApplicationException { + try { + return mcUploadedFileDAO.retrieveMcUploadedFiles(mc); + } + catch (DataAccessException e) { + throw new McApplicationException("Exception occured when lams is loading mc uploaded files: " + + e.getMessage(), + e); + } + } + + + + /** + * adds a new entry to the uploaded files table + */ + public void persistFile(McContent content, McUploadedFile file) throws McApplicationException { + logger.debug("in persistFile: " + file); + logger.debug("in persistFile, content: " + content); + + content.getMcAttachments().add(file); + file.setMcContent(content); + mcContentDAO.saveOrUpdateMc(content); + logger.debug("persisted mcUploadedFile: " + file); + } + + + /** + * removes an entry from the uploaded files table + */ + public void removeFile(Long submissionId) throws McApplicationException { + mcUploadedFileDAO.removeUploadFile(submissionId); + logger.debug("removed mcUploadedFile: " + submissionId); + } + + public Long createNotebookEntry(Long id, Integer idType, String signature, Integer userID, String entry) { logger.debug("coreNotebookService: " + coreNotebookService); @@ -2775,4 +2688,18 @@ public void setCoreNotebookService(ICoreNotebookService coreNotebookService) { this.coreNotebookService = coreNotebookService; } + + /** + * @return Returns the auditService. + */ + public IAuditService getAuditService() { + return auditService; + } + /** + * @param auditService The auditService to set. + */ + public void setAuditService(IAuditService auditService) { + this.auditService = auditService; + } + } Index: lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/web/AuthoringUtil.java =================================================================== RCS file: /usr/local/cvsroot/lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/web/AuthoringUtil.java,v diff -u -r1.51 -r1.52 --- lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/web/AuthoringUtil.java 17 Sep 2006 06:23:44 -0000 1.51 +++ lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/web/AuthoringUtil.java 2 Oct 2006 01:59:34 -0000 1.52 @@ -22,11 +22,7 @@ /* $$Id$$ */ package org.lamsfoundation.lams.tool.mc.web; -import java.io.FileNotFoundException; -import java.io.IOException; -import java.io.InputStream; import java.util.Date; -import java.util.HashSet; import java.util.Iterator; import java.util.LinkedList; import java.util.List; @@ -38,19 +34,13 @@ import javax.servlet.http.HttpSession; import org.apache.log4j.Logger; -import org.apache.struts.upload.FormFile; -import org.lamsfoundation.lams.contentrepository.FileException; -import org.lamsfoundation.lams.contentrepository.NodeKey; -import org.lamsfoundation.lams.contentrepository.RepositoryCheckedException; -import org.lamsfoundation.lams.tool.exception.ToolException; import org.lamsfoundation.lams.tool.mc.McAppConstants; -import org.lamsfoundation.lams.tool.mc.McAttachmentDTO; +import org.lamsfoundation.lams.tool.mc.McCandidateAnswersDTO; import org.lamsfoundation.lams.tool.mc.McComparator; -import org.lamsfoundation.lams.tool.mc.McUtils; +import org.lamsfoundation.lams.tool.mc.McQuestionContentDTO; import org.lamsfoundation.lams.tool.mc.pojos.McContent; import org.lamsfoundation.lams.tool.mc.pojos.McOptsContent; import org.lamsfoundation.lams.tool.mc.pojos.McQueContent; -import org.lamsfoundation.lams.tool.mc.pojos.McUploadedFile; import org.lamsfoundation.lams.tool.mc.service.IMcService; import org.lamsfoundation.lams.usermanagement.dto.UserDTO; import org.lamsfoundation.lams.web.session.SessionManager; @@ -64,48 +54,12 @@ */ public class AuthoringUtil implements McAppConstants { static Logger logger = Logger.getLogger(AuthoringUtil.class.getName()); - - /** - * populates data - * readData(HttpServletRequest request, McAuthoringForm mcAuthoringForm) - * - * @param request - * @param mcAuthoringForm - */ - public static void readData(HttpServletRequest request, McAuthoringForm mcAuthoringForm, boolean requestByStarter) - { - logger.debug("readData requestByStarter: " + requestByStarter); - /** define the next tab as Basic tab by default*/ - mcAuthoringForm.setEditOptionsMode(new Integer(0).toString()); - request.getSession().setAttribute(EDIT_OPTIONS_MODE, new Integer(0)); - - McUtils.saveInSessionRichText(request, requestByStarter); - AuthoringUtil.populateParameters(request, mcAuthoringForm); - } - /** - * populates request parameters - * populateParameters(HttpServletRequest request, McAuthoringForm mcAuthoringForm) - * - * @param request - * @param mcAuthoringForm - */ - protected static void populateParameters(HttpServletRequest request, McAuthoringForm mcAuthoringForm) - { - String selectedQuestion=request.getParameter(SELECTED_QUESTION); - - if ((selectedQuestion != null) && (selectedQuestion.length() > 0)) - { - request.getSession().setAttribute(SELECTED_QUESTION,selectedQuestion); - logger.debug("updated SELECTED_QUESTION"); - } - } - - /** * setRadioboxes(McContent mcContent, McAuthoringForm mcAuthoringForm) * * set values of radioboxes for an existing content + * * @param mcContent * @param mcAuthoringForm */ @@ -118,84 +72,11 @@ } - /** - * builds a candidate answers map for the selected question - * repopulateCurrentCheckBoxStatesMap(HttpServletRequest request) - * - * @param request - * @return Map - */ - public static Map repopulateCurrentCheckBoxStatesMap(HttpServletRequest request) - { - Map mapTempContent= new TreeMap(new McComparator()); - - long mapCounter=0; - for (long i=1; i <= MAX_OPTION_COUNT ; i++) - { - String candidateEntry =request.getParameter("checkBoxSelected" + i); - String optionText =request.getParameter("optionContent" + i); - - if ( - (candidateEntry != null) && - (candidateEntry.length() > 0) - ) - { - if (candidateEntry.equals("Correct")) - { - mapCounter++; - mapTempContent.put(new Long(mapCounter).toString(), optionText); - } - } - } - logger.debug("return repopulated currentCheckBoxStatesMap: " + mapTempContent); - return mapTempContent; - } - - /** - * verifies whether there are any duplicate candidate answer entries in the mapOptionsContent - * verifyDuplicatesOptionsMap(Map mapOptionsContent) - * - * @param mapOptionsContent - * @return boolean - */ - public static boolean verifyDuplicatesOptionsMap(Map mapOptionsContent) - { - Map originalMapOptionsContent=mapOptionsContent; - Map backupMapOptionsContent=mapOptionsContent; - - int optionCount=0; - for (long i=1; i <= MAX_OPTION_COUNT ; i++) - { - String currentOption=(String)originalMapOptionsContent.get(new Long(i).toString()); - logger.debug("verified currentOption " + currentOption); - - optionCount=0; - for (long j=1; j <= MAX_OPTION_COUNT ; j++) - { - String backedOption=(String)backupMapOptionsContent.get(new Long(j).toString()); - - if ((currentOption != null) && (backedOption !=null)) - { - if (currentOption.equals(backedOption)) - { - optionCount++; - logger.debug("optionCount for " + currentOption + " is: " + optionCount); - } - - if (optionCount > 1) - return false; - } - } - } - return true; - } - - - /** - * to make sure there is data in the map * verifyMapNoEmptyString(Map map) * + * makes sure there is data in the map + * * @param map * @return boolean */ @@ -213,636 +94,85 @@ return true; } - - /** - * validates if submitted questions map is empty or not - * validateQuestionsNotEmpty(Map mapQuestionsContent) - * - * @param mapQuestionsContent - * @return boolean - */ - public static boolean validateQuestionsNotEmpty(Map mapQuestionsContent) - { - Iterator itMap = mapQuestionsContent.entrySet().iterator(); - while (itMap.hasNext()) { - Map.Entry pairs = (Map.Entry)itMap.next(); - logger.debug("using the pair: " + pairs.getKey() + " = " + pairs.getValue()); - - if ((pairs.getValue() != null) && (pairs.getValue().toString().length() == 0)) - return false; - - } - return true; - } - + /** - * builds a weights map for all the questions - * repopulateCurrentWeightsMap(HttpServletRequest request, String parameterType) + * removes only unused question entries from the db. It keeps the valid entries since they get updated. + * + * cleanupRedundantQuestions(HttpServletRequest request, List existingQuestions, Map mapQuestionsContent, McContent mcContent) * * @param request - * @param parameterType - * @return Map + * @param existingQuestions + * @param mapQuestionsContent + * @param mcContent */ - public static Map repopulateCurrentWeightsMap(HttpServletRequest request, String parameterType) + public static void cleanupRedundantQuestions(HttpServletRequest request, List existingQuestions, Map mapQuestionsContent, McContent mcContent, IMcService mcService) { - Map mapTempQuestionsContent= new TreeMap(new McComparator()); - logger.debug("parameterType: " + parameterType); + logger.debug("doing cleanupRedundantQuestions..."); + logger.debug("using existingQuestions: " + existingQuestions); + logger.debug("using mapQuestionsContent: " + mapQuestionsContent); + logger.debug("using mcContent: " + mcContent); - long mapCounter=0; - for (long i=1; i <= MAX_QUESTION_COUNT ; i++) - { - String candidateEntry =request.getParameter(parameterType + i); - String questionText =request.getParameter("questionContent" + i); - if ((questionText != null) && (questionText.length() > 0)) - { - logger.debug("questionText: " + questionText); - if (candidateEntry != null) - { - mapCounter++; - mapTempQuestionsContent.put(new Long(mapCounter).toString(), candidateEntry); - } - } - } - logger.debug("return repopulated Map: " + mapTempQuestionsContent); - return mapTempQuestionsContent; - } - - - /** - * makes entry set of the map sequential - * sequenceMap(Map globalMap) - * - * @param globalMap - * @return Map - */ - public static Map sequenceMap(Map globalMap) - { - logger.debug("globalMap:"+ globalMap); - Map mapTemp= new TreeMap(new McComparator()); - - long mapCounter=0; - Iterator itMap = globalMap.entrySet().iterator(); - while (itMap.hasNext()) { - Map.Entry pairs = (Map.Entry)itMap.next(); - logger.debug("using the pair: " + pairs.getKey() + " = " + pairs.getValue()); - Map optionsMap=(Map)pairs.getValue(); - logger.debug("optionsMap:"+ optionsMap); - mapCounter++; - mapTemp.put(new Long(mapCounter).toString(), optionsMap); - } - - logger.debug("final mapTemp:"+ mapTemp); - return mapTemp; - } - - - /** - * shrinks the size of the Map to only used entries - * repopulateMap(HttpServletRequest request, String parameterType) - * - * @param mapQuestionContent - * @param request - * @return Map - */ - public static Map repopulateMap(HttpServletRequest request, String parameterType) - { - Map mapTempQuestionsContent= new TreeMap(new McComparator()); - logger.debug("parameterType: " + parameterType); - - long mapCounter=0; - for (long i=1; i <= MAX_QUESTION_COUNT ; i++) - { - String candidateEntry =request.getParameter(parameterType + i); - if ( - (candidateEntry != null) && - (candidateEntry.length() > 0) - ) - { - mapCounter++; - mapTempQuestionsContent.put(new Long(mapCounter).toString(), candidateEntry); - } - } - logger.debug("return repopulated Map: " + mapTempQuestionsContent); - return mapTempQuestionsContent; - } - - - /** - * returns the value of the entry for a given index - * getRequiredWeightEntry(Map mapWeights, String questionIndex) - * - * @param mapWeights - * @param questionIndex - * @return - */ - public static String getRequiredWeightEntry(Map mapWeights, String questionIndex) - { - logger.debug("mapWeights: " + mapWeights); - - Iterator itMap = mapWeights.entrySet().iterator(); - while (itMap.hasNext()) { - Map.Entry pairs = (Map.Entry)itMap.next(); - logger.debug("using the pair: " + pairs.getKey() + " = " + pairs.getValue()); - if (questionIndex.equals(pairs.getKey().toString())) - { - String weight=pairs.getValue().toString(); - logger.debug("required weight:" + weight); - return weight; - } - } - return null; - } - - - public static String getRequiredFeedbackEntry(Map map, String questionIndex) - { - logger.debug("map: " + map); - - Iterator itMap = map.entrySet().iterator(); - while (itMap.hasNext()) { - Map.Entry pairs = (Map.Entry)itMap.next(); - logger.debug("using the pair: " + pairs.getKey() + " = " + pairs.getValue()); - if (questionIndex.equals(pairs.getKey().toString())) - { - String feedback=pairs.getValue().toString(); - logger.debug("required entry:" + feedback); - return feedback; - } - } - return null; - } - - - - /** - * returns the options Map within mapGeneralOptionsContent indexed with the questionIndex parameter. - * getRequiredOptionsEntry(String questionIndex) - * - * @param questionIndex - * @return Map - */ - public static Map getRequiredOptionsEntry(Map mapGeneralOptionsContent, String questionIndex) - { - logger.debug("mapGeneralOptionsContent: " + mapGeneralOptionsContent); - - Iterator itMap = mapGeneralOptionsContent.entrySet().iterator(); - while (itMap.hasNext()) { - Map.Entry pairs = (Map.Entry)itMap.next(); - logger.debug("using the pair: " + pairs.getKey() + " = " + pairs.getValue()); - if (questionIndex.equals(pairs.getKey().toString())) - { - Map tempOptionsMap=(Map)pairs.getValue(); - logger.debug("tempOptionsMap:" + tempOptionsMap); - return tempOptionsMap; - } - } - return null; - } - - - /** - * moves the contents of the Map up or down - * shiftWeightsMap(Map mapWeights, String questionIndex , String direction) - * - * @param mapWeights - * @param questionIndex - * @param direction - * @return Map - */ - public static Map shiftWeightsMap(Map mapWeights, String questionIndex , String direction) - { - /* map to be returned */ - Map mapTempWeights= new TreeMap(new McComparator()); - mapTempWeights= mapWeights; - - String movableWeightEntry = getRequiredWeightEntry(mapWeights, questionIndex); - logger.debug("movableWeightEntry: " + movableWeightEntry); - - int shiftableIndex=0; - if (direction.equals("down")) + /*remove ununsed question entries from the db */ + boolean questionFound=false; + Iterator itExistingQuestions = existingQuestions.iterator(); + while (itExistingQuestions.hasNext()) { - logger.debug("moving map down"); - shiftableIndex=new Integer(questionIndex).intValue() + 1; - } - else - { - logger.debug("moving map up"); - shiftableIndex=new Integer(questionIndex).intValue() - 1; - } + McQueContent mcQueContent=(McQueContent)itExistingQuestions.next(); + logger.debug("mcQueContent:" + mcQueContent); - String shiftableWeightEntry = getRequiredWeightEntry(mapWeights, new Integer(shiftableIndex).toString()); - logger.debug("shiftableWeightEntry: " + shiftableWeightEntry); - - - if ((movableWeightEntry != null) && (shiftableWeightEntry != null)) - { - if (movableWeightEntry != null) - { - mapTempWeights.put(new Integer(shiftableIndex).toString(), movableWeightEntry); - logger.debug("mapTempWeights has been updated with movableWeightEntry"); - } - else - { - mapTempWeights.put(new Integer(shiftableIndex).toString(), ""); - logger.debug("mapTempWeights has been updated with a empty string"); - } - - - if (shiftableWeightEntry != null) - { - mapTempWeights.put(questionIndex,shiftableWeightEntry); - logger.debug("mapTempWeights has been updated with shiftableWeightEntry"); - } - else - { - mapTempWeights.put(questionIndex, ""); - logger.debug("mapTempWeights has been updated with empty string"); - } - } - - logger.debug("final shifted mapTempWeights: " + mapTempWeights); - return mapTempWeights; - } - - - /** - * shiftFeedbackMap(Map map, String questionIndex , String direction) - * - * @param map - * @param questionIndex - * @param direction - * @return Map - */ - public static Map shiftFeedbackMap(Map map, String questionIndex , String direction) - { - logger.debug("doing shiftFeedbackMap: "); - /* map to be returned */ - Map mapTemp= new TreeMap(new McComparator()); - mapTemp= map; - - String movableEntry = getRequiredFeedbackEntry(map, questionIndex); - logger.debug("movableEntry: " + movableEntry); - - int shiftableIndex=0; - if (direction.equals("down")) - { - logger.debug("moving map down"); - shiftableIndex=new Integer(questionIndex).intValue() + 1; - } - else - { - logger.debug("moving map up"); - shiftableIndex=new Integer(questionIndex).intValue() - 1; - } - - String shiftableEntry = getRequiredFeedbackEntry(map, new Integer(shiftableIndex).toString()); - logger.debug("shiftableEntry: " + shiftableEntry); - - if ((movableEntry != null) && (shiftableEntry != null)) - { - if (movableEntry != null) - { - mapTemp.put(new Integer(shiftableIndex).toString(), movableEntry); - } - else - { - mapTemp.put(new Integer(shiftableIndex).toString(), ""); - } - - - if (shiftableEntry != null) - { - mapTemp.put(questionIndex,shiftableEntry); - } - else - { - mapTemp.put(questionIndex, ""); - } - } - - logger.debug("final shifted mapTemp: " + mapTemp); - return mapTemp; - } - - - /** - * shifts the options contents within mapGenaralOptionsContent and mapGeneralSelectedlOptionsContent - * shiftOptionsMap(Map mapGlobalOptionsContent, String questionIndex , String direction) - * - * @param mapGlobalOptionsContent - * @param questionIndex - * @param direction - * @return Map - */ - public static Map shiftOptionsMap(Map mapGlobalOptionsContent, String questionIndex , String direction) - { - /* mapGlobalOptionsContent refers to mapGeneralOptionsContent and mapGeneralSelectedlOptionsContent */ - - /* map to be returned */ - Map mapTempGeneralOptionsContent= new TreeMap(new McComparator()); - mapTempGeneralOptionsContent= mapGlobalOptionsContent; - - Map mapMovableOptionsEntry = getRequiredOptionsEntry(mapGlobalOptionsContent, questionIndex); - logger.debug("mapMovableOptionsEntry: " + mapMovableOptionsEntry); - - int shiftableIndex=0; - if (direction.equals("down")) - { - logger.debug("moving map down"); - shiftableIndex=new Integer(questionIndex).intValue() + 1; - } - else - { - logger.debug("moving map up"); - shiftableIndex=new Integer(questionIndex).intValue() - 1; - } - - Map mapShiftableOptionsEntry = getRequiredOptionsEntry(mapGlobalOptionsContent, new Integer(shiftableIndex).toString()); - logger.debug("mapShiftableOptionsEntry: " + mapShiftableOptionsEntry); - - - if (mapMovableOptionsEntry != null) - { - mapTempGeneralOptionsContent.put(new Integer(shiftableIndex).toString(), mapMovableOptionsEntry); - logger.debug("mapTempGeneralOptionsContent has been updated with mapMovableOptionsEntry"); - } - else - { - mapTempGeneralOptionsContent.put(new Integer(shiftableIndex).toString(), new TreeMap(new McComparator())); - logger.debug("mapTempGeneralOptionsContent has been updated with a new Map"); - } - - - if (mapShiftableOptionsEntry != null) - { - mapTempGeneralOptionsContent.put(questionIndex,mapShiftableOptionsEntry); - logger.debug("mapTempGeneralOptionsContent has been updated with mapShiftableOptionsEntry"); - } - else - { - mapTempGeneralOptionsContent.put(questionIndex,new TreeMap(new McComparator())); - logger.debug("mapTempGeneralOptionsContent has been updated with a new Map"); - } - - logger.debug("final shifted mapTempGeneralOptionsContent: " + mapTempGeneralOptionsContent); - return mapTempGeneralOptionsContent; - } - - - /** - * removes options from mapGlobalOptionsContent - * removeFromOptionsMap(Map mapGlobalOptionsContent, String questionIndex ) - * - * @param mapGlobalOptionsContent - * @param questionIndex - * @param direction - * @return Map - */ - public static Map removeFromMap(Map mapContent, String index) - { - /* mapGlobalOptionsContent refers to mapGenaralOptionsContent and mapGeneralSelectedlOptionsContent */ - /* map to be returned */ - Map mapTempContent= new TreeMap(new McComparator()); - mapTempContent= mapContent; - - mapTempContent.remove(index); - logger.debug("entry at index removed from mapTempContent..."); - - logger.debug("final mapTempContent: " + mapTempContent); - return mapTempContent; - } - - - /** - * shifs questions Map when moving up and down - * shiftMap(Map mapQuestionsContent, String questionIndex , String movableQuestionEntry, String direction) - * - * @param mapQuestionsContent - * @param questionIndex - * @param movableQuestionEntry - * @param direction - * @return Map - */ - public static Map shiftMap(Map mapQuestionsContent, String questionIndex , String movableQuestionEntry, String direction) - { - logger.debug("movableQuestionEntry: " + movableQuestionEntry); - /* map to be returned */ - Map mapTempQuestionsContent= new TreeMap(new McComparator()); - - String shiftableEntry=null; - - int shiftableIndex=0; - if (direction.equals("down")) - { - logger.debug("moving map down"); - shiftableIndex=new Integer(questionIndex).intValue() + 1; - } - else - { - logger.debug("moving map up"); - shiftableIndex=new Integer(questionIndex).intValue() - 1; - } - - logger.debug("shiftableIndex: " + shiftableIndex); - shiftableEntry=(String)mapQuestionsContent.get(new Integer(shiftableIndex).toString()); - logger.debug("shiftable entry: " + shiftableEntry); - - if (shiftableEntry != null) - { - Iterator itQuestionsMap = mapQuestionsContent.entrySet().iterator(); - long mapCounter=0; - while (itQuestionsMap.hasNext()) { - Map.Entry pairs = (Map.Entry)itQuestionsMap.next(); - logger.debug("comparing the pair: " + pairs.getKey() + " = " + pairs.getValue()); - mapCounter++; - logger.debug("mapCounter: " + mapCounter); - - if (!pairs.getKey().equals(questionIndex) && !pairs.getKey().equals(new Integer(shiftableIndex).toString())) - { - logger.debug("normal copy " + questionIndex); - mapTempQuestionsContent.put(new Long(mapCounter).toString(), pairs.getValue()); - } - else if (pairs.getKey().equals(questionIndex)) - { - logger.debug("move type 1 " + questionIndex); - mapTempQuestionsContent.put(new Long(mapCounter).toString(), shiftableEntry); - } - else if (pairs.getKey().equals(new Integer(shiftableIndex).toString())) - { - mapTempQuestionsContent.put(new Long(mapCounter).toString(), movableQuestionEntry); - } - } - } - else - { - mapTempQuestionsContent=mapQuestionsContent; - } - return mapTempQuestionsContent; - } - - - /** - * validates if the total weight for the submitted questiona is 100 or not. - * validateTotalWeight(Map mapWeights) - * - * @param mapWeights - * @return boolean - */ - public static boolean validateTotalWeight(Map mapWeights) - { - logger.debug("mapWeights: " + mapWeights); - - Iterator itMap = mapWeights.entrySet().iterator(); - int totalWeight=0; - while (itMap.hasNext()) { - Map.Entry pairs = (Map.Entry)itMap.next(); - logger.debug("using the pair: " + pairs.getKey() + " = " + pairs.getValue()); - - if ((pairs.getValue() != null) || (pairs.getValue().toString().length() > 0)) + Iterator itNewQuestionsMap = mapQuestionsContent.entrySet().iterator(); + questionFound=false; + while (itNewQuestionsMap.hasNext()) { - totalWeight=totalWeight+ new Integer(pairs.getValue().toString()).intValue(); + Map.Entry pairs = (Map.Entry)itNewQuestionsMap.next(); + logger.debug("using the pair: " + pairs.getKey() + " = " + pairs.getValue()); + logger.debug("mcQueContent.getQuestion(): " + mcQueContent.getQuestion() + "--" + pairs.getValue()); + + if (mcQueContent.getQuestion().equals(pairs.getValue().toString())) + { + logger.debug("equals mcQueContent.getQuestion(): " + mcQueContent.getQuestion() + "--" + pairs.getValue()); + questionFound=true; + break; + } } - } - - logger.debug("totalWeight: " + totalWeight); - if (totalWeight != 100) - { - return false; - } - return true; - } - - - /** - * validates total question weight when adding new questions - * validateSubTotalWeights(HttpServletRequest request, McAuthoringForm mcAuthoringForm) - * - * @param request - * @param mcAuthoringForm - * @return boolean - */ - public static boolean validateSubTotalWeights(HttpServletRequest request, McAuthoringForm mcAuthoringForm) - { - Map mapWeights= repopulateCurrentWeightsMap(request, "questionWeight"); - logger.debug("mapWeights: " + mapWeights); - - int totalWeight=0; - Iterator itMap = mapWeights.entrySet().iterator(); - while (itMap.hasNext()) { - Map.Entry pairs = (Map.Entry)itMap.next(); - logger.debug("using the pair: " + pairs.getKey() + " = " + pairs.getValue()); - int currentWeight=new Integer(pairs.getValue().toString()).intValue(); - totalWeight= totalWeight + currentWeight; - logger.debug("sub totalWeight: " + totalWeight); - } - logger.debug("final totalWeight: " + totalWeight); - - if (totalWeight > 100) - return false; - else - return true; - } - - - /** - * checks candidate answers for a questions to see if there is at least one selected correct candidate answer - * validateOptions(HttpServletRequest request) - * @param request - * @return boolean - */ - public static boolean validateOptions(HttpServletRequest request) - { - logger.debug("will validateOptions"); - String parameterType="checkBoxSelected"; - for (int i=1; i <= MAX_OPTION_COUNT ; i++) - { - String isCorrect=request.getParameter(parameterType + i); - logger.debug("isCorrect: " + isCorrect); - - if (isCorrect != null) + if (questionFound == false) { - if (isCorrect.equals("Correct")) - return true; + String deletableQuestion=mcQueContent.getQuestion(); + logger.debug("found is false, delete this question " + deletableQuestion); + mcQueContent=mcService.getQuestionContentByQuestionText(deletableQuestion, mcContent.getUid()); + + logger.debug("found is false, delete this question " + mcQueContent); + if (mcQueContent != null) + { + logger.debug("first removing from collection " + mcQueContent); + mcContent.getMcQueContents().remove(mcQueContent); + logger.debug("removed from collection "); + + mcService.removeMcQueContent(mcQueContent); + logger.debug("removed mcQueContent from the db: " + mcQueContent); + } } - } - return false; + } } + - - /** - * builds a map to hold all the candidate answers for all the questions by accessing the db - * rebuildStartupGeneralOptionsQueIdfromDB(HttpServletRequest request, Map mapQuestionsUidContent) - * - * @param request - * @param mapQuestionsUidContent - * @return Map - */ - public static Map rebuildStartupGeneralOptionsQueIdfromDB(HttpServletRequest request, Map mapQuestionsUidContent) - { - IMcService mcService =McUtils.getToolService(request); - Map map= new TreeMap(new McComparator()); - - Iterator itMap = mapQuestionsUidContent.entrySet().iterator(); - Long mapIndex=new Long(1); - while (itMap.hasNext()) { - Map.Entry pairs = (Map.Entry)itMap.next(); - logger.debug("using the pair: " + pairs.getKey() + " = " + pairs.getValue()); - String currentQuestionUid=pairs.getValue().toString(); - logger.debug("currentQuestionUid: " + currentQuestionUid); - List listQuestionOptions=mcService.findMcOptionsContentByQueId(new Long(currentQuestionUid)); - logger.debug("listQuestionOptions: " + listQuestionOptions); - Map mapQuestionOptions=generateOptionsQueIdMap(listQuestionOptions); - map.put(mapIndex.toString(),mapQuestionOptions); - mapIndex=new Long(mapIndex.longValue()+1); - } - return map; - } - - + /** - * builds a map to hold all the selected candidate answers for all the questions by accessing the db - * rebuildStartupGeneralSelectedOptionsContentMapfromDB(HttpServletRequest request, Map mapQuestionsUidContent) * - * @param request - * @param mapQuestionsUidContent - * @return Map - */ - public static Map rebuildStartupGeneralSelectedOptionsContentMapfromDB(HttpServletRequest request, Map mapQuestionsUidContent) - { - IMcService mcService =McUtils.getToolService(request); - Map mapStartupGeneralOptionsContent= new TreeMap(new McComparator()); - - Iterator itMap = mapQuestionsUidContent.entrySet().iterator(); - Long mapIndex=new Long(1); - while (itMap.hasNext()) { - Map.Entry pairs = (Map.Entry)itMap.next(); - logger.debug("using the pair: " + pairs.getKey() + " = " + pairs.getValue()); - String currentQuestionUid=pairs.getValue().toString(); - logger.debug("currentQuestionUid: " + currentQuestionUid); - List listQuestionOptions=mcService.getPersistedSelectedOptions(new Long(currentQuestionUid)); - logger.debug("listQuestionOptions: " + listQuestionOptions); - Map mapQuestionOptions=generateOptionsMap(listQuestionOptions); - mapStartupGeneralOptionsContent.put(mapIndex.toString(),mapQuestionOptions); - mapIndex=new Long(mapIndex.longValue()+1); - } - return mapStartupGeneralOptionsContent; - } - - - /** - * builds a map to hold all the candidate answers for all the questions by accessing the db * rebuildStartupGeneralOptionsContentMapfromDB(HttpServletRequest request, Map mapQuestionsUidContent) * + * builds a map to hold all the candidate answers for all the questions by accessing the db + * * @param request * @param mapQuestionsUidContent * @return */ public static Map rebuildStartupGeneralOptionsContentMapfromDB(HttpServletRequest request, Map mapQuestionsUidContent, IMcService mcService) { Map mapStartupGeneralOptionsContent= new TreeMap(new McComparator()); - + Iterator itMap = mapQuestionsUidContent.entrySet().iterator(); Long mapIndex=new Long(1); while (itMap.hasNext()) { @@ -858,19 +188,22 @@ } return mapStartupGeneralOptionsContent; } - - + + + /** - * builds a questions map from questions list - * generateOptionsMap(List listQuestionOptions) + * + * generateOptionsMap(List listQuestionOptions) * + * builds a questions map from questions list + * * @param listQuestionOptions * @return Map */ public static Map generateOptionsMap(List listQuestionOptions) { Map mapOptsContent= new TreeMap(new McComparator()); - + Iterator listIterator=listQuestionOptions.iterator(); Long mapIndex=new Long(1); while (listIterator.hasNext()) @@ -882,36 +215,43 @@ } return mapOptsContent; } - + + + /** + * updates existing questions while persisting the questions + * + * updateExistingQuestionContent(HttpServletRequest request, Map mapFeedbackIncorrect, Map mapFeedbackCorrect, McQueContent mcQueContent, String displayOrder) + * + * @param request + * @param mapFeedbackIncorrect + * @param mapFeedbackCorrect + * @param mcQueContent + * @param displayOrder + */ + public static void updateExistingQuestionContent(HttpServletRequest request, Map mapFeedbackIncorrect, Map mapFeedbackCorrect, + McQueContent mcQueContent, String displayOrder, String weight, IMcService mcService) + { + logger.debug("doing updateExistingQuestionContent..."); + logger.debug("using displayOrder: " + displayOrder); + logger.debug("using weight: " + weight); + + String incorrectFeedback=(String)mapFeedbackIncorrect.get(displayOrder); + logger.debug("new incorrectFeedback will be :" + incorrectFeedback); + String correctFeedback=(String)mapFeedbackCorrect.get(displayOrder); + logger.debug("new correctFeedback will be :" + correctFeedback); + + mcQueContent.setDisplayOrder(new Integer(displayOrder)); + mcQueContent.setWeight(new Integer(weight)); + + mcService.saveOrUpdateMcQueContent(mcQueContent); + logger.debug("updated mcQueContent in the db: " + mcQueContent); + } + /** - * generates a map from the questions list - * generateOptionsQueIdMap(List listQuestionOptions) - * - * @param listQuestionOptions - * @return Map - */ - public static Map generateOptionsQueIdMap(List listQuestionOptions) - { - Map mapOptsContent= new TreeMap(new McComparator()); - - Iterator listIterator=listQuestionOptions.iterator(); - Long mapIndex=new Long(1); - while (listIterator.hasNext()) - { - McOptsContent mcOptsContent=(McOptsContent)listIterator.next(); - logger.debug("mcOptsContent: " + mcOptsContent); - mapOptsContent.put(mapIndex.toString(),mcOptsContent.getMcQueContentId().toString()); - mapIndex=new Long(mapIndex.longValue()+1); - } - return mapOptsContent; - } - - - /** - * builds a map to hold question texts + * builds a map to hold question texts * rebuildQuestionMapfromDB(HttpServletRequest request, Long toolContentId) - * + * * @param request * @param toolContentId * @return Map @@ -923,10 +263,10 @@ McContent mcContent=mcService.retrieveMc(toolContentId); logger.debug("mcContent:" + mcContent); - + List list=mcService.refreshQuestionContent(mcContent.getUid()); logger.debug("refreshed list:" + list); - + Iterator listIterator=list.iterator(); Long mapIndex=new Long(1); while (listIterator.hasNext()) @@ -936,16 +276,16 @@ mapQuestionsContent.put(mapIndex.toString(),mcQueContent.getQuestion()); mapIndex=new Long(mapIndex.longValue()+1); } - + logger.debug("refreshed Map:" + mapQuestionsContent); return mapQuestionsContent; } - + /** * builds a map to hold persisted uid values for questions * rebuildQuestionUidMapfromDB(HttpServletRequest request, Long toolContentId) - * + * * @param request * @param toolContentId * @return Map @@ -957,12 +297,12 @@ McContent mcContent=mcService.retrieveMc(toolContentId); logger.debug("mcContent:" + mcContent); - + if (mcContent != null) { List list=mcService.refreshQuestionContent(mcContent.getUid()); logger.debug("refreshed list:" + list); - + Iterator listIterator=list.iterator(); Long mapIndex=new Long(1); while (listIterator.hasNext()) @@ -973,1247 +313,15 @@ mapIndex=new Long(mapIndex.longValue()+1); } } - - logger.debug("refreshed Map:" + mapQuestionsContent); - return mapQuestionsContent; - } - - public static Map rebuildQuestionUidMap(IMcService mcService, Long toolContentId, Long mcQueContentUid) - { - logger.debug("starting rebuildQuestionUidMap"); - - logger.debug("mcQueContentUid:" + mcQueContentUid); - Map mapQuestionsContent= new TreeMap(new McComparator()); - - McContent mcContent=mcService.retrieveMc(toolContentId); - logger.debug("mcContent:" + mcContent); - - if (mcContent != null) - { - List list=mcService.refreshQuestionContent(mcContent.getUid()); - logger.debug("refreshed list:" + list); - - Iterator listIterator=list.iterator(); - Long mapIndex=new Long(1); - while (listIterator.hasNext()) - { - McQueContent mcQueContent=(McQueContent)listIterator.next(); - logger.debug("mcQueContent:" + mcQueContent); - if (mcQueContent.getUid().toString().equals(mcQueContentUid.toString())) - { - mapQuestionsContent.put(mapIndex.toString(),mcQueContent.getUid()); - mapIndex=new Long(mapIndex.longValue()+1); - } - } - } - logger.debug("refreshed Map:" + mapQuestionsContent); return mapQuestionsContent; } - - /** - * returns all the options for all the questions for a content - * generateGeneralOptionsContentMap(HttpServletRequest request, McContent mcContent) - * - * @param request - * @param mcContent - * @return Map - */ - public static Map generateGeneralOptionsContentMap(HttpServletRequest request, McContent mcContent) - { - Map mapGeneralOptionsContent= new TreeMap(new McComparator()); - IMcService mcService =McUtils.getToolService(request); - - Iterator mcQueIterator=mcContent.getMcQueContents().iterator(); - Long mapIndex=new Long(1); - while (mcQueIterator.hasNext()) - { - McQueContent mcQueContent=(McQueContent)mcQueIterator.next(); - if (mcQueContent != null) - { - Long uid=mcQueContent.getUid(); - logger.debug("uid : " + uid); - /* get the options for this question */ - List listMcOptions=mcService.findMcOptionsContentByQueId(uid); - logger.debug("listMcOptions : " + listMcOptions); - Map mapOptionsContent=McUtils.generateOptionsMap(listMcOptions); - logger.debug("mapOptionsContent : " + mapOptionsContent); - mapGeneralOptionsContent.put(mapIndex.toString(), mapOptionsContent); - mapIndex=new Long(mapIndex.longValue()+1); - } - } - logger.debug("current mapGeneralOptionsContent: " + mapGeneralOptionsContent); - return mapGeneralOptionsContent; - } - - /** - * builds a map to hold the weights for all the questions - * rebuildWeightsMapfromDB(HttpServletRequest request, Long toolContentId) - * - * @param request - * @param toolContentId - * @return Map - */ - public static Map rebuildWeightsMapfromDB(HttpServletRequest request, Long toolContentId) - { - Map mapWeightsContent= new TreeMap(new McComparator()); - - IMcService mcService =McUtils.getToolService(request); - logger.debug("toolContentId:" + toolContentId); - - McContent mcContent=mcService.retrieveMc(toolContentId); - logger.debug("mcContent:" + mcContent); - - List list=mcService.refreshQuestionContent(mcContent.getUid()); - logger.debug("refreshed list:" + list); - - Iterator listIterator=list.iterator(); - Long mapIndex=new Long(1); - while (listIterator.hasNext()) - { - McQueContent mcQueContent=(McQueContent)listIterator.next(); - logger.debug("mcQueContent:" + mcQueContent); - mapWeightsContent.put(mapIndex.toString(),mcQueContent.getWeight().toString()); - mapIndex=new Long(mapIndex.longValue()+1); - } - - logger.debug("refreshed Map:" + mapWeightsContent); - return mapWeightsContent; - } - public static Map rebuildIncorrectFeedbackMapfromDB(HttpServletRequest request, Long toolContentId) - { - Map map= new TreeMap(new McComparator()); - - IMcService mcService =McUtils.getToolService(request); - logger.debug("toolContentId:" + toolContentId); - - McContent mcContent=mcService.retrieveMc(toolContentId); - logger.debug("mcContent:" + mcContent); - - if (mcContent != null) - { - List list=mcService.refreshQuestionContent(mcContent.getUid()); - logger.debug("refreshed list:" + list); - - Iterator listIterator=list.iterator(); - Long mapIndex=new Long(1); - while (listIterator.hasNext()) - { - McQueContent mcQueContent=(McQueContent)listIterator.next(); - logger.debug("mcQueContent:" + mcQueContent); - - if (mcQueContent != null) - { - String incorrectFeedback=mcQueContent.getFeedbackIncorrect(); - if (incorrectFeedback != null) - { - map.put(mapIndex.toString(),incorrectFeedback.toString()); - } - else - { - map.put(mapIndex.toString(),""); - } - mapIndex=new Long(mapIndex.longValue()+1); - } - } - } - - logger.debug("refreshed Map:" + map); - return map; - } - - - public static Map rebuildCorrectFeedbackMapfromDB(HttpServletRequest request, Long toolContentId) - { - Map map= new TreeMap(new McComparator()); - - IMcService mcService =McUtils.getToolService(request); - logger.debug("toolContentId:" + toolContentId); - - McContent mcContent=mcService.retrieveMc(toolContentId); - logger.debug("mcContent:" + mcContent); - - if (mcContent != null) - { - List list=mcService.refreshQuestionContent(mcContent.getUid()); - logger.debug("refreshed list:" + list); - - Iterator listIterator=list.iterator(); - Long mapIndex=new Long(1); - while (listIterator.hasNext()) - { - McQueContent mcQueContent=(McQueContent)listIterator.next(); - logger.debug("mcQueContent:" + mcQueContent); - - if (mcQueContent != null) - { - String correctFeedback=mcQueContent.getFeedbackCorrect(); - logger.debug("correctFeedback:" + correctFeedback); - - if (correctFeedback != null) - { - map.put(mapIndex.toString(),correctFeedback.toString()); - } - else - { - map.put(mapIndex.toString(),""); - } - } - mapIndex=new Long(mapIndex.longValue()+1); - } - } - - logger.debug("refreshed Map:" + map); - return map; - } - - - - - /** - * builds a map to hold all the correct feedback entries - * buildInCorrectFeedbackMap(HttpServletRequest request, Long toolContentId) - * - * @param request - * @param toolContentId - * @return Map - */ - public static Map buildInCorrectFeedbackMap(HttpServletRequest request, Long toolContentId) - { - IMcService mcService =McUtils.getToolService(request); - Map mapIncorrectFeedback= new TreeMap(new McComparator()); - - McContent mcContent=mcService.retrieveMc(toolContentId); - logger.debug("mcContent:" + mcContent); - - List questionsContent=mcService.refreshQuestionContent(mcContent.getUid()); - logger.debug("questionsContent:" + questionsContent); - - Iterator listIterator=questionsContent.iterator(); - Long mapIndex=new Long(1); - while (listIterator.hasNext()) - { - McQueContent mcQueContent=(McQueContent)listIterator.next(); - logger.debug("mcQueContent:" + mcQueContent); - mapIncorrectFeedback.put(mapIndex.toString(),mcQueContent.getFeedbackIncorrect()); - mapIndex=new Long(mapIndex.longValue()+1); - } - return mapIncorrectFeedback; - } - - - /** - * builds a map to hold all the incorrect feedback entries - * buildCorrectFeedbackMap(HttpServletRequest request, Long toolContentId) - * - * @param request - * @param toolContentId - * @return Map - */ - public static Map buildCorrectFeedbackMap(HttpServletRequest request, Long toolContentId) - { - IMcService mcService =McUtils.getToolService(request); - Map mapCorrectFeedback= new TreeMap(new McComparator()); - - McContent mcContent=mcService.retrieveMc(toolContentId); - logger.debug("mcContent:" + mcContent); - - List questionsContent=mcService.refreshQuestionContent(mcContent.getUid()); - logger.debug("questionsContent:" + questionsContent); - - Iterator listIterator=questionsContent.iterator(); - Long mapIndex=new Long(1); - while (listIterator.hasNext()) - { - McQueContent mcQueContent=(McQueContent)listIterator.next(); - logger.debug("mcQueContent:" + mcQueContent); - mapCorrectFeedback.put(mapIndex.toString(),mcQueContent.getFeedbackCorrect()); - mapIndex=new Long(mapIndex.longValue()+1); - } - return mapCorrectFeedback; - } - - - /** - * creates the options for a particular question in the db - * persistOptionsFinal(HttpServletRequest request, Map currentOptions, Map selectedOptions, McQueContent mcQueContent) - * - * @param request - * @param currentOptions - * @param selectedOptions - * @param mcQueContent - */ - public static void persistOptionsFinal(HttpServletRequest request, Map currentOptions, Map selectedOptions, McQueContent mcQueContent) - { - logger.debug("doing persistOptionsFinal..."); - IMcService mcService =McUtils.getToolService(request); - logger.debug("passed currentOptions: " + currentOptions); - logger.debug("passed selectedOptions: " + selectedOptions); - - Iterator itCurrentOptions = currentOptions.entrySet().iterator(); - boolean selected=false; - while (itCurrentOptions.hasNext()) - { - Map.Entry pairs = (Map.Entry)itCurrentOptions.next(); - logger.debug("checking the current options pair: " + pairs.getKey() + " = " + pairs.getValue()); - - selected=false; - Iterator itSelectedOptions = selectedOptions.entrySet().iterator(); - while (itSelectedOptions.hasNext()) - { - Map.Entry selectedPairs = (Map.Entry)itSelectedOptions.next(); - logger.debug("checking the selected options pair: " + selectedPairs.getKey() + " = " + selectedPairs.getValue()); - selected=false; - if (pairs.getValue().equals(selectedPairs.getValue())) - { - selected=true; - logger.debug("set selected to true for: " + pairs.getValue()); - break; - } - } - - logger.debug("pre-persist mcOptionsContent: " + pairs.getValue() + " " + selected); - logger.debug("pre-persist mcOptionsContent, using mcQueContent: " + mcQueContent); - McOptsContent mcOptionsContent= new McOptsContent(selected,pairs.getValue().toString() , mcQueContent, new HashSet()); - logger.debug("created mcOptionsContent: " + mcOptionsContent); - mcService.saveMcOptionsContent(mcOptionsContent); - logger.debug("persisted the answer: " + pairs.getValue().toString()); - } - } - - - - /** - * prepares the data to persist options in the db - * persistOptions(HttpServletRequest request, Map mapGeneralOptionsContent, Map mapGeneralSelectedOptionsContent, McQueContent mcQueContent, String questionIndex) - * - * @param request - * @param mapGeneralOptionsContent - * @param mapGeneralSelectedOptionsContent - * @param mcQueContent - * @param questionIndex - */ - public static void persistOptions(HttpServletRequest request, Map mapGeneralOptionsContent, Map mapGeneralSelectedOptionsContent, McQueContent mcQueContent, String questionIndex) - { - logger.debug("doing persistOptions..."); - IMcService mcService =McUtils.getToolService(request); - logger.debug("passed questionIndex: " + questionIndex); - - Iterator itOptionsMap = mapGeneralOptionsContent.entrySet().iterator(); - while (itOptionsMap.hasNext()) { - Map.Entry pairs = (Map.Entry)itOptionsMap.next(); - logger.debug("checking the general options pair: " + pairs.getKey() + " = " + pairs.getValue()); - if ((pairs.getValue() != null) && (!pairs.getValue().equals(""))) - { - Iterator itSelectedOptionsMap = mapGeneralSelectedOptionsContent.entrySet().iterator(); - while (itSelectedOptionsMap.hasNext()) - { - Map.Entry selectedPairs = (Map.Entry)itSelectedOptionsMap.next(); - logger.debug("checking the general selected options pair: " + selectedPairs.getKey() + " = " + selectedPairs.getValue()); - - logger.debug("dubuging: " + pairs.getKey() + "---" + questionIndex); - if (pairs.getKey().equals(selectedPairs.getKey()) && questionIndex.equals(pairs.getKey())) - { - logger.debug("using updated equal question: " + pairs.getKey()); - Map currentOptions=(Map) pairs.getValue(); - Map selectedOptions=(Map) selectedPairs.getValue(); - - persistOptionsFinal(request, currentOptions,selectedOptions,mcQueContent); - } - } - } - } - } - - - /** - * creates the questions content in the db. - * createContent(HttpServletRequest request, McAuthoringForm mcAuthoringForm) - * - * @param request - * @param mcAuthoringForm - * @return - */ - public static McContent createContent(HttpServletRequest request, McAuthoringForm mcAuthoringForm) - { - logger.debug("doing createContent..."); - IMcService mcService =McUtils.getToolService(request); - - /* the tool content id is passed from the container to the tool and placed into session in the McStarterAction */ - Long toolContentId=(Long)request.getSession().getAttribute(TOOL_CONTENT_ID); - if ((toolContentId != null) && (toolContentId.longValue() != 0)) - { - logger.debug("passed TOOL_CONTENT_ID : " + toolContentId); - /*delete the existing content in the database before applying new content*/ - mcService.deleteMcById(toolContentId); - logger.debug("post-deletion existing content"); - } - - String title; - String instructions; - Long createdBy; - String monitoringReportTitle=""; - String reportTitle=""; - - String offlineInstructions=""; - String onlineInstructions=""; - String endLearningMessage=""; - Date creationDate=null; - int passmark=0; - - boolean isQuestionsSequenced=false; - boolean isSynchInMonitor=false; - boolean isUsernameVisible=false; - boolean isRunOffline=false; - boolean isDefineLater=false; - boolean isContentInUse=false; - boolean isRetries=false; - boolean isShowFeedback=false; - boolean isSln=false; - boolean isReflect=false; - - String questionsSequenced=request.getParameter("questionsSequenced"); - logger.debug("questionsSequenced: " + questionsSequenced); - if ((questionsSequenced != null) && (questionsSequenced.equalsIgnoreCase("1"))) - isQuestionsSequenced=true; - - - String retries=request.getParameter("retries"); - logger.debug("retries: " + retries); - if ((retries != null) && (retries.equalsIgnoreCase("1"))) - isRetries=true; - - String sln=request.getParameter("sln"); - logger.debug("sln: " + sln); - if ((sln != null) && (sln.equalsIgnoreCase("1"))) - isSln=true; - - - String isReflectStr=request.getParameter("reflect"); - logger.debug("isReflectStr:" + isReflectStr); - if (isReflectStr != null) - { - if (isReflectStr.equals("1")) - isReflect=true; - } - - logger.debug("passmark: " + mcAuthoringForm.getPassmark()); - if ((mcAuthoringForm.getPassmark() != null) && (mcAuthoringForm.getPassmark().length() > 0)) - passmark= new Integer(mcAuthoringForm.getPassmark()).intValue(); - - logger.debug("isShowFeedback: " + mcAuthoringForm.getShowFeedback()); - if (mcAuthoringForm.getShowFeedback().equalsIgnoreCase(ON)) - isShowFeedback=true; - - String reflectionSubject=request.getParameter(REFLECTION_SUBJECT); - logger.debug("reflectionSubject: " + reflectionSubject); - - - String richTextTitle=request.getParameter(RICHTEXT_TITLE); - logger.debug("richTextTitle: " + richTextTitle); - - String richTextInstructions=request.getParameter(RICHTEXT_INSTRUCTIONS); - logger.debug("richTextInstructions: " + richTextInstructions); - - - String richTextOfflineInstructions=""; - richTextOfflineInstructions = (String)request.getSession().getAttribute(RICHTEXT_OFFLINEINSTRUCTIONS); - logger.debug("createContent richTextOfflineInstructions from session: " + richTextOfflineInstructions); - if (richTextOfflineInstructions == null) richTextOfflineInstructions=""; - - String richTextOnlineInstructions=""; - richTextOnlineInstructions = (String)request.getSession().getAttribute(RICHTEXT_ONLINEINSTRUCTIONS); - logger.debug("createContent richTextOnlineInstructions from session: " + richTextOnlineInstructions); - if (richTextOnlineInstructions == null) richTextOnlineInstructions=""; - - - String richTextReportTitle=(String)request.getSession().getAttribute(RICHTEXT_REPORT_TITLE); - logger.debug("richTextReportTitle: " + richTextReportTitle); - - creationDate=(Date)request.getSession().getAttribute(CREATION_DATE); - if (creationDate == null) - creationDate=new Date(System.currentTimeMillis()); - - logger.debug("using creationDate: " + creationDate); - - /*obtain user object from the session*/ - HttpSession ss = SessionManager.getSession(); - /* get back login user DTO */ - UserDTO toolUser = (UserDTO) ss.getAttribute(AttributeNames.USER); - logger.debug("retrieving toolUser: " + toolUser); - logger.debug("retrieving toolUser userId: " + toolUser.getUserID()); - String fullName= toolUser.getFirstName() + " " + toolUser.getLastName(); - logger.debug("retrieving toolUser fullname: " + fullName); - long userId=toolUser.getUserID().longValue(); - logger.debug("userId: " + userId); - - /* create a new qa content and leave the default content intact*/ - McContent mc = new McContent(); - mc.setMcContentId(toolContentId); - mc.setTitle(richTextTitle); - mc.setInstructions(richTextInstructions); - mc.setCreationDate(creationDate); /*preserve this from the db*/ - mc.setUpdateDate(new Date(System.currentTimeMillis())); /* keep updating this one*/ - mc.setCreatedBy(userId); /* make sure we are setting the userId from the User object above*/ - mc.setUsernameVisible(isUsernameVisible); - mc.setQuestionsSequenced(isQuestionsSequenced); /* the default question listing in learner mode will be all in the same page*/ - mc.setOnlineInstructions(richTextOnlineInstructions); - mc.setOfflineInstructions(richTextOfflineInstructions); - mc.setRunOffline(false); - mc.setDefineLater(false); - mc.setSynchInMonitor(isSynchInMonitor); - mc.setContentInUse(isContentInUse); - mc.setRunOffline(isRunOffline); - mc.setReportTitle(richTextReportTitle); - mc.setMonitoringReportTitle(monitoringReportTitle); - mc.setRetries(isRetries); - mc.setPassMark(new Integer(passmark)); - mc.setShowReport(isSln); - mc.setReflect(isReflect); - mc.setReflectionSubject(reflectionSubject); - mc.setShowFeedback(isShowFeedback); - mc.setMcQueContents(new TreeSet()); - mc.setMcSessions(new TreeSet()); - logger.debug("mc content :" + mc); - - /*create the content in the db*/ - mcService.createMc(mc); - logger.debug("mc created with content id: " + toolContentId); - - return mc; - } - - - public static Map mergeMaps(Map map1, Map map2) - { - Map mapMergedMap= new TreeMap(new McComparator()); - logger.debug("merging maps now..."); - - Iterator itMap1 = map1.entrySet().iterator(); - while (itMap1.hasNext()) - { - Map.Entry pairs = (Map.Entry)itMap1.next(); - logger.debug("using the pair: " + pairs.getKey() + " = " + pairs.getValue()); - mapMergedMap.put(pairs.getKey(), pairs.getValue()); - } - - logger.debug("adding the other map..."); - Iterator itMap2 = map2.entrySet().iterator(); - while (itMap2.hasNext()) - { - Map.Entry pairs = (Map.Entry)itMap2.next(); - logger.debug("using the pair: " + pairs.getKey() + " = " + pairs.getValue()); - mapMergedMap.put(pairs.getKey(), pairs.getValue()); - } - - logger.debug("final merged map: " + mapMergedMap); - return mapMergedMap; - } - - - /** - * builds a question weights map from only those questions with candidate answers - * updateCurrentWeightsMapForQuestionWithNoOptions(HttpServletRequest request, Map mapWeights, Map mapQuestionsContent) - * - * @param request - * @param mapWeights - * @param mapQuestionsContent - * @return Map - */ - public static Map updateCurrentWeightsMapForQuestionWithNoOptions(HttpServletRequest request, Map mapWeights, Map mapQuestionsContent) - { - logger.debug("mapWeights: " + mapWeights); - logger.debug("mapQuestionsContent: " + mapQuestionsContent); - Map mapUpdatedWeightsMap= new TreeMap(new McComparator()); - - boolean questionWithOptionsFound=false; - Iterator itQuestionsMap = mapQuestionsContent.entrySet().iterator(); - while (itQuestionsMap.hasNext()) - { - Map.Entry pairs = (Map.Entry)itQuestionsMap.next(); - logger.debug("using the pair: " + pairs.getKey() + " = " + pairs.getValue()); - - questionWithOptionsFound=false; - Iterator itWeightsMap = mapWeights.entrySet().iterator(); - while (itWeightsMap.hasNext()) - { - Map.Entry pairsWeight = (Map.Entry)itWeightsMap.next(); - logger.debug("using the pairsWeight: " + pairsWeight.getKey() + " = " + pairsWeight.getValue()); - - if (pairs.getKey().toString().equals(pairsWeight.getKey().toString())) - { - logger.debug("this pair is eligible to be added to the updated weights map since this question is with candidate answers"); - mapUpdatedWeightsMap.put(pairsWeight.getKey().toString(), pairsWeight.getValue().toString()); - break; - } - } - } - logger.debug("final mapUpdatedWeightsMap: " + mapUpdatedWeightsMap); - return mapUpdatedWeightsMap; - } - - - /** - * builds a questions map from only those questions with candidate answers - * updateQuestionsMapForNoOptions(HttpServletRequest request, Map mapQuestionsContent, Map mapGeneralOptionsContent) - * - * @param request - * @param mapQuestionsContent - * @param mapGeneralOptionsContent - * @return Map - */ - public static Map updateQuestionsMapForNoOptions(HttpServletRequest request, Map mapQuestionsContent, Map mapGeneralOptionsContent) - { - logger.debug("doing updateQuestionsMapForNoOptions..."); - IMcService mcService =McUtils.getToolService(request); - Map mapUpdatedQuestionsContent= new TreeMap(new McComparator()); - - logger.debug("mapQuestionsContent: " + mapQuestionsContent); - logger.debug("mapGeneralOptionsContent: " + mapGeneralOptionsContent); - - request.getSession().setAttribute(QUESTIONS_WITHNO_OPTIONS, new Boolean(false)); - - Iterator itQuestionsMap = mapQuestionsContent.entrySet().iterator(); - boolean questionFound=false; - while (itQuestionsMap.hasNext()) - { - Map.Entry pairs = (Map.Entry)itQuestionsMap.next(); - logger.debug("using the pair: " + pairs.getKey() + " = " + pairs.getValue()); - - questionFound=false; - Iterator itMapGOC = mapGeneralOptionsContent.entrySet().iterator(); - while (itMapGOC.hasNext()) - { - Map.Entry pairsGOC = (Map.Entry)itMapGOC.next(); - logger.debug("using the pair: " + pairsGOC.getKey() + " = " + pairsGOC.getValue()); - logger.debug("comparing the pairs : " + pairs.getKey() + " and " + pairsGOC.getKey()); - - if (pairs.getKey().toString().equals(pairsGOC.getKey().toString())) - { - logger.debug("question has options, keep this one: " + pairs.getKey()); - questionFound=true; - } - } - logger.debug("questionFound: " + questionFound); - - - logger.debug("will add this question to the the questionsMap:" + pairs.getKey().toString()); - mapUpdatedQuestionsContent.put(pairs.getKey().toString(), pairs.getValue().toString()); - - if (questionFound == false) - { - request.getSession().setAttribute(QUESTIONS_WITHNO_OPTIONS, new Boolean(true)); - logger.debug("setting QUESTIONS_WITHNO_OPTIONS to true. using key: " + pairs.getKey().toString()); - addDefaultOptionsContentToQuestion(request, mapGeneralOptionsContent,pairs.getKey().toString()); - } - logger.debug("final mapUpdatedQuestionsContent:" + mapUpdatedQuestionsContent); - } - return mapUpdatedQuestionsContent; - } - - - public static void addDefaultOptionsContentToQuestion(HttpServletRequest request, Map mapGeneralOptionsContent,String newKey) - { - logger.debug("doing addDefaultOptionsContentToQuestion with newKey:" + newKey); - logger.debug("mapGeneralOptionsContent:" + mapGeneralOptionsContent); - Map mapDefaultOptionsContent=(Map)request.getSession().getAttribute(MAP_DEFAULTOPTIONS_CONTENT); - logger.debug("mapDefaultOptionsContent:" + mapDefaultOptionsContent); - mapGeneralOptionsContent.put(newKey, mapDefaultOptionsContent); - logger.debug("mapGeneralOptionsContent after put:" + mapGeneralOptionsContent); - } - - - public static Map addDefaultOptionsContentToMap(HttpServletRequest request, Map mapGO, Map mapQuestionsContent) - { - logger.debug("starting addDefaultOptionsContentToMap with map:" + mapGO); - - Map newMap= new TreeMap(new McComparator()); - Map mapDefaultOptionsContent=(Map)request.getSession().getAttribute(MAP_DEFAULTOPTIONS_CONTENT); - logger.debug("mapDefaultOptionsContent:" + mapDefaultOptionsContent); - - boolean found=false; - Iterator itMap = mapQuestionsContent.entrySet().iterator(); - while (itMap.hasNext()) - { - Map.Entry pairs = (Map.Entry)itMap.next(); - logger.debug("using the pair: " + pairs.getKey() + " = " + pairs.getValue()); - String localKey=(String)pairs.getKey(); - logger.debug("localKey: " + localKey); - - String question=(String)pairs.getValue(); - logger.debug("question: " + question); - - Iterator itGOMap = mapGO.entrySet().iterator(); - found=false; - Map generalMap=null; - while (itGOMap.hasNext()) - { - Map.Entry pairsGo = (Map.Entry)itGOMap.next(); - logger.debug("using the pairsGo: " + pairsGo.getKey() + " = " + pairsGo.getValue()); - String localGOKey=(String)pairsGo.getKey(); - logger.debug("localGOKey: " + localGOKey); - - if (localGOKey.equals(localKey)) - { - Map localMap=(Map)pairsGo.getValue(); - logger.debug("localMap: " + localMap); - generalMap=localMap; - - found=true; - break; - } - - } - - logger.debug("found: " + found); - logger.debug("generalMap: " + generalMap); - logger.debug("localKey: " + localKey); - - if (found == false) - { - newMap.put(localKey, mapDefaultOptionsContent); - } - else if (generalMap == null) - { - newMap.put(localKey, mapDefaultOptionsContent); - } - else - { - newMap.put(localKey, generalMap); - } - } - logger.debug("returning newMap: " + newMap); - return newMap; - } - - - - public static Map addDefaultSelectedOptionsContentToMap(HttpServletRequest request, Map mapGSO, Map mapQuestionsContent) - { - logger.debug("starting addDefaultSelectedOptionsContentToMap with map:" + mapGSO); - - Map newMap= new TreeMap(new McComparator()); - Map mapDefaultSelectedOptionsContent=(Map)request.getSession().getAttribute(MAP_DEFAULTSELECTEDOPTIONS_CONTENT); - logger.debug("mapDefaultSelectedOptionsContent:" + mapDefaultSelectedOptionsContent); - - boolean found=false; - Iterator itMap = mapQuestionsContent.entrySet().iterator(); - while (itMap.hasNext()) - { - Map.Entry pairs = (Map.Entry)itMap.next(); - logger.debug("using the pair: " + pairs.getKey() + " = " + pairs.getValue()); - String localKey=(String)pairs.getKey(); - logger.debug("localKey: " + localKey); - - String question=(String)pairs.getValue(); - logger.debug("question: " + question); - - Iterator itGSOMap = mapGSO.entrySet().iterator(); - found=false; - Map generalMap=null; - while (itGSOMap.hasNext()) - { - Map.Entry pairsGSo = (Map.Entry)itGSOMap.next(); - logger.debug("using the pairsGSo: " + pairsGSo.getKey() + " = " + pairsGSo.getValue()); - String localGOKey=(String)pairsGSo.getKey(); - logger.debug("localGOKey: " + localGOKey); - - if (localGOKey.equals(localKey)) - { - Map localMap=(Map)pairsGSo.getValue(); - logger.debug("localMap: " + localMap); - generalMap=localMap; - - found=true; - break; - } - - } - - logger.debug("found: " + found); - logger.debug("generalMap: " + generalMap); - logger.debug("localKey: " + localKey); - - if (found == false) - { - newMap.put(localKey, mapDefaultSelectedOptionsContent); - } - else if (generalMap == null) - { - newMap.put(localKey, mapDefaultSelectedOptionsContent); - } - else - { - newMap.put(localKey, generalMap); - } - } - logger.debug("returning newMap: " + newMap); - return newMap; - } - - - /** - * - * removes only unused question entries from the db. It keeps the valid entries since they get updated. - * cleanupRedundantQuestions(HttpServletRequest request, List existingQuestions, Map mapQuestionsContent, McContent mcContent) - * - * @param request - * @param existingQuestions - * @param mapQuestionsContent - * @param mcContent - */ - public static void cleanupRedundantQuestions(HttpServletRequest request, List existingQuestions, Map mapQuestionsContent, McContent mcContent) - { - logger.debug("doing cleanupRedundantQuestions..."); - logger.debug("using existingQuestions: " + existingQuestions); - logger.debug("using mapQuestionsContent: " + mapQuestionsContent); - logger.debug("using mcContent: " + mcContent); - - IMcService mcService =McUtils.getToolService(request); - - /*remove ununsed question entries from the db */ - boolean questionFound=false; - Iterator itExistingQuestions = existingQuestions.iterator(); - while (itExistingQuestions.hasNext()) - { - McQueContent mcQueContent=(McQueContent)itExistingQuestions.next(); - logger.debug("mcQueContent:" + mcQueContent); - - Iterator itNewQuestionsMap = mapQuestionsContent.entrySet().iterator(); - questionFound=false; - while (itNewQuestionsMap.hasNext()) - { - Map.Entry pairs = (Map.Entry)itNewQuestionsMap.next(); - logger.debug("using the pair: " + pairs.getKey() + " = " + pairs.getValue()); - logger.debug("mcQueContent.getQuestion(): " + mcQueContent.getQuestion() + "--" + pairs.getValue()); - - if (mcQueContent.getQuestion().equals(pairs.getValue().toString())) - { - logger.debug("equals mcQueContent.getQuestion(): " + mcQueContent.getQuestion() + "--" + pairs.getValue()); - questionFound=true; - break; - } - } - - if (questionFound == false) - { - String deletableQuestion=mcQueContent.getQuestion(); - logger.debug("found is false, delete this question " + deletableQuestion); - mcQueContent=mcService.getQuestionContentByQuestionText(deletableQuestion, mcContent.getUid()); - - logger.debug("found is false, delete this question " + mcQueContent); - if (mcQueContent != null) - { - logger.debug("first removing from collection " + mcQueContent); - mcContent.getMcQueContents().remove(mcQueContent); - logger.debug("removed from collection "); - - mcService.removeMcQueContent(mcQueContent); - logger.debug("removed mcQueContent from the db: " + mcQueContent); - } - } - } - } - - - /** - * supports persistance of questions - * selectAndPersistQuestions(HttpServletRequest request, List existingQuestions, Map mapQuestionsContent,Map mapFeedbackIncorrect, Map mapFeedbackCorrect, Map mapGeneralOptionsContent, McContent mcContent) - * - * @param request - * @param existingQuestions - * @param mapQuestionsContent - * @param mapFeedbackIncorrect - * @param mapFeedbackCorrect - * @param mapGeneralOptionsContent - * @param mcContent - */ - public static void selectAndPersistQuestions(HttpServletRequest request, List existingQuestions, Map mapQuestionsContent,Map mapFeedbackIncorrect, Map mapFeedbackCorrect, Map mapGeneralOptionsContent, Map mapWeights, McContent mcContent) - { - logger.debug("doing selectAndPersistQuestions..."); - logger.debug("mapWeights: " + mapWeights); - IMcService mcService =McUtils.getToolService(request); - - - Iterator itQuestionsMap = mapQuestionsContent.entrySet().iterator(); - boolean questionContentFound=false; - while (itQuestionsMap.hasNext()) - { - Map.Entry pairs = (Map.Entry)itQuestionsMap.next(); - logger.debug("using the pair: " + pairs.getKey() + " = " + pairs.getValue()); - - questionContentFound = false; - String displayOrder="1"; - String weight=""; - McQueContent mcQueContent=null; - Iterator itExistingQuestions = existingQuestions.iterator(); - while (itExistingQuestions.hasNext()) - { - mcQueContent=(McQueContent)itExistingQuestions.next(); - logger.debug("mcQueContent:" + mcQueContent); - - if (mcQueContent.getQuestion().equals(pairs.getValue())) - { - logger.debug("existing mcQueContent found :" + mcQueContent); - questionContentFound=true; - displayOrder=pairs.getKey().toString(); - weight=(String)mapWeights.get(displayOrder); - logger.debug("weight :" + weight); - - logger.debug("new display order for " + mcQueContent.getQuestion()+ " will be: " + displayOrder); - logger.debug("new weight for " + mcQueContent.getQuestion()+ " will be: " + weight); - break; - } - } - - if (questionContentFound == true) - { - logger.debug("questionContentFound is true: " + mcQueContent); - updateExistingQuestionContent(request,mapFeedbackIncorrect, mapFeedbackCorrect, mcQueContent, displayOrder, weight); - } - else - { - logger.debug("questionContentFound is false: " + mcQueContent); - createQuestionContent(request,mapQuestionsContent, mapFeedbackIncorrect, mapFeedbackCorrect, pairs.getValue().toString(), mapGeneralOptionsContent, mcContent); - } - } - } - - - /** - * updates existing questions while persisting the questions - * updateExistingQuestionContent(HttpServletRequest request, Map mapFeedbackIncorrect, Map mapFeedbackCorrect, McQueContent mcQueContent, String displayOrder) - * - * @param request - * @param mapFeedbackIncorrect - * @param mapFeedbackCorrect - * @param mcQueContent - * @param displayOrder - */ - public static void updateExistingQuestionContent(HttpServletRequest request, Map mapFeedbackIncorrect, Map mapFeedbackCorrect, McQueContent mcQueContent, String displayOrder, String weight) - { - logger.debug("doing updateExistingQuestionContent..."); - logger.debug("using displayOrder: " + displayOrder); - logger.debug("using weight: " + weight); - - String incorrectFeedback=(String)mapFeedbackIncorrect.get(displayOrder); - logger.debug("new incorrectFeedback will be :" + incorrectFeedback); - String correctFeedback=(String)mapFeedbackCorrect.get(displayOrder); - logger.debug("new correctFeedback will be :" + correctFeedback); - - IMcService mcService =McUtils.getToolService(request); - mcQueContent.setDisplayOrder(new Integer(displayOrder)); - mcQueContent.setWeight(new Integer(weight)); - - if ((incorrectFeedback != null) && !(incorrectFeedback.equals(""))) - mcQueContent.setFeedbackIncorrect(incorrectFeedback); - - if ((correctFeedback != null) && !(correctFeedback.equals(""))) - mcQueContent.setFeedbackCorrect(correctFeedback); - - mcService.saveOrUpdateMcQueContent(mcQueContent); - logger.debug("updated mcQueContent in the db: " + mcQueContent); - } - - - public static void removeRedundantOptionEntry(HttpServletRequest request, Map mapSGO, Map mapGO, Map options) - { - logger.debug("starting removeRedundantOptionEntry..." + mapGO); - logger.debug("using mapSGO..." + mapSGO); - - if ((mapSGO != null) && (mapGO != null)) - { - IMcService mcService =McUtils.getToolService(request); - Iterator itSGOMap = mapSGO.entrySet().iterator(); - boolean optionFound=false; - while (itSGOMap.hasNext()) - { - Map.Entry pairsSGO = (Map.Entry)itSGOMap.next(); - optionFound=false; - Iterator itGOMap = mapGO.entrySet().iterator(); - while (itGOMap.hasNext()) - { - Map.Entry pairsGO = (Map.Entry)itGOMap.next(); - if (pairsSGO.getValue().equals(pairsGO.getValue())) - { - logger.debug("equal option found: " + pairsGO.getValue()); - optionFound=true; - break; - } - } - - if (optionFound == false) - { - logger.debug("options optionFound is false: remove this option"); - int optionSize=options.size(); - logger.debug("optionSize:" + optionSize); - String mcQueContentUid=(String)options.get(new Integer(optionSize).toString()); - - logger.debug("mcQueContentUid: " + mcQueContentUid); - - String deletableOptionText=pairsSGO.getValue().toString(); - logger.debug("deletableOptionText: " + deletableOptionText); - - if (deletableOptionText != null && (!deletableOptionText.equals(""))) - { - McOptsContent mcOptsContent = mcService.getOptionContentByOptionText(deletableOptionText, new Long(mcQueContentUid)); - logger.debug("mcOptsContent: " + mcOptsContent); - mcService.removeMcOptionsContent(mcOptsContent); - logger.debug("removed mcOptsContent from db: " + mcOptsContent); - } - else - { - logger.debug("This should not happen: deletableOptionText is null.."); - } - } - } - } - } - - /** - * removes the unused persisted candidate answers - * cleanupRedundantOptions(HttpServletRequest request, Map mapStartupGeneralOptionsContent, Map mapStartupGeneralSelectedOptionsContent, Map mapGeneralOptionsContent, Map mapGeneralSelectedOptionsContent, Map mapStartupGeneralOptionsQueId) - * - * @param request - * @param mapStartupGeneralOptionsContent - * @param mapStartupGeneralSelectedOptionsContent - * @param mapGeneralOptionsContent - * @param mapGeneralSelectedOptionsContent - * @param mapStartupGeneralOptionsQueId - */ - public static void cleanupRedundantOptions(HttpServletRequest request, Map mapStartupGeneralOptionsContent, Map mapStartupGeneralSelectedOptionsContent, Map mapGeneralOptionsContent, Map mapGeneralSelectedOptionsContent, Map mapStartupGeneralOptionsQueId) - { - logger.debug("doing cleanupRedundantOptions..."); - logger.debug("starting mapStartupGeneralOptionsContent...:" + mapStartupGeneralOptionsContent); - logger.debug("using mapGeneralOptionsContent..: "+ mapGeneralOptionsContent); - IMcService mcService =McUtils.getToolService(request); - - Iterator itSGOMap = mapStartupGeneralOptionsContent.entrySet().iterator(); - int displayOrder=0; - boolean optionFound=false; - while (itSGOMap.hasNext()) - { - Map.Entry pairsSGO = (Map.Entry)itSGOMap.next(); - - optionFound=false; - Iterator itGOMap = mapGeneralOptionsContent.entrySet().iterator(); - while (itGOMap.hasNext()) - { - Map.Entry pairsGO = (Map.Entry)itGOMap.next(); - if (pairsSGO.getKey().equals(pairsGO.getKey())) - { - logger.debug("equal keys found: " + pairsSGO.getKey()); - Map mapSGO=(Map)pairsSGO.getValue(); - Map mapGO=(Map)pairsGO.getValue(); - logger.debug("mapSGO: " + mapSGO); - logger.debug("mapGO: " + mapGO); - - Map options=(Map)mapStartupGeneralOptionsQueId.get(pairsSGO.getKey()); - logger.debug("options: " + options); - removeRedundantOptionEntry(request, mapSGO, mapGO,options); - } - } - } - } - - - /** - * help persist candidate answers - * selectAndPersistOptions(HttpServletRequest request, Map mapStartupGeneralOptionsContent, Map mapStartupGeneralSelectedOptionsContent, - * - * @param request - * @param mapStartupGeneralOptionsContent - * @param mapStartupGeneralSelectedOptionsContent - * @param mapGeneralOptionsContent - * @param mapGeneralSelectedOptionsContent - * @param mapStartupGeneralOptionsQueId - */ - public static void selectAndPersistOptions(HttpServletRequest request, Map mapStartupGeneralOptionsContent, Map mapStartupGeneralSelectedOptionsContent, - Map mapGeneralOptionsContent, Map mapGeneralSelectedOptionsContent, Map mapStartupGeneralOptionsQueId) - { - logger.debug("doing selectAndPersistOptions..."); - logger.debug("starting selectAndPersistOptions..: "+ mapStartupGeneralOptionsContent); - logger.debug("using mapGeneralOptionsContent..: "+ mapGeneralOptionsContent); - IMcService mcService =McUtils.getToolService(request); - - Iterator itSGOMap = mapStartupGeneralOptionsContent.entrySet().iterator(); - int displayOrder=0; - boolean optionFound=false; - while (itSGOMap.hasNext()) - { - Map.Entry pairsSGO = (Map.Entry)itSGOMap.next(); - - optionFound=false; - Iterator itGOMap = mapGeneralOptionsContent.entrySet().iterator(); - while (itGOMap.hasNext()) - { - Map.Entry pairsGO = (Map.Entry)itGOMap.next(); - if (pairsSGO.getKey().equals(pairsGO.getKey())) - { - logger.debug("equal keys found: " + pairsSGO.getKey()); - String questionIndex=pairsSGO.getKey().toString(); - Map mapSGO=(Map)pairsSGO.getValue(); - Map mapGO=(Map)pairsGO.getValue(); - logger.debug("mapSGO: " + mapSGO); - logger.debug("mapGO: " + mapGO); - - Map options=(Map)mapStartupGeneralOptionsQueId.get(pairsSGO.getKey()); - logger.debug("options: " + options); - updateOrCreateOptions(request, mapSGO, mapGO,options, questionIndex, mapGeneralSelectedOptionsContent); - } - } - } - - logger.debug("will do writePendingOptions for the new questions.."); - writePendingOptions(request, mapGeneralOptionsContent, mapGeneralSelectedOptionsContent); - } - - - /** - * used to persist or update candidate answers - * updateOrCreateOptions(HttpServletRequest request, Map mapSGO, Map mapGO, Map options, String questionIndex, Map mapGeneralSelectedOptionsContent) - * - * @param request - * @param mapSGO - * @param mapGO - * @param options - * @param questionIndex - * @param mapGeneralSelectedOptionsContent - */ - public static void updateOrCreateOptions(HttpServletRequest request, Map mapSGO, Map mapGO, Map options, String questionIndex, Map mapGeneralSelectedOptionsContent) - { - logger.debug("doing updateOrCreateOptions..."); - if (mapGO != null) - { - Iterator itOptionsGoMap = mapGO.entrySet().iterator(); - boolean optionContentFound=false; - while (itOptionsGoMap.hasNext()) - { - Map.Entry pairs = (Map.Entry)itOptionsGoMap.next(); - logger.debug("using the pair: " + pairs.getKey() + " = " + pairs.getValue()); - - optionContentFound = false; - Iterator itOptionsSGO = mapSGO.entrySet().iterator(); - while (itOptionsSGO.hasNext()) - { - Map.Entry pairsSGO = (Map.Entry)itOptionsSGO.next(); - if (pairsSGO.getValue().equals(pairs.getValue())) - { - optionContentFound = true; - break; - } - } - - if (optionContentFound == false) - { - String optionText=pairs.getValue().toString(); - logger.debug("optionContentFound is false and option is: " + optionText); - if ((optionText != null) && (!optionText.equals(""))) - { - createOptionContent(request, options, optionText, questionIndex, mapGeneralSelectedOptionsContent); - } - } - } - } - } - - - - /** - * persists candidate answers - * writePendingOptions(HttpServletRequest request, Map mapGeneralOptionsContent, Map mapGeneralSelectedOptionsContent) - * - * @param request - * @param mapGeneralOptionsContent - * @param mapGeneralSelectedOptionsContent - */ - public static void writePendingOptions(HttpServletRequest request, Map mapGeneralOptionsContent, Map mapGeneralSelectedOptionsContent) - { - logger.debug("doing writePendingQuestions..."); - Iterator itGO = mapGeneralOptionsContent.entrySet().iterator(); - while (itGO.hasNext()) - { - Map.Entry pairsGO = (Map.Entry)itGO.next(); - Map pendingOptions=(Map) pairsGO.getValue(); - logger.debug("pendingOptions: " + pendingOptions); - writePendingOption(request, pairsGO.getKey().toString(), pendingOptions, mapGeneralSelectedOptionsContent); - } - } - - - /** - * persists a candidate answer - * writePendingOption(HttpServletRequest request, String questionIndex, Map pendingOptions, Map mapGeneralSelectedOptionsContent) - * - * @param request - * @param questionIndex - * @param pendingOptions - * @param mapGeneralSelectedOptionsContent - */ - public static void writePendingOption(HttpServletRequest request, String questionIndex, Map pendingOptions, Map mapGeneralSelectedOptionsContent) - { - logger.debug("doing writePendingOption..."); - logger.debug("questionIndex: " + questionIndex); - logger.debug("pendingOptions: " + pendingOptions); - IMcService mcService =McUtils.getToolService(request); - - Long toolContentId=(Long)request.getSession().getAttribute(TOOL_CONTENT_ID); - logger.debug("getting existing content with id:" + toolContentId); - McContent mcContent=mcService.retrieveMc(toolContentId); - logger.debug("existing mcContent:" + mcContent); - McQueContent mcQueContent=mcService.getQuestionContentByDisplayOrder(new Long(questionIndex), mcContent.getUid()); - logger.debug("exracted mcQueContent:" + mcQueContent); - - if (mcQueContent != null) - { - Long mcQueContentUid=mcQueContent.getUid(); - logger.debug("mcQueContentUid:" + mcQueContentUid); - - if (pendingOptions != null) - { - Iterator itPQ = pendingOptions.entrySet().iterator(); - boolean isOptionSelected=false; - while (itPQ.hasNext()) - { - Map.Entry pairsPQ = (Map.Entry)itPQ.next(); - String optionText=pairsPQ.getValue().toString() ; - logger.debug("optionText: " + optionText); - - if ((optionText != null) && (!optionText.equals(""))) - { - isOptionSelected=false; - isOptionSelected=isOptionSelected(mapGeneralSelectedOptionsContent, optionText, questionIndex); - logger.debug("isOptionSelected: " + isOptionSelected); - - McOptsContent mcOptsContent = mcService.getOptionContentByOptionText(optionText, mcQueContentUid); - logger.debug("mcOptsContent: " + mcOptsContent); - - if (mcOptsContent == null) - { - mcOptsContent = new McOptsContent(isOptionSelected, pairsPQ.getValue().toString(),mcQueContent , new TreeSet()); - logger.debug("created new mcOptsContent:" + mcOptsContent); - } - else - { - logger.debug("this option is already persisted mcQueContent, just look after isOptionSelected:" + mcQueContent); - mcOptsContent.setCorrectOption(isOptionSelected); - } - mcService.saveMcOptionsContent(mcOptsContent); - logger.debug("persisted mcQueContent: " + mcQueContent); - } - } - } - } - } - - - /** * persists a candidate answer * createOptionContent(HttpServletRequest request, Map options, String optionText, String questionIndex, Map mapGeneralSelectedOptionsContent) @@ -2225,10 +333,10 @@ * @param mapGeneralSelectedOptionsContent */ public static void createOptionContent(HttpServletRequest request, Map options, String optionText, - String questionIndex, Map mapGeneralSelectedOptionsContent) + String questionIndex, Map mapGeneralSelectedOptionsContent, IMcService mcService) { logger.debug("doing createOptionContent..."); - IMcService mcService =McUtils.getToolService(request); + int optionSize=options.size(); logger.debug("optionSize:" + optionSize); logger.debug("optionText:" + optionText); @@ -2334,813 +442,1501 @@ return false; } - - /** - * persists the question content - * createQuestionContent(HttpServletRequest request, Map mapQuestionsContent, Map mapFeedbackIncorrect, Map mapFeedbackCorrect, String question, Map mapGeneralOptionsContent, McContent mcContent) - * - * @param request - * @param mapQuestionsContent - * @param mapFeedbackIncorrect - * @param mapFeedbackCorrect - * @param question - * @param mapGeneralOptionsContent - * @param mcContent - */ - public static void createQuestionContent(HttpServletRequest request, Map mapQuestionsContent, Map mapFeedbackIncorrect, Map mapFeedbackCorrect, String question, Map mapGeneralOptionsContent, McContent mcContent) + + + /** + * cleans up authoring http session + * cleanupAuthoringSession(HttpServletRequest request) + * @param request + */ + public static void cleanupAuthoringSession(HttpServletRequest request) { - logger.debug("using createQuestionContent with question: " + question); - IMcService mcService =McUtils.getToolService(request); - - int displayOrder= getNewDisplayOrder(mapQuestionsContent, question); - logger.debug("displayOrder: " + displayOrder); - - boolean isQuestionWithOptions=isQuestionWithOptions(mapGeneralOptionsContent, displayOrder); - logger.debug("isQuestionWithOptions: " + isQuestionWithOptions); - - if (isQuestionWithOptions == true) - { - Map mapWeights= (Map)request.getSession().getAttribute(MAP_WEIGHTS); - logger.debug("MAP_WEIGHTS: " + MAP_WEIGHTS); - - String weight=(String)mapWeights.get(new Integer(displayOrder).toString()); - logger.debug("new weight will be:" + weight); - - String incorrectFeedback=(String)mapFeedbackIncorrect.get(new Integer(displayOrder).toString()); - logger.debug("new incorrectFeedback will be :" + incorrectFeedback); - - if ((incorrectFeedback == null) || (incorrectFeedback.equals(""))) - incorrectFeedback=DEFAULT_FEEDBACK_INCORRECT; + request.getSession().removeAttribute(ACTIVE_MODULE); + request.getSession().removeAttribute(DEFAULT_CONTENT_ID); + request.getSession().removeAttribute(SHOW_AUTHORING_TABS); + request.getSession().removeAttribute(TOOL_CONTENT_ID); + request.getSession().removeAttribute(DEFINE_LATER_IN_EDIT_MODE); + request.getSession().removeAttribute(LIST_OFFLINEFILES_METADATA); + request.getSession().removeAttribute(LIST_ONLINEFILES_METADATA); + request.getSession().removeAttribute(LIST_UPLOADED_OFFLINE_FILENAMES); + request.getSession().removeAttribute(LIST_UPLOADED_ONLINE_FILENAMES); + request.getSession().removeAttribute(EDIT_OPTIONS_MODE); + request.getSession().removeAttribute(IS_REVISITING_USER); + request.getSession().removeAttribute(PASSMARK); + request.getSession().removeAttribute(DEFINE_LATER); + request.getSession().removeAttribute(IS_REVISITING_USER); + request.getSession().removeAttribute(MAP_WEIGHTS); + request.getSession().removeAttribute(DEFINE_LATER_EDIT_ACTIVITY); + //request.getSession().removeAttribute(RICHTEXT_END_LEARNING_MSG); + request.getSession().removeAttribute(RICHTEXT_FEEDBACK_CORRECT); + request.getSession().removeAttribute(RICHTEXT_FEEDBACK_INCORRECT); + request.getSession().removeAttribute(RICHTEXT_TITLE); + request.getSession().removeAttribute(RICHTEXT_INSTRUCTIONS); + request.getSession().removeAttribute(RICHTEXT_OFFLINEINSTRUCTIONS); + request.getSession().removeAttribute(RICHTEXT_ONLINEINSTRUCTIONS); + request.getSession().removeAttribute(RETRIES); + request.getSession().removeAttribute(MAP_DEFAULTOPTIONS_CONTENT); + request.getSession().removeAttribute(MAP_GENERAL_OPTIONS_CONTENT); + request.getSession().removeAttribute(MAP_GENERAL_SELECTED_OPTIONS_CONTENT); + request.getSession().removeAttribute(MAP_STARTUP_GENERAL_OPTIONS_CONTENT); + request.getSession().removeAttribute(MAP_STARTUP_GENERAL_SELECTED_OPTIONS_CONTENT); + request.getSession().removeAttribute(MAP_DISABLED_QUESTIONS); + request.getSession().removeAttribute(MAP_SELECTED_OPTIONS); + request.getSession().removeAttribute(MAP_FEEDBACK_INCORRECT); + request.getSession().removeAttribute(MAP_FEEDBACK_CORRECT); + request.getSession().removeAttribute(SELECTED_QUESTION); + request.getSession().removeAttribute(SELECTED_QUESTION_INDEX); + request.getSession().removeAttribute(QUESTIONS_WITHNO_OPTIONS); + request.getSession().removeAttribute(USER_EXCEPTION_CONTENTID_REQUIRED); + request.getSession().removeAttribute(USER_EXCEPTION_NUMBERFORMAT); + request.getSession().removeAttribute(USER_EXCEPTION_DEFAULTCONTENT_NOTSETUP); + request.getSession().removeAttribute(USER_EXCEPTION_DEFAULTQUESTIONCONTENT_NOT_AVAILABLE); + request.getSession().removeAttribute(USER_EXCEPTION_DEFAULTOPTIONSCONTENT_NOT_AVAILABLE); - String correctFeedback=(String)mapFeedbackCorrect.get(new Integer(displayOrder).toString()); - logger.debug("new correctFeedback will be :" + correctFeedback); - - if ((correctFeedback == null) || (correctFeedback.equals(""))) - correctFeedback=DEFAULT_FEEDBACK_CORRECT; - - McQueContent mcQueContent= new McQueContent(question, - new Integer(displayOrder), - new Integer(weight), - incorrectFeedback, - correctFeedback, - mcContent, - new HashSet(), - new HashSet() - ); - - mcService.saveOrUpdateMcQueContent(mcQueContent); - logger.debug("created a new mcQueContent in the db: " + mcQueContent); - } - else - { - logger.debug("we don't create this question's content since it doesn't have options associated with it."); - } + /* Preview mode constants*/ + request.getSession().removeAttribute(MAP_QUESTION_CONTENT_LEARNER); + request.getSession().removeAttribute(TOTAL_QUESTION_COUNT); + request.getSession().removeAttribute(CURRENT_QUESTION_INDEX); + request.getSession().removeAttribute(MAP_GENERAL_OPTIONS_CONTENT); + request.getSession().removeAttribute(MAP_OPTIONS_CONTENT); + request.getSession().removeAttribute(QUESTION_LISTING_MODE_COMBINED); + request.getSession().removeAttribute(PREVIEW_ONLY); } + + /** + * List swapNodes(List listQuestionContentDTO, String questionIndex, String direction) + * + * swappes McQuestionContentDTO nodes in the list + * + * @param listQuestionContentDTO + * @param questionIndex + * @param direction + * @return + */ + protected static List swapNodes(List listQuestionContentDTO, String questionIndex, String direction) + { + logger.debug("swapNodes:"); + logger.debug("listQuestionContentDTO:" + listQuestionContentDTO); + logger.debug("questionIndex:" + questionIndex); + logger.debug("direction:" + direction); + int intQuestionIndex=new Integer(questionIndex).intValue(); + int intOriginalQuestionIndex=intQuestionIndex; + logger.debug("intQuestionIndex:" + intQuestionIndex); + + int replacedNodeIndex=0; + if (direction.equals("down")) + { + logger.debug("direction down:"); + replacedNodeIndex=++intQuestionIndex; + } + else + { + logger.debug("direction up:"); + replacedNodeIndex=--intQuestionIndex; + + } + logger.debug("replacedNodeIndex:" + replacedNodeIndex); + logger.debug("replacing nodes:" + intOriginalQuestionIndex + " and " + replacedNodeIndex); + + McQuestionContentDTO mainNode=extractNodeAtDisplayOrder(listQuestionContentDTO, intOriginalQuestionIndex); + logger.debug("mainNode:" + mainNode); + + + McQuestionContentDTO replacedNode=extractNodeAtDisplayOrder(listQuestionContentDTO, replacedNodeIndex); + logger.debug("replacedNode:" + replacedNode); + + List listFinalQuestionContentDTO=new LinkedList(); + + listFinalQuestionContentDTO=reorderSwappedListQuestionContentDTO(listQuestionContentDTO, intOriginalQuestionIndex, + replacedNodeIndex, mainNode, replacedNode); + + + logger.debug("listFinalQuestionContentDTO:" + listFinalQuestionContentDTO); + return listFinalQuestionContentDTO; + } + + + /** - * getNewDisplayOrder(Map mapQuestionsContent, String question) + * List reorderSwappedListQuestionContentDTO(List listQuestionContentDTO, int intOriginalQuestionIndex, + int replacedNodeIndex, McQuestionContentDTO mainNode, McQuestionContentDTO replacedNode) + + * @param listQuestionContentDTO + * @param intOriginalQuestionIndex + * @param replacedNodeIndex + * @param mainNode + * @param replacedNode + * @return + */ + protected static List reorderSwappedListQuestionContentDTO(List listQuestionContentDTO, int intOriginalQuestionIndex, + int replacedNodeIndex, McQuestionContentDTO mainNode, McQuestionContentDTO replacedNode) + { + logger.debug("reorderSwappedListQuestionContentDTO: intOriginalQuestionIndex:" + intOriginalQuestionIndex); + logger.debug("reorderSwappedListQuestionContentDTO: replacedNodeIndex:" + replacedNodeIndex); + logger.debug("mainNode: " + mainNode); + logger.debug("replacedNode: " + replacedNode); + + + List listFinalQuestionContentDTO=new LinkedList(); + + int queIndex=0; + Iterator listIterator=listQuestionContentDTO.iterator(); + while (listIterator.hasNext()) + { + McQuestionContentDTO mcQuestionContentDTO= (McQuestionContentDTO)listIterator.next(); + logger.debug("mcQuestionContentDTO:" + mcQuestionContentDTO); + logger.debug("mcQuestionContentDTO question:" + mcQuestionContentDTO.getQuestion()); + queIndex++; + McQuestionContentDTO tempNode=new McQuestionContentDTO(); + + if ((!mcQuestionContentDTO.getDisplayOrder().equals(new Integer(intOriginalQuestionIndex).toString())) && + !mcQuestionContentDTO.getDisplayOrder().equals(new Integer(replacedNodeIndex).toString())) + { + logger.debug("normal copy "); + tempNode.setQuestion(mcQuestionContentDTO.getQuestion()); + tempNode.setDisplayOrder(mcQuestionContentDTO.getDisplayOrder()); + tempNode.setFeedback(mcQuestionContentDTO.getFeedback()); + tempNode.setListCandidateAnswersDTO(mcQuestionContentDTO.getListCandidateAnswersDTO()); + tempNode.setCaCount(mcQuestionContentDTO.getCaCount()); + tempNode.setMark(mcQuestionContentDTO.getMark()); + + } + else if (mcQuestionContentDTO.getDisplayOrder().equals(new Integer(intOriginalQuestionIndex).toString())) + { + logger.debug("move type 1 "); + tempNode.setQuestion(replacedNode.getQuestion()); + tempNode.setDisplayOrder(replacedNode.getDisplayOrder()); + tempNode.setFeedback(replacedNode.getFeedback()); + tempNode.setListCandidateAnswersDTO(replacedNode.getListCandidateAnswersDTO()); + tempNode.setCaCount(replacedNode.getCaCount()); + tempNode.setMark(replacedNode.getMark()); + } + else if (mcQuestionContentDTO.getDisplayOrder().equals(new Integer(replacedNodeIndex).toString())) + { + logger.debug("move type 2 "); + tempNode.setQuestion(mainNode.getQuestion()); + tempNode.setDisplayOrder(mainNode.getDisplayOrder()); + tempNode.setFeedback(mainNode.getFeedback()); + tempNode.setListCandidateAnswersDTO(mainNode.getListCandidateAnswersDTO()); + tempNode.setCaCount(mainNode.getCaCount()); + tempNode.setMark(mainNode.getMark()); + } + + listFinalQuestionContentDTO.add(tempNode); + } + + + + logger.debug("final listFinalQuestionContentDTO:" + listFinalQuestionContentDTO); + return listFinalQuestionContentDTO; + } + + + /** + * List swapCandidateNodes(List listCandidates, String candidateIndex, String direction) * - * @param mapQuestionsContent - * @param question - * @return int + * swaps McCandidateAnswersDTO in the list + * + * + * @param listCandidates + * @param candidateIndex + * @param direction + * @return */ - public static int getNewDisplayOrder(Map mapQuestionsContent, String question) + protected static List swapCandidateNodes(List listCandidates, String candidateIndex, String direction) { - Iterator itQuestionsMap = mapQuestionsContent.entrySet().iterator(); - int displayOrder=0; - while (itQuestionsMap.hasNext()) + logger.debug("swapCandidateNodes:"); + logger.debug("listCandidates:" + listCandidates); + logger.debug("candidateIndex:" + candidateIndex); + logger.debug("direction:" + direction); + + int intCandidateIndex=new Integer(candidateIndex).intValue(); + int intOriginalCandidateIndex=intCandidateIndex; + logger.debug("intCandidateIndex:" + intCandidateIndex); + + int replacedNodeIndex=0; + if (direction.equals("down")) { - Map.Entry pairs = (Map.Entry)itQuestionsMap.next(); - logger.debug("using the pair: " + pairs.getKey() + " = " + pairs.getValue()); - if (pairs.getValue().equals(question)) + logger.debug("direction down:"); + replacedNodeIndex=++intCandidateIndex; + } + else + { + logger.debug("direction up:"); + replacedNodeIndex=--intCandidateIndex; + + } + logger.debug("replacedNodeIndex:" + replacedNodeIndex); + logger.debug("replacing nodes:" + intOriginalCandidateIndex + " and " + replacedNodeIndex); + + McCandidateAnswersDTO mainNode=extractCandidateAtOrder(listCandidates, intOriginalCandidateIndex); + logger.debug("mainNode:" + mainNode); + + + McCandidateAnswersDTO replacedNode=extractCandidateAtOrder(listCandidates, replacedNodeIndex); + logger.debug("replacedNode:" + replacedNode); + + List listFinalCandidateDTO=new LinkedList(); + + listFinalCandidateDTO=reorderSwappedListCandidateDTO(listCandidates, intOriginalCandidateIndex, + replacedNodeIndex, mainNode, replacedNode); + + + logger.debug("listFinalCandidateDTO:" + listFinalCandidateDTO); + return listFinalCandidateDTO; + } + + + /** + * reorderSwappedListCandidateDTO(List listCandidates, int intOriginalCandidateIndex, + int replacedNodeIndex, McCandidateAnswersDTO mainNode, McCandidateAnswersDTO replacedNode) + + + * @param listCandidates + * @param intOriginalCandidateIndex + * @param replacedNodeIndex + * @param mainNode + * @param replacedNode + * @return + */ + protected static List reorderSwappedListCandidateDTO(List listCandidates, int intOriginalCandidateIndex, + int replacedNodeIndex, McCandidateAnswersDTO mainNode, McCandidateAnswersDTO replacedNode) + { + logger.debug("reorderSwappedListCandidateDTO: intOriginalQuestionIndex:" + intOriginalCandidateIndex); + logger.debug("reorderSwappedListCandidateDTO: replacedNodeIndex:" + replacedNodeIndex); + logger.debug("mainNode: " + mainNode); + logger.debug("replacedNode: " + replacedNode); + + + List listFinalCandidatesDTO=new LinkedList(); + + int queIndex=0; + Iterator listIterator=listCandidates.iterator(); + while (listIterator.hasNext()) + { + McCandidateAnswersDTO mcCandidateAnswersDTO= (McCandidateAnswersDTO)listIterator.next(); + logger.debug("mcCandidateAnswersDTO:" + mcCandidateAnswersDTO); + logger.debug("mcCandidateAnswersDTO candidateAnswer:" + mcCandidateAnswersDTO.getCandidateAnswer()); + queIndex++; + + McCandidateAnswersDTO tempNode=new McCandidateAnswersDTO(); + + + if ((!new Integer(queIndex).toString().equals(new Integer(intOriginalCandidateIndex).toString())) && + !new Integer(queIndex).toString().equals(new Integer(replacedNodeIndex).toString())) { - logger.debug("question found:" + question); - displayOrder=new Integer(pairs.getKey().toString()).intValue(); - logger.debug("displayOrder:" + displayOrder); + logger.debug("normal copy "); + tempNode.setCandidateAnswer(mcCandidateAnswersDTO.getCandidateAnswer()); + tempNode.setCorrect(mcCandidateAnswersDTO.getCorrect()); } - } - return displayOrder; + else if (new Integer(queIndex).toString().equals(new Integer(intOriginalCandidateIndex).toString())) + { + logger.debug("move type 1 "); + tempNode.setCandidateAnswer(replacedNode.getCandidateAnswer()); + tempNode.setCorrect(replacedNode.getCorrect()); + } + else if (new Integer(queIndex).toString().equals(new Integer(replacedNodeIndex).toString())) + { + logger.debug("move type 2 "); + tempNode.setCandidateAnswer(mainNode.getCandidateAnswer()); + tempNode.setCorrect(mainNode.getCorrect()); + } + + listFinalCandidatesDTO.add(tempNode); + } + + logger.debug("final listFinalCandidatesDTO:" + listFinalCandidatesDTO); + return listFinalCandidatesDTO; } /** - * finds out whether a question has options (candidate answers) or not. + * McQuestionContentDTO extractNodeAtDisplayOrder(List listQuestionContentDTO, int intOriginalQuestionIndex) * - * isQuestionWithOptions(Map mapGeneralOptionsContent, int displayOrder) + * returns McQuestionContentDTO in the specified order of the list * - * @param mapGeneralOptionsContent - * @param displayOrder + * @param listQuestionContentDTO + * @param intOriginalQuestionIndex * @return */ - public static boolean isQuestionWithOptions(Map mapGeneralOptionsContent, int displayOrder) + protected static McQuestionContentDTO extractNodeAtDisplayOrder(List listQuestionContentDTO, int intOriginalQuestionIndex) { - logger.debug("mapGeneralOptionsContent:" + mapGeneralOptionsContent); - - Iterator itQuestionsMap = mapGeneralOptionsContent.entrySet().iterator(); - while (itQuestionsMap.hasNext()) + logger.debug("listQuestionContentDTO:" + listQuestionContentDTO); + logger.debug("intOriginalQuestionIndex:" + intOriginalQuestionIndex); + + Iterator listIterator=listQuestionContentDTO.iterator(); + while (listIterator.hasNext()) { - Map.Entry pairs = (Map.Entry)itQuestionsMap.next(); - logger.debug("using the pair: " + pairs.getKey() + " = " + pairs.getValue()); - logger.debug("current questionIndex: " + new Integer(pairs.getKey().toString()).intValue()); - int questionIndex=new Integer(pairs.getKey().toString()).intValue(); - if (questionIndex == displayOrder) + McQuestionContentDTO mcQuestionContentDTO=(McQuestionContentDTO)listIterator.next(); + logger.debug("mcQuestionContentDTO:" + mcQuestionContentDTO); + logger.debug("mcQuestionContentDTO question:" + mcQuestionContentDTO.getQuestion()); + + logger.debug("intOriginalQuestionIndex versus displayOrder:" + new Integer(intOriginalQuestionIndex).toString() + " versus " + + mcQuestionContentDTO.getDisplayOrder()); + if (new Integer(intOriginalQuestionIndex).toString().equals(mcQuestionContentDTO.getDisplayOrder())) { - logger.debug("questionIndex found:" + questionIndex); - return true; + logger.debug("node found:" + mcQuestionContentDTO); + return mcQuestionContentDTO; } } - return false; + return null; } + + - /** - * includes the new question entry in the questions Map - * addQuestionMemory(HttpServletRequest request, McAuthoringForm mcAuthoringForm, Map mapQuestionsContent, boolean increaseMapSize) + * McCandidateAnswersDTO extractCandidateAtOrder(List listCandidates, int intOriginalCandidateIndex) * - * @param request - * @param mcAuthoringForm - * @param mapQuestionsContent - * @param increaseMapSize + * @param listCandidates + * @param intOriginalCandidateIndex + * @return */ - public static void addQuestionMemory(HttpServletRequest request, McAuthoringForm mcAuthoringForm, Map mapQuestionsContent, boolean increaseMapSize) + protected static McCandidateAnswersDTO extractCandidateAtOrder(List listCandidates, int intOriginalCandidateIndex) { - if (increaseMapSize) - { - int mapSize=mapQuestionsContent.size(); - mapQuestionsContent.put(new Long(++mapSize).toString(), ""); - logger.debug("updated Questions Map size: " + mapQuestionsContent.size()); - request.getSession().setAttribute(MAP_QUESTIONS_CONTENT, mapQuestionsContent); - logger.debug("updated Questions Map: " + request.getSession().getAttribute(MAP_QUESTIONS_CONTENT)); - - Map mapWeights = (Map) request.getSession().getAttribute(MAP_WEIGHTS); - logger.debug("current mapWeights: " + mapWeights); - int mapWeightsSize=mapWeights.size(); - mapWeights.put(new Long(++mapWeightsSize).toString(), ""); - logger.debug("updated mapWeights size: " + mapWeights.size()); - request.getSession().setAttribute(MAP_WEIGHTS, mapWeights); - logger.debug("updated mapWeights: " + request.getSession().getAttribute(MAP_WEIGHTS)); - } + logger.debug("listCandidates:" + listCandidates); + logger.debug("intOriginalCandidateIndex:" + intOriginalCandidateIndex); + + int counter=0; + Iterator listIterator=listCandidates.iterator(); + while (listIterator.hasNext()) + { + ++counter; + McCandidateAnswersDTO mcCandidateAnswerDTO=(McCandidateAnswersDTO)listIterator.next(); + logger.debug("mcCandidateAnswerDTO:" + mcCandidateAnswerDTO); + + logger.debug("counter:" + counter); + + if (new Integer(intOriginalCandidateIndex).toString().equals(new Integer(counter).toString())) + { + logger.debug("node found:" + mcCandidateAnswerDTO); + return mcCandidateAnswerDTO; + } + } + return null; } - + + /** - * getNextAvailableDisplayOrder(HttpServletRequest request, Long mcContentId) + * extractMapQuestionContent(List listQuestionContentDTO) * - * @param request - * @param mcContentId - * @return int + * @param listQuestionContentDTO + * @return */ - public static int getNextAvailableDisplayOrder(HttpServletRequest request, Long mcContentId) + protected static Map extractMapQuestionContent(List listQuestionContentDTO) { - IMcService mcService =McUtils.getToolService(request); - List listDisplayOrder=mcService.getNextAvailableDisplayOrder(mcContentId.longValue()); - - Iterator itListDisplayOrder = listDisplayOrder.iterator(); - int maxDisplayOrder=1; - while (itListDisplayOrder.hasNext()) + logger.debug("listQuestionContentDTO:" + listQuestionContentDTO); + Map mapQuestionContent= new TreeMap(new McComparator()); + + Iterator listIterator=listQuestionContentDTO.iterator(); + int queIndex=0; + while (listIterator.hasNext()) { - McQueContent mcQueContent=(McQueContent)itListDisplayOrder.next(); - logger.debug("mcQueContent:" + mcQueContent); - int currentDisplayOrder=mcQueContent.getDisplayOrder().intValue(); - if (currentDisplayOrder > maxDisplayOrder) - maxDisplayOrder = currentDisplayOrder; + McQuestionContentDTO mcQuestionContentDTO=(McQuestionContentDTO)listIterator.next(); + logger.debug("mcQuestionContentDTO:" + mcQuestionContentDTO); + logger.debug("mcQuestionContentDTO question:" + mcQuestionContentDTO.getQuestion()); + + queIndex++; + logger.debug("queIndex:" + queIndex); + mapQuestionContent.put(new Integer(queIndex).toString(), mcQuestionContentDTO.getQuestion()); } - logger.debug("current biggest displayOrder is: " + maxDisplayOrder); - return maxDisplayOrder+1; - + logger.debug("mapQuestionContent:" + mapQuestionContent); + return mapQuestionContent; } - + /** - * refreshMaps(HttpServletRequest request, long toolContentId) + * List reorderListCandidatesDTO(List candidates) * - * @param request - * @param toolContentId + * @param candidates + * @return */ - public static void refreshMaps(HttpServletRequest request, long toolContentId, IMcService mcService) + protected static List reorderListCandidatesDTO(List candidates) { - logger.debug("refreshing maps.."); - Map mapQuestionsUidContent=AuthoringUtil.rebuildQuestionUidMapfromDB(request, new Long(toolContentId), mcService); - logger.debug("mapQuestionsUidContent:" + mapQuestionsUidContent); + logger.debug("reorderListCandidatesDTO"); + logger.debug("reorderListCandidatesDTO:" + candidates); - logger.debug("mapQuestionsUidContent size:" + mapQuestionsUidContent.size()); - if (mapQuestionsUidContent.size() > 0) - { - Map mapStartupGeneralOptionsContent=AuthoringUtil.rebuildStartupGeneralOptionsContentMapfromDB(request, mapQuestionsUidContent, mcService); - logger.debug("mapStartupGeneralOptionsContent:" + mapStartupGeneralOptionsContent); - request.getSession().setAttribute(MAP_STARTUP_GENERAL_OPTIONS_CONTENT, mapStartupGeneralOptionsContent); - - Map mapStartupGeneralSelectedOptionsContent=AuthoringUtil.rebuildStartupGeneralSelectedOptionsContentMapfromDB(request, mapQuestionsUidContent); - logger.debug("mapStartupGeneralSelectedOptionsContent:" + mapStartupGeneralSelectedOptionsContent); - request.getSession().setAttribute(MAP_STARTUP_GENERAL_SELECTED_OPTIONS_CONTENT, mapStartupGeneralSelectedOptionsContent); - - Map mapStartupGeneralOptionsQueId=AuthoringUtil.rebuildStartupGeneralOptionsQueIdfromDB(request, mapQuestionsUidContent); - logger.debug("mapStartupGeneralOptionsQueId:" + mapStartupGeneralOptionsQueId); - request.getSession().setAttribute(MAP_STARTUP_GENERAL_OPTIONS_QUEID, mapStartupGeneralOptionsQueId); - } + List listFinalCandidatesDTO=new LinkedList(); + + int queIndex=0; + Iterator listIterator=candidates.iterator(); + while (listIterator.hasNext()) + { + McCandidateAnswersDTO mcCandidateAnswersDTO= (McCandidateAnswersDTO)listIterator.next(); + logger.debug("mcCandidateAnswersDTO:" + mcCandidateAnswersDTO); + logger.debug("mcCandidateAnswersDTO answer:" + mcCandidateAnswersDTO.getCandidateAnswer()); + + String answer=mcCandidateAnswersDTO.getCandidateAnswer(); + logger.debug("answer:" + answer); + + String correct=mcCandidateAnswersDTO.getCorrect(); + logger.debug("correct:" + correct); + + + if ((answer != null) && (!answer.equals(""))) + { + mcCandidateAnswersDTO.setCandidateAnswer(answer); + mcCandidateAnswersDTO.setCorrect(correct); + + listFinalCandidatesDTO.add(mcCandidateAnswersDTO); + + } + } + + + logger.debug("final listFinalCandidatesDTO:" + listFinalCandidatesDTO); + return listFinalCandidatesDTO; } + - /** - * assignStaterMapsToCurrentMaps(HttpServletRequest request) - * @param request + * reorderListQuestionContentDTO(List listQuestionContentDTO, String excludeQuestionIndex) + * + * @param listQuestionContentDTO + * @param excludeQuestionIndex + * @return */ - public static void assignStaterMapsToCurrentMaps(HttpServletRequest request) + protected static List reorderListQuestionContentDTO(List listQuestionContentDTO, String excludeQuestionIndex) { - logger.debug("assigning maps.."); - Map mapStartupGeneralOptionsContent=(Map)request.getSession().getAttribute(MAP_STARTUP_GENERAL_OPTIONS_CONTENT); - logger.debug("mapStartupGeneralOptionsContent: " + mapStartupGeneralOptionsContent); + logger.debug("reorderListQuestionContentDTO"); + logger.debug("listQuestionContentDTO:" + listQuestionContentDTO); + logger.debug("excludeQuestionIndex:" + excludeQuestionIndex); - Map mapStartupGeneralSelectedOptionsContent=(Map) request.getSession().getAttribute(MAP_STARTUP_GENERAL_SELECTED_OPTIONS_CONTENT); - logger.debug("mapStartupGeneralSelectedOptionsContent: " + mapStartupGeneralSelectedOptionsContent); + List listFinalQuestionContentDTO=new LinkedList(); - request.getSession().setAttribute(MAP_GENERAL_OPTIONS_CONTENT, mapStartupGeneralOptionsContent); - request.getSession().setAttribute(MAP_GENERAL_SELECTED_OPTIONS_CONTENT, mapStartupGeneralSelectedOptionsContent); + int queIndex=0; + Iterator listIterator=listQuestionContentDTO.iterator(); + while (listIterator.hasNext()) + { + McQuestionContentDTO mcQuestionContentDTO= (McQuestionContentDTO)listIterator.next(); + logger.debug("mcQuestionContentDTO:" + mcQuestionContentDTO); + logger.debug("mcQuestionContentDTO question:" + mcQuestionContentDTO.getQuestion()); + + String question=mcQuestionContentDTO.getQuestion(); + logger.debug("question:" + question); + + String displayOrder=mcQuestionContentDTO.getDisplayOrder(); + logger.debug("displayOrder:" + displayOrder); + + String feedback=mcQuestionContentDTO.getFeedback(); + logger.debug("feedback:" + feedback); + + String caCount= mcQuestionContentDTO.getCaCount(); + logger.debug("caCount:" + caCount); + + List caList=mcQuestionContentDTO.getListCandidateAnswersDTO(); + logger.debug("caList:" + caList); + + + logger.debug("displayOrder versus excludeQuestionIndex :" + displayOrder + " versus " + excludeQuestionIndex); + + if ((question != null) && (!question.equals(""))) + { + if (!displayOrder.equals(excludeQuestionIndex)) + { + ++queIndex; + logger.debug("using queIndex:" + queIndex); + + mcQuestionContentDTO.setQuestion(question); + mcQuestionContentDTO.setDisplayOrder(new Integer(queIndex).toString()); + mcQuestionContentDTO.setFeedback(feedback); + mcQuestionContentDTO.setListCandidateAnswersDTO(caList); + //mcQuestionContentDTO.setCaCount(caList); + + logger.debug("caList size:" + mcQuestionContentDTO.getListCandidateAnswersDTO().size()); + mcQuestionContentDTO.setCaCount(new Integer(mcQuestionContentDTO.getListCandidateAnswersDTO().size()).toString()); + + listFinalQuestionContentDTO.add(mcQuestionContentDTO); + } + } + } + + + logger.debug("final listFinalQuestionContentDTO:" + listFinalQuestionContentDTO); + return listFinalQuestionContentDTO; } + - /** - * - * uploadFile(HttpServletRequest request, McAuthoringForm mcAuthoringForm, boolean isOfflineFile) throws RepositoryCheckedException - * - * @param request - * @param mcAuthoringForm - * @param isOfflineFile - * @return McAttachmentDTO - * @throws RepositoryCheckedException + * List reorderSimpleListQuestionContentDTO(List listQuestionContentDTO) + * + * @param listQuestionContentDTO + * @return */ - public static McAttachmentDTO uploadFile(HttpServletRequest request, McAuthoringForm mcAuthoringForm, boolean isOfflineFile) throws RepositoryCheckedException - { - logger.debug("doing uploadFile..."); - logger.debug("isOfflineFile:" + isOfflineFile); + protected static List reorderSimpleListQuestionContentDTO(List listQuestionContentDTO) + { + logger.debug("reorderListQuestionContentDTO"); + logger.debug("listQuestionContentDTO:" + listQuestionContentDTO); + List listFinalQuestionContentDTO=new LinkedList(); - InputStream stream=null; - String fileName=null; - String mimeType=null; - String fileProperty=null; - - if (isOfflineFile) - { - FormFile theOfflineFile = mcAuthoringForm.getTheOfflineFile(); - logger.debug("retrieved theOfflineFile: " + theOfflineFile); - - try + int queIndex=0; + Iterator listIterator=listQuestionContentDTO.iterator(); + while (listIterator.hasNext()) + { + McQuestionContentDTO mcQuestionContentDTO= (McQuestionContentDTO)listIterator.next(); + logger.debug("mcQuestionContentDTO:" + mcQuestionContentDTO); + logger.debug("mcQuestionContentDTO question:" + mcQuestionContentDTO.getQuestion()); + + String question=mcQuestionContentDTO.getQuestion(); + logger.debug("question:" + question); + + String displayOrder=mcQuestionContentDTO.getDisplayOrder(); + logger.debug("displayOrder:" + displayOrder); + + String feedback=mcQuestionContentDTO.getFeedback(); + logger.debug("feedback:" + feedback); + + List caList=mcQuestionContentDTO.getListCandidateAnswersDTO(); + logger.debug("caList:" + caList); + + String caCount=mcQuestionContentDTO.getCaCount(); + logger.debug("caCount:" + caCount); + + String mark=mcQuestionContentDTO.getMark(); + logger.debug("mark:" + mark); + + + if ((question != null) && (!question.equals(""))) { - stream = theOfflineFile.getInputStream(); - fileName=theOfflineFile.getFileName(); - if (fileName.length() == 0) - { - return null; - } - logger.debug("retrieved fileName: " + fileName); - fileProperty="OFFLINE"; - - } - catch(FileNotFoundException e) - { - logger.debug("filenotfound exception occured in accessing the repository server for the offline file : " + e.getMessage()); + ++queIndex; + logger.debug("using queIndex:" + queIndex); + + mcQuestionContentDTO.setQuestion(question); + mcQuestionContentDTO.setDisplayOrder(new Integer(queIndex).toString()); + mcQuestionContentDTO.setFeedback(feedback); + mcQuestionContentDTO.setListCandidateAnswersDTO(caList); + mcQuestionContentDTO.setCaCount(caCount); + mcQuestionContentDTO.setMark(mark); + listFinalQuestionContentDTO.add(mcQuestionContentDTO); } - catch(IOException e) - { - logger.debug("io exception occured in accessing the repository server for the offline file : " + e.getMessage()); - } - - if (fileName.length() > 0) - { - List listUploadedOfflineFileNames=(List)request.getSession().getAttribute(LIST_UPLOADED_OFFLINE_FILENAMES); - logger.debug("listUploadedOfflineFileNames:" + listUploadedOfflineFileNames); - int index=findFileNameIndex(listUploadedOfflineFileNames, fileName); - logger.debug("index:" + index); - if (index == 0) - { - listUploadedOfflineFileNames.add(fileName); - logger.debug("listUploadedOfflineFileNames after add :" + listUploadedOfflineFileNames); - request.getSession().setAttribute(LIST_UPLOADED_OFFLINE_FILENAMES,listUploadedOfflineFileNames); - } - } - - } - else - { - FormFile theOnlineFile = mcAuthoringForm.getTheOnlineFile(); - logger.debug("retrieved theOnlineFile: " + theOnlineFile); - - try - { - stream = theOnlineFile.getInputStream(); - fileName=theOnlineFile.getFileName(); - - if (fileName.length() == 0) - { - return null; - } - - logger.debug("retrieved fileName: " + fileName); - fileProperty="ONLINE"; - - } - catch(FileNotFoundException e) - { - logger.debug("filenotfound exception occured in accessing the repository server for the online file : " + e.getMessage()); - } - catch(IOException e) - { - logger.debug("io exception occured in accessing the repository server for the online file : " + e.getMessage()); - } + } + + + logger.debug("final listFinalQuestionContentDTO:" + listFinalQuestionContentDTO); + return listFinalQuestionContentDTO; + } - if (fileName.length() > 0) - { - List listUploadedOnlineFileNames=(List)request.getSession().getAttribute(LIST_UPLOADED_ONLINE_FILENAMES); - logger.debug("listUploadedOnlineFileNames:" + listUploadedOnlineFileNames); - int index=findFileNameIndex(listUploadedOnlineFileNames, fileName); - logger.debug("index:" + index); - if (index == 0) - { - listUploadedOnlineFileNames.add(fileName); - logger.debug("listUploadedOnlineFileNames after add :" + listUploadedOnlineFileNames); - request.getSession().setAttribute(LIST_UPLOADED_ONLINE_FILENAMES,listUploadedOnlineFileNames); - } - } - } - - IMcService mcService =McUtils.getToolService(request); - logger.debug("calling uploadFile with:"); - logger.debug("istream:" + stream); - logger.debug("filename:" + fileName); - logger.debug("mimeType:" + mimeType); - logger.debug("fileProperty:" + fileProperty); - - NodeKey nodeKey=null; - try{ - nodeKey=mcService.uploadFile(stream, fileName, mimeType, fileProperty); - logger.debug("nodeKey:" + nodeKey); - logger.debug("nodeKey uuid:" + nodeKey.getUuid()); - } - catch(FileException e) - { - logger.debug("exception writing raw data:" + e); - /* return a null dto*/ - return null; - } - - McAttachmentDTO mcAttachmentDTO= new McAttachmentDTO(); - mcAttachmentDTO.setUid(null); - mcAttachmentDTO.setUuid(nodeKey.getUuid().toString()); - mcAttachmentDTO.setFilename(fileName); - mcAttachmentDTO.setOfflineFile(isOfflineFile); - - return mcAttachmentDTO; - } - /** - * populateMetaDataAsAttachments(List listOfflineFilesMetaData) - * - * @param listOfflineFilesMetaData - * @return List + * reorderUpdateListQuestionContentDTO(List listQuestionContentDTO, + McQuestionContentDTO mcQuestionContentDTONew, + String editableQuestionIndex) + + * @param listQuestionContentDTO + * @param mcQuestionContentDTONew + * @param editableQuestionIndex + * @return */ - public static List populateMetaDataAsAttachments(List listOfflineFilesMetaData) + protected static List reorderUpdateListQuestionContentDTO(List listQuestionContentDTO, + McQuestionContentDTO mcQuestionContentDTONew, + String editableQuestionIndex) { - List listAttachments=new LinkedList(); + logger.debug("reorderUpdateListQuestionContentDTO"); + logger.debug("listQuestionContentDTO:" + listQuestionContentDTO); + logger.debug("mcQuestionContentDTONew:" + mcQuestionContentDTONew); + logger.debug("editableQuestionIndex:" + editableQuestionIndex); - Iterator itList = listOfflineFilesMetaData.iterator(); - while (itList.hasNext()) + + List listFinalQuestionContentDTO=new LinkedList(); + + int queIndex=0; + Iterator listIterator=listQuestionContentDTO.iterator(); + while (listIterator.hasNext()) + { + McQuestionContentDTO mcQuestionContentDTO= (McQuestionContentDTO)listIterator.next(); + logger.debug("mcQuestionContentDTO:" + mcQuestionContentDTO); + logger.debug("mcQuestionContentDTO question:" + mcQuestionContentDTO.getQuestion()); + + ++queIndex; + logger.debug("using queIndex:" + queIndex); + String question=mcQuestionContentDTO.getQuestion(); + logger.debug("question:" + question); + + String displayOrder=mcQuestionContentDTO.getDisplayOrder(); + logger.debug("displayOrder:" + displayOrder); + + String feedback=mcQuestionContentDTO.getFeedback(); + logger.debug("feedback:" + feedback); + + String mark=mcQuestionContentDTO.getMark(); + logger.debug("mark:" + mark); + + List caList=mcQuestionContentDTO.getListCandidateAnswersDTO(); + logger.debug("caList:" + caList); + + String caCount=mcQuestionContentDTO.getCaCount(); + logger.debug("caCount:" + caCount); + + + if (displayOrder.equals(editableQuestionIndex)) + { + logger.debug("displayOrder equals editableQuestionIndex:" + editableQuestionIndex); + mcQuestionContentDTO.setQuestion(mcQuestionContentDTONew.getQuestion()); + mcQuestionContentDTO.setDisplayOrder(mcQuestionContentDTONew.getDisplayOrder()); + mcQuestionContentDTO.setFeedback(mcQuestionContentDTONew.getFeedback()); + mcQuestionContentDTO.setMark(mcQuestionContentDTONew.getMark()); + mcQuestionContentDTO.setCaCount(mcQuestionContentDTONew.getCaCount()); + mcQuestionContentDTO.setListCandidateAnswersDTO(mcQuestionContentDTONew.getListCandidateAnswersDTO()); + + listFinalQuestionContentDTO.add(mcQuestionContentDTO); + } + else + { + logger.debug("displayOrder does not equal editableQuestionIndex:" + editableQuestionIndex); + mcQuestionContentDTO.setQuestion(question); + mcQuestionContentDTO.setDisplayOrder(displayOrder); + mcQuestionContentDTO.setFeedback(feedback); + mcQuestionContentDTO.setMark(mark); + mcQuestionContentDTO.setCaCount(caCount); + mcQuestionContentDTO.setListCandidateAnswersDTO(caList); + listFinalQuestionContentDTO.add(mcQuestionContentDTO); + + } + + } + + logger.debug("listFinalQuestionContentDTO:" + listFinalQuestionContentDTO); + return listFinalQuestionContentDTO; + } + + + + /** + * sorts the questions by the display order + * + * reOrganizeDisplayOrder(Map mapQuestionContent, IMcService mcService, McAuthoringForm mcAuthoringForm, McContent mcContent) + * + * @param mapQuestionContent + * @param mcService + * @param mcAuthoringForm + * @param mcContent + */ + public void reOrganizeDisplayOrder(Map mapQuestionContent, IMcService mcService, McAuthoringForm mcAuthoringForm, McContent mcContent) + { + logger.debug("mcContent: " + mcContent); + if (mcContent != null) { - McUploadedFile mcUploadedFile=(McUploadedFile)itList.next(); - logger.debug("mcUploadedFile:" + mcUploadedFile); - logger.debug("mcUploadedFile details, uid" + mcUploadedFile.getUid().toString()); - logger.debug("mcUploadedFile details, uuid" + mcUploadedFile.getUuid()); - logger.debug("mcUploadedFile details, filename" + mcUploadedFile.getFilename()); - logger.debug("mcUploadedFile details, isOfflineFile" + !mcUploadedFile.isFileOnline()); + logger.debug("content uid: " + mcContent.getUid()); + List sortedQuestions=mcService.getAllQuestionEntriesSorted(mcContent.getUid().longValue()); + logger.debug("sortedQuestions: " + sortedQuestions); - McAttachmentDTO mcAttachmentDTO= new McAttachmentDTO(); - mcAttachmentDTO.setUid(mcUploadedFile.getUid().toString()); - mcAttachmentDTO.setUuid(mcUploadedFile.getUuid()); - mcAttachmentDTO.setFilename(mcUploadedFile.getFilename()); - mcAttachmentDTO.setOfflineFile(!mcUploadedFile.isFileOnline()); - - listAttachments.add(mcAttachmentDTO); - logger.debug("listAttachments after add" + listAttachments); + Iterator listIterator=sortedQuestions.iterator(); + int displayOrder=1; + while (listIterator.hasNext()) + { + McQueContent queContent=(McQueContent)listIterator.next(); + logger.debug("queContent data: " + queContent); + logger.debug("queContent: " + queContent.getQuestion() + " " + queContent.getDisplayOrder()); + + McQueContent existingMcQueContent=mcService.getQuestionContentByQuestionText(queContent.getQuestion(), mcContent.getUid()); + logger.debug("existingMcQueContent: " + existingMcQueContent); + existingMcQueContent.setDisplayOrder(new Integer(displayOrder)); + logger.debug("updating the existing question content for displayOrder: " + existingMcQueContent); + mcService.updateMcQueContent(existingMcQueContent); + displayOrder++; + } } - logger.debug("final listAttachments after populating all: " + listAttachments); - return listAttachments; + logger.debug("done with reOrganizeDisplayOrder..."); } + /** - * populateMetaDataAsFilenames(List listFilesMetaData) + * boolean checkDuplicateQuestions(List listQuestionContentDTO, String newQuestion) * - * @param listFilesMetaData - * @return List + * verifies that there are no duplicate questions + * + * @param listQuestionContentDTO + * @param newQuestion + * @return */ - public static List populateMetaDataAsFilenames(List listFilesMetaData) + public static boolean checkDuplicateQuestions(List listQuestionContentDTO, String newQuestion) { - List listFilenames=new LinkedList(); - - Iterator itList = listFilesMetaData.iterator(); - while (itList.hasNext()) - { - McAttachmentDTO mcAttachmentDTO=(McAttachmentDTO)itList.next(); - logger.debug("current filename" + mcAttachmentDTO.getFilename()); - listFilenames.add(mcAttachmentDTO.getFilename()); - logger.debug("listFilenames after add" + listFilenames); - } - logger.debug("final listFilenames after populating all: " + listFilenames); - return listFilenames; + logger.debug("checkDuplicateQuestions: " + listQuestionContentDTO); + logger.debug("newQuestion: " + newQuestion); + + Map mapQuestionContent=extractMapQuestionContent(listQuestionContentDTO); + logger.debug("mapQuestionContent: " + mapQuestionContent); + + Iterator itMap = mapQuestionContent.entrySet().iterator(); + while (itMap.hasNext()) { + Map.Entry pairs = (Map.Entry)itMap.next(); + if ((pairs.getValue() != null) && (!pairs.getValue().equals(""))) + { + logger.debug("checking the pair: " + pairs.getKey() + " = " + pairs.getValue()); + + if (pairs.getValue().equals(newQuestion)) + { + logger.debug("entry found: " + newQuestion); + return true; + } + } + } + return false; } /** - * removeFileItem(HttpServletRequest request, String filename, String offlineFile) + * removes unused question entries from db + * removeRedundantQuestions (Map mapQuestionContent, IMcService mcService, McAuthoringForm mcAuthoringForm) * - * @param request - * @param filename - * @param offlineFile + * @param mapQuestionContent + * @param mcService + * @param mcAuthoringForm */ - public static void removeFileItem(HttpServletRequest request, String filename, String offlineFile) + public void removeRedundantQuestions (Map mapQuestionContent, IMcService mcService, McAuthoringForm mcAuthoringForm, + HttpServletRequest request, String toolContentID) { - logger.debug("offlineFile:" + offlineFile); - if (offlineFile.equals("1")) + logger.debug("removing unused entries... "); + logger.debug("mapQuestionContent: " + mapQuestionContent); + logger.debug("toolContentID: " + toolContentID); + + McContent mcContent=mcService.retrieveMc( new Long(toolContentID)); + logger.debug("mcContent: " + mcContent); + + if (mcContent != null) { - logger.debug("will remove an offline file"); - List listUploadedOfflineFileNames=(List)request.getSession().getAttribute(LIST_UPLOADED_OFFLINE_FILENAMES); - logger.debug("listUploadedOfflineFileNames:" + listUploadedOfflineFileNames); - - listUploadedOfflineFileNames.remove(filename); - logger.debug("removed offline filename:" + filename); - - logger.debug("listUploadedOfflineFileNames after remove :" + listUploadedOfflineFileNames); - request.getSession().setAttribute(LIST_UPLOADED_OFFLINE_FILENAMES,listUploadedOfflineFileNames); + logger.debug("mcContent uid: " + mcContent.getUid()); + List allQuestions=mcService.getAllQuestionEntries(mcContent.getUid()); + logger.debug("allQuestions: " + allQuestions); + + Iterator listIterator=allQuestions.iterator(); + int mapIndex=0; + boolean entryUsed=false; + while (listIterator.hasNext()) + { + ++mapIndex; + logger.debug("current mapIndex: " + mapIndex); + + McQueContent queContent=(McQueContent)listIterator.next(); + logger.debug("queContent data: " + queContent); + logger.debug("queContent: " + queContent.getQuestion() + " " + queContent.getDisplayOrder()); + + entryUsed=false; + Iterator itMap = mapQuestionContent.entrySet().iterator(); + int displayOrder=0; + while (itMap.hasNext()) + { + ++displayOrder; + logger.debug("current displayOrder: " + displayOrder); + entryUsed=false; + Map.Entry pairs = (Map.Entry)itMap.next(); + logger.debug("using the pair: " + pairs.getKey() + " = " + pairs.getValue()); + + if (pairs.getValue().toString().length() != 0) + { + logger.debug("text from map:" + pairs.getValue().toString()); + logger.debug("text from db:" + queContent.getQuestion()); + + logger.debug("mapIndex versus displayOrder:" + mapIndex + " versus " + displayOrder); + if (mapIndex == displayOrder) + { + //logger.debug("used entry in db:" + queContent.getQuestion()); + logger.debug("used displayOrder position:" + displayOrder); + entryUsed=true; + break; + } + + } + } + + if (entryUsed == false) + { + logger.debug("removing unused entry in db:" + queContent.getQuestion()); + + McQueContent removeableMcQueContent=mcService.getQuestionContentByQuestionText(queContent.getQuestion(), mcContent.getUid()); + logger.debug("removeableMcQueContent" + removeableMcQueContent); + if (removeableMcQueContent != null) + { + //mcContent.getMcQueContents().remove(removeableMcQueContent); + mcService.removeMcQueContent(removeableMcQueContent); + logger.debug("removed removeableMcQueContent from the db: " + removeableMcQueContent); + } + + } + } } - else - { - logger.debug("will remove an online file"); - List listUploadedOnlineFileNames=(List)request.getSession().getAttribute(LIST_UPLOADED_ONLINE_FILENAMES); - logger.debug("listUploadedOnlineFileNames:" + listUploadedOnlineFileNames); - - listUploadedOnlineFileNames.remove(filename); - logger.debug("removed online filename:" + filename); - - logger.debug("listUploadedOnlineFileNames after remove :" + listUploadedOnlineFileNames); - request.getSession().setAttribute(LIST_UPLOADED_ONLINE_FILENAMES,listUploadedOnlineFileNames); - } + } /** - * findFileNameIndex(List listUploadedFileNames, String filename) + * Map extractMapFeedback(List listQuestionContentDTO) * - * @param listUploadedFileNames - * @param filename - * @return int + * @param listQuestionContentDTO + * @return */ - public static int findFileNameIndex(List listUploadedFileNames, String filename) + protected static Map extractMapFeedback(List listQuestionContentDTO) { - Iterator itListUploadedFileNames = listUploadedFileNames.iterator(); - int mainIndex=0; - while (itListUploadedFileNames.hasNext()) + logger.debug("listQuestionContentDTO:" + listQuestionContentDTO); + Map mapFeedbackContent= new TreeMap(new McComparator()); + + Iterator listIterator=listQuestionContentDTO.iterator(); + int queIndex=0; + while (listIterator.hasNext()) { - mainIndex++; - String currentFilename=(String) itListUploadedFileNames.next(); - logger.debug("currentFilename :" + currentFilename); - if (currentFilename.equals(filename)) - { - logger.debug("currentFilename found in the list at mainIndex :" + mainIndex); - return mainIndex; - } + McQuestionContentDTO mcQuestionContentDTO=(McQuestionContentDTO)listIterator.next(); + logger.debug("mcQuestionContentDTO:" + mcQuestionContentDTO); + logger.debug("mcQuestionContentDTO feedback:" + mcQuestionContentDTO.getFeedback()); + + queIndex++; + logger.debug("queIndex:" + queIndex); + mapFeedbackContent.put(new Integer(queIndex).toString(), mcQuestionContentDTO.getFeedback()); } - return 0; + logger.debug("mapFeedbackContent:" + mapFeedbackContent); + return mapFeedbackContent; } + - /** - * removeFileItem(List listFilesMetaData, String uuid) + * Map extractMapWeights(List listQuestionContentDTO) * - * @param listFilesMetaData - * @param uuid - * @return List + * @param listQuestionContentDTO + * @return */ - public static List removeFileItem(List listFilesMetaData, String uuid) + protected static Map extractMapWeights(List listQuestionContentDTO) { - McAttachmentDTO deletableAttachmentDTO=null; - - Iterator itList = listFilesMetaData.iterator(); - int mainIndex=0; - while (itList.hasNext()) + logger.debug("listQuestionContentDTO:" + listQuestionContentDTO); + Map mapWeights= new TreeMap(new McComparator()); + + Iterator listIterator=listQuestionContentDTO.iterator(); + int queIndex=0; + while (listIterator.hasNext()) { - mainIndex++; - McAttachmentDTO currentAttachmentDTO=(McAttachmentDTO) itList.next(); - logger.debug("currentAttachmentDTO :" + currentAttachmentDTO); - logger.debug("currentAttachmentDTO uuid :" + currentAttachmentDTO.getUuid()); - - if (currentAttachmentDTO.getUuid().equals(uuid)) - { - logger.debug("equal uuid found uuid :" + uuid); - deletableAttachmentDTO=currentAttachmentDTO; - break; - } + McQuestionContentDTO mcQuestionContentDTO=(McQuestionContentDTO)listIterator.next(); + logger.debug("mcQuestionContentDTO:" + mcQuestionContentDTO); + logger.debug("mcQuestionContentDTO weight:" + mcQuestionContentDTO.getWeight()); + + queIndex++; + logger.debug("queIndex:" + queIndex); + mapWeights.put(new Integer(queIndex).toString(), mcQuestionContentDTO.getWeight()); } - - logger.debug("equal uuid found at index :" + mainIndex); - logger.debug("deletable attachment is:" + deletableAttachmentDTO); - - listFilesMetaData.remove(deletableAttachmentDTO); - logger.debug("listOfflineFilesMetaData after remove:" + listFilesMetaData); - - return listFilesMetaData; + logger.debug("mapWeights:" + mapWeights); + return mapWeights; } + + + /** + * Map extractMapMarks(List listQuestionContentDTO) + * + * @param listQuestionContentDTO + * @return + */ + protected static Map extractMapMarks(List listQuestionContentDTO) + { + logger.debug("listQuestionContentDTO:" + listQuestionContentDTO); + Map mapMarks= new TreeMap(new McComparator()); + + Iterator listIterator=listQuestionContentDTO.iterator(); + int queIndex=0; + while (listIterator.hasNext()) + { + McQuestionContentDTO mcQuestionContentDTO=(McQuestionContentDTO)listIterator.next(); + logger.debug("mcQuestionContentDTO:" + mcQuestionContentDTO); + logger.debug("mcQuestionContentDTO weight:" + mcQuestionContentDTO.getMark()); + + queIndex++; + logger.debug("queIndex:" + queIndex); + mapMarks.put(new Integer(queIndex).toString(), mcQuestionContentDTO.getMark()); + } + logger.debug("mapMarks:" + mapMarks); + return mapMarks; + } + + + /** + * Map extractMapCandidatesList(List listQuestionContentDTO) + * + * @param listQuestionContentDTO + * @return + */ + protected static Map extractMapCandidatesList(List listQuestionContentDTO) + { + logger.debug("listQuestionContentDTO:" + listQuestionContentDTO); + Map mapCandidatesList= new TreeMap(new McComparator()); + + Iterator listIterator=listQuestionContentDTO.iterator(); + int queIndex=0; + while (listIterator.hasNext()) + { + McQuestionContentDTO mcQuestionContentDTO=(McQuestionContentDTO)listIterator.next(); + logger.debug("mcQuestionContentDTO:" + mcQuestionContentDTO); + logger.debug("mcQuestionContentDTO candidates list:" + mcQuestionContentDTO.getListCandidateAnswersDTO()); + + queIndex++; + logger.debug("queIndex:" + queIndex); + mapCandidatesList.put(new Integer(queIndex).toString(), mcQuestionContentDTO.getListCandidateAnswersDTO()); + } + logger.debug("mapCandidatesList:" + mapCandidatesList); + return mapCandidatesList; + } + /** - * persistFilesMetaData(HttpServletRequest request, boolean isOfflineFile, McContent mcContent) - * + * saveOrUpdateMcContent(Map mapQuestionContent, Map mapFeedback, Map mapWeights, Map mapMarks, Map mapCandidatesList, + IMcService mcService, McAuthoringForm mcAuthoringForm, + HttpServletRequest request, McContent mcContent, String strToolContentID) + + enables persisting content + + * @param mapQuestionContent + * @param mapFeedback + * @param mapWeights + * @param mapMarks + * @param mapCandidatesList + * @param mcService + * @param mcAuthoringForm * @param request - * @param isOfflineFile * @param mcContent + * @param strToolContentID + * @return */ - public static void persistFilesMetaData(HttpServletRequest request, boolean isOfflineFile, McContent mcContent) + public McContent saveOrUpdateMcContent(Map mapQuestionContent, Map mapFeedback, Map mapWeights, Map mapMarks, Map mapCandidatesList, + IMcService mcService, McAuthoringForm mcAuthoringForm, + HttpServletRequest request, McContent mcContent, String strToolContentID) { - IMcService mcService =McUtils.getToolService(request); + logger.debug("doing saveOrUpdateMcContent, mapCandidatesList: " + mapCandidatesList); + UserDTO toolUser = (UserDTO) SessionManager.getSession().getAttribute(AttributeNames.USER); + + boolean isQuestionsSequenced=false; + boolean isSynchInMonitor=false; + boolean isUsernameVisible=false; - List listFilesMetaData=null; - logger.debug("doing persistFilesMetaData..."); - logger.debug("isOfflineFile:" + isOfflineFile); - - if (isOfflineFile) - { - listFilesMetaData =(List)request.getSession().getAttribute(LIST_OFFLINEFILES_METADATA); - } - else - { - listFilesMetaData =(List)request.getSession().getAttribute(LIST_ONLINEFILES_METADATA); - } - logger.debug("listFilesMetaData:" + listFilesMetaData); - - Iterator itListFilesMetaData = listFilesMetaData.iterator(); - while (itListFilesMetaData.hasNext()) + String richTextTitle = request.getParameter(TITLE); + String richTextInstructions = request.getParameter(INSTRUCTIONS); + + logger.debug("richTextTitle: " + richTextTitle); + logger.debug("richTextInstructions: " + richTextInstructions); + + String sln=request.getParameter("sln"); + logger.debug("sln: " + sln); + + String questionsSequenced=request.getParameter("questionsSequenced"); + logger.debug("questionsSequenced: " + questionsSequenced); + + String retries=request.getParameter("retries"); + logger.debug("retries: " + retries); + + String reflect=request.getParameter(REFLECT); + logger.debug("reflect: " + reflect); + + + String richTextOfflineInstructions=request.getParameter(OFFLINE_INSTRUCTIONS); + String richTextOnlineInstructions=request.getParameter(ONLINE_INSTRUCTIONS); + + String reflectionSubject=request.getParameter(REFLECTION_SUBJECT); + logger.debug("reflectionSubject: " + reflectionSubject); + + String activeModule=request.getParameter(ACTIVE_MODULE); + logger.debug("activeModule: " + activeModule); + + + boolean setCommonContent=true; + if ((sln == null) || (questionsSequenced == null) || + (retries == null) || (reflect == null)) { - McAttachmentDTO mcAttachmentDTO=(McAttachmentDTO)itListFilesMetaData.next(); - logger.debug("mcAttachmentDTO:" + mcAttachmentDTO); - String uid=mcAttachmentDTO.getUid(); - logger.debug("uid:" + uid); + setCommonContent=false; + } + logger.debug("setCommonContent: " + setCommonContent); + + boolean questionsSequencedBoolean=false; + boolean slnBoolean=false; + boolean retriesBoolean=false; + boolean reflectBoolean=false; + + if ((questionsSequenced != null) && (questionsSequenced.equalsIgnoreCase("1"))) + questionsSequencedBoolean=true; + + if ((sln != null) && (sln.equalsIgnoreCase("1"))) + slnBoolean=true; + + if ((retries != null) && (retries.equalsIgnoreCase("1"))) + retriesBoolean=true; + + if ((reflect != null) && (reflect.equalsIgnoreCase("1"))) + reflectBoolean=true; + + + logger.debug("questionsSequencedBoolean: " + questionsSequencedBoolean); + logger.debug("slnBoolean: " + slnBoolean); + logger.debug("retriesBoolean: " + retriesBoolean); + logger.debug("reflectBoolean: " + reflectBoolean); + + long userId=0; + if (toolUser != null) + { + userId = toolUser.getUserID().longValue(); + } + else + { + HttpSession ss = SessionManager.getSession(); + logger.debug("ss: " + ss); + UserDTO user = (UserDTO) ss.getAttribute(AttributeNames.USER); + logger.debug("user" + user); + if (user != null) + { + userId = user.getUserID().longValue(); + } + else + { + logger.debug("should not reach here"); + userId=0; + } + } + logger.debug("userId: " + userId); + logger.debug("mcContent: " + mcContent); + + boolean newContent=false; + if(mcContent == null) + { + mcContent = new McContent(); + newContent=true; + } + + + logger.debug("setting common content values..." + richTextTitle + " " + richTextInstructions); + mcContent.setMcContentId(new Long(strToolContentID)); + mcContent.setTitle(richTextTitle); + mcContent.setInstructions(richTextInstructions); + mcContent.setUpdateDate(new Date(System.currentTimeMillis())); /**keep updating this one*/ + logger.debug("userId: " + userId); + mcContent.setCreatedBy(userId); /**make sure we are setting the userId from the User object above*/ + logger.debug("end of setting common content values..."); + + + String passmark= request.getParameter("passmark"); + logger.debug("passmark: " + passmark); + + if (passmark == null) + passmark="0"; + + if ((passmark != null) && (passmark.equals(" "))) + passmark="0"; + + else if ((passmark != null) && (passmark.length() == 0)) + passmark="0"; + + + logger.debug("activeModule:" + activeModule); + if (activeModule.equals(AUTHORING)) + { + logger.debug("setting other content values..."); + mcContent.setOnlineInstructions(richTextOnlineInstructions); + mcContent.setOfflineInstructions(richTextOfflineInstructions); + mcContent.setQuestionsSequenced(questionsSequencedBoolean); + mcContent.setRetries(retriesBoolean); + mcContent.setShowReport(slnBoolean); + mcContent.setReflect(reflectBoolean); + mcContent.setReflectionSubject(reflectionSubject); + + logger.debug("setting passmark..."); + mcContent.setPassMark(new Integer(passmark)); + } - String uuid=mcAttachmentDTO.getUuid(); - boolean isOnlineFile=!mcAttachmentDTO.isOfflineFile(); - String fileName=mcAttachmentDTO.getFilename(); - - if (uid == null) - { - logger.debug("persisting files metadata..."); - if (!mcService.isUuidPersisted(uuid)) - { - mcService.persistFile(uuid, isOnlineFile, fileName, mcContent); - } - } + + if (newContent) + { + logger.debug("will create: " + mcContent); + mcService.createMc(mcContent); } + else + { + logger.debug("will update: " + mcContent); + mcService.updateMc(mcContent); + } + + mcContent=mcService.retrieveMc(new Long(strToolContentID)); + logger.debug("mcContent: " + mcContent); + + mcContent=createQuestionContent(mapQuestionContent, mapFeedback, mapWeights, mapMarks, mapCandidatesList, mcService, mcContent); + + return mcContent; } + /** - * extractFileNames(List listFilesMetaData) * - * @param listFilesMetaData - * @return List + * McContent createQuestionContent(Map mapQuestionContent, Map mapFeedback, Map mapWeights, + Map mapMarks, Map mapCandidatesList, IMcService mcService, McContent mcContent) + * + * persists the questions in the Map the user has submitted + * + * @param mapQuestionContent + * @param mapFeedback + * @param mapWeights + * @param mapMarks + * @param mapCandidatesList + * @param mcService + * @param mcContent + * @return */ - public static List extractFileNames(List listFilesMetaData) - { - Iterator itList = listFilesMetaData.iterator(); - LinkedList listFilenames= new LinkedList(); - - while (itList.hasNext()) - { - McAttachmentDTO mcAttachmentDTO=(McAttachmentDTO)itList.next(); - String filename=mcAttachmentDTO.getFilename(); - logger.debug("extracted filename: " + filename); - listFilenames.add(filename); - } - logger.debug("final extracted listFilenames: " + listFilenames); - return listFilenames; + protected McContent createQuestionContent(Map mapQuestionContent, Map mapFeedback, Map mapWeights, + Map mapMarks, Map mapCandidatesList, IMcService mcService, McContent mcContent) + { + logger.debug("createQuestionContent, mapCandidatesList: " + mapCandidatesList); + logger.debug("content uid is: " + mcContent.getUid()); + List questions=mcService.retrieveMcQueContentsByToolContentId(mcContent.getUid().longValue()); + logger.debug("questions: " + questions); + + logger.debug("mapQuestionContent: " + mapQuestionContent); + logger.debug("mapFeedback: " + mapFeedback); + logger.debug("mapMarks: " + mapMarks); + + + Iterator itMap = mapQuestionContent.entrySet().iterator(); + int displayOrder=0; + while (itMap.hasNext()) + { + Map.Entry pairs = (Map.Entry)itMap.next(); + logger.debug("using the pair: " + pairs.getKey() + " = " + pairs.getValue()); + + if (pairs.getValue().toString().length() != 0) + { + logger.debug("starting createQuestionContent: pairs.getValue().toString():" + pairs.getValue().toString()); + logger.debug("starting createQuestionContent: mcContent: " + mcContent); + + ++displayOrder; + logger.debug("starting createQuestionContent: displayOrder: " + displayOrder); + String currentFeedback=(String)mapFeedback.get(new Integer(displayOrder).toString()); + logger.debug("currentFeedback: " + currentFeedback); + + String currentMark=(String)mapMarks.get(new Integer(displayOrder).toString()); + logger.debug("currentMark: " + currentMark); + /*set the default mark in case it is not provided*/ + if (currentMark == null) + currentMark= "1"; + + List caList=(List)mapCandidatesList.get(new Integer(displayOrder).toString()); + logger.debug("caList: " + caList); + + + + McQueContent queContent= new McQueContent(pairs.getValue().toString(), + new Integer(displayOrder), + new Integer(0), + new Integer(currentMark), + currentFeedback, + mcContent, + null, + null); + + + logger.debug("queContent: " + queContent); + + /* checks if the question is already recorded*/ + logger.debug("question text is: " + pairs.getValue().toString()); + logger.debug("content uid is: " + mcContent.getUid()); + logger.debug("question display order is: " + displayOrder); + McQueContent existingMcQueContent=mcService.getQuestionContentByDisplayOrder(new Long(displayOrder), mcContent.getUid()); + logger.debug("existingMcQueContent: " + existingMcQueContent); + + if (existingMcQueContent == null) + { + /*make sure a question with the same question text is not already saved*/ + McQueContent duplicateMcQueContent=mcService.getQuestionContentByQuestionText(pairs.getValue().toString(), mcContent.getUid()); + logger.debug("duplicateMcQueContent: " + duplicateMcQueContent); + logger.debug("adding a new question to content: " + queContent); + mcContent.getMcQueContents().add(queContent); + queContent.setMcContent(mcContent); + + mcService.createMcQue(queContent); + + logger.debug("start persisting candidate answers: " + queContent); + persistCandidates(caList, queContent, mcService); + } + else + { + + String existingQuestion=existingMcQueContent.getQuestion(); + logger.debug("existingQuestion: " + existingQuestion); + + logger.debug("map question versus existingQuestion: " + pairs.getValue().toString() + + " versus db question value: " + existingQuestion); + + existingMcQueContent.setQuestion(pairs.getValue().toString()); + existingMcQueContent.setFeedback(currentFeedback); + existingMcQueContent.setDisplayOrder(new Integer(displayOrder)); + existingMcQueContent.setMark(new Integer(currentMark)); + + + logger.debug("updating the existing question content: " + existingMcQueContent); + mcService.updateMcQueContent(existingMcQueContent); + + logger.debug("questionUid " + existingMcQueContent.getUid()); + + logger.debug("will be removing redundant candidates, questionUid: " + existingMcQueContent.getUid()); + mcService.removeMcOptionsContentByQueId(existingMcQueContent.getUid()); + logger.debug("start persisting candidates " + existingMcQueContent.getUid()); + + persistCandidates(caList, existingMcQueContent, mcService); + } + } + } + return mcContent; } /** - * removeRedundantOfflineFileItems(HttpServletRequest request, McContent mcContent) + * Map buildMarksMap() * - * @param request - * @param mcContent + * @return */ - public static void removeRedundantOfflineFileItems(HttpServletRequest request, McContent mcContent) + protected Map buildMarksMap() { - IMcService mcService =McUtils.getToolService(request); + Map map= new TreeMap(new McComparator()); - List allOfflineFilenames=mcService.retrieveMcUploadedOfflineFilesName(mcContent.getUid()); - logger.debug("allOfflineFilenames:" + allOfflineFilenames); + for (int i=1; i <= 10 ; i++) + { + map.put(new Integer(i).toString(), new Integer(i).toString()); + } + logger.debug("return marks Map: " + map); + return map; + } + + /** + * Map buildPassMarkMap() + * + * @return + */ + protected Map buildPassMarkMap() + { + Map map= new TreeMap(new McComparator()); - List listOfflineFilesMetaData =(List)request.getSession().getAttribute(LIST_OFFLINEFILES_METADATA); - logger.debug("listOfflineFilesMetaData:" + listOfflineFilesMetaData); - - List listUploadedOfflineFileNames=extractFileNames(listOfflineFilesMetaData); - logger.debug("listUploadedOfflineFileNames:" + listUploadedOfflineFileNames); - - boolean matchFound=false; - Iterator itAllOfflineFiles = allOfflineFilenames.iterator(); - while (itAllOfflineFiles.hasNext()) - { - String filename =(String)itAllOfflineFiles.next(); - logger.debug("filename: " + filename); + map.put(new Integer(1).toString(), " "); - matchFound=false; - Iterator itFiles = listUploadedOfflineFileNames.iterator(); - while (itFiles.hasNext()) - { - matchFound=false; - String currentFilename =(String)itFiles.next(); - logger.debug("currentFilename: " + currentFilename); - - if (filename.equals(currentFilename)) - { - logger.debug("filename match found : " + currentFilename); - matchFound=true; - break; - } - } - - logger.debug("matchFound : " + matchFound); - if (matchFound == false) - { - logger.debug("matchFound is false for filename: " + filename); - mcService.removeOffLineFile(filename, mcContent.getUid()); - logger.debug("filename removed: " + filename); - } + for (int i=2; i <= 11 ; i++) + { + map.put(new Integer(i).toString(), new Integer(i-1).toString()); } + logger.debug("return passmarks Map: " + map); + return map; } - + /** + * Map buildCorrectMap() + * + * @return + */ + protected Map buildCorrectMap() + { + Map map= new TreeMap(new McComparator()); + map.put(new Integer(1).toString(), "Incorrect"); + map.put(new Integer(2).toString(), "Correct"); + logger.debug("return marks Map: " + map); + return map; + } + /** - * removeRedundantOnlineFileItems(HttpServletRequest request, McContent mcContent) + * List repopulateCandidateAnswersBox(HttpServletRequest request, boolean addBlankCa) * * @param request - * @param mcContent + * @param addBlankCa + * @return */ - public static void removeRedundantOnlineFileItems(HttpServletRequest request, McContent mcContent) + protected List repopulateCandidateAnswersBox(HttpServletRequest request, boolean addBlankCa) { - IMcService mcService =McUtils.getToolService(request); - - List allOnlineFilenames=mcService.retrieveMcUploadedOnlineFilesName(mcContent.getUid()); - logger.debug("allOnlineFilenames:" + allOnlineFilenames); - - List listOnlineFilesMetaData =(List)request.getSession().getAttribute(LIST_ONLINEFILES_METADATA); - logger.debug("listOnlineFilesMetaData:" + listOnlineFilesMetaData); - - List listUploadedOnlineFileNames=extractFileNames(listOnlineFilesMetaData); - logger.debug("listUploadedOnlineFileNames:" + listUploadedOnlineFileNames); - - - boolean matchFound=false; - Iterator itAllOnlineFiles = allOnlineFilenames.iterator(); - while (itAllOnlineFiles.hasNext()) - { - String filename =(String)itAllOnlineFiles.next(); - logger.debug("filename: " + filename); + logger.debug("doing repopulateCandidateAnswersBox, addBlankCa: " + addBlankCa); - matchFound=false; - Iterator itFiles = listUploadedOnlineFileNames.iterator(); - while (itFiles.hasNext()) - { - matchFound=false; - String currentFilename =(String)itFiles.next(); - logger.debug("currentFilename: " + currentFilename); - - if (filename.equals(currentFilename)) - { - logger.debug("filename match found : " + currentFilename); - matchFound=true; - break; - } - } + List listFinalCandidatesDTO=new LinkedList(); + + for (int i=0; i< MAX_OPTION_COUNT; i++) + { + String candidate= request.getParameter("ca" + i); + logger.debug("candidate: " + candidate); - logger.debug("matchFound : " + matchFound); - if (matchFound == false) + String correct= request.getParameter("correct" + i); + logger.debug("correct: " + correct); + + + if ((candidate != null) && (candidate.length() > 0)) { - logger.debug("matchFound is false for filename: " + filename); - mcService.removeOnLineFile(filename, mcContent.getUid()); - logger.debug("filename removed: " + filename); + McCandidateAnswersDTO mcCandidateAnswersDTO= new McCandidateAnswersDTO(); + mcCandidateAnswersDTO.setCandidateAnswer(candidate); + mcCandidateAnswersDTO.setCorrect(correct); + listFinalCandidatesDTO.add(mcCandidateAnswersDTO); } - } + } + + if (addBlankCa == true) + { + McCandidateAnswersDTO mcCandidateAnswersDTO= new McCandidateAnswersDTO(); + mcCandidateAnswersDTO.setCandidateAnswer(""); + mcCandidateAnswersDTO.setCorrect("Incorrect"); + listFinalCandidatesDTO.add(mcCandidateAnswersDTO); + } + + logger.debug("returning listFinalCandidatesDTO: " + listFinalCandidatesDTO); + return listFinalCandidatesDTO; } + /** - * simulatePropertyInspector_RunOffline(HttpServletRequest request) - * @param request + * boolean validateSingleCorrectCandidate(List caList) + * + * verifies that there is at least one Correct entry selected + * + * @param caList + * @return */ - public void simulatePropertyInspector_RunOffline(HttpServletRequest request) + protected boolean validateSingleCorrectCandidate(List caList) { - IMcService mcService =McUtils.getToolService(request); - - String toolContentId=(String)request.getSession().getAttribute(TOOL_CONTENT_ID); - if ((toolContentId != null) && (!toolContentId.equals(""))) - { - logger.debug("passed TOOL_CONTENT_ID : " + new Long(toolContentId)); - try - { - mcService.setAsRunOffline(new Long(toolContentId)); - } - catch(ToolException e) - { - logger.debug("we should never come here"); - } - - logger.debug("post-RunAsOffline"); - } - logger.debug("end of simulating RunOffline on content id: " + toolContentId); - } - + Iterator itCaList= caList.iterator(); + while (itCaList.hasNext()) + { + McCandidateAnswersDTO mcCandidateAnswersDTO= (McCandidateAnswersDTO)itCaList.next(); + logger.debug("mcCandidateAnswersDTO:" + mcCandidateAnswersDTO); + + String candidateAnswer= mcCandidateAnswersDTO.getCandidateAnswer(); + String correct= mcCandidateAnswersDTO.getCorrect(); + logger.debug("correct:" + correct); + + if (correct.equals("Correct")) + { + logger.debug("there is at leat one Correct candidate, it is good."); + return true; + } + } + + return false; + } + + /** - * Normally, a request to set defineLaterproperty of the content comes directly from container through the property inspector. - * What we do below is simulate that for development purposes. - * @param request + * buildDefaultQuestionContent(McContent mcContent, IMcService mcService) + * + * generates a list for holding default questions and their candidate answers + * + * @param mcContent + * @param mcService + * @return */ - public void simulatePropertyInspector_setAsDefineLater(HttpServletRequest request) + protected List buildDefaultQuestionContent(McContent mcContent, IMcService mcService) { - IMcService mcService =McUtils.getToolService(request); + logger.debug("starting buildDefaultQuestionContent, mcContent: " + mcContent); + List listQuestionContentDTO= new LinkedList(); - String toolContentId=(String)request.getSession().getAttribute(TOOL_CONTENT_ID); - if ((toolContentId != null) && (!toolContentId.equals(""))) + /* + * get the existing question content + */ + logger.debug("setting content data from the db"); + Iterator queIterator=mcContent.getMcQueContents().iterator(); + Long mapIndex=new Long(1); + + while (queIterator.hasNext()) { - logger.debug("passed TOOL_CONTENT_ID : " + new Long(toolContentId)); - try - { - mcService.setAsDefineLater(new Long(toolContentId)); + McQuestionContentDTO mcQuestionContentDTO=new McQuestionContentDTO(); + + McQueContent mcQueContent=(McQueContent) queIterator.next(); + if (mcQueContent != null) + { + logger.debug("question: " + mcQueContent.getQuestion()); + logger.debug("displayorder: " + mcQueContent.getDisplayOrder().toString()); + logger.debug("mark: " + mcQueContent.getMark().toString()); + logger.debug("feedback: " + mcQueContent.getFeedback()); + + String feedback=""; + if (mcQueContent.getFeedback() != null) + feedback=mcQueContent.getFeedback(); + + logger.debug("feedback now: " + mcQueContent.getFeedback()); + + + mcQuestionContentDTO.setQuestion(mcQueContent.getQuestion()); + mcQuestionContentDTO.setDisplayOrder(mcQueContent.getDisplayOrder().toString()); + mcQuestionContentDTO.setFeedback(feedback); + mcQuestionContentDTO.setMark(mcQueContent.getMark().toString()); + + + /* get candidates, from here.. */ + List list=mcService.findMcOptionsContentByQueId(mcQueContent.getUid()); + logger.debug("candidiate answers list for mapQuestionContent:" + list); + + int caCount=list.size(); + logger.debug("caCount:" + caCount); + mcQuestionContentDTO.setCaCount(new Integer(caCount).toString()); + + List listCandidates= new LinkedList(); + Iterator listIterator=list.iterator(); + while (listIterator.hasNext()) + { + McOptsContent mcOptsContent=(McOptsContent)listIterator.next(); + McCandidateAnswersDTO mcCandidateAnswersDTO = new McCandidateAnswersDTO(); + + logger.debug("mcOptsContent:" + mcOptsContent); + logger.debug("option text:" + mcOptsContent.getMcQueOptionText()); + logger.debug("option text:" + mcOptsContent.isCorrectOption()); + + mcCandidateAnswersDTO.setCandidateAnswer(mcOptsContent.getMcQueOptionText()); + + if (mcOptsContent.isCorrectOption()) + { + logger.debug("mcOptsContent.getMcQueOptionText() is set to true"); + mcCandidateAnswersDTO.setCorrect("Correct"); + } + else + { + logger.debug("mcOptsContent.getMcQueOptionText() is set to true"); + mcCandidateAnswersDTO.setCorrect("Incorrect"); + } + logger.debug("current mcCandidateAnswersDTO:" + mcCandidateAnswersDTO); + listCandidates.add(mcCandidateAnswersDTO); + logger.debug("current listCandidates:" + listCandidates); + } + logger.debug("final listCandidates for mcQueContent:" + listCandidates); + /* get candidates, till here.. */ + + mcQuestionContentDTO.setListCandidateAnswersDTO(listCandidates); + logger.debug("current mcQuestionContentDTO:" + mcQuestionContentDTO); + + + listQuestionContentDTO.add(mcQuestionContentDTO); + logger.debug("current listQuestionContentDTO:" + listQuestionContentDTO); + + mapIndex=new Long(mapIndex.longValue()+1); } - catch(ToolException e) - { - logger.debug("we should never come here"); - } - - logger.debug("post-setAsDefineLater"); - } - logger.debug("end of simulating setAsDefineLater on content id: " + toolContentId); + } + + logger.debug("final listQuestionContentDTO:" + listQuestionContentDTO); + return listQuestionContentDTO; } - /** - * cleans up authoring http session - * cleanupAuthoringSession(HttpServletRequest request) - * @param request + * persistCandidates(List caList, McQueContent mcQueContent, IMcService mcService) + * + * @param caList + * @param mcQueContent + * @param mcService */ - public static void cleanupAuthoringSession(HttpServletRequest request) + protected void persistCandidates(List caList, McQueContent mcQueContent, IMcService mcService) { - request.getSession().removeAttribute(ACTIVE_MODULE); - request.getSession().removeAttribute(DEFAULT_CONTENT_ID); - request.getSession().removeAttribute(SHOW_AUTHORING_TABS); - request.getSession().removeAttribute(TOOL_CONTENT_ID); - request.getSession().removeAttribute(DEFINE_LATER_IN_EDIT_MODE); - request.getSession().removeAttribute(LIST_OFFLINEFILES_METADATA); - request.getSession().removeAttribute(LIST_ONLINEFILES_METADATA); - request.getSession().removeAttribute(LIST_UPLOADED_OFFLINE_FILENAMES); - request.getSession().removeAttribute(LIST_UPLOADED_ONLINE_FILENAMES); - request.getSession().removeAttribute(EDIT_OPTIONS_MODE); - request.getSession().removeAttribute(IS_REVISITING_USER); - request.getSession().removeAttribute(PASSMARK); - request.getSession().removeAttribute(DEFINE_LATER); - request.getSession().removeAttribute(IS_REVISITING_USER); - request.getSession().removeAttribute(MAP_WEIGHTS); - request.getSession().removeAttribute(DEFINE_LATER_EDIT_ACTIVITY); - //request.getSession().removeAttribute(RICHTEXT_END_LEARNING_MSG); - request.getSession().removeAttribute(RICHTEXT_FEEDBACK_CORRECT); - request.getSession().removeAttribute(RICHTEXT_FEEDBACK_INCORRECT); - request.getSession().removeAttribute(RICHTEXT_TITLE); - request.getSession().removeAttribute(RICHTEXT_INSTRUCTIONS); - request.getSession().removeAttribute(RICHTEXT_OFFLINEINSTRUCTIONS); - request.getSession().removeAttribute(RICHTEXT_ONLINEINSTRUCTIONS); - request.getSession().removeAttribute(RETRIES); - request.getSession().removeAttribute(MAP_DEFAULTOPTIONS_CONTENT); - request.getSession().removeAttribute(MAP_GENERAL_OPTIONS_CONTENT); - request.getSession().removeAttribute(MAP_GENERAL_SELECTED_OPTIONS_CONTENT); - request.getSession().removeAttribute(MAP_STARTUP_GENERAL_OPTIONS_CONTENT); - request.getSession().removeAttribute(MAP_STARTUP_GENERAL_SELECTED_OPTIONS_CONTENT); - request.getSession().removeAttribute(MAP_DISABLED_QUESTIONS); - request.getSession().removeAttribute(MAP_SELECTED_OPTIONS); - request.getSession().removeAttribute(MAP_FEEDBACK_INCORRECT); - request.getSession().removeAttribute(MAP_FEEDBACK_CORRECT); - request.getSession().removeAttribute(SELECTED_QUESTION); - request.getSession().removeAttribute(SELECTED_QUESTION_INDEX); - request.getSession().removeAttribute(QUESTIONS_WITHNO_OPTIONS); - request.getSession().removeAttribute(USER_EXCEPTION_CONTENTID_REQUIRED); - request.getSession().removeAttribute(USER_EXCEPTION_NUMBERFORMAT); - request.getSession().removeAttribute(USER_EXCEPTION_DEFAULTCONTENT_NOTSETUP); - request.getSession().removeAttribute(USER_EXCEPTION_DEFAULTQUESTIONCONTENT_NOT_AVAILABLE); - request.getSession().removeAttribute(USER_EXCEPTION_DEFAULTOPTIONSCONTENT_NOT_AVAILABLE); + logger.debug("doing persistCandidates:" + caList); + logger.debug("mcQueContent:" + mcQueContent); - /* Preview mode constants*/ - request.getSession().removeAttribute(MAP_QUESTION_CONTENT_LEARNER); - request.getSession().removeAttribute(TOTAL_QUESTION_COUNT); - request.getSession().removeAttribute(CURRENT_QUESTION_INDEX); - request.getSession().removeAttribute(MAP_GENERAL_OPTIONS_CONTENT); - request.getSession().removeAttribute(MAP_OPTIONS_CONTENT); - request.getSession().removeAttribute(QUESTION_LISTING_MODE_COMBINED); - request.getSession().removeAttribute(PREVIEW_ONLY); + Iterator itCaList= caList.iterator(); + while (itCaList.hasNext()) + { + McCandidateAnswersDTO mcCandidateAnswersDTO= (McCandidateAnswersDTO)itCaList.next(); + logger.debug("mcCandidateAnswersDTO:" + mcCandidateAnswersDTO); + + String candidateAnswer= mcCandidateAnswersDTO.getCandidateAnswer(); + String correct= mcCandidateAnswersDTO.getCorrect(); + + boolean correctOption=false; + if (correct.equals("Correct")) + correctOption= true; + else + correctOption= false; + + McOptsContent mcOptsContent = new McOptsContent(correctOption, candidateAnswer, mcQueContent, new TreeSet()); + logger.debug("mcOptsContent: " + mcOptsContent); + + mcService.saveMcOptionsContent(mcOptsContent); + logger.debug("persisted mcOptsContent: " + mcOptsContent); + } } } Index: lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/web/ExportServlet.java =================================================================== RCS file: /usr/local/cvsroot/lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/web/ExportServlet.java,v diff -u -r1.11 -r1.12 --- lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/web/ExportServlet.java 17 Sep 2006 06:23:44 -0000 1.11 +++ lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/web/ExportServlet.java 2 Oct 2006 01:59:34 -0000 1.12 @@ -75,7 +75,17 @@ return FILENAME; } - + + /** + * learner(HttpServletRequest request, HttpServletResponse response, String directoryName, Cookie[] cookies) + * + * generates report for learner mode + * + * @param request + * @param response + * @param directoryName + * @param cookies + */ public void learner(HttpServletRequest request, HttpServletResponse response, String directoryName, Cookie[] cookies) { logger.debug("starting learner mode..."); @@ -116,14 +126,15 @@ throw new McApplicationException(error); } - + + McMonitoringAction mcMonitoringAction= new McMonitoringAction(); List listMonitoredAnswersContainerDTO=MonitoringUtil.buildGroupsQuestionDataForExportLearner(request, content, mcService, mcSession, learner ); request.getSession().setAttribute(LIST_MONITORED_ANSWERS_CONTAINER_DTO, listMonitoredAnswersContainerDTO); logger.debug("LIST_MONITORED_ANSWERS_CONTAINER_DTO: " + request.getSession().getAttribute(LIST_MONITORED_ANSWERS_CONTAINER_DTO)); - - String intTotalMark=viewAnswers(request, content, learner, mcSession, mcService); + + String intTotalMark=viewAnswers(request, content, learner, mcSession, mcService); logger.debug("intTotalMark: " + intTotalMark); request.getSession().setAttribute(LEARNER_MARK,intTotalMark); @@ -136,7 +147,16 @@ } - + /** + * viewAnswers(HttpServletRequest request, McContent content, McQueUsr mcQueUsr, McSession mcSession, IMcService mcService) + * + * @param request + * @param content + * @param mcQueUsr + * @param mcSession + * @param mcService + * @return + */ public String viewAnswers(HttpServletRequest request, McContent content, McQueUsr mcQueUsr, McSession mcSession, IMcService mcService) { logger.debug("starting viewAnswers..."); @@ -206,7 +226,7 @@ String currentMark=""; if (isAttemptCorrect) { - currentMark= mcUsrAttemptUser.getMcQueContent().getWeight().toString(); + currentMark= mcUsrAttemptUser.getMcQueContent().getMark().toString(); } else { @@ -246,7 +266,7 @@ String currentMark=""; if (isAttemptCorrect) { - currentMark= mcUsrAttempt.getMcQueContent().getWeight().toString(); + currentMark= mcUsrAttempt.getMcQueContent().getMark().toString(); } else { @@ -334,6 +354,15 @@ } + /** + * teacher(HttpServletRequest request, HttpServletResponse response, String directoryName, Cookie[] cookies) + * + * generates report for teacher mode + * @param request + * @param response + * @param directoryName + * @param cookies + */ public void teacher(HttpServletRequest request, HttpServletResponse response, String directoryName, Cookie[] cookies) { logger.debug("starting teacher mode..."); @@ -375,5 +404,4 @@ mcMonitoringAction.prepareReflectionData(request, content, mcService, null, true); logger.debug("ending teacher mode: "); } - } Index: lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/web/LearningUtil.java =================================================================== RCS file: /usr/local/cvsroot/lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/web/LearningUtil.java,v diff -u -r1.37 -r1.38 --- lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/web/LearningUtil.java 17 Sep 2006 06:23:44 -0000 1.37 +++ lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/web/LearningUtil.java 2 Oct 2006 01:59:34 -0000 1.38 @@ -56,7 +56,13 @@ public class LearningUtil implements McAppConstants { static Logger logger = Logger.getLogger(LearningUtil.class.getName()); - + /** + * void saveFormRequestData(HttpServletRequest request, McLearningForm mcLearningForm, boolean prepareViewAnswersDataMode) + * + * @param request + * @param mcLearningForm + * @param prepareViewAnswersDataMode + */ public static void saveFormRequestData(HttpServletRequest request, McLearningForm mcLearningForm, boolean prepareViewAnswersDataMode) { logger.debug("prepareViewAnswersDataMode: " + prepareViewAnswersDataMode); @@ -97,14 +103,6 @@ logger.debug("done saving form request data."); } - /** - * updates the Map based on learner activity - * selectOptionsCheckBox(HttpServletRequest request,McLearningForm mcLearningForm, String questionIndex) - * - * @param request - * @param form - * @param questionIndex - */ /** * continueOptions(HttpServletRequest request) @@ -394,6 +392,12 @@ } + /** + * Map buildMapCorrectOptionUids(List correctOptions) + * + * @param correctOptions + * @return + */ public static Map buildMapCorrectOptionUids(List correctOptions) { Map mapCorrectOptionUids= new TreeMap(new McComparator()); @@ -413,6 +417,13 @@ } + /** + * Map compare(Map mapGeneralCorrectOptions,Map mapGeneralCheckedOptionsContent) + * + * @param mapGeneralCorrectOptions + * @param mapGeneralCheckedOptionsContent + * @return + */ public static Map compare(Map mapGeneralCorrectOptions,Map mapGeneralCheckedOptionsContent) { logger.debug("incoming mapGeneralCorrectOptions : " + mapGeneralCorrectOptions); @@ -451,7 +462,13 @@ return mapLeanerAssessmentResults; } - + /** + * boolean compareMapItems(Map mapCorrectOptions, Map mapCheckedOptions) + * + * @param mapCorrectOptions + * @param mapCheckedOptions + * @return + */ public static boolean compareMapItems(Map mapCorrectOptions, Map mapCheckedOptions) { logger.debug("performing compareMaps"); @@ -475,6 +492,7 @@ return true; } + /** * compareMapsCross(Map mapCorrectOptions, Map mapCheckedOptions) * @@ -530,6 +548,15 @@ return false; } + + /** + * McQueUsr getUser(HttpServletRequest request, IMcService mcService, String toolSessionId) + * + * @param request + * @param mcService + * @param toolSessionId + * @return + */ public static McQueUsr getUser(HttpServletRequest request, IMcService mcService, String toolSessionId) { logger.debug("getUser:: " + toolSessionId); @@ -567,6 +594,20 @@ return mcQueUsr; } + + /** + * createLearnerAttempt(HttpServletRequest request, McQueUsr mcQueUsr, List selectedQuestionAndCandidateAnswersDTO, + int mark, boolean passed, int highestAttemptOrder, Map mapLeanerAssessmentResults, IMcService mcService) + + * @param request + * @param mcQueUsr + * @param selectedQuestionAndCandidateAnswersDTO + * @param mark + * @param passed + * @param highestAttemptOrder + * @param mapLeanerAssessmentResults + * @param mcService + */ public static void createLearnerAttempt(HttpServletRequest request, McQueUsr mcQueUsr, List selectedQuestionAndCandidateAnswersDTO, int mark, boolean passed, int highestAttemptOrder, Map mapLeanerAssessmentResults, IMcService mcService) { @@ -601,6 +642,24 @@ } + /** + * + * createIndividualOptions(HttpServletRequest request, Map candidateAnswers, McQueContent mcQueContent, + McQueUsr mcQueUsr, Date attempTime, String timeZone, int mark, boolean passed, Integer highestAttemptOrder, String isAttemptCorrect, + IMcService mcService) + * + * @param request + * @param candidateAnswers + * @param mcQueContent + * @param mcQueUsr + * @param attempTime + * @param timeZone + * @param mark + * @param passed + * @param highestAttemptOrder + * @param isAttemptCorrect + * @param mcService + */ public static void createIndividualOptions(HttpServletRequest request, Map candidateAnswers, McQueContent mcQueContent, McQueUsr mcQueUsr, Date attempTime, String timeZone, int mark, boolean passed, Integer highestAttemptOrder, String isAttemptCorrect, IMcService mcService) @@ -637,7 +696,7 @@ /** - * buildWeightsMap(HttpServletRequest request, Long toolContentId) + * Map buildWeightsMap(HttpServletRequest request, Long toolContentId, IMcService mcService) * * @param request * @param toolContentId @@ -666,7 +725,48 @@ return mapWeights; } + + /** + * Map buildMarksMap(HttpServletRequest request, Long toolContentId, IMcService mcService) + * + * @param request + * @param toolContentId + * @param mcService + * @return + */ + public static Map buildMarksMap(HttpServletRequest request, Long toolContentId, IMcService mcService) + { + logger.debug("starting buildMarksMap : " + toolContentId); + Map mapMarks= new TreeMap(new McComparator()); + McContent mcContent=mcService.retrieveMc(toolContentId); + logger.debug("mcContent : " + mcContent); + + List questionsContent=mcService.refreshQuestionContent(mcContent.getUid()); + logger.debug("questionsContent : " + questionsContent); + + Iterator listIterator=questionsContent.iterator(); + Long mapIndex=new Long(1); + while (listIterator.hasNext()) + { + McQueContent mcQueContent=(McQueContent)listIterator.next(); + logger.debug("mcQueContent : " + mcQueContent); + mapMarks.put(mapIndex.toString(),mcQueContent.getMark().toString()); + mapIndex=new Long(mapIndex.longValue()+1); + } + logger.debug("mapMarks : " + mapMarks); + return mapMarks; + } + + /** + * + * Map buildQuestionContentMap(HttpServletRequest request, McContent mcContent, IMcService mcService) + * + * @param request + * @param mcContent + * @param mcService + * @return + */ public static Map buildQuestionContentMap(HttpServletRequest request, McContent mcContent, IMcService mcService) { Map mapQuestionsContent= new TreeMap(new McComparator()); @@ -681,7 +781,7 @@ if (displayOrder != 0) { /* add the question to the questions Map in the displayOrder*/ - mapQuestionsContent.put(new Integer(displayOrder).toString(),mcQueContent.getQuestion() + " of weight: " + mcQueContent.getWeight().toString() + "%"); + mapQuestionsContent.put(new Integer(displayOrder).toString(),mcQueContent.getQuestion() + " of weight: " + mcQueContent.getWeight().toString() + "%"); } /* prepare the first question's candidate answers for presentation*/ @@ -701,7 +801,13 @@ return mapQuestionsContent; } - + + /** + * McGeneralLearnerFlowDTO buildMcGeneralLearnerFlowDTO(McContent mcContent) + * + * @param mcContent + * @return + */ public static McGeneralLearnerFlowDTO buildMcGeneralLearnerFlowDTO(McContent mcContent) { logger.debug("starting buildMcGeneralLearnerFlowDTO: " + mcContent); @@ -710,7 +816,7 @@ mcGeneralLearnerFlowDTO.setActivityTitle(mcContent.getTitle()); mcGeneralLearnerFlowDTO.setActivityInstructions(mcContent.getInstructions()); mcGeneralLearnerFlowDTO.setPassMark(mcContent.getPassMark().toString()); - mcGeneralLearnerFlowDTO.setReportTitleLearner(mcContent.getReportTitle()); + mcGeneralLearnerFlowDTO.setReportTitleLearner("Report"); mcGeneralLearnerFlowDTO.setLearnerProgress(new Boolean(false).toString()); if (mcContent.isQuestionsSequenced()) @@ -726,6 +832,14 @@ } + /** + * List buildQuestionAndCandidateAnswersDTO(HttpServletRequest request, McContent mcContent, IMcService mcService) + * + * @param request + * @param mcContent + * @param mcService + * @return + */ public static List buildQuestionAndCandidateAnswersDTO(HttpServletRequest request, McContent mcContent, IMcService mcService) { logger.debug("starting buildQuestionAndCandidateAnswersDTO"); @@ -760,6 +874,7 @@ mcLearnerAnswersDTO.setQuestionUid(mcQueContent.getUid().toString()); mcLearnerAnswersDTO.setWeight(mcQueContent.getWeight().toString()); + mcLearnerAnswersDTO.setMark(mcQueContent.getMark().toString()); mcLearnerAnswersDTO.setCandidateAnswerUids(mapCandidateAnswerUids); mcLearnerAnswersDTO.setCandidateAnswers(mapCandidateAnswers); @@ -775,6 +890,12 @@ } + /** + * Map convertToStringMap(List list) + * + * @param list + * @return + */ public static Map convertToStringMap(List list) { logger.debug("using convertToStringMap: " + list); @@ -793,7 +914,13 @@ } - + /** + * int getLearnerMarkAtLeast(Integer passMark, Map mapQuestionWeights) + * + * @param passMark + * @param mapQuestionWeights + * @return + */ public static int getLearnerMarkAtLeast(Integer passMark, Map mapQuestionWeights) { logger.debug("doing getLearnerMarkAtLeast"); @@ -815,6 +942,41 @@ } + /** + * int getMarksBasedLearnerMarkAtLeast(Integer passMark, Map mapQuestionMarks) + * + * @param passMark + * @param mapQuestionMarks + * @return + */ + public static int getMarksBasedLearnerMarkAtLeast(Integer passMark, Map mapQuestionMarks) + { + logger.debug("doing getMarksBasedLearnerMarkAtLeast: " + mapQuestionMarks); + logger.debug("passMark:" + passMark); + logger.debug("mapQuestionMarks:" + mapQuestionMarks); + + if ((passMark == null) || (passMark.intValue() == 0)) + { + logger.debug("no passMark.."); + return 0; + } + else if ((passMark != null) && (passMark.intValue() != 0)) + { + int minimumQuestionCountToPass=calculateMarksBasedMinimumQuestionCountToPass(passMark, mapQuestionMarks); + logger.debug("minimumQuestionCountToPass: " + minimumQuestionCountToPass); + return minimumQuestionCountToPass; + } + return 0; + } + + + /** + * int calculateMinimumQuestionCountToPass(Integer passMark, Map mapQuestionWeights) + * + * @param passMark + * @param mapQuestionWeights + * @return + */ public static int calculateMinimumQuestionCountToPass(Integer passMark, Map mapQuestionWeights) { logger.debug("calculating minimumQuestionCountToPass: mapQuestionWeights: " + mapQuestionWeights + " passmark: " + passMark); @@ -844,8 +1006,87 @@ logger.debug("returning minimumQuestionCount: " + minimumQuestionCount); return minimumQuestionCount; } + + /** + * int calculateMarksBasedMinimumQuestionCountToPass(Integer passMark, Map mapQuestionMarks) + * + * @param passMark + * @param mapQuestionMarks + * @return + */ + public static int calculateMarksBasedMinimumQuestionCountToPass(Integer passMark, Map mapQuestionMarks) + { + logger.debug("calculating minimumQuestionCountToPass: mapQuestionMarks: " + mapQuestionMarks + " passmark: " + passMark); + logger.debug("passMark: " + passMark); + logger.debug("original mapQuestionMarks: " + mapQuestionMarks); + + boolean mapExcluded=false; + int minimumQuestionCount=0; + int totalHighestMarks=0; + while (totalHighestMarks <= passMark.intValue()) + { + logger.debug("totalHighestMarks versus passMark: " + totalHighestMarks + " versus" + passMark); + int highestWeight=getHighestMark(mapQuestionMarks, mapExcluded); + logger.debug("highestWeight: " + highestWeight); + totalHighestMarks=totalHighestMarks + highestWeight; + logger.debug("totalHighestMarks: " + totalHighestMarks); + mapQuestionMarks=rebuildWeightsMapExcludeHighestWeight(mapQuestionMarks, highestWeight); + mapExcluded=true; + logger.debug("mapQuestionMarks: " + mapQuestionMarks); + ++minimumQuestionCount; + if (mapQuestionMarks.size() == 0) + { + logger.debug("no more marks: "); + break; + } + } + logger.debug("returning minimumQuestionCount: " + minimumQuestionCount); + return minimumQuestionCount; + } + + + /** + * int getHighestMark(Map mapQuestionMarks, boolean mapExcluded) + * + * @param mapQuestionMarks + * @param mapExcluded + * @return + */ + public static int getHighestMark(Map mapQuestionMarks, boolean mapExcluded) + { + logger.debug("mapExcluded: " + mapExcluded); + + if ((mapQuestionMarks.size() == 1) && (!mapExcluded)) + { + logger.debug("using map with 1 question only"); + /*the only alternative is 100*/ + return 100; + } + + logger.debug("continue excluding map"); + Iterator itMap = mapQuestionMarks.entrySet().iterator(); + int highestMark=0; + while (itMap.hasNext()) + { + Map.Entry pair = (Map.Entry)itMap.next(); + String mark=pair.getValue().toString(); + int intMark=new Integer(mark).intValue(); + + if (intMark > highestMark) + highestMark= intMark; + } + return highestMark; + } + + /** + * int getHighestWeight(Map mapQuestionWeights, boolean mapExcluded) + * + * @param mapQuestionWeights + * @param mapExcluded + * @return + */ public static int getHighestWeight(Map mapQuestionWeights, boolean mapExcluded) { logger.debug("mapExcluded: " + mapExcluded); @@ -873,6 +1114,13 @@ } + /** + * Map rebuildWeightsMapExcludeHighestWeight(Map mapQuestionWeights, int highestWeight) + * + * @param mapQuestionWeights + * @param highestWeight + * @return + */ public static Map rebuildWeightsMapExcludeHighestWeight(Map mapQuestionWeights, int highestWeight) { logger.debug("doing rebuildWeightsMapExcludeHighestWeight: " + mapQuestionWeights); @@ -903,16 +1151,56 @@ return mapWeightsExcludeHighestWeight; } + + /** + * Map rebuildMarksMapExcludeHighestMark(Map mapQuestionMarks, int highestMark) + * + * @param mapQuestionMarks + * @param highestMark + * @return + */ + public static Map rebuildMarksMapExcludeHighestMark(Map mapQuestionMarks, int highestMark) + { + logger.debug("doing rebuildMarksMapExcludeHighestMark: " + mapQuestionMarks); + logger.debug("using highestMark: " + highestMark); + + Map mapMarksExcludeHighestMark= new TreeMap(new McComparator()); + + Iterator itMap = mapQuestionMarks.entrySet().iterator(); + Long mapIndex=new Long(1); + while (itMap.hasNext()) + { + Map.Entry pair = (Map.Entry)itMap.next(); + String mark=pair.getValue().toString(); + int intMark=new Integer(mark).intValue(); + + logger.debug("intMark: " + intMark); + logger.debug("intMark versus highestMark:" + intMark + " versus" + highestMark); + if (intMark != highestMark) + { + mapMarksExcludeHighestMark.put(mapIndex.toString(),mark); + mapIndex=new Long(mapIndex.longValue()+1); + } + else + { + logger.debug("excluding highest weight from the reconstructed map: " + intMark); + } + } + logger.debug("returning mapWeightsExcludeHighestWeight: " + mapMarksExcludeHighestMark); + return mapMarksExcludeHighestMark; + } + + /** - * removes Learning session attributes + * * cleanUpLearningSession(HttpServletRequest request) + * removes Learning session attributes * * @param request */ public static void cleanUpLearningSession(HttpServletRequest request) { - //request.getSession().removeAttribute(USER_ID); request.getSession().removeAttribute(TOOL_CONTENT_ID); request.getSession().removeAttribute(TOOL_SESSION_ID); request.getSession().removeAttribute(QUESTION_LISTING_MODE); Index: lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/web/McDLStarterAction.java =================================================================== RCS file: /usr/local/cvsroot/lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/web/Attic/McDLStarterAction.java,v diff -u -r1.7 -r1.8 --- lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/web/McDLStarterAction.java 17 Sep 2006 06:23:44 -0000 1.7 +++ lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/web/McDLStarterAction.java 2 Oct 2006 01:59:34 -0000 1.8 @@ -27,45 +27,32 @@ * It reuses majority of the functionality from existing authoring module. * - - - + - - + + - - + */ /* $$Id$$ */ @@ -83,7 +70,6 @@ import org.apache.struts.action.ActionMapping; import org.lamsfoundation.lams.tool.mc.McAppConstants; import org.lamsfoundation.lams.tool.mc.McApplicationException; -import org.lamsfoundation.lams.tool.mc.McUtils; import org.lamsfoundation.lams.tool.mc.service.IMcService; import org.lamsfoundation.lams.tool.mc.service.McServiceProxy; @@ -93,14 +79,12 @@ public ActionForward execute(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException, McApplicationException { - McUtils.cleanUpSessionAbsolute(request); - logger.debug("init defineLater mode. removed attributes..."); + McAuthoringForm mcAuthoringForm = (McAuthoringForm) form; IMcService mcService = McServiceProxy.getMcService(getServlet().getServletContext()); - logger.debug("mcService: " + mcService); - request.getSession().setAttribute(TOOL_SERVICE, mcService); - + mcAuthoringForm.setMcService(mcService); + McStarterAction mcStarterAction= new McStarterAction(); - return mcStarterAction.executeDefineLater(mapping, form, request, response, mcService); + return mcStarterAction.executeDefineLater(mapping, mcAuthoringForm, request, response, mcService); } } Index: lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/web/McExportForm.java =================================================================== RCS file: /usr/local/cvsroot/lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/web/McExportForm.java,v diff -u -r1.5 -r1.6 --- lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/web/McExportForm.java 17 Sep 2006 06:23:44 -0000 1.5 +++ lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/web/McExportForm.java 2 Oct 2006 01:59:34 -0000 1.6 @@ -28,8 +28,8 @@ /** * @author Ozgur Demirtas + * */ - public class McExportForm extends ActionForm { static Logger logger = Logger.getLogger(McExportForm.class.getName()); Index: lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/web/McLearningAction.java =================================================================== RCS file: /usr/local/cvsroot/lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/web/McLearningAction.java,v diff -u -r1.44 -r1.45 --- lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/web/McLearningAction.java 17 Sep 2006 06:23:44 -0000 1.44 +++ lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/web/McLearningAction.java 2 Oct 2006 01:59:34 -0000 1.45 @@ -191,55 +191,36 @@ HttpServletResponse response) throws IOException, ServletException { - McUtils.cleanUpUserExceptions(request); McLearningForm mcLearningForm = (McLearningForm) form; LearningUtil.saveFormRequestData(request, mcLearningForm, false); return null; } + /** - * responds to learner activity in learner mode. - * - * ActionForward displayMc(ActionMapping mapping, + *displayMc(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException - * - * + * + * responds to learner activity in learner mode. + * * @param mapping * @param form * @param request * @param response * @return * @throws IOException * @throws ServletException - - - * - * ActionForward displayMc(ActionMapping mapping, - ActionForm form, - HttpServletRequest request, - HttpServletResponse response) throws IOException, - ServletException - * - * - * @param mapping - * @param form - * @param request - * @param response - * @return - * @throws IOException - * @throws ServletException */ public ActionForward displayMc(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException { - McUtils.cleanUpUserExceptions(request); McLearningForm mcLearningForm = (McLearningForm) form; IMcService mcService = McServiceProxy.getMcService(getServlet().getServletContext()); @@ -260,7 +241,7 @@ (!mcLearningForm.getNextQuestionSelected().equals(""))) { logger.debug("presenting next question..."); - LearningUtil.saveFormRequestData(request, mcLearningForm, false); + LearningUtil.saveFormRequestData(request, mcLearningForm, false); mcLearningForm.resetParameters(); setContentInUse(request, toolContentId, mcService); return getNextOptions(mapping, form, request, response); @@ -328,6 +309,21 @@ } + /** + * ActionForward endLearning(ActionMapping mapping, + ActionForm form, + HttpServletRequest request, + HttpServletResponse response) + + * + * @param mapping + * @param form + * @param request + * @param response + * @return + * @throws IOException + * @throws ServletException + */ public ActionForward endLearning(ActionMapping mapping, ActionForm form, HttpServletRequest request, @@ -477,7 +473,14 @@ - + /** + * Set parseLearnerInput(List learnerInput, McContent mcContent, IMcService mcService) + * + * @param learnerInput + * @param mcContent + * @param mcService + * @return + */ protected Set parseLearnerInput(List learnerInput, McContent mcContent, IMcService mcService) { logger.debug("learnerInput: " + learnerInput); @@ -530,6 +533,16 @@ } + /** + * List buildSelectedQuestionAndCandidateAnswersDTO(List learnerInput, McTempDataHolderDTO mcTempDataHolderDTO, + IMcService mcService, McContent mcContent) + + * @param learnerInput + * @param mcTempDataHolderDTO + * @param mcService + * @param mcContent + * @return + */ protected List buildSelectedQuestionAndCandidateAnswersDTO(List learnerInput, McTempDataHolderDTO mcTempDataHolderDTO, IMcService mcService, McContent mcContent) { @@ -539,6 +552,7 @@ logger.debug("learnerInput: " + learnerInput); int mark=0; int userWeight=0; + int userMarks=0; Set questionUids=parseLearnerInput(learnerInput, mcContent, mcService); logger.debug("set questionUids: " + questionUids); @@ -561,7 +575,17 @@ mcLearnerAnswersDTO.setDisplayOrder(mcQueContent.getDisplayOrder().toString()); mcLearnerAnswersDTO.setWeight(mcQueContent.getWeight().toString()); mcLearnerAnswersDTO.setQuestionUid(mcQueContent.getUid().toString()); + mcLearnerAnswersDTO.setMark(mcQueContent.getMark().toString()); + String feedback=mcQueContent.getFeedback(); + if (feedback == null) feedback=""; + logger.debug("feedback: " + feedback); + + feedback=McUtils.replaceNewLines(feedback); + logger.debug("feedback after procesing new lines: " + feedback); + + mcLearnerAnswersDTO.setFeedback(feedback); + Map caMap= new TreeMap(new McStringComparator()); Map caIdsMap= new TreeMap(new McStringComparator()); Long mapIndex=new Long(1); @@ -611,15 +635,21 @@ mcLearnerAnswersDTO.setAttemptCorrect(new Boolean(compareResult).toString()); if (compareResult) { - mcLearnerAnswersDTO.setFeedbackCorrect(mcQueContent.getFeedbackCorrect()); + mcLearnerAnswersDTO.setFeedbackCorrect(mcQueContent.getFeedback()); ++mark; int weight=mcQueContent.getWeight().intValue(); logger.debug("weight: " + weight); + + int currentMark=mcQueContent.getMark().intValue(); + logger.debug("currentMark: " + currentMark); + + userWeight=userWeight + weight; + userMarks=userMarks + currentMark;; } else { - mcLearnerAnswersDTO.setFeedbackIncorrect(mcQueContent.getFeedbackIncorrect()); + mcLearnerAnswersDTO.setFeedbackIncorrect(mcQueContent.getFeedback()); } logger.debug("assesment complete"); logger.debug("mark:: " + mark); @@ -629,21 +659,27 @@ logger.debug("final questionAndCandidateAnswersList: " + questionAndCandidateAnswersList); logger.debug("final mark: " + mark); logger.debug("final userWeight: " + userWeight); + logger.debug("final userMarks: " + userMarks); + mcTempDataHolderDTO.setLearnerMark(new Integer(mark).toString()); mcTempDataHolderDTO.setTotalUserWeight(new Integer(userWeight).toString()); + mcTempDataHolderDTO.setTotalUserMark(new Integer(userMarks).toString()); + logger.debug("mcTempDataHolderDTO before return : " + mcTempDataHolderDTO); + return questionAndCandidateAnswersList; } /** - * responses to learner when they answer all the questions on a single page * continueOptionsCombined(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) - * + * + * responses to learner when they answer all the questions on a single page + * * @param request * @param form * @param mapping @@ -655,7 +691,6 @@ HttpServletResponse response) throws IOException, ServletException { - McUtils.cleanUpUserExceptions(request); logger.debug("dispatching continueOptionsCombined..."); McLearningForm mcLearningForm = (McLearningForm) form; IMcService mcService = McServiceProxy.getMcService(getServlet().getServletContext()); @@ -770,7 +805,10 @@ String totalUserWeight=mcTempDataHolderDTO.getTotalUserWeight(); logger.debug("totalUserWeight: " + totalUserWeight); + String totalUserMark=mcTempDataHolderDTO.getTotalUserMark(); + logger.debug("totalUserMark: " + totalUserMark); + McGeneralLearnerFlowDTO mcGeneralLearnerFlowDTO=LearningUtil.buildMcGeneralLearnerFlowDTO(mcContent); logger.debug("constructed a new mcGeneralLearnerFlowDTO"); mcGeneralLearnerFlowDTO.setQuestionListingMode(QUESTION_LISTING_MODE_COMBINED); @@ -791,11 +829,11 @@ { mcGeneralLearnerFlowDTO.setPassMarkApplicable(new Boolean(true).toString()); - logger.debug("totalUserWeight versus passMark: " + totalUserWeight + " versus " + passMark); - if (new Integer(totalUserWeight).intValue() < passMark.intValue()) + logger.debug("totalUserMark versus passMark: " + totalUserMark + " versus " + passMark); + if (new Integer(totalUserMark).intValue() < passMark.intValue()) { logger.debug("USER FAILED"); - logger.debug("totalUserWeight is less than passmark: " + totalUserWeight + " < " + passMark.intValue()); + logger.debug("totalUserMark is less than passmark: " + totalUserMark + " < " + passMark.intValue()); passed=false; } else @@ -812,13 +850,6 @@ mcGeneralLearnerFlowDTO.setPassMarkApplicable(new Boolean(false).toString()); } - /* - if (!mcContent.isRetries()) - { - logger.debug("content is not isRetries. set passed to true"); - passed=true; - } - */ Long toolSessionUid=mcSession.getUid(); logger.debug("toolSessionUid: " + toolSessionUid); @@ -886,10 +917,14 @@ LearningUtil.createLearnerAttempt(request, mcQueUsr, selectedQuestionAndCandidateAnswersDTO, new Integer(learnerMark).intValue(), passed, new Integer(highestAttemptOrder).intValue(), null, mcService); logger.debug("created user attempt in the db"); - Map mapQuestionWeights=LearningUtil.buildWeightsMap(request, mcContent.getMcContentId(), mcService); - logger.debug("mapQuestionWeights:" + mapQuestionWeights); + //Map mapQuestionWeights=LearningUtil.buildWeightsMap(request, mcContent.getMcContentId(), mcService); + //logger.debug("mapQuestionWeights:" + mapQuestionWeights); - int learnerMarkAtLeast=LearningUtil.getLearnerMarkAtLeast(passMark,mapQuestionWeights); + Map mapQuestionMarks=LearningUtil.buildMarksMap(request, mcContent.getMcContentId(), mcService); + logger.debug("mapQuestionMarks:" + mapQuestionMarks); + + + int learnerMarkAtLeast=LearningUtil.getMarksBasedLearnerMarkAtLeast(passMark,mapQuestionMarks); logger.debug("learnerMarkAtLeast:" + learnerMarkAtLeast); mcGeneralLearnerFlowDTO.setLearnerMarkAtLeast (new Integer(learnerMarkAtLeast).toString()); @@ -910,11 +945,13 @@ /** - * takes the learner to the next set of questions + * * continueOptionsCombined(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) + + takes the learner to the next set of questions * * @param request * @param form @@ -927,7 +964,6 @@ HttpServletResponse response) throws IOException, ServletException { - McUtils.cleanUpUserExceptions(request); logger.debug("dispatching getNextOptions..."); McLearningForm mcLearningForm = (McLearningForm) form; IMcService mcService = McServiceProxy.getMcService(getServlet().getServletContext()); @@ -1028,12 +1064,14 @@ /** - * allows the learner to take the activity again + * * redoQuestions(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) * + * allows the learner to take the activity again + * * @param request * @param form * @param mapping @@ -1045,7 +1083,6 @@ HttpServletResponse response) throws IOException, ServletException { - McUtils.cleanUpUserExceptions(request); logger.debug("dispatching redoQuestions..."); McLearningForm mcLearningForm = (McLearningForm) form; IMcService mcService = McServiceProxy.getMcService(getServlet().getServletContext()); @@ -1117,6 +1154,17 @@ } + /** + * void prepareViewAnswersData(ActionMapping mapping, + McLearningForm mcLearningForm, + HttpServletRequest request, + HttpServletResponse response) + + * @param mapping + * @param mcLearningForm + * @param request + * @param response + */ public void prepareViewAnswersData(ActionMapping mapping, McLearningForm mcLearningForm, HttpServletRequest request, @@ -1169,11 +1217,12 @@ Map mapQuestionsUidContent=AuthoringUtil.rebuildQuestionUidMapfromDB(request, new Long(toolContentId), mcService); logger.debug("mapQuestionsUidContent:" + mapQuestionsUidContent); - + Map mapStartupGeneralOptionsContent=AuthoringUtil.rebuildStartupGeneralOptionsContentMapfromDB(request, mapQuestionsUidContent, mcService); logger.debug("mapStartupGeneralOptionsContent:" + mapStartupGeneralOptionsContent); mcGeneralLearnerFlowDTO.setMapGeneralOptionsContent(mapStartupGeneralOptionsContent); + Map mapQuestionsContent=AuthoringUtil.rebuildQuestionMapfromDB(request, new Long(toolContentId), mcService); logger.debug("mapQuestionsContent:" + mapQuestionsContent); mcGeneralLearnerFlowDTO.setMapQuestionsContent(mapQuestionsContent); @@ -1372,11 +1421,13 @@ /** - * allows the learner to view their answer history + * * viewAnswers(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) + + allows the learner to view their answer history * * @param request * @param form @@ -1399,12 +1450,14 @@ /** - * allows the learner to view all the other learners' activity summary + * * viewSummary(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) * + * allows the learner to view all the other learners' activity summary + * * @param request * @param form * @param mapping @@ -1416,7 +1469,6 @@ HttpServletResponse response) throws IOException, ServletException { - McUtils.cleanUpUserExceptions(request); logger.debug("dispatching viewSummary..."); McLearningForm mcLearningForm = (McLearningForm) form; IMcService mcService = McServiceProxy.getMcService(getServlet().getServletContext()); @@ -1494,13 +1546,17 @@ return (mapping.findForward(RESULTS_SUMMARY)); } + + /** - * to indicate that some learners are using the content - * marks the content as used content - * setContentInUse(HttpServletRequest request) + * setContentInUse(HttpServletRequest request, String toolContentId, IMcService mcService) * + * indicates that some learners are using the content + * * @param request + * @param toolContentId + * @param mcService */ protected void setContentInUse(HttpServletRequest request, String toolContentId, IMcService mcService) { @@ -1525,7 +1581,6 @@ */ public ActionForward redoQuestions(HttpServletRequest request, McLearningForm mcLearningForm, ActionMapping mapping) { - McUtils.cleanUpUserExceptions(request); logger.debug("requested redoQuestions..."); IMcService mcService = McServiceProxy.getMcService(getServlet().getServletContext()); @@ -1578,6 +1633,19 @@ saveErrors(request,errors); } + + /** + * submitReflection(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) + * + * @param mapping + * @param form + * @param request + * @param response + * @return + * @throws IOException + * @throws ServletException + * @throws ToolException + */ public ActionForward submitReflection(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException, ToolException { @@ -1651,6 +1719,18 @@ } + /** + * forwardtoReflection(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) + * + * @param mapping + * @param form + * @param request + * @param response + * @return + * @throws IOException + * @throws ServletException + * @throws ToolException + */ public ActionForward forwardtoReflection(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException, ToolException { @@ -1668,7 +1748,6 @@ McContent mcContent=mcSession.getMcContent(); logger.debug("using mcContent: " + mcContent); - McGeneralLearnerFlowDTO mcGeneralLearnerFlowDTO= new McGeneralLearnerFlowDTO(); mcGeneralLearnerFlowDTO.setActivityTitle(mcContent.getTitle()); String reflectionSubject=mcContent.getReflectionSubject(); @@ -1682,6 +1761,5 @@ logger.debug("fwd'ing to: " + NOTEBOOK); return (mapping.findForward(NOTEBOOK)); } - } \ No newline at end of file Index: lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/web/McLearningForm.java =================================================================== RCS file: /usr/local/cvsroot/lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/web/McLearningForm.java,v diff -u -r1.26 -r1.27 --- lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/web/McLearningForm.java 17 Sep 2006 06:23:44 -0000 1.26 +++ lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/web/McLearningForm.java 2 Oct 2006 01:59:34 -0000 1.27 @@ -74,6 +74,9 @@ protected String nextQuestionSelected; protected String httpSessionID; + protected String responseId; + protected String sessionId; + public IMcService mcService; @@ -490,4 +493,28 @@ public void setEntryText(String entryText) { this.entryText = entryText; } + /** + * @return Returns the responseId. + */ + public String getResponseId() { + return responseId; + } + /** + * @param responseId The responseId to set. + */ + public void setResponseId(String responseId) { + this.responseId = responseId; + } + /** + * @return Returns the sessionId. + */ + public String getSessionId() { + return sessionId; + } + /** + * @param sessionId The sessionId to set. + */ + public void setSessionId(String sessionId) { + this.sessionId = sessionId; + } } Index: lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/web/McLearningStarterAction.java =================================================================== RCS file: /usr/local/cvsroot/lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/web/McLearningStarterAction.java,v diff -u -r1.68 -r1.69 --- lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/web/McLearningStarterAction.java 17 Sep 2006 06:23:44 -0000 1.68 +++ lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/web/McLearningStarterAction.java 2 Oct 2006 01:59:34 -0000 1.69 @@ -164,17 +164,13 @@ public class McLearningStarterAction extends Action implements McAppConstants { static Logger logger = Logger.getLogger(McLearningStarterAction.class.getName()); - /* Since the toolSessionId is passed, we will derive toolContentId from the toolSessionId - * This class is used to load the default content and initialize the presentation Map for Learner mode - */ public ActionForward execute(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException, McApplicationException { /* * By now, the passed tool session id MUST exist in the db through the calling of: * public void createToolSession(Long toolSessionId, Long toolContentId) by the container. - * * * make sure this session exists in tool's session table by now. */ @@ -206,7 +202,6 @@ request.getSession().setAttribute(sessionMap.getSessionID(), sessionMap); mcLearningForm.setHttpSessionID(sessionMap.getSessionID()); - String toolSessionID=request.getParameter(AttributeNames.PARAM_TOOL_SESSION_ID); logger.debug("retrieved toolSessionID: " + toolSessionID); mcLearningForm.setToolSessionID(new Long(toolSessionID).toString()); @@ -283,8 +278,7 @@ teacher learner */ - /* ? CHECK THIS: how do we determine whether preview is requested? Mode is not enough on its own.*/ - + /*handle PREVIEW mode*/ //String mode=mcLearningForm.getLearningMode(); String mode=request.getParameter(MODE); @@ -318,9 +312,7 @@ logger.debug("mcQueUsr: " + mcQueUsr); if (mcQueUsr == null) { - McUtils.cleanUpSessionAbsolute(request); - persistError(request, "error.learner.required"); - return (mapping.findForward(ERROR_LIST)); + logger.error("error.learner.required"); } /* check whether the user's session really referrs to the session id passed to the url*/ @@ -335,9 +327,7 @@ if ((mcSessionLocal == null) || (mcSessionLocal.getMcSessionId().longValue() != new Long(toolSessionID).longValue())) { - McUtils.cleanUpSessionAbsolute(request); - //persistError(request, "error.learner.sessionId.inconsistent"); - return (mapping.findForward(ERROR_LIST)); + logger.error("error.learner.sessionId.inconsistent"); } LearningUtil.saveFormRequestData(request, mcLearningForm, true); logger.debug("learnerProgress before presenting learner Progress screen: " + mcLearningForm.getLearnerProgress()); @@ -355,8 +345,6 @@ logger.debug("the activity is offline."); logger.debug("MC_GENERAL_LEARNER_FLOW_DTO: " + request.getAttribute(MC_GENERAL_LEARNER_FLOW_DTO)); - //McUtils.cleanUpSessionAbsolute(request); - logger.debug("fwding to :" + RUN_OFFLINE); return (mapping.findForward(RUN_OFFLINE)); } @@ -366,7 +354,6 @@ logger.debug("isDefineLater: " + isDefineLater); if (isDefineLater == true) { - //McUtils.cleanUpSessionAbsolute(request); logger.debug("fwding to :" + DEFINE_LATER); return (mapping.findForward(DEFINE_LATER)); } @@ -565,9 +552,7 @@ long toolSessionId=0; if ((strToolSessionId == null) || (strToolSessionId.length() == 0)) { - McUtils.cleanUpSessionAbsolute(request); - persistError(request, "error.toolSessionId.required"); - return (mapping.findForward(ERROR_LIST)); + logger.error("error.toolSessionId.required"); } else { @@ -578,10 +563,7 @@ } catch(NumberFormatException e) { - McUtils.cleanUpSessionAbsolute(request); - persistError(request, "error.sessionId.numberFormatException"); - logger.debug("add error.sessionId.numberFormatException to ActionMessages."); - return (mapping.findForward(ERROR_LIST)); + logger.error("error.sessionId.numberFormatException"); } } @@ -591,16 +573,12 @@ if ((mode == null) || (mode.length() == 0)) { - McUtils.cleanUpSessionAbsolute(request); - //persistError(request, "error.mode.required"); - return (mapping.findForward(ERROR_LIST)); + logger.error("error.mode.required"); } if ((!mode.equals("learner")) && (!mode.equals("teacher")) && (!mode.equals("author"))) { - McUtils.cleanUpSessionAbsolute(request); - persistError(request, "error.mode.invalid"); - return (mapping.findForward(ERROR_LIST)); + logger.error("error.mode.invalid"); } logger.debug("session LEARNING_MODE set to:" + mode); Index: lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/web/McMonitoringAction.java =================================================================== RCS file: /usr/local/cvsroot/lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/web/McMonitoringAction.java,v diff -u -r1.28 -r1.29 --- lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/web/McMonitoringAction.java 17 Sep 2006 06:23:44 -0000 1.28 +++ lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/web/McMonitoringAction.java 2 Oct 2006 01:59:34 -0000 1.29 @@ -23,9 +23,12 @@ package org.lamsfoundation.lams.tool.mc.web; import java.io.IOException; +import java.util.ArrayList; import java.util.Iterator; import java.util.LinkedList; import java.util.List; +import java.util.Map; +import java.util.TreeMap; import javax.servlet.ServletException; import javax.servlet.http.HttpServletRequest; @@ -38,21 +41,31 @@ import org.apache.struts.action.ActionMapping; import org.apache.struts.action.ActionMessage; import org.apache.struts.action.ActionMessages; -import org.lamsfoundation.lams.contentrepository.RepositoryCheckedException; import org.lamsfoundation.lams.notebook.model.NotebookEntry; import org.lamsfoundation.lams.notebook.service.CoreNotebookConstants; import org.lamsfoundation.lams.tool.exception.ToolException; +import org.lamsfoundation.lams.tool.mc.EditActivityDTO; +import org.lamsfoundation.lams.tool.mc.ExportPortfolioDTO; import org.lamsfoundation.lams.tool.mc.McAppConstants; import org.lamsfoundation.lams.tool.mc.McApplicationException; +import org.lamsfoundation.lams.tool.mc.McCandidateAnswersDTO; +import org.lamsfoundation.lams.tool.mc.McComparator; +import org.lamsfoundation.lams.tool.mc.McGeneralAuthoringDTO; import org.lamsfoundation.lams.tool.mc.McGeneralLearnerFlowDTO; +import org.lamsfoundation.lams.tool.mc.McGeneralMonitoringDTO; +import org.lamsfoundation.lams.tool.mc.McQuestionContentDTO; import org.lamsfoundation.lams.tool.mc.McUtils; import org.lamsfoundation.lams.tool.mc.ReflectionDTO; import org.lamsfoundation.lams.tool.mc.pojos.McContent; +import org.lamsfoundation.lams.tool.mc.pojos.McQueContent; import org.lamsfoundation.lams.tool.mc.pojos.McQueUsr; import org.lamsfoundation.lams.tool.mc.pojos.McSession; import org.lamsfoundation.lams.tool.mc.service.IMcService; import org.lamsfoundation.lams.tool.mc.service.McServiceProxy; +import org.lamsfoundation.lams.util.WebUtil; import org.lamsfoundation.lams.web.action.LamsDispatchAction; +import org.lamsfoundation.lams.web.util.AttributeNames; +import org.lamsfoundation.lams.web.util.SessionMap; /** * * @author Ozgur Demirtas @@ -74,36 +87,58 @@ + validate="false"> + + + + - + + + - + + name="editQuestionBox" + path="/monitoring/editQuestionBox.jsp" + redirect="false" + /> + + * */ public class McMonitoringAction extends LamsDispatchAction implements McAppConstants @@ -144,163 +179,463 @@ HttpServletResponse response) throws IOException, ServletException { - McUtils.cleanUpUserExceptions(request); logger.debug("dispatching unspecified..."); - request.getSession().setAttribute(IS_MONITORED_CONTENT_IN_USE, new Boolean(false).toString()); - McMonitoringForm mcMonitoringForm = (McMonitoringForm) form; return null; } - - + + /** - * gets called when the user selects a group from dropdown box in the summary tab - * submitSession(ActionMapping mapping, - ActionForm form, - HttpServletRequest request, - HttpServletResponse response) throws IOException, - ServletException + * submitSession * + * enables getting monitoring data for different sessions + * * @param mapping * @param form * @param request * @param response + * @param mcService + * @param mcGeneralMonitoringDTO * @return * @throws IOException * @throws ServletException */ public ActionForward submitSession(ActionMapping mapping, ActionForm form, HttpServletRequest request, - HttpServletResponse response) throws IOException, + HttpServletResponse response, + IMcService mcService, + McGeneralMonitoringDTO mcGeneralMonitoringDTO + ) throws IOException, ServletException { - McUtils.cleanUpUserExceptions(request); - logger.debug("dispatching submitSession..."); - request.getSession().setAttribute(IS_MONITORED_CONTENT_IN_USE, new Boolean(false).toString()); - McMonitoringForm mcMonitoringForm = (McMonitoringForm) form; - IMcService mcService =McUtils.getToolService(request); - if (mcService == null) - { - logger.debug("will retrieve mcService"); - mcService = McServiceProxy.getMcService(getServlet().getServletContext()); - logger.debug("retrieving mcService from cache: " + mcService); - } - request.getSession().setAttribute(TOOL_SERVICE, mcService); - - String currentMonitoredToolSession=mcMonitoringForm.getSelectedToolSessionId(); + logger.debug("calling submitSession...mcGeneralMonitoringDTO:" + mcGeneralMonitoringDTO); + commonSubmitSessionCode(form, request, mcService,mcGeneralMonitoringDTO); + logger.debug("post commonSubmitSessionCode: " +mcGeneralMonitoringDTO); + return (mapping.findForward(LOAD_MONITORING)); + } + + + /** + * commonSubmitSessionCode(ActionForm form, HttpServletRequest request,IMcService mcService, + McGeneralMonitoringDTO mcGeneralMonitoringDTO) + * + * @param form + * @param request + * @param mcService + * @param mcGeneralMonitoringDTO + * @throws IOException + * @throws ServletException + */ + protected void commonSubmitSessionCode(ActionForm form, HttpServletRequest request,IMcService mcService, + McGeneralMonitoringDTO mcGeneralMonitoringDTO) throws IOException, ServletException + { + logger.debug("starting commonSubmitSessionCode...mcGeneralMonitoringDTO:" + mcGeneralMonitoringDTO); + + logger.debug("mcService:" + mcService); + McMonitoringForm mcMonitoringForm = (McMonitoringForm) form; + + repopulateRequestParameters(request, mcMonitoringForm, mcGeneralMonitoringDTO); + logger.debug("done repopulateRequestParameters"); + + String currentMonitoredToolSession=request.getParameter("monitoredToolSessionId"); logger.debug("currentMonitoredToolSession: " + currentMonitoredToolSession); - if (currentMonitoredToolSession.equals("All")) + if (currentMonitoredToolSession == null) { - request.getSession().setAttribute(SELECTION_CASE, new Long(2)); + logger.debug("default to All"); + currentMonitoredToolSession="All"; } + + + String toolContentID =mcMonitoringForm.getToolContentID(); + logger.debug("toolContentID: " + toolContentID); + + McContent mcContent=mcService.retrieveMc(new Long(toolContentID)); + logger.debug("existing mcContent:" + mcContent); + + + if (currentMonitoredToolSession.equals("All")) + { + List listMcAllSessionsDTO = new LinkedList(); + logger.debug("generate DTO for All sessions: "); + MonitoringUtil.setupAllSessionsData(request, mcContent,mcService); + + mcGeneralMonitoringDTO.setSelectionCase(new Long(2)); + request.setAttribute(SELECTION_CASE, new Long(2)); + } else { - /* SELECTION_CASE == 1 indicates a selected group other than "All" */ - request.getSession().setAttribute(SELECTION_CASE, new Long(1)); McSession mcSession=mcService.retrieveMcSession(new Long(currentMonitoredToolSession)); - request.getSession().setAttribute(CURRENT_MONITORED_TOOL_SESSION_NAME, mcSession.getSession_name()); + logger.debug("mcSession uid:" + mcSession.getUid()); + + MonitoringUtil.setupAllSessionsData(request, mcContent,mcService); + + logger.debug("session_name: " + mcSession.getSession_name()); + mcGeneralMonitoringDTO.setGroupName(mcSession.getSession_name()); + mcGeneralMonitoringDTO.setSelectionCase(new Long(1)); + request.setAttribute(SELECTION_CASE, new Long(1)); } - logger.debug("SELECTION_CASE: " + request.getSession().getAttribute(SELECTION_CASE)); + logger.debug("SELECTION_CASE: " + mcGeneralMonitoringDTO.getSelectionCase()); + + logger.debug("SELECTION_CASE: " + request.getAttribute(SELECTION_CASE)); + request.setAttribute(CURRENT_MONITORED_TOOL_SESSION, currentMonitoredToolSession); + + mcGeneralMonitoringDTO.setCurrentMonitoredToolSession(currentMonitoredToolSession); + mcGeneralMonitoringDTO.setSbmtSuccess(new Boolean(false).toString()); + mcGeneralMonitoringDTO.setRequestLearningReport(new Boolean(false).toString()); - request.getSession().setAttribute(CURRENT_MONITORED_TOOL_SESSION, currentMonitoredToolSession); - logger.debug("CURRENT_MONITORED_TOOL_SESSION: " + request.getSession().getAttribute(CURRENT_MONITORED_TOOL_SESSION)); - logger.debug("CURRENT_MONITORED_TOOL_SESSION_NAME: " + request.getSession().getAttribute(CURRENT_MONITORED_TOOL_SESSION_NAME)); - - Long toolContentId =(Long) request.getSession().getAttribute(TOOL_CONTENT_ID); - logger.debug("toolContentId: " + toolContentId); - - McContent mcContent=mcService.retrieveMc(toolContentId); - logger.debug("mcContent:" + mcContent); - MonitoringUtil.setAttributeNoToolSessions(request, mcService, mcContent); + Map summaryToolSessions=MonitoringUtil.populateToolSessions(request, mcContent, mcService); + logger.debug("summaryToolSessions: " + summaryToolSessions); + mcGeneralMonitoringDTO.setSummaryToolSessions(summaryToolSessions); + + Map summaryToolSessionsId=MonitoringUtil.populateToolSessionsId(request, mcContent, mcService); + logger.debug("summaryToolSessionsId: " + summaryToolSessionsId); + mcGeneralMonitoringDTO.setSummaryToolSessionsId(summaryToolSessionsId); + + logger.debug("calling initStatsContent."); + initStatsContent(toolContentID, request, mcService, mcGeneralMonitoringDTO); + logger.debug("post initStatsContent, mcGeneralMonitoringDTO: " + mcGeneralMonitoringDTO); + - prepareReflectionData(request, mcContent, mcService, null,false); - return (mapping.findForward(LOAD_MONITORING_CONTENT)); - } + /*setting editable screen properties*/ + McGeneralAuthoringDTO mcGeneralAuthoringDTO= new McGeneralAuthoringDTO(); + mcGeneralAuthoringDTO.setActivityTitle(mcContent.getTitle()); + mcGeneralAuthoringDTO.setActivityInstructions(mcContent.getInstructions()); + + Map mapOptionsContent= new TreeMap(new McComparator()); + Iterator queIterator=mcContent.getMcQueContents().iterator(); + Long mapIndex=new Long(1); + logger.debug("mapOptionsContent: " + mapOptionsContent); + while (queIterator.hasNext()) + { + McQueContent mcQueContent=(McQueContent) queIterator.next(); + if (mcQueContent != null) + { + logger.debug("question: " + mcQueContent.getQuestion()); + mapOptionsContent.put(mapIndex.toString(),mcQueContent.getQuestion()); + + mapIndex=new Long(mapIndex.longValue()+1); + } + } + + logger.debug("mapOptionsContent: " + mapOptionsContent); + int maxIndex=mapOptionsContent.size(); + logger.debug("maxIndex: " + maxIndex); + + boolean isContentInUse=McUtils.isContentInUse(mcContent); + logger.debug("isContentInUse:" + isContentInUse); + mcGeneralMonitoringDTO.setIsMonitoredContentInUse(new Boolean(false).toString()); + if (isContentInUse == true) + { + logger.debug("monitoring url does not allow editActivity since the content is in use."); + mcGeneralMonitoringDTO.setIsMonitoredContentInUse(new Boolean(true).toString()); + } + + logger.debug("mcGeneralAuthoringDTO: " + mcGeneralAuthoringDTO); + request.setAttribute(MC_GENERAL_AUTHORING_DTO, mcGeneralAuthoringDTO); + + prepareReflectionData(request, mcContent, mcService, null, false, "All"); + + if (mcService.studentActivityOccurredGlobal(mcContent)) + { + logger.debug("USER_EXCEPTION_NO_TOOL_SESSIONS is set to false"); + mcGeneralMonitoringDTO.setUserExceptionNoToolSessions(new Boolean(false).toString()); + } + else + { + logger.debug("USER_EXCEPTION_NO_TOOL_SESSIONS is set to true"); + mcGeneralMonitoringDTO.setUserExceptionNoToolSessions(new Boolean(true).toString()); + } + + /**getting instructions screen content from here... */ + mcGeneralMonitoringDTO.setOnlineInstructions(mcContent.getOnlineInstructions()); + mcGeneralMonitoringDTO.setOfflineInstructions(mcContent.getOfflineInstructions()); + + List attachmentList = mcService.retrieveMcUploadedFiles(mcContent); + logger.debug("attachmentList: " + attachmentList); + mcGeneralMonitoringDTO.setAttachmentList(attachmentList); + mcGeneralMonitoringDTO.setDeletedAttachmentList(new ArrayList()); + /** ...till here **/ + + + logger.debug("end of commonSubmitSessionCode, mcGeneralMonitoringDTO: " + mcGeneralMonitoringDTO); + request.setAttribute(MC_GENERAL_MONITORING_DTO, mcGeneralMonitoringDTO); + + EditActivityDTO editActivityDTO = new EditActivityDTO(); + logger.debug("isContentInUse:" + isContentInUse); + if (isContentInUse == true) + { + editActivityDTO.setMonitoredContentInUse(new Boolean(true).toString()); + } + request.setAttribute(EDIT_ACTIVITY_DTO, editActivityDTO); + + + /*find out if there are any reflection entries, from here*/ + boolean notebookEntriesExist=MonitoringUtil.notebookEntriesExist(mcService, mcContent); + logger.debug("notebookEntriesExist : " + notebookEntriesExist); + + if (notebookEntriesExist) + { + request.setAttribute(NOTEBOOK_ENTRIES_EXIST, new Boolean(true).toString()); + + String userExceptionNoToolSessions=(String)mcGeneralMonitoringDTO.getUserExceptionNoToolSessions(); + logger.debug("userExceptionNoToolSessions : " + userExceptionNoToolSessions); + + if (userExceptionNoToolSessions.equals("true")) + { + logger.debug("there are no online student activity but there are reflections : "); + request.setAttribute(NO_SESSIONS_NOTEBOOK_ENTRIES_EXIST, new Boolean(true).toString()); + } + } + else + { + request.setAttribute(NOTEBOOK_ENTRIES_EXIST, new Boolean(false).toString()); + } + /* ... till here*/ + + MonitoringUtil.buildMcStatsDTO(request,mcService, mcContent); + + MonitoringUtil.setupAllSessionsData(request, mcContent,mcService); + + logger.debug("dumping jsp controllers: "); + logger.debug("dumping jsp controlllers, mcGeneralMonitoringDTO, mcGeneralMonitoringDTO.getIsMonitoredContentInUse():" + mcGeneralMonitoringDTO.getIsMonitoredContentInUse()); + logger.debug("dumping jsp controlllers, mcGeneralMonitoringDTO, mcGeneralMonitoringDTO.getUserExceptionNoToolSessions():" + mcGeneralMonitoringDTO.getUserExceptionNoToolSessions()); + logger.debug("dumping jsp controlllers, mcGeneralMonitoringDTO, mcGeneralMonitoringDTO.getCurrentMonitoredToolSession():" + mcGeneralMonitoringDTO.getCurrentMonitoredToolSession()); + logger.debug("dumping jsp controlllers, mcGeneralMonitoringDTO, mcGeneralMonitoringDTO.getSelectionCase(): " + mcGeneralMonitoringDTO.getSelectionCase()); + + + logger.debug("dumping request level controlllers, REQUEST selectionCase: " + request.getAttribute(SELECTION_CASE)); + } - + /** - * reuses the define later functionality - * editActivity(ActionMapping mapping, - ActionForm form, - HttpServletRequest request, - HttpServletResponse response) throws IOException, - ServletException + * refreshSummaryData(HttpServletRequest request, McContent mcContent, IMcService mcService, + boolean isUserNamesVisible, boolean isLearnerRequest, String currentSessionId, String userId, + boolean showUserEntriesBySession, McGeneralLearnerFlowDTO mcGeneralLearnerFlowDTO, + McGeneralMonitoringDTO mcGeneralMonitoringDTO, ExportPortfolioDTO exportPortfolioDTO) + + * refreshes summary data * - * @param mapping - * @param form * @param request - * @param response - * @return - * @throws IOException - * @throws ServletException + * @param mcContent + * @param mcService + * @param isUserNamesVisible + * @param isLearnerRequest + * @param currentSessionId + * @param userId + * @param showUserEntriesBySession + * @param mcGeneralLearnerFlowDTO + * @param mcGeneralMonitoringDTO + * @param exportPortfolioDTO */ - public ActionForward editActivity(ActionMapping mapping, - ActionForm form, - HttpServletRequest request, - HttpServletResponse response) throws IOException, - ServletException + public void refreshSummaryData(HttpServletRequest request, McContent mcContent, IMcService mcService, + boolean isUserNamesVisible, boolean isLearnerRequest, String currentSessionId, String userId, + boolean showUserEntriesBySession, McGeneralLearnerFlowDTO mcGeneralLearnerFlowDTO, + McGeneralMonitoringDTO mcGeneralMonitoringDTO, ExportPortfolioDTO exportPortfolioDTO) { - McUtils.cleanUpUserExceptions(request); - logger.debug("dispatching editActivity..."); - request.getSession().setAttribute(IS_MONITORED_CONTENT_IN_USE, new Boolean(false).toString()); - McMonitoringForm mcMonitoringForm = (McMonitoringForm) form; - IMcService mcService =McUtils.getToolService(request); - logger.debug("mcService: " + mcService); - - if (mcService == null) + logger.debug("doing refreshSummaryData." + mcGeneralLearnerFlowDTO); + logger.debug("mcGeneralMonitoringDTO:" + mcGeneralMonitoringDTO); + logger.debug("exportPortfolioDTO:" + exportPortfolioDTO); + + if (mcService == null) { logger.debug("will retrieve mcService"); mcService = McServiceProxy.getMcService(getServlet().getServletContext()); - logger.debug("retrieving mcService from cache: " + mcService); + logger.debug("retrieving mcService from session: " + mcService); } - request.getSession().setAttribute(TOOL_SERVICE, mcService); - - request.getSession().setAttribute(CURRENT_MONITORING_TAB, "editActivity"); - - McStarterAction mcStarterAction= new McStarterAction(); - request.getSession().setAttribute(TOOL_SERVICE, mcService); - Long toolContentId =(Long) request.getSession().getAttribute(TOOL_CONTENT_ID); - logger.debug("toolContentId: " + toolContentId); - - request.setAttribute(SOURCE_MC_STARTER, "monitoring"); - logger.debug("SOURCE_MC_STARTER: monitoring"); + logger.debug("mcService: " + mcService); + + logger.debug("isUserNamesVisible: " + isUserNamesVisible); + logger.debug("isLearnerRequest: " + isLearnerRequest); + + /* this section is related to summary tab. Starts here. */ + Map summaryToolSessions=MonitoringUtil.populateToolSessions(request, mcContent, mcService); + logger.debug("summaryToolSessions: " + summaryToolSessions); + + if (mcService.studentActivityOccurredGlobal(mcContent)) + { + if (mcGeneralMonitoringDTO != null) + mcGeneralMonitoringDTO.setUserExceptionNoToolSessions(new Boolean(false).toString()); + logger.debug("USER_EXCEPTION_NO_TOOL_SESSIONS is set to false"); + } + else + { + if (mcGeneralMonitoringDTO != null) + mcGeneralMonitoringDTO.setUserExceptionNoToolSessions(new Boolean(true).toString()); + logger.debug("USER_EXCEPTION_NO_TOOL_SESSIONS is set to true"); + } + + String userExceptionNoToolSessions=mcGeneralMonitoringDTO.getUserExceptionNoToolSessions(); + logger.debug("userExceptionNoToolSessions: " + userExceptionNoToolSessions); + if (exportPortfolioDTO != null) + { + exportPortfolioDTO.setUserExceptionNoToolSessions(userExceptionNoToolSessions); + } + + Map summaryToolSessionsId=MonitoringUtil.populateToolSessionsId(request, mcContent, mcService); + logger.debug("summaryToolSessionsId: " + summaryToolSessionsId); + logger.debug("currentSessionId: " + currentSessionId); - /* it is possible that the content is being used by some learners. In this situation, the content is marked as "in use" and - content in use is not modifiable*/ - McContent mcContent=mcService.retrieveMc(toolContentId); - logger.debug("mcContent:" + mcContent); + if ((currentSessionId != null) && (!currentSessionId.equals("All"))) + { + McSession mcSession= mcService.retrieveMcSession(new Long(currentSessionId)); + logger.debug("mcSession:" + mcSession); + if (mcGeneralMonitoringDTO != null) + mcGeneralMonitoringDTO.setGroupName(mcSession.getSession_name()); + } + else + { + mcGeneralMonitoringDTO.setGroupName("All Groups"); + } + + logger.debug("using allUsersData to retrieve data: " + isUserNamesVisible); + + List listMonitoredAnswersContainerDTO = new LinkedList(); + logger.debug("listMonitoredAnswersContainerDTO: " + listMonitoredAnswersContainerDTO); + /* ends here. */ + + logger.debug("decide processing user entered values based on isLearnerRequest: " + isLearnerRequest); + + + if (exportPortfolioDTO != null) + { + logger.debug("placing dtos within the exportPortfolioDTO: "); + exportPortfolioDTO.setListMonitoredAnswersContainerDto(listMonitoredAnswersContainerDTO); + } + + + if (mcGeneralMonitoringDTO != null) + { + mcGeneralMonitoringDTO.setSummaryToolSessions(summaryToolSessions); + mcGeneralMonitoringDTO.setSummaryToolSessionsId(summaryToolSessionsId); + mcGeneralMonitoringDTO.setSelectionCase(new Long(2)); + mcGeneralMonitoringDTO.setCurrentMonitoredToolSession("All"); + mcGeneralMonitoringDTO.setListMonitoredAnswersContainerDto(listMonitoredAnswersContainerDTO); + + mcGeneralMonitoringDTO.setExistsOpenMcs(new Boolean(false).toString()); + } + + logger.debug("final mcGeneralLearnerFlowDTO: " + mcGeneralLearnerFlowDTO); + logger.debug("final mcGeneralMonitoringDTO: " + mcGeneralMonitoringDTO); + boolean isContentInUse=McUtils.isContentInUse(mcContent); logger.debug("isContentInUse:" + isContentInUse); - + mcGeneralMonitoringDTO.setIsMonitoredContentInUse(new Boolean(false).toString()); if (isContentInUse == true) { - McUtils.cleanUpSessionAbsolute(request); logger.debug("monitoring url does not allow editActivity since the content is in use."); - persistError(request,"error.content.inUse"); - request.getSession().setAttribute(IS_MONITORED_CONTENT_IN_USE, new Boolean(true).toString()); - logger.debug("forwarding to: " + LOAD_MONITORING_CONTENT); - return (mapping.findForward(LOAD_MONITORING_CONTENT)); + mcGeneralMonitoringDTO.setIsMonitoredContentInUse(new Boolean(true).toString()); } + + prepareReflectionData(request, mcContent, mcService, null, false, "All"); + if (mcService.studentActivityOccurredGlobal(mcContent)) + { + logger.debug("USER_EXCEPTION_NO_TOOL_SESSIONS is set to false"); + mcGeneralMonitoringDTO.setUserExceptionNoToolSessions(new Boolean(false).toString()); + } + else + { + logger.debug("USER_EXCEPTION_NO_TOOL_SESSIONS is set to true"); + mcGeneralMonitoringDTO.setUserExceptionNoToolSessions(new Boolean(true).toString()); + } + + /**getting instructions screen content from here... */ + mcGeneralMonitoringDTO.setOnlineInstructions(mcContent.getOnlineInstructions()); + mcGeneralMonitoringDTO.setOfflineInstructions(mcContent.getOfflineInstructions()); - MonitoringUtil.setAttributeNoToolSessions(request, mcService, mcContent); + List attachmentList = mcService.retrieveMcUploadedFiles(mcContent); + logger.debug("attachmentList: " + attachmentList); + mcGeneralMonitoringDTO.setAttachmentList(attachmentList); + mcGeneralMonitoringDTO.setDeletedAttachmentList(new ArrayList()); + /** ...till here **/ - prepareReflectionData(request, mcContent, mcService, null,false); - return mcStarterAction.executeDefineLater(mapping, form, request, response, mcService); + + logger.debug("end of refreshSummaryData, mcGeneralMonitoringDTO" + mcGeneralMonitoringDTO); + request.setAttribute(MC_GENERAL_MONITORING_DTO, mcGeneralMonitoringDTO); + + EditActivityDTO editActivityDTO = new EditActivityDTO(); + isContentInUse=McUtils.isContentInUse(mcContent); + logger.debug("isContentInUse:" + isContentInUse); + if (isContentInUse == true) + { + editActivityDTO.setMonitoredContentInUse(new Boolean(true).toString()); + } + request.setAttribute(EDIT_ACTIVITY_DTO, editActivityDTO); + + + /*find out if there are any reflection entries, from here*/ + boolean notebookEntriesExist=MonitoringUtil.notebookEntriesExist(mcService, mcContent); + logger.debug("notebookEntriesExist : " + notebookEntriesExist); + + if (notebookEntriesExist) + { + request.setAttribute(NOTEBOOK_ENTRIES_EXIST, new Boolean(true).toString()); + + userExceptionNoToolSessions=(String)mcGeneralMonitoringDTO.getUserExceptionNoToolSessions(); + logger.debug("userExceptionNoToolSessions : " + userExceptionNoToolSessions); + + if (userExceptionNoToolSessions.equals("true")) + { + logger.debug("there are no online student activity but there are reflections : "); + request.setAttribute(NO_SESSIONS_NOTEBOOK_ENTRIES_EXIST, new Boolean(true).toString()); + } + } + else + { + request.setAttribute(NOTEBOOK_ENTRIES_EXIST, new Boolean(false).toString()); + } + /* ... till here*/ + + MonitoringUtil.buildMcStatsDTO(request,mcService, mcContent); + + MonitoringUtil.setupAllSessionsData(request, mcContent,mcService); } + - /** - * editActivityQuestions(ActionMapping mapping, + /** + * ActionForward submitSession(ActionMapping mapping, ActionForm form, HttpServletRequest request, - HttpServletResponse response) throws IOException, - ServletException, - ToolException + HttpServletResponse response) + * + * submitSession + * + * @param mapping + * @param form + * @param request + * @param response + * @return + * @throws IOException + * @throws ServletException + */ + public ActionForward submitSession(ActionMapping mapping, + ActionForm form, + HttpServletRequest request, + HttpServletResponse response) + throws IOException,ServletException + { + logger.debug("dispathcing submitSession.."); + IMcService mcService = McServiceProxy.getMcService(getServlet().getServletContext()); + logger.debug("mcService: " +mcService); + + McGeneralMonitoringDTO mcGeneralMonitoringDTO= new McGeneralMonitoringDTO(); + + commonSubmitSessionCode(form, request, mcService,mcGeneralMonitoringDTO); + logger.debug("post commonSubmitSessionCode: " + mcGeneralMonitoringDTO); + + return (mapping.findForward(LOAD_MONITORING_CONTENT)); + } + + + /** + * editActivityQuestions * + * enables swiching to editable mode in the Edit Activity tab + * * @param mapping * @param form * @param request @@ -316,63 +651,214 @@ HttpServletResponse response) throws IOException, ServletException, ToolException - { - McUtils.cleanUpUserExceptions(request); - logger.debug("dispatching editActivityQuestions.."); - request.getSession().setAttribute(IS_MONITORED_CONTENT_IN_USE, new Boolean(false).toString()); - IMcService mcService =McUtils.getToolService(request); - - - if (mcService == null) + { + logger.debug("dispatching editActivityQuestions..."); + + McAuthoringForm mcAuthoringForm = (McAuthoringForm) form; + logger.debug("mcAuthoringForm: " + mcAuthoringForm); + + IMcService mcService =McServiceProxy.getMcService(getServlet().getServletContext()); + logger.debug("mcService: " + mcService); + + String httpSessionID=mcAuthoringForm.getHttpSessionID(); + logger.debug("httpSessionID: " + httpSessionID); + + SessionMap sessionMap=(SessionMap)request.getSession().getAttribute(httpSessionID); + logger.debug("sessionMap: " + sessionMap); + + String contentFolderID = WebUtil.readStrParam(request, AttributeNames.PARAM_CONTENT_FOLDER_ID); + logger.debug("contentFolderID: " + contentFolderID); + mcAuthoringForm.setContentFolderID(contentFolderID); + + + String activeModule=request.getParameter(ACTIVE_MODULE); + logger.debug("activeModule: " + activeModule); + + String strToolContentID=request.getParameter(AttributeNames.PARAM_TOOL_CONTENT_ID); + logger.debug("strToolContentID: " + strToolContentID); + + String defaultContentIdStr=request.getParameter(DEFAULT_CONTENT_ID_STR); + logger.debug("defaultContentIdStr: " + defaultContentIdStr); + + McContent mcContent=mcService.retrieveMc(new Long(strToolContentID)); + logger.debug("mcContent: " + mcContent); + + McGeneralAuthoringDTO mcGeneralAuthoringDTO= new McGeneralAuthoringDTO(); + logger.debug("mcGeneralAuthoringDTO: " + mcGeneralAuthoringDTO); + mcGeneralAuthoringDTO.setContentFolderID(contentFolderID); + + + logger.debug("title: " + mcContent.getTitle()); + logger.debug("instructions: " + mcContent.getInstructions()); + + mcGeneralAuthoringDTO.setActivityTitle(mcContent.getTitle()); + mcAuthoringForm.setTitle(mcContent.getTitle()); + + mcGeneralAuthoringDTO.setActivityInstructions(mcContent.getInstructions()); + + sessionMap.put(ACTIVITY_TITLE_KEY, mcContent.getTitle()); + sessionMap.put(ACTIVITY_INSTRUCTIONS_KEY, mcContent.getInstructions()); + + + /* determine whether the request is from Monitoring url Edit Activity*/ + String sourceMcStarter = (String) request.getAttribute(SOURCE_MC_STARTER); + logger.debug("sourceMcStarter: " + sourceMcStarter); + + mcAuthoringForm.setDefineLaterInEditMode(new Boolean(true).toString()); + mcGeneralAuthoringDTO.setDefineLaterInEditMode(new Boolean(true).toString()); + + boolean isContentInUse=McUtils.isContentInUse(mcContent); + logger.debug("isContentInUse:" + isContentInUse); + + mcGeneralAuthoringDTO.setMonitoredContentInUse(new Boolean(false).toString()); + if (isContentInUse == true) { - logger.debug("will retrieve mcService"); - mcService = McServiceProxy.getMcService(getServlet().getServletContext()); - logger.debug("retrieving mcService from cache: " + mcService); + logger.debug("monitoring url does not allow editActivity since the content is in use."); + persistError(request,"error.content.inUse"); + mcGeneralAuthoringDTO.setMonitoredContentInUse(new Boolean(true).toString()); } - request.getSession().setAttribute(TOOL_SERVICE, mcService); - request.getSession().setAttribute(CURRENT_MONITORING_TAB, "editActivity"); - + + EditActivityDTO editActivityDTO = new EditActivityDTO(); + logger.debug("isContentInUse:" + isContentInUse); + if (isContentInUse == true) + { + editActivityDTO.setMonitoredContentInUse(new Boolean(true).toString()); + } + request.setAttribute(EDIT_ACTIVITY_DTO, editActivityDTO); - request.getSession().setAttribute(DEFINE_LATER_IN_EDIT_MODE, new Boolean(true)); - McUtils.setDefineLater(request, true); + McUtils.setDefineLater(request, true, strToolContentID, mcService); + + McUtils.setFormProperties(request, mcService, + mcAuthoringForm, mcGeneralAuthoringDTO, strToolContentID, defaultContentIdStr, activeModule, sessionMap, httpSessionID); + + + mcGeneralAuthoringDTO.setToolContentID(strToolContentID); + mcGeneralAuthoringDTO.setActiveModule(activeModule); + mcGeneralAuthoringDTO.setDefaultContentIdStr(defaultContentIdStr); + mcAuthoringForm.setToolContentID(strToolContentID); + mcAuthoringForm.setActiveModule(activeModule); + mcAuthoringForm.setDefaultContentIdStr(defaultContentIdStr); + mcAuthoringForm.setCurrentTab("3"); + - McMonitoringForm mcMonitoringForm = (McMonitoringForm) form; - mcMonitoringForm.setEditOptionsMode(new Integer(0).toString()); - request.getSession().setAttribute(EDIT_OPTIONS_MODE, new Integer(0)); - logger.debug("setting EDIT_OPTIONS_MODE to 0"); - - Long toolContentId =(Long) request.getSession().getAttribute(TOOL_CONTENT_ID); - logger.debug("toolContentId: " + toolContentId); + AuthoringUtil authoringUtil= new AuthoringUtil(); + List listQuestionContentDTO=authoringUtil.buildDefaultQuestionContent(mcContent, mcService); + logger.debug("listQuestionContentDTO: " + listQuestionContentDTO); + + request.setAttribute(TOTAL_QUESTION_COUNT, new Integer(listQuestionContentDTO.size())); + logger.debug("listQuestionContentDTO: " + listQuestionContentDTO); + request.setAttribute(LIST_QUESTION_CONTENT_DTO,listQuestionContentDTO); + sessionMap.put(LIST_QUESTION_CONTENT_DTO_KEY, listQuestionContentDTO); + + request.setAttribute(TOTAL_QUESTION_COUNT, new Integer(listQuestionContentDTO.size())); + request.getSession().setAttribute(httpSessionID, sessionMap); + + Map marksMap=authoringUtil.buildMarksMap(); + logger.debug("marksMap: " + marksMap); + mcGeneralAuthoringDTO.setMarksMap(marksMap); + + Map passMarksMap=authoringUtil.buildPassMarkMap(); + logger.debug("passMarksMap: " + passMarksMap); + mcGeneralAuthoringDTO.setPassMarksMap(passMarksMap); - McContent mcContent=mcService.retrieveMc(toolContentId); - logger.debug("mcContent:" + mcContent); + Map correctMap=authoringUtil.buildCorrectMap(); + logger.debug("correctMap: " + correctMap); + mcGeneralAuthoringDTO.setCorrectMap(correctMap); + + logger.debug("before fwding to jsp, mcAuthoringForm: " + mcAuthoringForm); + logger.debug("before saving final mcGeneralAuthoringDTO: " + mcGeneralAuthoringDTO); + request.setAttribute(MC_GENERAL_AUTHORING_DTO, mcGeneralAuthoringDTO); - MonitoringUtil.setAttributeNoToolSessions(request, mcService, mcContent); - request.getSession().setAttribute(RICHTEXT_TITLE, mcContent.getTitle()); - request.getSession().setAttribute(RICHTEXT_INSTRUCTIONS, mcContent.getInstructions()); + /*setting up USER_EXCEPTION_NO_TOOL_SESSIONS, from here */ + McGeneralMonitoringDTO mcGeneralMonitoringDTO= new McGeneralMonitoringDTO(); + mcGeneralMonitoringDTO.setDefineLaterInEditMode(new Boolean(true).toString()); + + if (mcService.studentActivityOccurredGlobal(mcContent)) + { + logger.debug("USER_EXCEPTION_NO_TOOL_SESSIONS is set to false"); + mcGeneralMonitoringDTO.setUserExceptionNoToolSessions(new Boolean(false).toString()); + } + else + { + logger.debug("USER_EXCEPTION_NO_TOOL_SESSIONS is set to true"); + mcGeneralMonitoringDTO.setUserExceptionNoToolSessions(new Boolean(true).toString()); + } + + + mcGeneralMonitoringDTO.setOnlineInstructions(mcContent.getOnlineInstructions()); + mcGeneralMonitoringDTO.setOfflineInstructions(mcContent.getOfflineInstructions()); + + List attachmentList = mcService.retrieveMcUploadedFiles(mcContent); + logger.debug("attachmentList: " + attachmentList); + mcGeneralMonitoringDTO.setAttachmentList(attachmentList); + mcGeneralMonitoringDTO.setDeletedAttachmentList(new ArrayList()); + - logger.debug("Title is: " + mcContent.getTitle()); - logger.debug("Instructions is: " + mcContent.getInstructions()); - logger.debug("setting passmark to: " + mcContent.getPassMark()); - mcMonitoringForm.setPassmark(mcContent.getPassMark().toString()); + logger.debug("end of refreshSummaryData, mcGeneralMonitoringDTO" + mcGeneralMonitoringDTO); + request.setAttribute(MC_GENERAL_MONITORING_DTO, mcGeneralMonitoringDTO); + /*.. till here*/ - prepareReflectionData(request, mcContent, mcService, null,false); - logger.debug("fwd ing to : " + LOAD_MONITORING_CONTENT); - return (mapping.findForward(LOAD_MONITORING_CONTENT)); + /*find out if there are any reflection entries, from here*/ + boolean notebookEntriesExist=MonitoringUtil.notebookEntriesExist(mcService, mcContent); + logger.debug("notebookEntriesExist : " + notebookEntriesExist); + + if (notebookEntriesExist) + { + request.setAttribute(NOTEBOOK_ENTRIES_EXIST, new Boolean(true).toString()); + + String userExceptionNoToolSessions=(String)mcGeneralMonitoringDTO.getUserExceptionNoToolSessions(); + logger.debug(": " + userExceptionNoToolSessions); + + if (userExceptionNoToolSessions.equals("true")) + { + logger.debug("there are no online student activity but there are reflections : "); + request.setAttribute(NO_SESSIONS_NOTEBOOK_ENTRIES_EXIST, new Boolean(true).toString()); + } + } + else + { + request.setAttribute(NOTEBOOK_ENTRIES_EXIST, new Boolean(false).toString()); + } + /* ... till here*/ + + MonitoringUtil.buildMcStatsDTO(request,mcService, mcContent); + MonitoringUtil.generateGroupsSessionData(request, mcService, mcContent); + + MonitoringUtil.setupAllSessionsData(request, mcContent,mcService); + + + logger.debug("forwarding to LOAD_MONITORING_CONTENT: " + LOAD_MONITORING_CONTENT); + return mapping.findForward(LOAD_MONITORING_CONTENT); + } + + + + /** + * persistError(HttpServletRequest request, String message) + * persists error messages to request scope + * @param request + * @param message + */ + public void persistError(HttpServletRequest request, String message) + { + ActionMessages errors= new ActionMessages(); + errors.add(Globals.ERROR_KEY, new ActionMessage(message)); + logger.debug("add " + message +" to ActionMessages:"); + saveErrors(request,errors); } + /** - * switches to summary tab of the monitoring url - * getSummary(ActionMapping mapping, - ActionForm form, - HttpServletRequest request, - HttpServletResponse response) throws IOException, - ServletException * + * ActionForward submitAllContent(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) + throws IOException, ServletException + + submits content into the tool database + * * @param mapping * @param form * @param request @@ -381,59 +867,270 @@ * @throws IOException * @throws ServletException */ - public ActionForward getSummary(ActionMapping mapping, - ActionForm form, - HttpServletRequest request, - HttpServletResponse response) throws IOException, - ServletException - { - McUtils.cleanUpUserExceptions(request); - McMonitoringStarterAction mcMonitoringStarter= new McMonitoringStarterAction(); - request.getSession().setAttribute(IS_MONITORED_CONTENT_IN_USE, new Boolean(false).toString()); - logger.debug("init monitoring data"); - boolean initData=mcMonitoringStarter.initialiseMonitoringData(mapping, form, request, response); - logger.debug("monitoring data initialised.."); - - logger.debug("dispatching getSummary..."+ request); - McMonitoringForm mcMonitoringForm = (McMonitoringForm) form; - logger.debug("mcMonitoringForm: "+ mcMonitoringForm); + public ActionForward submitAllContent(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) + throws IOException, ServletException { + logger.debug("dispathcing proxy submitAllContent :" +form); + logger.debug("dispathcing submitAllContent :" +form); - IMcService mcService =McUtils.getToolService(request); - logger.debug("mcService: "+ mcService); - if (mcService == null) - { - logger.debug("will retrieve mcService"); - mcService = McServiceProxy.getMcService(getServlet().getServletContext()); - logger.debug("retrieving mcService from cache: " + mcService); + McAuthoringForm mcAuthoringForm = (McMonitoringForm) form; + + IMcService mcService =McServiceProxy.getMcService(getServlet().getServletContext()); + logger.debug("mcService: " + mcService); + + String httpSessionID=mcAuthoringForm.getHttpSessionID(); + logger.debug("httpSessionID: " + httpSessionID); + + SessionMap sessionMap=(SessionMap)request.getSession().getAttribute(httpSessionID); + logger.debug("sessionMap: " + sessionMap); + + String contentFolderID = WebUtil.readStrParam(request, AttributeNames.PARAM_CONTENT_FOLDER_ID); + logger.debug("contentFolderID: " + contentFolderID); + mcAuthoringForm.setContentFolderID(contentFolderID); + + String activeModule=request.getParameter(ACTIVE_MODULE); + logger.debug("activeModule: " + activeModule); + + String strToolContentID=request.getParameter(AttributeNames.PARAM_TOOL_CONTENT_ID); + logger.debug("strToolContentID: " + strToolContentID); + + String defaultContentIdStr=request.getParameter(DEFAULT_CONTENT_ID_STR); + logger.debug("defaultContentIdStr: " + defaultContentIdStr); + + List listQuestionContentDTO=(List)sessionMap.get(LIST_QUESTION_CONTENT_DTO_KEY); + logger.debug("listQuestionContentDTO: " + listQuestionContentDTO); + + Map mapQuestionContent=AuthoringUtil.extractMapQuestionContent(listQuestionContentDTO); + logger.debug("extracted mapQuestionContent: " + mapQuestionContent); + + Map mapFeedback=AuthoringUtil.extractMapFeedback(listQuestionContentDTO); + logger.debug("extracted mapFeedback: " + mapFeedback); + + Map mapWeights=AuthoringUtil.extractMapWeights(listQuestionContentDTO); + logger.debug("extracted mapWeights: " + mapWeights); + + Map mapMarks=AuthoringUtil.extractMapMarks(listQuestionContentDTO); + logger.debug("extracted mapMarks: " + mapMarks); + + Map mapCandidatesList=AuthoringUtil.extractMapCandidatesList(listQuestionContentDTO); + logger.debug("extracted mapCandidatesList: " + mapCandidatesList); + + + ActionMessages errors = new ActionMessages(); + logger.debug("mapQuestionContent size: " + mapQuestionContent.size()); + + if (mapQuestionContent.size() == 0) + { + ActionMessage error = new ActionMessage("questions.none.submitted"); + errors.add(ActionMessages.GLOBAL_MESSAGE, error); + } + logger.debug("errors: " + errors); + + AuthoringUtil authoringUtil= new AuthoringUtil(); + + McGeneralAuthoringDTO mcGeneralAuthoringDTO= new McGeneralAuthoringDTO(); + + logger.debug("activeModule: " + activeModule); + + mcGeneralAuthoringDTO.setContentFolderID(contentFolderID); + + String richTextTitle = request.getParameter(TITLE); + String richTextInstructions = request.getParameter(INSTRUCTIONS); + + logger.debug("richTextTitle: " + richTextTitle); + logger.debug("richTextInstructions: " + richTextInstructions); + + mcGeneralAuthoringDTO.setActivityTitle(richTextTitle); + mcAuthoringForm.setTitle(richTextTitle); + + mcGeneralAuthoringDTO.setActivityInstructions(richTextInstructions); + + sessionMap.put(ACTIVITY_TITLE_KEY, richTextTitle); + sessionMap.put(ACTIVITY_INSTRUCTIONS_KEY, richTextInstructions); + + mcGeneralAuthoringDTO.setMapQuestionContent(mapQuestionContent); + logger.debug("mcGeneralAuthoringDTO: " + mcGeneralAuthoringDTO); + + logger.debug("mcGeneralAuthoringDTO now: " + mcGeneralAuthoringDTO); + request.setAttribute(MC_GENERAL_AUTHORING_DTO, mcGeneralAuthoringDTO); + + logger.debug("there are no issues with input, continue and submit data"); + + McContent mcContentTest=mcService.retrieveMc(new Long(strToolContentID)); + logger.debug("mcContentTest: " + mcContentTest); + + logger.debug("errors: " + errors); + if(!errors.isEmpty()){ + saveErrors(request, errors); + logger.debug("errors saved: " + errors); } - request.getSession().setAttribute(TOOL_SERVICE, mcService); - request.getSession().setAttribute(CURRENT_MONITORING_TAB, "summary"); - Long toolContentId =(Long) request.getSession().getAttribute(TOOL_CONTENT_ID); - logger.debug("toolContentId: " + toolContentId); + McGeneralMonitoringDTO mcGeneralMonitoringDTO= new McGeneralMonitoringDTO(); + + McContent mcContent=mcContentTest; + if(errors.isEmpty()){ + logger.debug("errors is empty: " + errors); + authoringUtil.removeRedundantQuestions(mapQuestionContent, mcService, mcAuthoringForm, request, strToolContentID); + logger.debug("end of removing unused entries... "); + + mcContent=authoringUtil.saveOrUpdateMcContent(mapQuestionContent, mapFeedback, mapWeights, + mapMarks, mapCandidatesList, mcService, mcAuthoringForm, request, mcContentTest, strToolContentID); + logger.debug("mcContent: " + mcContent); + + + long defaultContentID=0; + logger.debug("attempt retrieving tool with signatute : " + MY_SIGNATURE); + defaultContentID=mcService.getToolDefaultContentIdBySignature(MY_SIGNATURE); + logger.debug("retrieved tool default contentId: " + defaultContentID); + + if (mcContent != null) + { + mcGeneralAuthoringDTO.setDefaultContentIdStr(new Long(defaultContentID).toString()); + } + logger.debug("updated mcGeneralAuthoringDTO to: " + mcGeneralAuthoringDTO); + + authoringUtil.reOrganizeDisplayOrder(mapQuestionContent, mcService, mcAuthoringForm, mcContent); + logger.debug("post reOrganizeDisplayOrder: " + mcContent); + + + logger.debug("strToolContentID: " + strToolContentID); + McUtils.setDefineLater(request, false, strToolContentID, mcService); + logger.debug("define later set to false"); + + McUtils.setFormProperties(request, mcService, + mcAuthoringForm, mcGeneralAuthoringDTO, strToolContentID, defaultContentIdStr, activeModule, sessionMap, httpSessionID); + + mcGeneralAuthoringDTO.setDefineLaterInEditMode(new Boolean(false).toString()); + mcGeneralMonitoringDTO.setDefineLaterInEditMode(new Boolean(false).toString()); + } + else + { + logger.debug("errors is not empty: " + errors); + + if (mcContent != null) + { + long defaultContentID=0; + logger.debug("attempt retrieving tool with signatute : " + MY_SIGNATURE); + defaultContentID=mcService.getToolDefaultContentIdBySignature(MY_SIGNATURE); + logger.debug("retrieved tool default contentId: " + defaultContentID); + + if (mcContent != null) + { + mcGeneralAuthoringDTO.setDefaultContentIdStr(new Long(defaultContentID).toString()); + } + + McUtils.setFormProperties(request, mcService, + mcAuthoringForm, mcGeneralAuthoringDTO, strToolContentID, defaultContentIdStr, activeModule, sessionMap, httpSessionID); + + mcGeneralMonitoringDTO.setDefineLaterInEditMode(new Boolean(true).toString()); + } + } + + logger.debug("end of refreshSummaryData, mcGeneralMonitoringDTO" + mcGeneralMonitoringDTO); + request.setAttribute(MC_GENERAL_MONITORING_DTO, mcGeneralMonitoringDTO); + + mcGeneralAuthoringDTO.setSbmtSuccess(new Integer(1).toString()); + + mcAuthoringForm.resetUserAction(); + mcGeneralAuthoringDTO.setMapQuestionContent(mapQuestionContent); + + Map marksMap=authoringUtil.buildMarksMap(); + logger.debug("marksMap: " + marksMap); + mcGeneralAuthoringDTO.setMarksMap(marksMap); - McContent mcContent=mcService.retrieveMc(toolContentId); - logger.debug("mcContent:" + mcContent); + Map passMarksMap=authoringUtil.buildPassMarkMap(); + logger.debug("passMarksMap: " + passMarksMap); + mcGeneralAuthoringDTO.setPassMarksMap(passMarksMap); + + + Map correctMap=authoringUtil.buildCorrectMap(); + logger.debug("correctMap: " + correctMap); + mcGeneralAuthoringDTO.setCorrectMap(correctMap); + + + logger.debug("before saving final mcGeneralAuthoringDTO: " + mcGeneralAuthoringDTO); + request.setAttribute(MC_GENERAL_AUTHORING_DTO, mcGeneralAuthoringDTO); + + request.setAttribute(LIST_QUESTION_CONTENT_DTO,listQuestionContentDTO); + sessionMap.put(LIST_QUESTION_CONTENT_DTO_KEY, listQuestionContentDTO); + request.getSession().setAttribute(httpSessionID, sessionMap); + + request.setAttribute(TOTAL_QUESTION_COUNT, new Integer(listQuestionContentDTO.size())); - MonitoringUtil.setAttributeNoToolSessions(request, mcService, mcContent); + mcGeneralAuthoringDTO.setToolContentID(strToolContentID); + mcGeneralAuthoringDTO.setHttpSessionID(httpSessionID); + mcGeneralAuthoringDTO.setActiveModule(activeModule); + mcGeneralAuthoringDTO.setDefaultContentIdStr(defaultContentIdStr); - prepareReflectionData(request, mcContent, mcService, null,false); + mcAuthoringForm.setToolContentID(strToolContentID); + mcAuthoringForm.setHttpSessionID(httpSessionID); + mcAuthoringForm.setActiveModule(activeModule); + mcAuthoringForm.setDefaultContentIdStr(defaultContentIdStr); + mcAuthoringForm.setCurrentTab("3"); - McStarterAction mcStarterAction= new McStarterAction(); - return mcStarterAction.executeGetMonitoringTab(mapping, form, request, response); - } + + /*common screen data*/ + if (mcService.studentActivityOccurredGlobal(mcContent)) + { + logger.debug("USER_EXCEPTION_NO_TOOL_SESSIONS is set to false"); + mcGeneralMonitoringDTO.setUserExceptionNoToolSessions(new Boolean(false).toString()); + } + else + { + logger.debug("USER_EXCEPTION_NO_TOOL_SESSIONS is set to true"); + mcGeneralMonitoringDTO.setUserExceptionNoToolSessions(new Boolean(true).toString()); + } + + + mcGeneralMonitoringDTO.setOnlineInstructions(mcContent.getOnlineInstructions()); + mcGeneralMonitoringDTO.setOfflineInstructions(mcContent.getOfflineInstructions()); + + List attachmentList = mcService.retrieveMcUploadedFiles(mcContent); + logger.debug("attachmentList: " + attachmentList); + mcGeneralMonitoringDTO.setAttachmentList(attachmentList); + mcGeneralMonitoringDTO.setDeletedAttachmentList(new ArrayList()); + + + /*find out if there are any reflection entries, from here*/ + boolean notebookEntriesExist=MonitoringUtil.notebookEntriesExist(mcService, mcContent); + logger.debug("notebookEntriesExist : " + notebookEntriesExist); + + if (notebookEntriesExist) + { + request.setAttribute(NOTEBOOK_ENTRIES_EXIST, new Boolean(true).toString()); + + String userExceptionNoToolSessions=(String)mcGeneralMonitoringDTO.getUserExceptionNoToolSessions(); + logger.debug(": " + userExceptionNoToolSessions); + + if (userExceptionNoToolSessions.equals("true")) + { + logger.debug("there are no online student activity but there are reflections : "); + request.setAttribute(NO_SESSIONS_NOTEBOOK_ENTRIES_EXIST, new Boolean(true).toString()); + } + } + else + { + request.setAttribute(NOTEBOOK_ENTRIES_EXIST, new Boolean(false).toString()); + } + /* ... till here*/ + + MonitoringUtil.buildMcStatsDTO(request,mcService, mcContent); + MonitoringUtil.generateGroupsSessionData(request, mcService, mcContent); + logger.debug("ending setupCommonScreenData, mcContent " + mcContent); + + MonitoringUtil.setupAllSessionsData(request, mcContent,mcService); + + logger.debug("forwarding to :" + LOAD_MONITORING_CONTENT); + return mapping.findForward(LOAD_MONITORING_CONTENT); + } + - /** - * switches to instructions tab of the monitoring url. - * getInstructions(ActionMapping mapping, - ActionForm form, - HttpServletRequest request, - HttpServletResponse response) throws IOException, - ServletException + * ActionForward saveSingleQuestion(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) * + * includes a new question in the questions list + * * @param mapping * @param form * @param request @@ -442,982 +1139,1993 @@ * @throws IOException * @throws ServletException */ - public ActionForward getInstructions(ActionMapping mapping, - ActionForm form, - HttpServletRequest request, - HttpServletResponse response) throws IOException, - ServletException - { - McUtils.cleanUpUserExceptions(request); - logger.debug("dispatching getInstructions..." + request); - request.getSession().setAttribute(IS_MONITORED_CONTENT_IN_USE, new Boolean(false).toString()); - McMonitoringStarterAction mcMonitoringStarter= new McMonitoringStarterAction(); - logger.debug("init monitoring data"); - boolean initData=mcMonitoringStarter.initialiseMonitoringData(mapping, form, request, response); - logger.debug("monitoring data initialised.."); - - McMonitoringForm mcMonitoringForm = (McMonitoringForm) form; - - IMcService mcService =McUtils.getToolService(request); - logger.debug("mcService: " + mcService); - - if (mcService == null) - { - logger.debug("will retrieve mcService"); - mcService = McServiceProxy.getMcService(getServlet().getServletContext()); - logger.debug("retrieving mcService from cache: " + mcService); - } - request.getSession().setAttribute(TOOL_SERVICE, mcService); - request.getSession().setAttribute(CURRENT_MONITORING_TAB, "instructions"); + public ActionForward saveSingleQuestion(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) + throws IOException, ServletException { + logger.debug("dispathcing proxy saveSingleQuestion"); + logger.debug("dispathcing saveSingleQuestion"); + McAuthoringForm mcAuthoringForm = (McMonitoringForm) form; + + IMcService mcService =McServiceProxy.getMcService(getServlet().getServletContext()); + logger.debug("mcService: " + mcService); + + String httpSessionID=mcAuthoringForm.getHttpSessionID(); + logger.debug("httpSessionID: " + httpSessionID); + + SessionMap sessionMap=(SessionMap)request.getSession().getAttribute(httpSessionID); + logger.debug("sessionMap: " + sessionMap); + + String contentFolderID = WebUtil.readStrParam(request, AttributeNames.PARAM_CONTENT_FOLDER_ID); + logger.debug("contentFolderID: " + contentFolderID); + mcAuthoringForm.setContentFolderID(contentFolderID); + + + String activeModule=request.getParameter(ACTIVE_MODULE); + logger.debug("activeModule: " + activeModule); + + String strToolContentID=request.getParameter(AttributeNames.PARAM_TOOL_CONTENT_ID); + logger.debug("strToolContentID: " + strToolContentID); + + String defaultContentIdStr=request.getParameter(DEFAULT_CONTENT_ID_STR); + logger.debug("defaultContentIdStr: " + defaultContentIdStr); + + String editQuestionBoxRequest=request.getParameter("editQuestionBoxRequest"); + logger.debug("editQuestionBoxRequest: " + editQuestionBoxRequest); + + + String mark=request.getParameter("mark"); + logger.debug("mark: " + mark); + - Long toolContentId =(Long) request.getSession().getAttribute(TOOL_CONTENT_ID); - logger.debug("toolContentId: " + toolContentId); + AuthoringUtil authoringUtil = new AuthoringUtil(); + List caList=authoringUtil.repopulateCandidateAnswersBox(request, false); + logger.debug("repopulated caList: " + caList); + + boolean validateSingleCorrectCandidate=authoringUtil.validateSingleCorrectCandidate(caList); + logger.debug("validateSingleCorrectCandidate: " + validateSingleCorrectCandidate); - McContent mcContent=mcService.retrieveMc(toolContentId); - logger.debug("mcContent:" + mcContent); - - MonitoringUtil.setAttributeNoToolSessions(request, mcService, mcContent); + + ActionMessages errors = new ActionMessages(); + + + if (caList.size() == 0) + { + ActionMessage error = new ActionMessage("candidates.none.provided"); + errors.add(ActionMessages.GLOBAL_MESSAGE, error); + } + + + if (!validateSingleCorrectCandidate) + { + ActionMessage error = new ActionMessage("candidates.none.correct"); + errors.add(ActionMessages.GLOBAL_MESSAGE, error); + } + logger.debug("errors: " + errors); - prepareReflectionData(request, mcContent, mcService, null,false); + if(!errors.isEmpty()){ + saveErrors(request, errors); + logger.debug("errors saved: " + errors); + } + + List listQuestionContentDTO=(List)sessionMap.get(LIST_QUESTION_CONTENT_DTO_KEY); + logger.debug("listQuestionContentDTO: " + listQuestionContentDTO); - McStarterAction mcStarterAction= new McStarterAction(); - return mcStarterAction.executeGetMonitoringTab(mapping, form, request, response); + McGeneralAuthoringDTO mcGeneralAuthoringDTO= new McGeneralAuthoringDTO(); + + logger.debug("entry using mark: " + mark); + mcGeneralAuthoringDTO.setMarkValue(mark); + + McContent mcContent=mcService.retrieveMc(new Long(strToolContentID)); + logger.debug("mcContent: " + mcContent); + + + if(errors.isEmpty()) + { + logger.debug("errors is empty: " + errors); + + logger.debug("mcGeneralAuthoringDTO: " + mcGeneralAuthoringDTO); + mcGeneralAuthoringDTO.setContentFolderID(contentFolderID); + + mcGeneralAuthoringDTO.setSbmtSuccess(new Integer(0).toString()); + + String newQuestion=request.getParameter("newQuestion"); + logger.debug("newQuestion: " + newQuestion); + + String feedback=request.getParameter("feedback"); + logger.debug("feedback: " + feedback); + + + String editableQuestionIndex=request.getParameter("editableQuestionIndex"); + logger.debug("editableQuestionIndex: " + editableQuestionIndex); + mcAuthoringForm.setQuestionIndex(editableQuestionIndex); + + if ((newQuestion != null) && (newQuestion.length() > 0)) + { + if ((editQuestionBoxRequest != null) && (editQuestionBoxRequest.equals("false"))) + { + logger.debug("request for add and save"); + boolean duplicates=AuthoringUtil.checkDuplicateQuestions(listQuestionContentDTO, newQuestion); + logger.debug("duplicates: " + duplicates); + + if (!duplicates) + { + McQuestionContentDTO mcQuestionContentDTO= null; + Iterator listIterator=listQuestionContentDTO.iterator(); + while (listIterator.hasNext()) + { + mcQuestionContentDTO= (McQuestionContentDTO)listIterator.next(); + logger.debug("mcQuestionContentDTO:" + mcQuestionContentDTO); + logger.debug("mcQuestionContentDTO question:" + mcQuestionContentDTO.getQuestion()); + + String question=mcQuestionContentDTO.getQuestion(); + String displayOrder=mcQuestionContentDTO.getDisplayOrder(); + logger.debug("displayOrder:" + displayOrder); + + if ((displayOrder != null) && (!displayOrder.equals(""))) + { + if (displayOrder.equals(editableQuestionIndex)) + { + break; + } + + } + } + logger.debug("mcQuestionContentDTO found:" + mcQuestionContentDTO); + + mcQuestionContentDTO.setQuestion(newQuestion); + mcQuestionContentDTO.setFeedback(feedback); + mcQuestionContentDTO.setDisplayOrder(editableQuestionIndex); + mcQuestionContentDTO.setListCandidateAnswersDTO(caList); + mcQuestionContentDTO.setMark(mark); + + logger.debug("caList size:" + mcQuestionContentDTO.getListCandidateAnswersDTO().size()); + mcQuestionContentDTO.setCaCount(new Integer(mcQuestionContentDTO.getListCandidateAnswersDTO().size()).toString()); + + + listQuestionContentDTO=AuthoringUtil.reorderUpdateListQuestionContentDTO(listQuestionContentDTO, mcQuestionContentDTO, editableQuestionIndex); + logger.debug("post reorderUpdateListQuestionContentDTO listQuestionContentDTO: " + listQuestionContentDTO); + } + else + { + logger.debug("duplicate question entry, not adding"); + } + } + else + { + logger.debug("request for edit and save."); + McQuestionContentDTO mcQuestionContentDTO= null; + Iterator listIterator=listQuestionContentDTO.iterator(); + while (listIterator.hasNext()) + { + mcQuestionContentDTO= (McQuestionContentDTO)listIterator.next(); + logger.debug("mcQuestionContentDTO:" + mcQuestionContentDTO); + logger.debug("mcQuestionContentDTO question:" + mcQuestionContentDTO.getQuestion()); + + String question=mcQuestionContentDTO.getQuestion(); + String displayOrder=mcQuestionContentDTO.getDisplayOrder(); + logger.debug("displayOrder:" + displayOrder); + + if ((displayOrder != null) && (!displayOrder.equals(""))) + { + if (displayOrder.equals(editableQuestionIndex)) + { + break; + } + + } + } + logger.debug("mcQuestionContentDTO found:" + mcQuestionContentDTO); + + mcQuestionContentDTO.setQuestion(newQuestion); + mcQuestionContentDTO.setFeedback(feedback); + mcQuestionContentDTO.setDisplayOrder(editableQuestionIndex); + mcQuestionContentDTO.setListCandidateAnswersDTO(caList); + mcQuestionContentDTO.setMark(mark); + + logger.debug("caList size:" + mcQuestionContentDTO.getListCandidateAnswersDTO().size()); + mcQuestionContentDTO.setCaCount(new Integer(mcQuestionContentDTO.getListCandidateAnswersDTO().size()).toString()); + + listQuestionContentDTO=AuthoringUtil.reorderUpdateListQuestionContentDTO(listQuestionContentDTO, mcQuestionContentDTO, editableQuestionIndex); + logger.debug("post reorderUpdateListQuestionContentDTO listQuestionContentDTO: " + listQuestionContentDTO); + } + } + else + { + logger.debug("entry blank, not adding"); + } + + logger.debug("entryusing mark: " + mark); + mcGeneralAuthoringDTO.setMarkValue(mark); + + + request.setAttribute(LIST_QUESTION_CONTENT_DTO,listQuestionContentDTO); + sessionMap.put(LIST_QUESTION_CONTENT_DTO_KEY, listQuestionContentDTO); + logger.debug("listQuestionContentDTO now: " + listQuestionContentDTO); + + commonSaveCode(request, mcGeneralAuthoringDTO, + mcAuthoringForm, sessionMap, activeModule, strToolContentID, + defaultContentIdStr, mcService, httpSessionID,listQuestionContentDTO); + + request.setAttribute(TOTAL_QUESTION_COUNT, new Integer(listQuestionContentDTO.size())); + + setupCommonScreenData(mcContent, mcService,request); + MonitoringUtil.setupAllSessionsData(request, mcContent,mcService); + + logger.debug("fwd ing to LOAD_MONITORING_CONTENT: " + LOAD_MONITORING_CONTENT); + return (mapping.findForward(LOAD_MONITORING_CONTENT)); + } + else + { + logger.debug("errors is not empty: " + errors); + + commonSaveCode(request, mcGeneralAuthoringDTO, + mcAuthoringForm, sessionMap, activeModule, strToolContentID, + defaultContentIdStr, mcService, httpSessionID,listQuestionContentDTO); + + + request.setAttribute(LIST_QUESTION_CONTENT_DTO,listQuestionContentDTO); + sessionMap.put(LIST_QUESTION_CONTENT_DTO_KEY, listQuestionContentDTO); + logger.debug("listQuestionContentDTO now: " + listQuestionContentDTO); + + setupCommonScreenData(mcContent, mcService,request); + MonitoringUtil.setupAllSessionsData(request, mcContent,mcService); + + logger.debug("forwarding using newEditableQuestionBox"); + return newEditableQuestionBox(mapping, form, request, response); + } + } - + /** - * switches to Stats tab of the Monitoring url - * getStats(ActionMapping mapping, - ActionForm form, - HttpServletRequest request, - HttpServletResponse response) throws IOException, - ServletException + * commonSaveCode(HttpServletRequest request, McGeneralAuthoringDTO mcGeneralAuthoringDTO, + McAuthoringForm mcAuthoringForm, SessionMap sessionMap, String activeModule, String strToolContentID, + String defaultContentIdStr, IMcService mcService, String httpSessionID, List listQuestionContentDTO) * - * @param mapping - * @param form * @param request - * @param response - * @return - * @throws IOException - * @throws ServletException + * @param mcGeneralAuthoringDTO + * @param mcAuthoringForm + * @param sessionMap + * @param activeModule + * @param strToolContentID + * @param defaultContentIdStr + * @param mcService + * @param httpSessionID + * @param listQuestionContentDTO */ - public ActionForward getStats(ActionMapping mapping, - ActionForm form, - HttpServletRequest request, - HttpServletResponse response) throws IOException, - ServletException + protected void commonSaveCode(HttpServletRequest request, McGeneralAuthoringDTO mcGeneralAuthoringDTO, + McAuthoringForm mcAuthoringForm, SessionMap sessionMap, String activeModule, String strToolContentID, + String defaultContentIdStr, IMcService mcService, String httpSessionID, List listQuestionContentDTO) { - McUtils.cleanUpUserExceptions(request); - McMonitoringStarterAction mcMonitoringStarter= new McMonitoringStarterAction(); - request.getSession().setAttribute(IS_MONITORED_CONTENT_IN_USE, new Boolean(false).toString()); - logger.debug("init monitoring data"); - boolean initData=mcMonitoringStarter.initialiseMonitoringData(mapping, form, request, response); - logger.debug("monitoring data initialised.."); + String richTextTitle = request.getParameter(TITLE); + String richTextInstructions = request.getParameter(INSTRUCTIONS); - logger.debug("dispatching getStats..." + request); - McMonitoringForm mcMonitoringForm = (McMonitoringForm) form; - - IMcService mcService =McUtils.getToolService(request); - if (mcService == null) - { - logger.debug("will retrieve mcService"); - mcService = McServiceProxy.getMcService(getServlet().getServletContext()); - logger.debug("retrieving mcService from cache: " + mcService); - } - request.getSession().setAttribute(TOOL_SERVICE, mcService); - logger.debug("mcService : " + mcService); - - request.getSession().setAttribute(CURRENT_MONITORING_TAB, "stats"); + logger.debug("richTextTitle: " + richTextTitle); + logger.debug("richTextInstructions: " + richTextInstructions); + mcGeneralAuthoringDTO.setActivityTitle(richTextTitle); + mcAuthoringForm.setTitle(richTextTitle); + + mcGeneralAuthoringDTO.setActivityInstructions(richTextInstructions); + + sessionMap.put(ACTIVITY_TITLE_KEY, richTextTitle); + sessionMap.put(ACTIVITY_INSTRUCTIONS_KEY, richTextInstructions); - Long toolContentId =(Long) request.getSession().getAttribute(TOOL_CONTENT_ID); - logger.debug("toolContentId: " + toolContentId); + mcGeneralAuthoringDTO.setEditActivityEditMode(new Boolean(true).toString()); - McContent mcContent=mcService.retrieveMc(toolContentId); - logger.debug("mcContent:" + mcContent); + request.getSession().setAttribute(httpSessionID, sessionMap); + sessionMap.put(LIST_QUESTION_CONTENT_DTO_KEY, listQuestionContentDTO); + + McUtils.setFormProperties(request, mcService, + mcAuthoringForm, mcGeneralAuthoringDTO, strToolContentID, defaultContentIdStr, activeModule, sessionMap, httpSessionID); + + mcGeneralAuthoringDTO.setToolContentID(strToolContentID); + mcGeneralAuthoringDTO.setHttpSessionID(httpSessionID); + mcGeneralAuthoringDTO.setActiveModule(activeModule); + mcGeneralAuthoringDTO.setDefaultContentIdStr(defaultContentIdStr); - MonitoringUtil.setAttributeNoToolSessions(request, mcService, mcContent); + mcAuthoringForm.setToolContentID(strToolContentID); + mcAuthoringForm.setHttpSessionID(httpSessionID); + mcAuthoringForm.setActiveModule(activeModule); + mcAuthoringForm.setDefaultContentIdStr(defaultContentIdStr); + mcAuthoringForm.setCurrentTab("3"); + + mcGeneralAuthoringDTO.setDefineLaterInEditMode(new Boolean(true).toString()); + - prepareReflectionData(request, mcContent, mcService, null,false); - - McStarterAction mcStarterAction= new McStarterAction(); - return mcStarterAction.executeGetMonitoringTab(mapping, form, request, response); + AuthoringUtil authoringUtil = new AuthoringUtil(); + Map marksMap=authoringUtil.buildMarksMap(); + logger.debug("marksMap: " + marksMap); + mcGeneralAuthoringDTO.setMarksMap(marksMap); + + Map passMarksMap=authoringUtil.buildPassMarkMap(); + logger.debug("passMarksMap: " + passMarksMap); + mcGeneralAuthoringDTO.setPassMarksMap(passMarksMap); + + + Map correctMap=authoringUtil.buildCorrectMap(); + logger.debug("correctMap: " + correctMap); + mcGeneralAuthoringDTO.setCorrectMap(correctMap); + + + logger.debug("mcGeneralAuthoringDTO now: " + mcGeneralAuthoringDTO); + request.setAttribute(MC_GENERAL_AUTHORING_DTO, mcGeneralAuthoringDTO); + + logger.debug("httpSessionID: " + httpSessionID); + logger.debug("sessionMap: " + sessionMap); + + request.getSession().setAttribute(httpSessionID, sessionMap); + logger.debug("mcGeneralAuthoringDTO.getMapQuestionContent(); " + mcGeneralAuthoringDTO.getMapQuestionContent()); } + + - /** - * acts as a proxy to authoring addNewQuestion(....) - * addNewQuestion(ActionMapping mapping, - ActionForm form, - HttpServletRequest request, - HttpServletResponse response) throws IOException, - ServletException + * ActionForward addSingleQuestion(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) * * @param mapping * @param form * @param request * @param response - * @return ActionForward + * @return * @throws IOException * @throws ServletException */ - public ActionForward addNewQuestion(ActionMapping mapping, - ActionForm form, - HttpServletRequest request, - HttpServletResponse response) throws IOException, - ServletException - { - McUtils.cleanUpUserExceptions(request); - logger.debug("dispatching proxy addNewQuestion..."); - request.getSession().setAttribute(IS_MONITORED_CONTENT_IN_USE, new Boolean(false).toString()); - request.setAttribute(SOURCE_MC_STARTER, "monitoring"); - logger.debug("SOURCE_MC_STARTER: monitoring"); + public ActionForward addSingleQuestion(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) + throws IOException, ServletException { + + logger.debug("dispathcing proxy addSingleQuestion"); + logger.debug("dispathcing addSingleQuestion"); + McAuthoringForm mcAuthoringForm = (McMonitoringForm) form; + + IMcService mcService =McServiceProxy.getMcService(getServlet().getServletContext()); + logger.debug("mcService: " + mcService); + + String httpSessionID=mcAuthoringForm.getHttpSessionID(); + logger.debug("httpSessionID: " + httpSessionID); + + SessionMap sessionMap=(SessionMap)request.getSession().getAttribute(httpSessionID); + logger.debug("sessionMap: " + sessionMap); + + String contentFolderID = WebUtil.readStrParam(request, AttributeNames.PARAM_CONTENT_FOLDER_ID); + logger.debug("contentFolderID: " + contentFolderID); + mcAuthoringForm.setContentFolderID(contentFolderID); + + + String activeModule=request.getParameter(ACTIVE_MODULE); + logger.debug("activeModule: " + activeModule); + + String strToolContentID=request.getParameter(AttributeNames.PARAM_TOOL_CONTENT_ID); + logger.debug("strToolContentID: " + strToolContentID); + + String defaultContentIdStr=request.getParameter(DEFAULT_CONTENT_ID_STR); + logger.debug("defaultContentIdStr: " + defaultContentIdStr); + + McContent mcContent=mcService.retrieveMc(new Long(strToolContentID)); + logger.debug("mcContent: " + mcContent); + + McGeneralAuthoringDTO mcGeneralAuthoringDTO= new McGeneralAuthoringDTO(); + logger.debug("mcGeneralAuthoringDTO: " + mcGeneralAuthoringDTO); + mcGeneralAuthoringDTO.setContentFolderID(contentFolderID); + + mcGeneralAuthoringDTO.setSbmtSuccess(new Integer(0).toString()); + + AuthoringUtil authoringUtil= new AuthoringUtil(); - IMcService mcService =McUtils.getToolService(request); - if (mcService == null) - { - logger.debug("will retrieve mcService"); - mcService = McServiceProxy.getMcService(getServlet().getServletContext()); - logger.debug("retrieving mcService from cache: " + mcService); - } - request.getSession().setAttribute(TOOL_SERVICE, mcService); - logger.debug("mcService : " + mcService); + List listQuestionContentDTO=(List)sessionMap.get(LIST_QUESTION_CONTENT_DTO_KEY); + logger.debug("listQuestionContentDTO: " + listQuestionContentDTO); + + String newQuestion=request.getParameter("newQuestion"); + logger.debug("newQuestion: " + newQuestion); + + String feedback=request.getParameter("feedback"); + logger.debug("feedback: " + feedback); + + String mark=request.getParameter("mark"); + logger.debug("mark: " + mark); + mcGeneralAuthoringDTO.setMarkValue(mark); + List caList=new LinkedList(); - request.getSession().setAttribute(CURRENT_MONITORING_TAB, "editActivity"); + McCandidateAnswersDTO mcCandidateAnswersDTO= new McCandidateAnswersDTO(); + mcCandidateAnswersDTO.setCandidateAnswer("Candidate Answer 1"); + mcCandidateAnswersDTO.setCorrect("Incorrect"); + caList.add(mcCandidateAnswersDTO); - Long toolContentId =(Long) request.getSession().getAttribute(TOOL_CONTENT_ID); - logger.debug("toolContentId: " + toolContentId); + mcCandidateAnswersDTO= new McCandidateAnswersDTO(); + mcCandidateAnswersDTO.setCandidateAnswer("Candidate Answer 2"); + mcCandidateAnswersDTO.setCorrect("Correct"); + caList.add(mcCandidateAnswersDTO); + - McContent mcContent=mcService.retrieveMc(toolContentId); - logger.debug("mcContent:" + mcContent); - - MonitoringUtil.setAttributeNoToolSessions(request, mcService, mcContent); - prepareReflectionData(request, mcContent, mcService, null,false); - - McAction mcAction = new McAction(); - return mcAction.addNewQuestion(mapping, form, request, response); - } + int listSize=listQuestionContentDTO.size(); + logger.debug("listSize: " + listSize); + + if ((newQuestion != null) && (newQuestion.length() > 0)) + { + boolean duplicates=AuthoringUtil.checkDuplicateQuestions(listQuestionContentDTO, newQuestion); + logger.debug("duplicates: " + duplicates); + + if (!duplicates) + { + McQuestionContentDTO mcQuestionContentDTO=new McQuestionContentDTO(); + mcQuestionContentDTO.setDisplayOrder(new Long(listSize+1).toString()); + mcQuestionContentDTO.setFeedback(feedback); + mcQuestionContentDTO.setQuestion(newQuestion); + mcQuestionContentDTO.setMark(mark); + + mcQuestionContentDTO.setListCandidateAnswersDTO(caList); + logger.debug("caList size:" + mcQuestionContentDTO.getListCandidateAnswersDTO().size()); + mcQuestionContentDTO.setCaCount(new Integer(mcQuestionContentDTO.getListCandidateAnswersDTO().size()).toString()); + + listQuestionContentDTO.add(mcQuestionContentDTO); + logger.debug("updated listQuestionContentDTO: " + listQuestionContentDTO); + } + else + { + logger.debug("entry duplicate, not adding"); + } + } + else + { + logger.debug("entry blank, not adding"); + } + + + logger.debug("entry using mark: " + mark); + mcGeneralAuthoringDTO.setMarkValue(mark); + + + request.setAttribute(LIST_QUESTION_CONTENT_DTO,listQuestionContentDTO); + sessionMap.put(LIST_QUESTION_CONTENT_DTO_KEY, listQuestionContentDTO); + logger.debug("listQuestionContentDTO now: " + listQuestionContentDTO); + + commonSaveCode(request, mcGeneralAuthoringDTO, + mcAuthoringForm, sessionMap, activeModule, strToolContentID, + defaultContentIdStr, mcService, httpSessionID,listQuestionContentDTO); + + request.setAttribute(TOTAL_QUESTION_COUNT, new Integer(listQuestionContentDTO.size())); + + setupCommonScreenData(mcContent, mcService,request); + + MonitoringUtil.setupAllSessionsData(request, mcContent,mcService); + + logger.debug("fwd ing to LOAD_MONITORING_CONTENT: " + LOAD_MONITORING_CONTENT); + return (mapping.findForward(LOAD_MONITORING_CONTENT)); + + } + /** - * acts as a proxy to authoring removeQuestion(....) - * removeQuestion(ActionMapping mapping, - ActionForm form, - HttpServletRequest request, - HttpServletResponse response) throws IOException, - ServletException + * newQuestionBox(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) * + * opens up an new screen within the current page for adding a new question * * @param mapping * @param form * @param request * @param response - * @return ActionForward + * @return * @throws IOException * @throws ServletException */ - public ActionForward removeQuestion(ActionMapping mapping, - ActionForm form, - HttpServletRequest request, - HttpServletResponse response) throws IOException, - ServletException - { - McUtils.cleanUpUserExceptions(request); - logger.debug("dispatching proxy removeQuestion..."); - request.getSession().setAttribute(IS_MONITORED_CONTENT_IN_USE, new Boolean(false).toString()); - request.setAttribute(SOURCE_MC_STARTER, "monitoring"); - logger.debug("SOURCE_MC_STARTER: monitoring"); + public ActionForward newQuestionBox(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) + throws IOException, ServletException + { + logger.debug("dispathcing newQuestionBox"); + McAuthoringForm mcAuthoringForm = (McMonitoringForm) form; + + IMcService mcService =McServiceProxy.getMcService(getServlet().getServletContext()); + logger.debug("mcService: " + mcService); + + String httpSessionID=mcAuthoringForm.getHttpSessionID(); + logger.debug("httpSessionID: " + httpSessionID); + + SessionMap sessionMap=(SessionMap)request.getSession().getAttribute(httpSessionID); + logger.debug("sessionMap: " + sessionMap); + + String contentFolderID = WebUtil.readStrParam(request, AttributeNames.PARAM_CONTENT_FOLDER_ID); + logger.debug("contentFolderID: " + contentFolderID); + mcAuthoringForm.setContentFolderID(contentFolderID); + + String activeModule=request.getParameter(ACTIVE_MODULE); + logger.debug("activeModule: " + activeModule); + + String strToolContentID=request.getParameter(AttributeNames.PARAM_TOOL_CONTENT_ID); + logger.debug("strToolContentID: " + strToolContentID); + + + logger.debug("attempt retrieving tool with signatute : " + MY_SIGNATURE); + long defaultContentID=mcService.getToolDefaultContentIdBySignature(MY_SIGNATURE); + logger.debug("retrieved tool default contentId: " + defaultContentID); + String defaultContentIdStr =new Long(defaultContentID).toString(); + logger.debug("retrieved defaultContentIdStr: " + defaultContentIdStr); + + + /* create default mcContent object*/ + McContent mcContent=mcService.retrieveMc(new Long(defaultContentIdStr)); + logger.debug("mcContent: " + mcContent); + + McGeneralAuthoringDTO mcGeneralAuthoringDTO= new McGeneralAuthoringDTO(); + logger.debug("mcGeneralAuthoringDTO: " + mcGeneralAuthoringDTO); + mcGeneralAuthoringDTO.setContentFolderID(contentFolderID); + + String richTextTitle = request.getParameter(TITLE); + String richTextInstructions = request.getParameter(INSTRUCTIONS); + + logger.debug("richTextTitle: " + richTextTitle); + logger.debug("richTextInstructions: " + richTextInstructions); + mcGeneralAuthoringDTO.setActivityTitle(richTextTitle); + mcAuthoringForm.setTitle(richTextTitle); - IMcService mcService =McUtils.getToolService(request); - if (mcService == null) + mcGeneralAuthoringDTO.setActivityInstructions(richTextInstructions); + + + McUtils.setFormProperties(request, mcService, + mcAuthoringForm, mcGeneralAuthoringDTO, strToolContentID, defaultContentIdStr, activeModule, sessionMap, httpSessionID); + + + mcGeneralAuthoringDTO.setDefineLaterInEditMode(new Boolean(true).toString()); + + AuthoringUtil authoringUtil = new AuthoringUtil(); + Map marksMap=authoringUtil.buildMarksMap(); + logger.debug("marksMap: " + marksMap); + mcGeneralAuthoringDTO.setMarksMap(marksMap); + + Map passMarksMap=authoringUtil.buildPassMarkMap(); + logger.debug("passMarksMap: " + passMarksMap); + mcGeneralAuthoringDTO.setPassMarksMap(passMarksMap); + + Map correctMap=authoringUtil.buildCorrectMap(); + logger.debug("correctMap: " + correctMap); + mcGeneralAuthoringDTO.setCorrectMap(correctMap); + + + logger.debug("mcGeneralAuthoringDTO now: " + mcGeneralAuthoringDTO); + request.setAttribute(MC_GENERAL_AUTHORING_DTO, mcGeneralAuthoringDTO); + + String requestType=request.getParameter("requestType"); + logger.debug("requestType: " + requestType); + + List listQuestionContentDTO=new LinkedList(); + + if ((requestType != null) && (requestType.equals("direct"))) { - logger.debug("will retrieve mcService"); - mcService = McServiceProxy.getMcService(getServlet().getServletContext()); - logger.debug("retrieving mcService from cache: " + mcService); + logger.debug("getting the list from the db: "); + listQuestionContentDTO=authoringUtil.buildDefaultQuestionContent(mcContent, mcService); + + int count=listQuestionContentDTO.size(); + logger.debug("question count: " + count); + request.setAttribute(CURRENT_EDITABLE_QUESTION_INDEX, new Integer(count + 1)); + } - request.getSession().setAttribute(TOOL_SERVICE, mcService); - logger.debug("mcService : " + mcService); - - request.getSession().setAttribute(CURRENT_MONITORING_TAB, "editActivity"); + else + { + logger.debug("getting the list from the cache: "); + listQuestionContentDTO=(List)sessionMap.get(LIST_QUESTION_CONTENT_DTO_KEY); + int count=listQuestionContentDTO.size(); + logger.debug("question count: " + count); + request.setAttribute(CURRENT_EDITABLE_QUESTION_INDEX, new Integer(count)); - Long toolContentId =(Long) request.getSession().getAttribute(TOOL_CONTENT_ID); - logger.debug("toolContentId: " + toolContentId); + } - McContent mcContent=mcService.retrieveMc(toolContentId); - logger.debug("mcContent:" + mcContent); - MonitoringUtil.setAttributeNoToolSessions(request, mcService, mcContent); + + logger.debug("listQuestionContentDTO: " + listQuestionContentDTO); - prepareReflectionData(request, mcContent, mcService, null,false); + request.setAttribute(TOTAL_QUESTION_COUNT, new Integer(listQuestionContentDTO.size())); - McAction mcAction = new McAction(); - return mcAction.removeQuestion(mapping, form, request, response); - } - - + logger.debug("final listQuestionContentDTO: " + listQuestionContentDTO); + request.setAttribute(LIST_QUESTION_CONTENT_DTO,listQuestionContentDTO); + + mcGeneralAuthoringDTO.setToolContentID(strToolContentID); + mcGeneralAuthoringDTO.setHttpSessionID(httpSessionID); + mcGeneralAuthoringDTO.setActiveModule(activeModule); + mcGeneralAuthoringDTO.setDefaultContentIdStr(defaultContentIdStr); + + mcAuthoringForm.setToolContentID(strToolContentID); + mcAuthoringForm.setHttpSessionID(httpSessionID); + mcAuthoringForm.setActiveModule(activeModule); + mcAuthoringForm.setDefaultContentIdStr(defaultContentIdStr); + + setupCommonScreenData(mcContent, mcService,request); + + MonitoringUtil.setupAllSessionsData(request, mcContent,mcService); + + logger.debug("fwd ing to newQuestionBox: "); + return (mapping.findForward("newQuestionBox")); + } + + /** - * acts as a proxy to authoring editOptions(...) - * editOptions(ActionMapping mapping, - ActionForm form, - HttpServletRequest request, - HttpServletResponse response) throws IOException, - ServletException + * ActionForward newEditableQuestionBox(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) * + * opens up an new screen within the current page for editing a question + * * @param mapping * @param form * @param request * @param response - * @return ActionForward + * @return * @throws IOException * @throws ServletException */ - public ActionForward editOptions(ActionMapping mapping, - ActionForm form, - HttpServletRequest request, - HttpServletResponse response) throws IOException, - ServletException + public ActionForward newEditableQuestionBox(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) + throws IOException, ServletException { - McUtils.cleanUpUserExceptions(request); - logger.debug("dispatching proxy editOptions..." + request); - request.getSession().setAttribute(IS_MONITORED_CONTENT_IN_USE, new Boolean(false).toString()); - request.setAttribute(SOURCE_MC_STARTER, "monitoring"); - logger.debug("SOURCE_MC_STARTER: monitoring"); + logger.debug("dispathcing newEditableQuestionBox"); + McAuthoringForm mcAuthoringForm = (McMonitoringForm) form; + + IMcService mcService =McServiceProxy.getMcService(getServlet().getServletContext()); + logger.debug("mcService: " + mcService); + + String httpSessionID=mcAuthoringForm.getHttpSessionID(); + logger.debug("httpSessionID: " + httpSessionID); + + SessionMap sessionMap=(SessionMap)request.getSession().getAttribute(httpSessionID); + logger.debug("sessionMap: " + sessionMap); - IMcService mcService =McUtils.getToolService(request); - if (mcService == null) - { - logger.debug("will retrieve mcService"); - mcService = McServiceProxy.getMcService(getServlet().getServletContext()); - logger.debug("retrieving mcService from cache: " + mcService); - } - request.getSession().setAttribute(TOOL_SERVICE, mcService); - logger.debug("mcService : " + mcService); + + String questionIndex=request.getParameter("questionIndex"); + logger.debug("questionIndex: " + questionIndex); + mcAuthoringForm.setQuestionIndex(questionIndex); + + request.setAttribute(CURRENT_EDITABLE_QUESTION_INDEX,questionIndex); + + mcAuthoringForm.setEditableQuestionIndex(questionIndex); + + List listQuestionContentDTO=(List)sessionMap.get(LIST_QUESTION_CONTENT_DTO_KEY); + logger.debug("listQuestionContentDTO: " + listQuestionContentDTO); + String editableQuestion=""; + String editableFeedback=""; + String editableMark=""; + Iterator listIterator=listQuestionContentDTO.iterator(); + while (listIterator.hasNext()) + { + McQuestionContentDTO mcQuestionContentDTO= (McQuestionContentDTO)listIterator.next(); + logger.debug("mcQuestionContentDTO:" + mcQuestionContentDTO); + logger.debug("mcQuestionContentDTO question:" + mcQuestionContentDTO.getQuestion()); + String question=mcQuestionContentDTO.getQuestion(); + String displayOrder=mcQuestionContentDTO.getDisplayOrder(); + + if ((displayOrder != null) && (!displayOrder.equals(""))) + { + if (displayOrder.equals(questionIndex)) + { + editableFeedback=mcQuestionContentDTO.getFeedback(); + editableQuestion=mcQuestionContentDTO.getQuestion(); + editableMark=mcQuestionContentDTO.getMark(); + logger.debug("editableFeedback found :" + editableFeedback); + + List candidates=mcQuestionContentDTO.getListCandidateAnswersDTO(); + logger.debug("candidates found :" + candidates); + + break; + } + + } + } + logger.debug("editableFeedback found :" + editableFeedback); + logger.debug("editableQuestion found :" + editableQuestion); + logger.debug("editableMark found :" + editableMark); + + String contentFolderID = WebUtil.readStrParam(request, AttributeNames.PARAM_CONTENT_FOLDER_ID); + logger.debug("contentFolderID: " + contentFolderID); + mcAuthoringForm.setContentFolderID(contentFolderID); + + + String activeModule=request.getParameter(ACTIVE_MODULE); + logger.debug("activeModule: " + activeModule); + + String strToolContentID=request.getParameter(AttributeNames.PARAM_TOOL_CONTENT_ID); + logger.debug("strToolContentID: " + strToolContentID); + + String defaultContentIdStr=request.getParameter(DEFAULT_CONTENT_ID_STR); + logger.debug("defaultContentIdStr: " + defaultContentIdStr); + + McContent mcContent=mcService.retrieveMc(new Long(strToolContentID)); + logger.debug("mcContent: " + mcContent); + + + McGeneralAuthoringDTO mcGeneralAuthoringDTO= new McGeneralAuthoringDTO(); + + mcGeneralAuthoringDTO.setMarkValue(editableMark); + + logger.debug("mcGeneralAuthoringDTO: " + mcGeneralAuthoringDTO); + mcGeneralAuthoringDTO.setContentFolderID(contentFolderID); + + + String richTextTitle = request.getParameter(TITLE); + String richTextInstructions = request.getParameter(INSTRUCTIONS); + + logger.debug("richTextTitle: " + richTextTitle); + logger.debug("richTextInstructions: " + richTextInstructions); + mcGeneralAuthoringDTO.setActivityTitle(richTextTitle); + mcAuthoringForm.setTitle(richTextTitle); - request.getSession().setAttribute(CURRENT_MONITORING_TAB, "editActivity"); - - Long toolContentId =(Long) request.getSession().getAttribute(TOOL_CONTENT_ID); - logger.debug("toolContentId: " + toolContentId); - - McContent mcContent=mcService.retrieveMc(toolContentId); - logger.debug("mcContent:" + mcContent); + mcGeneralAuthoringDTO.setActivityInstructions(richTextInstructions); + + McUtils.setFormProperties(request, mcService, + mcAuthoringForm, mcGeneralAuthoringDTO, strToolContentID, defaultContentIdStr, activeModule, sessionMap, httpSessionID); - MonitoringUtil.setAttributeNoToolSessions(request, mcService, mcContent); + mcGeneralAuthoringDTO.setEditableQuestionText(editableQuestion); + mcGeneralAuthoringDTO.setEditableQuestionFeedback (editableFeedback); + mcAuthoringForm.setFeedback(editableFeedback); + + mcGeneralAuthoringDTO.setDefineLaterInEditMode(new Boolean(true).toString()); + + AuthoringUtil authoringUtil = new AuthoringUtil(); + Map marksMap=authoringUtil.buildMarksMap(); + logger.debug("marksMap: " + marksMap); + mcGeneralAuthoringDTO.setMarksMap(marksMap); + + Map passMarksMap=authoringUtil.buildPassMarkMap(); + logger.debug("passMarksMap: " + passMarksMap); + mcGeneralAuthoringDTO.setPassMarksMap(passMarksMap); + + Map correctMap=authoringUtil.buildCorrectMap(); + logger.debug("correctMap: " + correctMap); + mcGeneralAuthoringDTO.setCorrectMap(correctMap); + - prepareReflectionData(request, mcContent, mcService, null,false); + logger.debug("mcGeneralAuthoringDTO now: " + mcGeneralAuthoringDTO); + request.setAttribute(MC_GENERAL_AUTHORING_DTO, mcGeneralAuthoringDTO); - McAction mcAction = new McAction(); - return mcAction.editOptions(mapping, form, request, response); + request.setAttribute(TOTAL_QUESTION_COUNT, new Integer(listQuestionContentDTO.size())); + + logger.debug("final listQuestionContentDTO: " + listQuestionContentDTO); + request.setAttribute(LIST_QUESTION_CONTENT_DTO,listQuestionContentDTO); + + mcGeneralAuthoringDTO.setToolContentID(strToolContentID); + mcGeneralAuthoringDTO.setHttpSessionID(httpSessionID); + mcGeneralAuthoringDTO.setActiveModule(activeModule); + mcGeneralAuthoringDTO.setDefaultContentIdStr(defaultContentIdStr); + + mcAuthoringForm.setToolContentID(strToolContentID); + mcAuthoringForm.setHttpSessionID(httpSessionID); + mcAuthoringForm.setActiveModule(activeModule); + mcAuthoringForm.setDefaultContentIdStr(defaultContentIdStr); + + setupCommonScreenData(mcContent, mcService,request); + + MonitoringUtil.setupAllSessionsData(request, mcContent,mcService); + + logger.debug("fwd ing to editQuestionBox: "); + return (mapping.findForward("editQuestionBox")); } + /** - * acts as a proxy to authoring addOption(...) - * addOption(ActionMapping mapping, - ActionForm form, - HttpServletRequest request, - HttpServletResponse response) throws IOException, - ServletException * + * ActionForward removeQuestion(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) + throws IOException, ServletException + + removes a question from the questions map + * * @param mapping * @param form * @param request * @param response - * @return ActionForward + * @return * @throws IOException * @throws ServletException */ - public ActionForward addOption(ActionMapping mapping, - ActionForm form, - HttpServletRequest request, - HttpServletResponse response) throws IOException, - ServletException - { - McUtils.cleanUpUserExceptions(request); - logger.debug("dispatching proxy addOption..."+ request); - request.getSession().setAttribute(IS_MONITORED_CONTENT_IN_USE, new Boolean(false).toString()); - request.setAttribute(SOURCE_MC_STARTER, "monitoring"); - logger.debug("SOURCE_MC_STARTER: monitoring"); + public ActionForward removeQuestion(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) + throws IOException, ServletException { + logger.debug("dispatching proxy removeQuestion"); + logger.debug("dispatching removeQuestion"); + McAuthoringForm mcAuthoringForm = (McMonitoringForm) form; + + IMcService mcService =McServiceProxy.getMcService(getServlet().getServletContext()); + logger.debug("mcService: " + mcService); + + String httpSessionID=mcAuthoringForm.getHttpSessionID(); + logger.debug("httpSessionID: " + httpSessionID); + + SessionMap sessionMap=(SessionMap)request.getSession().getAttribute(httpSessionID); + logger.debug("sessionMap: " + sessionMap); + + String questionIndex=request.getParameter("questionIndex"); + logger.debug("questionIndex: " + questionIndex); + mcAuthoringForm.setQuestionIndex(questionIndex); + - IMcService mcService =McUtils.getToolService(request); - if (mcService == null) - { - logger.debug("will retrieve mcService"); - mcService = McServiceProxy.getMcService(getServlet().getServletContext()); - logger.debug("retrieving mcService from cache: " + mcService); - } - request.getSession().setAttribute(TOOL_SERVICE, mcService); - logger.debug("mcService : " + mcService); + List listQuestionContentDTO=(List)sessionMap.get(LIST_QUESTION_CONTENT_DTO_KEY); + logger.debug("listQuestionContentDTO: " + listQuestionContentDTO); + + McQuestionContentDTO mcQuestionContentDTO= null; + Iterator listIterator=listQuestionContentDTO.iterator(); + while (listIterator.hasNext()) + { + mcQuestionContentDTO= (McQuestionContentDTO)listIterator.next(); + logger.debug("mcQuestionContentDTO:" + mcQuestionContentDTO); + logger.debug("mcQuestionContentDTO question:" + mcQuestionContentDTO.getQuestion()); + + String question=mcQuestionContentDTO.getQuestion(); + String displayOrder=mcQuestionContentDTO.getDisplayOrder(); + logger.debug("displayOrder:" + displayOrder); + + if ((displayOrder != null) && (!displayOrder.equals(""))) + { + if (displayOrder.equals(questionIndex)) + { + break; + } + + } + } + logger.debug("mcQuestionContentDTO found:" + mcQuestionContentDTO); + mcQuestionContentDTO.setQuestion(""); + logger.debug("listQuestionContentDTO after remove:" + listQuestionContentDTO); + - request.getSession().setAttribute(CURRENT_MONITORING_TAB, "editActivity"); + listQuestionContentDTO=AuthoringUtil.reorderListQuestionContentDTO(listQuestionContentDTO, questionIndex ); + logger.debug("listQuestionContentDTO reordered:" + listQuestionContentDTO); + + + sessionMap.put(LIST_QUESTION_CONTENT_DTO_KEY, listQuestionContentDTO); - Long toolContentId =(Long) request.getSession().getAttribute(TOOL_CONTENT_ID); - logger.debug("toolContentId: " + toolContentId); - - McContent mcContent=mcService.retrieveMc(toolContentId); - logger.debug("mcContent:" + mcContent); + String contentFolderID = WebUtil.readStrParam(request, AttributeNames.PARAM_CONTENT_FOLDER_ID); + logger.debug("contentFolderID: " + contentFolderID); + mcAuthoringForm.setContentFolderID(contentFolderID); + - MonitoringUtil.setAttributeNoToolSessions(request, mcService, mcContent); - - prepareReflectionData(request, mcContent, mcService, null,false); + String activeModule=request.getParameter(ACTIVE_MODULE); + logger.debug("activeModule: " + activeModule); + + String richTextTitle = request.getParameter(TITLE); + logger.debug("richTextTitle: " + richTextTitle); + + String richTextInstructions = request.getParameter(INSTRUCTIONS); + logger.debug("richTextInstructions: " + richTextInstructions); + - McAction mcAction = new McAction(); - return mcAction.addOption(mapping, form, request, response); - } - - - /** acts as a proxy to authoring removeOption(...) - * removeOption(ActionMapping mapping, - ActionForm form, - HttpServletRequest request, - HttpServletResponse response) throws IOException, - ServletException - * - * @param mapping - * @param form - * @param request - * @param response - * @return ActionForward - * @throws IOException - * @throws ServletException - */ - public ActionForward removeOption(ActionMapping mapping, - ActionForm form, - HttpServletRequest request, - HttpServletResponse response) throws IOException, - ServletException - { - McUtils.cleanUpUserExceptions(request); - logger.debug("dispatching proxy removeOption..." + request); - request.getSession().setAttribute(IS_MONITORED_CONTENT_IN_USE, new Boolean(false).toString()); - request.setAttribute(SOURCE_MC_STARTER, "monitoring"); - logger.debug("SOURCE_MC_STARTER: monitoring"); + sessionMap.put(ACTIVITY_TITLE_KEY, richTextTitle); + sessionMap.put(ACTIVITY_INSTRUCTIONS_KEY, richTextInstructions); - IMcService mcService =McUtils.getToolService(request); - if (mcService == null) + + String strToolContentID=request.getParameter(AttributeNames.PARAM_TOOL_CONTENT_ID); + logger.debug("strToolContentID: " + strToolContentID); + + String defaultContentIdStr=request.getParameter(DEFAULT_CONTENT_ID_STR); + logger.debug("defaultContentIdStr: " + defaultContentIdStr); + + McContent mcContent=mcService.retrieveMc(new Long(strToolContentID)); + logger.debug("mcContent: " + mcContent); + + if (mcContent == null) { - logger.debug("will retrieve mcService"); - mcService = McServiceProxy.getMcService(getServlet().getServletContext()); - logger.debug("retrieving mcService from cache: " + mcService); + logger.debug("using defaultContentIdStr: " + defaultContentIdStr); + mcContent=mcService.retrieveMc(new Long(defaultContentIdStr)); } - request.getSession().setAttribute(TOOL_SERVICE, mcService); - logger.debug("mcService : " + mcService); - - - request.getSession().setAttribute(CURRENT_MONITORING_TAB, "editActivity"); + logger.debug("final mcContent: " + mcContent); - Long toolContentId =(Long) request.getSession().getAttribute(TOOL_CONTENT_ID); - logger.debug("toolContentId: " + toolContentId); - - McContent mcContent=mcService.retrieveMc(toolContentId); - logger.debug("mcContent:" + mcContent); + McGeneralAuthoringDTO mcGeneralAuthoringDTO= new McGeneralAuthoringDTO(); + logger.debug("mcGeneralAuthoringDTO: " + mcGeneralAuthoringDTO); + mcGeneralAuthoringDTO.setContentFolderID(contentFolderID); - MonitoringUtil.setAttributeNoToolSessions(request, mcService, mcContent); + mcGeneralAuthoringDTO.setActivityTitle(richTextTitle); + mcAuthoringForm.setTitle(richTextTitle); + + mcGeneralAuthoringDTO.setActivityInstructions(richTextInstructions); + + AuthoringUtil authoringUtil= new AuthoringUtil(); + + mcGeneralAuthoringDTO.setEditActivityEditMode(new Boolean(true).toString()); + + request.getSession().setAttribute(httpSessionID, sessionMap); + + McUtils.setFormProperties(request, mcService, + mcAuthoringForm, mcGeneralAuthoringDTO, strToolContentID, defaultContentIdStr, activeModule, sessionMap, httpSessionID); + + + mcGeneralAuthoringDTO.setToolContentID(strToolContentID); + mcGeneralAuthoringDTO.setHttpSessionID(httpSessionID); + mcGeneralAuthoringDTO.setActiveModule(activeModule); + mcGeneralAuthoringDTO.setDefaultContentIdStr(defaultContentIdStr); + mcAuthoringForm.setToolContentID(strToolContentID); + mcAuthoringForm.setHttpSessionID(httpSessionID); + mcAuthoringForm.setActiveModule(activeModule); + mcAuthoringForm.setDefaultContentIdStr(defaultContentIdStr); + mcAuthoringForm.setCurrentTab("3"); + + request.setAttribute(LIST_QUESTION_CONTENT_DTO,listQuestionContentDTO); + logger.debug("mcQuestionContentDTO now: " + mcQuestionContentDTO); + logger.debug("listQuestionContentDTO now: " + listQuestionContentDTO); + + mcGeneralAuthoringDTO.setDefineLaterInEditMode(new Boolean(true).toString()); + + Map marksMap=authoringUtil.buildMarksMap(); + logger.debug("marksMap: " + marksMap); + mcGeneralAuthoringDTO.setMarksMap(marksMap); + + Map passMarksMap=authoringUtil.buildPassMarkMap(); + logger.debug("passMarksMap: " + passMarksMap); + mcGeneralAuthoringDTO.setPassMarksMap(passMarksMap); + - prepareReflectionData(request, mcContent, mcService, null,false); + Map correctMap=authoringUtil.buildCorrectMap(); + logger.debug("correctMap: " + correctMap); + mcGeneralAuthoringDTO.setCorrectMap(correctMap); + + logger.debug("before saving final mcGeneralAuthoringDTO: " + mcGeneralAuthoringDTO); + request.setAttribute(MC_GENERAL_AUTHORING_DTO, mcGeneralAuthoringDTO); + request.setAttribute(TOTAL_QUESTION_COUNT, new Integer(listQuestionContentDTO.size())); - McAction mcAction = new McAction(); - return mcAction.removeOption(mapping, form, request, response); + setupCommonScreenData(mcContent, mcService,request); + + MonitoringUtil.setupAllSessionsData(request, mcContent,mcService); + + logger.debug("fwd ing to LOAD_MONITORING_CONTENT: " + LOAD_MONITORING_CONTENT); + return (mapping.findForward(LOAD_MONITORING_CONTENT)); } /** - * acts as a proxy to authoring moveQuestionDown(...) - * moveQuestionDown(ActionMapping mapping, - ActionForm form, - HttpServletRequest request, - HttpServletResponse response) throws IOException, - ServletException + * ActionForward moveQuestionDown(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) * + * moves a question down in the list * * @param mapping * @param form * @param request * @param response - * @return ActionForward + * @return * @throws IOException * @throws ServletException */ - public ActionForward moveQuestionDown(ActionMapping mapping, - ActionForm form, - HttpServletRequest request, - HttpServletResponse response) throws IOException, - ServletException - { - McUtils.cleanUpUserExceptions(request); - logger.debug("dispatching proxy moveQuestionDown..." + request); - request.getSession().setAttribute(IS_MONITORED_CONTENT_IN_USE, new Boolean(false).toString()); - request.setAttribute(SOURCE_MC_STARTER, "monitoring"); - logger.debug("SOURCE_MC_STARTER: monitoring"); - - IMcService mcService =McUtils.getToolService(request); - if (mcService == null) - { - logger.debug("will retrieve mcService"); - mcService = McServiceProxy.getMcService(getServlet().getServletContext()); - logger.debug("retrieving mcService from cache: " + mcService); - } - request.getSession().setAttribute(TOOL_SERVICE, mcService); - logger.debug("mcService : " + mcService); - + public ActionForward moveQuestionDown(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) + throws IOException, ServletException { + logger.debug("dispatching proxy moveQuestionDown"); + logger.debug("dispatching moveQuestionDown"); + McAuthoringForm mcAuthoringForm = (McMonitoringForm) form; + + IMcService mcService =McServiceProxy.getMcService(getServlet().getServletContext()); + logger.debug("mcService: " + mcService); + + String httpSessionID=mcAuthoringForm.getHttpSessionID(); + logger.debug("httpSessionID: " + httpSessionID); + + SessionMap sessionMap=(SessionMap)request.getSession().getAttribute(httpSessionID); + logger.debug("sessionMap: " + sessionMap); + + String questionIndex=request.getParameter("questionIndex"); + logger.debug("questionIndex: " + questionIndex); + mcAuthoringForm.setQuestionIndex(questionIndex); + + + List listQuestionContentDTO=(List)sessionMap.get(LIST_QUESTION_CONTENT_DTO_KEY); + logger.debug("listQuestionContentDTO: " + listQuestionContentDTO); - request.getSession().setAttribute(CURRENT_MONITORING_TAB, "editActivity"); + listQuestionContentDTO=AuthoringUtil.swapNodes(listQuestionContentDTO, questionIndex, "down"); + logger.debug("listQuestionContentDTO after swap: " + listQuestionContentDTO); + + listQuestionContentDTO=AuthoringUtil.reorderSimpleListQuestionContentDTO(listQuestionContentDTO); + logger.debug("listQuestionContentDTO after reordersimple: " + listQuestionContentDTO); - Long toolContentId =(Long) request.getSession().getAttribute(TOOL_CONTENT_ID); - logger.debug("toolContentId: " + toolContentId); - McContent mcContent=mcService.retrieveMc(toolContentId); - logger.debug("mcContent:" + mcContent); + sessionMap.put(LIST_QUESTION_CONTENT_DTO_KEY, listQuestionContentDTO); + + + String contentFolderID = WebUtil.readStrParam(request, AttributeNames.PARAM_CONTENT_FOLDER_ID); + logger.debug("contentFolderID: " + contentFolderID); + mcAuthoringForm.setContentFolderID(contentFolderID); + - MonitoringUtil.setAttributeNoToolSessions(request, mcService, mcContent); + String activeModule=request.getParameter(ACTIVE_MODULE); + logger.debug("activeModule: " + activeModule); + + String richTextTitle = request.getParameter(TITLE); + logger.debug("richTextTitle: " + richTextTitle); - prepareReflectionData(request, mcContent, mcService, null,false); + String richTextInstructions = request.getParameter(INSTRUCTIONS); + logger.debug("richTextInstructions: " + richTextInstructions); + - McAction mcAction = new McAction(); - return mcAction.moveQuestionDown(mapping, form, request, response); - } - - - /** - * acts as a proxy to authoring moveQuestionUp(...) - * moveQuestionUp(ActionMapping mapping, - ActionForm form, - HttpServletRequest request, - HttpServletResponse response) throws IOException, - ServletException - - * @param mapping - * @param form - * @param request - * @param response - * @return - * @throws IOException - * @throws ServletException - */ - public ActionForward moveQuestionUp(ActionMapping mapping, - ActionForm form, - HttpServletRequest request, - HttpServletResponse response) throws IOException, - ServletException - { - McUtils.cleanUpUserExceptions(request); - logger.debug("dispatching proxy moveQuestionUp..." + request); - request.getSession().setAttribute(IS_MONITORED_CONTENT_IN_USE, new Boolean(false).toString()); - request.setAttribute(SOURCE_MC_STARTER, "monitoring"); - logger.debug("SOURCE_MC_STARTER: monitoring"); + sessionMap.put(ACTIVITY_TITLE_KEY, richTextTitle); + sessionMap.put(ACTIVITY_INSTRUCTIONS_KEY, richTextInstructions); + + + String strToolContentID=request.getParameter(AttributeNames.PARAM_TOOL_CONTENT_ID); + logger.debug("strToolContentID: " + strToolContentID); + + String defaultContentIdStr=request.getParameter(DEFAULT_CONTENT_ID_STR); + logger.debug("defaultContentIdStr: " + defaultContentIdStr); + + McContent mcContent=mcService.retrieveMc(new Long(strToolContentID)); + logger.debug("mcContent: " + mcContent); - IMcService mcService =McUtils.getToolService(request); - if (mcService == null) - { - logger.debug("will retrieve mcService"); - mcService = McServiceProxy.getMcService(getServlet().getServletContext()); - logger.debug("retrieving mcService from cache: " + mcService); - } - request.getSession().setAttribute(TOOL_SERVICE, mcService); - logger.debug("mcService : " + mcService); - + McGeneralAuthoringDTO mcGeneralAuthoringDTO= new McGeneralAuthoringDTO(); + logger.debug("mcGeneralAuthoringDTO: " + mcGeneralAuthoringDTO); + mcGeneralAuthoringDTO.setContentFolderID(contentFolderID); + + mcGeneralAuthoringDTO.setActivityTitle(richTextTitle); + mcAuthoringForm.setTitle(richTextTitle); - request.getSession().setAttribute(CURRENT_MONITORING_TAB, "editActivity"); - - Long toolContentId =(Long) request.getSession().getAttribute(TOOL_CONTENT_ID); - logger.debug("toolContentId: " + toolContentId); + mcGeneralAuthoringDTO.setActivityInstructions(richTextInstructions); + + AuthoringUtil authoringUtil= new AuthoringUtil(); - McContent mcContent=mcService.retrieveMc(toolContentId); - logger.debug("mcContent:" + mcContent); + mcGeneralAuthoringDTO.setEditActivityEditMode(new Boolean(true).toString()); + + request.getSession().setAttribute(httpSessionID, sessionMap); + + McUtils.setFormProperties(request, mcService, + mcAuthoringForm, mcGeneralAuthoringDTO, strToolContentID, defaultContentIdStr, activeModule, sessionMap, httpSessionID); + - MonitoringUtil.setAttributeNoToolSessions(request, mcService, mcContent); + mcGeneralAuthoringDTO.setToolContentID(strToolContentID); + mcGeneralAuthoringDTO.setHttpSessionID(httpSessionID); + mcGeneralAuthoringDTO.setActiveModule(activeModule); + mcGeneralAuthoringDTO.setDefaultContentIdStr(defaultContentIdStr); + mcAuthoringForm.setToolContentID(strToolContentID); + mcAuthoringForm.setHttpSessionID(httpSessionID); + mcAuthoringForm.setActiveModule(activeModule); + mcAuthoringForm.setDefaultContentIdStr(defaultContentIdStr); + mcAuthoringForm.setCurrentTab("3"); + + request.setAttribute(LIST_QUESTION_CONTENT_DTO,listQuestionContentDTO); + logger.debug("listQuestionContentDTO now: " + listQuestionContentDTO); + + mcGeneralAuthoringDTO.setDefineLaterInEditMode(new Boolean(true).toString()); + + Map marksMap=authoringUtil.buildMarksMap(); + logger.debug("marksMap: " + marksMap); + mcGeneralAuthoringDTO.setMarksMap(marksMap); + + Map passMarksMap=authoringUtil.buildPassMarkMap(); + logger.debug("passMarksMap: " + passMarksMap); + mcGeneralAuthoringDTO.setPassMarksMap(passMarksMap); + + Map correctMap=authoringUtil.buildCorrectMap(); + logger.debug("correctMap: " + correctMap); + mcGeneralAuthoringDTO.setCorrectMap(correctMap); - prepareReflectionData(request, mcContent, mcService, null,false); + logger.debug("before saving final mcGeneralAuthoringDTO: " + mcGeneralAuthoringDTO); + request.setAttribute(MC_GENERAL_AUTHORING_DTO, mcGeneralAuthoringDTO); + + request.setAttribute(TOTAL_QUESTION_COUNT, new Integer(listQuestionContentDTO.size())); + + setupCommonScreenData(mcContent, mcService,request); - McAction mcAction = new McAction(); - return mcAction.moveQuestionUp(mapping, form, request, response); + MonitoringUtil.setupAllSessionsData(request, mcContent,mcService); + + logger.debug("fwd ing to LOAD_MONITORING_CONTENT: " + LOAD_MONITORING_CONTENT); + return (mapping.findForward(LOAD_MONITORING_CONTENT)); } + /** - * acts as a proxy to authoring doneOptions(...) - * doneOptions(ActionMapping mapping, - ActionForm form, - HttpServletRequest request, - HttpServletResponse response) throws IOException, - ServletException + * ActionForward moveQuestionUp(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) * + * moves a question up in the list + * * @param mapping * @param form * @param request * @param response - * @return ActionForward + * @return * @throws IOException * @throws ServletException */ - public ActionForward doneOptions(ActionMapping mapping, - ActionForm form, - HttpServletRequest request, - HttpServletResponse response) throws IOException, - ServletException - { - McUtils.cleanUpUserExceptions(request); - logger.debug("dispatching proxy doneOptions..."); - request.getSession().setAttribute(IS_MONITORED_CONTENT_IN_USE, new Boolean(false).toString()); - request.setAttribute(SOURCE_MC_STARTER, "monitoring"); - logger.debug("SOURCE_MC_STARTER: monitoring"); + public ActionForward moveQuestionUp(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) + throws IOException, ServletException { + logger.debug("dispatching proxy moveQuestionUp"); + logger.debug("dispatching moveQuestionUp"); + McAuthoringForm mcAuthoringForm = (McMonitoringForm) form; + + IMcService mcService =McServiceProxy.getMcService(getServlet().getServletContext()); + logger.debug("mcService: " + mcService); + + String httpSessionID=mcAuthoringForm.getHttpSessionID(); + logger.debug("httpSessionID: " + httpSessionID); + + SessionMap sessionMap=(SessionMap)request.getSession().getAttribute(httpSessionID); + logger.debug("sessionMap: " + sessionMap); + + String questionIndex=request.getParameter("questionIndex"); + logger.debug("questionIndex: " + questionIndex); + mcAuthoringForm.setQuestionIndex(questionIndex); + + + List listQuestionContentDTO=(List)sessionMap.get(LIST_QUESTION_CONTENT_DTO_KEY); + logger.debug("listQuestionContentDTO: " + listQuestionContentDTO); + + listQuestionContentDTO=AuthoringUtil.swapNodes(listQuestionContentDTO, questionIndex, "up"); + logger.debug("listQuestionContentDTO after swap: " + listQuestionContentDTO); + + listQuestionContentDTO=AuthoringUtil.reorderSimpleListQuestionContentDTO(listQuestionContentDTO); + logger.debug("listQuestionContentDTO after reordersimple: " + listQuestionContentDTO); + + sessionMap.put(LIST_QUESTION_CONTENT_DTO_KEY, listQuestionContentDTO); + + String contentFolderID = WebUtil.readStrParam(request, AttributeNames.PARAM_CONTENT_FOLDER_ID); + logger.debug("contentFolderID: " + contentFolderID); + mcAuthoringForm.setContentFolderID(contentFolderID); + + + String activeModule=request.getParameter(ACTIVE_MODULE); + logger.debug("activeModule: " + activeModule); + + String richTextTitle = request.getParameter(TITLE); + logger.debug("richTextTitle: " + richTextTitle); + + String richTextInstructions = request.getParameter(INSTRUCTIONS); + logger.debug("richTextInstructions: " + richTextInstructions); + + + sessionMap.put(ACTIVITY_TITLE_KEY, richTextTitle); + sessionMap.put(ACTIVITY_INSTRUCTIONS_KEY, richTextInstructions); + + + String strToolContentID=request.getParameter(AttributeNames.PARAM_TOOL_CONTENT_ID); + logger.debug("strToolContentID: " + strToolContentID); + + String defaultContentIdStr=request.getParameter(DEFAULT_CONTENT_ID_STR); + logger.debug("defaultContentIdStr: " + defaultContentIdStr); + + McContent mcContent=mcService.retrieveMc(new Long(strToolContentID)); + logger.debug("mcContent: " + mcContent); + + McGeneralAuthoringDTO mcGeneralAuthoringDTO= new McGeneralAuthoringDTO(); + logger.debug("mcGeneralAuthoringDTO: " + mcGeneralAuthoringDTO); + mcGeneralAuthoringDTO.setContentFolderID(contentFolderID); + + mcGeneralAuthoringDTO.setActivityTitle(richTextTitle); + mcAuthoringForm.setTitle(richTextTitle); + + mcGeneralAuthoringDTO.setActivityInstructions(richTextInstructions); + AuthoringUtil authoringUtil= new AuthoringUtil(); + + mcGeneralAuthoringDTO.setEditActivityEditMode(new Boolean(true).toString()); + + request.getSession().setAttribute(httpSessionID, sessionMap); + + McUtils.setFormProperties(request, mcService, + mcAuthoringForm, mcGeneralAuthoringDTO, strToolContentID, defaultContentIdStr, activeModule, sessionMap, httpSessionID); + + + mcGeneralAuthoringDTO.setToolContentID(strToolContentID); + mcGeneralAuthoringDTO.setHttpSessionID(httpSessionID); + mcGeneralAuthoringDTO.setActiveModule(activeModule); + mcGeneralAuthoringDTO.setDefaultContentIdStr(defaultContentIdStr); + mcAuthoringForm.setToolContentID(strToolContentID); + mcAuthoringForm.setHttpSessionID(httpSessionID); + mcAuthoringForm.setActiveModule(activeModule); + mcAuthoringForm.setDefaultContentIdStr(defaultContentIdStr); + mcAuthoringForm.setCurrentTab("3"); + + request.setAttribute(LIST_QUESTION_CONTENT_DTO,listQuestionContentDTO); + logger.debug("listQuestionContentDTO now: " + listQuestionContentDTO); + + mcGeneralAuthoringDTO.setDefineLaterInEditMode(new Boolean(true).toString()); - IMcService mcService =McUtils.getToolService(request); - if (mcService == null) - { - logger.debug("will retrieve mcService"); - mcService = McServiceProxy.getMcService(getServlet().getServletContext()); - logger.debug("retrieving mcService from cache: " + mcService); - } - request.getSession().setAttribute(TOOL_SERVICE, mcService); - logger.debug("mcService : " + mcService); + Map marksMap=authoringUtil.buildMarksMap(); + logger.debug("marksMap: " + marksMap); + mcGeneralAuthoringDTO.setMarksMap(marksMap); + Map passMarksMap=authoringUtil.buildPassMarkMap(); + logger.debug("passMarksMap: " + passMarksMap); + mcGeneralAuthoringDTO.setPassMarksMap(passMarksMap); - request.getSession().setAttribute(CURRENT_MONITORING_TAB, "editActivity"); - - Long toolContentId =(Long) request.getSession().getAttribute(TOOL_CONTENT_ID); - logger.debug("toolContentId: " + toolContentId); + Map correctMap=authoringUtil.buildCorrectMap(); + logger.debug("correctMap: " + correctMap); + mcGeneralAuthoringDTO.setCorrectMap(correctMap); - McContent mcContent=mcService.retrieveMc(toolContentId); - logger.debug("mcContent:" + mcContent); + logger.debug("before saving final mcGeneralAuthoringDTO: " + mcGeneralAuthoringDTO); + request.setAttribute(MC_GENERAL_AUTHORING_DTO, mcGeneralAuthoringDTO); + + request.setAttribute(TOTAL_QUESTION_COUNT, new Integer(listQuestionContentDTO.size())); - MonitoringUtil.setAttributeNoToolSessions(request, mcService, mcContent); - - prepareReflectionData(request, mcContent, mcService, null,false); + setupCommonScreenData(mcContent, mcService,request); - McAction mcAction = new McAction(); - return mcAction.doneOptions(mapping, form, request, response); + MonitoringUtil.setupAllSessionsData(request, mcContent,mcService); + + logger.debug("fwd ing to LOAD_MONITORING_CONTENT: " + LOAD_MONITORING_CONTENT); + return (mapping.findForward(LOAD_MONITORING_CONTENT)); } /** - * acts as a proxy to authoring submitQuestions(...) - * submitQuestions(ActionMapping mapping, - ActionForm form, - HttpServletRequest request, - HttpServletResponse response) throws IOException, - ServletException + * ActionForward moveCandidateDown(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) * + * moves a candidate question down in the list + * * @param mapping * @param form * @param request * @param response - * @return ActionForward + * @return * @throws IOException * @throws ServletException */ - public ActionForward submitQuestions(ActionMapping mapping, - ActionForm form, - HttpServletRequest request, - HttpServletResponse response) throws IOException, - ServletException + public ActionForward moveCandidateDown(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) + throws IOException, ServletException { + logger.debug("dispatching moveCandidateDown"); + McAuthoringForm mcAuthoringForm = (McAuthoringForm) form; + + IMcService mcService =McServiceProxy.getMcService(getServlet().getServletContext()); + logger.debug("mcService: " + mcService); + + String httpSessionID=mcAuthoringForm.getHttpSessionID(); + logger.debug("httpSessionID: " + httpSessionID); + + SessionMap sessionMap=(SessionMap)request.getSession().getAttribute(httpSessionID); + logger.debug("sessionMap: " + sessionMap); + + String questionIndex=request.getParameter("questionIndex"); + logger.debug("questionIndex: " + questionIndex); + mcAuthoringForm.setQuestionIndex(questionIndex); + + String candidateIndex=request.getParameter("candidateIndex"); + logger.debug("candidateIndex: " + candidateIndex); + mcAuthoringForm.setCandidateIndex(candidateIndex); + - { - McUtils.cleanUpUserExceptions(request); - logger.debug("dispatching proxy submitQuestions..." + request); - request.getSession().setAttribute(IS_MONITORED_CONTENT_IN_USE, new Boolean(false).toString()); - request.setAttribute(SOURCE_MC_STARTER, "monitoring"); - logger.debug("SOURCE_MC_STARTER: monitoring"); + AuthoringUtil authoringUtil = new AuthoringUtil(); + List caList=authoringUtil.repopulateCandidateAnswersBox(request, false); + logger.debug("repopulated caList: " + caList); - IMcService mcService =McUtils.getToolService(request); - if (mcService == null) - { - logger.debug("will retrieve mcService"); - mcService = McServiceProxy.getMcService(getServlet().getServletContext()); - logger.debug("retrieving mcService from cache: " + mcService); - } - request.getSession().setAttribute(TOOL_SERVICE, mcService); - logger.debug("mcService : " + mcService); + + List listQuestionContentDTO=(List)sessionMap.get(LIST_QUESTION_CONTENT_DTO_KEY); + logger.debug("listQuestionContentDTO: " + listQuestionContentDTO); + + + List candidates =new LinkedList(); + List listCandidates =new LinkedList(); + String editableQuestion=""; + Iterator listIterator=listQuestionContentDTO.iterator(); + while (listIterator.hasNext()) + { + McQuestionContentDTO mcQuestionContentDTO= (McQuestionContentDTO)listIterator.next(); + logger.debug("mcQuestionContentDTO:" + mcQuestionContentDTO); + + logger.debug("mcQuestionContentDTO question:" + mcQuestionContentDTO.getQuestion()); + String question=mcQuestionContentDTO.getQuestion(); + String displayOrder=mcQuestionContentDTO.getDisplayOrder(); + + if ((displayOrder != null) && (!displayOrder.equals(""))) + { + if (displayOrder.equals(questionIndex)) + { + logger.debug("displayOrder equals questionIndex :" + questionIndex); + editableQuestion=mcQuestionContentDTO.getQuestion(); + + candidates=mcQuestionContentDTO.getListCandidateAnswersDTO(); + logger.debug("candidates found :" + candidates); + logger.debug("but we are using the repopulated caList here: " + caList); + + listCandidates=AuthoringUtil.swapCandidateNodes(caList, candidateIndex, "down"); + logger.debug("swapped candidates :" + listCandidates); + + mcQuestionContentDTO.setListCandidateAnswersDTO(listCandidates); + + break; + } + + } + } + logger.debug("candidates found :" + candidates); + logger.debug("swapped candidates is :" + listCandidates); + logger.debug("listQuestionContentDTO after swapped candidates :" + listQuestionContentDTO); + - /*set the current tab*/ - request.getSession().setAttribute(CURRENT_MONITORING_TAB, "editActivity"); + sessionMap.put(LIST_QUESTION_CONTENT_DTO_KEY, listQuestionContentDTO); - /* present the view-only screen first */ - request.getSession().setAttribute(ACTIVE_MODULE, DEFINE_LATER); - request.getSession().setAttribute(DEFINE_LATER_IN_EDIT_MODE, new Boolean(false)); + + String contentFolderID = WebUtil.readStrParam(request, AttributeNames.PARAM_CONTENT_FOLDER_ID); + logger.debug("contentFolderID: " + contentFolderID); + mcAuthoringForm.setContentFolderID(contentFolderID); + + + String activeModule=request.getParameter(ACTIVE_MODULE); + logger.debug("activeModule: " + activeModule); + + String richTextTitle = request.getParameter(TITLE); + logger.debug("richTextTitle: " + richTextTitle); + + String richTextInstructions = request.getParameter(INSTRUCTIONS); + logger.debug("richTextInstructions: " + richTextInstructions); + + + sessionMap.put(ACTIVITY_TITLE_KEY, richTextTitle); + sessionMap.put(ACTIVITY_INSTRUCTIONS_KEY, richTextInstructions); + + + String strToolContentID=request.getParameter(AttributeNames.PARAM_TOOL_CONTENT_ID); + logger.debug("strToolContentID: " + strToolContentID); + + String defaultContentIdStr=request.getParameter(DEFAULT_CONTENT_ID_STR); + logger.debug("defaultContentIdStr: " + defaultContentIdStr); + + McContent mcContent=mcService.retrieveMc(new Long(strToolContentID)); + logger.debug("mcContent: " + mcContent); - Long toolContentId =(Long) request.getSession().getAttribute(TOOL_CONTENT_ID); - logger.debug("toolContentId: " + toolContentId); + McGeneralAuthoringDTO mcGeneralAuthoringDTO= new McGeneralAuthoringDTO(); + logger.debug("mcGeneralAuthoringDTO: " + mcGeneralAuthoringDTO); + mcGeneralAuthoringDTO.setContentFolderID(contentFolderID); + + mcGeneralAuthoringDTO.setActivityTitle(richTextTitle); + mcAuthoringForm.setTitle(richTextTitle); - McContent mcContent=mcService.retrieveMc(toolContentId); - logger.debug("mcContent:" + mcContent); + mcGeneralAuthoringDTO.setActivityInstructions(richTextInstructions); + + mcGeneralAuthoringDTO.setEditActivityEditMode(new Boolean(true).toString()); + + request.getSession().setAttribute(httpSessionID, sessionMap); + + McUtils.setFormProperties(request, mcService, + mcAuthoringForm, mcGeneralAuthoringDTO, strToolContentID, defaultContentIdStr, activeModule, sessionMap, httpSessionID); + - MonitoringUtil.setAttributeNoToolSessions(request, mcService, mcContent); + mcGeneralAuthoringDTO.setToolContentID(strToolContentID); + mcGeneralAuthoringDTO.setHttpSessionID(httpSessionID); + mcGeneralAuthoringDTO.setActiveModule(activeModule); + mcGeneralAuthoringDTO.setDefaultContentIdStr(defaultContentIdStr); + mcAuthoringForm.setToolContentID(strToolContentID); + mcAuthoringForm.setHttpSessionID(httpSessionID); + mcAuthoringForm.setActiveModule(activeModule); + mcAuthoringForm.setDefaultContentIdStr(defaultContentIdStr); + mcAuthoringForm.setCurrentTab("1"); + + request.setAttribute(LIST_QUESTION_CONTENT_DTO,listQuestionContentDTO); + logger.debug("listQuestionContentDTO now: " + listQuestionContentDTO); + + mcGeneralAuthoringDTO.setDefineLaterInEditMode(new Boolean(true).toString()); + + Map marksMap=authoringUtil.buildMarksMap(); + logger.debug("marksMap: " + marksMap); + mcGeneralAuthoringDTO.setMarksMap(marksMap); + + Map passMarksMap=authoringUtil.buildPassMarkMap(); + logger.debug("passMarksMap: " + passMarksMap); + mcGeneralAuthoringDTO.setPassMarksMap(passMarksMap); + + Map correctMap=authoringUtil.buildCorrectMap(); + logger.debug("correctMap: " + correctMap); + mcGeneralAuthoringDTO.setCorrectMap(correctMap); + + logger.debug("before saving final mcGeneralAuthoringDTO: " + mcGeneralAuthoringDTO); + request.setAttribute(MC_GENERAL_AUTHORING_DTO, mcGeneralAuthoringDTO); + + request.setAttribute(TOTAL_QUESTION_COUNT, new Integer(listQuestionContentDTO.size())); + - prepareReflectionData(request, mcContent, mcService, null,false); + String editQuestionBoxRequest=request.getParameter("editQuestionBoxRequest"); + logger.debug("editQuestionBoxRequest: " + editQuestionBoxRequest); - McAction mcAction = new McAction(); - return mcAction.submitQuestions(mapping, form, request, response); + setupCommonScreenData(mcContent, mcService,request); + + MonitoringUtil.setupAllSessionsData(request, mcContent,mcService); + + return newEditableQuestionBox(mapping, form, request, response); } - + + /** - * acts as a proxy to deleteOfflineFile(...) - * deleteOfflineFile(ActionMapping mapping, - ActionForm form, - HttpServletRequest request, - HttpServletResponse response) throws IOException, - ServletException + * ActionForward moveCandidateUp(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) * + * moves a candidate question up in the list + * * @param mapping * @param form * @param request * @param response - * @return ActionForward + * @return * @throws IOException * @throws ServletException */ - public ActionForward deleteOfflineFile(ActionMapping mapping, - ActionForm form, - HttpServletRequest request, - HttpServletResponse response) throws IOException, - ServletException + public ActionForward moveCandidateUp(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) + throws IOException, ServletException { + logger.debug("dispatching moveCandidateUp"); + McAuthoringForm mcAuthoringForm = (McAuthoringForm) form; + + IMcService mcService =McServiceProxy.getMcService(getServlet().getServletContext()); + logger.debug("mcService: " + mcService); + + String httpSessionID=mcAuthoringForm.getHttpSessionID(); + logger.debug("httpSessionID: " + httpSessionID); + + SessionMap sessionMap=(SessionMap)request.getSession().getAttribute(httpSessionID); + logger.debug("sessionMap: " + sessionMap); + + String questionIndex=request.getParameter("questionIndex"); + logger.debug("questionIndex: " + questionIndex); + mcAuthoringForm.setQuestionIndex(questionIndex); + + String candidateIndex=request.getParameter("candidateIndex"); + logger.debug("candidateIndex: " + candidateIndex); + mcAuthoringForm.setCandidateIndex(candidateIndex); - { - McUtils.cleanUpUserExceptions(request); - logger.debug("dispatching proxy deleteOfflineFile..." + request); - request.getSession().setAttribute(IS_MONITORED_CONTENT_IN_USE, new Boolean(false).toString()); - request.setAttribute(SOURCE_MC_STARTER, "monitoring"); - logger.debug("SOURCE_MC_STARTER: monitoring"); + AuthoringUtil authoringUtil = new AuthoringUtil(); + List caList=authoringUtil.repopulateCandidateAnswersBox(request, false); + logger.debug("repopulated caList: " + caList); - IMcService mcService =McUtils.getToolService(request); - if (mcService == null) - { - logger.debug("will retrieve mcService"); - mcService = McServiceProxy.getMcService(getServlet().getServletContext()); - logger.debug("retrieving mcService from cache: " + mcService); - } - request.getSession().setAttribute(TOOL_SERVICE, mcService); - logger.debug("mcService : " + mcService); + + List listQuestionContentDTO=(List)sessionMap.get(LIST_QUESTION_CONTENT_DTO_KEY); + logger.debug("listQuestionContentDTO: " + listQuestionContentDTO); - request.getSession().setAttribute(CURRENT_MONITORING_TAB, "editActivity"); + + + List candidates =new LinkedList(); + List listCandidates =new LinkedList(); + String editableQuestion=""; + Iterator listIterator=listQuestionContentDTO.iterator(); + while (listIterator.hasNext()) + { + McQuestionContentDTO mcQuestionContentDTO= (McQuestionContentDTO)listIterator.next(); + logger.debug("mcQuestionContentDTO:" + mcQuestionContentDTO); + + logger.debug("mcQuestionContentDTO question:" + mcQuestionContentDTO.getQuestion()); + String question=mcQuestionContentDTO.getQuestion(); + String displayOrder=mcQuestionContentDTO.getDisplayOrder(); + + if ((displayOrder != null) && (!displayOrder.equals(""))) + { + if (displayOrder.equals(questionIndex)) + { + logger.debug("displayOrder equals questionIndex :" + questionIndex); + editableQuestion=mcQuestionContentDTO.getQuestion(); + + candidates=mcQuestionContentDTO.getListCandidateAnswersDTO(); + logger.debug("candidates found :" + candidates); + + logger.debug("using repopulated caList:" + caList); + + listCandidates=AuthoringUtil.swapCandidateNodes(caList, candidateIndex, "up"); + logger.debug("swapped candidates :" + listCandidates); + + + mcQuestionContentDTO.setListCandidateAnswersDTO(listCandidates); + mcQuestionContentDTO.setCaCount(new Integer(listCandidates.size()).toString()); + + break; + } + + } + } - Long toolContentId =(Long) request.getSession().getAttribute(TOOL_CONTENT_ID); - logger.debug("toolContentId: " + toolContentId); + logger.debug("candidates found :" + candidates); + logger.debug("swapped candidates is :" + listCandidates); + logger.debug("listQuestionContentDTO after swapped candidates :" + listQuestionContentDTO); + - McContent mcContent=mcService.retrieveMc(toolContentId); - logger.debug("mcContent:" + mcContent); + sessionMap.put(LIST_QUESTION_CONTENT_DTO_KEY, listQuestionContentDTO); + + + String contentFolderID = WebUtil.readStrParam(request, AttributeNames.PARAM_CONTENT_FOLDER_ID); + logger.debug("contentFolderID: " + contentFolderID); + mcAuthoringForm.setContentFolderID(contentFolderID); + - MonitoringUtil.setAttributeNoToolSessions(request, mcService, mcContent); + String activeModule=request.getParameter(ACTIVE_MODULE); + logger.debug("activeModule: " + activeModule); + + String richTextTitle = request.getParameter(TITLE); + logger.debug("richTextTitle: " + richTextTitle); - prepareReflectionData(request, mcContent, mcService, null,false); + String richTextInstructions = request.getParameter(INSTRUCTIONS); + logger.debug("richTextInstructions: " + richTextInstructions); + - McAction mcAction = new McAction(); - return mcAction.deleteOfflineFile(mapping, form, request, response); - } - - /** - * acts as a proxy to authoring deleteOnlineFile(...) - * deleteOnlineFile(ActionMapping mapping, - ActionForm form, - HttpServletRequest request, - HttpServletResponse response) throws IOException, - ServletException - * - * @param mapping - * @param form - * @param request - * @param response - * @return ActionForward - * @throws IOException - * @throws ServletException - */ - public ActionForward deleteOnlineFile(ActionMapping mapping, - ActionForm form, - HttpServletRequest request, - HttpServletResponse response) throws IOException, - ServletException + sessionMap.put(ACTIVITY_TITLE_KEY, richTextTitle); + sessionMap.put(ACTIVITY_INSTRUCTIONS_KEY, richTextInstructions); + + + String strToolContentID=request.getParameter(AttributeNames.PARAM_TOOL_CONTENT_ID); + logger.debug("strToolContentID: " + strToolContentID); + + String defaultContentIdStr=request.getParameter(DEFAULT_CONTENT_ID_STR); + logger.debug("defaultContentIdStr: " + defaultContentIdStr); + + McContent mcContent=mcService.retrieveMc(new Long(strToolContentID)); + logger.debug("mcContent: " + mcContent); - { - McUtils.cleanUpUserExceptions(request); - logger.debug("dispatching proxy deleteOnlineFile..."); - request.getSession().setAttribute(IS_MONITORED_CONTENT_IN_USE, new Boolean(false).toString()); - request.setAttribute(SOURCE_MC_STARTER, "monitoring"); - logger.debug("SOURCE_MC_STARTER: monitoring"); + McGeneralAuthoringDTO mcGeneralAuthoringDTO= new McGeneralAuthoringDTO(); + logger.debug("mcGeneralAuthoringDTO: " + mcGeneralAuthoringDTO); + mcGeneralAuthoringDTO.setContentFolderID(contentFolderID); + + mcGeneralAuthoringDTO.setActivityTitle(richTextTitle); + mcAuthoringForm.setTitle(richTextTitle); + + mcGeneralAuthoringDTO.setActivityInstructions(richTextInstructions); + + mcGeneralAuthoringDTO.setEditActivityEditMode(new Boolean(true).toString()); + + request.getSession().setAttribute(httpSessionID, sessionMap); + + McUtils.setFormProperties(request, mcService, + mcAuthoringForm, mcGeneralAuthoringDTO, strToolContentID, defaultContentIdStr, activeModule, sessionMap, httpSessionID); + + + mcGeneralAuthoringDTO.setToolContentID(strToolContentID); + mcGeneralAuthoringDTO.setHttpSessionID(httpSessionID); + mcGeneralAuthoringDTO.setActiveModule(activeModule); + mcGeneralAuthoringDTO.setDefaultContentIdStr(defaultContentIdStr); + mcAuthoringForm.setToolContentID(strToolContentID); + mcAuthoringForm.setHttpSessionID(httpSessionID); + mcAuthoringForm.setActiveModule(activeModule); + mcAuthoringForm.setDefaultContentIdStr(defaultContentIdStr); + mcAuthoringForm.setCurrentTab("1"); + + request.setAttribute(LIST_QUESTION_CONTENT_DTO,listQuestionContentDTO); + logger.debug("listQuestionContentDTO now: " + listQuestionContentDTO); + + mcGeneralAuthoringDTO.setDefineLaterInEditMode(new Boolean(true).toString()); - IMcService mcService =McUtils.getToolService(request); - if (mcService == null) - { - logger.debug("will retrieve mcService"); - mcService = McServiceProxy.getMcService(getServlet().getServletContext()); - logger.debug("retrieving mcService from cache: " + mcService); - } - request.getSession().setAttribute(TOOL_SERVICE, mcService); - logger.debug("mcService : " + mcService); + Map marksMap=authoringUtil.buildMarksMap(); + logger.debug("marksMap: " + marksMap); + mcGeneralAuthoringDTO.setMarksMap(marksMap); - - request.getSession().setAttribute(CURRENT_MONITORING_TAB, "editActivity"); + Map passMarksMap=authoringUtil.buildPassMarkMap(); + logger.debug("passMarksMap: " + passMarksMap); + mcGeneralAuthoringDTO.setPassMarksMap(passMarksMap); - Long toolContentId =(Long) request.getSession().getAttribute(TOOL_CONTENT_ID); - logger.debug("toolContentId: " + toolContentId); + Map correctMap=authoringUtil.buildCorrectMap(); + logger.debug("correctMap: " + correctMap); + mcGeneralAuthoringDTO.setCorrectMap(correctMap); - McContent mcContent=mcService.retrieveMc(toolContentId); - logger.debug("mcContent:" + mcContent); + logger.debug("before saving final mcGeneralAuthoringDTO: " + mcGeneralAuthoringDTO); + request.setAttribute(MC_GENERAL_AUTHORING_DTO, mcGeneralAuthoringDTO); + + request.setAttribute(TOTAL_QUESTION_COUNT, new Integer(listQuestionContentDTO.size())); - MonitoringUtil.setAttributeNoToolSessions(request, mcService, mcContent); - - prepareReflectionData(request, mcContent, mcService, null,false); + String editQuestionBoxRequest=request.getParameter("editQuestionBoxRequest"); + logger.debug("editQuestionBoxRequest: " + editQuestionBoxRequest); + + setupCommonScreenData(mcContent, mcService,request); - McAction mcAction = new McAction(); - return mcAction.deleteOnlineFile(mapping, form, request, response); + MonitoringUtil.setupAllSessionsData(request, mcContent,mcService); + + return newEditableQuestionBox(mapping, form, request, response); + } - - + + /** - * acts as a proxy to authoring submitOfflineFiles(...) - * submitOfflineFiles(ActionMapping mapping, - ActionForm form, - HttpServletRequest request, - HttpServletResponse response) throws IOException, - ServletException, - RepositoryCheckedException + * ActionForward removeCandidate(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) * + * removes a candidate question from the list + * * @param mapping * @param form * @param request * @param response * @return * @throws IOException * @throws ServletException - * @throws RepositoryCheckedException */ - public ActionForward submitOfflineFiles(ActionMapping mapping, - ActionForm form, - HttpServletRequest request, - HttpServletResponse response) throws IOException, - ServletException, - RepositoryCheckedException - { - McUtils.cleanUpUserExceptions(request); - logger.debug("dispatching proxy deleteOnlineFile..." + request); - request.getSession().setAttribute(IS_MONITORED_CONTENT_IN_USE, new Boolean(false).toString()); - request.setAttribute(SOURCE_MC_STARTER, "monitoring"); - logger.debug("SOURCE_MC_STARTER: monitoring"); + public ActionForward removeCandidate(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) + throws IOException, ServletException { + logger.debug("dispatching removeCandidate"); + McAuthoringForm mcAuthoringForm = (McAuthoringForm) form; + + IMcService mcService =McServiceProxy.getMcService(getServlet().getServletContext()); + logger.debug("mcService: " + mcService); + + String httpSessionID=mcAuthoringForm.getHttpSessionID(); + logger.debug("httpSessionID: " + httpSessionID); + + SessionMap sessionMap=(SessionMap)request.getSession().getAttribute(httpSessionID); + logger.debug("sessionMap: " + sessionMap); + + String questionIndex=request.getParameter("questionIndex"); + logger.debug("questionIndex: " + questionIndex); + mcAuthoringForm.setQuestionIndex(questionIndex); - IMcService mcService =McUtils.getToolService(request); - if (mcService == null) - { - logger.debug("will retrieve mcService"); - mcService = McServiceProxy.getMcService(getServlet().getServletContext()); - logger.debug("retrieving mcService from cache: " + mcService); - } - request.getSession().setAttribute(TOOL_SERVICE, mcService); - logger.debug("mcService : " + mcService); + String candidateIndex=request.getParameter("candidateIndex"); + logger.debug("candidateIndex: " + candidateIndex); + mcAuthoringForm.setCandidateIndex(candidateIndex); - request.getSession().setAttribute(CURRENT_MONITORING_TAB, "editActivity"); + List listQuestionContentDTO=(List)sessionMap.get(LIST_QUESTION_CONTENT_DTO_KEY); + logger.debug("listQuestionContentDTO: " + listQuestionContentDTO); + + AuthoringUtil authoringUtil = new AuthoringUtil(); + List caList=authoringUtil.repopulateCandidateAnswersBox(request, false); + logger.debug("repopulated caList: " + caList); + + + McQuestionContentDTO mcQuestionContentDTO= null; + Iterator listIterator=listQuestionContentDTO.iterator(); + while (listIterator.hasNext()) + { + mcQuestionContentDTO= (McQuestionContentDTO)listIterator.next(); + logger.debug("mcQuestionContentDTO:" + mcQuestionContentDTO); + logger.debug("mcQuestionContentDTO question:" + mcQuestionContentDTO.getQuestion()); + + String question=mcQuestionContentDTO.getQuestion(); + String displayOrder=mcQuestionContentDTO.getDisplayOrder(); + logger.debug("displayOrder:" + displayOrder); + + if ((displayOrder != null) && (!displayOrder.equals(""))) + { + if (displayOrder.equals(questionIndex)) + { + break; + } + + } + } + + logger.debug("mcQuestionContentDTO found:" + mcQuestionContentDTO); + logger.debug("setting caList for the content:"); + mcQuestionContentDTO.setListCandidateAnswersDTO(caList); + + List candidateAnswers=mcQuestionContentDTO.getListCandidateAnswersDTO(); + logger.debug("candidateAnswers:" + candidateAnswers); + + McCandidateAnswersDTO mcCandidateAnswersDTO= null; + Iterator listCaIterator=candidateAnswers.iterator(); + int caIndex=0; + while (listCaIterator.hasNext()) + { + caIndex ++; + logger.debug("caIndex:" + caIndex); + mcCandidateAnswersDTO= (McCandidateAnswersDTO)listCaIterator.next(); + logger.debug("mcCandidateAnswersDTO:" + mcCandidateAnswersDTO); + logger.debug("mcCandidateAnswersDTO question:" + mcCandidateAnswersDTO.getCandidateAnswer()); + + if (caIndex == new Integer(candidateIndex).intValue()) + { + logger.debug("candidateIndex found"); + mcCandidateAnswersDTO.setCandidateAnswer(""); + + + break; + } + } + logger.debug("candidateAnswers after resetting answer" + candidateAnswers); + + candidateAnswers=AuthoringUtil.reorderListCandidatesDTO(candidateAnswers); + logger.debug("candidateAnswers after reordering candidate nodes" + candidateAnswers); - Long toolContentId =(Long) request.getSession().getAttribute(TOOL_CONTENT_ID); - logger.debug("toolContentId: " + toolContentId); + mcQuestionContentDTO.setListCandidateAnswersDTO(candidateAnswers); + mcQuestionContentDTO.setCaCount(new Integer(candidateAnswers.size()).toString()); + + logger.debug("listQuestionContentDTO after remove: " + listQuestionContentDTO); - McContent mcContent=mcService.retrieveMc(toolContentId); - logger.debug("mcContent:" + mcContent); + sessionMap.put(LIST_QUESTION_CONTENT_DTO_KEY, listQuestionContentDTO); + + String contentFolderID = WebUtil.readStrParam(request, AttributeNames.PARAM_CONTENT_FOLDER_ID); + logger.debug("contentFolderID: " + contentFolderID); + mcAuthoringForm.setContentFolderID(contentFolderID); + - MonitoringUtil.setAttributeNoToolSessions(request, mcService, mcContent); + String activeModule=request.getParameter(ACTIVE_MODULE); + logger.debug("activeModule: " + activeModule); + + String richTextTitle = request.getParameter(TITLE); + logger.debug("richTextTitle: " + richTextTitle); - prepareReflectionData(request, mcContent, mcService, null,false); + String richTextInstructions = request.getParameter(INSTRUCTIONS); + logger.debug("richTextInstructions: " + richTextInstructions); + - McAction mcAction = new McAction(); - return mcAction.submitOfflineFiles(mapping, form, request, response); - } - - /** - * acts as a proxy to authoring submitOnlineFiles(...) - * submitOnlineFiles(ActionMapping mapping, - ActionForm form, - HttpServletRequest request, - HttpServletResponse response) throws IOException, - ServletException, - RepositoryCheckedException - * - * @param mapping - * @param form - * @param request - * @param response - * @return ActionForward - * @throws IOException - * @throws ServletException - * @throws RepositoryCheckedException - */ - public ActionForward submitOnlineFiles(ActionMapping mapping, - ActionForm form, - HttpServletRequest request, - HttpServletResponse response) throws IOException, - ServletException, - RepositoryCheckedException - { - McUtils.cleanUpUserExceptions(request); - logger.debug("dispatching proxy submitOnlineFiles..." + request); - request.getSession().setAttribute(IS_MONITORED_CONTENT_IN_USE, new Boolean(false).toString()); - request.setAttribute(SOURCE_MC_STARTER, "monitoring"); - logger.debug("SOURCE_MC_STARTER: monitoring"); - - IMcService mcService =McUtils.getToolService(request); - if (mcService == null) + sessionMap.put(ACTIVITY_TITLE_KEY, richTextTitle); + sessionMap.put(ACTIVITY_INSTRUCTIONS_KEY, richTextInstructions); + + + String strToolContentID=request.getParameter(AttributeNames.PARAM_TOOL_CONTENT_ID); + logger.debug("strToolContentID: " + strToolContentID); + + String defaultContentIdStr=request.getParameter(DEFAULT_CONTENT_ID_STR); + logger.debug("defaultContentIdStr: " + defaultContentIdStr); + + McContent mcContent=mcService.retrieveMc(new Long(strToolContentID)); + logger.debug("mcContent: " + mcContent); + + if (mcContent == null) { - logger.debug("will retrieve mcService"); - mcService = McServiceProxy.getMcService(getServlet().getServletContext()); - logger.debug("retrieving mcService from cache: " + mcService); + logger.debug("using defaultContentIdStr: " + defaultContentIdStr); + mcContent=mcService.retrieveMc(new Long(defaultContentIdStr)); } - request.getSession().setAttribute(TOOL_SERVICE, mcService); - logger.debug("mcService : " + mcService); + logger.debug("final mcContent: " + mcContent); + + McGeneralAuthoringDTO mcGeneralAuthoringDTO= new McGeneralAuthoringDTO(); + logger.debug("mcGeneralAuthoringDTO: " + mcGeneralAuthoringDTO); + mcGeneralAuthoringDTO.setContentFolderID(contentFolderID); + + mcGeneralAuthoringDTO.setActivityTitle(richTextTitle); + mcAuthoringForm.setTitle(richTextTitle); + + mcGeneralAuthoringDTO.setActivityInstructions(richTextInstructions); + + logger.debug("activeModule: " + activeModule); + if (activeModule.equals(AUTHORING)) + { + String onlineInstructions=(String)sessionMap.get(ONLINE_INSTRUCTIONS_KEY); + logger.debug("onlineInstructions: " + onlineInstructions); + mcGeneralAuthoringDTO.setOnlineInstructions(onlineInstructions); + String offlineInstructions=(String)sessionMap.get(OFFLINE_INSTRUCTIONS_KEY); + logger.debug("offlineInstructions: " + offlineInstructions); + mcGeneralAuthoringDTO.setOfflineInstructions(offlineInstructions); + + + List attachmentList=(List)sessionMap.get(ATTACHMENT_LIST_KEY); + logger.debug("attachmentList: " + attachmentList); + List deletedAttachmentList=(List)sessionMap.get(DELETED_ATTACHMENT_LIST_KEY); + logger.debug("deletedAttachmentList: " + deletedAttachmentList); + + mcGeneralAuthoringDTO.setAttachmentList(attachmentList); + mcGeneralAuthoringDTO.setDeletedAttachmentList(deletedAttachmentList); + + String strOnlineInstructions= request.getParameter("onlineInstructions"); + String strOfflineInstructions= request.getParameter("offlineInstructions"); + logger.debug("onlineInstructions: " + strOnlineInstructions); + logger.debug("offlineInstructions: " + strOnlineInstructions); + mcAuthoringForm.setOnlineInstructions(strOnlineInstructions); + mcAuthoringForm.setOfflineInstructions(strOfflineInstructions); + } - request.getSession().setAttribute(CURRENT_MONITORING_TAB, "editActivity"); + mcGeneralAuthoringDTO.setEditActivityEditMode(new Boolean(true).toString()); + + request.getSession().setAttribute(httpSessionID, sessionMap); + + McUtils.setFormProperties(request, mcService, + mcAuthoringForm, mcGeneralAuthoringDTO, strToolContentID, defaultContentIdStr, activeModule, sessionMap, httpSessionID); + + + mcGeneralAuthoringDTO.setToolContentID(strToolContentID); + mcGeneralAuthoringDTO.setHttpSessionID(httpSessionID); + mcGeneralAuthoringDTO.setActiveModule(activeModule); + mcGeneralAuthoringDTO.setDefaultContentIdStr(defaultContentIdStr); + mcAuthoringForm.setToolContentID(strToolContentID); + mcAuthoringForm.setHttpSessionID(httpSessionID); + mcAuthoringForm.setActiveModule(activeModule); + mcAuthoringForm.setDefaultContentIdStr(defaultContentIdStr); + mcAuthoringForm.setCurrentTab("1"); + + request.setAttribute(LIST_QUESTION_CONTENT_DTO,listQuestionContentDTO); + logger.debug("mcQuestionContentDTO now: " + mcQuestionContentDTO); + logger.debug("listQuestionContentDTO now: " + listQuestionContentDTO); + + mcGeneralAuthoringDTO.setDefineLaterInEditMode(new Boolean(true).toString()); + + Map marksMap=authoringUtil.buildMarksMap(); + logger.debug("marksMap: " + marksMap); + mcGeneralAuthoringDTO.setMarksMap(marksMap); - Long toolContentId =(Long) request.getSession().getAttribute(TOOL_CONTENT_ID); - logger.debug("toolContentId: " + toolContentId); + Map passMarksMap=authoringUtil.buildPassMarkMap(); + logger.debug("passMarksMap: " + passMarksMap); + mcGeneralAuthoringDTO.setPassMarksMap(passMarksMap); - McContent mcContent=mcService.retrieveMc(toolContentId); - logger.debug("mcContent:" + mcContent); + Map correctMap=authoringUtil.buildCorrectMap(); + logger.debug("correctMap: " + correctMap); + mcGeneralAuthoringDTO.setCorrectMap(correctMap); + + + logger.debug("before saving final mcGeneralAuthoringDTO: " + mcGeneralAuthoringDTO); + request.setAttribute(MC_GENERAL_AUTHORING_DTO, mcGeneralAuthoringDTO); + + request.setAttribute(TOTAL_QUESTION_COUNT, new Integer(listQuestionContentDTO.size())); - MonitoringUtil.setAttributeNoToolSessions(request, mcService, mcContent); - prepareReflectionData(request, mcContent, mcService, null,false); - - McAction mcAction = new McAction(); - return mcAction.submitOnlineFiles(mapping, form, request, response); + String editQuestionBoxRequest=request.getParameter("editQuestionBoxRequest"); + logger.debug("editQuestionBoxRequest: " + editQuestionBoxRequest); + + setupCommonScreenData(mcContent, mcService,request); + + MonitoringUtil.setupAllSessionsData(request, mcContent,mcService); + + return newEditableQuestionBox(mapping, form, request, response); + } + /** - * acts as a proxy to authoring doneAdvancedTab(...) - * doneAdvancedTab(ActionMapping mapping, - ActionForm form, - HttpServletRequest request, - HttpServletResponse response) throws IOException, - ServletException + * ActionForward newCandidateBox(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) * + * creates screen area for adding a new candidate question + * * @param mapping * @param form * @param request * @param response - * @return ActionForward + * @return * @throws IOException * @throws ServletException */ - public ActionForward doneAdvancedTab(ActionMapping mapping, - ActionForm form, - HttpServletRequest request, - HttpServletResponse response) throws IOException, - ServletException - { - McUtils.cleanUpUserExceptions(request); - logger.debug("dispatching proxy doneAdvancedTab..."); - request.getSession().setAttribute(IS_MONITORED_CONTENT_IN_USE, new Boolean(false).toString()); - request.setAttribute(SOURCE_MC_STARTER, "monitoring"); - logger.debug("SOURCE_MC_STARTER: monitoring"); + public ActionForward newCandidateBox(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) + throws IOException, ServletException { + logger.debug("dispatching newCandidateBox"); + McAuthoringForm mcAuthoringForm = (McAuthoringForm) form; + + IMcService mcService =McServiceProxy.getMcService(getServlet().getServletContext()); + logger.debug("mcService: " + mcService); + + String httpSessionID=mcAuthoringForm.getHttpSessionID(); + logger.debug("httpSessionID: " + httpSessionID); + + SessionMap sessionMap=(SessionMap)request.getSession().getAttribute(httpSessionID); + logger.debug("sessionMap: " + sessionMap); + + String questionIndex=request.getParameter("questionIndex"); + logger.debug("questionIndex: " + questionIndex); + mcAuthoringForm.setQuestionIndex(questionIndex); - IMcService mcService =McUtils.getToolService(request); - if (mcService == null) - { - logger.debug("will retrieve mcService"); - mcService = McServiceProxy.getMcService(getServlet().getServletContext()); - logger.debug("retrieving mcService from cache: " + mcService); - } - request.getSession().setAttribute(TOOL_SERVICE, mcService); - logger.debug("mcService : " + mcService); + String candidateIndex=request.getParameter("candidateIndex"); + logger.debug("candidateIndex: " + candidateIndex); + mcAuthoringForm.setCandidateIndex(candidateIndex); + + List listQuestionContentDTO=(List)sessionMap.get(LIST_QUESTION_CONTENT_DTO_KEY); + logger.debug("listQuestionContentDTO: " + listQuestionContentDTO); + + + AuthoringUtil authoringUtil = new AuthoringUtil(); + List caList=authoringUtil.repopulateCandidateAnswersBox(request, true); + logger.debug("repopulated caList: " + caList); - request.getSession().setAttribute(CURRENT_MONITORING_TAB, "editActivity"); + int caCount=caList.size(); + logger.debug("caCount: " + caCount); + - Long toolContentId =(Long) request.getSession().getAttribute(TOOL_CONTENT_ID); - logger.debug("toolContentId: " + toolContentId); + String newQuestion=request.getParameter("newQuestion"); + logger.debug("newQuestion: " + newQuestion); - McContent mcContent=mcService.retrieveMc(toolContentId); - logger.debug("mcContent:" + mcContent); + String mark=request.getParameter("mark"); + logger.debug("mark: " + mark); + + String passmark=request.getParameter("passmark"); + logger.debug("passmark: " + passmark); + + + String feedback=request.getParameter("feedback"); + logger.debug("feedback: " + feedback); + + int currentQuestionCount= listQuestionContentDTO.size(); + logger.debug("currentQuestionCount: " + currentQuestionCount); + + + String editQuestionBoxRequest=request.getParameter("editQuestionBoxRequest"); + logger.debug("editQuestionBoxRequest: " + editQuestionBoxRequest); - MonitoringUtil.setAttributeNoToolSessions(request, mcService, mcContent); + + McQuestionContentDTO mcQuestionContentDTOLocal= null; + Iterator listIterator=listQuestionContentDTO.iterator(); + while (listIterator.hasNext()) + { + mcQuestionContentDTOLocal= (McQuestionContentDTO)listIterator.next(); + logger.debug("mcQuestionContentDTOLocal:" + mcQuestionContentDTOLocal); + logger.debug("mcQuestionContentDTOLocal question:" + mcQuestionContentDTOLocal.getQuestion()); + + String question=mcQuestionContentDTOLocal.getQuestion(); + String displayOrder=mcQuestionContentDTOLocal.getDisplayOrder(); + logger.debug("displayOrder:" + displayOrder); + + if ((displayOrder != null) && (!displayOrder.equals(""))) + { + if (displayOrder.equals(questionIndex)) + { + break; + } + + } + } - prepareReflectionData(request, mcContent, mcService, null,false); + logger.debug("mcQuestionContentDTOLocal found:" + mcQuestionContentDTOLocal); + + if (mcQuestionContentDTOLocal != null) + { + mcQuestionContentDTOLocal.setListCandidateAnswersDTO(caList); + mcQuestionContentDTOLocal.setCaCount(new Integer(caList.size()).toString()); + } + + - McAction mcAction = new McAction(); - return mcAction.doneAdvancedTab(mapping, form, request, response); - } - - - /** - * acts as a proxy to authoring doneInstructionsTab(...) - * doneInstructionsTab(ActionMapping mapping, - ActionForm form, - HttpServletRequest request, - HttpServletResponse response) throws IOException, - ServletException - - * @param mapping - * @param form - * @param request - * @param response - * @return - * @throws IOException - * @throws ServletException - */ - public ActionForward doneInstructionsTab(ActionMapping mapping, - ActionForm form, - HttpServletRequest request, - HttpServletResponse response) throws IOException, - ServletException - { - McUtils.cleanUpUserExceptions(request); - logger.debug("dispatching proxy doneInstructionsTab..."); - request.getSession().setAttribute(IS_MONITORED_CONTENT_IN_USE, new Boolean(false).toString()); - request.setAttribute(SOURCE_MC_STARTER, "monitoring"); - logger.debug("SOURCE_MC_STARTER: monitoring"); - - IMcService mcService =McUtils.getToolService(request); - if (mcService == null) - { - logger.debug("will retrieve mcService"); - mcService = McServiceProxy.getMcService(getServlet().getServletContext()); - logger.debug("retrieving mcService from cache: " + mcService); - } - request.getSession().setAttribute(TOOL_SERVICE, mcService); - logger.debug("mcService : " + mcService); + logger.debug("listQuestionContentDTO after repopulating data: " + listQuestionContentDTO); + + sessionMap.put(LIST_QUESTION_CONTENT_DTO_KEY, listQuestionContentDTO); + String contentFolderID = WebUtil.readStrParam(request, AttributeNames.PARAM_CONTENT_FOLDER_ID); + logger.debug("contentFolderID: " + contentFolderID); + mcAuthoringForm.setContentFolderID(contentFolderID); + + + String activeModule=request.getParameter(ACTIVE_MODULE); + logger.debug("activeModule: " + activeModule); + + String richTextTitle = request.getParameter(TITLE); + logger.debug("richTextTitle: " + richTextTitle); - request.getSession().setAttribute(CURRENT_MONITORING_TAB, "editActivity"); - - Long toolContentId =(Long) request.getSession().getAttribute(TOOL_CONTENT_ID); - logger.debug("toolContentId: " + toolContentId); + String richTextInstructions = request.getParameter(INSTRUCTIONS); + logger.debug("richTextInstructions: " + richTextInstructions); - McContent mcContent=mcService.retrieveMc(toolContentId); - logger.debug("mcContent:" + mcContent); - MonitoringUtil.setAttributeNoToolSessions(request, mcService, mcContent); + sessionMap.put(ACTIVITY_TITLE_KEY, richTextTitle); + sessionMap.put(ACTIVITY_INSTRUCTIONS_KEY, richTextInstructions); + + + String strToolContentID=request.getParameter(AttributeNames.PARAM_TOOL_CONTENT_ID); + logger.debug("strToolContentID: " + strToolContentID); + + String defaultContentIdStr=request.getParameter(DEFAULT_CONTENT_ID_STR); + logger.debug("defaultContentIdStr: " + defaultContentIdStr); + + McGeneralAuthoringDTO mcGeneralAuthoringDTO= new McGeneralAuthoringDTO(); + logger.debug("mcGeneralAuthoringDTO: " + mcGeneralAuthoringDTO); + mcGeneralAuthoringDTO.setContentFolderID(contentFolderID); + + mcGeneralAuthoringDTO.setActivityTitle(richTextTitle); + mcAuthoringForm.setTitle(richTextTitle); - prepareReflectionData(request, mcContent, mcService, null,false); + mcGeneralAuthoringDTO.setActivityInstructions(richTextInstructions); - McAction mcAction = new McAction(); - return mcAction.doneInstructionsTab(mapping, form, request, response); + mcGeneralAuthoringDTO.setEditActivityEditMode(new Boolean(true).toString()); + + request.getSession().setAttribute(httpSessionID, sessionMap); + + McUtils.setFormProperties(request, mcService, + mcAuthoringForm, mcGeneralAuthoringDTO, strToolContentID, defaultContentIdStr, activeModule, sessionMap, httpSessionID); + + + mcGeneralAuthoringDTO.setToolContentID(strToolContentID); + mcGeneralAuthoringDTO.setHttpSessionID(httpSessionID); + mcGeneralAuthoringDTO.setActiveModule(activeModule); + mcGeneralAuthoringDTO.setDefaultContentIdStr(defaultContentIdStr); + mcAuthoringForm.setToolContentID(strToolContentID); + mcAuthoringForm.setHttpSessionID(httpSessionID); + mcAuthoringForm.setActiveModule(activeModule); + mcAuthoringForm.setDefaultContentIdStr(defaultContentIdStr); + mcAuthoringForm.setCurrentTab("1"); + + request.setAttribute(LIST_QUESTION_CONTENT_DTO,listQuestionContentDTO); + logger.debug("mcQuestionContentDTOLocal now: " + mcQuestionContentDTOLocal); + logger.debug("listQuestionContentDTO now: " + listQuestionContentDTO); + + mcGeneralAuthoringDTO.setDefineLaterInEditMode(new Boolean(true).toString()); + + Map marksMap=authoringUtil.buildMarksMap(); + logger.debug("marksMap: " + marksMap); + mcGeneralAuthoringDTO.setMarksMap(marksMap); + + Map passMarksMap=authoringUtil.buildPassMarkMap(); + logger.debug("passMarksMap: " + passMarksMap); + mcGeneralAuthoringDTO.setPassMarksMap(passMarksMap); + + Map correctMap=authoringUtil.buildCorrectMap(); + logger.debug("correctMap: " + correctMap); + mcGeneralAuthoringDTO.setCorrectMap(correctMap); + + + logger.debug("before saving final mcGeneralAuthoringDTO: " + mcGeneralAuthoringDTO); + request.setAttribute(MC_GENERAL_AUTHORING_DTO, mcGeneralAuthoringDTO); + + request.setAttribute(TOTAL_QUESTION_COUNT, new Integer(listQuestionContentDTO.size())); + + logger.debug("editQuestionBoxRequest: " + editQuestionBoxRequest); + + logger.debug("strToolContentID: " + strToolContentID); + McContent mcContent=mcService.retrieveMc(new Long(strToolContentID)); + + setupCommonScreenData(mcContent, mcService,request); + + MonitoringUtil.setupAllSessionsData(request, mcContent,mcService); + + return newEditableQuestionBox(mapping, form, request, response); + } + /** - * user is done with Monitoring environment - * doneMonitoring(ActionMapping mapping, - ActionForm form, - HttpServletRequest request, - HttpServletResponse response) throws IOException, - ServletException + * prepareReflectionData(HttpServletRequest request, McContent mcContent, + IMcService mcService, String userID, boolean exportMode) * - * @param mapping - * @param form + * prepares reflection data + * * @param request - * @param response - * @return - * @throws IOException - * @throws ServletException + * @param mcContent + * @param mcService + * @param userID + * @param exportMode */ - public ActionForward doneMonitoring(ActionMapping mapping, - ActionForm form, - HttpServletRequest request, - HttpServletResponse response) throws IOException, - ServletException - { - /*not doing anything for the moment*/ - return null; - } - public void prepareReflectionData(HttpServletRequest request, McContent mcContent, IMcService mcService, String userID, boolean exportMode) { @@ -1430,14 +3138,14 @@ logger.debug("all users mode"); for (Iterator sessionIter = mcContent.getMcSessions().iterator(); sessionIter.hasNext();) { - McSession qaSession = (McSession) sessionIter.next(); - logger.debug("qaSession: " + qaSession); - for (Iterator userIter = qaSession.getMcQueUsers().iterator(); userIter.hasNext();) + McSession mcSession = (McSession) sessionIter.next(); + logger.debug("mcSession: " + mcSession); + for (Iterator userIter = mcSession.getMcQueUsers().iterator(); userIter.hasNext();) { McQueUsr user = (McQueUsr) userIter.next(); logger.debug("user: " + user); - NotebookEntry notebookEntry = mcService.getEntry(qaSession.getMcSessionId(), + NotebookEntry notebookEntry = mcService.getEntry(mcSession.getMcSessionId(), CoreNotebookConstants.NOTEBOOK_TOOL, MY_SIGNATURE, new Integer(user.getQueUsrId().toString())); @@ -1446,7 +3154,7 @@ if (notebookEntry != null) { ReflectionDTO reflectionDTO = new ReflectionDTO(); reflectionDTO.setUserId(user.getQueUsrId().toString()); - reflectionDTO.setSessionId(qaSession.getMcSessionId().toString()); + reflectionDTO.setSessionId(mcSession.getMcSessionId().toString()); reflectionDTO.setUserName(user.getUsername()); reflectionDTO.setReflectionUid (notebookEntry.getUid().toString()); String notebookEntryPresentable=McUtils.replaceNewLines(notebookEntry.getEntry()); @@ -1462,16 +3170,16 @@ logger.debug("single user mode"); for (Iterator sessionIter = mcContent.getMcSessions().iterator(); sessionIter.hasNext();) { - McSession qaSession = (McSession) sessionIter.next(); - logger.debug("qaSession: " + qaSession); - for (Iterator userIter = qaSession.getMcQueUsers().iterator(); userIter.hasNext();) + McSession mcSession = (McSession) sessionIter.next(); + logger.debug("mcSession: " + mcSession); + for (Iterator userIter = mcSession.getMcQueUsers().iterator(); userIter.hasNext();) { McQueUsr user = (McQueUsr) userIter.next(); logger.debug("user: " + user); if (user.getQueUsrId().toString().equals(userID)) { - NotebookEntry notebookEntry = mcService.getEntry(qaSession.getMcSessionId(), + NotebookEntry notebookEntry = mcService.getEntry(mcSession.getMcSessionId(), CoreNotebookConstants.NOTEBOOK_TOOL, MY_SIGNATURE, new Integer(user.getQueUsrId().toString())); @@ -1480,7 +3188,7 @@ if (notebookEntry != null) { ReflectionDTO reflectionDTO = new ReflectionDTO(); reflectionDTO.setUserId(user.getQueUsrId().toString()); - reflectionDTO.setSessionId(qaSession.getMcSessionId().toString()); + reflectionDTO.setSessionId(mcSession.getMcSessionId().toString()); reflectionDTO.setUserName(user.getUsername()); reflectionDTO.setReflectionUid (notebookEntry.getUid().toString()); String notebookEntryPresentable=McUtils.replaceNewLines(notebookEntry.getEntry()); @@ -1496,7 +3204,6 @@ logger.debug("reflectionsContainerDTO: " + reflectionsContainerDTO); - //request.setAttribute(REFLECTIONS_CONTAINER_DTO, reflectionsContainerDTO); request.getSession().setAttribute(REFLECTIONS_CONTAINER_DTO, reflectionsContainerDTO); if (exportMode) @@ -1506,14 +3213,30 @@ } + /** + * ActionForward openNotebook(ActionMapping mapping, + ActionForm form, HttpServletRequest request, + HttpServletResponse response) + * + * allows viewing users reflection data + * + * @param mapping + * @param form + * @param request + * @param response + * @return + * @throws IOException + * @throws ServletException + * @throws ToolException + */ public ActionForward openNotebook(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException, ToolException { logger.debug("dispatching openNotebook..."); - IMcService qaService = McServiceProxy.getMcService(getServlet().getServletContext()); - logger.debug("qaService: " + qaService); + IMcService mcService = McServiceProxy.getMcService(getServlet().getServletContext()); + logger.debug("mcService: " + mcService); String uid=request.getParameter("uid"); @@ -1529,7 +3252,7 @@ logger.debug("sessionId: " + sessionId); - NotebookEntry notebookEntry = qaService.getEntry(new Long(sessionId), + NotebookEntry notebookEntry = mcService.getEntry(new Long(sessionId), CoreNotebookConstants.NOTEBOOK_TOOL, MY_SIGNATURE, new Integer(userId)); @@ -1547,19 +3270,630 @@ return mapping.findForward(LEARNER_NOTEBOOK); } + + + /** + * prepareReflectionData(HttpServletRequest request, McContent mcContent, + IMcService mcService, String userID, boolean exportMode, String currentSessionId) + * + * @param request + * @param mcContent + * @param mcService + * @param userID + * @param exportMode + * @param currentSessionId + */ + public void prepareReflectionData(HttpServletRequest request, McContent mcContent, + IMcService mcService, String userID, boolean exportMode, String currentSessionId) + { + logger.debug("starting prepareReflectionData: " + mcContent); + logger.debug("currentSessionId: " + currentSessionId); + logger.debug("userID: " + userID); + logger.debug("exportMode: " + exportMode); + + List reflectionsContainerDTO= new LinkedList(); + + reflectionsContainerDTO=getReflectionList(mcContent, userID, mcService); + + logger.debug("reflectionsContainerDTO: " + reflectionsContainerDTO); + request.setAttribute(REFLECTIONS_CONTAINER_DTO, reflectionsContainerDTO); + + if (exportMode) + { + request.getSession().setAttribute(REFLECTIONS_CONTAINER_DTO, reflectionsContainerDTO); + } + } + /** - * persists error messages to request scope + * List getReflectionList(McContent mcContent, String userID, IMcService mcService) + * + * returns reflection data for all sessions + * + * @param mcContent + * @param userID + * @param mcService + * @return + */ + public List getReflectionList(McContent mcContent, String userID, IMcService mcService) + { + logger.debug("getting reflections for all sessions"); + List reflectionsContainerDTO= new LinkedList(); + if (userID == null) + { + logger.debug("all users mode"); + for (Iterator sessionIter = mcContent.getMcSessions().iterator(); sessionIter.hasNext();) + { + McSession mcSession = (McSession) sessionIter.next(); + logger.debug("mcSession: " + mcSession); + logger.debug("mcSession sessionId: " + mcSession.getMcSessionId()); + + for (Iterator userIter = mcSession.getMcQueUsers().iterator(); userIter.hasNext();) + { + McQueUsr user = (McQueUsr) userIter.next(); + logger.debug("user: " + user); + + NotebookEntry notebookEntry = mcService.getEntry(mcSession.getMcSessionId(), + CoreNotebookConstants.NOTEBOOK_TOOL, + MY_SIGNATURE, new Integer(user.getQueUsrId().toString())); + + logger.debug("notebookEntry: " + notebookEntry); + + if (notebookEntry != null) { + ReflectionDTO reflectionDTO = new ReflectionDTO(); + reflectionDTO.setUserId(user.getQueUsrId().toString()); + reflectionDTO.setSessionId(mcSession.getMcSessionId().toString()); + reflectionDTO.setUserName(user.getFullname()); + reflectionDTO.setReflectionUid (notebookEntry.getUid().toString()); + String notebookEntryPresentable=McUtils.replaceNewLines(notebookEntry.getEntry()); + reflectionDTO.setEntry(notebookEntryPresentable); + reflectionsContainerDTO.add(reflectionDTO); + } + } + } + } + else + { + logger.debug("single user mode"); + for (Iterator sessionIter = mcContent.getMcSessions().iterator(); sessionIter.hasNext();) + { + McSession mcSession = (McSession) sessionIter.next(); + logger.debug("mcSession: " + mcSession); + for (Iterator userIter = mcSession.getMcQueUsers().iterator(); userIter.hasNext();) + { + McQueUsr user = (McQueUsr) userIter.next(); + logger.debug("user: " + user); + + if (user.getQueUsrId().toString().equals(userID)) + { + logger.debug("getting reflection for user with userID: " + userID); + NotebookEntry notebookEntry = mcService.getEntry(mcSession.getMcSessionId(), + CoreNotebookConstants.NOTEBOOK_TOOL, + MY_SIGNATURE, new Integer(user.getQueUsrId().toString())); + + logger.debug("notebookEntry: " + notebookEntry); + + if (notebookEntry != null) { + ReflectionDTO reflectionDTO = new ReflectionDTO(); + reflectionDTO.setUserId(user.getQueUsrId().toString()); + reflectionDTO.setSessionId(mcSession.getMcSessionId().toString()); + reflectionDTO.setUserName(user.getFullname()); + reflectionDTO.setReflectionUid (notebookEntry.getUid().toString()); + String notebookEntryPresentable=McUtils.replaceNewLines(notebookEntry.getEntry()); + reflectionDTO.setEntry(notebookEntryPresentable); + reflectionsContainerDTO.add(reflectionDTO); + } + } + } + } + } + + return reflectionsContainerDTO; + } + + /** + * + * List getReflectionListForSession(McContent mcContent, String userID, IMcService mcService, String currentSessionId) + + * returns reflection data for a specific session + * + * @param mcContent + * @param userID + * @param mcService + * @param currentSessionId + * @return + */ + public List getReflectionListForSession(McContent mcContent, String userID, IMcService mcService, String currentSessionId) + { + logger.debug("getting reflections for a specific session"); + logger.debug("currentSessionId: " + currentSessionId); + + List reflectionsContainerDTO= new LinkedList(); + if (userID == null) + { + logger.debug("all users mode"); + for (Iterator sessionIter = mcContent.getMcSessions().iterator(); sessionIter.hasNext();) + { + McSession mcSession = (McSession) sessionIter.next(); + logger.debug("mcSession: " + mcSession); + logger.debug("mcSession sessionId: " + mcSession.getMcSessionId()); + + if (currentSessionId.equals(mcSession.getMcSessionId())) + { + + for (Iterator userIter = mcSession.getMcQueUsers().iterator(); userIter.hasNext();) + { + McQueUsr user = (McQueUsr) userIter.next(); + logger.debug("user: " + user); + + NotebookEntry notebookEntry = mcService.getEntry(mcSession.getMcSessionId(), + CoreNotebookConstants.NOTEBOOK_TOOL, + MY_SIGNATURE, new Integer(user.getQueUsrId().toString())); + + logger.debug("notebookEntry: " + notebookEntry); + + if (notebookEntry != null) { + ReflectionDTO reflectionDTO = new ReflectionDTO(); + reflectionDTO.setUserId(user.getQueUsrId().toString()); + reflectionDTO.setSessionId(mcSession.getMcSessionId().toString()); + reflectionDTO.setUserName(user.getFullname()); + reflectionDTO.setReflectionUid (notebookEntry.getUid().toString()); + String notebookEntryPresentable=McUtils.replaceNewLines(notebookEntry.getEntry()); + reflectionDTO.setEntry(notebookEntryPresentable); + reflectionsContainerDTO.add(reflectionDTO); + } + } + } + } + } + else + { + logger.debug("single user mode"); + for (Iterator sessionIter = mcContent.getMcSessions().iterator(); sessionIter.hasNext();) + { + McSession mcSession = (McSession) sessionIter.next(); + logger.debug("mcSession: " + mcSession); + + if (currentSessionId.equals(mcSession.getMcSessionId())) + { + for (Iterator userIter = mcSession.getMcQueUsers().iterator(); userIter.hasNext();) + { + McQueUsr user = (McQueUsr) userIter.next(); + logger.debug("user: " + user); + + if (user.getQueUsrId().toString().equals(userID)) + { + logger.debug("getting reflection for user with userID: " + userID); + NotebookEntry notebookEntry = mcService.getEntry(mcSession.getMcSessionId(), + CoreNotebookConstants.NOTEBOOK_TOOL, + MY_SIGNATURE, new Integer(user.getQueUsrId().toString())); + + logger.debug("notebookEntry: " + notebookEntry); + + if (notebookEntry != null) { + ReflectionDTO reflectionDTO = new ReflectionDTO(); + reflectionDTO.setUserId(user.getQueUsrId().toString()); + reflectionDTO.setSessionId(mcSession.getMcSessionId().toString()); + reflectionDTO.setUserName(user.getFullname()); + reflectionDTO.setReflectionUid (notebookEntry.getUid().toString()); + String notebookEntryPresentable=McUtils.replaceNewLines(notebookEntry.getEntry()); + reflectionDTO.setEntry(notebookEntryPresentable); + reflectionsContainerDTO.add(reflectionDTO); + } + } + } + + } + } + } + + return reflectionsContainerDTO; + } + + + /** + * prepareEditActivityScreenData(HttpServletRequest request, McContent mcContent) + * + * prepareEditActivityScreenData + * * @param request - * @param message + * @param mcContent */ - public void persistError(HttpServletRequest request, String message) + public void prepareEditActivityScreenData(HttpServletRequest request, McContent mcContent) { - ActionMessages errors= new ActionMessages(); - errors.add(Globals.ERROR_KEY, new ActionMessage(message)); - logger.debug("add " + message +" to ActionMessages:"); - saveErrors(request,errors); + logger.debug("starting prepareEditActivityScreenData: " + mcContent); + McGeneralAuthoringDTO mcGeneralAuthoringDTO= new McGeneralAuthoringDTO(); + + if (mcContent.getTitle() == null) + { + mcGeneralAuthoringDTO.setActivityTitle(DEFAULT_MC_TITLE); + } + else + { + mcGeneralAuthoringDTO.setActivityTitle(mcContent.getTitle()); + } + + + if (mcContent.getInstructions() == null) + { + mcGeneralAuthoringDTO.setActivityInstructions(DEFAULT_MC_INSTRUCTIONS); + } + else + { + mcGeneralAuthoringDTO.setActivityInstructions(mcContent.getInstructions()); + } + + + logger.debug("final mcGeneralAuthoringDTO: " + mcGeneralAuthoringDTO); + request.setAttribute(MC_GENERAL_AUTHORING_DTO, mcGeneralAuthoringDTO); } + + + /** + * initSummaryContent(String toolContentID, + HttpServletRequest request, + IMcService mcService, + McGeneralMonitoringDTO mcGeneralMonitoringDTO) + * + * @param toolContentID + * @param request + * @param mcService + * @param mcGeneralMonitoringDTO + * @throws IOException + * @throws ServletException + */ + public void initSummaryContent(String toolContentID, + HttpServletRequest request, + IMcService mcService, + McGeneralMonitoringDTO mcGeneralMonitoringDTO) throws IOException, + ServletException + { + logger.debug("start initSummaryContent...toolContentID: " + toolContentID); + logger.debug("dispatching getSummary...mcGeneralMonitoringDTO:" + mcGeneralMonitoringDTO); + + logger.debug("mcService: " + mcService); + logger.debug("toolContentID: " + toolContentID); + + McContent mcContent=mcService.retrieveMc(new Long(toolContentID)); + logger.debug("existing mcContent:" + mcContent); + + /* this section is related to summary tab. Starts here. */ + Map summaryToolSessions=MonitoringUtil.populateToolSessions(request, mcContent, mcService); + logger.debug("summaryToolSessions: " + summaryToolSessions); + mcGeneralMonitoringDTO.setSummaryToolSessions(summaryToolSessions); + + Map summaryToolSessionsId=MonitoringUtil.populateToolSessionsId(request, mcContent, mcService); + logger.debug("summaryToolSessionsId: " + summaryToolSessionsId); + mcGeneralMonitoringDTO.setSummaryToolSessionsId(summaryToolSessionsId); + /* ends here. */ + + /*true means there is at least 1 response*/ + if (mcService.studentActivityOccurredGlobal(mcContent)) + { + mcGeneralMonitoringDTO.setUserExceptionNoToolSessions(new Boolean(false).toString()); + logger.debug("USER_EXCEPTION_NO_TOOL_SESSIONS is set to false"); + } + else + { + mcGeneralMonitoringDTO.setUserExceptionNoToolSessions(new Boolean(true).toString()); + logger.debug("USER_EXCEPTION_NO_TOOL_SESSIONS is set to true"); + } + + prepareReflectionData(request, mcContent, mcService, null, false, "All"); + + EditActivityDTO editActivityDTO = new EditActivityDTO(); + boolean isContentInUse=McUtils.isContentInUse(mcContent); + logger.debug("isContentInUse:" + isContentInUse); + if (isContentInUse == true) + { + editActivityDTO.setMonitoredContentInUse(new Boolean(true).toString()); + } + request.setAttribute(EDIT_ACTIVITY_DTO, editActivityDTO); + + /**getting instructions screen content from here... */ + mcGeneralMonitoringDTO.setOnlineInstructions(mcContent.getOnlineInstructions()); + mcGeneralMonitoringDTO.setOfflineInstructions(mcContent.getOfflineInstructions()); + + List attachmentList = mcService.retrieveMcUploadedFiles(mcContent); + logger.debug("attachmentList: " + attachmentList); + mcGeneralMonitoringDTO.setAttachmentList(attachmentList); + mcGeneralMonitoringDTO.setDeletedAttachmentList(new ArrayList()); + /** ...till here **/ + + + mcGeneralMonitoringDTO.setCurrentMonitoringTab("summary"); + + logger.debug("end of refreshSummaryData, mcGeneralMonitoringDTO" + mcGeneralMonitoringDTO); + request.setAttribute(MC_GENERAL_MONITORING_DTO, mcGeneralMonitoringDTO); + + /*find out if there are any reflection entries, from here*/ + boolean notebookEntriesExist=MonitoringUtil.notebookEntriesExist(mcService, mcContent); + logger.debug("notebookEntriesExist : " + notebookEntriesExist); + + if (notebookEntriesExist) + { + request.setAttribute(NOTEBOOK_ENTRIES_EXIST, new Boolean(true).toString()); + + String userExceptionNoToolSessions=(String)mcGeneralMonitoringDTO.getUserExceptionNoToolSessions(); + logger.debug("userExceptionNoToolSessions : " + userExceptionNoToolSessions); + + if (userExceptionNoToolSessions.equals("true")) + { + logger.debug("there are no online student activity but there are reflections : "); + request.setAttribute(NO_SESSIONS_NOTEBOOK_ENTRIES_EXIST, new Boolean(true).toString()); + } + } + else + { + request.setAttribute(NOTEBOOK_ENTRIES_EXIST, new Boolean(false).toString()); + } + /* ... till here*/ + + MonitoringUtil.buildMcStatsDTO(request,mcService, mcContent); + + MonitoringUtil.setupAllSessionsData(request, mcContent,mcService); + + logger.debug("end initSummaryContent..."); + } + + + /** + * void initStatsContent(String toolContentID, + HttpServletRequest request, + IMcService mcService, + McGeneralMonitoringDTO mcGeneralMonitoringDTO) + * + * @param toolContentID + * @param request + * @param mcService + * @param mcGeneralMonitoringDTO + * @throws IOException + * @throws ServletException + */ + public void initStatsContent(String toolContentID, + HttpServletRequest request, + IMcService mcService, + McGeneralMonitoringDTO mcGeneralMonitoringDTO) throws IOException, + ServletException + { + logger.debug("starting initStatsContent...:" + toolContentID); + logger.debug("dispatching getStats..." + request); + logger.debug("mcService: " + mcService); + + McContent mcContent=mcService.retrieveMc(new Long(toolContentID)); + logger.debug("existing mcContent:" + mcContent); + + if (mcService.studentActivityOccurredGlobal(mcContent)) + { + mcGeneralMonitoringDTO.setUserExceptionNoToolSessions(new Boolean(false).toString()); + logger.debug("USER_EXCEPTION_NO_TOOL_SESSIONS is set to false"); + } + else + { + mcGeneralMonitoringDTO.setUserExceptionNoToolSessions(new Boolean(true).toString()); + logger.debug("USER_EXCEPTION_NO_TOOL_SESSIONS is set to true"); + } + + + refreshStatsData(request, mcService,mcGeneralMonitoringDTO); + logger.debug("post refreshStatsData, mcGeneralMonitoringDTO: " + mcGeneralMonitoringDTO ); + + prepareReflectionData(request, mcContent, mcService, null, false, "All"); + + EditActivityDTO editActivityDTO = new EditActivityDTO(); + boolean isContentInUse=McUtils.isContentInUse(mcContent); + logger.debug("isContentInUse:" + isContentInUse); + if (isContentInUse == true) + { + editActivityDTO.setMonitoredContentInUse(new Boolean(true).toString()); + } + request.setAttribute(EDIT_ACTIVITY_DTO, editActivityDTO); + + /**getting instructions screen content from here... */ + mcGeneralMonitoringDTO.setOnlineInstructions(mcContent.getOnlineInstructions()); + mcGeneralMonitoringDTO.setOfflineInstructions(mcContent.getOfflineInstructions()); + + List attachmentList = mcService.retrieveMcUploadedFiles(mcContent); + logger.debug("attachmentList: " + attachmentList); + mcGeneralMonitoringDTO.setAttachmentList(attachmentList); + mcGeneralMonitoringDTO.setDeletedAttachmentList(new ArrayList()); + /** ...till here **/ + + + mcGeneralMonitoringDTO.setCurrentMonitoringTab("stats"); + + logger.debug("end of refreshSummaryData, mcGeneralMonitoringDTO" + mcGeneralMonitoringDTO); + request.setAttribute(MC_GENERAL_MONITORING_DTO, mcGeneralMonitoringDTO); + + + /*find out if there are any reflection entries, from here*/ + boolean notebookEntriesExist=MonitoringUtil.notebookEntriesExist(mcService, mcContent); + logger.debug("notebookEntriesExist : " + notebookEntriesExist); + + if (notebookEntriesExist) + { + request.setAttribute(NOTEBOOK_ENTRIES_EXIST, new Boolean(true).toString()); + + String userExceptionNoToolSessions=(String)mcGeneralMonitoringDTO.getUserExceptionNoToolSessions(); + logger.debug("userExceptionNoToolSessions : " + userExceptionNoToolSessions); + + if (userExceptionNoToolSessions.equals("true")) + { + logger.debug("there are no online student activity but there are reflections : "); + request.setAttribute(NO_SESSIONS_NOTEBOOK_ENTRIES_EXIST, new Boolean(true).toString()); + } + } + else + { + request.setAttribute(NOTEBOOK_ENTRIES_EXIST, new Boolean(false).toString()); + } + /* ... till here*/ + + MonitoringUtil.buildMcStatsDTO(request,mcService, mcContent); + + MonitoringUtil.setupAllSessionsData(request, mcContent,mcService); + + logger.debug("ending initStatsContent..."); + } + + + /** + * void refreshStatsData(HttpServletRequest request, IMcService mcService, + McGeneralMonitoringDTO mcGeneralMonitoringDTO) + * + * @param request + * @param mcService + * @param mcGeneralMonitoringDTO + */ + public void refreshStatsData(HttpServletRequest request, IMcService mcService, + McGeneralMonitoringDTO mcGeneralMonitoringDTO) + { + logger.debug("starting refreshStatsData: " + mcService); + /* it is possible that no users has ever logged in for the activity yet*/ + if (mcService == null) + { + logger.debug("will retrieve mcService"); + mcService = McServiceProxy.getMcService(getServlet().getServletContext()); + logger.debug("retrieving mcService from session: " + mcService); + } + + int countAllUsers=mcService.getTotalNumberOfUsers(); + logger.debug("countAllUsers: " + countAllUsers); + + if (countAllUsers == 0) + { + logger.debug("error: countAllUsers is 0"); + mcGeneralMonitoringDTO.setUserExceptionNoStudentActivity(new Boolean(true).toString()); + } + + mcGeneralMonitoringDTO.setCountAllUsers(new Integer(countAllUsers).toString()); + + int countSessionComplete=mcService.countSessionComplete(); + logger.debug("countSessionComplete: " + countSessionComplete); + mcGeneralMonitoringDTO.setCountSessionComplete(new Integer(countSessionComplete).toString()); + + + logger.debug("end of refreshStatsData, mcGeneralMonitoringDTO" + mcGeneralMonitoringDTO); + request.setAttribute(MC_GENERAL_MONITORING_DTO, mcGeneralMonitoringDTO); + } + + + + /** + * void repopulateRequestParameters(HttpServletRequest request, McMonitoringForm mcMonitoringForm, + McGeneralMonitoringDTO mcGeneralMonitoringDTO) + * + * @param request + * @param mcMonitoringForm + * @param mcGeneralMonitoringDTO + */ + protected void repopulateRequestParameters(HttpServletRequest request, McMonitoringForm mcMonitoringForm, + McGeneralMonitoringDTO mcGeneralMonitoringDTO) + { + logger.debug("starting repopulateRequestParameters"); + + String toolContentID=request.getParameter(TOOL_CONTENT_ID); + logger.debug("toolContentID: " + toolContentID); + mcMonitoringForm.setToolContentID(toolContentID); + mcGeneralMonitoringDTO.setToolContentID(toolContentID); + + String activeModule=request.getParameter(ACTIVE_MODULE); + logger.debug("activeModule: " + activeModule); + mcMonitoringForm.setActiveModule(activeModule); + mcGeneralMonitoringDTO.setActiveModule(activeModule); + + String defineLaterInEditMode=request.getParameter(DEFINE_LATER_IN_EDIT_MODE); + logger.debug("defineLaterInEditMode: " + defineLaterInEditMode); + mcMonitoringForm.setDefineLaterInEditMode(defineLaterInEditMode); + mcGeneralMonitoringDTO.setDefineLaterInEditMode(defineLaterInEditMode); + + + String isToolSessionChanged=request.getParameter(IS_TOOL_SESSION_CHANGED); + logger.debug("isToolSessionChanged: " + isToolSessionChanged); + mcMonitoringForm.setIsToolSessionChanged(isToolSessionChanged); + mcGeneralMonitoringDTO.setIsToolSessionChanged(isToolSessionChanged); + + String responseId=request.getParameter(RESPONSE_ID); + logger.debug("responseId: " + responseId); + mcMonitoringForm.setResponseId(responseId); + mcGeneralMonitoringDTO.setResponseId(responseId); + + String currentUid=request.getParameter(CURRENT_UID); + logger.debug("currentUid: " + currentUid); + mcMonitoringForm.setCurrentUid(currentUid); + mcGeneralMonitoringDTO.setCurrentUid(currentUid); + } + + + /** + * void setupCommonScreenData(McContent mcContent, IMcService mcService, HttpServletRequest request) + * + * @param mcContent + * @param mcService + * @param request + */ + protected void setupCommonScreenData(McContent mcContent, IMcService mcService, HttpServletRequest request) + { + logger.debug("starting setupCommonScreenData, mcContent " + mcContent); + /*setting up USER_EXCEPTION_NO_TOOL_SESSIONS, from here */ + McGeneralMonitoringDTO mcGeneralMonitoringDTO= new McGeneralMonitoringDTO(); + mcGeneralMonitoringDTO.setDefineLaterInEditMode(new Boolean(true).toString()); + + if (mcService.studentActivityOccurredGlobal(mcContent)) + { + logger.debug("USER_EXCEPTION_NO_TOOL_SESSIONS is set to false"); + mcGeneralMonitoringDTO.setUserExceptionNoToolSessions(new Boolean(false).toString()); + } + else + { + logger.debug("USER_EXCEPTION_NO_TOOL_SESSIONS is set to true"); + mcGeneralMonitoringDTO.setUserExceptionNoToolSessions(new Boolean(true).toString()); + } + + + mcGeneralMonitoringDTO.setOnlineInstructions(mcContent.getOnlineInstructions()); + mcGeneralMonitoringDTO.setOfflineInstructions(mcContent.getOfflineInstructions()); + + List attachmentList = mcService.retrieveMcUploadedFiles(mcContent); + logger.debug("attachmentList: " + attachmentList); + mcGeneralMonitoringDTO.setAttachmentList(attachmentList); + mcGeneralMonitoringDTO.setDeletedAttachmentList(new ArrayList()); + + + logger.debug("end of refreshSummaryData, mcGeneralMonitoringDTO" + mcGeneralMonitoringDTO); + request.setAttribute(MC_GENERAL_MONITORING_DTO, mcGeneralMonitoringDTO); + /*.. till here*/ + + + /*find out if there are any reflection entries, from here*/ + boolean notebookEntriesExist=MonitoringUtil.notebookEntriesExist(mcService, mcContent); + logger.debug("notebookEntriesExist : " + notebookEntriesExist); + + if (notebookEntriesExist) + { + request.setAttribute(NOTEBOOK_ENTRIES_EXIST, new Boolean(true).toString()); + + String userExceptionNoToolSessions=(String)mcGeneralMonitoringDTO.getUserExceptionNoToolSessions(); + logger.debug(": " + userExceptionNoToolSessions); + + if (userExceptionNoToolSessions.equals("true")) + { + logger.debug("there are no online student activity but there are reflections : "); + request.setAttribute(NO_SESSIONS_NOTEBOOK_ENTRIES_EXIST, new Boolean(true).toString()); + } + } + else + { + request.setAttribute(NOTEBOOK_ENTRIES_EXIST, new Boolean(false).toString()); + } + /* ... till here*/ + + MonitoringUtil.buildMcStatsDTO(request,mcService, mcContent); + MonitoringUtil.generateGroupsSessionData(request, mcService, mcContent); + MonitoringUtil.setupAllSessionsData(request, mcContent,mcService); + logger.debug("ending setupCommonScreenData, mcContent " + mcContent); + } + } \ No newline at end of file Index: lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/web/McMonitoringForm.java =================================================================== RCS file: /usr/local/cvsroot/lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/web/McMonitoringForm.java,v diff -u -r1.8 -r1.9 --- lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/web/McMonitoringForm.java 17 Sep 2006 06:23:44 -0000 1.8 +++ lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/web/McMonitoringForm.java 2 Oct 2006 01:59:34 -0000 1.9 @@ -31,13 +31,17 @@ * ActionForm for the Monitoring environment */ public class McMonitoringForm extends McAuthoringForm implements McAppConstants { - // controls which method is called by the Lookup map */ protected String method; protected String selectedToolSessionId; protected String isToolSessionChanged; + private String currentUid; + + private String editResponse; + + /** * @return Returns the isToolSessionChanged. */ @@ -75,4 +79,28 @@ public void setMethod(String method) { this.method = method; } + /** + * @return Returns the currentUid. + */ + public String getCurrentUid() { + return currentUid; + } + /** + * @param currentUid The currentUid to set. + */ + public void setCurrentUid(String currentUid) { + this.currentUid = currentUid; + } + /** + * @return Returns the editResponse. + */ + public String getEditResponse() { + return editResponse; + } + /** + * @param editResponse The editResponse to set. + */ + public void setEditResponse(String editResponse) { + this.editResponse = editResponse; + } } Index: lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/web/McMonitoringStarterAction.java =================================================================== RCS file: /usr/local/cvsroot/lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/web/McMonitoringStarterAction.java,v diff -u -r1.39 -r1.40 --- lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/web/McMonitoringStarterAction.java 17 Sep 2006 06:23:44 -0000 1.39 +++ lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/web/McMonitoringStarterAction.java 2 Oct 2006 01:59:34 -0000 1.40 @@ -4,8 +4,8 @@ * License Information: http://lamsfoundation.org/licensing/lams/2.0/ * * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation. + * it under the terms of the GNU General Public License version 2.0 + * as published by the Free Software Foundation. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of @@ -19,10 +19,13 @@ * * http://www.gnu.org/licenses/gpl.txt * ***********************************************************************/ -/* $$Id$$ */ + package org.lamsfoundation.lams.tool.mc.web; import java.io.IOException; +import java.util.ArrayList; +import java.util.Iterator; +import java.util.LinkedList; import java.util.List; import java.util.Map; import java.util.TreeMap; @@ -39,53 +42,59 @@ import org.apache.struts.action.ActionMapping; import org.apache.struts.action.ActionMessage; import org.apache.struts.action.ActionMessages; +import org.lamsfoundation.lams.tool.mc.EditActivityDTO; import org.lamsfoundation.lams.tool.mc.McAppConstants; import org.lamsfoundation.lams.tool.mc.McApplicationException; import org.lamsfoundation.lams.tool.mc.McComparator; +import org.lamsfoundation.lams.tool.mc.McGeneralAuthoringDTO; +import org.lamsfoundation.lams.tool.mc.McGeneralMonitoringDTO; +import org.lamsfoundation.lams.tool.mc.McQuestionContentDTO; import org.lamsfoundation.lams.tool.mc.McUtils; import org.lamsfoundation.lams.tool.mc.pojos.McContent; +import org.lamsfoundation.lams.tool.mc.pojos.McQueContent; import org.lamsfoundation.lams.tool.mc.service.IMcService; import org.lamsfoundation.lams.tool.mc.service.McServiceProxy; import org.lamsfoundation.lams.web.util.AttributeNames; +import org.lamsfoundation.lams.web.util.SessionMap; /** * + *

Starts up the monitoring module

+ * * @author Ozgur Demirtas - * starts up the monitoring module * + - + unknown="false" + validate="false" + input="/monitoringIndex.jsp"> + - - - - - + + + + - - * + + * */ public class McMonitoringStarterAction extends Action implements McAppConstants { @@ -94,327 +103,307 @@ public ActionForward execute(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException, McApplicationException { + logger.debug("init McMonitoringStarterAction..."); McUtils.cleanUpSessionAbsolute(request); + + IMcService mcService = McServiceProxy.getMcService(getServlet().getServletContext()); + logger.debug("mcService: " + mcService); - ActionForward validateParameters=validateParameters(request, mapping); + McMonitoringForm mcMonitoringForm = (McMonitoringForm) form; + logger.debug("mcMonitoringForm: " + mcMonitoringForm); + + McGeneralAuthoringDTO mcGeneralAuthoringDTO= new McGeneralAuthoringDTO(); + McGeneralMonitoringDTO mcGeneralMonitoringDTO=new McGeneralMonitoringDTO(); + + ActionForward validateParameters=validateParameters(request, mapping, mcMonitoringForm); logger.debug("validateParamaters: " + validateParameters); + if (validateParameters != null) { - return validateParameters; + //return validateParameters; + logger.debug("error validating monitoring parameters"); } - boolean initData=initialiseMonitoringData(mapping, form, request, response); + boolean initData=initialiseMonitoringData(mapping, form, request, response, + mcService, mcGeneralMonitoringDTO); logger.debug("initData: " + initData); if (initData == false) - return (mapping.findForward(ERROR_LIST)); + //return (mapping.findForward(ERROR_LIST)); + logger.debug("error initialising monitoring parameters"); - request.getSession().setAttribute(CURRENT_MONITORING_TAB, "summary"); - McMonitoringForm mcMonitoringForm = (McMonitoringForm) form; - mcMonitoringForm.setEditOptionsMode(new Integer(0).toString()); - request.getSession().setAttribute(EDIT_OPTIONS_MODE, new Integer(0)); - request.getSession().setAttribute(USER_EXCEPTION_NO_TOOL_SESSIONS, new Boolean(true).toString()); + mcMonitoringForm.setCurrentTab("1"); + mcGeneralMonitoringDTO.setCurrentTab("1"); + logger.debug("setting current tab to 1: "); - request.getSession().setAttribute(ACTIVE_MODULE, DEFINE_LATER); - request.getSession().setAttribute(DEFINE_LATER_IN_EDIT_MODE, new Boolean(false)); - request.getSession().setAttribute(SHOW_AUTHORING_TABS,new Boolean(false).toString()); - - Long toolContentId=(Long)request.getSession().getAttribute(TOOL_CONTENT_ID); - logger.debug("toolContentId: " + toolContentId); + String toolContentID=mcMonitoringForm.getToolContentID(); + logger.debug("toolContentID: " + toolContentID); - IMcService mcService = (IMcService)request.getSession().getAttribute(TOOL_SERVICE); - logger.debug("mcService: " + mcService); - if (mcService == null) - { - logger.debug("will retrieve mcService"); - mcService = McServiceProxy.getMcService(getServlet().getServletContext()); - logger.debug("retrieving mcService from cache: " + mcService); - } - - McContent mcContent=mcService.retrieveMc(toolContentId); - logger.debug("mcContent:" + mcContent); + mcGeneralMonitoringDTO.setUserExceptionNoToolSessions(new Boolean(true).toString()); + mcGeneralMonitoringDTO.setCountAllUsers(new Integer(0).toString()); + mcGeneralMonitoringDTO.setCountSessionComplete(new Integer(0).toString()); - logger.debug("TOTAL QUESTION COUNT: " + mcContent.getMcQueContents().size()); - request.getSession().setAttribute(TOTAL_QUESTION_COUNT, new Integer(mcContent.getMcQueContents().size()).toString()); - request.getSession().setAttribute(HR_COLUMN_COUNT, new Integer(mcContent.getMcQueContents().size()+2).toString()); + McMonitoringAction mcMonitoringAction= new McMonitoringAction(); + logger.debug("calling initSummaryContent."); + mcMonitoringAction.initSummaryContent(toolContentID , request, mcService, mcGeneralMonitoringDTO); + logger.debug("post initSummaryContent, mcGeneralMonitoringDTO: " + mcGeneralMonitoringDTO); - /* it is possible that no users has ever logged in for the activity yet*/ - int countAllUsers=mcService.getTotalNumberOfUsers(); - logger.debug("countAllUsers: " + countAllUsers); - - request.getSession().setAttribute(USER_EXCEPTION_NO_STUDENT_ACTIVITY, new Boolean(false)); - if (countAllUsers == 0) + logger.debug("calling initInstructionsContent."); + logger.debug("post initInstructionsContent, mcGeneralMonitoringDTO: " + mcGeneralMonitoringDTO); + + logger.debug("calling initStatsContent."); + mcMonitoringAction.initStatsContent(toolContentID, request, mcService, mcGeneralMonitoringDTO); + logger.debug("post initStatsContent, mcGeneralMonitoringDTO: " + mcGeneralMonitoringDTO); + + McContent mcContent=mcService.retrieveMc(new Long(toolContentID)); + logger.debug("mcContent: " + mcContent); + + /*true means there is at least 1 response*/ + if (mcService.studentActivityOccurredGlobal(mcContent)) { - logger.debug("error: countAllUsers is 0"); - request.getSession().setAttribute(USER_EXCEPTION_NO_STUDENT_ACTIVITY, new Boolean(true)); + mcGeneralMonitoringDTO.setUserExceptionNoToolSessions(new Boolean(false).toString()); + logger.debug("USER_EXCEPTION_NO_TOOL_SESSIONS is set to false"); } - - /* it is possible that no users has ever attempted the activity yet*/ - int totalAttemptCount=MonitoringUtil.getTotalAttemptCount(request); - logger.debug("totalAttemptCount: " + totalAttemptCount); - if (totalAttemptCount == 0) + else { - logger.debug("error: totalAttemptCount is 0"); - request.getSession().setAttribute(USER_EXCEPTION_NO_STUDENT_ACTIVITY, new Boolean(true)); + mcGeneralMonitoringDTO.setUserExceptionNoToolSessions(new Boolean(true).toString()); + logger.debug("USER_EXCEPTION_NO_TOOL_SESSIONS is set to true"); } - - - request.getSession().setAttribute(IS_REVISITING_USER, new Boolean(false)); - request.getSession().setAttribute(RICHTEXT_TITLE,mcContent.getTitle()); - request.getSession().setAttribute(RICHTEXT_INSTRUCTIONS,mcContent.getInstructions()); - request.getSession().setAttribute(PASSMARK, mcContent.getPassMark()); //Integer - - Map mapQuestionsContent=AuthoringUtil.rebuildQuestionMapfromDB(request, toolContentId, mcService); - logger.debug("mapQuestionsContent:" + mapQuestionsContent); - request.getSession().setAttribute(MAP_QUESTIONS_CONTENT, mapQuestionsContent); - logger.debug("starter initialized the existing Questions Map: " + request.getSession().getAttribute(MAP_QUESTIONS_CONTENT)); - - Map mapWeights= AuthoringUtil.rebuildWeightsMapfromDB(request, toolContentId); - logger.debug("Check the mapWeights: " + mapWeights); - request.getSession().setAttribute(MAP_WEIGHTS, mapWeights); - - Map mapGeneralOptionsContent= new TreeMap(new McComparator()); - request.getSession().setAttribute(MAP_GENERAL_OPTIONS_CONTENT, mapGeneralOptionsContent); - - Map mapGeneralSelectedOptionsContent= new TreeMap(new McComparator()); - request.getSession().setAttribute(MAP_GENERAL_SELECTED_OPTIONS_CONTENT, mapGeneralSelectedOptionsContent); - - Map mapStartupGeneralOptionsContent= new TreeMap(new McComparator()); - request.getSession().setAttribute(MAP_STARTUP_GENERAL_OPTIONS_CONTENT, mapStartupGeneralOptionsContent); - - Map mapStartupGeneralSelectedOptionsContent= new TreeMap(new McComparator()); - request.getSession().setAttribute(MAP_STARTUP_GENERAL_SELECTED_OPTIONS_CONTENT, mapStartupGeneralSelectedOptionsContent); - - Map mapDisabledQuestions= new TreeMap(new McComparator()); - request.getSession().setAttribute(MAP_DISABLED_QUESTIONS, mapDisabledQuestions); - - Map mapCheckBoxStates= new TreeMap(new McComparator()); - mapCheckBoxStates.put("1" ,"INCORRECT"); - mapCheckBoxStates.put("2" ,"CORRECT"); - request.getSession().setAttribute(MAP_CHECKBOX_STATES, mapCheckBoxStates); - Map mapSelectedOptions= new TreeMap(new McComparator()); - request.getSession().setAttribute(MAP_SELECTED_OPTIONS, mapSelectedOptions); + mcMonitoringForm.setActiveModule(MONITORING); + mcGeneralMonitoringDTO.setActiveModule(MONITORING); - Map mapIncorrectFeedback= new TreeMap(new McComparator()); - request.getSession().setAttribute(MAP_INCORRECT_FEEDBACK, mapIncorrectFeedback); + mcMonitoringForm.setSelectedToolSessionId("All"); + mcGeneralMonitoringDTO.setSelectedToolSessionId("All"); - Map mapCorrectFeedback= new TreeMap(new McComparator()); - request.getSession().setAttribute(MAP_CORRECT_FEEDBACK, mapCorrectFeedback); + mcGeneralMonitoringDTO.setRequestLearningReport(new Boolean(false).toString()); + mcGeneralMonitoringDTO.setIsPortfolioExport(new Boolean(false).toString()); - List listUploadedOffFiles= mcService.retrieveMcUploadedOfflineFilesName(mcContent.getUid()); - logger.debug("existing listUploadedOfflineFileNames:" + listUploadedOffFiles); - request.getSession().setAttribute(LIST_UPLOADED_OFFLINE_FILENAMES,listUploadedOffFiles); + logger.debug("calling submitSession:" + toolContentID); + request.setAttribute(MC_GENERAL_MONITORING_DTO, mcGeneralMonitoringDTO); - List listUploadedOnFiles= mcService.retrieveMcUploadedOnlineFilesName(mcContent.getUid()); - logger.debug("existing listUploadedOnlineFileNames:" + listUploadedOnFiles); - request.getSession().setAttribute(LIST_UPLOADED_ONLINE_FILENAMES,listUploadedOnFiles); + /*this section is needed for Edit Activity screen, from here... */ + logger.debug("for copy using mcGeneralMonitoringDTO: " + mcGeneralMonitoringDTO); + mcGeneralAuthoringDTO.setActivityTitle(mcGeneralMonitoringDTO.getActivityTitle()); + mcGeneralAuthoringDTO.setActivityInstructions(mcGeneralMonitoringDTO.getActivityInstructions()); + mcGeneralAuthoringDTO.setActiveModule(MONITORING); - List listOfflineFilesMetaData=mcService.getOfflineFilesMetaData(mcContent.getUid()); - logger.debug("existing listOfflineFilesMetaData, to be structured as McAttachmentDTO: " + listOfflineFilesMetaData); - listOfflineFilesMetaData=AuthoringUtil.populateMetaDataAsAttachments(listOfflineFilesMetaData); - logger.debug("populated listOfflineFilesMetaData: " + listOfflineFilesMetaData); - request.getSession().setAttribute(LIST_OFFLINEFILES_METADATA, listOfflineFilesMetaData); - - List listUploadedOfflineFileNames=AuthoringUtil.populateMetaDataAsFilenames(listOfflineFilesMetaData); - logger.debug("returned from db listUploadedOfflineFileNames: " + listUploadedOfflineFileNames); - request.getSession().setAttribute(LIST_UPLOADED_OFFLINE_FILENAMES, listUploadedOfflineFileNames); - - /*process online files metadata*/ - List listOnlineFilesMetaData=mcService.getOnlineFilesMetaData(mcContent.getUid()); - logger.debug("existing listOnlineFilesMetaData, to be structured as McAttachmentDTO: " + listOnlineFilesMetaData); - listOnlineFilesMetaData=AuthoringUtil.populateMetaDataAsAttachments(listOnlineFilesMetaData); - logger.debug("populated listOnlineFilesMetaData: " + listOnlineFilesMetaData); - request.getSession().setAttribute(LIST_ONLINEFILES_METADATA, listOnlineFilesMetaData); - - List listUploadedOnlineFileNames=AuthoringUtil.populateMetaDataAsFilenames(listOnlineFilesMetaData); - logger.debug("returned from db listUploadedOnlineFileNames: " + listUploadedOnlineFileNames); - request.getSession().setAttribute(LIST_UPLOADED_ONLINE_FILENAMES, listUploadedOnlineFileNames); - - logger.debug("end of execute: "); - logger.debug("SUMMARY_TOOL_SESSIONS_ID: " + request.getSession().getAttribute(SUMMARY_TOOL_SESSIONS_ID)); - logger.debug("SUMMARY_TOOL_SESSIONS: " + request.getSession().getAttribute(SUMMARY_TOOL_SESSIONS)); - logger.debug("SELECTION_CASE: " + request.getSession().getAttribute(SELECTION_CASE)); - logger.debug("LIST_MONITORED_ANSWERS_CONTAINER_DTO: " + request.getSession().getAttribute(LIST_MONITORED_ANSWERS_CONTAINER_DTO)); + Map mapOptionsContent=mcGeneralMonitoringDTO.getMapOptionsContent(); + logger.debug("mapOptionsContent: " + mapOptionsContent); + int maxIndex=mapOptionsContent.size(); + logger.debug("maxIndex: " + maxIndex); - boolean isContentInUse=McUtils.isContentInUse(mcContent); - logger.debug("isContentInUse:" + isContentInUse); + logger.debug("mcGeneralAuthoringDTO: " + mcGeneralAuthoringDTO); + request.setAttribute(MC_GENERAL_AUTHORING_DTO, mcGeneralAuthoringDTO); + /*...till here */ - request.getSession().setAttribute(IS_MONITORED_CONTENT_IN_USE, new Boolean(false).toString()); - if (isContentInUse == true) - { - logger.debug("monitoring url does not allow editActivity since the content is in use."); - persistError(request,"error.content.inUse"); - request.getSession().setAttribute(IS_MONITORED_CONTENT_IN_USE, new Boolean(true).toString()); - } - logger.debug("final IS_MONITORED_CONTENT_IN_USE: " + request.getSession().getAttribute(IS_MONITORED_CONTENT_IN_USE)); - - /*get existing feedback maps*/ - mapIncorrectFeedback = AuthoringUtil.rebuildIncorrectFeedbackMapfromDB(request,toolContentId); - logger.debug("existing mapIncorrectFeedback:" + mapIncorrectFeedback); - request.getSession().setAttribute(MAP_INCORRECT_FEEDBACK, mapIncorrectFeedback); - - mapCorrectFeedback = AuthoringUtil.rebuildCorrectFeedbackMapfromDB(request, toolContentId); - logger.debug("existing mapCorrectFeedback:" + mapCorrectFeedback); - request.getSession().setAttribute(MAP_CORRECT_FEEDBACK, mapCorrectFeedback); - - MonitoringUtil.setAttributeNoToolSessions(request, mcService, mcContent); - - McMonitoringAction mcMonitoringAction= new McMonitoringAction(); - mcMonitoringAction.prepareReflectionData(request, mcContent, mcService, null, false); - - return (mapping.findForward(LOAD_MONITORING_CONTENT)); + logger.debug("calling submitSession with selectedToolSessionId" + mcMonitoringForm.getSelectedToolSessionId()); + return mcMonitoringAction.submitSession(mapping, mcMonitoringForm, request, response, mcService, mcGeneralMonitoringDTO); } - + /** - * initialises monitoring data mainly for jsp purposes - * initialiseMonitoringData(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) + * initialiseMonitoringData(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response, + IMcService mcService, McGeneralMonitoringDTO mcGeneralMonitoringDTO) + + initialises monitoring data * * @param mapping * @param form * @param request * @param response - * @return boolean + * @param mcService + * @param mcGeneralMonitoringDTO + * @return */ - public boolean initialiseMonitoringData(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) + public boolean initialiseMonitoringData(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response, + IMcService mcService, McGeneralMonitoringDTO mcGeneralMonitoringDTO) { - logger.debug("initialising MonitoringData..."); - - IMcService mcService = (IMcService)request.getSession().getAttribute(TOOL_SERVICE); - logger.debug("mcService: " + mcService); - if (mcService == null) - { - logger.debug("will retrieve mcService"); - mcService = McServiceProxy.getMcService(getServlet().getServletContext()); - logger.debug("retrieving mcService from cache: " + mcService); - } - - request.getSession().setAttribute(TOOL_SERVICE, mcService); + logger.debug("start initializing monitoring data...mcService: " + mcService); McMonitoringForm mcMonitoringForm = (McMonitoringForm) form; - /* setting active tab to summary*/ - mcMonitoringForm.setCurrentTab("1"); - - /* - * persist time zone information to session scope. - */ - McUtils.saveTimeZone(request); - /* we have made sure TOOL_CONTENT_ID is passed */ - Long toolContentId =(Long) request.getSession().getAttribute(TOOL_CONTENT_ID); - logger.debug("toolContentId: " + toolContentId); + mcGeneralMonitoringDTO.setCurrentMonitoringTab("summary"); + mcGeneralMonitoringDTO.setSbmtSuccess(new Boolean(false).toString()); + mcGeneralMonitoringDTO.setDefineLaterInEditMode(new Boolean(false).toString()); + mcGeneralMonitoringDTO.setRequestLearningReport(new Boolean(false).toString()); + mcGeneralMonitoringDTO.setUserExceptionNoToolSessions(new Boolean(true).toString()); + + McUtils.saveTimeZone(request); + + /* we have made sure TOOL_CONTENT_ID is passed */ + String toolContentID=mcMonitoringForm.getToolContentID(); + logger.debug("toolContentID: " + toolContentID); - McContent mcContent=mcService.retrieveMc(toolContentId); + McContent mcContent=mcService.retrieveMc(new Long(toolContentID)); logger.debug("existing mcContent:" + mcContent); if (mcContent == null) { McUtils.cleanUpSessionAbsolute(request); - request.getSession().setAttribute(USER_EXCEPTION_CONTENT_DOESNOTEXIST, new Boolean(true).toString()); - persistError(request, "error.content.doesNotExist"); + mcGeneralMonitoringDTO.setUserExceptionContentDoesNotExist(new Boolean(true).toString()); return false; } - - Map summaryToolSessions=MonitoringUtil.populateToolSessions(request, mcContent, mcService); - logger.debug("summaryToolSessions: " + summaryToolSessions); - Map summaryToolSessionsId=MonitoringUtil.populateToolSessionsId(request, mcContent, mcService); - logger.debug("summaryToolSessionsId: " + summaryToolSessionsId); - request.getSession().setAttribute(SUMMARY_TOOL_SESSIONS_ID, summaryToolSessionsId); + boolean isContentInUse=McUtils.isContentInUse(mcContent); + logger.debug("isContentInUse:" + isContentInUse); + mcGeneralMonitoringDTO.setIsMonitoredContentInUse(new Boolean(false).toString()); + if (isContentInUse == true) + { + logger.debug("monitoring url does not allow editActivity since the content is in use."); + mcGeneralMonitoringDTO.setIsMonitoredContentInUse(new Boolean(true).toString()); + } - /* this section is related to summary tab. Starts here. */ - request.getSession().setAttribute(SUMMARY_TOOL_SESSIONS, summaryToolSessions); - logger.debug("SUMMARY_TOOL_SESSIONS: " + request.getSession().getAttribute(SUMMARY_TOOL_SESSIONS)); - - /* SELECTION_CASE == 2 indicates start up */ - request.getSession().setAttribute(SELECTION_CASE, new Long(2)); - logger.debug("SELECTION_CASE: " + request.getSession().getAttribute(SELECTION_CASE)); - - /* Default to All for tool Sessions so that all tool sessions' summary information gets displayed when the module starts up */ - request.getSession().setAttribute(CURRENT_MONITORED_TOOL_SESSION, "All"); - logger.debug("CURRENT_MONITORED_TOOL_SESSION: " + request.getSession().getAttribute(CURRENT_MONITORED_TOOL_SESSION)); + mcGeneralMonitoringDTO.setActivityTitle(mcContent.getTitle()); + mcGeneralMonitoringDTO.setActivityInstructions(mcContent.getInstructions()); - List listMonitoredAnswersContainerDTO=MonitoringUtil.buildGroupsQuestionData(request, mcContent, mcService); - request.getSession().setAttribute(LIST_MONITORED_ANSWERS_CONTAINER_DTO, listMonitoredAnswersContainerDTO); - logger.debug("LIST_MONITORED_ANSWERS_CONTAINER_DTO: " + request.getSession().getAttribute(LIST_MONITORED_ANSWERS_CONTAINER_DTO)); - - List listMonitoredMarksContainerDTO=MonitoringUtil.buildGroupsMarkData(request, mcContent, mcService); - request.getSession().setAttribute(LIST_MONITORED_MARKS_CONTAINER_DTO, listMonitoredMarksContainerDTO); - logger.debug("LIST_MONITORED_MARKS_CONTAINER_DTO: " + request.getSession().getAttribute(LIST_MONITORED_MARKS_CONTAINER_DTO)); - /* ends here*/ - - /* this section is related to instructions tab. Starts here. */ - request.getSession().setAttribute(RICHTEXT_ONLINEINSTRUCTIONS,mcContent.getOnlineInstructions()); - request.getSession().setAttribute(RICHTEXT_OFFLINEINSTRUCTIONS,mcContent.getOfflineInstructions()); - /* ends here. */ - - - /* it is possible that no users has ever logged in for the activity yet*/ - //int countAllUsers=mcService.getTotalNumberOfUsers(); - int countAllUsers=mcService.getTotalNumberOfUsers(mcContent); - logger.debug("countAllUsers: " + countAllUsers); - - request.getSession().setAttribute(USER_EXCEPTION_NO_STUDENT_ACTIVITY, new Boolean(false)); - if (countAllUsers == 0) + logger.debug("checking student activity on the standard Questions:" + mcContent); + if (mcService.studentActivityOccurredGlobal(mcContent)) { - logger.debug("error: countAllUsers is 0"); - request.getSession().setAttribute(USER_EXCEPTION_NO_STUDENT_ACTIVITY, new Boolean(true)); + McUtils.cleanUpSessionAbsolute(request); + logger.debug("student activity occurred on this content:" + mcContent); + mcGeneralMonitoringDTO.setUserExceptionContentInUse(new Boolean(true).toString()); + mcGeneralMonitoringDTO.setUserExceptionNoToolSessions(new Boolean(false).toString()); + logger.debug("USER_EXCEPTION_NO_TOOL_SESSIONS is set to false"); } + else + { + mcGeneralMonitoringDTO.setUserExceptionNoToolSessions(new Boolean(true).toString()); + logger.debug("USER_EXCEPTION_NO_TOOL_SESSIONS is set to true"); + } + + /* + * get the questions + * section is needed for the Edit tab's View Only mode, starts here + */ - /* it is possible that no users has ever attempted the activity yet*/ - int totalAttemptCount=MonitoringUtil.getTotalAttemptCount(request); - logger.debug("totalAttemptCount: " + totalAttemptCount); - if (totalAttemptCount == 0) + SessionMap sessionMap = new SessionMap(); + sessionMap.put(ACTIVITY_TITLE_KEY, mcContent.getTitle()); + sessionMap.put(ACTIVITY_INSTRUCTIONS_KEY, mcContent.getInstructions()); + + mcMonitoringForm.setHttpSessionID(sessionMap.getSessionID()); + request.getSession().setAttribute(sessionMap.getSessionID(), sessionMap); + + + List listQuestionContentDTO= new LinkedList(); + + Map mapOptionsContent= new TreeMap(new McComparator()); + logger.debug("setting existing content data from the db"); + mapOptionsContent.clear(); + Iterator queIterator=mcContent.getMcQueContents().iterator(); + Long mapIndex=new Long(1); + logger.debug("mapOptionsContent: " + mapOptionsContent); + while (queIterator.hasNext()) { - logger.debug("error: totalAttemptCount is 0"); - request.getSession().setAttribute(USER_EXCEPTION_NO_STUDENT_ACTIVITY, new Boolean(true)); + McQuestionContentDTO mcContentDTO=new McQuestionContentDTO(); + + McQueContent mcQueContent=(McQueContent) queIterator.next(); + if (mcQueContent != null) + { + logger.debug("question: " + mcQueContent.getQuestion()); + mapOptionsContent.put(mapIndex.toString(),mcQueContent.getQuestion()); + + mcContentDTO.setQuestion(mcQueContent.getQuestion()); + mcContentDTO.setDisplayOrder(mcQueContent.getDisplayOrder().toString()); + listQuestionContentDTO.add(mcContentDTO); + + mapIndex=new Long(mapIndex.longValue()+1); + } } + logger.debug("Map initialized with existing contentid to: " + mapOptionsContent); + mcGeneralMonitoringDTO.setMapOptionsContent(mapOptionsContent); + /* ends here*/ - /* this section is related to Stats tab. Starts here. */ - //int countSessionComplete=mcService.countSessionComplete(mcContent); - int countUserComplete=mcService.countUserComplete(mcContent); - logger.debug("countUserComplete: " + countUserComplete); - int countMaxAttempt=1; - logger.debug("countMaxAttempt: " + countMaxAttempt); + logger.debug("listQuestionContentDTO: " + listQuestionContentDTO); + request.setAttribute(LIST_QUESTION_CONTENT_DTO,listQuestionContentDTO); + sessionMap.put(LIST_QUESTION_CONTENT_DTO_KEY, listQuestionContentDTO); - int topMark=LearningUtil.getTopMark(request, mcService); - logger.debug("topMark: " + topMark); + request.setAttribute(TOTAL_QUESTION_COUNT, new Integer(listQuestionContentDTO.size())); - int lowestMark=LearningUtil.getLowestMark(request, mcService); - logger.debug("lowestMark: " + lowestMark); - int averageMark=LearningUtil.getAverageMark(request, mcService); - logger.debug("averageMark: " + averageMark); + McMonitoringAction mcMonitoringAction= new McMonitoringAction(); + logger.debug("refreshing summary data..."); + mcMonitoringAction.refreshSummaryData(request, mcContent, mcService, true, false, + null, null, false, null, mcGeneralMonitoringDTO, null); + logger.debug("post refreshSummaryData, mcGeneralMonitoringDTO: " + mcGeneralMonitoringDTO); - request.getSession().setAttribute(COUNT_ALL_USERS, new Integer(countAllUsers).toString()); - request.getSession().setAttribute(COUNT_SESSION_COMPLETE, new Integer(countUserComplete).toString()); - request.getSession().setAttribute(COUNT_MAX_ATTEMPT, new Integer(countMaxAttempt).toString()); - request.getSession().setAttribute(TOP_MARK, new Integer(topMark).toString()); - request.getSession().setAttribute(LOWEST_MARK, new Integer(lowestMark).toString()); - request.getSession().setAttribute(AVERAGE_MARK, new Integer(averageMark).toString()); - /* ends here. */ + //mcMonitoringAction.refreshStatsData(request, mcService, mcGeneralMonitoringDTO); - logger.debug("end of initialiseMonitoringData: "); - logger.debug("SUMMARY_TOOL_SESSIONS_ID: " + request.getSession().getAttribute(SUMMARY_TOOL_SESSIONS_ID)); - logger.debug("SUMMARY_TOOL_SESSIONS: " + request.getSession().getAttribute(SUMMARY_TOOL_SESSIONS)); - logger.debug("SELECTION_CASE: " + request.getSession().getAttribute(SELECTION_CASE)); - logger.debug("LIST_MONITORED_ANSWERS_CONTAINER_DTO: " + request.getSession().getAttribute(LIST_MONITORED_ANSWERS_CONTAINER_DTO)); + logger.debug("end initializing monitoring data..."); + mcGeneralMonitoringDTO.setExistsOpenMcs(new Boolean(false).toString()); + logger.debug("post refreshes, mcGeneralMonitoringDTO: " + mcGeneralMonitoringDTO); + + + EditActivityDTO editActivityDTO = new EditActivityDTO(); + isContentInUse=McUtils.isContentInUse(mcContent); + logger.debug("isContentInUse:" + isContentInUse); + if (isContentInUse == true) + { + editActivityDTO.setMonitoredContentInUse(new Boolean(true).toString()); + } + request.setAttribute(EDIT_ACTIVITY_DTO, editActivityDTO); + + mcMonitoringAction.prepareReflectionData(request, mcContent, mcService, null, false, "All"); + + + boolean notebookEntriesExist=MonitoringUtil.notebookEntriesExist(mcService, mcContent); + logger.debug("notebookEntriesExist : " + notebookEntriesExist); + if (notebookEntriesExist) + { + request.setAttribute(NOTEBOOK_ENTRIES_EXIST, new Boolean(true).toString()); + + String userExceptionNoToolSessions=(String)mcGeneralMonitoringDTO.getUserExceptionNoToolSessions(); + logger.debug("userExceptionNoToolSessions : " + userExceptionNoToolSessions); + + if (userExceptionNoToolSessions.equals("true")) + { + logger.debug("there are no online student activity but there are reflections : "); + request.setAttribute(NO_SESSIONS_NOTEBOOK_ENTRIES_EXIST, new Boolean(true).toString()); + } + + } + else + { + request.setAttribute(NOTEBOOK_ENTRIES_EXIST, new Boolean(false).toString()); + } + + + /* SELECTION_CASE == 2 indicates start up */ + request.setAttribute(SELECTION_CASE, new Long(2)); + logger.debug("SELECTION_CASE: " + request.getAttribute(SELECTION_CASE)); + + + /* Default to All for tool Sessions so that all tool sessions' summary information gets displayed when the module starts up */ + request.setAttribute(CURRENT_MONITORED_TOOL_SESSION, "All"); + MonitoringUtil.setupAllSessionsData(request, mcContent,mcService); + + /**getting instructions screen content from here... */ + mcGeneralMonitoringDTO.setOnlineInstructions(mcContent.getOnlineInstructions()); + mcGeneralMonitoringDTO.setOfflineInstructions(mcContent.getOfflineInstructions()); + + List attachmentList = mcService.retrieveMcUploadedFiles(mcContent); + logger.debug("attachmentList: " + attachmentList); + mcGeneralMonitoringDTO.setAttachmentList(attachmentList); + mcGeneralMonitoringDTO.setDeletedAttachmentList(new ArrayList()); + /** ...till here **/ + + MonitoringUtil.buildMcStatsDTO(request,mcService, mcContent); + return true; } - + /** - * validates request paramaters based on tool contract - * validateParameters(HttpServletRequest request, ActionMapping mapping) + * ActionForward validateParameters(HttpServletRequest request, ActionMapping mapping, McMonitoringForm mcMonitoringForm) * * @param request * @param mapping - * @return ActionForward + * @param mcMonitoringForm + * @return */ - protected ActionForward validateParameters(HttpServletRequest request, ActionMapping mapping) + protected ActionForward validateParameters(HttpServletRequest request, ActionMapping mapping, McMonitoringForm mcMonitoringForm) { logger.debug("start validating monitoring parameters..."); @@ -424,38 +413,32 @@ if ((strToolContentId == null) || (strToolContentId.length() == 0)) { McUtils.cleanUpSessionAbsolute(request); - persistError(request, "error.contentId.required"); - request.getSession().setAttribute(USER_EXCEPTION_CONTENTID_REQUIRED, new Boolean(true).toString()); - return (mapping.findForward(ERROR_LIST)); + return (mapping.findForward(ERROR_LIST)); } else { try { - long toolContentId=new Long(strToolContentId).longValue(); - logger.debug("passed TOOL_CONTENT_ID : " + new Long(toolContentId)); - request.getSession().setAttribute(TOOL_CONTENT_ID,new Long(toolContentId)); + long toolContentID=new Long(strToolContentId).longValue(); + logger.debug("passed TOOL_CONTENT_ID : " + new Long(toolContentID)); + mcMonitoringForm.setToolContentID(strToolContentId); } catch(NumberFormatException e) { - McUtils.cleanUpSessionAbsolute(request); - request.getSession().setAttribute(USER_EXCEPTION_NUMBERFORMAT, new Boolean(true).toString()); - //persistError(request, "error.numberFormatException"); - logger.debug("add error.numberFormatException to ActionMessages."); + logger.debug("add error.numberFormatException"); return (mapping.findForward(ERROR_LIST)); } } return null; } - /** * persists error messages to request scope * @param request * @param message */ - public void persistError(HttpServletRequest request, String message) + public void persistInRequestError(HttpServletRequest request, String message) { ActionMessages errors= new ActionMessages(); errors.add(Globals.ERROR_KEY, new ActionMessage(message)); Index: lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/web/MonitoringUtil.java =================================================================== RCS file: /usr/local/cvsroot/lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/web/MonitoringUtil.java,v diff -u -r1.25 -r1.26 --- lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/web/MonitoringUtil.java 17 Sep 2006 06:23:44 -0000 1.25 +++ lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/web/MonitoringUtil.java 2 Oct 2006 01:59:34 -0000 1.26 @@ -32,10 +32,14 @@ import javax.servlet.http.HttpServletRequest; import org.apache.log4j.Logger; +import org.lamsfoundation.lams.notebook.model.NotebookEntry; +import org.lamsfoundation.lams.notebook.service.CoreNotebookConstants; +import org.lamsfoundation.lams.tool.mc.McAllGroupsDTO; import org.lamsfoundation.lams.tool.mc.McAppConstants; import org.lamsfoundation.lams.tool.mc.McMonitoredAnswersDTO; import org.lamsfoundation.lams.tool.mc.McMonitoredUserDTO; import org.lamsfoundation.lams.tool.mc.McSessionMarkDTO; +import org.lamsfoundation.lams.tool.mc.McStatsDTO; import org.lamsfoundation.lams.tool.mc.McStringComparator; import org.lamsfoundation.lams.tool.mc.McUserMarkDTO; import org.lamsfoundation.lams.tool.mc.McUtils; @@ -56,9 +60,11 @@ static Logger logger = Logger.getLogger(MonitoringUtil.class.getName()); /** - * populates all the tool sessions in a map + * * populateToolSessions(HttpServletRequest request, McContent mcContent) * + * populates all the tool sessions in a map + * * @param request * @param mcContent * @return Map @@ -92,9 +98,11 @@ /** - * ends up populating the attempt history for all the users of all the tool sessions for a content + * * buildGroupsQuestionData(HttpServletRequest request, McContent mcContent) * + * ends up populating the attempt history for all the users of all the tool sessions for a content + * * @param request * @param mcContent * @return List @@ -121,7 +129,10 @@ mcMonitoredAnswersDTO.setQuestionUid(mcQueContent.getUid().toString()); mcMonitoredAnswersDTO.setQuestion(mcQueContent.getQuestion()); mcMonitoredAnswersDTO.setWeight(mcQueContent.getWeight().toString()); + mcMonitoredAnswersDTO.setMark(mcQueContent.getMark().toString()); + + List listCandidateAnswers=mcService.findMcOptionNamesByQueId(mcQueContent.getUid()); logger.debug("listCandidateAnswers:..." + listCandidateAnswers); mcMonitoredAnswersDTO.setCandidateAnswers(listCandidateAnswers); @@ -142,6 +153,17 @@ } + /** + * buildGroupsQuestionDataForExportLearner(HttpServletRequest request, McContent mcContent, + IMcService mcService, McSession mcSession, McQueUsr mcQueUsr) + * + * @param request + * @param mcContent + * @param mcService + * @param mcSession + * @param mcQueUsr + * @return + */ public static List buildGroupsQuestionDataForExportLearner(HttpServletRequest request, McContent mcContent, IMcService mcService, McSession mcSession, McQueUsr mcQueUsr) { @@ -167,6 +189,7 @@ mcMonitoredAnswersDTO.setQuestionUid(mcQueContent.getUid().toString()); mcMonitoredAnswersDTO.setQuestion(mcQueContent.getQuestion()); mcMonitoredAnswersDTO.setWeight(mcQueContent.getWeight().toString()); + mcMonitoredAnswersDTO.setMark(mcQueContent.getMark().toString()); List listCandidateAnswers=mcService.findMcOptionNamesByQueId(mcQueContent.getUid()); logger.debug("listCandidateAnswers:..." + listCandidateAnswers); @@ -188,7 +211,18 @@ } - + /** + * + * List buildGroupsMarkDataForExportLearner(HttpServletRequest request, + * McContent mcContent, IMcService mcService, McSession mcSession, Long learnerUid) + * + * @param request + * @param mcContent + * @param mcService + * @param mcSession + * @param learnerUid + * @return + */ public static List buildGroupsMarkDataForExportLearner(HttpServletRequest request, McContent mcContent, IMcService mcService, McSession mcSession, Long learnerUid) { logger.debug("will be building export learner groups mark data for content:..." + mcContent); @@ -249,6 +283,14 @@ } + /** + * List buildGroupsMarkData(HttpServletRequest request, McContent mcContent, IMcService mcService) + * + * @param request + * @param mcContent + * @param mcService + * @return + */ public static List buildGroupsMarkData(HttpServletRequest request, McContent mcContent, IMcService mcService) { logger.debug("will be building groups mark data for content:..." + mcContent); @@ -324,6 +366,14 @@ } + /** + * List buildGroupingBasedResponsesData(HttpServletRequest request, McContent mcContent, IMcService mcService) + * + * @param request + * @param mcContent + * @param mcService + * @return + */ public static List buildGroupingBasedResponsesData(HttpServletRequest request, McContent mcContent, IMcService mcService) { logger.debug("will be building grouping data for content:..." + mcContent); @@ -398,6 +448,18 @@ } + /** + * + * String getLearnerMarkForQuestionInSession(Long mcQueContentUid, Long mcSessionUid, Long mcQueUsrUid, + * McSession mcSession, IMcService mcService) + * + * @param mcQueContentUid + * @param mcSessionUid + * @param mcQueUsrUid + * @param mcSession + * @param mcService + * @return + */ public static String getLearnerMarkForQuestionInSession(Long mcQueContentUid, Long mcSessionUid, Long mcQueUsrUid, McSession mcSession, IMcService mcService) { logger.debug("starting getLearnerMarkForQuestionInSession: mcQueContentUid" + mcQueContentUid); @@ -451,7 +513,8 @@ if (isAttemptCorrect) { - return mcUsrAttemptUser.getMcQueContent().getWeight().toString(); + //return mcUsrAttemptUser.getMcQueContent().getWeight().toString(); + return mcUsrAttemptUser.getMcQueContent().getMark().toString(); } else { @@ -485,7 +548,8 @@ logger.debug("final isAttemptCorrect: " + isAttemptCorrect); if (isAttemptCorrect) { - return mcUsrAttemptGeneral.getMcQueContent().getWeight().toString(); + //return mcUsrAttemptGeneral.getMcQueContent().getWeight().toString(); + return mcUsrAttemptGeneral.getMcQueContent().getMark().toString(); } else { @@ -495,6 +559,12 @@ } + /** + * String getTotalUserMarkForQuestions(LinkedList userMarks) + * + * @param userMarks + * @return + */ public static String getTotalUserMarkForQuestions(LinkedList userMarks) { Iterator itAttempts=userMarks.iterator(); @@ -509,12 +579,21 @@ } - public static List buildSessionQuestionData(HttpServletRequest request, McContent mcContent, Long sessionId, Long userID) + /** + * List buildSessionQuestionData(HttpServletRequest request, McContent mcContent, Long sessionId, Long userID) + * + * @param request + * @param mcContent + * @param sessionId + * @param userID + * @return + */ + public static List buildSessionQuestionData(HttpServletRequest request, McContent mcContent, Long sessionId, Long userID, IMcService mcService) { logger.debug("doing buildSessionQuestionData with sessionId: " + sessionId); logger.debug("doing buildSessionQuestionData with userID: " + userID); logger.debug("will be building groups question data for content:..." + mcContent); - IMcService mcService =McUtils.getToolService(request); + List listQuestions=mcService.getAllQuestionEntries(mcContent.getUid()); logger.debug("listQuestions:..." + listQuestions); @@ -536,7 +615,8 @@ logger.debug("listCandidateAnswers:..." + listCandidateAnswers); mcMonitoredAnswersDTO.setCandidateAnswers(listCandidateAnswers); - Map questionAttemptData= buildSessionAttemptData(request, mcContent, mcQueContent, mcQueContent.getUid().toString(), sessionId, userID); + Map questionAttemptData= buildSessionAttemptData(request, mcContent, mcQueContent, mcQueContent.getUid().toString(), sessionId, + userID, mcService); logger.debug("questionAttemptData:..." + questionAttemptData); mcMonitoredAnswersDTO.setQuestionAttempts(questionAttemptData); listMonitoredAnswersContainerDTO.add(mcMonitoredAnswersDTO); @@ -550,9 +630,11 @@ /** - * helps populating user's attempt history + * * buildGroupsAttemptData(HttpServletRequest request, McContent mcContent, McQueContent mcQueContent) * + * helps populating user's attempt history + * * @param request * @param mcContent * @param mcQueContent @@ -580,7 +662,8 @@ { logger.debug("using the numerical summary tool sessions pair: " + " = " + pairs.getValue()); McSession mcSession= mcService.findMcSessionById(new Long(pairs.getValue().toString())); - logger.debug("mcSession: " + " = " + mcSession); + logger.debug("mcSession: " + " = " + mcSession); + if (mcSession != null) { List listMcUsers=mcService.getMcUserBySessionOnly(mcSession); @@ -627,6 +710,19 @@ } + /** + * Map buildGroupsAttemptDataForExportLearner(HttpServletRequest request, McContent mcContent, McQueContent mcQueContent, String questionUid, + IMcService mcService, McSession mcSession, McQueUsr mcQueUsr ) + + * @param request + * @param mcContent + * @param mcQueContent + * @param questionUid + * @param mcService + * @param mcSession + * @param mcQueUsr + * @return + */ public static Map buildGroupsAttemptDataForExportLearner(HttpServletRequest request, McContent mcContent, McQueContent mcQueContent, String questionUid, IMcService mcService, McSession mcSession, McQueUsr mcQueUsr ) { @@ -654,15 +750,24 @@ } - - - public static Map buildSessionAttemptData(HttpServletRequest request, McContent mcContent, McQueContent mcQueContent, String questionUid, Long sessionId, Long userID) + /** + * Map buildSessionAttemptData(HttpServletRequest request, McContent mcContent, McQueContent mcQueContent, String questionUid, + * Long sessionId, Long userID) + * + * @param request + * @param mcContent + * @param mcQueContent + * @param questionUid + * @param sessionId + * @param userID + * @return + */ + public static Map buildSessionAttemptData(HttpServletRequest request, McContent mcContent, McQueContent mcQueContent, String questionUid, Long sessionId, Long userID, IMcService mcService) { logger.debug("doing buildSessionAttemptData with sessionId: " + sessionId); logger.debug("doing buildSessionAttemptData with userID: " + userID); logger.debug("will be building groups attempt data for mcQueContent:..." + mcQueContent + " questionUid:" + questionUid); - IMcService mcService =McUtils.getToolService(request); Map mapMonitoredAttemptsContainerDTO= new TreeMap(new McStringComparator()); List listMonitoredAttemptsContainerDTO= new LinkedList(); @@ -690,19 +795,20 @@ * @param request * @return int */ - public static int getTotalAttemptCount(HttpServletRequest request) + public static int getTotalAttemptCount(HttpServletRequest request, IMcService mcService) { - IMcService mcService =McUtils.getToolService(request); List listMarks=mcService.getMarks(); logger.debug("total attempt count: " + listMarks.size()); return listMarks.size(); } /** - * ends up populating all the user's attempt data of a particular tool session + * * populateSessionUsersAttempts(HttpServletRequest request,List listMcUsers) * + * ends up populating all the user's attempt data of a particular tool session + * * @param request * @param listMcUsers * @return List @@ -754,7 +860,19 @@ } - + /** + * Map getAttemptEntries(HttpServletRequest request, IMcService mcService, McQueUsr mcQueUsr, McSession mcSession, + String questionUid, List listMonitoredUserContainerDTO, Map mapMonitoredUserContainerDTO) + * + * @param request + * @param mcService + * @param mcQueUsr + * @param mcSession + * @param questionUid + * @param listMonitoredUserContainerDTO + * @param mapMonitoredUserContainerDTO + * @return + */ public static Map getAttemptEntries(HttpServletRequest request, IMcService mcService, McQueUsr mcQueUsr, McSession mcSession, String questionUid, List listMonitoredUserContainerDTO, Map mapMonitoredUserContainerDTO) { @@ -829,7 +947,8 @@ if (isAttemptCorrect) { - mcMonitoredUserDTO.setMark(mcUsrAttemptUser.getMcQueContent().getWeight().toString()); + //mcMonitoredUserDTO.setMark(mcUsrAttemptUser.getMcQueContent().getWeight().toString()); + mcMonitoredUserDTO.setMark(mcUsrAttemptUser.getMcQueContent().getMark().toString()); } else { @@ -866,7 +985,8 @@ logger.debug("final isAttemptCorrect: " + isAttemptCorrect); if (isAttemptCorrect) { - mcMonitoredUserDTO.setMark(mcUsrAttemptGeneral.getMcQueContent().getWeight().toString()); + //mcMonitoredUserDTO.setMark(mcUsrAttemptGeneral.getMcQueContent().getWeight().toString()); + mcMonitoredUserDTO.setMark(mcUsrAttemptGeneral.getMcQueContent().getMark().toString()); } else { @@ -892,6 +1012,12 @@ } + /** + * McUsrAttempt getAttemptWithHighestOrder(List listUserAttempts) + * + * @param listUserAttempts + * @return + */ public static McUsrAttempt getAttemptWithHighestOrder(List listUserAttempts) { logger.debug("starting getAttemptWithHighestOrder: " + listUserAttempts); @@ -920,6 +1046,14 @@ } + /** + * Map populateToolSessionsId(HttpServletRequest request, McContent mcContent, IMcService mcService) + * + * @param request + * @param mcContent + * @param mcService + * @return + */ public static Map populateToolSessionsId(HttpServletRequest request, McContent mcContent, IMcService mcService) { List sessionsList=mcService.getSessionsFromContent(mcContent); @@ -945,7 +1079,12 @@ } - + /** + * Map convertToMap(List list) + * + * @param list + * @return + */ public static Map convertToMap(List list) { logger.debug("using convertToMap: " + list); @@ -964,6 +1103,12 @@ } + /** + * Map convertToMcUserMarkDTOMap(List list) + * + * @param list + * @return + */ public static Map convertToMcUserMarkDTOMap(List list) { logger.debug("using McUserMarkDTOMap: " + list); @@ -982,6 +1127,12 @@ } + /** + * Map convertToMcMonitoredUserDTOMap(List list) + * + * @param list + * @return + */ public static Map convertToMcMonitoredUserDTOMap(List list) { logger.debug("using convertToMcMonitoredUserDTOMap: " + list); @@ -1000,6 +1151,13 @@ } + /** + * void setAttributeNoToolSessions(HttpServletRequest request, IMcService mcService, McContent mcContent) + * + * @param request + * @param mcService + * @param mcContent + */ public static void setAttributeNoToolSessions(HttpServletRequest request, IMcService mcService, McContent mcContent) { logger.debug("using mcContent: " + mcContent); @@ -1050,5 +1208,250 @@ request.getSession().removeAttribute(DEFINE_LATER_IN_EDIT_MODE); request.getSession().removeAttribute(EDIT_OPTIONS_MODE); } + + + /** + * void buildMcStatsDTO(HttpServletRequest request, IMcService mcService, McContent mcContent) + * + * @param request + * @param mcService + * @param mcContent + */ + public static void buildMcStatsDTO(HttpServletRequest request, IMcService mcService, McContent mcContent) + { + logger.debug("building mcStatsDTO: " + mcContent); + McStatsDTO mcStatsDTO= new McStatsDTO(); + + int countSessionComplete=0; + int countAllUsers=0; + logger.debug("finding out about content level notebook entries: " + mcContent); + Iterator iteratorSession= mcContent.getMcSessions().iterator(); + while (iteratorSession.hasNext()) + { + McSession mcSession=(McSession) iteratorSession.next(); + logger.debug("mcSession: " + mcSession); + + if (mcSession != null) + { + logger.debug("mcSession id: " + mcSession.getMcSessionId()); + + if (mcSession.getSessionStatus().equals(COMPLETED)) + { + ++countSessionComplete; + } + + Iterator iteratorUser=mcSession.getMcQueUsers().iterator(); + while (iteratorUser.hasNext()) + { + McQueUsr mcQueUsr=(McQueUsr) iteratorUser.next(); + logger.debug("mcQueUsr: " + mcQueUsr); + + if (mcQueUsr != null) + { + logger.debug("mcQueUsr foundid"); + ++countAllUsers; + } + } + } + } + logger.debug("countAllUsers: " + countAllUsers); + logger.debug("countSessionComplete: " + countSessionComplete); + + + mcStatsDTO.setCountAllUsers(new Integer(countAllUsers).toString()); + mcStatsDTO.setCountSessionComplete(new Integer(countSessionComplete).toString()); + + logger.debug("mcStatsDTO: " + mcStatsDTO); + + request.setAttribute(MC_STATS_DTO, mcStatsDTO); + } + + + /** + * boolean notebookEntriesExist(IMcService mcService, McContent mcContent) + * + * @param mcService + * @param mcContent + * @return + */ + public static boolean notebookEntriesExist(IMcService mcService, McContent mcContent) + { + logger.debug("finding out about content level notebook entries: " + mcContent); + Iterator iteratorSession= mcContent.getMcSessions().iterator(); + while (iteratorSession.hasNext()) + { + McSession mcSession=(McSession) iteratorSession.next(); + logger.debug("mcSession: " + mcSession); + + if (mcSession != null) + { + logger.debug("mcSession id: " + mcSession.getMcSessionId()); + + Iterator iteratorUser=mcSession.getMcQueUsers().iterator(); + while (iteratorUser.hasNext()) + { + McQueUsr mcQueUsr=(McQueUsr) iteratorUser.next(); + logger.debug("mcQueUsr: " + mcQueUsr); + + if (mcQueUsr != null) + { + logger.debug("mcQueUsr id: " + mcQueUsr.getQueUsrId()); + + logger.debug("attempt getting notebookEntry: "); + NotebookEntry notebookEntry = mcService.getEntry(mcSession.getMcSessionId(), + CoreNotebookConstants.NOTEBOOK_TOOL, + MY_SIGNATURE, new Integer(mcQueUsr.getQueUsrId().intValue())); + + logger.debug("notebookEntry: " + notebookEntry); + if (notebookEntry != null) + { + logger.debug("found at least one notebookEntry: " + notebookEntry.getEntry()); + return true; + } + + } + } + } + } + return false; + } + + + /** + * generateGroupsSessionData(HttpServletRequest request, IMcService mcService, McContent mcContent) + * + * @param request + * @param mcService + * @param mcContent + */ + public static void generateGroupsSessionData(HttpServletRequest request, IMcService mcService, McContent mcContent) + { + logger.debug("generateGroupsSessionData: " + mcContent); + + List listAllGroupsDTO=buildGroupBasedSessionData(request, mcContent, mcService); + logger.debug("listAllGroupsDTO: " + listAllGroupsDTO); + + request.setAttribute(LIST_ALL_GROUPS_DTO, listAllGroupsDTO); + } + + + /** + * List buildGroupBasedSessionData(HttpServletRequest request, McContent mcContent, IMcService mcService) + * + * @param request + * @param mcContent + * @param mcService + * @return + */ + public static List buildGroupBasedSessionData(HttpServletRequest request, McContent mcContent, IMcService mcService) + { + logger.debug("buildGroupBasedSessionData" + mcContent); + logger.debug("will be building groups question data for content:..." + mcContent); + List listQuestions=mcService.getAllQuestionEntries(mcContent.getUid()); + logger.debug("listQuestions:..." + listQuestions); + List listAllGroupsContainerDTO= new LinkedList(); + + + Iterator iteratorSession= mcContent.getMcSessions().iterator(); + while (iteratorSession.hasNext()) + { + McSession mcSession=(McSession) iteratorSession.next(); + logger.debug("iteration for group based session data: " + mcSession); + String currentSessionId=mcSession.getMcSessionId().toString(); + logger.debug("currentSessionId: " + currentSessionId); + + String currentSessionName=mcSession.getSession_name(); + logger.debug("currentSessionName: " + currentSessionName); + + McAllGroupsDTO mcAllGroupsDTO= new McAllGroupsDTO(); + List listMonitoredAnswersContainerDTO= new LinkedList(); + + if (mcSession != null) + { + Iterator itListQuestions = listQuestions.iterator(); + while (itListQuestions.hasNext()) + { + McQueContent mcQueContent =(McQueContent)itListQuestions.next(); + logger.debug("mcQueContent:..." + mcQueContent); + + if (mcQueContent != null) + { + logger.debug("populating McMonitoredAnswersDTO for : " + mcQueContent); + McMonitoredAnswersDTO mcMonitoredAnswersDTO= new McMonitoredAnswersDTO(); + mcMonitoredAnswersDTO.setQuestionUid(mcQueContent.getUid().toString()); + mcMonitoredAnswersDTO.setQuestion(mcQueContent.getQuestion()); + mcMonitoredAnswersDTO.setSessionId(currentSessionId); + mcMonitoredAnswersDTO.setSessionName(currentSessionName); + + Map questionAttemptData = new TreeMap(); + + logger.debug("generated questionAttemptData: " + questionAttemptData); + mcMonitoredAnswersDTO.setQuestionAttempts(questionAttemptData); + + logger.debug("adding mcMonitoredAnswersDTO to the listMonitoredAnswersContainerDTO: " + mcMonitoredAnswersDTO); + listMonitoredAnswersContainerDTO.add(mcMonitoredAnswersDTO); + } + } + } + logger.debug("listMonitoredAnswersContainerDTO:" + listMonitoredAnswersContainerDTO); + + logger.debug("adding listMonitoredAnswersContainerDTO to the mcAllGroupsDTO:" + listMonitoredAnswersContainerDTO); + mcAllGroupsDTO.setGroupData(listMonitoredAnswersContainerDTO); + mcAllGroupsDTO.setSessionName(currentSessionName); + mcAllGroupsDTO.setSessionId(currentSessionId); + + logger.debug("built mcAllGroupsDTO:" + mcAllGroupsDTO); + listAllGroupsContainerDTO.add(mcAllGroupsDTO); + + } + + + logger.debug("final listAllGroupsContainerDTO:..." + listAllGroupsContainerDTO); + return listAllGroupsContainerDTO; + } + + + /** + * void setupAllSessionsData(HttpServletRequest request, McContent mcContent, IMcService mcService) + * + * @param request + * @param mcContent + * @param mcService + */ + protected static void setupAllSessionsData(HttpServletRequest request, McContent mcContent, IMcService mcService) + { + logger.debug("starting setupAllSessionsData, mcContent: " + mcContent); + logger.debug("CURRENT_MONITORED_TOOL_SESSION: " + request.getAttribute(CURRENT_MONITORED_TOOL_SESSION)); + + List listMonitoredAnswersContainerDTO=MonitoringUtil.buildGroupsQuestionData(request, mcContent, mcService); + request.setAttribute(LIST_MONITORED_ANSWERS_CONTAINER_DTO, listMonitoredAnswersContainerDTO); + logger.debug("LIST_MONITORED_ANSWERS_CONTAINER_DTO: " + request.getAttribute(LIST_MONITORED_ANSWERS_CONTAINER_DTO)); + + List listMonitoredMarksContainerDTO=MonitoringUtil.buildGroupsMarkData(request, mcContent, mcService); + request.setAttribute(LIST_MONITORED_MARKS_CONTAINER_DTO, listMonitoredMarksContainerDTO); + logger.debug("LIST_MONITORED_MARKS_CONTAINER_DTO: " + request.getAttribute(LIST_MONITORED_MARKS_CONTAINER_DTO)); + logger.debug("ending setupAllSessionsData, mcContent: "); + + request.setAttribute(HR_COLUMN_COUNT, new Integer(mcContent.getMcQueContents().size()+2).toString()); + + String strPassMark=""; + Integer passMark=mcContent.getPassMark(); + logger.debug("passMark: " + passMark); + + if (passMark == null) + strPassMark=" "; + else if ((passMark != null) && (passMark.equals("0"))) + strPassMark=" "; + else + strPassMark=passMark.toString(); + + logger.debug("strPassMark: " + strPassMark); + + if (strPassMark.trim().equals("0")) + strPassMark=" "; + + logger.debug("strPassMark: " + strPassMark); + request.setAttribute(PASSMARK, strPassMark); + } } Index: lams_tool_lamc/test/java/org/lamsfoundation/lams/tool/mc/McDataAccessTestCase.java =================================================================== RCS file: /usr/local/cvsroot/lams_tool_lamc/test/java/org/lamsfoundation/lams/tool/mc/Attic/McDataAccessTestCase.java,v diff -u -r1.19 -r1.20 --- lams_tool_lamc/test/java/org/lamsfoundation/lams/tool/mc/McDataAccessTestCase.java 17 Sep 2006 06:23:44 -0000 1.19 +++ lams_tool_lamc/test/java/org/lamsfoundation/lams/tool/mc/McDataAccessTestCase.java 2 Oct 2006 01:59:54 -0000 1.20 @@ -115,18 +115,13 @@ mc.setTitle("title..."); mc.setInstructions("instructions..."); mc.setQuestionsSequenced(false); - mc.setUsernameVisible(false); mc.setCreatedBy(0); - mc.setMonitoringReportTitle("Monitoring Report"); - mc.setReportTitle("Report"); mc.setRunOffline(false); mc.setDefineLater(false); - mc.setSynchInMonitor(false); mc.setOnlineInstructions("online instructions..."); mc.setOfflineInstructions("offline instructions..."); mc.setContentInUse(false); mc.setRetries(false); - mc.setShowFeedback(false); mc.setMcQueContents(new HashSet()); mc.setMcSessions(new HashSet()); mcContentDAO.saveMcContent(mc); Index: lams_tool_lamc/web/403.jsp =================================================================== RCS file: /usr/local/cvsroot/lams_tool_lamc/web/403.jsp,v diff -u -r1.1 -r1.2 --- lams_tool_lamc/web/403.jsp 25 Jul 2006 05:16:26 -0000 1.1 +++ lams_tool_lamc/web/403.jsp 2 Oct 2006 01:59:54 -0000 1.2 @@ -1,3 +1,22 @@ +<%-- +Copyright (C) 2005 LAMS Foundation (http://lamsfoundation.org) +License Information: http://lamsfoundation.org/licensing/lams/2.0/ + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License version 2 as + published by the Free Software Foundation. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + + http://www.gnu.org/licenses/gpl.txt +--%> <%@ page language="java" pageEncoding="UTF-8" contentType="text/html;charset=utf-8" %> <%@ taglib uri="tags-lams" prefix="lams"%> <%@ taglib uri="tags-core" prefix="c" %> Index: lams_tool_lamc/web/404.jsp =================================================================== RCS file: /usr/local/cvsroot/lams_tool_lamc/web/404.jsp,v diff -u -r1.1 -r1.2 --- lams_tool_lamc/web/404.jsp 25 Jul 2006 05:16:26 -0000 1.1 +++ lams_tool_lamc/web/404.jsp 2 Oct 2006 01:59:35 -0000 1.2 @@ -1,3 +1,22 @@ +<%-- +Copyright (C) 2005 LAMS Foundation (http://lamsfoundation.org) +License Information: http://lamsfoundation.org/licensing/lams/2.0/ + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License version 2 as + published by the Free Software Foundation. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + + http://www.gnu.org/licenses/gpl.txt +--%> <%@ page language="java" pageEncoding="UTF-8" contentType="text/html;charset=utf-8" %> <%@ taglib uri="tags-lams" prefix="lams"%> <%@ taglib uri="tags-core" prefix="c" %> Fisheye: Tag 1.3 refers to a dead (removed) revision in file `lams_tool_lamc/web/AuthoringMaincontent.jsp'. Fisheye: No comparison available. Pass `N' to diff? Index: lams_tool_lamc/web/BaseContent.jsp =================================================================== RCS file: /usr/local/cvsroot/lams_tool_lamc/web/Attic/BaseContent.jsp,v diff -u -r1.4 -r1.5 --- lams_tool_lamc/web/BaseContent.jsp 17 Sep 2006 06:23:44 -0000 1.4 +++ lams_tool_lamc/web/BaseContent.jsp 2 Oct 2006 01:59:35 -0000 1.5 @@ -1,9 +1,9 @@ -<%-- +<%-- Copyright (C) 2005 LAMS Foundation (http://lamsfoundation.org) License Information: http://lamsfoundation.org/licensing/lams/2.0/ This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License version 2 as + it under the terms of the GNU General Public License version 2 as published by the Free Software Foundation. This program is distributed in the hope that it will be useful, @@ -13,18 +13,9 @@ You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software - Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 - USA + Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA http://www.gnu.org/licenses/gpl.txt --%> -<%@ taglib uri="tags-bean" prefix="bean"%> -<%@ taglib uri="tags-html" prefix="html"%> -<%@ taglib uri="tags-logic" prefix="logic" %> -<%@ taglib uri="tags-logic-el" prefix="logic-el" %> -<%@ taglib uri="tags-core" prefix="c"%> -<%@ taglib uri="tags-fmt" prefix="fmt" %> -<%@ taglib uri="fck-editor" prefix="FCK" %> -<%@ taglib uri="tags-lams" prefix="lams" %>

Base Content

Index: lams_tool_lamc/web/Footer.jsp =================================================================== RCS file: /usr/local/cvsroot/lams_tool_lamc/web/Attic/Footer.jsp,v diff -u -r1.4 -r1.5 --- lams_tool_lamc/web/Footer.jsp 17 Sep 2006 06:23:44 -0000 1.4 +++ lams_tool_lamc/web/Footer.jsp 2 Oct 2006 01:59:54 -0000 1.5 @@ -1,9 +1,9 @@ -<%-- +<%-- Copyright (C) 2005 LAMS Foundation (http://lamsfoundation.org) License Information: http://lamsfoundation.org/licensing/lams/2.0/ This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License version 2 as + it under the terms of the GNU General Public License version 2 as published by the Free Software Foundation. This program is distributed in the hope that it will be useful, @@ -13,16 +13,7 @@ You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software - Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 - USA + Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA http://www.gnu.org/licenses/gpl.txt ---%> - -<%@ taglib uri="tags-bean" prefix="bean"%> -<%@ taglib uri="tags-html" prefix="html"%> -<%@ taglib uri="tags-logic" prefix="logic" %> -<%@ taglib uri="tags-core" prefix="c"%> -<%@ taglib uri="tags-fmt" prefix="fmt" %> -<%@ taglib uri="fck-editor" prefix="FCK" %> -<%@ taglib uri="tags-lams" prefix="lams" %> +--%> \ No newline at end of file Index: lams_tool_lamc/web/Header.jsp =================================================================== RCS file: /usr/local/cvsroot/lams_tool_lamc/web/Attic/Header.jsp,v diff -u -r1.6 -r1.7 --- lams_tool_lamc/web/Header.jsp 17 Sep 2006 06:23:44 -0000 1.6 +++ lams_tool_lamc/web/Header.jsp 2 Oct 2006 01:59:54 -0000 1.7 @@ -1,9 +1,9 @@ -<%-- +<%-- Copyright (C) 2005 LAMS Foundation (http://lamsfoundation.org) License Information: http://lamsfoundation.org/licensing/lams/2.0/ This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License version 2 as + it under the terms of the GNU General Public License version 2 as published by the Free Software Foundation. This program is distributed in the hope that it will be useful, @@ -13,16 +13,7 @@ You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software - Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 - USA + Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA http://www.gnu.org/licenses/gpl.txt --%> -<%@ taglib uri="tags-bean" prefix="bean"%> -<%@ taglib uri="tags-html" prefix="html"%> -<%@ taglib uri="tags-logic" prefix="logic" %> -<%@ taglib uri="tags-logic-el" prefix="logic-el" %> -<%@ taglib uri="tags-core" prefix="c"%> -<%@ taglib uri="tags-fmt" prefix="fmt" %> -<%@ taglib uri="fck-editor" prefix="FCK" %> -<%@ taglib uri="tags-lams" prefix="lams" %> Index: lams_tool_lamc/web/SystemErrorContent.jsp =================================================================== RCS file: /usr/local/cvsroot/lams_tool_lamc/web/Attic/SystemErrorContent.jsp,v diff -u -r1.6 -r1.7 --- lams_tool_lamc/web/SystemErrorContent.jsp 17 Sep 2006 06:23:44 -0000 1.6 +++ lams_tool_lamc/web/SystemErrorContent.jsp 2 Oct 2006 01:59:54 -0000 1.7 @@ -1,9 +1,9 @@ -<%-- +<%-- Copyright (C) 2005 LAMS Foundation (http://lamsfoundation.org) License Information: http://lamsfoundation.org/licensing/lams/2.0/ This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License version 2 as + it under the terms of the GNU General Public License version 2 as published by the Free Software Foundation. This program is distributed in the hope that it will be useful, @@ -13,27 +13,18 @@ You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software - Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 - USA + Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA http://www.gnu.org/licenses/gpl.txt --%> - -<%@ taglib uri="tags-bean" prefix="bean"%> -<%@ taglib uri="tags-html" prefix="html"%> -<%@ taglib uri="tags-logic" prefix="logic" %> -<%@ taglib uri="tags-core" prefix="c"%> -<%@ taglib uri="tags-fmt" prefix="fmt" %> -<%@ taglib uri="fck-editor" prefix="FCK" %> -<%@ taglib uri="tags-lams" prefix="lams" %> - +
- + - - + - - + + +
+ +
+ + - - + + - + + - - + +
- +
Fisheye: Tag 1.20 refers to a dead (removed) revision in file `lams_tool_lamc/web/index.jsp'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.18 refers to a dead (removed) revision in file `lams_tool_lamc/web/learningIndex.jsp'. Fisheye: No comparison available. Pass `N' to diff? Index: lams_tool_lamc/web/login.jsp =================================================================== RCS file: /usr/local/cvsroot/lams_tool_lamc/web/login.jsp,v diff -u -r1.5 -r1.6 --- lams_tool_lamc/web/login.jsp 25 Jul 2006 05:16:26 -0000 1.5 +++ lams_tool_lamc/web/login.jsp 2 Oct 2006 01:59:54 -0000 1.6 @@ -1,3 +1,23 @@ +<%-- +Copyright (C) 2005 LAMS Foundation (http://lamsfoundation.org) +License Information: http://lamsfoundation.org/licensing/lams/2.0/ + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License version 2 as + published by the Free Software Foundation. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + + http://www.gnu.org/licenses/gpl.txt +--%> + <%@ page language="java" pageEncoding="UTF-8" contentType="text/html;charset=utf-8" %> <%@ taglib uri="tags-lams" prefix="lams"%> <%@ taglib uri="tags-core" prefix="c" %> Fisheye: Tag 1.9 refers to a dead (removed) revision in file `lams_tool_lamc/web/monitoringIndex.jsp'. Fisheye: No comparison available. Pass `N' to diff? Index: lams_tool_lamc/web/WEB-INF/struts-config.xml =================================================================== RCS file: /usr/local/cvsroot/lams_tool_lamc/web/WEB-INF/struts-config.xml,v diff -u -r1.56 -r1.57 --- lams_tool_lamc/web/WEB-INF/struts-config.xml 6 Sep 2006 23:49:47 -0000 1.56 +++ lams_tool_lamc/web/WEB-INF/struts-config.xml 2 Oct 2006 01:59:54 -0000 1.57 @@ -26,119 +26,123 @@ - - - + + - + + + - + - + + + + + - - - + name="load" + path="/AuthoringMaincontent.jsp" + redirect="false" + /> + - - - - - - - - - - - + + + + + + + + - - + - - + + + - @@ -284,34 +288,29 @@ - - - - - + + + + @@ -320,57 +319,63 @@ - + - + - - + - - - - - + + - + + + + + + + + + + Index: lams_tool_lamc/web/WEB-INF/web.xml =================================================================== RCS file: /usr/local/cvsroot/lams_tool_lamc/web/WEB-INF/web.xml,v diff -u -r1.22 -r1.23 --- lams_tool_lamc/web/WEB-INF/web.xml 20 Sep 2006 00:46:18 -0000 1.22 +++ lams_tool_lamc/web/WEB-INF/web.xml 2 Oct 2006 01:59:54 -0000 1.23 @@ -174,6 +174,7 @@ --> + @@ -191,10 +192,6 @@ /WEB-INF/struts/tlds/struts-logic.tld - tags-logic-el - /WEB-INF/struts/tlds/struts-logic-el.tld - - tags-tiles /WEB-INF/struts/tlds/struts-tiles.tld @@ -217,30 +214,21 @@ tags-xml /WEB-INF/jstl/tlds/x.tld - - - - - tags-permittedTaglibs - /WEB-INF/jstl/tlds/permittedTaglibs.tld - - - tags-scriptfree - /WEB-INF/jstl/tlds/scriptfree.tld - - - - - - fck-editor - /WEB-INF/fckeditor/tlds/FCKeditor.tld - - - tags-lams - /WEB-INF/lams.tld - + + + + + fck-editor + /WEB-INF/fckeditor/tlds/FCKeditor.tld + + + tags-lams + /WEB-INF/lams.tld + - + + + @@ -350,6 +338,5 @@ /login.jsp?failed=y - Index: lams_tool_lamc/web/authoring/AdvancedContent.jsp =================================================================== RCS file: /usr/local/cvsroot/lams_tool_lamc/web/authoring/AdvancedContent.jsp,v diff -u -r1.19 -r1.20 --- lams_tool_lamc/web/authoring/AdvancedContent.jsp 17 Sep 2006 06:23:45 -0000 1.19 +++ lams_tool_lamc/web/authoring/AdvancedContent.jsp 2 Oct 2006 01:59:35 -0000 1.20 @@ -1,9 +1,9 @@ -<%-- +<%-- Copyright (C) 2005 LAMS Foundation (http://lamsfoundation.org) License Information: http://lamsfoundation.org/licensing/lams/2.0/ This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License version 2 as + it under the terms of the GNU General Public License version 2 as published by the Free Software Foundation. This program is distributed in the hope that it will be useful, @@ -13,25 +13,13 @@ You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software - Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 - USA + Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA http://www.gnu.org/licenses/gpl.txt --%> -<%@ taglib uri="tags-bean" prefix="bean"%> -<%@ taglib uri="tags-html" prefix="html"%> -<%@ taglib uri="tags-logic" prefix="logic" %> -<%@ taglib uri="tags-logic-el" prefix="logic-el" %> -<%@ taglib uri="tags-core" prefix="c"%> -<%@ taglib uri="tags-fmt" prefix="fmt" %> -<%@ taglib uri="fck-editor" prefix="FCK" %> -<%@ taglib uri="tags-lams" prefix="lams" %> +<%@ include file="/common/taglibs.jsp"%> - - - - + + + + + + @@ -72,14 +78,7 @@
@@ -56,6 +44,24 @@
+ + +
- - - - - - - - \ No newline at end of file + \ No newline at end of file Index: lams_tool_lamc/web/authoring/AuthoringTabsHolder.jsp =================================================================== RCS file: /usr/local/cvsroot/lams_tool_lamc/web/authoring/AuthoringTabsHolder.jsp,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ lams_tool_lamc/web/authoring/AuthoringTabsHolder.jsp 2 Oct 2006 01:59:34 -0000 1.1 @@ -0,0 +1,179 @@ +<%-- +Copyright (C) 2005 LAMS Foundation (http://lamsfoundation.org) +License Information: http://lamsfoundation.org/licensing/lams/2.0/ + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License version 2 as + published by the Free Software Foundation. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + + http://www.gnu.org/licenses/gpl.txt +--%> + + + + +<%@ include file="/common/taglibs.jsp"%> + +<%@ page import="java.util.LinkedHashSet" %> +<%@ page import="java.util.Set" %> +<%@ page import="org.lamsfoundation.lams.tool.mc.McAppConstants"%> + + <% + Set tabs = new LinkedHashSet(); + tabs.add("label.basic"); + tabs.add("label.advanced"); + tabs.add("label.instructions"); + pageContext.setAttribute("tabs", tabs); + + Set tabsBasic = new LinkedHashSet(); + tabsBasic.add("label.basic"); + pageContext.setAttribute("tabsBasic", tabsBasic); + %> + + + + <fmt:message key="activity.title" /> + + <%@ include file="/common/header.jsp"%> + + + + + + + + + + + +
+

+ + + +
+ + + + + + + + + + + <%@ include file="/common/messages.jsp"%> + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + +
+ + + +
+ + + Fisheye: Tag 1.4 refers to a dead (removed) revision in file `lams_tool_lamc/web/authoring/Basic.jsp'. Fisheye: No comparison available. Pass `N' to diff? Index: lams_tool_lamc/web/authoring/BasicContentViewOnly.jsp =================================================================== RCS file: /usr/local/cvsroot/lams_tool_lamc/web/authoring/Attic/BasicContentViewOnly.jsp,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ lams_tool_lamc/web/authoring/BasicContentViewOnly.jsp 2 Oct 2006 01:59:35 -0000 1.1 @@ -0,0 +1,74 @@ +<%-- +Copyright (C) 2005 LAMS Foundation (http://lamsfoundation.org) +License Information: http://lamsfoundation.org/licensing/lams/2.0/ + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License version 2 as + published by the Free Software Foundation. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + + http://www.gnu.org/licenses/gpl.txt +--%> + +<%@ include file="/common/taglibs.jsp"%> + + + + + + + + + + + + + + + + + + + + +
+
+ +
+ +
+
+ +
+ +
+
+ <%@ include file="/authoring/itemlistViewOnly.jsp"%> +
+
+ + + +
+ + + + + + + + + + + + + + \ No newline at end of file Index: lams_tool_lamc/web/authoring/InstructionsContent.jsp =================================================================== RCS file: /usr/local/cvsroot/lams_tool_lamc/web/authoring/Attic/InstructionsContent.jsp,v diff -u -r1.12 -r1.13 --- lams_tool_lamc/web/authoring/InstructionsContent.jsp 17 Sep 2006 06:23:45 -0000 1.12 +++ lams_tool_lamc/web/authoring/InstructionsContent.jsp 2 Oct 2006 01:59:35 -0000 1.13 @@ -1,3 +1,4 @@ + <%-- Copyright (C) 2005 LAMS Foundation (http://lamsfoundation.org) License Information: http://lamsfoundation.org/licensing/lams/2.0/ @@ -19,135 +20,179 @@ http://www.gnu.org/licenses/gpl.txt --%> -<%@ taglib uri="tags-bean" prefix="bean"%> -<%@ taglib uri="tags-html" prefix="html"%> -<%@ taglib uri="tags-logic" prefix="logic" %> -<%@ taglib uri="tags-logic-el" prefix="logic-el" %> -<%@ taglib uri="tags-core" prefix="c"%> -<%@ taglib uri="tags-fmt" prefix="fmt" %> -<%@ taglib uri="fck-editor" prefix="FCK" %> -<%@ taglib uri="tags-lams" prefix="lams" %> +<%@ include file="/common/taglibs.jsp" %> - - + -
- -
- -
- - - + +
+ +
+ + - + - + +
- -
- - - - - +
- - - - - - - - + + + - - - - -
- - - - - - - - - images/delete.gif" align=left onclick="javascript:submitDeleteFile('','deleteOnlineFile');"> -
-
+ + + +
+ + + + + /download/?uuid=&preferDownload=false + /download/?uuid=&preferDownload=true + + + + + + + + +
+ + + + +
+ '/>")' class="button"> + + +    + + + +    + + + +
+
+
+ + + +
+
- + + - - - - + + + + +
- -
- - - - - - - - -
- - - - - - - - - - - - - - - - - images/delete.gif" align=left onclick="javascript:submitDeleteFile('','deleteOnlineFile');"> -
-
+ + + +
+ + + + +
+ + + + + + /download/?uuid=&preferDownload=false + /download/?uuid=&preferDownload=true + + + + + + + + +
+ + + + +
+ '/>")' class="button"> + + +    + + + +    + + + +
+
+
+ +
+
- + + - - - - + + + + +
+ - - - - - - + + + + + + Fisheye: Tag 1.21 refers to a dead (removed) revision in file `lams_tool_lamc/web/authoring/OptionsContent.jsp'. Fisheye: No comparison available. Pass `N' to diff? Index: lams_tool_lamc/web/authoring/candidateAnswersAddList.jsp =================================================================== RCS file: /usr/local/cvsroot/lams_tool_lamc/web/authoring/candidateAnswersAddList.jsp,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ lams_tool_lamc/web/authoring/candidateAnswersAddList.jsp 2 Oct 2006 01:59:35 -0000 1.1 @@ -0,0 +1,113 @@ +<%-- +Copyright (C) 2005 LAMS Foundation (http://lamsfoundation.org) +License Information: http://lamsfoundation.org/licensing/lams/2.0/ + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License version 2 as + published by the Free Software Foundation. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + + http://www.gnu.org/licenses/gpl.txt +--%> + +<%@ include file="/common/taglibs.jsp" %> + + + + + + + + +
+
+ +
+
+ +<%@ include file="/common/messages.jsp"%> + +newQuestionBoxDTO.listCandidateAnswersDTO:
+ + + + + + + currentCandidateDTO:
+ + +
+ + + + + + + + + + + + + + +
+ + + + + + + + + + + + + ', '', 'moveAddCandidateDown');"> + images/down.gif" border="0"> + + + + + + ', '', 'moveAddCandidateUp');"> + images/up.gif" border="0"> + + + + + ', '', 'moveAddCandidateDown');"> + images/down.gif" border="0"> + + + ', '', 'moveAddCandidateUp');"> + images/up.gif" border="0"> + + + + + + + images/delete.gif" border="0"> + +
Index: lams_tool_lamc/web/authoring/candidateAnswersList.jsp =================================================================== RCS file: /usr/local/cvsroot/lams_tool_lamc/web/authoring/candidateAnswersList.jsp,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ lams_tool_lamc/web/authoring/candidateAnswersList.jsp 2 Oct 2006 01:59:34 -0000 1.1 @@ -0,0 +1,124 @@ +<%-- +Copyright (C) 2005 LAMS Foundation (http://lamsfoundation.org) +License Information: http://lamsfoundation.org/licensing/lams/2.0/ + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License version 2 as + published by the Free Software Foundation. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + + http://www.gnu.org/licenses/gpl.txt +--%> + +<%@ include file="/common/taglibs.jsp" %> + + + + + + + + +
+
+ +
+
+ +<%@ include file="/common/messages.jsp"%> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + ', '', 'moveCandidateDown');"> + images/down.gif" border="0"> + + + + + + ', '', 'moveCandidateUp');"> + images/up.gif" border="0"> + + + + + ', '', 'moveCandidateDown');"> + images/down.gif" border="0"> + + + ', '', 'moveCandidateUp');"> + images/up.gif" border="0"> + + + + + + + images/delete.gif" border="0"> + +
Index: lams_tool_lamc/web/authoring/editQuestionBox.jsp =================================================================== RCS file: /usr/local/cvsroot/lams_tool_lamc/web/authoring/editQuestionBox.jsp,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ lams_tool_lamc/web/authoring/editQuestionBox.jsp 2 Oct 2006 01:59:35 -0000 1.1 @@ -0,0 +1,189 @@ +<%-- +Copyright (C) 2005 LAMS Foundation (http://lamsfoundation.org) +License Information: http://lamsfoundation.org/licensing/lams/2.0/ + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License version 2 as + published by the Free Software Foundation. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + + http://www.gnu.org/licenses/gpl.txt +--%> + + + +<%@ include file="/common/taglibs.jsp"%> + + + <%@ include file="/common/header.jsp"%> + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+
+ +
+ + +
+ <%@ include file="/authoring/candidateAnswersList.jsp"%> +
+ + + +
+ + + + + + + +
+
+ +
+ +
+ + + + + + +
                     + + + + + + + +
+
+
+ + + Index: lams_tool_lamc/web/authoring/itemlist.jsp =================================================================== RCS file: /usr/local/cvsroot/lams_tool_lamc/web/authoring/itemlist.jsp,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ lams_tool_lamc/web/authoring/itemlist.jsp 2 Oct 2006 01:59:34 -0000 1.1 @@ -0,0 +1,104 @@ +<%-- +Copyright (C) 2005 LAMS Foundation (http://lamsfoundation.org) +License Information: http://lamsfoundation.org/licensing/lams/2.0/ + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License version 2 as + published by the Free Software Foundation. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + + http://www.gnu.org/licenses/gpl.txt +--%> + +<%@ include file="/common/taglibs.jsp" %> + + +<%-- This script will works when a new resoruce item submit in order to refresh "Resource List" panel. --%> + + Index: lams_tool_lamc/web/authoring/itemlistViewOnly.jsp =================================================================== RCS file: /usr/local/cvsroot/lams_tool_lamc/web/authoring/Attic/itemlistViewOnly.jsp,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ lams_tool_lamc/web/authoring/itemlistViewOnly.jsp 2 Oct 2006 01:59:35 -0000 1.1 @@ -0,0 +1,94 @@ +<%-- +Copyright (C) 2005 LAMS Foundation (http://lamsfoundation.org) +License Information: http://lamsfoundation.org/licensing/lams/2.0/ + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License version 2 as + published by the Free Software Foundation. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + + http://www.gnu.org/licenses/gpl.txt +--%> + + +<%@ include file="/common/taglibs.jsp" %> + + Index: lams_tool_lamc/web/authoring/newQuestionBox.jsp =================================================================== RCS file: /usr/local/cvsroot/lams_tool_lamc/web/authoring/newQuestionBox.jsp,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ lams_tool_lamc/web/authoring/newQuestionBox.jsp 2 Oct 2006 01:59:35 -0000 1.1 @@ -0,0 +1,149 @@ +<%-- +Copyright (C) 2005 LAMS Foundation (http://lamsfoundation.org) +License Information: http://lamsfoundation.org/licensing/lams/2.0/ + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License version 2 as + published by the Free Software Foundation. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + + http://www.gnu.org/licenses/gpl.txt +--%> + + + +<%@ include file="/common/taglibs.jsp"%> + + + <%@ include file="/common/header.jsp"%> + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + +
+
+ +
+ +
+ + + + + + +
+
+ +
+ +
+ + + + + + +
                     + + + + + + + +
+
+
+ + + Index: lams_tool_lamc/web/common/messages.jsp =================================================================== RCS file: /usr/local/cvsroot/lams_tool_lamc/web/common/messages.jsp,v diff -u -r1.1 -r1.2 --- lams_tool_lamc/web/common/messages.jsp 29 Jun 2006 00:44:45 -0000 1.1 +++ lams_tool_lamc/web/common/messages.jsp 2 Oct 2006 01:59:34 -0000 1.2 @@ -2,9 +2,9 @@
- -
+   
@@ -13,8 +13,8 @@
- -
+    +   
\ No newline at end of file Index: lams_tool_lamc/web/common/taglibs.jsp =================================================================== RCS file: /usr/local/cvsroot/lams_tool_lamc/web/common/taglibs.jsp,v diff -u -r1.1 -r1.2 --- lams_tool_lamc/web/common/taglibs.jsp 29 Jun 2006 00:44:45 -0000 1.1 +++ lams_tool_lamc/web/common/taglibs.jsp 2 Oct 2006 01:59:34 -0000 1.2 @@ -1,4 +1,4 @@ -<%@ page language="java" errorPage="/error.jsp" pageEncoding="UTF-8" contentType="text/html;charset=utf-8" %> +<%@ page language="java" pageEncoding="UTF-8" contentType="text/html;charset=utf-8" %> <%@ taglib uri="tags-tiles" prefix="tiles" %> <%@ taglib uri="tags-bean" prefix="bean" %> <%@ taglib uri="tags-html" prefix="html" %> @@ -10,4 +10,3 @@ <%@ taglib uri="tags-lams" prefix="lams" %> <%@ taglib uri="fck-editor" prefix="FCK"%> - Index: lams_tool_lamc/web/images/iconInformation.gif =================================================================== RCS file: /usr/local/cvsroot/lams_tool_lamc/web/images/iconInformation.gif,v diff -u Binary files differ Index: lams_tool_lamc/web/images/iconWarning.gif =================================================================== RCS file: /usr/local/cvsroot/lams_tool_lamc/web/images/iconWarning.gif,v diff -u Binary files differ Index: lams_tool_lamc/web/includes/blank.jsp =================================================================== RCS file: /usr/local/cvsroot/lams_tool_lamc/web/includes/Attic/blank.jsp,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ lams_tool_lamc/web/includes/blank.jsp 2 Oct 2006 01:59:55 -0000 1.1 @@ -0,0 +1,3 @@ +<%@ include file="/common/taglibs.jsp" %> +<%@ include file="/common/messages.jsp" %> + Index: lams_tool_lamc/web/includes/error.jsp =================================================================== RCS file: /usr/local/cvsroot/lams_tool_lamc/web/includes/Attic/error.jsp,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ lams_tool_lamc/web/includes/error.jsp 2 Oct 2006 01:59:55 -0000 1.1 @@ -0,0 +1,7 @@ +<%@ page language="java" %> +<%@ include file="/includes/taglibs.jsp" %> +
+ + + +
Index: lams_tool_lamc/web/includes/layout.jsp =================================================================== RCS file: /usr/local/cvsroot/lams_tool_lamc/web/includes/Attic/layout.jsp,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ lams_tool_lamc/web/includes/layout.jsp 2 Oct 2006 01:59:54 -0000 1.1 @@ -0,0 +1,32 @@ + + +<%@ include file="/common/taglibs.jsp"%> +<%@ taglib uri="tags-tiles" prefix="tiles"%> + + + + <bean:message key="activity.title" /> + <%@ include file="/common/header.jsp"%> + + +
+ + + +

+ +

+
+ + + +
+ +
+ + +
+ + Index: lams_tool_lamc/web/includes/learnerLayout.jsp =================================================================== RCS file: /usr/local/cvsroot/lams_tool_lamc/web/includes/Attic/learnerLayout.jsp,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ lams_tool_lamc/web/includes/learnerLayout.jsp 2 Oct 2006 01:59:55 -0000 1.1 @@ -0,0 +1,33 @@ + + +<%@ include file="/common/taglibs.jsp"%> +<%@ taglib uri="tags-tiles" prefix="tiles"%> + + + + + + + + + <bean:message key="activity.title" /> + <%@ include file="/common/header.jsp"%> + + + + + + +
+ +
+ + Index: lams_tool_lamc/web/includes/tablayout.jsp =================================================================== RCS file: /usr/local/cvsroot/lams_tool_lamc/web/includes/Attic/tablayout.jsp,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ lams_tool_lamc/web/includes/tablayout.jsp 2 Oct 2006 01:59:55 -0000 1.1 @@ -0,0 +1,31 @@ + + +<%@ include file="/common/taglibs.jsp"%> +<%@ taglib uri="tags-tiles" prefix="tiles"%> + + + + <bean:message key="activity.title" /> + <%@ include file="/common/header.jsp"%> + + + + + +
+ + + + +

+ +

+
+ + + + +
+ + Index: lams_tool_lamc/web/includes/taglibs.jsp =================================================================== RCS file: /usr/local/cvsroot/lams_tool_lamc/web/includes/Attic/taglibs.jsp,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ lams_tool_lamc/web/includes/taglibs.jsp 2 Oct 2006 01:59:55 -0000 1.1 @@ -0,0 +1,10 @@ +<%@ page language="java" pageEncoding="UTF-8" contentType="text/html;charset=utf-8" %> +<%@ taglib uri="tags-bean" prefix="bean" %> +<%@ taglib uri="tags-logic" prefix="logic" %> +<%@ taglib uri="tags-tiles" prefix="tiles" %> +<%@ taglib uri="tags-html" prefix="html" %> +<%@ taglib uri="tags-core" prefix="c"%> +<%@ taglib uri="tags-fmt" prefix="fmt"%> +<%@ taglib uri="tags-lams" prefix="lams" %> +<%@ taglib uri="fck-editor" prefix="fck"%> + Fisheye: Tag 1.2 refers to a dead (removed) revision in file `lams_tool_lamc/web/includes/css/rsrc.css'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.2 refers to a dead (removed) revision in file `lams_tool_lamc/web/includes/javascript/fckcontroller.js'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.2 refers to a dead (removed) revision in file `lams_tool_lamc/web/includes/javascript/tabcontroller.js'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.2 refers to a dead (removed) revision in file `lams_tool_lamc/web/includes/javascript/tree.js'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.2 refers to a dead (removed) revision in file `lams_tool_lamc/web/includes/javascript/tree_tpl.js'. Fisheye: No comparison available. Pass `N' to diff? Index: lams_tool_lamc/web/learning/CombinedAnswersContent.jsp =================================================================== RCS file: /usr/local/cvsroot/lams_tool_lamc/web/learning/CombinedAnswersContent.jsp,v diff -u -r1.15 -r1.16 --- lams_tool_lamc/web/learning/CombinedAnswersContent.jsp 17 Sep 2006 06:23:44 -0000 1.15 +++ lams_tool_lamc/web/learning/CombinedAnswersContent.jsp 2 Oct 2006 01:59:55 -0000 1.16 @@ -18,14 +18,7 @@ http://www.gnu.org/licenses/gpl.txt --%> -<%@ taglib uri="tags-bean" prefix="bean"%> -<%@ taglib uri="tags-html" prefix="html"%> -<%@ taglib uri="tags-logic" prefix="logic" %> -<%@ taglib uri="tags-logic-el" prefix="logic-el" %> -<%@ taglib uri="tags-core" prefix="c"%> -<%@ taglib uri="tags-fmt" prefix="fmt" %> -<%@ taglib uri="fck-editor" prefix="FCK" %> -<%@ taglib uri="tags-lams" prefix="lams" %> +<%@ include file="/common/taglibs.jsp"%> @@ -64,8 +57,8 @@ - ( - ) + ( ) + @@ -76,8 +69,8 @@ -  [ : - ] +  [ + ] Index: lams_tool_lamc/web/learning/SingleQuestionAnswersContent.jsp =================================================================== RCS file: /usr/local/cvsroot/lams_tool_lamc/web/learning/SingleQuestionAnswersContent.jsp,v diff -u -r1.13 -r1.14 --- lams_tool_lamc/web/learning/SingleQuestionAnswersContent.jsp 17 Sep 2006 06:23:44 -0000 1.13 +++ lams_tool_lamc/web/learning/SingleQuestionAnswersContent.jsp 2 Oct 2006 01:59:55 -0000 1.14 @@ -18,14 +18,7 @@ http://www.gnu.org/licenses/gpl.txt --%> -<%@ taglib uri="tags-bean" prefix="bean"%> -<%@ taglib uri="tags-html" prefix="html"%> -<%@ taglib uri="tags-logic" prefix="logic" %> -<%@ taglib uri="tags-logic-el" prefix="logic-el" %> -<%@ taglib uri="tags-core" prefix="c"%> -<%@ taglib uri="tags-fmt" prefix="fmt" %> -<%@ taglib uri="fck-editor" prefix="FCK" %> -<%@ taglib uri="tags-lams" prefix="lams" %> +<%@ include file="/common/taglibs.jsp"%> @@ -64,8 +57,8 @@ - ( - ) + ( ) + @@ -80,8 +73,8 @@ -  [ : - ] +  [ + ] Index: lams_tool_lamc/web/monitoring/AllSessionsSummary.jsp =================================================================== RCS file: /usr/local/cvsroot/lams_tool_lamc/web/monitoring/Attic/AllSessionsSummary.jsp,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ lams_tool_lamc/web/monitoring/AllSessionsSummary.jsp 2 Oct 2006 01:59:34 -0000 1.1 @@ -0,0 +1,112 @@ +<%-- +Copyright (C) 2005 LAMS Foundation (http://lamsfoundation.org) +License Information: http://lamsfoundation.org/licensing/lams/2.0/ + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License version 2 as + published by the Free Software Foundation. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + + http://www.gnu.org/licenses/gpl.txt +--%> +<%@ include file="/common/taglibs.jsp"%> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
: +
+   ( ) +
+ + + + + +
+ + + + + +

+ + \ No newline at end of file Index: lams_tool_lamc/web/monitoring/Edit.jsp =================================================================== RCS file: /usr/local/cvsroot/lams_tool_lamc/web/monitoring/Edit.jsp,v diff -u -r1.7 -r1.8 --- lams_tool_lamc/web/monitoring/Edit.jsp 20 Sep 2006 00:52:49 -0000 1.7 +++ lams_tool_lamc/web/monitoring/Edit.jsp 2 Oct 2006 01:59:34 -0000 1.8 @@ -1,9 +1,9 @@ -<%-- +<%-- Copyright (C) 2005 LAMS Foundation (http://lamsfoundation.org) License Information: http://lamsfoundation.org/licensing/lams/2.0/ This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License version 2 as + it under the terms of the GNU General Public License version 2 as published by the Free Software Foundation. This program is distributed in the hope that it will be useful, @@ -13,28 +13,35 @@ You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software - Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 + USA http://www.gnu.org/licenses/gpl.txt --%> + + <%@ include file="/common/taglibs.jsp"%> -<%@ include file="/common/taglibs.jsp"%> + + - - + <%@ include file="/common/messages.jsp"%> + + + + + + + + + - - - - - - - - - - - -
- -
-
+ + + +
+ +
+
+ + + Index: lams_tool_lamc/web/monitoring/IndividualSessionSummary.jsp =================================================================== RCS file: /usr/local/cvsroot/lams_tool_lamc/web/monitoring/Attic/IndividualSessionSummary.jsp,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ lams_tool_lamc/web/monitoring/IndividualSessionSummary.jsp 2 Oct 2006 01:59:34 -0000 1.1 @@ -0,0 +1,116 @@ +<%-- +Copyright (C) 2005 LAMS Foundation (http://lamsfoundation.org) +License Information: http://lamsfoundation.org/licensing/lams/2.0/ + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License version 2 as + published by the Free Software Foundation. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + + http://www.gnu.org/licenses/gpl.txt +--%> + +<%@ include file="/common/taglibs.jsp"%> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
: +
+   ( + ) +
+ + + + + +
+ + + + + +
+ + + \ No newline at end of file Index: lams_tool_lamc/web/monitoring/Instructions.jsp =================================================================== RCS file: /usr/local/cvsroot/lams_tool_lamc/web/monitoring/Attic/Instructions.jsp,v diff -u -r1.15 -r1.16 --- lams_tool_lamc/web/monitoring/Instructions.jsp 20 Sep 2006 00:52:49 -0000 1.15 +++ lams_tool_lamc/web/monitoring/Instructions.jsp 2 Oct 2006 01:59:34 -0000 1.16 @@ -18,92 +18,119 @@ http://www.gnu.org/licenses/gpl.txt --%> - <%@ include file="/common/taglibs.jsp"%> - - - - +
+ - + + - + +
- - + +
- - - - - +
- - - - - - - - + + + - - - -
- - - - - - - -
-
+ + + +
+ + + + + /download/?uuid=&preferDownload=false + /download/?uuid=&preferDownload=true + + + + + + + + +
+ + + + +
+ '/>")' class="button"> + + +    + + + +
+
+
+ +
+ - - - + + - - - - - - - - - -
- - - - - - - - - - - - - - - -
- + + + + + +
+ + + + + +
+ + + + + /download/?uuid=&preferDownload=false + /download/?uuid=&preferDownload=true + + + + + + + + +
+ + + + +
+ '/>")' class="button"> + + +    + + + +
+
+
+ +
+ - - - - Index: lams_tool_lamc/web/monitoring/LearnerRep.jsp =================================================================== RCS file: /usr/local/cvsroot/lams_tool_lamc/web/monitoring/Attic/LearnerRep.jsp,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ lams_tool_lamc/web/monitoring/LearnerRep.jsp 2 Oct 2006 01:59:34 -0000 1.1 @@ -0,0 +1,27 @@ +<%-- +Copyright (C) 2005 LAMS Foundation (http://lamsfoundation.org) +License Information: http://lamsfoundation.org/licensing/lams/2.0/ + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License version 2 as + published by the Free Software Foundation. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 + USA + + http://www.gnu.org/licenses/gpl.txt +--%> + + + +<%@ include file="/common/taglibs.jsp"%> + +mc learner rep \ No newline at end of file Index: lams_tool_lamc/web/monitoring/Reflections.jsp =================================================================== RCS file: /usr/local/cvsroot/lams_tool_lamc/web/monitoring/Reflections.jsp,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ lams_tool_lamc/web/monitoring/Reflections.jsp 2 Oct 2006 01:59:34 -0000 1.1 @@ -0,0 +1,61 @@ +<%-- +Copyright (C) 2005 LAMS Foundation (http://lamsfoundation.org) +License Information: http://lamsfoundation.org/licensing/lams/2.0/ + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License version 2 as + published by the Free Software Foundation. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + + http://www.gnu.org/licenses/gpl.txt +--%> + +<%@ include file="/common/taglibs.jsp"%> + + + + + + + + + + + + + + + + + + + + +
+ +
+ + + + + + + + + + + + + + + +
+
Index: lams_tool_lamc/web/monitoring/Stats.jsp =================================================================== RCS file: /usr/local/cvsroot/lams_tool_lamc/web/monitoring/Stats.jsp,v diff -u -r1.19 -r1.20 --- lams_tool_lamc/web/monitoring/Stats.jsp 20 Sep 2006 00:52:49 -0000 1.19 +++ lams_tool_lamc/web/monitoring/Stats.jsp 2 Oct 2006 01:59:34 -0000 1.20 @@ -1,9 +1,9 @@ -<%-- +<%-- Copyright (C) 2005 LAMS Foundation (http://lamsfoundation.org) License Information: http://lamsfoundation.org/licensing/lams/2.0/ This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License version 2 as + it under the terms of the GNU General Public License version 2 as published by the Free Software Foundation. This program is distributed in the hope that it will be useful, @@ -13,7 +13,8 @@ You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software - Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 + USA http://www.gnu.org/licenses/gpl.txt --%> @@ -23,22 +24,22 @@ - +
-
- + + - +
- + - +
Fisheye: Tag 1.14 refers to a dead (removed) revision in file `lams_tool_lamc/web/monitoring/Summary.jsp'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.8 refers to a dead (removed) revision in file `lams_tool_lamc/web/monitoring/SummaryAllSessions.jsp'. Fisheye: No comparison available. Pass `N' to diff? Index: lams_tool_lamc/web/monitoring/SummaryContent.jsp =================================================================== RCS file: /usr/local/cvsroot/lams_tool_lamc/web/monitoring/SummaryContent.jsp,v diff -u -r1.19 -r1.20 --- lams_tool_lamc/web/monitoring/SummaryContent.jsp 20 Sep 2006 00:52:49 -0000 1.19 +++ lams_tool_lamc/web/monitoring/SummaryContent.jsp 2 Oct 2006 01:59:34 -0000 1.20 @@ -1,9 +1,9 @@ -<%-- +<%-- Copyright (C) 2005 LAMS Foundation (http://lamsfoundation.org) License Information: http://lamsfoundation.org/licensing/lams/2.0/ This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License version 2 as + it under the terms of the GNU General Public License version 2 as published by the Free Software Foundation. This program is distributed in the hope that it will be useful, @@ -13,128 +13,124 @@ You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software - Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 + USA http://www.gnu.org/licenses/gpl.txt --%> <%@ include file="/common/taglibs.jsp"%> - - - - + + +
- +
-
+
+ - + + - - + - + + + - - - - - - + + + + +
- + + + +
   
- + : +   ( )
- +
-                  - +         + + + +   () +
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-
+ : +
-
+

- \ No newline at end of file + + + + + + + + +
+ + + + + + + + + + Fisheye: Tag 1.8 refers to a dead (removed) revision in file `lams_tool_lamc/web/monitoring/SummaryIndividualSession.jsp'. Fisheye: No comparison available. Pass `N' to diff? Index: lams_tool_lamc/web/monitoring/UserResponses.jsp =================================================================== RCS file: /usr/local/cvsroot/lams_tool_lamc/web/monitoring/Attic/UserResponses.jsp,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ lams_tool_lamc/web/monitoring/UserResponses.jsp 2 Oct 2006 01:59:34 -0000 1.1 @@ -0,0 +1,28 @@ +<%-- +Copyright (C) 2005 LAMS Foundation (http://lamsfoundation.org) +License Information: http://lamsfoundation.org/licensing/lams/2.0/ + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License version 2 as + published by the Free Software Foundation. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 + USA + + http://www.gnu.org/licenses/gpl.txt +--%> + +<%@ include file="/common/taglibs.jsp"%> + + + + + +mc user responses \ No newline at end of file Index: lams_tool_lamc/web/monitoring/candidateAnswersList.jsp =================================================================== RCS file: /usr/local/cvsroot/lams_tool_lamc/web/monitoring/Attic/candidateAnswersList.jsp,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ lams_tool_lamc/web/monitoring/candidateAnswersList.jsp 2 Oct 2006 01:59:34 -0000 1.1 @@ -0,0 +1,124 @@ +<%-- +Copyright (C) 2005 LAMS Foundation (http://lamsfoundation.org) +License Information: http://lamsfoundation.org/licensing/lams/2.0/ + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License version 2 as + published by the Free Software Foundation. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + + http://www.gnu.org/licenses/gpl.txt +--%> + +<%@ include file="/common/taglibs.jsp" %> + + + + + + + + +
+
+ +
+
+ +<%@ include file="/common/messages.jsp"%> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + ', '', 'moveCandidateDown');"> + images/down.gif" border="0"> + + + + + + ', '', 'moveCandidateUp');"> + images/up.gif" border="0"> + + + + + ', '', 'moveCandidateDown');"> + images/down.gif" border="0"> + + + ', '', 'moveCandidateUp');"> + images/up.gif" border="0"> + + + + + + + images/delete.gif" border="0"> + +
Index: lams_tool_lamc/web/monitoring/editQuestionBox.jsp =================================================================== RCS file: /usr/local/cvsroot/lams_tool_lamc/web/monitoring/Attic/editQuestionBox.jsp,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ lams_tool_lamc/web/monitoring/editQuestionBox.jsp 2 Oct 2006 01:59:34 -0000 1.1 @@ -0,0 +1,170 @@ +<%-- +Copyright (C) 2005 LAMS Foundation (http://lamsfoundation.org) +License Information: http://lamsfoundation.org/licensing/lams/2.0/ + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License version 2 as + published by the Free Software Foundation. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + + http://www.gnu.org/licenses/gpl.txt +--%> + + + +<%@ include file="/common/taglibs.jsp"%> + + + <%@ include file="/common/header.jsp"%> + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+
+ +
+ + +
+ <%@ include file="/monitoring/candidateAnswersList.jsp"%> +
+ + + +
+ + + + + + + +
+
+ +
+ +
+ + + + + + +
                     + + + + + + + +
+
+
+ + + Index: lams_tool_lamc/web/monitoring/itemlist.jsp =================================================================== RCS file: /usr/local/cvsroot/lams_tool_lamc/web/monitoring/Attic/itemlist.jsp,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ lams_tool_lamc/web/monitoring/itemlist.jsp 2 Oct 2006 01:59:34 -0000 1.1 @@ -0,0 +1,104 @@ +<%-- +Copyright (C) 2005 LAMS Foundation (http://lamsfoundation.org) +License Information: http://lamsfoundation.org/licensing/lams/2.0/ + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License version 2 as + published by the Free Software Foundation. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + + http://www.gnu.org/licenses/gpl.txt +--%> + +<%@ include file="/common/taglibs.jsp" %> + + +<%-- This script will works when a new resoruce item submit in order to refresh "Resource List" panel. --%> + + Index: lams_tool_lamc/web/monitoring/newQuestionBox.jsp =================================================================== RCS file: /usr/local/cvsroot/lams_tool_lamc/web/monitoring/Attic/newQuestionBox.jsp,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ lams_tool_lamc/web/monitoring/newQuestionBox.jsp 2 Oct 2006 01:59:34 -0000 1.1 @@ -0,0 +1,139 @@ + <%-- +Copyright (C) 2005 LAMS Foundation (http://lamsfoundation.org) +License Information: http://lamsfoundation.org/licensing/lams/2.0/ + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License version 2 as + published by the Free Software Foundation. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + + http://www.gnu.org/licenses/gpl.txt +--%> + + + +<%@ include file="/common/taglibs.jsp"%> + + + <%@ include file="/common/header.jsp"%> + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
+
+ +
+ +
+ + + + + + + +
+
+ +
+ +
+ + + + + + +
                     + + + + + + + +
+
+
+ + +