Index: lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/McUtils.java =================================================================== diff -u -r9db7a5bb39fecf9a0f1ae5cf2a9f701d2aa1532f -r4d139bddc3cdd41d32d9f3033f2100c711d8c0c5 --- lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/McUtils.java (.../McUtils.java) (revision 9db7a5bb39fecf9a0f1ae5cf2a9f701d2aa1532f) +++ lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/McUtils.java (.../McUtils.java) (revision 4d139bddc3cdd41d32d9f3033f2100c711d8c0c5) @@ -181,34 +181,7 @@ /** * - * @param request - * @param defaultMcContent - * @param mcGeneralAuthoringDTO */ - public static void populateAuthoringDTO(HttpServletRequest request, McContent defaultMcContent, - McGeneralAuthoringDTO mcGeneralAuthoringDTO) { - mcGeneralAuthoringDTO.setActivityTitle(defaultMcContent.getTitle()); - mcGeneralAuthoringDTO.setActivityInstructions(defaultMcContent.getInstructions()); - } - - /** - * @param request - * @param value - * @param toolContentID - */ - public static void setDefineLater(HttpServletRequest request, boolean value, String strToolContentID, - IMcService mcService) { - - McContent mcContent = mcService.getMcContent(new Long(strToolContentID)); - if (mcContent != null) { - mcContent.setDefineLater(value); - mcService.updateMc(mcContent); - } - } - - /** - * - */ public static void setFormProperties(HttpServletRequest request, McAuthoringForm mcAuthoringForm, McGeneralAuthoringDTO mcGeneralAuthoringDTO, String strToolContentID, String httpSessionID) { Index: lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/dao/IMcContentDAO.java =================================================================== diff -u -r9db7a5bb39fecf9a0f1ae5cf2a9f701d2aa1532f -r4d139bddc3cdd41d32d9f3033f2100c711d8c0c5 --- lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/dao/IMcContentDAO.java (.../IMcContentDAO.java) (revision 9db7a5bb39fecf9a0f1ae5cf2a9f701d2aa1532f) +++ lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/dao/IMcContentDAO.java (.../IMcContentDAO.java) (revision 4d139bddc3cdd41d32d9f3033f2100c711d8c0c5) @@ -81,16 +81,6 @@ /** *

- * Delete the given instance of McContent - *

- * - * @param mcContent - * The instance of McContent to delete. - */ - public void removeMc(McContent mcContent); - - /** - *

* Delete the given instance of McContent with the given tool content id mcContentId * * @param mcContentId Index: lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/dao/IMcOptionsContentDAO.java =================================================================== diff -u -r9db7a5bb39fecf9a0f1ae5cf2a9f701d2aa1532f -r4d139bddc3cdd41d32d9f3033f2100c711d8c0c5 --- lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/dao/IMcOptionsContentDAO.java (.../IMcOptionsContentDAO.java) (revision 9db7a5bb39fecf9a0f1ae5cf2a9f701d2aa1532f) +++ lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/dao/IMcOptionsContentDAO.java (.../IMcOptionsContentDAO.java) (revision 4d139bddc3cdd41d32d9f3033f2100c711d8c0c5) @@ -33,17 +33,6 @@ * @author Ozgur Demirtas */ public interface IMcOptionsContentDAO { - /** - * * - *

- * Return the persistent instance of a McOptsContent with the given identifier uid, returns null if not - * found. - *

- * - * @param uid - * @return McOptsContent - */ - McOptsContent getMcOptionsContentByUID(Long uid); /** *

@@ -56,55 +45,14 @@ */ List findMcOptionsContentByQueId(Long mcQueContentId); - /** - *

- * Return the persistent instance of a McOptsContent with the given identifiers option, - * mcQueContentUid returns null if not found. - *

- * - * @param option - * @param mcQueContentUid - * @return McOptsContent - */ - McOptsContent getOptionContentByOptionText(final String option, final Long mcQueContentUid); - - List findMcOptionCorrectByQueId(Long mcQueContentId); - List getOptionDtos(Long mcQueContentId); /** *

- * saves McOptsContent - *

- * - * @param mcOptionsContent - */ - void saveMcOptionsContent(McOptsContent mcOptionsContent); - - /** - *

* updates McOptsContent *

* * @param mcOptionsContent */ void updateMcOptionsContent(McOptsContent mcOptionsContent); - - /** - *

- * removes McOptsContent - *

- * - * @param mcOptionsContent - */ - void removeMcOptionsContentByUID(Long uid); - - /** - *

- * removes McOptsContent - *

- * - * @param mcOptionsContent - */ - void removeMcOptionsContent(McOptsContent mcOptsContent); } Index: lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/dao/IMcQueContentDAO.java =================================================================== diff -u -r9db7a5bb39fecf9a0f1ae5cf2a9f701d2aa1532f -r4d139bddc3cdd41d32d9f3033f2100c711d8c0c5 --- lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/dao/IMcQueContentDAO.java (.../IMcQueContentDAO.java) (revision 9db7a5bb39fecf9a0f1ae5cf2a9f701d2aa1532f) +++ lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/dao/IMcQueContentDAO.java (.../IMcQueContentDAO.java) (revision 4d139bddc3cdd41d32d9f3033f2100c711d8c0c5) @@ -32,32 +32,9 @@ * @author Ozgur Demirtas */ public interface IMcQueContentDAO { - - /** - *

- * Return the persistent instance of a McQueContent with the given identifier uid, returns null if not - * found. - *

- * - * @param uid - * @return McQueContent - */ - McQueContent getMcQueContentByUID(Long uid); /** *

- * Return the persistent instance of a McQueContent with the given identifier question and - * mcContentUid, returns null if not found. - *

- * - * @param question - * @param mcContentUid - * @return McQueContent - */ - McQueContent getQuestionContentByQuestionText(final String question, final Long mcContentUid); - - /** - *

* Return the persistent instance of a McQueContent with the given identifier displayOrder and * mcContentUid, returns null if not found. *

@@ -92,33 +69,6 @@ /** *

- * resets McQueContent with the given identifier mcContentUid - *

- * - * @param mcContentUid - */ - void resetAllQuestions(final Long mcContentUid); - - /** - *

- * removes McQueContent with the given identifier mcContentUid - *

- * - * @param mcContentUid - */ - void removeQuestionContentByMcUid(final Long mcContentUid); - - /** - *

- * saves McQueContent with the given identifier mcQueContent - *

- * - * @param mcQueContent - */ - void saveMcQueContent(McQueContent mcQueContent); - - /** - *

* updates McQueContent with the given identifier mcQueContent *

* @@ -137,15 +87,6 @@ /** *

- * removes McQueContent with the given identifier uid - *

- * - * @param uid - */ - void removeMcQueContentByUID(Long uid); - - /** - *

* removes McQueContent with the given identifier mcQueContent *

* @@ -154,16 +95,6 @@ */ void removeMcQueContent(McQueContent mcQueContent); - /** - *

- * used to get the next available display order with the given identifier mcContentId - *

- * - * @param mcQueContent - * @return - */ - List getNextAvailableDisplayOrder(final long mcContentId); - McQueContent findMcQuestionContentByUid(Long uid); List getAllQuestionEntriesSorted(final long qaContentId); Index: lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/dao/IMcSessionDAO.java =================================================================== diff -u -rc369c0326857e08851d03a29d39d4337091f5253 -r4d139bddc3cdd41d32d9f3033f2100c711d8c0c5 --- lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/dao/IMcSessionDAO.java (.../IMcSessionDAO.java) (revision c369c0326857e08851d03a29d39d4337091f5253) +++ lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/dao/IMcSessionDAO.java (.../IMcSessionDAO.java) (revision 4d139bddc3cdd41d32d9f3033f2100c711d8c0c5) @@ -35,19 +35,6 @@ /** *

- * Return the persistent instance of a McSession with the given identifier uid, returns null if not - * found. - *

- * - * @param uid - * an identifier for the McSession object. - * @return the persistent instance of a McSession or null if not found - */ - - public McSession getMcSessionByUID(Long uid); - - /** - *

* Return the persistent instance of a McSession with the given tool session id mcSessionId, returns * null if not found. *

Index: lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/dao/hibernate/McContentDAO.java =================================================================== diff -u -r9db7a5bb39fecf9a0f1ae5cf2a9f701d2aa1532f -r4d139bddc3cdd41d32d9f3033f2100c711d8c0c5 --- lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/dao/hibernate/McContentDAO.java (.../McContentDAO.java) (revision 9db7a5bb39fecf9a0f1ae5cf2a9f701d2aa1532f) +++ lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/dao/hibernate/McContentDAO.java (.../McContentDAO.java) (revision 4d139bddc3cdd41d32d9f3033f2100c711d8c0c5) @@ -90,10 +90,6 @@ } } - public void removeMc(McContent mcContent) { - this.getHibernateTemplate().delete(mcContent); - } - public void removeMcSessions(McContent mcContent) { this.getHibernateTemplate().deleteAll(mcContent.getMcSessions()); } Index: lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/dao/hibernate/McOptionsContentDAO.java =================================================================== diff -u -r9db7a5bb39fecf9a0f1ae5cf2a9f701d2aa1532f -r4d139bddc3cdd41d32d9f3033f2100c711d8c0c5 --- lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/dao/hibernate/McOptionsContentDAO.java (.../McOptionsContentDAO.java) (revision 9db7a5bb39fecf9a0f1ae5cf2a9f701d2aa1532f) +++ lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/dao/hibernate/McOptionsContentDAO.java (.../McOptionsContentDAO.java) (revision 4d139bddc3cdd41d32d9f3033f2100c711d8c0c5) @@ -43,12 +43,7 @@ private static Logger logger = Logger.getLogger(McOptionsContentDAO.class.getName()); private static final String FIND_OPTIONS_BY_QUESTION_UID = "from mcOptsContent in class McOptsContent where mcOptsContent.mcQueContentId=:mcQueContentUid order by mcOptsContent.displayOrder"; - private static final String FIND_OPTIONS_BY_OPTION_TEXT = "from mcOptsContent in class McOptsContent where mcOptsContent.mcQueOptionText=:option and mcOptsContent.mcQueContentId=:mcQueContentUid"; - public McOptsContent getMcOptionsContentByUID(Long uid) { - return (McOptsContent) this.getHibernateTemplate().get(McOptsContent.class, uid); - } - public List findMcOptionsContentByQueId(Long questionUid) { if (questionUid != null) { List list = getSession().createQuery(FIND_OPTIONS_BY_QUESTION_UID) @@ -75,52 +70,10 @@ return optionDtos; } - public List findMcOptionCorrectByQueId(Long questionUid) { - - List listOptionCorrect = new LinkedList(); - - if (questionUid != null) { - List options = getSession().createQuery(FIND_OPTIONS_BY_QUESTION_UID) - .setLong("mcQueContentUid", questionUid.longValue()).list(); - - if (options != null && options.size() > 0) { - for (McOptsContent option : options) { - listOptionCorrect.add(new Boolean(option.isCorrectOption()).toString()); - } - } - } - return listOptionCorrect; - } - - public McOptsContent getOptionContentByOptionText(final String option, final Long questionUid) { - List list = getSession().createQuery(FIND_OPTIONS_BY_OPTION_TEXT).setString("option", option) - .setLong("mcQueContentUid", questionUid.longValue()).list(); - - if (list != null && list.size() > 0) { - McOptsContent mcq = (McOptsContent) list.get(0); - return mcq; - } - return null; - } - - public void saveMcOptionsContent(McOptsContent mcOptsContent) { - this.getHibernateTemplate().saveOrUpdate(mcOptsContent); - } - public void updateMcOptionsContent(McOptsContent mcOptsContent) { this.getHibernateTemplate().update(mcOptsContent); } - public void removeMcOptionsContentByUID(Long uid) { - McOptsContent mco = (McOptsContent) getHibernateTemplate().get(McOptsContent.class, uid); - this.getHibernateTemplate().delete(mco); - } - - public void removeMcOptionsContent(McOptsContent mcOptsContent) { - this.getSession().setFlushMode(FlushMode.AUTO); - this.getHibernateTemplate().delete(mcOptsContent); - } - public void flush() { this.getHibernateTemplate().flush(); } Index: lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/dao/hibernate/McQueContentDAO.java =================================================================== diff -u -r9db7a5bb39fecf9a0f1ae5cf2a9f701d2aa1532f -r4d139bddc3cdd41d32d9f3033f2100c711d8c0c5 --- lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/dao/hibernate/McQueContentDAO.java (.../McQueContentDAO.java) (revision 9db7a5bb39fecf9a0f1ae5cf2a9f701d2aa1532f) +++ lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/dao/hibernate/McQueContentDAO.java (.../McQueContentDAO.java) (revision 4d139bddc3cdd41d32d9f3033f2100c711d8c0c5) @@ -44,12 +44,8 @@ private static final String REFRESH_QUESTION_CONTENT = "from mcQueContent in class McQueContent where mcQueContent.mcContentId=:mcContentId order by mcQueContent.displayOrder"; - private static final String LOAD_QUESTION_CONTENT_BY_QUESTION_TEXT = "from mcQueContent in class McQueContent where mcQueContent.question=:question and mcQueContent.mcContentId=:mcContentUid"; - private static final String LOAD_QUESTION_CONTENT_BY_DISPLAY_ORDER = "from mcQueContent in class McQueContent where mcQueContent.displayOrder=:displayOrder and mcQueContent.mcContentId=:mcContentUid"; - private static final String GET_NEXT_AVAILABLE_DISPLAY_ORDER = "from mcQueContent in class McQueContent where mcQueContent.mcContentId=:mcContentId"; - private static final String SORT_QUESTION_CONTENT_BY_DISPLAY_ORDER = "from mcQueContent in class McQueContent where mcQueContent.mcContentId=:mcContentId order by mcQueContent.displayOrder"; @Override @@ -67,11 +63,6 @@ } @Override - public McQueContent getMcQueContentByUID(Long uid) { - return (McQueContent) this.getHibernateTemplate().get(McQueContent.class, uid); - } - - @Override public List getQuestionsByContentUid(final long contentUid) { HibernateTemplate templ = this.getHibernateTemplate(); List list = getSession().createQuery(LOAD_QUESTION_CONTENT_BY_CONTENT_ID).setLong("mcContentId", contentUid) @@ -90,19 +81,6 @@ } @Override - public McQueContent getQuestionContentByQuestionText(final String question, final Long mcContentUid) { - HibernateTemplate templ = this.getHibernateTemplate(); - List list = getSession().createQuery(LOAD_QUESTION_CONTENT_BY_QUESTION_TEXT).setString("question", question) - .setLong("mcContentUid", mcContentUid.longValue()).list(); - - if (list != null && list.size() > 0) { - McQueContent mcq = (McQueContent) list.get(0); - return mcq; - } - return null; - } - - @Override public McQueContent getQuestionContentByDisplayOrder(final Long displayOrder, final Long mcContentUid) { HibernateTemplate templ = this.getHibernateTemplate(); List list = getSession().createQuery(LOAD_QUESTION_CONTENT_BY_DISPLAY_ORDER) @@ -117,65 +95,11 @@ } @Override - public void removeQuestionContentByMcUid(final Long mcContentUid) { - HibernateTemplate templ = this.getHibernateTemplate(); - List list = getSession().createQuery(LOAD_QUESTION_CONTENT_BY_CONTENT_ID) - .setLong("mcContentId", mcContentUid.longValue()).list(); - - if (list != null && list.size() > 0) { - Iterator listIterator = list.iterator(); - while (listIterator.hasNext()) { - McQueContent mcQueContent = (McQueContent) listIterator.next(); - this.getSession().setFlushMode(FlushMode.AUTO); - templ.delete(mcQueContent); - templ.flush(); - } - } - } - - @Override - public void resetAllQuestions(final Long mcContentUid) { - HibernateTemplate templ = this.getHibernateTemplate(); - List list = getSession().createQuery(LOAD_QUESTION_CONTENT_BY_CONTENT_ID) - .setLong("mcContentId", mcContentUid.longValue()).list(); - - if (list != null && list.size() > 0) { - Iterator listIterator = list.iterator(); - while (listIterator.hasNext()) { - McQueContent mcQueContent = (McQueContent) listIterator.next(); - this.getSession().setFlushMode(FlushMode.AUTO); - templ.update(mcQueContent); - } - } - } - - @Override - public List getNextAvailableDisplayOrder(final long mcContentId) { - HibernateTemplate templ = this.getHibernateTemplate(); - List list = getSession().createQuery(GET_NEXT_AVAILABLE_DISPLAY_ORDER).setLong("mcContentId", mcContentId) - .list(); - - return list; - } - - @Override - public void saveMcQueContent(McQueContent mcQueContent) { - this.getHibernateTemplate().save(mcQueContent); - } - - @Override public void saveOrUpdateMcQueContent(McQueContent mcQueContent) { this.getHibernateTemplate().saveOrUpdate(mcQueContent); } @Override - public void removeMcQueContentByUID(Long uid) { - McQueContent mcq = (McQueContent) getHibernateTemplate().get(McQueContent.class, uid); - this.getSession().setFlushMode(FlushMode.AUTO); - this.getHibernateTemplate().delete(mcq); - } - - @Override public void updateMcQueContent(McQueContent mcQueContent) { this.getSession().setFlushMode(FlushMode.AUTO); this.getHibernateTemplate().saveOrUpdate(mcQueContent); Index: lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/dao/hibernate/McSessionDAO.java =================================================================== diff -u -rc369c0326857e08851d03a29d39d4337091f5253 -r4d139bddc3cdd41d32d9f3033f2100c711d8c0c5 --- lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/dao/hibernate/McSessionDAO.java (.../McSessionDAO.java) (revision c369c0326857e08851d03a29d39d4337091f5253) +++ lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/dao/hibernate/McSessionDAO.java (.../McSessionDAO.java) (revision 4d139bddc3cdd41d32d9f3033f2100c711d8c0c5) @@ -46,10 +46,6 @@ private static final String LOAD_MCSESSION_BY_MCSESSIONID = "from McSession mcs where mcs.mcSessionId=?"; - public McSession getMcSessionByUID(Long uid) { - return (McSession) this.getHibernateTemplate().get(McSession.class, uid); - } - public McSession getMcSessionById(Long mcSessionId) { List list = getSession().createQuery(LOAD_MCSESSION_BY_MCSESSIONID).setLong(0, mcSessionId.longValue()).list(); Index: lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/mcApplicationContext.xml =================================================================== diff -u -r40eb54374e84591563d8b6a679ac719dbc85c8f7 -r4d139bddc3cdd41d32d9f3033f2100c711d8c0c5 --- lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/mcApplicationContext.xml (.../mcApplicationContext.xml) (revision 40eb54374e84591563d8b6a679ac719dbc85c8f7) +++ lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/mcApplicationContext.xml (.../mcApplicationContext.xml) (revision 4d139bddc3cdd41d32d9f3033f2100c711d8c0c5) @@ -96,6 +96,7 @@ PROPAGATION_REQUIRED,-McApplicationException PROPAGATION_REQUIRED,-McApplicationException PROPAGATION_REQUIRED,-McApplicationException + PROPAGATION_REQUIRED,-McApplicationException PROPAGATION_REQUIRED,-McApplicationException Index: lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/service/IMcService.java =================================================================== diff -u -r40eb54374e84591563d8b6a679ac719dbc85c8f7 -r4d139bddc3cdd41d32d9f3033f2100c711d8c0c5 --- lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/service/IMcService.java (.../IMcService.java) (revision 40eb54374e84591563d8b6a679ac719dbc85c8f7) +++ lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/service/IMcService.java (.../IMcService.java) (revision 4d139bddc3cdd41d32d9f3033f2100c711d8c0c5) @@ -72,16 +72,14 @@ void createMc(McContent mcContent) throws McApplicationException; McContent getMcContent(Long toolContentId) throws McApplicationException; + + void setDefineLater(String strToolContentID, boolean value); - void createQuestion(McQueContent mcQueContent) throws McApplicationException; - void updateQuestion(McQueContent mcQueContent) throws McApplicationException; McQueContent getQuestionByDisplayOrder(final Long displayOrder, final Long mcContentUid) throws McApplicationException; - void createMcSession(McSession mcSession) throws McApplicationException; - McQueUsr createMcUser(Long toolSessionId) throws McApplicationException; McQueUsr getMcUserBySession(final Long queUsrId, final Long mcSessionUid) throws McApplicationException; @@ -92,30 +90,21 @@ void removeMcQueContent(McQueContent mcQueContent) throws McApplicationException; - McQueContent getMcQueContentByUID(Long uid) throws McApplicationException; - void saveOrUpdateMcQueContent(McQueContent mcQueContent) throws McApplicationException; + /** + * persists the questions + */ + McContent createQuestions(List questionDTOs, McContent content); + void releaseQuestionsFromCache(McContent content); - void removeQuestionContentByMcUid(final Long mcContentUid) throws McApplicationException; - - McOptsContent getMcOptionsContentByUID(Long uid) throws McApplicationException; - - void resetAllQuestions(final Long mcContentUid) throws McApplicationException; - List refreshQuestionContent(final Long mcContentId) throws McApplicationException; List getAllQuestionsSorted(final long mcContentId) throws McApplicationException; McQueContent getQuestionByUid(Long uid); - void removeMcOptionsContent(McOptsContent mcOptsContent); - - McQueContent getQuestionByQuestionText(final String question, final Long mcContentUid); - - void removeMcQueContentByUID(Long uid) throws McApplicationException; - McQueUsr getMcUserByUID(Long uid) throws McApplicationException; List getQuestionsByContentUid(final Long mcContentId) throws McApplicationException; @@ -124,38 +113,16 @@ void updateMc(McContent mc) throws McApplicationException; - void updateMcSession(McSession mcSession) throws McApplicationException; - void updateMcQueUsr(McQueUsr mcQueUsr) throws McApplicationException; List getOptionDtos(Long mcQueContentId) throws McApplicationException; - - McSession getMcSessionByUID(Long uid) throws McApplicationException; - + List getFinalizedUserAttempts(final McQueUsr user) throws McApplicationException; - void deleteMc(McContent mc) throws McApplicationException; - - void deleteMcById(Long mcId) throws McApplicationException; - - void deleteMcQueUsr(McQueUsr mcQueUsr) throws McApplicationException; - List findOptionsByQuestionUid(Long mcQueContentId) throws McApplicationException; - void saveOption(McOptsContent mcOptsContent) throws McApplicationException; - - McOptsContent getOptionContentByOptionText(final String option, final Long mcQueContentUid); - void updateMcOptionsContent(McOptsContent mcOptsContent) throws McApplicationException; - void deleteMcOptionsContent(McOptsContent mcOptsContent) throws McApplicationException; - - void deleteMcOptionsContentByUID(Long uid) throws McApplicationException; - - void saveMcContent(McContent mc) throws McApplicationException; - - boolean studentActivityOccurredGlobal(McContent mcContent) throws McApplicationException; - McUsrAttempt getUserAttemptByQuestion(Long queUsrUid, Long mcQueContentId) throws McApplicationException; @@ -181,10 +148,6 @@ long getToolDefaultContentIdBySignature(String toolSignature) throws McApplicationException; - List getNextAvailableDisplayOrder(final long mcContentId) throws McApplicationException; - - List findMcOptionCorrectByQueId(Long mcQueContentId) throws McApplicationException; - Long createNotebookEntry(Long id, Integer idType, String signature, Integer userID, String entry); NotebookEntry getEntry(Long id, Integer idType, String signature, Integer userID); Index: lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/service/McServicePOJO.java =================================================================== diff -u -r40eb54374e84591563d8b6a679ac719dbc85c8f7 -r4d139bddc3cdd41d32d9f3033f2100c711d8c0c5 --- lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/service/McServicePOJO.java (.../McServicePOJO.java) (revision 40eb54374e84591563d8b6a679ac719dbc85c8f7) +++ lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/service/McServicePOJO.java (.../McServicePOJO.java) (revision 4d139bddc3cdd41d32d9f3033f2100c711d8c0c5) @@ -28,6 +28,7 @@ import java.util.Arrays; import java.util.Collections; import java.util.Date; +import java.util.HashSet; import java.util.Hashtable; import java.util.Iterator; import java.util.LinkedList; @@ -39,6 +40,7 @@ import java.util.TreeSet; import java.util.Vector; +import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpSession; import org.apache.commons.lang.StringUtils; @@ -169,7 +171,7 @@ // set group leader mcSession.setGroupLeader(leader); - this.updateMcSession(mcSession); + mcSessionDAO.updateMcSession(mcSession); } } @@ -209,6 +211,7 @@ } } + @Override public void createMc(McContent mcContent) throws McApplicationException { try { mcContentDAO.saveMcContent(mcContent); @@ -217,31 +220,26 @@ } } + @Override public McContent getMcContent(Long toolContentId) throws McApplicationException { try { return mcContentDAO.findMcContentById(toolContentId); } catch (DataAccessException e) { throw new McApplicationException("Exception occured when lams is loading mc content: " + e.getMessage(), e); } } + + @Override + public void setDefineLater(String strToolContentID, boolean value) { - public void updateMcContent(McContent mcContent) throws McApplicationException { - try { - mcContentDAO.updateMcContent(mcContent); - } catch (DataAccessException e) { - throw new McApplicationException("Exception occured when lams is updating mc content: " + e.getMessage(), e); + McContent mcContent = getMcContent(new Long(strToolContentID)); + if (mcContent != null) { + mcContent.setDefineLater(value); + updateMc(mcContent); } } - public void createQuestion(McQueContent mcQueContent) throws McApplicationException { - try { - mcQueContentDAO.saveMcQueContent(mcQueContent); - } catch (DataAccessException e) { - throw new McApplicationException("Exception occured when lams is creating mc que content: " - + e.getMessage(), e); - } - } - + @Override public void updateQuestion(McQueContent mcQueContent) throws McApplicationException { try { mcQueContentDAO.updateMcQueContent(mcQueContent); @@ -252,6 +250,7 @@ } + @Override public McQueContent getQuestionByDisplayOrder(final Long displayOrder, final Long mcContentUid) throws McApplicationException { try { @@ -262,15 +261,7 @@ } } - public McQueContent getMcQueContentByUID(Long uid) throws McApplicationException { - try { - return mcQueContentDAO.getMcQueContentByUID(uid); - } catch (DataAccessException e) { - throw new McApplicationException("Exception occured when lams is getting mc que content by uid: " - + e.getMessage(), e); - } - } - + @Override public List getAllQuestionsSorted(final long mcContentId) throws McApplicationException { try { return mcQueContentDAO.getAllQuestionEntriesSorted(mcContentId); @@ -280,6 +271,7 @@ } } + @Override public void saveOrUpdateMcQueContent(McQueContent mcQueContent) throws McApplicationException { try { mcQueContentDAO.saveOrUpdateMcQueContent(mcQueContent); @@ -290,56 +282,90 @@ } @Override - public void releaseQuestionsFromCache(McContent content) { - for (McQueContent question : (Set)content.getMcQueContents()) { - mcQueContentDAO.releaseQuestionFromCache(question); - } - } + public McContent createQuestions(List questionDTOs, McContent content) { - public void removeQuestionContentByMcUid(final Long mcContentUid) throws McApplicationException { - try { - mcQueContentDAO.removeQuestionContentByMcUid(mcContentUid); - } catch (DataAccessException e) { - throw new McApplicationException( - "Exception occured when lams is removing mc que content by mc content id: " + e.getMessage(), e); - } - } + int displayOrder = 0; + for (McQuestionDTO questionDTO : questionDTOs) { + String currentQuestionText = questionDTO.getQuestion(); - public void resetAllQuestions(final Long mcContentUid) throws McApplicationException { - try { - mcQueContentDAO.resetAllQuestions(mcContentUid); - } catch (DataAccessException e) { - throw new McApplicationException("Exception occured when lams is resetting all questions: " - + e.getMessage(), e); - } - } + // skip empty questions + if (currentQuestionText.isEmpty()) { + continue; + } - public List getNextAvailableDisplayOrder(final long mcContentId) throws McApplicationException { - try { - return mcQueContentDAO.getNextAvailableDisplayOrder(mcContentId); - } catch (DataAccessException e) { - throw new McApplicationException( - "Exception occured when lams is getting the next available display order: " + e.getMessage(), e); - } - } + ++displayOrder; + String currentFeedback = questionDTO.getFeedback(); + String currentMark = questionDTO.getMark(); + /* set the default mark in case it is not provided */ + if (currentMark == null) { + currentMark = "1"; + } - public void createMcSession(McSession mcSession) throws McApplicationException { - try { - mcSessionDAO.saveMcSession(mcSession); - } catch (DataAccessException e) { - throw new McApplicationException("Exception occured when lams is creating mc session: " + e.getMessage(), e); + McQueContent question = getQuestionByUid(questionDTO.getUid()); + + // in case question doesn't exist + if (question == null) { + question = new McQueContent(currentQuestionText, new Integer(displayOrder), new Integer(currentMark), + currentFeedback, content, null, null); + + // adding a new question to content + content.getMcQueContents().add(question); + question.setMcContent(content); + + // in case question exists already + } else { + + question.setQuestion(currentQuestionText); + question.setFeedback(currentFeedback); + question.setDisplayOrder(new Integer(displayOrder)); + question.setMark(new Integer(currentMark)); + } + + // persist candidate answers + List optionDTOs = questionDTO.getListCandidateAnswersDTO(); + Set oldOptions = question.getMcOptionsContents(); + Set newOptions = new HashSet(); + int displayOrderOption = 1; + for (McOptionDTO optionDTO : optionDTOs) { + + Long optionUid = optionDTO.getUid(); + String optionText = optionDTO.getCandidateAnswer(); + boolean isCorrectOption = "Correct".equals(optionDTO.getCorrect()); + + //find persisted option if it exists + McOptsContent option = new McOptsContent(); + for (McOptsContent oldOption: oldOptions) { + if (oldOption.getUid().equals(optionUid)) { + option = oldOption; + } + } + + option.setDisplayOrder(displayOrderOption); + option.setCorrectOption(isCorrectOption); + option.setMcQueOptionText(optionText); + option.setMcQueContent(question); + + newOptions.add(option); + displayOrderOption++; + } + + question.setMcOptionsContents(newOptions); + + // updating the existing question content + updateQuestion(question); + } + return content; } - - public McSession getMcSessionByUID(Long uid) throws McApplicationException { - try { - return mcSessionDAO.getMcSessionByUID(uid); - } catch (DataAccessException e) { - throw new McApplicationException("Exception occured when lams is getting mcSession my uid: " - + e.getMessage(), e); + + @Override + public void releaseQuestionsFromCache(McContent content) { + for (McQueContent question : (Set)content.getMcQueContents()) { + mcQueContentDAO.releaseQuestionFromCache(question); } } + @Override public McQueUsr createMcUser(Long toolSessionID) throws McApplicationException { try { HttpSession ss = SessionManager.getSession(); @@ -358,6 +384,7 @@ } } + @Override public void updateMcQueUsr(McQueUsr mcQueUsr) throws McApplicationException { try { mcUserDAO.updateMcUser(mcQueUsr); @@ -366,6 +393,7 @@ } } + @Override public McQueUsr getMcUserBySession(final Long queUsrId, final Long mcSessionUid) throws McApplicationException { try { return mcUserDAO.getMcUserBySession(queUsrId, mcSessionUid); @@ -374,6 +402,7 @@ } } + @Override public McQueUsr getMcUserByUID(Long uid) throws McApplicationException { try { return mcUserDAO.getMcUserByUID(uid); @@ -433,6 +462,7 @@ } } + @Override public void updateMcUsrAttempt(McUsrAttempt mcUsrAttempt) throws McApplicationException { try { mcUsrAttemptDAO.updateMcUsrAttempt(mcUsrAttempt); @@ -591,6 +621,7 @@ return listMonitoredMarksContainerDTO; } + @Override public List getFinalizedUserAttempts(final McQueUsr user) throws McApplicationException { try { return mcUsrAttemptDAO.getFinalizedUserAttempts(user.getUid()); @@ -601,6 +632,7 @@ } } + @Override public McUsrAttempt getUserAttemptByQuestion(Long queUsrUid, Long mcQueContentId) throws McApplicationException { try { @@ -612,6 +644,7 @@ } } + @Override public List getQuestionsByContentUid(final Long contentUid) throws McApplicationException { try { return mcQueContentDAO.getQuestionsByContentUid(contentUid.longValue()); @@ -621,15 +654,7 @@ } } - public void removeMcQueContentByUID(Long uid) throws McApplicationException { - try { - mcQueContentDAO.removeMcQueContentByUID(uid); - } catch (DataAccessException e) { - throw new McApplicationException("Exception occured when lams is removing by uid mc question content: " - + e.getMessage(), e); - } - } - + @Override public List refreshQuestionContent(final Long mcContentId) throws McApplicationException { try { return mcQueContentDAO.refreshQuestionContent(mcContentId); @@ -640,6 +665,7 @@ } + @Override public void removeMcQueContent(McQueContent mcQueContent) throws McApplicationException { try { mcQueContentDAO.removeMcQueContent(mcQueContent); @@ -649,15 +675,7 @@ } } - public void removeMcOptionsContent(McOptsContent mcOptsContent) throws McApplicationException { - try { - mcOptionsContentDAO.removeMcOptionsContent(mcOptsContent); - } catch (DataAccessException e) { - throw new McApplicationException("Exception occured when lams is removing" + " the mc options content: " - + e.getMessage(), e); - } - } - + @Override public List getOptionDtos(Long mcQueContentId) throws McApplicationException { try { return mcOptionsContentDAO.getOptionDtos(mcQueContentId); @@ -667,15 +685,7 @@ } } - public McQueContent getQuestionByQuestionText(final String question, final Long mcContentId) { - try { - return mcQueContentDAO.getQuestionContentByQuestionText(question, mcContentId); - } catch (DataAccessException e) { - throw new McApplicationException( - "Exception occured when lams is retrieving question content by question text: " + e.getMessage(), e); - } - } - + @Override public McSession getMcSessionById(Long mcSessionId) throws McApplicationException { try { return mcSessionDAO.getMcSessionById(mcSessionId); @@ -685,6 +695,7 @@ } } + @Override public void updateMc(McContent mc) throws McApplicationException { try { mcContentDAO.updateMcContent(mc); @@ -694,61 +705,12 @@ } } - public void updateMcSession(McSession mcSession) throws McApplicationException { - try { - mcSessionDAO.updateMcSession(mcSession); - } catch (DataAccessException e) { - throw new McApplicationException("Exception occured when lams is updating mc session : " + e.getMessage(), - e); - } - } - - public void deleteMc(McContent mc) throws McApplicationException { - try { - mcContentDAO.removeMc(mc); - } catch (DataAccessException e) { - throw new McApplicationException("Exception occured when lams is removing" + " the mc content: " - + e.getMessage(), e); - } - } - - public void deleteMcById(Long mcId) throws McApplicationException { - try { - mcContentDAO.removeMcById(mcId); - } catch (DataAccessException e) { - throw new McApplicationException("Exception occured when lams is removing by id" + " the mc content: " - + e.getMessage(), e); - } - } - - /** - * Return the top, lowest and average mark for all learners for one particular tool session. - * - * @param request - * @return top mark, lowest mark, average mark in that order - */ + @Override public Integer[] getMarkStatistics(McSession mcSession) { return mcUserDAO.getMarkStatisticsForSession(mcSession.getUid()); } - public void deleteMcQueUsr(McQueUsr mcQueUsr) throws McApplicationException { - try { - mcUserDAO.removeMcUser(mcQueUsr); - } catch (DataAccessException e) { - throw new McApplicationException( - "Exception occured when lams is removing" + " the user: " + e.getMessage(), e); - } - } - - public void saveMcContent(McContent mc) throws McApplicationException { - try { - mcContentDAO.saveMcContent(mc); - } catch (DataAccessException e) { - throw new McApplicationException("Exception occured when lams is saving" + " the mc content: " - + e.getMessage(), e); - } - } - + @Override public List findOptionsByQuestionUid(Long mcQueContentId) throws McApplicationException { try { return mcOptionsContentDAO.findMcOptionsContentByQueId(mcQueContentId); @@ -758,15 +720,7 @@ } } - public McOptsContent getMcOptionsContentByUID(Long uid) throws McApplicationException { - try { - return mcOptionsContentDAO.getMcOptionsContentByUID(uid); - } catch (DataAccessException e) { - throw new McApplicationException("Exception occured when lams is getting opt content by uid" - + e.getMessage(), e); - } - } - + @Override public McQueContent getQuestionByUid(Long uid) { if (uid == null) { return null; @@ -775,24 +729,7 @@ return mcQueContentDAO.findMcQuestionContentByUid(uid); } - public void saveOption(McOptsContent mcOptsContent) throws McApplicationException { - try { - mcOptionsContentDAO.saveMcOptionsContent(mcOptsContent); - } catch (DataAccessException e) { - throw new McApplicationException("Exception occured when lams is saving" + " the mc options content: " - + e.getMessage(), e); - } - } - - public McOptsContent getOptionContentByOptionText(final String option, final Long mcQueContentUid) { - try { - return mcOptionsContentDAO.getOptionContentByOptionText(option, mcQueContentUid); - } catch (DataAccessException e) { - throw new McApplicationException("Exception occured when lams is returning the" - + " option by option text: " + e.getMessage(), e); - } - } - + @Override public void updateMcOptionsContent(McOptsContent mcOptsContent) throws McApplicationException { try { mcOptionsContentDAO.updateMcOptionsContent(mcOptsContent); @@ -801,45 +738,6 @@ + e.getMessage(), e); } } - - public List findMcOptionCorrectByQueId(Long mcQueContentId) throws McApplicationException { - try { - return mcOptionsContentDAO.findMcOptionCorrectByQueId(mcQueContentId); - } catch (DataAccessException e) { - throw new McApplicationException("Exception occured when lams is getting correct/incorrect options list" - + " the mc options content: " + e.getMessage(), e); - } - - } - - public void deleteMcOptionsContent(McOptsContent mcOptsContent) throws McApplicationException { - try { - mcOptionsContentDAO.removeMcOptionsContent(mcOptsContent); - } catch (DataAccessException e) { - throw new McApplicationException("Exception occured when lams is removing" + " the mc options content: " - + e.getMessage(), e); - } - } - - public void deleteMcOptionsContentByUID(Long uid) throws McApplicationException { - try { - mcOptionsContentDAO.removeMcOptionsContentByUID(uid); - } catch (DataAccessException e) { - throw new McApplicationException("Exception occured when lams is removing by uid" - + " the mc options content: " + e.getMessage(), e); - } - } - - /** - * checks the parameter content in the user responses table - * - * @param mcContent - * @return boolean - * @throws McApplicationException - */ - public boolean studentActivityOccurredGlobal(McContent mcContent) throws McApplicationException { - return !mcContent.getMcSessions().isEmpty(); - } @Override public void changeUserAttemptMark(Long userAttemptUid, Integer newMark) { @@ -1387,7 +1285,7 @@ throw new DataMissingException("mcContent is missing"); } mcContent.setDefineLater(false); - saveMcContent(mcContent); + mcContentDAO.saveMcContent(mcContent); } @SuppressWarnings("unchecked") Index: lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/web/AuthoringUtil.java =================================================================== diff -u -r9db7a5bb39fecf9a0f1ae5cf2a9f701d2aa1532f -r4d139bddc3cdd41d32d9f3033f2100c711d8c0c5 --- lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/web/AuthoringUtil.java (.../AuthoringUtil.java) (revision 9db7a5bb39fecf9a0f1ae5cf2a9f701d2aa1532f) +++ lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/web/AuthoringUtil.java (.../AuthoringUtil.java) (revision 4d139bddc3cdd41d32d9f3033f2100c711d8c0c5) @@ -503,85 +503,6 @@ return mcContent; } - /** - * persists the questions - */ - public static McContent createQuestions(List questionDTOs, IMcService mcService, McContent content) { - - int displayOrder = 0; - for (McQuestionDTO questionDTO : questionDTOs) { - String currentQuestionText = questionDTO.getQuestion(); - - // skip empty questions - if (currentQuestionText.isEmpty()) { - continue; - } - - ++displayOrder; - String currentFeedback = questionDTO.getFeedback(); - String currentMark = questionDTO.getMark(); - /* set the default mark in case it is not provided */ - if (currentMark == null) { - currentMark = "1"; - } - - McQueContent question = mcService.getQuestionByUid(questionDTO.getUid()); - - // in case question doesn't exist - if (question == null) { - question = new McQueContent(currentQuestionText, new Integer(displayOrder), new Integer(currentMark), - currentFeedback, content, null, null); - - // adding a new question to content - content.getMcQueContents().add(question); - question.setMcContent(content); - - // in case question exists already - } else { - - question.setQuestion(currentQuestionText); - question.setFeedback(currentFeedback); - question.setDisplayOrder(new Integer(displayOrder)); - question.setMark(new Integer(currentMark)); - } - - // persist candidate answers - List optionDTOs = questionDTO.getListCandidateAnswersDTO(); - Set oldOptions = question.getMcOptionsContents(); - Set newOptions = new HashSet(); - int displayOrderOption = 1; - for (McOptionDTO optionDTO : optionDTOs) { - - Long optionUid = optionDTO.getUid(); - String optionText = optionDTO.getCandidateAnswer(); - boolean isCorrectOption = "Correct".equals(optionDTO.getCorrect()); - - //find persisted option if it exists - McOptsContent option = new McOptsContent(); - for (McOptsContent oldOption: oldOptions) { - if (oldOption.getUid().equals(optionUid)) { - option = oldOption; - } - } - - option.setDisplayOrder(displayOrderOption); - option.setCorrectOption(isCorrectOption); - option.setMcQueOptionText(optionText); - option.setMcQueContent(question); - - newOptions.add(option); - displayOrderOption++; - } - - question.setMcOptionsContents(newOptions); - - // updating the existing question content - mcService.updateQuestion(question); - - } - return content; - } - public static Map buildDynamicPassMarkMap(List questionDTOs, boolean initialScreen) { Map map = new TreeMap(new McComparator()); @@ -637,53 +558,9 @@ } /** - * repopulateOptionsBox - */ - public static List repopulateOptionDTOs(HttpServletRequest request, boolean isAddBlankOptions) { - - String correct = request.getParameter("correct"); - - /* check this logic again */ - int intCorrect = 0; - if (correct != null) { - intCorrect = new Integer(correct).intValue(); - } - - List optionDtos = new LinkedList(); - - for (int i = 0; i < McAppConstants.MAX_OPTION_COUNT; i++) { - String optionText = request.getParameter("ca" + i); - Long optionUid = WebUtil.readLongParam(request, "caUid" + i, true); - - String isCorrect = "Incorrect"; - - if (i == intCorrect) { - isCorrect = "Correct"; - } - - if (optionText != null) { - McOptionDTO optionDTO = new McOptionDTO(); - optionDTO.setUid(optionUid); - optionDTO.setCandidateAnswer(optionText); - optionDTO.setCorrect(isCorrect); - optionDtos.add(optionDTO); - } - } - - if (isAddBlankOptions) { - McOptionDTO optionDTO = new McOptionDTO(); - optionDTO.setCandidateAnswer(""); - optionDTO.setCorrect("Incorrect"); - optionDtos.add(optionDTO); - } - - return optionDtos; - } - - /** * generates a list for holding default questions and their candidate answers */ - public static List buildDefaultQuestions(McContent mcContent, IMcService mcService) { + public static List buildDefaultQuestions(McContent mcContent) { List questionDTOs = new LinkedList(); Long mapIndex = new Long(1); Index: lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/web/McAction.java =================================================================== diff -u -r40eb54374e84591563d8b6a679ac719dbc85c8f7 -r4d139bddc3cdd41d32d9f3033f2100c711d8c0c5 --- lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/web/McAction.java (.../McAction.java) (revision 40eb54374e84591563d8b6a679ac719dbc85c8f7) +++ lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/web/McAction.java (.../McAction.java) (revision 4d139bddc3cdd41d32d9f3033f2100c711d8c0c5) @@ -144,7 +144,7 @@ if (mode.isTeacher()) { Set oldQuestions = mcContent.getMcQueContents(); mcService.releaseQuestionsFromCache(mcContent); - McUtils.setDefineLater(request, false, strToolContentID, mcService); + mcService.setDefineLater(strToolContentID, false); // recalculate User Answers mcService.recalculateUserAnswers(mcContent, oldQuestions, questionDTOs, deletedQuestionDTOs); @@ -170,7 +170,7 @@ mcContent = AuthoringUtil.saveOrUpdateMcContent(mcService, request, mcContentTest, strToolContentID); //store questions - mcContent = AuthoringUtil.createQuestions(questionDTOs, mcService, mcContent); + mcContent = mcService.createQuestions(questionDTOs, mcContent); if (mcContent != null) { @@ -253,7 +253,7 @@ String passmark = request.getParameter("passmark"); - List options = AuthoringUtil.repopulateOptionDTOs(request, false); + List options = repopulateOptionDTOs(request, false); options = AuthoringUtil.removeBlankOptions(options); List questionDTOs = (List) sessionMap @@ -583,7 +583,7 @@ String passmark = request.getParameter("passmark"); mcGeneralAuthoringDTO.setPassMarkValue(passmark); - List optionDtos = AuthoringUtil.repopulateOptionDTOs(request, false); + List optionDtos = repopulateOptionDTOs(request, false); optionDtos = AuthoringUtil.removeBlankOptions(optionDtos); if ((newQuestionParam != null) && (newQuestionParam.length() > 0)) { @@ -1132,7 +1132,7 @@ String candidateIndex = request.getParameter("candidateIndex"); request.setAttribute("candidateIndex", candidateIndex); - List optionDtos = AuthoringUtil.repopulateOptionDTOs(request, false); + List optionDtos = repopulateOptionDTOs(request, false); List questionDTOs = (List) sessionMap.get(McAppConstants.LIST_QUESTION_DTOS); @@ -1251,7 +1251,7 @@ String candidateIndex = request.getParameter("candidateIndex"); request.setAttribute("candidateIndex", candidateIndex); - List optionDtos = AuthoringUtil.repopulateOptionDTOs(request, false); + List optionDtos = repopulateOptionDTOs(request, false); List questionDTOs = (List) sessionMap.get(McAppConstants.LIST_QUESTION_DTOS); @@ -1382,7 +1382,7 @@ } //update options - List optionDtos = AuthoringUtil.repopulateOptionDTOs(request, false); + List optionDtos = repopulateOptionDTOs(request, false); List listFinalCandidatesDTO = new LinkedList(); McOptionDTO mcOptionDTO = null; Iterator listCaIterator = optionDtos.iterator(); @@ -1486,7 +1486,7 @@ List questionDTOs = (List) sessionMap.get(McAppConstants.LIST_QUESTION_DTOS); - List optionDtos = AuthoringUtil.repopulateOptionDTOs(request, true); + List optionDtos = repopulateOptionDTOs(request, true); String newQuestion = request.getParameter("newQuestion"); @@ -1658,7 +1658,7 @@ String candidateIndex = request.getParameter("candidateIndex"); request.setAttribute("candidateIndex", candidateIndex); - List optionDtos = AuthoringUtil.repopulateOptionDTOs(request, false); + List optionDtos = repopulateOptionDTOs(request, false); List questionDTOs = (List) sessionMap.get(McAppConstants.LIST_QUESTION_DTOS); @@ -1743,7 +1743,7 @@ String candidateIndex = request.getParameter("candidateIndex"); request.setAttribute("candidateIndex", candidateIndex); - List optionDtos = AuthoringUtil.repopulateOptionDTOs(request, false); + List optionDtos = repopulateOptionDTOs(request, false); List questionDTOs = (List) sessionMap.get(McAppConstants.LIST_QUESTION_DTOS); sessionMap.put(McAppConstants.LIST_QUESTION_DTOS, questionDTOs); @@ -1827,7 +1827,7 @@ // removeAddedCandidate McQuestionDTO newQuestionDTO = (McQuestionDTO) sessionMap.get(McAppConstants.NEW_QUESTION_DTO); - List optionDtos = AuthoringUtil.repopulateOptionDTOs(request, false); + List optionDtos = repopulateOptionDTOs(request, false); List listFinalCandidatesDTO = new LinkedList(); int caIndex = 0; for (McOptionDTO mcOptionDTO : optionDtos) { @@ -1915,7 +1915,7 @@ List questionDTOs = (List) sessionMap.get(McAppConstants.LIST_QUESTION_DTOS); - List optionDtos = AuthoringUtil.repopulateOptionDTOs(request, true); + List optionDtos = repopulateOptionDTOs(request, true); String newQuestion = request.getParameter("newQuestion"); @@ -2012,4 +2012,48 @@ return mode; } + /** + * repopulateOptionsBox + */ + private static List repopulateOptionDTOs(HttpServletRequest request, boolean isAddBlankOptions) { + + String correct = request.getParameter("correct"); + + /* check this logic again */ + int intCorrect = 0; + if (correct != null) { + intCorrect = new Integer(correct).intValue(); + } + + List optionDtos = new LinkedList(); + + for (int i = 0; i < McAppConstants.MAX_OPTION_COUNT; i++) { + String optionText = request.getParameter("ca" + i); + Long optionUid = WebUtil.readLongParam(request, "caUid" + i, true); + + String isCorrect = "Incorrect"; + + if (i == intCorrect) { + isCorrect = "Correct"; + } + + if (optionText != null) { + McOptionDTO optionDTO = new McOptionDTO(); + optionDTO.setUid(optionUid); + optionDTO.setCandidateAnswer(optionText); + optionDTO.setCorrect(isCorrect); + optionDtos.add(optionDTO); + } + } + + if (isAddBlankOptions) { + McOptionDTO optionDTO = new McOptionDTO(); + optionDTO.setCandidateAnswer(""); + optionDTO.setCorrect("Incorrect"); + optionDtos.add(optionDTO); + } + + return optionDtos; + } + } Index: lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/web/McMonitoringAction.java =================================================================== diff -u -r9db7a5bb39fecf9a0f1ae5cf2a9f701d2aa1532f -r4d139bddc3cdd41d32d9f3033f2100c711d8c0c5 --- lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/web/McMonitoringAction.java (.../McMonitoringAction.java) (revision 9db7a5bb39fecf9a0f1ae5cf2a9f701d2aa1532f) +++ lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/web/McMonitoringAction.java (.../McMonitoringAction.java) (revision 4d139bddc3cdd41d32d9f3033f2100c711d8c0c5) @@ -125,7 +125,7 @@ List reflectionsContainerDTO = mcService.getReflectionList(mcContent, null); request.setAttribute(REFLECTIONS_CONTAINER_DTO, reflectionsContainerDTO); - if (mcService.studentActivityOccurredGlobal(mcContent)) { + if (!mcContent.getMcSessions().isEmpty()) { // USER_EXCEPTION_NO_TOOL_SESSIONS is set to false mcGeneralMonitoringDTO.setUserExceptionNoToolSessions(new Boolean(false).toString()); } else { Index: lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/web/McMonitoringStarterAction.java =================================================================== diff -u -r9db7a5bb39fecf9a0f1ae5cf2a9f701d2aa1532f -r4d139bddc3cdd41d32d9f3033f2100c711d8c0c5 --- lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/web/McMonitoringStarterAction.java (.../McMonitoringStarterAction.java) (revision 9db7a5bb39fecf9a0f1ae5cf2a9f701d2aa1532f) +++ lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/web/McMonitoringStarterAction.java (.../McMonitoringStarterAction.java) (revision 4d139bddc3cdd41d32d9f3033f2100c711d8c0c5) @@ -146,7 +146,7 @@ List reflectionsContainerDTO = service.getReflectionList(mcContent, null); request.setAttribute(REFLECTIONS_CONTAINER_DTO, reflectionsContainerDTO); - if (service.studentActivityOccurredGlobal(mcContent)) { + if (!mcContent.getMcSessions().isEmpty()) { // USER_EXCEPTION_NO_TOOL_SESSIONS is set to false mcGeneralMonitoringDTO.setUserExceptionNoToolSessions(new Boolean(false).toString()); } else { Index: lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/web/McPedagogicalPlannerForm.java =================================================================== diff -u -r9db7a5bb39fecf9a0f1ae5cf2a9f701d2aa1532f -r4d139bddc3cdd41d32d9f3033f2100c711d8c0c5 --- lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/web/McPedagogicalPlannerForm.java (.../McPedagogicalPlannerForm.java) (revision 9db7a5bb39fecf9a0f1ae5cf2a9f701d2aa1532f) +++ lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/web/McPedagogicalPlannerForm.java (.../McPedagogicalPlannerForm.java) (revision 4d139bddc3cdd41d32d9f3033f2100c711d8c0c5) @@ -127,7 +127,7 @@ if (mcContent != null) { setToolContentID(mcContent.getMcContentId()); - List questionDtos = AuthoringUtil.buildDefaultQuestions(mcContent, mcService); + List questionDtos = AuthoringUtil.buildDefaultQuestions(mcContent); StringBuilder candidateAnswersBuilder = new StringBuilder(); setCandidateAnswerCount(new ArrayList(questionDtos.size())); Index: lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/web/McStarterAction.java =================================================================== diff -u -r9db7a5bb39fecf9a0f1ae5cf2a9f701d2aa1532f -r4d139bddc3cdd41d32d9f3033f2100c711d8c0c5 --- lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/web/McStarterAction.java (.../McStarterAction.java) (revision 9db7a5bb39fecf9a0f1ae5cf2a9f701d2aa1532f) +++ lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/web/McStarterAction.java (.../McStarterAction.java) (revision 4d139bddc3cdd41d32d9f3033f2100c711d8c0c5) @@ -102,7 +102,7 @@ ToolAccessMode mode = getAccessMode(request); // request is from monitoring module if (mode.isTeacher()) { - McUtils.setDefineLater(request, true, strToolContentID, mcService); + mcService.setDefineLater(strToolContentID, true); } request.setAttribute(AttributeNames.ATTR_MODE, mode.toString()); @@ -132,7 +132,7 @@ prepareDTOandForm(request, mapping, mcAuthoringForm, new Long(strToolContentID).longValue(), mcContent, mcGeneralAuthoringDTO, sessionMap); - List questionDtos = AuthoringUtil.buildDefaultQuestions(mcContent, mcService); + List questionDtos = AuthoringUtil.buildDefaultQuestions(mcContent); request.setAttribute(TOTAL_QUESTION_COUNT, new Integer(questionDtos.size())); request.setAttribute(LIST_QUESTION_DTOS, questionDtos); sessionMap.put(LIST_QUESTION_DTOS, questionDtos); @@ -180,7 +180,8 @@ McAuthoringForm mcAuthoringForm, long toolContentID, McContent mcContent, McGeneralAuthoringDTO mcGeneralAuthoringDTO, SessionMap sessionMap) { - McUtils.populateAuthoringDTO(request, mcContent, mcGeneralAuthoringDTO); + mcGeneralAuthoringDTO.setActivityTitle(mcContent.getTitle()); + mcGeneralAuthoringDTO.setActivityInstructions(mcContent.getInstructions()); mcAuthoringForm.setSln(mcContent.isShowReport() ? "1" : "0"); mcAuthoringForm.setQuestionsSequenced(mcContent.isQuestionsSequenced() ? "1" : "0"); Index: lams_tool_lamc/web/authoring/AuthoringTabsHolder.jsp =================================================================== diff -u -r9db7a5bb39fecf9a0f1ae5cf2a9f701d2aa1532f -r4d139bddc3cdd41d32d9f3033f2100c711d8c0c5 --- lams_tool_lamc/web/authoring/AuthoringTabsHolder.jsp (.../AuthoringTabsHolder.jsp) (revision 9db7a5bb39fecf9a0f1ae5cf2a9f701d2aa1532f) +++ lams_tool_lamc/web/authoring/AuthoringTabsHolder.jsp (.../AuthoringTabsHolder.jsp) (revision 4d139bddc3cdd41d32d9f3033f2100c711d8c0c5) @@ -84,8 +84,6 @@ } - -
@@ -125,6 +123,5 @@
- \ No newline at end of file Index: lams_tool_lamc/web/authoring/BasicContent.jsp =================================================================== diff -u -r9db7a5bb39fecf9a0f1ae5cf2a9f701d2aa1532f -r4d139bddc3cdd41d32d9f3033f2100c711d8c0c5 --- lams_tool_lamc/web/authoring/BasicContent.jsp (.../BasicContent.jsp) (revision 9db7a5bb39fecf9a0f1ae5cf2a9f701d2aa1532f) +++ lams_tool_lamc/web/authoring/BasicContent.jsp (.../BasicContent.jsp) (revision 4d139bddc3cdd41d32d9f3033f2100c711d8c0c5) @@ -64,7 +64,7 @@ form.submit(); } - function exportQTI(){ + function exportQTI() { var frame = document.getElementById("downloadFileDummyIframe"), title = encodeURIComponent(document.getElementsByName("title")[0].value); frame.src = '' Index: lams_tool_lamc/web/authoring/candidateAnswersList.jsp =================================================================== diff -u -r9db7a5bb39fecf9a0f1ae5cf2a9f701d2aa1532f -r4d139bddc3cdd41d32d9f3033f2100c711d8c0c5 --- lams_tool_lamc/web/authoring/candidateAnswersList.jsp (.../candidateAnswersList.jsp) (revision 9db7a5bb39fecf9a0f1ae5cf2a9f701d2aa1532f) +++ lams_tool_lamc/web/authoring/candidateAnswersList.jsp (.../candidateAnswersList.jsp) (revision 4d139bddc3cdd41d32d9f3033f2100c711d8c0c5) @@ -83,18 +83,18 @@ - - - + + + - - - - + + + + - " > + " > - + Index: lams_tool_lamc/web/authoring/newQuestionBox.jsp =================================================================== diff -u -r9db7a5bb39fecf9a0f1ae5cf2a9f701d2aa1532f -r4d139bddc3cdd41d32d9f3033f2100c711d8c0c5 --- lams_tool_lamc/web/authoring/newQuestionBox.jsp (.../newQuestionBox.jsp) (revision 9db7a5bb39fecf9a0f1ae5cf2a9f701d2aa1532f) +++ lams_tool_lamc/web/authoring/newQuestionBox.jsp (.../newQuestionBox.jsp) (revision 4d139bddc3cdd41d32d9f3033f2100c711d8c0c5) @@ -147,8 +147,7 @@
- + @@ -178,22 +177,20 @@
- - - + + +
@@ -203,8 +200,7 @@ - + Index: lams_tool_lamc/web/export/class.jsp =================================================================== diff -u -r7e6ebfd5557305fbb05f12d799297e25c2d02084 -r4d139bddc3cdd41d32d9f3033f2100c711d8c0c5 --- lams_tool_lamc/web/export/class.jsp (.../class.jsp) (revision 7e6ebfd5557305fbb05f12d799297e25c2d02084) +++ lams_tool_lamc/web/export/class.jsp (.../class.jsp) (revision 4d139bddc3cdd41d32d9f3033f2100c711d8c0c5) @@ -1,114 +1,124 @@ <%@ include file="/common/taglibs.jsp"%> - - - - +
- -
+ + + - - - + + - - - - - - - - - + - + - - - + + + -
+ +
 
: -   ( - ) -
- - - - + + + + + + + + + - + +   () + + + + +
- + + +
 
: +   ( + ) +
+ + + + - - -
+ - -   () - -
-
+
- -
+ +
+ - -

- -

-
- +

+ + +

+
+ +
- - - + + + - - - + + + - - - - - - - - + + + + + + + + - - + + - - - + + + - - - + + + - - - + + + - - - + + + - - + - - - - - - - -
: -
: +
-
+ + + +
+ +
- -
+ + - - + + - -
+ +

+ + + + +
+ + + + + + \ No newline at end of file Index: lams_tool_lamc/web/export/exportportfolio.jsp =================================================================== diff -u -rc369c0326857e08851d03a29d39d4337091f5253 -r4d139bddc3cdd41d32d9f3033f2100c711d8c0c5 --- lams_tool_lamc/web/export/exportportfolio.jsp (.../exportportfolio.jsp) (revision c369c0326857e08851d03a29d39d4337091f5253) +++ lams_tool_lamc/web/export/exportportfolio.jsp (.../exportportfolio.jsp) (revision 4d139bddc3cdd41d32d9f3033f2100c711d8c0c5) @@ -1,5 +1,4 @@ - + <%@ include file="/common/taglibs.jsp"%> @@ -18,41 +17,34 @@

- - + +

- - -

+ +

-
- + - - + + - + - + -
+ + - - - - - Index: lams_tool_lamc/web/export/learner.jsp =================================================================== diff -u -rc369c0326857e08851d03a29d39d4337091f5253 -r4d139bddc3cdd41d32d9f3033f2100c711d8c0c5 --- lams_tool_lamc/web/export/learner.jsp (.../learner.jsp) (revision c369c0326857e08851d03a29d39d4337091f5253) +++ lams_tool_lamc/web/export/learner.jsp (.../learner.jsp) (revision 4d139bddc3cdd41d32d9f3033f2100c711d8c0c5) @@ -1,70 +1,72 @@ <%@ include file="/common/taglibs.jsp"%> - +
- - - - - - - - - + - - <%-- only expect one entry for the following two maps as it is one entry per session and then one per user --%> - + + +
 
: -   ( - ) -
- - - - + + + + + + + + + - + +   () + + + + +
- + +
 
+ : +   ( + ) +
+ + + + - - -
+ - -   () - -
-
+
- - - - - - + + <%-- only expect one entry for the following two maps as it is one entry per session and then one per user --%> + - + - + - - - + + + - - - - -
()
+ + + + + + - + - + - +
()
- : -
+ : +
- : -
\ No newline at end of file +
+ : +
\ No newline at end of file Index: lams_tool_lamc/web/export/reflections.jsp =================================================================== diff -u -rf04e5eaf5a3b6bd01c39426e993609857686d936 -r4d139bddc3cdd41d32d9f3033f2100c711d8c0c5 --- lams_tool_lamc/web/export/reflections.jsp (.../reflections.jsp) (revision f04e5eaf5a3b6bd01c39426e993609857686d936) +++ lams_tool_lamc/web/export/reflections.jsp (.../reflections.jsp) (revision 4d139bddc3cdd41d32d9f3033f2100c711d8c0c5) @@ -1,45 +1,45 @@ <%@ include file="/common/taglibs.jsp"%> - +
+ + + + + + + + +
+   +
+ + - - - - - -
-   + +
- - - - - - - - - - - - - - + + + + + + + + + - + - - - -
- -
- : -
+ : + - - + + - -
-
\ No newline at end of file +
+ +
+ + + \ No newline at end of file Index: lams_tool_lamc/web/learning/AnswersContent.jsp =================================================================== diff -u -r816baa75867795676ea15c9dfcc4feef712edc47 -r4d139bddc3cdd41d32d9f3033f2100c711d8c0c5 --- lams_tool_lamc/web/learning/AnswersContent.jsp (.../AnswersContent.jsp) (revision 816baa75867795676ea15c9dfcc4feef712edc47) +++ lams_tool_lamc/web/learning/AnswersContent.jsp (.../AnswersContent.jsp) (revision 4d139bddc3cdd41d32d9f3033f2100c711d8c0c5) @@ -1,5 +1,4 @@ - + <%@ include file="/common/taglibs.jsp"%> @@ -31,47 +30,49 @@ - + + + + @@ -160,5 +161,4 @@ - - + Index: lams_tool_lamc/web/learning/IndividualLearnerResults.jsp =================================================================== diff -u -r816baa75867795676ea15c9dfcc4feef712edc47 -r4d139bddc3cdd41d32d9f3033f2100c711d8c0c5 --- lams_tool_lamc/web/learning/IndividualLearnerResults.jsp (.../IndividualLearnerResults.jsp) (revision 816baa75867795676ea15c9dfcc4feef712edc47) +++ lams_tool_lamc/web/learning/IndividualLearnerResults.jsp (.../IndividualLearnerResults.jsp) (revision 4d139bddc3cdd41d32d9f3033f2100c711d8c0c5) @@ -1,5 +1,4 @@ - + <%@ include file="/common/taglibs.jsp"%> @@ -38,8 +37,7 @@ - + @@ -50,22 +48,18 @@ - - - -

- -

- -
- - -

- -

- -
+ +

+ +

+
+ + +

+ +

+
@@ -78,22 +72,21 @@

- - + - - - - - - - - - - - - + + + + + + + + + + +

@@ -120,24 +113,25 @@ -

- +

+ - - - images/tick.gif" border="0" class="middle"> - - - images/cross.gif" border="0" class="middle"> - + + + images/tick.gif" border="0" class="middle"> -

+ + images/cross.gif" border="0" class="middle"> + + +

- -
- -
-
+ +
+ + +
+
@@ -147,28 +141,26 @@ - - - - + + + + - - - - + + + +
- - - -
+ + + +
- - - -
+ + + +
- - + -

@@ -180,38 +172,11 @@ - -

- - - - - - - - - - - - - - - - - - - - - - - - -
-
- +
Index: lams_tool_lamc/web/learning/Notebook.jsp =================================================================== diff -u -r816baa75867795676ea15c9dfcc4feef712edc47 -r4d139bddc3cdd41d32d9f3033f2100c711d8c0c5 --- lams_tool_lamc/web/learning/Notebook.jsp (.../Notebook.jsp) (revision 816baa75867795676ea15c9dfcc4feef712edc47) +++ lams_tool_lamc/web/learning/Notebook.jsp (.../Notebook.jsp) (revision 4d139bddc3cdd41d32d9f3033f2100c711d8c0c5) @@ -20,8 +20,7 @@ - + @@ -33,39 +32,25 @@ - -

- +
- + onclick="javascript:document.McLearningForm.submit();return false"> +
-
- - - - - - - - - - Index: lams_tool_lamc/web/learning/SimpleLearnerError.jsp =================================================================== diff -u -rc369c0326857e08851d03a29d39d4337091f5253 -r4d139bddc3cdd41d32d9f3033f2100c711d8c0c5 --- lams_tool_lamc/web/learning/SimpleLearnerError.jsp (.../SimpleLearnerError.jsp) (revision c369c0326857e08851d03a29d39d4337091f5253) +++ lams_tool_lamc/web/learning/SimpleLearnerError.jsp (.../SimpleLearnerError.jsp) (revision 4d139bddc3cdd41d32d9f3033f2100c711d8c0c5) @@ -26,12 +26,4 @@ - - - - - - - - - + \ No newline at end of file Index: lams_tool_lamc/web/learning/SingleQuestionAnswersContent.jsp =================================================================== diff -u -r6c5d0c6b8ff17d661580df2c265f2dcabfe7d76c -r4d139bddc3cdd41d32d9f3033f2100c711d8c0c5 --- lams_tool_lamc/web/learning/SingleQuestionAnswersContent.jsp (.../SingleQuestionAnswersContent.jsp) (revision 6c5d0c6b8ff17d661580df2c265f2dcabfe7d76c) +++ lams_tool_lamc/web/learning/SingleQuestionAnswersContent.jsp (.../SingleQuestionAnswersContent.jsp) (revision 4d139bddc3cdd41d32d9f3033f2100c711d8c0c5) @@ -33,6 +33,7 @@ +
Index: lams_tool_lamc/web/learning/ViewAnswers.jsp =================================================================== diff -u -r816baa75867795676ea15c9dfcc4feef712edc47 -r4d139bddc3cdd41d32d9f3033f2100c711d8c0c5 --- lams_tool_lamc/web/learning/ViewAnswers.jsp (.../ViewAnswers.jsp) (revision 816baa75867795676ea15c9dfcc4feef712edc47) +++ lams_tool_lamc/web/learning/ViewAnswers.jsp (.../ViewAnswers.jsp) (revision 4d139bddc3cdd41d32d9f3033f2100c711d8c0c5) @@ -1,5 +1,4 @@ - + <%@ include file="/common/taglibs.jsp"%> @@ -27,10 +26,11 @@ elem.disabled = true; } } - function submitForm(methodName){ - var f = document.getElementById('Form1'); - f.submit(); - } + + function submitForm(methodName) { + var f = document.getElementById('Form1'); + f.submit(); + } @@ -49,8 +49,7 @@ - + @@ -73,8 +72,7 @@ - +
@@ -83,23 +81,21 @@ ${status.count}) -
+
- - + -
    - -
  • - -
  • -
    -
+
    + +
  • + +
  • +
    +

@@ -111,14 +107,16 @@ + images/tick.gif" border="0" class="middle"> images/cross.gif" border="0" class="middle"> - + + @@ -127,47 +125,46 @@ - - - -

- -
-
+ + + +
+ +
+
- - + -

- -

+

+ +

- - - - - +
- - - -
+ + + + - - + + - -
+ + + +
- -
+ + - +
-
+ + + @@ -225,7 +222,7 @@

- +

Index: lams_tool_lamc/web/learning/mobile/AnswersContent.jsp =================================================================== diff -u -r344ed95b6b62ebd716c85cd256320cd723a18a13 -r4d139bddc3cdd41d32d9f3033f2100c711d8c0c5 --- lams_tool_lamc/web/learning/mobile/AnswersContent.jsp (.../AnswersContent.jsp) (revision 344ed95b6b62ebd716c85cd256320cd723a18a13) +++ lams_tool_lamc/web/learning/mobile/AnswersContent.jsp (.../AnswersContent.jsp) (revision 4d139bddc3cdd41d32d9f3033f2100c711d8c0c5) @@ -14,6 +14,7 @@ <fmt:message key="activity.title" /> <%@ include file="/common/mobileheader.jsp"%> + + + + - - + -

@@ -78,16 +76,10 @@

+
+ - - - - - - - - Index: lams_tool_lamc/web/monitoring/Edit.jsp =================================================================== diff -u -r9db7a5bb39fecf9a0f1ae5cf2a9f701d2aa1532f -r4d139bddc3cdd41d32d9f3033f2100c711d8c0c5 --- lams_tool_lamc/web/monitoring/Edit.jsp (.../Edit.jsp) (revision 9db7a5bb39fecf9a0f1ae5cf2a9f701d2aa1532f) +++ lams_tool_lamc/web/monitoring/Edit.jsp (.../Edit.jsp) (revision 4d139bddc3cdd41d32d9f3033f2100c711d8c0c5) @@ -83,10 +83,5 @@ - - - - - + - Index: lams_tool_lamc/web/monitoring/LearnerNotebook.jsp =================================================================== diff -u -r816baa75867795676ea15c9dfcc4feef712edc47 -r4d139bddc3cdd41d32d9f3033f2100c711d8c0c5 --- lams_tool_lamc/web/monitoring/LearnerNotebook.jsp (.../LearnerNotebook.jsp) (revision 816baa75867795676ea15c9dfcc4feef712edc47) +++ lams_tool_lamc/web/monitoring/LearnerNotebook.jsp (.../LearnerNotebook.jsp) (revision 4d139bddc3cdd41d32d9f3033f2100c711d8c0c5) @@ -21,53 +21,44 @@ - -
+

- - - - - - - - -
-

- -

-
-

-
+ + + + + + + + +
+

+ +

+
+

+ +

+
- - - - -
- - -
- + + + + +
+ + + +
-
+
- - - - - - - - - - Index: lams_tool_lamc/web/monitoring/Reflections.jsp =================================================================== diff -u -r24b8afc681eaf7ee41fc7b59aab54cf86140044c -r4d139bddc3cdd41d32d9f3033f2100c711d8c0c5 --- lams_tool_lamc/web/monitoring/Reflections.jsp (.../Reflections.jsp) (revision 24b8afc681eaf7ee41fc7b59aab54cf86140044c) +++ lams_tool_lamc/web/monitoring/Reflections.jsp (.../Reflections.jsp) (revision 4d139bddc3cdd41d32d9f3033f2100c711d8c0c5) @@ -1,41 +1,40 @@ <%@ include file="/common/taglibs.jsp"%> - - + +
- - - + + + - - - - - - - - + + + + + + + + - - - -
- -
+ +
- -
+ + - - - - - - - - + + + + + + + + + - - - - -
-
+ + + + + + + + Index: lams_tool_lamc/web/monitoring/Stats.jsp =================================================================== diff -u -re86557b2e2a6b6dd1c750263f1bacc60fceaabbb -r4d139bddc3cdd41d32d9f3033f2100c711d8c0c5 --- lams_tool_lamc/web/monitoring/Stats.jsp (.../Stats.jsp) (revision e86557b2e2a6b6dd1c750263f1bacc60fceaabbb) +++ lams_tool_lamc/web/monitoring/Stats.jsp (.../Stats.jsp) (revision 4d139bddc3cdd41d32d9f3033f2100c711d8c0c5) @@ -3,24 +3,22 @@ - - - - - +
- - - -
+ + + + - - - - -
+ + + +
- - - -
- - + + + + + + + + + \ No newline at end of file Index: lams_tool_lamc/web/monitoring/parts/advanceOptions.jsp =================================================================== diff -u -r816baa75867795676ea15c9dfcc4feef712edc47 -r4d139bddc3cdd41d32d9f3033f2100c711d8c0c5 --- lams_tool_lamc/web/monitoring/parts/advanceOptions.jsp (.../advanceOptions.jsp) (revision 816baa75867795676ea15c9dfcc4feef712edc47) +++ lams_tool_lamc/web/monitoring/parts/advanceOptions.jsp (.../advanceOptions.jsp) (revision 4d139bddc3cdd41d32d9f3033f2100c711d8c0c5) @@ -165,21 +165,23 @@ - - -

- -

-
- -

-
- + + +

+ +

+
+ +

+ +
+ + - -

-
-
+ +

+ + Index: lams_tool_lamc/web/monitoring/parts/advanceQuestions.jsp =================================================================== diff -u -rd66da54e1b79ff5493ac331ec290649184965a7e -r4d139bddc3cdd41d32d9f3033f2100c711d8c0c5 --- lams_tool_lamc/web/monitoring/parts/advanceQuestions.jsp (.../advanceQuestions.jsp) (revision d66da54e1b79ff5493ac331ec290649184965a7e) +++ lams_tool_lamc/web/monitoring/parts/advanceQuestions.jsp (.../advanceQuestions.jsp) (revision 4d139bddc3cdd41d32d9f3033f2100c711d8c0c5) @@ -8,45 +8,44 @@ \ No newline at end of file Index: lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/dao/IQaQueUsrDAO.java =================================================================== diff -u -ra7661f206a3f21114f1c05f9a29f56e20f5e35f0 -r4d139bddc3cdd41d32d9f3033f2100c711d8c0c5 --- lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/dao/IQaQueUsrDAO.java (.../IQaQueUsrDAO.java) (revision a7661f206a3f21114f1c05f9a29f56e20f5e35f0) +++ lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/dao/IQaQueUsrDAO.java (.../IQaQueUsrDAO.java) (revision 4d139bddc3cdd41d32d9f3033f2100c711d8c0c5) @@ -44,7 +44,5 @@ int countSessionUser(QaSession qaSession); - int getTotalNumberOfUsers(QaContent qa); - List getUserBySessionOnly(final QaSession qaSession); } Index: lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/dao/IQaSessionDAO.java =================================================================== diff -u -ra7661f206a3f21114f1c05f9a29f56e20f5e35f0 -r4d139bddc3cdd41d32d9f3033f2100c711d8c0c5 --- lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/dao/IQaSessionDAO.java (.../IQaSessionDAO.java) (revision a7661f206a3f21114f1c05f9a29f56e20f5e35f0) +++ lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/dao/IQaSessionDAO.java (.../IQaSessionDAO.java) (revision 4d139bddc3cdd41d32d9f3033f2100c711d8c0c5) @@ -33,15 +33,11 @@ */ public interface IQaSessionDAO { - int countSessionComplete(QaContent qa); - QaSession getQaSessionById(long qaSessionId); void createSession(QaSession session); void UpdateQaSession(QaSession session); void deleteQaSession(QaSession session); - - List getSessionsFromContent(QaContent qaContent); } Index: lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/dao/hibernate/QaQueUsrDAO.java =================================================================== diff -u -ra7661f206a3f21114f1c05f9a29f56e20f5e35f0 -r4d139bddc3cdd41d32d9f3033f2100c711d8c0c5 --- lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/dao/hibernate/QaQueUsrDAO.java (.../QaQueUsrDAO.java) (revision a7661f206a3f21114f1c05f9a29f56e20f5e35f0) +++ lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/dao/hibernate/QaQueUsrDAO.java (.../QaQueUsrDAO.java) (revision 4d139bddc3cdd41d32d9f3033f2100c711d8c0c5) @@ -44,9 +44,6 @@ private static final String COUNT_SESSION_USER = "select qaQueUsr.queUsrId from QaQueUsr qaQueUsr where qaQueUsr.qaSession.qaSessionId= :qaSession"; private static final String LOAD_USER_FOR_SESSION = "from qaQueUsr in class QaQueUsr where qaQueUsr.qaSession.qaSessionId= :qaSessionId"; - private static final String GET_USER_COUNT_FOR_CONTENT = "select count(*) from QaQueUsr quser, QaSession qses, QaQueContent qcon where " - + "quser.qaSession=qses and " + "qses.qaContent=qcon and " + "qcon.uid=:uid"; - public int countSessionUser(QaSession qaSession) { return (getHibernateTemplate().findByNamedParam(COUNT_SESSION_USER, "qaSession", qaSession)).size(); } @@ -87,17 +84,4 @@ this.getHibernateTemplate().delete(qaQueUsr); } - public int getTotalNumberOfUsers(QaContent qa) { - - int returnInt = 0; - if (qa != null && qa.getUid() != null) { - List result = getSession().createQuery(GET_USER_COUNT_FOR_CONTENT).setLong("uid", qa.getUid()).list(); - Long resultLong = (result.get(0) != null) ? (Long) result.get(0) : new Long(0); - returnInt = resultLong.intValue(); - } else { - logger.error("Attempt to count users from null content"); - } - return returnInt; - } - } \ No newline at end of file Index: lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/dao/hibernate/QaSessionDAO.java =================================================================== diff -u -ra7661f206a3f21114f1c05f9a29f56e20f5e35f0 -r4d139bddc3cdd41d32d9f3033f2100c711d8c0c5 --- lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/dao/hibernate/QaSessionDAO.java (.../QaSessionDAO.java) (revision a7661f206a3f21114f1c05f9a29f56e20f5e35f0) +++ lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/dao/hibernate/QaSessionDAO.java (.../QaSessionDAO.java) (revision 4d139bddc3cdd41d32d9f3033f2100c711d8c0c5) @@ -36,22 +36,7 @@ * */ public class QaSessionDAO extends HibernateDaoSupport implements IQaSessionDAO { - private static final String COUNT_SESSION_COMPLETE = "from qaSession in class QaSession where qaSession.session_status='COMPLETE'"; - private static final String GET_SESSION_IDS_FROM_CONTENT = "select qas.qaSessionId from QaSession qas where qas.qaContent=:qaContent order by qas.session_name asc"; - public int countSessionComplete(QaContent qa) { - List list = getSession().createQuery(COUNT_SESSION_COMPLETE).list(); - - int sessionCount = 0; - if (list != null && list.size() > 0) { - QaSession qaSession = (QaSession) list.get(0); - if (qaSession.getQaContent().getUid().intValue() == qa.getUid().intValue()) { - ++sessionCount; - } - } - return sessionCount; - } - /** * @see org.lamsfoundation.lams.tool.survey.dao.interfaces.ISurveySessionDAO#getSurveySessionById(long) */ @@ -90,8 +75,4 @@ this.getHibernateTemplate().delete(qaSession); } - public List getSessionsFromContent(QaContent qaContent) { - return (getHibernateTemplate().findByNamedParam(GET_SESSION_IDS_FROM_CONTENT, "qaContent", qaContent)); - } - } Index: lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/qaApplicationContext.xml =================================================================== diff -u -r3ff38201dcc90ccdf402ac3ba094b0c05fd32d05 -r4d139bddc3cdd41d32d9f3033f2100c711d8c0c5 --- lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/qaApplicationContext.xml (.../qaApplicationContext.xml) (revision 3ff38201dcc90ccdf402ac3ba094b0c05fd32d05) +++ lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/qaApplicationContext.xml (.../qaApplicationContext.xml) (revision 4d139bddc3cdd41d32d9f3033f2100c711d8c0c5) @@ -102,6 +102,7 @@ PROPAGATION_REQUIRED, -QaApplicationException PROPAGATION_REQUIRED,-QaApplicationException PROPAGATION_REQUIRED,-QaApplicationException + PROPAGATION_REQUIRED,-QaApplicationException PROPAGATION_REQUIRED,-QaApplicationException PROPAGATION_REQUIRED,-QaApplicationException PROPAGATION_REQUIRED,-QaApplicationException Index: lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/service/IQaService.java =================================================================== diff -u -r7d0d609b844ea5e9c41f46d209825ce5bd4fb83a -r4d139bddc3cdd41d32d9f3033f2100c711d8c0c5 --- lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/service/IQaService.java (.../IQaService.java) (revision 7d0d609b844ea5e9c41f46d209825ce5bd4fb83a) +++ lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/service/IQaService.java (.../IQaService.java) (revision 4d139bddc3cdd41d32d9f3033f2100c711d8c0c5) @@ -45,6 +45,7 @@ import org.lamsfoundation.lams.tool.qa.dto.GroupDTO; import org.lamsfoundation.lams.tool.qa.dto.QaQuestionDTO; import org.lamsfoundation.lams.tool.qa.dto.ReflectionDTO; +import org.lamsfoundation.lams.tool.qa.util.QaApplicationException; import org.lamsfoundation.lams.util.audit.IAuditService; /** @@ -76,6 +77,8 @@ * @param leader */ void copyAnswersFromLeader(QaQueUsr user, QaQueUsr leader); + + void setDefineLater(String strToolContentID, boolean value); /** * Get users by given toolSessionID. @@ -97,10 +100,6 @@ void saveOrUpdateQaContent(QaContent qa); - int getTotalNumberOfUsers(QaContent qa); - - int countSessionComplete(QaContent qa); - void updateUser(QaQueUsr qaQueUsr); List getResponsesByUserUid(final Long userUid); @@ -154,12 +153,8 @@ */ QaSession getSessionById(long qaSessionId); - void createSession(QaSession qaSession); - void removeToolSession(Long toolSessionId) throws DataMissingException, ToolException; - List getSessionsFromContent(QaContent qaContent); - QaQueUsr createUser(Long toolSessionID); void updateSession(QaSession qaSession); @@ -176,8 +171,6 @@ List getAllQuestionEntries(final Long uid); - List getUserBySessionOnly(final QaSession qaSession); - void recalculateUserAnswers(QaContent content, Set oldQuestions, List questionDTOs, List deletedQuestions); @@ -189,6 +182,13 @@ */ void copyToolContent(Long fromContentId, Long toContentId) throws ToolException; + /** + * checks the paramter content in the user responses table + * + * @param qa + * @return boolean + * @throws QaApplicationException + */ boolean isStudentActivityOccurredGlobal(QaContent qaContent); /** Index: lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/service/QaServicePOJO.java =================================================================== diff -u -r7d0d609b844ea5e9c41f46d209825ce5bd4fb83a -r4d139bddc3cdd41d32d9f3033f2100c711d8c0c5 --- lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/service/QaServicePOJO.java (.../QaServicePOJO.java) (revision 7d0d609b844ea5e9c41f46d209825ce5bd4fb83a) +++ lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/service/QaServicePOJO.java (.../QaServicePOJO.java) (revision 4d139bddc3cdd41d32d9f3033f2100c711d8c0c5) @@ -39,6 +39,7 @@ import java.util.TreeMap; import java.util.TreeSet; +import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpSession; import org.apache.log4j.Logger; @@ -205,29 +206,45 @@ } } } + + @Override + public void setDefineLater(String strToolContentID, boolean value) { + QaContent qaContent = getQaContent(new Long(strToolContentID).longValue()); + + if (qaContent != null) { + qaContent.setDefineLater(value); + updateQaContent(qaContent); + } + } + @Override public List getUsersBySessionId(Long toolSessionID) { QaSession session = qaSessionDAO.getQaSessionById(toolSessionID); return qaQueUsrDAO.getUserBySessionOnly(session); } + @Override public void createQaContent(QaContent qaContent) { qaDAO.saveQa(qaContent); } + @Override public QaContent getQaContent(long toolContentID) { return qaDAO.getQaByContentId(toolContentID); } + @Override public void saveOrUpdateQaContent(QaContent qa) { qaDAO.saveOrUpdateQa(qa); } + @Override public QaQueContent getQuestionByContentAndDisplayOrder(Long displayOrder, Long contentUid) { return qaQuestionDAO.getQuestionByDisplayOrder(displayOrder, contentUid); } + @Override public QaQueContent getQuestionByUid(Long questionUid) { if (questionUid == null) { return null; @@ -236,22 +253,16 @@ return qaQuestionDAO.getQuestionByUid(questionUid); } + @Override public void saveOrUpdateQuestion(QaQueContent question) { qaQuestionDAO.saveOrUpdateQaQueContent(question); } + @Override public void createQuestion(QaQueContent question) { qaQuestionDAO.createQueContent(question); } - public void createSession(QaSession qaSession) { - qaSessionDAO.createSession(qaSession); - } - - public List getSessionsFromContent(QaContent qaContent) { - return qaSessionDAO.getSessionsFromContent(qaContent); - } - public QaQueUsr createUser(Long toolSessionID) { HttpSession ss = SessionManager.getSession(); UserDTO toolUser = (UserDTO) ss.getAttribute(AttributeNames.USER); @@ -307,10 +318,12 @@ return qaResponseRatingDAO.getAverageRatingDTOByUserAndContentId(userUid, contentId); } + @Override public void updateUserResponse(QaUsrResp resp) { qaUsrRespDAO.updateUserResponse(resp); } + @Override public void updateResponseWithNewAnswer(String newAnswer, String toolSessionID, Long questionDisplayOrder) { HttpSession ss = SessionManager.getSession(); UserDTO toolUser = (UserDTO) ss.getAttribute(AttributeNames.USER); @@ -337,38 +350,37 @@ } } - public List getUserBySessionOnly(final QaSession qaSession) { - return qaQueUsrDAO.getUserBySessionOnly(qaSession); - } - + @Override public void createUserResponse(QaUsrResp qaUsrResp) { qaUsrRespDAO.createUserResponse(qaUsrResp); } + @Override public void updateUser(QaQueUsr qaQueUsr) { qaQueUsrDAO.updateUsr(qaQueUsr); } + @Override public QaUsrResp getResponseById(Long responseId) { return qaUsrRespDAO.getResponseById(responseId); } - public int countSessionComplete(QaContent qa) { - return qaSessionDAO.countSessionComplete(qa); - } - + @Override public QaSession getSessionById(long qaSessionId) { return qaSessionDAO.getQaSessionById(qaSessionId); } + @Override public void updateQaContent(QaContent qa) { qaDAO.updateQa(qa); } + @Override public void updateSession(QaSession qaSession) { qaSessionDAO.UpdateQaSession(qaSession); } + @Override public void removeUserResponse(QaUsrResp resp) { auditService.logChange(QaAppConstants.MY_SIGNATURE, resp.getQaQueUser().getQueUsrId(), resp.getQaQueUser() .getUsername(), resp.getAnswer(), null); @@ -397,29 +409,22 @@ } } - public int getTotalNumberOfUsers(QaContent qa) { - return qaQueUsrDAO.getTotalNumberOfUsers(qa); - } - + @Override public List getAllQuestionEntries(final Long uid) { return qaQuestionDAO.getAllQuestionEntries(uid.longValue()); } + @Override public List getAllQuestionEntriesSorted(final long contentUid) { return qaQuestionDAO.getAllQuestionEntriesSorted(contentUid); } + @Override public void removeQuestion(QaQueContent question) { qaQuestionDAO.removeQaQueContent(question); } - /** - * checks the paramter content in the user responses table - * - * @param qa - * @return boolean - * @throws QaApplicationException - */ + @Override public boolean isStudentActivityOccurredGlobal(QaContent qaContent) { int countResponses = 0; if (qaContent != null) { @@ -609,6 +614,7 @@ } } + @Override public AverageRatingDTO rateResponse(Long responseId, Long userId, Long toolSessionID, float rating) { QaQueUsr imageGalleryUser = this.getUserByIdAndSession(userId, toolSessionID); ResponseRating responseRating = qaResponseRatingDAO.getRatingByResponseAndUser(responseId, userId); @@ -627,10 +633,12 @@ return qaResponseRatingDAO.getAverageRatingDTOByResponse(responseId); } + @Override public AverageRatingDTO getAverageRatingDTOByResponse(Long responseId) { return qaResponseRatingDAO.getAverageRatingDTOByResponse(responseId); } + @Override public List getReflectList(QaContent content, String userID) { // reflection data for all sessions @@ -905,15 +913,7 @@ eventNotificationService.notifyLessonMonitors(sessionId, message, true); } - /** - * Export the XML fragment for the tool's content, along with any files needed for the content. - * - * @throws DataMissingException - * if no tool content matches the toolSessionId - * @throws ToolException - * if any other error occurs - */ - + @Override public void exportToolContent(Long toolContentID, String rootPath) { QaContent toolContentObj = qaDAO.getQaByContentId(toolContentID); if (toolContentObj == null) { @@ -946,12 +946,7 @@ } } - /** - * Import the XML fragment for the tool's content, along with any files needed for the content. - * - * @throws ToolException - * if any other error occurs - */ + @Override public void importToolContent(Long toolContentID, Integer newUserUid, String toolContentPath, String fromVersion, String toVersion) throws ToolException { try { @@ -981,14 +976,7 @@ } } - /** - * Get the definitions for possible output for an activity, based on the toolContentId. These may be definitions - * that are always available for the tool (e.g. number of marks for Multiple Choice) or a custom definition created - * for a particular activity such as the answer to the third question contains the word Koala and hence the need for - * the toolContentId - * - * @return SortedMap of ToolOutputDefinitions with the key being the name of each definition - */ + @Override public SortedMap getToolOutputDefinitions(Long toolContentId, int definitionType) throws ToolException { QaContent qaContent = qaDAO.getQaByContentId(toolContentId); @@ -1010,11 +998,7 @@ return qaDAO.getQaByContentId(toolContentId).isDefineLater(); } - /** - * ToolSessionManager CONTRACT : creates a tool session with the incoming toolSessionId in the tool session table - * - * gets called only in the Learner mode. All the learners in the same group have the same toolSessionId. - */ + @Override public void createToolSession(Long toolSessionId, String toolSessionName, Long toolContentID) throws ToolException { if (toolSessionId == null) { @@ -1040,6 +1024,7 @@ } } + @Override public void removeToolSession(Long toolSessionId) throws DataMissingException, ToolException { if (toolSessionId == null) { QaServicePOJO.logger.error("toolSessionId is null"); @@ -1067,13 +1052,7 @@ } } - /** - * Complete the tool session. - * - * Part of the ToolSessionManager contract. Called by controller service to force complete the qa session, or by the - * web front end to complete the qa session - * - */ + @Override public String leaveToolSession(Long toolSessionId, Long learnerId) throws DataMissingException, ToolException { if (toolSessionId == null) { @@ -1102,28 +1081,20 @@ /** * ToolSessionManager CONTRACT - * */ public ToolSessionExportOutputData exportToolSession(Long toolSessionId) throws DataMissingException, ToolException { throw new ToolException("not yet implemented"); } /** * ToolSessionManager CONTRACT - * */ public ToolSessionExportOutputData exportToolSession(List toolSessionIds) throws DataMissingException, ToolException { - throw new ToolException("not yet implemented"); } - /** - * Get the tool output for the given tool output names. - * - * @see org.lamsfoundation.lams.tool.ToolSessionManager#getToolOutput(java.util.List, java.lang.Long, - * java.lang.Long) - */ + @Override public SortedMap getToolOutput(List names, Long toolSessionId, Long learnerId) { return getQaOutputFactory().getToolOutput(names, this, toolSessionId, learnerId); } @@ -1360,9 +1331,7 @@ } - /** - * Set the description, throws away the title value as this is not supported in 2.0 - */ + @Override public void setReflectiveData(Long toolContentId, String title, String description) throws ToolException, DataMissingException { @@ -1431,6 +1400,7 @@ this.qaWizardDAO = qaWizardDAO; } + @Override public QaContent getQaContentBySessionId(Long sessionId) { QaSession session = qaSessionDAO.getQaSessionById(sessionId); // to skip CGLib problem @@ -1439,9 +1409,7 @@ return qaContent; } - /** - * {@inheritDoc} - */ + @Override public String createConditionName(Collection existingConditions) { String uniqueNumber = null; do { @@ -1456,95 +1424,69 @@ return getQaOutputFactory().buildUserAnswersConditionName(uniqueNumber); } + @Override public void deleteCondition(QaCondition condition) { if (condition != null && condition.getConditionId() != null) { qaDAO.deleteCondition(condition); } } + @Override public QaCondition createDefaultComplexCondition(QaContent qaContent) { return getQaOutputFactory().createDefaultComplexUserAnswersCondition(qaContent); } - /** - * Gets the qa config item with the given key - * - * @param configKey - * @return - */ + @Override public QaConfigItem getConfigItem(String configKey) { return qaConfigItemDAO.getConfigItemByKey(configKey); } - /** - * Saves or updates a qa config item - * - * @param configItem - */ + @Override public void saveOrUpdateConfigItem(QaConfigItem configItem) { qaConfigItemDAO.saveOrUpdate(configItem); } - /** - * Gets the set of wizard categories from the database - * - * @return - */ + @Override public SortedSet getWizardCategories() { return qaWizardDAO.getWizardCategories(); } - /** - * Saves the entire set of QaWizardCategories (including the child cognitive skills and questions) - * - * @param categories - */ + @Override public void saveOrUpdateQaWizardCategories(SortedSet categories) { qaWizardDAO.saveOrUpdateCategories(categories); } - /** - * Deletes a wizard category from the db - * - * @param uid - */ + @Override public void deleteWizardCategoryByUID(Long uid) { qaWizardDAO.deleteWizardCategoryByUID(uid); } - /** - * Deletes a wizard cognitive skill from the db - * - * @param uid - */ + @Override public void deleteWizardSkillByUID(Long uid) { qaWizardDAO.deleteWizardSkillByUID(uid); } - /** - * Deletes a wizard question from the db - * - * @param uid - */ + @Override public void deleteWizardQuestionByUID(Long uid) { qaWizardDAO.deleteWizardQuestionByUID(uid); } - /** - * Deletes all categories, sub skills and sub questions - */ + @Override public void deleteAllWizardCategories() { qaWizardDAO.deleteAllWizardCategories(); } + @Override public void removeQuestionsFromCache(QaContent qaContent) { qaDAO.removeQuestionsFromCache(qaContent); } + @Override public void removeQaContentFromCache(QaContent qaContent) { qaDAO.removeQaContentFromCache(qaContent); } + @Override public Class[] getSupportedToolOutputDefinitionClasses(int definitionType) { return getQaOutputFactory().getSupportedDefinitionClasses(definitionType); } Index: lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/util/QaUtils.java =================================================================== diff -u -ra7661f206a3f21114f1c05f9a29f56e20f5e35f0 -r4d139bddc3cdd41d32d9f3033f2100c711d8c0c5 --- lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/util/QaUtils.java (.../QaUtils.java) (revision a7661f206a3f21114f1c05f9a29f56e20f5e35f0) +++ lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/util/QaUtils.java (.../QaUtils.java) (revision 4d139bddc3cdd41d32d9f3033f2100c711d8c0c5) @@ -197,21 +197,4 @@ request.getSession().removeAttribute(USER_EXCEPTION_QUESTIONS_DUPLICATE); } - /** - * - * @param request - * @param value - * @param toolContentID - */ - public static void setDefineLater(HttpServletRequest request, boolean value, String strToolContentID, - IQaService qaService) { - - QaContent qaContent = qaService.getQaContent(new Long(strToolContentID).longValue()); - - if (qaContent != null) { - qaContent.setDefineLater(value); - qaService.updateQaContent(qaContent); - } - } - } Index: lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/web/AuthoringUtil.java =================================================================== diff -u -ra7661f206a3f21114f1c05f9a29f56e20f5e35f0 -r4d139bddc3cdd41d32d9f3033f2100c711d8c0c5 --- lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/web/AuthoringUtil.java (.../AuthoringUtil.java) (revision a7661f206a3f21114f1c05f9a29f56e20f5e35f0) +++ lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/web/AuthoringUtil.java (.../AuthoringUtil.java) (revision 4d139bddc3cdd41d32d9f3033f2100c711d8c0c5) @@ -56,105 +56,8 @@ */ public class AuthoringUtil implements QaAppConstants { - protected static List swapQuestions(List questionDTOs, String questionIndex, - String direction, Set conditions) { - int intQuestionIndex = new Integer(questionIndex).intValue(); - int intOriginalQuestionIndex = intQuestionIndex; - int replacedQuestionIndex = 0; - if (direction.equals("down")) { - // direction down - replacedQuestionIndex = ++intQuestionIndex; - } else { - // direction up - replacedQuestionIndex = --intQuestionIndex; - } - - QaQuestionDTO mainQuestion = getQuestionAtDisplayOrder(questionDTOs, intOriginalQuestionIndex); - - QaQuestionDTO replacedQuestion = getQuestionAtDisplayOrder(questionDTOs, replacedQuestionIndex); - - List newQuestionDtos = new LinkedList(); - - Iterator iter = questionDTOs.iterator(); - while (iter.hasNext()) { - QaQuestionDTO questionDTO = iter.next(); - QaQuestionDTO tempQuestion = null; - - if (!questionDTO.getDisplayOrder().equals(new Integer(intOriginalQuestionIndex).toString()) - && !questionDTO.getDisplayOrder().equals(new Integer(replacedQuestionIndex).toString())) { - // normal copy - tempQuestion = questionDTO; - - } else if (questionDTO.getDisplayOrder().equals(new Integer(intOriginalQuestionIndex).toString())) { - // move type 1 - tempQuestion = replacedQuestion; - - } else if (questionDTO.getDisplayOrder().equals(new Integer(replacedQuestionIndex).toString())) { - // move type 1 - tempQuestion = mainQuestion; - } - - newQuestionDtos.add(tempQuestion); - } - - // references in conditions also need to be changed - if (conditions != null) { - for (QaCondition condition : conditions) { - SortedSet newQuestionDTOSet = new TreeSet( - new QaQuestionContentDTOComparator()); - for (QaQuestionDTO dto : (List) newQuestionDtos) { - if (condition.temporaryQuestionDTOSet.contains(dto)) { - newQuestionDTOSet.add(dto); - } - } - condition.temporaryQuestionDTOSet = newQuestionDTOSet; - } - } - - return newQuestionDtos; - } - - private static QaQuestionDTO getQuestionAtDisplayOrder(List questionDTOs, - int intOriginalQuestionIndex) { - - Iterator iter = questionDTOs.iterator(); - while (iter.hasNext()) { - QaQuestionDTO qaQuestionDTO = iter.next(); - if (new Integer(intOriginalQuestionIndex).toString().equals(qaQuestionDTO.getDisplayOrder())) { - return qaQuestionDTO; - } - } - return null; - } - - protected static List reorderQuestionDTOs(List questionDTOs) { - List listFinalQuestionDTO = new LinkedList(); - - int queIndex = 0; - Iterator iter = questionDTOs.iterator(); - while (iter.hasNext()) { - QaQuestionDTO qaQuestionDTO = iter.next(); - - String question = qaQuestionDTO.getQuestion(); - String feedback = qaQuestionDTO.getFeedback(); - boolean required = qaQuestionDTO.isRequired(); - - if (question != null && !question.equals("")) { - ++queIndex; - - qaQuestionDTO.setQuestion(question); - qaQuestionDTO.setDisplayOrder(new Integer(queIndex).toString()); - qaQuestionDTO.setFeedback(feedback); - qaQuestionDTO.setRequired(required); - - listFinalQuestionDTO.add(qaQuestionDTO); - } - } - return listFinalQuestionDTO; - } - protected static List reorderUpdateQuestionDTOs(List questionDTOs, QaQuestionDTO qaQuestionContentDTONew, String editableQuestionIndex) { @@ -193,8 +96,7 @@ } public static QaContent saveOrUpdateQaContent(List questionDTOs, IQaService qaService, - HttpServletRequest request, QaContent qaContent, String strToolContentID, - Set conditions) { + HttpServletRequest request, QaContent qaContent, String strToolContentID, Set conditions) { UserDTO toolUser = (UserDTO) SessionManager.getSession().getAttribute(AttributeNames.USER); String richTextTitle = request.getParameter(QaAppConstants.TITLE); @@ -314,8 +216,8 @@ } qaContent.setConditions(conditions); qaService.updateQaContent(qaContent); - - //persist questions + + // persist questions int displayOrder = 0; for (QaQuestionDTO questionDTO : questionDTOs) { @@ -336,19 +238,19 @@ questionDTO.isRequired(), qaContent); qaContent.getQaQueContents().add(question); question.setQaContent(qaContent); - - // in case question exists already + + // in case question exists already } else { question.setQuestion(questionText); question.setFeedback(questionDTO.getFeedback()); question.setDisplayOrder(displayOrder); question.setRequired(questionDTO.isRequired()); } - + qaService.saveOrUpdateQuestion(question); } - + return qaContent; } Index: lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/web/LearningUtil.java =================================================================== diff -u -r52c8c1dcf1233af8cbd4e3447f318146a9975f41 -r4d139bddc3cdd41d32d9f3033f2100c711d8c0c5 --- lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/web/LearningUtil.java (.../LearningUtil.java) (revision 52c8c1dcf1233af8cbd4e3447f318146a9975f41) +++ lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/web/LearningUtil.java (.../LearningUtil.java) (revision 4d139bddc3cdd41d32d9f3033f2100c711d8c0c5) @@ -41,11 +41,9 @@ import org.lamsfoundation.lams.web.util.AttributeNames; /** - * * Keeps all operations needed for Learning mode. * * @author Ozgur Demirtas - * */ public class LearningUtil implements QaAppConstants { Index: lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/web/QaAction.java =================================================================== diff -u -ra7661f206a3f21114f1c05f9a29f56e20f5e35f0 -r4d139bddc3cdd41d32d9f3033f2100c711d8c0c5 --- lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/web/QaAction.java (.../QaAction.java) (revision a7661f206a3f21114f1c05f9a29f56e20f5e35f0) +++ lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/web/QaAction.java (.../QaAction.java) (revision 4d139bddc3cdd41d32d9f3033f2100c711d8c0c5) @@ -32,6 +32,7 @@ import java.util.List; import java.util.Set; import java.util.SortedSet; +import java.util.TreeSet; import javax.servlet.ServletException; import javax.servlet.http.HttpServletRequest; @@ -55,6 +56,7 @@ import org.lamsfoundation.lams.tool.qa.dto.QaQuestionDTO; import org.lamsfoundation.lams.tool.qa.service.IQaService; import org.lamsfoundation.lams.tool.qa.service.QaServiceProxy; +import org.lamsfoundation.lams.tool.qa.util.QaQuestionContentDTOComparator; import org.lamsfoundation.lams.tool.qa.util.QaUtils; import org.lamsfoundation.lams.tool.qa.web.form.QaAuthoringForm; import org.lamsfoundation.lams.util.WebUtil; @@ -129,7 +131,7 @@ if (mode.isTeacher()) { Set oldQuestions = qaContent.getQaQueContents(); qaService.removeQuestionsFromCache(qaContent); - QaUtils.setDefineLater(request, false, strToolContentID, qaService); + qaService.setDefineLater(strToolContentID, false); // recalculate User Answers qaService.recalculateUserAnswers(qaContent, oldQuestions, questionDTOs, deletedQuestionDTOs); @@ -616,9 +618,9 @@ SortedSet conditionSet = (SortedSet) sessionMap .get(QaAppConstants.ATTR_CONDITION_SET); - questionDTOs = AuthoringUtil.swapQuestions(questionDTOs, questionIndex, "down", conditionSet); + questionDTOs = swapQuestions(questionDTOs, questionIndex, "down", conditionSet); - questionDTOs = AuthoringUtil.reorderQuestionDTOs(questionDTOs); + questionDTOs = reorderQuestionDTOs(questionDTOs); sessionMap.put(QaAppConstants.LIST_QUESTION_DTOS, questionDTOs); @@ -678,9 +680,9 @@ SortedSet conditionSet = (SortedSet) sessionMap .get(QaAppConstants.ATTR_CONDITION_SET); - questionDTOs = AuthoringUtil.swapQuestions(questionDTOs, questionIndex, "up", conditionSet); + questionDTOs = swapQuestions(questionDTOs, questionIndex, "up", conditionSet); - questionDTOs = AuthoringUtil.reorderQuestionDTOs(questionDTOs); + questionDTOs = reorderQuestionDTOs(questionDTOs); sessionMap.put(QaAppConstants.LIST_QUESTION_DTOS, questionDTOs); @@ -724,7 +726,106 @@ request.setAttribute(QaAppConstants.TOTAL_QUESTION_COUNT, new Integer(questionDTOs.size())); return mapping.findForward(QaAppConstants.LOAD_QUESTIONS); } + + private static List swapQuestions(List questionDTOs, String questionIndex, + String direction, Set conditions) { + int intQuestionIndex = new Integer(questionIndex).intValue(); + int intOriginalQuestionIndex = intQuestionIndex; + + int replacedQuestionIndex = 0; + if (direction.equals("down")) { + // direction down + replacedQuestionIndex = ++intQuestionIndex; + } else { + // direction up + replacedQuestionIndex = --intQuestionIndex; + } + + QaQuestionDTO mainQuestion = getQuestionAtDisplayOrder(questionDTOs, intOriginalQuestionIndex); + + QaQuestionDTO replacedQuestion = getQuestionAtDisplayOrder(questionDTOs, replacedQuestionIndex); + + List newQuestionDtos = new LinkedList(); + + Iterator iter = questionDTOs.iterator(); + while (iter.hasNext()) { + QaQuestionDTO questionDTO = iter.next(); + QaQuestionDTO tempQuestion = null; + + if (!questionDTO.getDisplayOrder().equals(new Integer(intOriginalQuestionIndex).toString()) + && !questionDTO.getDisplayOrder().equals(new Integer(replacedQuestionIndex).toString())) { + // normal copy + tempQuestion = questionDTO; + + } else if (questionDTO.getDisplayOrder().equals(new Integer(intOriginalQuestionIndex).toString())) { + // move type 1 + tempQuestion = replacedQuestion; + + } else if (questionDTO.getDisplayOrder().equals(new Integer(replacedQuestionIndex).toString())) { + // move type 1 + tempQuestion = mainQuestion; + } + + newQuestionDtos.add(tempQuestion); + } + + // references in conditions also need to be changed + if (conditions != null) { + for (QaCondition condition : conditions) { + SortedSet newQuestionDTOSet = new TreeSet( + new QaQuestionContentDTOComparator()); + for (QaQuestionDTO dto : (List) newQuestionDtos) { + if (condition.temporaryQuestionDTOSet.contains(dto)) { + newQuestionDTOSet.add(dto); + } + } + condition.temporaryQuestionDTOSet = newQuestionDTOSet; + } + } + + return newQuestionDtos; + } + + private static QaQuestionDTO getQuestionAtDisplayOrder(List questionDTOs, + int intOriginalQuestionIndex) { + + Iterator iter = questionDTOs.iterator(); + while (iter.hasNext()) { + QaQuestionDTO qaQuestionDTO = iter.next(); + if (new Integer(intOriginalQuestionIndex).toString().equals(qaQuestionDTO.getDisplayOrder())) { + return qaQuestionDTO; + } + } + return null; + } + + private static List reorderQuestionDTOs(List questionDTOs) { + List listFinalQuestionDTO = new LinkedList(); + + int queIndex = 0; + Iterator iter = questionDTOs.iterator(); + while (iter.hasNext()) { + QaQuestionDTO qaQuestionDTO = iter.next(); + + String question = qaQuestionDTO.getQuestion(); + String feedback = qaQuestionDTO.getFeedback(); + boolean required = qaQuestionDTO.isRequired(); + + if (question != null && !question.equals("")) { + ++queIndex; + + qaQuestionDTO.setQuestion(question); + qaQuestionDTO.setDisplayOrder(new Integer(queIndex).toString()); + qaQuestionDTO.setFeedback(feedback); + qaQuestionDTO.setRequired(required); + + listFinalQuestionDTO.add(qaQuestionDTO); + } + } + return listFinalQuestionDTO; + } + /** * Get the deleted condition list, which could be persisted or non-persisted * items. Index: lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/web/QaLearningAction.java =================================================================== diff -u -r7d0d609b844ea5e9c41f46d209825ce5bd4fb83a -r4d139bddc3cdd41d32d9f3033f2100c711d8c0c5 --- lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/web/QaLearningAction.java (.../QaLearningAction.java) (revision 7d0d609b844ea5e9c41f46d209825ce5bd4fb83a) +++ lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/web/QaLearningAction.java (.../QaLearningAction.java) (revision 4d139bddc3cdd41d32d9f3033f2100c711d8c0c5) @@ -331,13 +331,8 @@ String toolSessionID = request.getParameter(AttributeNames.PARAM_TOOL_SESSION_ID); String userID = request.getParameter("userID"); QaSession qaSession = QaLearningAction.qaService.getSessionById(new Long(toolSessionID).longValue()); - Long toolContentID = qaSession.getQaContent().getQaContentId(); QaContent qaContent = qaSession.getQaContent(); - - String httpSessionID = qaLearningForm.getHttpSessionID(); - SessionMap sessionMap = (SessionMap) request.getSession().getAttribute(httpSessionID); - Map mapAnswers = (Map) sessionMap.get(QaAppConstants.MAP_ALL_RESULTS_KEY); - + // LearningUtil.storeResponses(mapAnswers, qaService, toolContentID, new Long(toolSessionID)); // mark response as finalised QaQueUsr qaQueUsr = getCurrentUser(toolSessionID); @@ -349,6 +344,7 @@ if (qaContent.isShowOtherAnswers()) { GeneralLearnerFlowDTO generalLearnerFlowDTO = LearningUtil.buildGeneralLearnerFlowDTO(qaContent); + String httpSessionID = qaLearningForm.getHttpSessionID(); generalLearnerFlowDTO.setHttpSessionID(httpSessionID); String isUserNamesVisibleBoolean = generalLearnerFlowDTO.getUserNameVisible(); boolean isUserNamesVisible = new Boolean(isUserNamesVisibleBoolean).booleanValue(); Index: lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/web/QaLearningStarterAction.java =================================================================== diff -u -refbaf6ddcc506fed7b594bc9b663b81a03b1283f -r4d139bddc3cdd41d32d9f3033f2100c711d8c0c5 --- lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/web/QaLearningStarterAction.java (.../QaLearningStarterAction.java) (revision efbaf6ddcc506fed7b594bc9b663b81a03b1283f) +++ lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/web/QaLearningStarterAction.java (.../QaLearningStarterAction.java) (revision 4d139bddc3cdd41d32d9f3033f2100c711d8c0c5) @@ -72,20 +72,14 @@ import org.lamsfoundation.lams.web.util.SessionMap; /** + * This class is used to load the default content and initialize the presentation Map for Learner mode. + * It is important that ALL the session attributes created in this action gets removed by: QaUtils.cleanupSession(request) * * @author Ozgur Demirtas * - * This class is used to load the default content and initialize the - * presentation Map for Learner mode - * - * createToolSession will not be called once the tool is deployed. - * - * It is important that ALL the session attributes created in this action gets - * removed by: QaUtils.cleanupSession(request) - * */ public class QaLearningStarterAction extends Action implements QaAppConstants { - static Logger logger = Logger.getLogger(QaLearningStarterAction.class.getName()); + private static Logger logger = Logger.getLogger(QaLearningStarterAction.class.getName()); private static IQaService qaService; Index: lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/web/QaStarterAction.java =================================================================== diff -u -ra7661f206a3f21114f1c05f9a29f56e20f5e35f0 -r4d139bddc3cdd41d32d9f3033f2100c711d8c0c5 --- lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/web/QaStarterAction.java (.../QaStarterAction.java) (revision a7661f206a3f21114f1c05f9a29f56e20f5e35f0) +++ lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/web/QaStarterAction.java (.../QaStarterAction.java) (revision 4d139bddc3cdd41d32d9f3033f2100c711d8c0c5) @@ -132,7 +132,7 @@ ToolAccessMode mode = getAccessMode(request); // request is from monitoring module if (mode.isTeacher()) { - QaUtils.setDefineLater(request, true, strToolContentID, qaService); + qaService.setDefineLater(strToolContentID, true); } request.setAttribute(AttributeNames.ATTR_MODE, mode.toString()); Index: lams_tool_laqa/web/admin/config.jsp =================================================================== diff -u -r35a0e719d061c08b52e705135bb2f2126079ed21 -r4d139bddc3cdd41d32d9f3033f2100c711d8c0c5 --- lams_tool_laqa/web/admin/config.jsp (.../config.jsp) (revision 35a0e719d061c08b52e705135bb2f2126079ed21) +++ lams_tool_laqa/web/admin/config.jsp (.../config.jsp) (revision 4d139bddc3cdd41d32d9f3033f2100c711d8c0c5) @@ -14,7 +14,6 @@ - - - @@ -455,8 +371,6 @@ - -

@@ -489,7 +403,6 @@ - @@ -513,6 +426,7 @@
+ + + +

- + + + +   - + + + + +



- - + + +

- - + - - + \ No newline at end of file Index: lams_tool_laqa/web/export/exportportfolio.jsp =================================================================== diff -u -r55acfa2355b842ad87bac70171e366e088daad3c -r4d139bddc3cdd41d32d9f3033f2100c711d8c0c5 --- lams_tool_laqa/web/export/exportportfolio.jsp (.../exportportfolio.jsp) (revision 55acfa2355b842ad87bac70171e366e088daad3c) +++ lams_tool_laqa/web/export/exportportfolio.jsp (.../exportportfolio.jsp) (revision 4d139bddc3cdd41d32d9f3033f2100c711d8c0c5) @@ -98,7 +98,7 @@ - + @@ -176,7 +176,7 @@ - + Index: lams_tool_laqa/web/includes/jsp/qaWizardCommon.jsp =================================================================== diff -u -rce3e782fd6844641f7298e09104f8d7554f073ff -r4d139bddc3cdd41d32d9f3033f2100c711d8c0c5 --- lams_tool_laqa/web/includes/jsp/qaWizardCommon.jsp (.../qaWizardCommon.jsp) (revision ce3e782fd6844641f7298e09104f8d7554f073ff) +++ lams_tool_laqa/web/includes/jsp/qaWizardCommon.jsp (.../qaWizardCommon.jsp) (revision 4d139bddc3cdd41d32d9f3033f2100c711d8c0c5) @@ -1,10 +1,8 @@ \ No newline at end of file Index: lams_tool_laqa/web/learning/AnswersContent.jsp =================================================================== diff -u -r52c8c1dcf1233af8cbd4e3447f318146a9975f41 -r4d139bddc3cdd41d32d9f3033f2100c711d8c0c5 --- lams_tool_laqa/web/learning/AnswersContent.jsp (.../AnswersContent.jsp) (revision 52c8c1dcf1233af8cbd4e3447f318146a9975f41) +++ lams_tool_laqa/web/learning/AnswersContent.jsp (.../AnswersContent.jsp) (revision 4d139bddc3cdd41d32d9f3033f2100c711d8c0c5) @@ -30,7 +30,9 @@ - + + + @@ -90,11 +87,3 @@ - - - - - - - - Index: lams_tool_vote/src/java/org/lamsfoundation/lams/tool/vote/dao/IVoteContentDAO.java =================================================================== diff -u -r5b17b810b5302c90b2daf6a5866bf4f6e85bef6a -r4d139bddc3cdd41d32d9f3033f2100c711d8c0c5 --- lams_tool_vote/src/java/org/lamsfoundation/lams/tool/vote/dao/IVoteContentDAO.java (.../IVoteContentDAO.java) (revision 5b17b810b5302c90b2daf6a5866bf4f6e85bef6a) +++ lams_tool_vote/src/java/org/lamsfoundation/lams/tool/vote/dao/IVoteContentDAO.java (.../IVoteContentDAO.java) (revision 4d139bddc3cdd41d32d9f3033f2100c711d8c0c5) @@ -43,8 +43,6 @@ void saveOrUpdateVote(VoteContent voteContent); - void removeVote(VoteContent voteContent); - void removeVoteById(Long voteContentId); void removeVoteSessions(VoteContent voteContent); Index: lams_tool_vote/src/java/org/lamsfoundation/lams/tool/vote/dao/IVoteQueContentDAO.java =================================================================== diff -u -r5b17b810b5302c90b2daf6a5866bf4f6e85bef6a -r4d139bddc3cdd41d32d9f3033f2100c711d8c0c5 --- lams_tool_vote/src/java/org/lamsfoundation/lams/tool/vote/dao/IVoteQueContentDAO.java (.../IVoteQueContentDAO.java) (revision 5b17b810b5302c90b2daf6a5866bf4f6e85bef6a) +++ lams_tool_vote/src/java/org/lamsfoundation/lams/tool/vote/dao/IVoteQueContentDAO.java (.../IVoteQueContentDAO.java) (revision 4d139bddc3cdd41d32d9f3033f2100c711d8c0c5) @@ -37,8 +37,6 @@ VoteQueContent getQuestionByDisplayOrder(final Long displayOrder, final Long voteContentUid); - void saveQuestion(VoteQueContent voteQueContent); - void saveOrUpdateQuestion(VoteQueContent voteQueContent); void removeQuestion(VoteQueContent voteQueContent); Index: lams_tool_vote/src/java/org/lamsfoundation/lams/tool/vote/dao/IVoteSessionDAO.java =================================================================== diff -u -r5b17b810b5302c90b2daf6a5866bf4f6e85bef6a -r4d139bddc3cdd41d32d9f3033f2100c711d8c0c5 --- lams_tool_vote/src/java/org/lamsfoundation/lams/tool/vote/dao/IVoteSessionDAO.java (.../IVoteSessionDAO.java) (revision 5b17b810b5302c90b2daf6a5866bf4f6e85bef6a) +++ lams_tool_vote/src/java/org/lamsfoundation/lams/tool/vote/dao/IVoteSessionDAO.java (.../IVoteSessionDAO.java) (revision 4d139bddc3cdd41d32d9f3033f2100c711d8c0c5) @@ -29,11 +29,12 @@ import org.lamsfoundation.lams.tool.vote.pojos.VoteSession; /** + *

+ * Interface that defines the contract for VoteSession access + *

+ * * @author Ozgur Demirtas * - *

- * Interface that defines the contract for VoteSession access - *

*/ public interface IVoteSessionDAO { VoteSession getVoteSessionByUID(Long uid); @@ -60,6 +61,4 @@ List getSessionsFromContent(VoteContent voteContent); - List getSessionNamesFromContent(VoteContent voteContent); - } \ No newline at end of file Index: lams_tool_vote/src/java/org/lamsfoundation/lams/tool/vote/dao/IVoteUserDAO.java =================================================================== diff -u -r5b17b810b5302c90b2daf6a5866bf4f6e85bef6a -r4d139bddc3cdd41d32d9f3033f2100c711d8c0c5 --- lams_tool_vote/src/java/org/lamsfoundation/lams/tool/vote/dao/IVoteUserDAO.java (.../IVoteUserDAO.java) (revision 5b17b810b5302c90b2daf6a5866bf4f6e85bef6a) +++ lams_tool_vote/src/java/org/lamsfoundation/lams/tool/vote/dao/IVoteUserDAO.java (.../IVoteUserDAO.java) (revision 4d139bddc3cdd41d32d9f3033f2100c711d8c0c5) @@ -28,36 +28,30 @@ import org.lamsfoundation.lams.tool.vote.pojos.VoteSession; /** + *

+ * Interface that defines the contract for VoteQueUsr access + *

+ * * @author Ozgur Demirtas * - *

- * Interface that defines the contract for VoteQueUsr access - *

*/ public interface IVoteUserDAO { - public VoteQueUsr getVoteUserByUID(Long uid); - public VoteQueUsr getUserByUserId(Long userId); + VoteQueUsr getUserByUserId(Long userId); - public VoteQueUsr getVoteUserBySession(final Long queUsrId, final Long voteSessionId); + VoteQueUsr getVoteUserBySession(final Long queUsrId, final Long voteSessionId); - public int getCompletedVoteUserBySessionUid(final Long voteSessionUid); + int getCompletedVoteUserBySessionUid(final Long voteSessionUid); - public List getVoteUserBySessionUid(final Long voteSessionUid); + VoteQueUsr getVoteQueUsrById(long voteQueUsrId); - public VoteQueUsr getVoteQueUsrById(long voteQueUsrId); + void saveVoteUser(VoteQueUsr voteUser); - public void saveVoteUser(VoteQueUsr voteUser); + void updateVoteUser(VoteQueUsr voteUser); - public void updateVoteUser(VoteQueUsr voteUser); + List getUserBySessionOnly(final VoteSession voteSession); - public List getUserBySessionOnly(final VoteSession voteSession); + void removeVoteUser(VoteQueUsr voteUser); - public void removeVoteUserById(Long userId); - - public void removeVoteUser(VoteQueUsr voteUser); - - public int getNumberOfUsers(VoteSession voteSession); - - public int getTotalNumberOfUsers(); + int getTotalNumberOfUsers(); } Index: lams_tool_vote/src/java/org/lamsfoundation/lams/tool/vote/dao/IVoteUsrAttemptDAO.java =================================================================== diff -u -r5b17b810b5302c90b2daf6a5866bf4f6e85bef6a -r4d139bddc3cdd41d32d9f3033f2100c711d8c0c5 --- lams_tool_vote/src/java/org/lamsfoundation/lams/tool/vote/dao/IVoteUsrAttemptDAO.java (.../IVoteUsrAttemptDAO.java) (revision 5b17b810b5302c90b2daf6a5866bf4f6e85bef6a) +++ lams_tool_vote/src/java/org/lamsfoundation/lams/tool/vote/dao/IVoteUsrAttemptDAO.java (.../IVoteUsrAttemptDAO.java) (revision 4d139bddc3cdd41d32d9f3033f2100c711d8c0c5) @@ -54,8 +54,6 @@ List getStandardAttemptsByQuestionUid(final Long questionUid); - int getAttemptsForQuestionContent(final Long voteQueContentId); - int getStandardAttemptsForQuestionContentAndSessionUid(final Long voteQueContentId, final Long voteSessionUid); List getAttemptsForQuestionContentAndSessionUid(final Long voteQueContentId, Index: lams_tool_vote/src/java/org/lamsfoundation/lams/tool/vote/dao/hibernate/VoteContentDAO.java =================================================================== diff -u -r5b17b810b5302c90b2daf6a5866bf4f6e85bef6a -r4d139bddc3cdd41d32d9f3033f2100c711d8c0c5 --- lams_tool_vote/src/java/org/lamsfoundation/lams/tool/vote/dao/hibernate/VoteContentDAO.java (.../VoteContentDAO.java) (revision 5b17b810b5302c90b2daf6a5866bf4f6e85bef6a) +++ lams_tool_vote/src/java/org/lamsfoundation/lams/tool/vote/dao/hibernate/VoteContentDAO.java (.../VoteContentDAO.java) (revision 4d139bddc3cdd41d32d9f3033f2100c711d8c0c5) @@ -108,10 +108,6 @@ } } - public void removeVote(VoteContent voteContent) { - this.getHibernateTemplate().delete(voteContent); - } - public void removeVoteSessions(VoteContent voteContent) { this.getHibernateTemplate().deleteAll(voteContent.getVoteSessions()); } Index: lams_tool_vote/src/java/org/lamsfoundation/lams/tool/vote/dao/hibernate/VoteQueContentDAO.java =================================================================== diff -u -r5b17b810b5302c90b2daf6a5866bf4f6e85bef6a -r4d139bddc3cdd41d32d9f3033f2100c711d8c0c5 --- lams_tool_vote/src/java/org/lamsfoundation/lams/tool/vote/dao/hibernate/VoteQueContentDAO.java (.../VoteQueContentDAO.java) (revision 5b17b810b5302c90b2daf6a5866bf4f6e85bef6a) +++ lams_tool_vote/src/java/org/lamsfoundation/lams/tool/vote/dao/hibernate/VoteQueContentDAO.java (.../VoteQueContentDAO.java) (revision 4d139bddc3cdd41d32d9f3033f2100c711d8c0c5) @@ -83,11 +83,6 @@ } @Override - public void saveQuestion(VoteQueContent voteQueContent) { - this.getHibernateTemplate().save(voteQueContent); - } - - @Override public void saveOrUpdateQuestion(VoteQueContent voteQueContent) { this.getHibernateTemplate().saveOrUpdate(voteQueContent); } Index: lams_tool_vote/src/java/org/lamsfoundation/lams/tool/vote/dao/hibernate/VoteSessionDAO.java =================================================================== diff -u -r5b17b810b5302c90b2daf6a5866bf4f6e85bef6a -r4d139bddc3cdd41d32d9f3033f2100c711d8c0c5 --- lams_tool_vote/src/java/org/lamsfoundation/lams/tool/vote/dao/hibernate/VoteSessionDAO.java (.../VoteSessionDAO.java) (revision 5b17b810b5302c90b2daf6a5866bf4f6e85bef6a) +++ lams_tool_vote/src/java/org/lamsfoundation/lams/tool/vote/dao/hibernate/VoteSessionDAO.java (.../VoteSessionDAO.java) (revision 4d139bddc3cdd41d32d9f3033f2100c711d8c0c5) @@ -54,8 +54,6 @@ private static final String COUNT_SESSION_COMPLETE = "from voteSession in class VoteSession where voteSession.sessionStatus='COMPLETE'"; - private static final String GET_SESSIONNAMES_FROM_CONTENT = "select votes.session_name from VoteSession votes where votes.voteContent=:voteContent order by votes.voteSessionId"; - public VoteSession getVoteSessionByUID(Long sessionUid) { return (VoteSession) this.getHibernateTemplate().get(VoteSession.class, sessionUid); } @@ -143,8 +141,4 @@ public List getSessionsFromContent(VoteContent voteContent) { return (getHibernateTemplate().findByNamedParam(GET_SESSIONS_FROM_CONTENT, "voteContent", voteContent)); } - - public List getSessionNamesFromContent(VoteContent voteContent) { - return (getHibernateTemplate().findByNamedParam(GET_SESSIONNAMES_FROM_CONTENT, "voteContent", voteContent)); - } } Index: lams_tool_vote/src/java/org/lamsfoundation/lams/tool/vote/dao/hibernate/VoteUserDAO.java =================================================================== diff -u -r5b17b810b5302c90b2daf6a5866bf4f6e85bef6a -r4d139bddc3cdd41d32d9f3033f2100c711d8c0c5 --- lams_tool_vote/src/java/org/lamsfoundation/lams/tool/vote/dao/hibernate/VoteUserDAO.java (.../VoteUserDAO.java) (revision 5b17b810b5302c90b2daf6a5866bf4f6e85bef6a) +++ lams_tool_vote/src/java/org/lamsfoundation/lams/tool/vote/dao/hibernate/VoteUserDAO.java (.../VoteUserDAO.java) (revision 4d139bddc3cdd41d32d9f3033f2100c711d8c0c5) @@ -33,32 +33,16 @@ import org.springframework.orm.hibernate3.support.HibernateDaoSupport; /** + *

+ * Hibernate implementation for database access to Voting users (learners) for the voting tool. + *

+ * * @author Ozgur Demirtas - *

- * Hibernate implementation for database access to Voting users (learners) for the voting tool. - *

*/ public class VoteUserDAO extends HibernateDaoSupport implements IVoteUserDAO { - private static final String FIND_VOTE_USR_CONTENT = "from " + VoteQueUsr.class.getName() - + " as voteu where que_usr_id=?"; - - private static final String COUNT_USERS_IN_SESSION = "select voteu.queUsrId from VoteQueUsr voteu where voteu.voteSession= :voteSession"; - private static final String LOAD_USER_FOR_SESSION = "from voteQueUsr in class VoteQueUsr where voteQueUsr.voteSessionId= :voteSessionId"; - public VoteQueUsr getVoteUserByUID(Long uid) { - String query = "from VoteQueUsr user where user.uid=?"; - - List list = getSession().createQuery(query).setLong(0, uid.longValue()).list(); - - if (list != null && list.size() > 0) { - VoteQueUsr voteu = (VoteQueUsr) list.get(0); - return voteu; - } - return null; - } - public VoteQueUsr getUserByUserId(Long userId) { String query = "from VoteQueUsr user where user.queUsrId=?"; @@ -71,12 +55,6 @@ return null; } - public List getVoteUserBySessionUid(final Long voteSessionUid) { - List list = getSession().createQuery(LOAD_USER_FOR_SESSION) - .setLong("voteSessionId", voteSessionUid.longValue()).list(); - return list; - } - public int getCompletedVoteUserBySessionUid(final Long voteSessionUid) { List list = getSession().createQuery(LOAD_USER_FOR_SESSION) .setLong("voteSessionId", voteSessionUid.longValue()).list(); @@ -128,21 +106,6 @@ this.getHibernateTemplate().update(voteUser); } - public void removeVoteUserById(Long userId) { - HibernateTemplate templ = this.getHibernateTemplate(); - if (userId != null) { - List list = getSession().createQuery(FIND_VOTE_USR_CONTENT).setLong(0, userId.longValue()).list(); - - if (list != null && list.size() > 0) { - VoteQueUsr voteu = (VoteQueUsr) list.get(0); - this.getSession().setFlushMode(FlushMode.AUTO); - templ.delete(voteu); - templ.flush(); - } - } - - } - public List getUserBySessionOnly(final VoteSession voteSession) { List list = getSession().createQuery(LOAD_USER_FOR_SESSION) .setLong("voteSessionId", voteSession.getUid().longValue()).list(); @@ -154,10 +117,6 @@ this.getHibernateTemplate().delete(voteUser); } - public int getNumberOfUsers(VoteSession voteSession) { - return (getHibernateTemplate().findByNamedParam(COUNT_USERS_IN_SESSION, "voteSession", voteSession)).size(); - } - public int getTotalNumberOfUsers() { String query = "from obj in class VoteQueUsr"; return this.getHibernateTemplate().find(query).size(); Index: lams_tool_vote/src/java/org/lamsfoundation/lams/tool/vote/dao/hibernate/VoteUsrAttemptDAO.java =================================================================== diff -u -r5b17b810b5302c90b2daf6a5866bf4f6e85bef6a -r4d139bddc3cdd41d32d9f3033f2100c711d8c0c5 --- lams_tool_vote/src/java/org/lamsfoundation/lams/tool/vote/dao/hibernate/VoteUsrAttemptDAO.java (.../VoteUsrAttemptDAO.java) (revision 5b17b810b5302c90b2daf6a5866bf4f6e85bef6a) +++ lams_tool_vote/src/java/org/lamsfoundation/lams/tool/vote/dao/hibernate/VoteUsrAttemptDAO.java (.../VoteUsrAttemptDAO.java) (revision 4d139bddc3cdd41d32d9f3033f2100c711d8c0c5) @@ -153,18 +153,6 @@ } @Override - public int getAttemptsForQuestionContent(final Long questionUid) { - List list = getSession().createQuery(VoteUsrAttemptDAO.LOAD_ATTEMPT_FOR_QUESTION_CONTENT) - .setLong("voteQueContentId", questionUid.longValue()).list(); - - if ((list != null) && (list.size() > 0)) { - return list.size(); - } - - return 0; - } - - @Override public int getStandardAttemptsForQuestionContentAndSessionUid(final Long questionUid, final Long sessionUid) { List list = getAttemptsForQuestionContentAndSessionUid(questionUid, sessionUid); return list.size(); Index: lams_tool_vote/src/java/org/lamsfoundation/lams/tool/vote/dto/VoteGeneralLearnerFlowDTO.java =================================================================== diff -u -r9afb93ea36dcedb5db374cacb84b3c4a3d30465c -r4d139bddc3cdd41d32d9f3033f2100c711d8c0c5 --- lams_tool_vote/src/java/org/lamsfoundation/lams/tool/vote/dto/VoteGeneralLearnerFlowDTO.java (.../VoteGeneralLearnerFlowDTO.java) (revision 9afb93ea36dcedb5db374cacb84b3c4a3d30465c) +++ lams_tool_vote/src/java/org/lamsfoundation/lams/tool/vote/dto/VoteGeneralLearnerFlowDTO.java (.../VoteGeneralLearnerFlowDTO.java) (revision 4d139bddc3cdd41d32d9f3033f2100c711d8c0c5) @@ -80,8 +80,6 @@ protected String notebookEntry; - protected String totalQuestionCount; - protected String previewOnly; protected String reportViewOnly; @@ -383,21 +381,6 @@ } /** - * @return Returns the totalQuestionCount. - */ - public String getTotalQuestionCount() { - return totalQuestionCount; - } - - /** - * @param totalQuestionCount - * The totalQuestionCount to set. - */ - public void setTotalQuestionCount(String totalQuestionCount) { - this.totalQuestionCount = totalQuestionCount; - } - - /** * @return Returns the listUserEntries. */ public List getListUserEntries() { @@ -429,8 +412,7 @@ .append("learningMode: ", learningMode).append("maxNominationCount: ", maxNominationCount) .append("allowTextEntry: ", allowTextEntry).append("showResults: ", showResults) .append("lockOnFinish: ", lockOnFinish).append("toolContentID: ", toolContentID) - .append("toolContentUID: ", toolContentUID).append("totalQuestionCount: ", totalQuestionCount) - .append("requestLearningReport: ", requestLearningReport) + .append("toolContentUID: ", toolContentUID).append("requestLearningReport: ", requestLearningReport) .append("requestLearningReportProgress: ", requestLearningReportProgress) .append("nominationsSubmited: ", nominationsSubmited) .append("mapGeneralCheckedOptionsContent: ", mapGeneralCheckedOptionsContent) Index: lams_tool_vote/src/java/org/lamsfoundation/lams/tool/vote/service/IVoteService.java =================================================================== diff -u -r5b17b810b5302c90b2daf6a5866bf4f6e85bef6a -r4d139bddc3cdd41d32d9f3033f2100c711d8c0c5 --- lams_tool_vote/src/java/org/lamsfoundation/lams/tool/vote/service/IVoteService.java (.../IVoteService.java) (revision 5b17b810b5302c90b2daf6a5866bf4f6e85bef6a) +++ lams_tool_vote/src/java/org/lamsfoundation/lams/tool/vote/service/IVoteService.java (.../IVoteService.java) (revision 4d139bddc3cdd41d32d9f3033f2100c711d8c0c5) @@ -22,8 +22,10 @@ package org.lamsfoundation.lams.tool.vote.service; +import java.util.Collection; import java.util.LinkedList; import java.util.List; +import java.util.Map; import java.util.Set; import javax.servlet.http.HttpServletRequest; @@ -105,28 +107,16 @@ VoteUsrAttempt getAttemptByUID(Long uid); - void createVoteQue(VoteQueContent voteQueContent); - - void createVoteSession(VoteSession voteSession); - void createVoteQueUsr(VoteQueUsr voteQueUsr); VoteQueUsr getVoteUserBySession(final Long queUsrId, final Long sessionUid); VoteQueUsr getUserByUserId(Long userId); - List getVoteUserBySessionUid(final Long voteSessionUid); - - int getCompletedVoteUserBySessionUid(final Long voteSessionUid); - VoteQueContent getQuestionByDisplayOrder(final Long displayOrder, final Long voteContentUid); Set getAttemptsForUserAndSessionUseOpenAnswer(final Long userUid, final Long sessionUid); - Set getSessionUserEntriesSet(final Long voteSessionUid); - - void createVoteUsrAttempt(VoteUsrAttempt voteUsrAttempt); - void updateVoteUsrAttempt(VoteUsrAttempt voteUsrAttempt); List getUserBySessionOnly(final VoteSession voteSession); @@ -135,37 +125,45 @@ void showOpenVote(VoteUsrAttempt voteUsrAttempt); - int getAttemptsForQuestionContent(final Long questionUid); - boolean studentActivityOccurredStandardAndOpen(VoteContent voteContent); int getUserEnteredVotesCountForContent(final Long voteContentUid); List getAttemptsForQuestionContentAndSessionUid(final Long questionUid, final Long voteSessionUid); - int getStandardAttemptsForQuestionContentAndSessionUid(final Long questionUid, final Long voteSessionId); - - int getSessionEntriesCount(final Long voteSessionId); - List getAttemptsForUserAndQuestionContent(final Long userUid, final Long questionUid); + + /** + * creates a new vote record in the database + */ + void createAttempt(VoteQueUsr voteQueUsr, Map mapGeneralCheckedOptionsContent, String userEntry, + VoteSession voteSession, Long voteContentUid); - VoteUsrAttempt getAttemptForUserAndQuestionContentAndSession(final Long queUsrId, final Long questionUid, - final Long toolSessionUid); - VoteQueContent getQuestionByUid(Long uid); void removeVoteQueContent(VoteQueContent voteQueContent); VoteQueContent getVoteQueContentByUID(Long uid); void saveOrUpdateVoteQueContent(VoteQueContent voteQueContent); - - List getStandardAttemptsByQuestionUid(final Long questionUid); - VoteQueContent getDefaultVoteContentFirstQuestion(); + VoteContent createQuestions(List questionDTOs, VoteContent voteContent); - VoteQueUsr getVoteUserByUID(Long uid); + /** + * Build a map of the display ids -> nomination text. If checkedOptions != null then only include the display ids in + * the checkedOptions list. + * + * @param request + * @param voteContent + * the content of the vote from the database + * @param checkedOptions + * collection of String display IDs to which to restrict the map (optional) + * @return Map of display id -> nomination text. + */ + Map buildQuestionMap(VoteContent voteContent, Collection checkedOptions); + List getStandardAttemptsByQuestionUid(final Long questionUid); + void updateVoteUser(VoteQueUsr voteUser); void removeAttemptsForUserandSession(final Long queUsrId, final Long sessionUid); @@ -176,34 +174,8 @@ void updateVote(VoteContent vote); - void updateVoteSession(VoteSession voteSession); - VoteSession getVoteSessionByUID(Long uid); - /** - * Get the count of all the potential learners for the vote session. This will include the people that have never - * logged into the lesson. Not great, but it is a better estimate of how many users there will be eventually than - * the number of people already known to the tool. - * - * @param voteSessionId - * The tool session id - */ - int getVoteSessionPotentialLearnersCount(Long voteSessionId); - - void deleteVote(VoteContent vote); - - void deleteVoteById(Long voteId); - - void deleteVoteSession(VoteSession voteSession); - - List getSessionNamesFromContent(VoteContent voteContent); - - void removeAttempt(VoteUsrAttempt attempt); - - void deleteVoteQueUsr(VoteQueUsr voteQueUsr); - - User getCurrentUserData(String username); - int getTotalNumberOfUsers(); void saveVoteContent(VoteContent vote); Index: lams_tool_vote/src/java/org/lamsfoundation/lams/tool/vote/service/VoteServicePOJO.java =================================================================== diff -u -r0cf80d736677826d89b04c4d957546975c678f24 -r4d139bddc3cdd41d32d9f3033f2100c711d8c0c5 --- lams_tool_vote/src/java/org/lamsfoundation/lams/tool/vote/service/VoteServicePOJO.java (.../VoteServicePOJO.java) (revision 0cf80d736677826d89b04c4d957546975c678f24) +++ lams_tool_vote/src/java/org/lamsfoundation/lams/tool/vote/service/VoteServicePOJO.java (.../VoteServicePOJO.java) (revision 4d139bddc3cdd41d32d9f3033f2100c711d8c0c5) @@ -23,6 +23,7 @@ package org.lamsfoundation.lams.tool.vote.service; import java.util.ArrayList; +import java.util.Collection; import java.util.Date; import java.util.Hashtable; import java.util.Iterator; @@ -31,12 +32,15 @@ import java.util.Map; import java.util.Set; import java.util.SortedMap; +import java.util.TimeZone; import java.util.TreeMap; import java.util.TreeSet; import java.util.Vector; import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpSession; +import org.apache.commons.lang.StringUtils; import org.apache.log4j.Logger; import org.lamsfoundation.lams.contentrepository.client.IToolContentHandler; import org.lamsfoundation.lams.learning.service.ILearnerService; @@ -49,6 +53,7 @@ import org.lamsfoundation.lams.notebook.service.CoreNotebookConstants; import org.lamsfoundation.lams.notebook.service.ICoreNotebookService; import org.lamsfoundation.lams.tool.IToolVO; +import org.lamsfoundation.lams.tool.SimpleURL; import org.lamsfoundation.lams.tool.ToolContentImport102Manager; import org.lamsfoundation.lams.tool.ToolContentManager; import org.lamsfoundation.lams.tool.ToolOutput; @@ -88,6 +93,8 @@ import org.lamsfoundation.lams.util.audit.IAuditService; import org.lamsfoundation.lams.util.wddx.WDDXProcessor; import org.lamsfoundation.lams.util.wddx.WDDXProcessorConversionException; +import org.lamsfoundation.lams.web.session.SessionManager; +import org.lamsfoundation.lams.web.util.AttributeNames; import org.springframework.dao.DataAccessException; /** @@ -118,7 +125,6 @@ private IDataFlowDAO dataFlowDAO; private MessageService messageService; - private ILamsCoreToolService lamsCoreToolService; public VoteServicePOJO() { } @@ -162,7 +168,7 @@ // set group leader session.setGroupLeader(leader); - this.updateVoteSession(session); + voteSessionDAO.updateVoteSession(session); } } @@ -197,7 +203,7 @@ if (userAttempt == null) { VoteUsrAttempt voteUsrAttempt = new VoteUsrAttempt(attempTime, timeZone, question, user, userEntry, true); - this.createVoteUsrAttempt(voteUsrAttempt); + voteUsrAttemptDAO.saveVoteUsrAttempt(voteUsrAttempt); // if it's been changed by the leader } else if (leaderAttempt.getAttemptTime().compareTo(userAttempt.getAttemptTime()) != 0) { @@ -214,7 +220,7 @@ // remove redundant ones for (VoteUsrAttempt redundantUserAttempt : userAttempts) { - this.removeAttempt(redundantUserAttempt); + voteUsrAttemptDAO.removeVoteUsrAttempt(redundantUserAttempt); } } @@ -227,8 +233,8 @@ int entriesCount = 0; Set userEntries = null; if (toolSessionUid != null) { - entriesCount = this.getSessionEntriesCount(toolSessionUid); - userEntries = this.getSessionUserEntriesSet(toolSessionUid); + entriesCount = voteUsrAttemptDAO.getSessionEntriesCount(toolSessionUid); + userEntries = voteUsrAttemptDAO.getSessionUserEntriesSet(toolSessionUid); } Long mapIndex = 1L; @@ -247,7 +253,7 @@ String noHTMLNomination = VoteUtils.stripHTML(question.getQuestion()); mapStandardNominationsContent.put(mapIndex, noHTMLNomination); - int votesCount = this.getStandardAttemptsForQuestionContentAndSessionUid(question.getUid(), toolSessionUid); + int votesCount = voteUsrAttemptDAO.getStandardAttemptsForQuestionContentAndSessionUid(question.getUid(), toolSessionUid); totalStandardVotesCount += votesCount; mapStandardUserCount.put(mapIndex, new Long(votesCount)); @@ -301,14 +307,14 @@ sessionDTO.setSessionId(session.getVoteSessionId().toString()); sessionDTO.setSessionName(session.getSession_name()); - int entriesCount = this.getSessionEntriesCount(session.getUid()); + int entriesCount = voteUsrAttemptDAO.getSessionEntriesCount(session.getUid()); // potentialUserCount int potentialUserCount = this.getVoteSessionPotentialLearnersCount(session.getUid()); sessionDTO.setSessionUserCount(potentialUserCount); // completedSessionUserCount - int completedSessionUserCount = this.getCompletedVoteUserBySessionUid(session.getUid()); + int completedSessionUserCount = voteUserDAO.getCompletedVoteUserBySessionUid(session.getUid()); sessionDTO.setCompletedSessionUserCount(completedSessionUserCount); Long mapIndex = 1L; @@ -323,7 +329,7 @@ for (VoteQueContent question : (Set) voteContent.getVoteQueContents()) { mapStandardNominationsHTMLedContent.put(mapIndex, question.getQuestion()); - int votesCount = this.getStandardAttemptsForQuestionContentAndSessionUid(question.getUid(), + int votesCount = voteUsrAttemptDAO.getStandardAttemptsForQuestionContentAndSessionUid(question.getUid(), session.getUid()); totalStandardVotesCount += votesCount; mapStandardUserCount.put(mapIndex, new Long(votesCount)); @@ -449,6 +455,26 @@ return sessionDTOs; } + /** + * Get the count of all the potential learners for the vote session. This will include the people that have never + * logged into the lesson. Not great, but it is a better estimate of how many users there will be eventually than + * the number of people already known to the tool. + * + * @param voteSessionId + * The tool session id + */ + private int getVoteSessionPotentialLearnersCount(Long sessionUid) { + VoteSession session = voteSessionDAO.getVoteSessionByUID(sessionUid); + if (session != null) { + Set potentialLearners = toolService.getAllPotentialLearners(session.getVoteSessionId().longValue()); + return potentialLearners != null ? potentialLearners.size() : 0; + } else { + VoteServicePOJO.logger + .error("Unable to find vote session record id=" + sessionUid + ". Returning 0 users."); + return 0; + } + } + @Override public List getOpenVotes(Long voteContentUid, Long currentSessionId, Long userId) { Set userEntries = voteUsrAttemptDAO.getUserEntries(voteContentUid); @@ -591,10 +617,6 @@ return voteContentDAO.getVoteContentByContentId(toolContentID); } - public void updateVoteContent(VoteContent voteContent) { - voteContentDAO.updateVoteContent(voteContent); - } - public VoteQueContent getQuestionByDisplayOrder(final Long displayOrder, final Long voteContentUid) { return voteQueContentDAO.getQuestionByDisplayOrder(displayOrder, voteContentUid); } @@ -604,10 +626,6 @@ return voteQueUsr; } - public void createVoteQue(VoteQueContent voteQueContent) { - voteQueContentDAO.saveQuestion(voteQueContent); - } - public List getAttemptsForQuestionContentAndSessionUid(final Long questionUid, final Long voteSessionUid) { return voteUsrAttemptDAO.getAttemptsForQuestionContentAndSessionUid(questionUid, voteSessionUid); @@ -621,10 +639,7 @@ return voteUsrAttemptDAO.getAttemptsForUserAndSession(queUsrUid, sessionUid); } - public Set getSessionUserEntriesSet(final Long voteSessionUid) { - return voteUsrAttemptDAO.getSessionUserEntriesSet(voteSessionUid); - } - + @Override public VoteQueContent getVoteQueContentByUID(Long uid) { if (uid == null) { return null; @@ -633,153 +648,376 @@ return voteQueContentDAO.getQuestionByUid(uid); } + @Override public void saveOrUpdateVoteQueContent(VoteQueContent voteQueContent) { voteQueContentDAO.saveOrUpdateQuestion(voteQueContent); } + + @Override + public VoteContent createQuestions(List questionDTOs, VoteContent voteContent) { - public List getUserBySessionOnly(final VoteSession voteSession) { - return voteUserDAO.getUserBySessionOnly(voteSession); - } + int displayOrder = 0; + for (VoteQuestionDTO questionDTO : questionDTOs) { + String currentQuestionText = questionDTO.getQuestion(); - public void createVoteSession(VoteSession voteSession) { - voteSessionDAO.saveVoteSession(voteSession); + // skip empty questions + if (currentQuestionText.isEmpty()) { + continue; + } + + ++displayOrder; + + VoteQueContent question = getVoteQueContentByUID(questionDTO.getUid()); + + // in case question doesn't exist + if (question == null) { + + question = new VoteQueContent(currentQuestionText, displayOrder, voteContent); + // adding a new question to content + voteContent.getVoteQueContents().add(question); + question.setVoteContent(voteContent); + + // in case question exists already + } else { + + question.setQuestion(currentQuestionText); + question.setDisplayOrder(displayOrder); + } + + saveOrUpdateVoteQueContent(question); + } + + return voteContent; } + + @Override + public Map buildQuestionMap(VoteContent voteContent, Collection checkedOptions) { + Map mapQuestionsContent = new TreeMap(new VoteComparator()); + Set questions = voteContent.getVoteQueContents(); + + // should we add questions from data flow from other activities? + if (Boolean.TRUE.equals(voteContent.getAssignedDataFlowObject()) + && (voteContent.getMaxExternalInputs() == null || voteContent.getExternalInputsAdded() == null || voteContent + .getExternalInputsAdded() < voteContent.getMaxExternalInputs())) { + // If we are using tool input, we need to get it now and + // create questions. Once they are created, they will be not altered, no matter if another learner gets to + // this point and the tool input changed + HttpSession ss = SessionManager.getSession(); + UserDTO toolUser = (UserDTO) ss.getAttribute(AttributeNames.USER); + long userId = toolUser.getUserID().longValue(); - public VoteSession getVoteSessionByUID(Long uid) { - return voteSessionDAO.getVoteSessionByUID(uid); + // We get whatever the source tool provides us with and try to create questions out of it + ToolOutput toolInput = getToolInput(voteContent.getVoteContentId(), new Long(userId).intValue()); + + Object value = toolInput.getValue().getComplex(); + short inputsAdded = voteContent.getExternalInputsAdded() == null ? 0 : voteContent.getExternalInputsAdded(); + Short maxInputs = voteContent.getMaxExternalInputs(); + Set existingNominations = voteContent.getVoteQueContents(); + // The input is an array (users) of arrays of strings (their answers) + if (value instanceof String[][]) { + if (value != null) { + String[][] usersAndAnswers = (String[][]) value; + int nominationIndex = voteContent.getVoteQueContents().size() + 1; + for (String[] userAnswers : usersAndAnswers) { + if (userAnswers != null) { + if (maxInputs != null && inputsAdded >= maxInputs) { + // if we reached the maximum number of inputs, i.e. number of students that will be + // taken + // into account + break; + } + boolean anyAnswersAdded = false; + for (String questionText : userAnswers) { + if (!StringUtils.isBlank(questionText)) { + VoteQueContent nomination = new VoteQueContent(); + nomination.setDisplayOrder(nominationIndex); + nomination.setMcContent(voteContent); + nomination.setQuestion(questionText); + if (!isNominationExists(nomination, existingNominations)) { + saveOrUpdateVoteQueContent(nomination); + voteContent.getVoteQueContents().add(nomination); + nominationIndex++; + anyAnswersAdded = true; + } + } + } + if (anyAnswersAdded) { + inputsAdded++; + } + } + } + } + } else if (value instanceof String[]) { + // the input is a list of strings (questions, for example) + int nominationIndex = voteContent.getVoteQueContents().size() + 1; + String[] userAnswers = (String[]) value; + for (String questionText : userAnswers) { + if (maxInputs != null && inputsAdded >= maxInputs) { + // if we reached the maximum number of inputs, i.e. number of students that will be taken + // into account + break; + } + + if (!StringUtils.isBlank(questionText)) { + VoteQueContent nomination = new VoteQueContent(); + nomination.setDisplayOrder(nominationIndex); + nomination.setMcContent(voteContent); + nomination.setQuestion(questionText); + if (!isNominationExists(nomination, existingNominations)) { + saveOrUpdateVoteQueContent(nomination); + voteContent.getVoteQueContents().add(nomination); + nominationIndex++; + inputsAdded++; + } + } + } + } else if (value instanceof String && !StringUtils.isBlank((String) value)) { + int nominationIndex = voteContent.getVoteQueContents().size() + 1; + VoteQueContent nomination = new VoteQueContent(); + nomination.setDisplayOrder(nominationIndex); + nomination.setMcContent(voteContent); + nomination.setQuestion((String) value); + if (!isNominationExists(nomination, existingNominations)) { + saveOrUpdateVoteQueContent(nomination); + voteContent.getVoteQueContents().add(nomination); + } + } + if (value instanceof SimpleURL[][]) { + if (value != null) { + SimpleURL[][] usersAndUrls = (SimpleURL[][]) value; + int nominationIndex = voteContent.getVoteQueContents().size() + 1; + for (SimpleURL[] userUrls : usersAndUrls) { + if (userUrls != null) { + if (maxInputs != null && inputsAdded >= maxInputs) { + // if we reached the maximum number of inputs, i.e. number of students that will be + // taken + // into account + break; + } + boolean anyAnswersAdded = false; + for (SimpleURL url : userUrls) { + if (url != null) { + VoteQueContent nomination = new VoteQueContent(); + nomination.setDisplayOrder(nominationIndex); + nomination.setMcContent(voteContent); + + String link = "" + url.getNameToDisplay() + ""; + nomination.setQuestion(link); + if (!isNominationExists(nomination, existingNominations)) { + saveOrUpdateVoteQueContent(nomination); + voteContent.getVoteQueContents().add(nomination); + nominationIndex++; + anyAnswersAdded = true; + } + } + } + if (anyAnswersAdded) { + inputsAdded++; + } + } + } + } + } + + else if (value instanceof SimpleURL[]) { + // the input is a list of strings (questions, for example) + int nominationIndex = voteContent.getVoteQueContents().size() + 1; + SimpleURL[] userUrls = (SimpleURL[]) value; + for (SimpleURL url : userUrls) { + if (maxInputs != null && inputsAdded >= maxInputs) { + // if we reached the maximum number of inputs, i.e. number of students that will be taken + // into account + break; + } + if (url != null) { + VoteQueContent nomination = new VoteQueContent(); + nomination.setDisplayOrder(nominationIndex); + nomination.setMcContent(voteContent); + + String link = "" + url.getNameToDisplay() + ""; + nomination.setQuestion(link); + if (!isNominationExists(nomination, existingNominations)) { + saveOrUpdateVoteQueContent(nomination); + voteContent.getVoteQueContents().add(nomination); + nominationIndex++; + inputsAdded++; + } + } + } + } else if (value instanceof SimpleURL) { + int nominationIndex = voteContent.getVoteQueContents().size() + 1; + VoteQueContent nomination = new VoteQueContent(); + nomination.setDisplayOrder(nominationIndex); + + SimpleURL url = (SimpleURL) value; + String link = "" + url.getNameToDisplay() + ""; + nomination.setQuestion(link); + if (!isNominationExists(nomination, existingNominations)) { + nomination.setMcContent(voteContent); + saveOrUpdateVoteQueContent(nomination); + voteContent.getVoteQueContents().add(nomination); + } + } + + voteContent.setExternalInputsAdded(inputsAdded); + saveVoteContent(voteContent); + questions = voteContent.getVoteQueContents(); + } + + for (VoteQueContent question : questions) { + String displayOrder = "" + question.getDisplayOrder(); + if ((checkedOptions == null || checkedOptions.contains(displayOrder)) && !displayOrder.equals("0")) { + /* add the question to the questions Map in the displayOrder */ + mapQuestionsContent.put(displayOrder.toString(), question.getQuestion()); + } + } + + return mapQuestionsContent; } - public int getVoteSessionPotentialLearnersCount(Long sessionUid) { - VoteSession session = voteSessionDAO.getVoteSessionByUID(sessionUid); - if (session != null) { - Set potentialLearners = toolService.getAllPotentialLearners(session.getVoteSessionId().longValue()); - return potentialLearners != null ? potentialLearners.size() : 0; - } else { - VoteServicePOJO.logger - .error("Unable to find vote session record id=" + sessionUid + ". Returning 0 users."); - return 0; + private static boolean isNominationExists(VoteQueContent nomination, Set existingNominations) { + if (existingNominations != null && nomination != null) { + for (VoteQueContent existingNomination : existingNominations) { + if (existingNomination.getQuestion() != null + && existingNomination.getQuestion().equals(nomination.getQuestion())) { + return true; + } + } } + return false; } + @Override + public List getUserBySessionOnly(final VoteSession voteSession) { + return voteUserDAO.getUserBySessionOnly(voteSession); + } + + @Override + public VoteSession getVoteSessionByUID(Long uid) { + return voteSessionDAO.getVoteSessionByUID(uid); + } + + @Override public void createVoteQueUsr(VoteQueUsr voteQueUsr) { voteUserDAO.saveVoteUser(voteQueUsr); } + @Override public VoteQueUsr getVoteUserBySession(final Long queUsrId, final Long sessionUid) { return voteUserDAO.getVoteUserBySession(queUsrId, sessionUid); } - public VoteQueUsr getVoteUserByUID(Long uid) { - return voteUserDAO.getVoteUserByUID(uid); - } - + @Override public void updateVoteUser(VoteQueUsr voteUser) { voteUserDAO.updateVoteUser(voteUser); } + @Override public VoteQueUsr getUserByUserId(Long userID) { VoteQueUsr voteQueUsr = voteUserDAO.getUserByUserId(userID); return voteQueUsr; } - public void createVoteUsrAttempt(VoteUsrAttempt voteUsrAttempt) { - voteUsrAttemptDAO.saveVoteUsrAttempt(voteUsrAttempt); - } - + @Override public List getStandardAttemptsByQuestionUid(final Long voteQueContentId) { return voteUsrAttemptDAO.getStandardAttemptsByQuestionUid(voteQueContentId); } - public int getSessionEntriesCount(final Long voteSessionUid) { - return voteUsrAttemptDAO.getSessionEntriesCount(voteSessionUid); - } - + @Override public VoteUsrAttempt getAttemptByUID(Long uid) { return voteUsrAttemptDAO.getAttemptByUID(uid); } - public int getAttemptsForQuestionContent(final Long voteQueContentId) { - return voteUsrAttemptDAO.getAttemptsForQuestionContent(voteQueContentId); - } - - public int getStandardAttemptsForQuestionContentAndSessionUid(final Long voteQueContentId, final Long voteSessionUid) { - return voteUsrAttemptDAO.getStandardAttemptsForQuestionContentAndSessionUid(voteQueContentId, voteSessionUid); - } - - public VoteUsrAttempt getAttemptForUserAndQuestionContentAndSession(final Long queUsrId, - final Long voteQueContentId, final Long toolSessionUid) { - return voteUsrAttemptDAO.getAttemptForUserAndQuestionContentAndSession(queUsrId, voteQueContentId, - toolSessionUid); - } - + @Override public void updateVoteUsrAttempt(VoteUsrAttempt voteUsrAttempt) { voteUsrAttemptDAO.updateVoteUsrAttempt(voteUsrAttempt); } + @Override public void removeAttemptsForUserandSession(final Long queUsrId, final Long sessionUid) { voteUsrAttemptDAO.removeAttemptsForUserandSession(queUsrId, sessionUid); } + @Override public List getAttemptsForUser(final Long userUid) { return voteUsrAttemptDAO.getAttemptsForUser(userUid); } + + @Override + public void createAttempt(VoteQueUsr voteQueUsr, Map mapGeneralCheckedOptionsContent, String userEntry, + VoteSession voteSession, Long voteContentUid) { + Date attempTime = new Date(System.currentTimeMillis()); + String timeZone = TimeZone.getDefault().getDisplayName(); + + //in case of free entry + if (mapGeneralCheckedOptionsContent.size() == 0) { + VoteQueContent defaultContentFirstQuestion = voteQueContentDAO.getDefaultVoteContentFirstQuestion(); + createAttempt(defaultContentFirstQuestion, voteQueUsr, attempTime, timeZone, userEntry, voteSession); + + //if the question is selected + } else if (voteContentUid != null) { + Iterator itCheckedMap = mapGeneralCheckedOptionsContent.entrySet().iterator(); + while (itCheckedMap.hasNext()) { + Map.Entry checkedPairs = (Map.Entry) itCheckedMap.next(); + Long questionDisplayOrder = new Long(checkedPairs.getKey().toString()); + + VoteQueContent question = getQuestionByDisplayOrder(questionDisplayOrder, voteContentUid); + createAttempt(question, voteQueUsr, attempTime, timeZone, userEntry, voteSession); + } + } + + } + + private void createAttempt(VoteQueContent question, VoteQueUsr user, Date attempTime, String timeZone, + String userEntry, VoteSession session) { + + if (question != null) { + VoteUsrAttempt existingAttempt = voteUsrAttemptDAO.getAttemptForUserAndQuestionContentAndSession( + user.getQueUsrId(), question.getVoteContentId(), session.getUid()); + + if (existingAttempt != null) { + existingAttempt.setUserEntry(userEntry); + existingAttempt.setAttemptTime(attempTime); + existingAttempt.setTimeZone(timeZone); + updateVoteUsrAttempt(existingAttempt); + } else { + VoteUsrAttempt voteUsrAttempt = new VoteUsrAttempt(attempTime, timeZone, question, user, userEntry, + true); + voteUsrAttemptDAO.saveVoteUsrAttempt(voteUsrAttempt); + } + } + } + + @Override public int getUserEnteredVotesCountForContent(final Long voteContentUid) { return voteUsrAttemptDAO.getUserEnteredVotesCountForContent(voteContentUid); } + @Override public VoteQueContent getQuestionByUid(Long uid) { return voteQueContentDAO.getQuestionByUid(uid); } + @Override public void removeVoteQueContent(VoteQueContent voteQueContent) { voteQueContentDAO.removeQuestion(voteQueContent); } + @Override public VoteSession getSessionBySessionId(Long voteSessionId) { return voteSessionDAO.getSessionBySessionId(voteSessionId); } - public int getCompletedVoteUserBySessionUid(final Long voteSessionUid) { - return voteUserDAO.getCompletedVoteUserBySessionUid(voteSessionUid); - } - - public List getVoteUserBySessionUid(final Long voteSessionUid) { - return voteUserDAO.getVoteUserBySessionUid(voteSessionUid); - } - - public List getSessionNamesFromContent(VoteContent voteContent) { - return voteSessionDAO.getSessionNamesFromContent(voteContent); - } - + @Override public void updateVote(VoteContent vote) { voteContentDAO.updateVoteContent(vote); } - public void updateVoteSession(VoteSession voteSession) { - voteSessionDAO.updateVoteSession(voteSession); - } - - public void deleteVote(VoteContent vote) { - voteContentDAO.removeVote(vote); - } - - public void deleteVoteById(Long voteId) { - voteContentDAO.removeVoteById(voteId); - } - public int countSessionComplete() { return voteSessionDAO.countSessionComplete(); } - public void deleteVoteSession(VoteSession voteSession) { - voteSessionDAO.removeVoteSession(voteSession); - } - - public void removeAttempt(VoteUsrAttempt attempt) { - voteUsrAttemptDAO.removeVoteUsrAttempt(attempt); - } - /** * logs hiding of a user entered vote */ @@ -796,39 +1034,21 @@ .getVoteQueUsr().getUsername(), voteUsrAttempt.getUserEntry()); } - public void deleteVoteQueUsr(VoteQueUsr voteQueUsr) { - try { - voteUserDAO.removeVoteUser(voteQueUsr); - } catch (DataAccessException e) { - throw new VoteApplicationException("Exception occured when lams is removing" + " the user: " - + e.getMessage(), e); - } - } - + @Override public void saveVoteContent(VoteContent vote) { voteContentDAO.saveVoteContent(vote); } + @Override public List getSessionsFromContent(VoteContent voteContent) { return voteSessionDAO.getSessionsFromContent(voteContent); } + @Override public int getTotalNumberOfUsers() { return voteUserDAO.getTotalNumberOfUsers(); } - public User getCurrentUserData(String username) { - /** - * this will return null if the username not found - */ - User user = userManagementService.getUserByLogin(username); - if (user == null) { - VoteServicePOJO.logger.error("No user with the username: " + username + " exists."); - throw new VoteApplicationException("No user with that username exists."); - } - return user; - } - @Override public List getAttemptsForUserAndQuestionContent(final Long userUid, final Long questionUid) { try { @@ -984,7 +1204,7 @@ Iterator sessionUsersAttemptsIterator = voteQueUsr.getVoteUsrAttempts().iterator(); while (sessionUsersAttemptsIterator.hasNext()) { VoteUsrAttempt voteUsrAttempt = (VoteUsrAttempt) sessionUsersAttemptsIterator.next(); - removeAttempt(voteUsrAttempt); + voteUsrAttemptDAO.removeVoteUsrAttempt(voteUsrAttempt); } } } @@ -1201,12 +1421,6 @@ contentId = toolService.getToolDefaultContentIdBySignature(toolSignature); return contentId; } - - @Override - public VoteQueContent getDefaultVoteContentFirstQuestion() { - VoteQueContent voteQueContent = voteQueContentDAO.getDefaultVoteContentFirstQuestion(); - return voteQueContent; - } @Override public List getToolSessionsForContent(VoteContent vote) { @@ -1615,10 +1829,6 @@ this.messageService = messageService; } - public void setLamsCoreToolService(ILamsCoreToolService lamsCoreToolService) { - this.lamsCoreToolService = lamsCoreToolService; - } - public void removeQuestionsFromCache(VoteContent voteContent) { voteContentDAO.removeQuestionsFromCache(voteContent); } Index: lams_tool_vote/src/java/org/lamsfoundation/lams/tool/vote/voteApplicationContext.xml =================================================================== diff -u -r40eb54374e84591563d8b6a679ac719dbc85c8f7 -r4d139bddc3cdd41d32d9f3033f2100c711d8c0c5 --- lams_tool_vote/src/java/org/lamsfoundation/lams/tool/vote/voteApplicationContext.xml (.../voteApplicationContext.xml) (revision 40eb54374e84591563d8b6a679ac719dbc85c8f7) +++ lams_tool_vote/src/java/org/lamsfoundation/lams/tool/vote/voteApplicationContext.xml (.../voteApplicationContext.xml) (revision 4d139bddc3cdd41d32d9f3033f2100c711d8c0c5) @@ -73,13 +73,13 @@ - PROPAGATION_REQUIRED,-VoteApplicationException + PROPAGATION_REQUIRED,-VoteApplicationException PROPAGATION_REQUIRED,-VoteApplicationException PROPAGATION_REQUIRED, -VoteApplicationException PROPAGATION_REQUIRED,-VoteApplicationException Index: lams_tool_vote/src/java/org/lamsfoundation/lams/tool/vote/web/AuthoringUtil.java =================================================================== diff -u -r5b17b810b5302c90b2daf6a5866bf4f6e85bef6a -r4d139bddc3cdd41d32d9f3033f2100c711d8c0c5 --- lams_tool_vote/src/java/org/lamsfoundation/lams/tool/vote/web/AuthoringUtil.java (.../AuthoringUtil.java) (revision 5b17b810b5302c90b2daf6a5866bf4f6e85bef6a) +++ lams_tool_vote/src/java/org/lamsfoundation/lams/tool/vote/web/AuthoringUtil.java (.../AuthoringUtil.java) (revision 4d139bddc3cdd41d32d9f3033f2100c711d8c0c5) @@ -303,41 +303,6 @@ return voteContent; } - protected static VoteContent createQuestions(List questionDTOs, IVoteService voteService, - VoteContent voteContent) { - int displayOrder = 0; - for (VoteQuestionDTO questionDTO : questionDTOs) { - String currentQuestionText = questionDTO.getQuestion(); - // skip empty questions - if (currentQuestionText.isEmpty()) { - continue; - } - - ++displayOrder; - - VoteQueContent question = voteService.getVoteQueContentByUID(questionDTO.getUid()); - - // in case question doesn't exist - if (question == null) { - - question = new VoteQueContent(currentQuestionText, displayOrder, voteContent); - // adding a new question to content - voteContent.getVoteQueContents().add(question); - question.setVoteContent(voteContent); - - // in case question exists already - } else { - - question.setQuestion(currentQuestionText); - question.setDisplayOrder(displayOrder); - } - - voteService.saveOrUpdateVoteQueContent(question); - } - - return voteContent; - } - } Fisheye: Tag 4d139bddc3cdd41d32d9f3033f2100c711d8c0c5 refers to a dead (removed) revision in file `lams_tool_vote/src/java/org/lamsfoundation/lams/tool/vote/web/LearningUtil.java'. Fisheye: No comparison available. Pass `N' to diff? Index: lams_tool_vote/src/java/org/lamsfoundation/lams/tool/vote/web/VoteAction.java =================================================================== diff -u -r5b17b810b5302c90b2daf6a5866bf4f6e85bef6a -r4d139bddc3cdd41d32d9f3033f2100c711d8c0c5 --- lams_tool_vote/src/java/org/lamsfoundation/lams/tool/vote/web/VoteAction.java (.../VoteAction.java) (revision 5b17b810b5302c90b2daf6a5866bf4f6e85bef6a) +++ lams_tool_vote/src/java/org/lamsfoundation/lams/tool/vote/web/VoteAction.java (.../VoteAction.java) (revision 4d139bddc3cdd41d32d9f3033f2100c711d8c0c5) @@ -757,7 +757,7 @@ voteContentTest, strToolContentID); //store questions - voteContent = AuthoringUtil.createQuestions(questionDTOs, voteService, voteContent); + voteContent = voteService.createQuestions(questionDTOs, voteContent); //store DataFlowObjectAssigment voteService.saveDataFlowObjectAssigment(assignedDataFlowObject); Index: lams_tool_vote/src/java/org/lamsfoundation/lams/tool/vote/web/VoteLearningAction.java =================================================================== diff -u -r5b17b810b5302c90b2daf6a5866bf4f6e85bef6a -r4d139bddc3cdd41d32d9f3033f2100c711d8c0c5 --- lams_tool_vote/src/java/org/lamsfoundation/lams/tool/vote/web/VoteLearningAction.java (.../VoteLearningAction.java) (revision 5b17b810b5302c90b2daf6a5866bf4f6e85bef6a) +++ lams_tool_vote/src/java/org/lamsfoundation/lams/tool/vote/web/VoteLearningAction.java (.../VoteLearningAction.java) (revision 4d139bddc3cdd41d32d9f3033f2100c711d8c0c5) @@ -417,29 +417,26 @@ voteService.removeAttemptsForUserandSession(user.getUid(), session.getUid()); /* to minimize changes to working code, convert the String[] array to the mapGeneralCheckedOptionsContent structure */ - Map mapGeneralCheckedOptionsContent = LearningUtil.buildQuestionMap(request, voteService, voteContent, + Map mapGeneralCheckedOptionsContent = voteService.buildQuestionMap(voteContent, voteDisplayOrderIds); if (mapGeneralCheckedOptionsContent.size() > 0) { - LearningUtil.createAttempt(voteService, user, mapGeneralCheckedOptionsContent, "", session, - voteContentUid); + voteService.createAttempt(user, mapGeneralCheckedOptionsContent, "", session, voteContentUid); } if ((mapGeneralCheckedOptionsContent.size() == 0 && (userEntryAvailable == true))) { Map mapLeanerCheckedOptionsContent = new TreeMap(new VoteComparator()); if (userEntry.length() > 0) { - LearningUtil.createAttempt(voteService, user, mapLeanerCheckedOptionsContent, userEntry, - session, voteContentUid); + voteService.createAttempt(user, mapLeanerCheckedOptionsContent, userEntry, session, voteContentUid); } } if ((mapGeneralCheckedOptionsContent.size() > 0) && (userEntryAvailable == true)) { Map mapLeanerCheckedOptionsContent = new TreeMap(new VoteComparator()); if (userEntry.length() > 0) { - LearningUtil.createAttempt(voteService, user, mapLeanerCheckedOptionsContent, userEntry, - session, voteContentUid); + voteService.createAttempt(user, mapLeanerCheckedOptionsContent, userEntry, session, voteContentUid); } } @@ -495,7 +492,7 @@ voteGeneralLearnerFlowDTO.setNominationsSubmited(new Boolean(false).toString()); voteGeneralLearnerFlowDTO.setMaxNominationCountReached(new Boolean(false).toString()); - Map mapQuestionsContent = LearningUtil.buildQuestionMap(request, voteService, voteContent, null); + Map mapQuestionsContent = voteService.buildQuestionMap(voteContent, null); request.setAttribute(MAP_QUESTION_CONTENT_LEARNER, mapQuestionsContent); Map mapGeneralCheckedOptionsContent = new TreeMap(new VoteComparator()); Index: lams_tool_vote/src/java/org/lamsfoundation/lams/tool/vote/web/VoteLearningStarterAction.java =================================================================== diff -u -r5b17b810b5302c90b2daf6a5866bf4f6e85bef6a -r4d139bddc3cdd41d32d9f3033f2100c711d8c0c5 --- lams_tool_vote/src/java/org/lamsfoundation/lams/tool/vote/web/VoteLearningStarterAction.java (.../VoteLearningStarterAction.java) (revision 5b17b810b5302c90b2daf6a5866bf4f6e85bef6a) +++ lams_tool_vote/src/java/org/lamsfoundation/lams/tool/vote/web/VoteLearningStarterAction.java (.../VoteLearningStarterAction.java) (revision 4d139bddc3cdd41d32d9f3033f2100c711d8c0c5) @@ -170,13 +170,10 @@ voteGeneralLearnerFlowDTO.setNotebookEntry(notebookEntry.getEntry()); } - request.setAttribute(VoteAppConstants.VOTE_GENERAL_LEARNER_FLOW_DTO, voteGeneralLearnerFlowDTO); + Map mapQuestions = voteService.buildQuestionMap(voteContent, null); + request.setAttribute(VoteAppConstants.MAP_QUESTION_CONTENT_LEARNER, mapQuestions); - /* handle PREVIEW mode */ - if (mode != null && mode.equals("author")) { - commonContentSetup(request, voteService, voteContent, voteGeneralLearnerFlowDTO); - request.setAttribute(VoteAppConstants.VOTE_GENERAL_LEARNER_FLOW_DTO, voteGeneralLearnerFlowDTO); - } + request.setAttribute(VoteAppConstants.VOTE_GENERAL_LEARNER_FLOW_DTO, voteGeneralLearnerFlowDTO); VoteQueUsr user = null; if ((mode != null) && mode.equals(ToolAccessMode.TEACHER.toString())) { @@ -270,12 +267,6 @@ } /* - * fetch question content from content - */ - Map mapQuestions = LearningUtil.buildQuestionMap(request, voteService, voteContent, null); - request.setAttribute(VoteAppConstants.MAP_QUESTION_CONTENT_LEARNER, mapQuestions); - - /* * the user's session id AND user id exists in the tool tables goto this screen if the OverAll Results scren has * been already called up by this user */ @@ -364,21 +355,6 @@ } /** - * sets up question and candidate answers maps commonContentSetup(HttpServletRequest request, VoteContent - * voteContent) - * - * @param request - * @param voteContent - */ - protected void commonContentSetup(HttpServletRequest request, IVoteService voteService, VoteContent voteContent, - VoteGeneralLearnerFlowDTO voteGeneralLearnerFlowDTO) { - Map mapQuestionsContent = LearningUtil.buildQuestionMap(request, voteService, voteContent, null); - - request.setAttribute(VoteAppConstants.MAP_QUESTION_CONTENT_LEARNER, mapQuestionsContent); - voteGeneralLearnerFlowDTO.setTotalQuestionCount(new Long(mapQuestionsContent.size()).toString()); - } - - /** * sets up session scope attributes based on content linked to the passed tool session id * setupAttributes(HttpServletRequest request, VoteContent voteContent) * Index: lams_tool_vote/web/authoring/pedagogicalPlannerForm.jsp =================================================================== diff -u -r35a0e719d061c08b52e705135bb2f2126079ed21 -r4d139bddc3cdd41d32d9f3033f2100c711d8c0c5 --- lams_tool_vote/web/authoring/pedagogicalPlannerForm.jsp (.../pedagogicalPlannerForm.jsp) (revision 35a0e719d061c08b52e705135bb2f2126079ed21) +++ lams_tool_vote/web/authoring/pedagogicalPlannerForm.jsp (.../pedagogicalPlannerForm.jsp) (revision 4d139bddc3cdd41d32d9f3033f2100c711d8c0c5) @@ -78,13 +78,12 @@

- + toolbarSet="CustomPedplanner" height="150px" + width="${param.plannerCKEditorLongWidth}" displayExpanded="false"> - +

Index: lams_tool_vote/web/learning/AllNominations.jsp =================================================================== diff -u -ra93d2b61cf24814e3afc91d5cc6887bf7a5bf05c -r4d139bddc3cdd41d32d9f3033f2100c711d8c0c5 --- lams_tool_vote/web/learning/AllNominations.jsp (.../AllNominations.jsp) (revision a93d2b61cf24814e3afc91d5cc6887bf7a5bf05c) +++ lams_tool_vote/web/learning/AllNominations.jsp (.../AllNominations.jsp) (revision 4d139bddc3cdd41d32d9f3033f2100c711d8c0c5) @@ -1,27 +1,5 @@ -<%-- -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"%> @@ -159,14 +137,12 @@ - - + + -  ( +  ( ) - + @@ -189,8 +165,8 @@ - + +
@@ -201,20 +177,17 @@ - - - - - - - + + + + + + -
- +
@@ -224,7 +197,6 @@ -

@@ -237,7 +209,6 @@ -
Index: lams_tool_vote/web/learning/AnswersContent.jsp =================================================================== diff -u -r43437f9c52f60b4fe545162b3ed72e6ddf911777 -r4d139bddc3cdd41d32d9f3033f2100c711d8c0c5 --- lams_tool_vote/web/learning/AnswersContent.jsp (.../AnswersContent.jsp) (revision 43437f9c52f60b4fe545162b3ed72e6ddf911777) +++ lams_tool_vote/web/learning/AnswersContent.jsp (.../AnswersContent.jsp) (revision 4d139bddc3cdd41d32d9f3033f2100c711d8c0c5) @@ -1,27 +1,5 @@ -<%-- -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"%> @@ -222,9 +200,9 @@
- - - + + +
Index: lams_tool_vote/web/learning/ExitLearning.jsp =================================================================== diff -u -r43437f9c52f60b4fe545162b3ed72e6ddf911777 -r4d139bddc3cdd41d32d9f3033f2100c711d8c0c5 --- lams_tool_vote/web/learning/ExitLearning.jsp (.../ExitLearning.jsp) (revision 43437f9c52f60b4fe545162b3ed72e6ddf911777) +++ lams_tool_vote/web/learning/ExitLearning.jsp (.../ExitLearning.jsp) (revision 4d139bddc3cdd41d32d9f3033f2100c711d8c0c5) @@ -1,27 +1,5 @@ -<%-- -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"%> @@ -38,8 +16,7 @@ <fmt:message key="activity.title" /> - + @@ -65,8 +42,7 @@

- +

@@ -113,40 +89,39 @@ - -

- -

+ +

+ +

- -
+ +
- +
- - - - - + + + + + -
- - - - - - - - - - +
+ + + + + + + + + + - -
- +
+
+
Index: lams_tool_vote/web/learning/IndividualLearnerResults.jsp =================================================================== diff -u -r43437f9c52f60b4fe545162b3ed72e6ddf911777 -r4d139bddc3cdd41d32d9f3033f2100c711d8c0c5 --- lams_tool_vote/web/learning/IndividualLearnerResults.jsp (.../IndividualLearnerResults.jsp) (revision 43437f9c52f60b4fe545162b3ed72e6ddf911777) +++ lams_tool_vote/web/learning/IndividualLearnerResults.jsp (.../IndividualLearnerResults.jsp) (revision 4d139bddc3cdd41d32d9f3033f2100c711d8c0c5) @@ -1,24 +1,3 @@ -<%-- -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"%> @@ -54,9 +33,9 @@

-
- -
+
+ +
@@ -89,18 +68,14 @@

- - +

    - +
  • - -
    @@ -112,17 +87,14 @@
    - + - - + @@ -158,7 +130,6 @@
    - Index: lams_tool_vote/web/learning/Notebook.jsp =================================================================== diff -u -r43437f9c52f60b4fe545162b3ed72e6ddf911777 -r4d139bddc3cdd41d32d9f3033f2100c711d8c0c5 --- lams_tool_vote/web/learning/Notebook.jsp (.../Notebook.jsp) (revision 43437f9c52f60b4fe545162b3ed72e6ddf911777) +++ lams_tool_vote/web/learning/Notebook.jsp (.../Notebook.jsp) (revision 4d139bddc3cdd41d32d9f3033f2100c711d8c0c5) @@ -1,27 +1,5 @@ -<%-- -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"%> @@ -35,12 +13,10 @@ - <fmt:message key="activity.title" /> - + <fmt:message key="activity.title" /> + @@ -50,8 +27,7 @@