Index: lams_tool_lamc/db/sql/insert_lams_tool_lamc.sql =================================================================== diff -u -rb729587d2ebffa80f02239e91bc80352869d311a -rb9d979e7f1478db56c700664c515c4036557f29f --- lams_tool_lamc/db/sql/insert_lams_tool_lamc.sql (.../insert_lams_tool_lamc.sql) (revision b729587d2ebffa80f02239e91bc80352869d311a) +++ lams_tool_lamc/db/sql/insert_lams_tool_lamc.sql (.../insert_lams_tool_lamc.sql) (revision b9d979e7f1478db56c700664c515c4036557f29f) @@ -70,37 +70,3 @@ -INSERT INTO tl_lamc11_options_content ( - uid, - correct_option, - mc_que_content_id, - mc_que_option_text -) -VALUES ( - null, - 0, - 1, - 'sample answer 2'); - - - -INSERT INTO tl_lamc11_options_content ( - uid, - correct_option, - mc_que_content_id, - mc_que_option_text -) -VALUES ( - null, - 1, - 1, - 'sample answer 3'); - - - - - - - - - \ No newline at end of file Index: lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/dao/IMcQueContentDAO.java =================================================================== diff -u -r671255080ca12fba787bcf07b5d0d196fc96c5ea -rb9d979e7f1478db56c700664c515c4036557f29f --- lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/dao/IMcQueContentDAO.java (.../IMcQueContentDAO.java) (revision 671255080ca12fba787bcf07b5d0d196fc96c5ea) +++ lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/dao/IMcQueContentDAO.java (.../IMcQueContentDAO.java) (revision b9d979e7f1478db56c700664c515c4036557f29f) @@ -36,7 +36,7 @@ public McQueContent getToolDefaultQuestionContent(final long mcContentId); - public McQueContent getQuestionContentByQuestionText(final String question); + public McQueContent getQuestionContentByQuestionText(final String question, final Long mcContentId); public void saveMcQueContent(McQueContent mcQueContent); Index: lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/dao/hibernate/McQueContentDAO.java =================================================================== diff -u -r4336aafba788b801aa78c2dc27f8d07a2f932be7 -rb9d979e7f1478db56c700664c515c4036557f29f --- lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/dao/hibernate/McQueContentDAO.java (.../McQueContentDAO.java) (revision 4336aafba788b801aa78c2dc27f8d07a2f932be7) +++ lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/dao/hibernate/McQueContentDAO.java (.../McQueContentDAO.java) (revision b9d979e7f1478db56c700664c515c4036557f29f) @@ -47,7 +47,7 @@ private static final String LOAD_QUESTION_CONTENT_BY_CONTENT_ID = "from mcQueContent in class McQueContent where mcQueContent.mcContentId=:mcContentId"; - private static final String LOAD_QUESTION_CONTENT_BY_QUESTION_TEXT = "from mcQueContent in class McQueContent where mcQueContent.question=:question"; + private static final String LOAD_QUESTION_CONTENT_BY_QUESTION_TEXT = "from mcQueContent in class McQueContent where mcQueContent.question=:question and mcQueContent.mcContentId=:mcContentId"; public McQueContent getMcQueContentByUID(Long uid) @@ -72,17 +72,19 @@ } - public McQueContent getQuestionContentByQuestionText(final String question) + public McQueContent getQuestionContentByQuestionText(final String question, final Long mcContentId) { - return (McQueContent) getHibernateTemplate().execute(new HibernateCallback() - { - public Object doInHibernate(Session session) throws HibernateException - { - return session.createQuery(LOAD_QUESTION_CONTENT_BY_QUESTION_TEXT) - .setString("question", question) - .uniqueResult(); - } - }); + HibernateTemplate templ = this.getHibernateTemplate(); + List list = getSession().createQuery(LOAD_QUESTION_CONTENT_BY_QUESTION_TEXT) + .setString("question", question) + .setLong("mcContentId", mcContentId.longValue()) + .list(); + + if(list != null && list.size() > 0){ + McQueContent mcq = (McQueContent) list.get(0); + return mcq; + } + return null; } Index: lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/service/IMcService.java =================================================================== diff -u -rebdf73e801c6cb84f02b48e4860e1d7885f7ab84 -rb9d979e7f1478db56c700664c515c4036557f29f --- lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/service/IMcService.java (.../IMcService.java) (revision ebdf73e801c6cb84f02b48e4860e1d7885f7ab84) +++ lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/service/IMcService.java (.../IMcService.java) (revision b9d979e7f1478db56c700664c515c4036557f29f) @@ -73,7 +73,7 @@ public void removeMcQueContent(McQueContent mcQueContent) throws McApplicationException; - public McQueContent getQuestionContentByQuestionText(final String question); + public McQueContent getQuestionContentByQuestionText(final String question, final Long mcContentId); public McSession retrieveMcSession(Long mcSessionId) throws McApplicationException; Index: lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/service/McServicePOJO.java =================================================================== diff -u -rebdf73e801c6cb84f02b48e4860e1d7885f7ab84 -rb9d979e7f1478db56c700664c515c4036557f29f --- lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/service/McServicePOJO.java (.../McServicePOJO.java) (revision ebdf73e801c6cb84f02b48e4860e1d7885f7ab84) +++ lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/service/McServicePOJO.java (.../McServicePOJO.java) (revision b9d979e7f1478db56c700664c515c4036557f29f) @@ -287,11 +287,11 @@ } - public McQueContent getQuestionContentByQuestionText(final String question) + public McQueContent getQuestionContentByQuestionText(final String question, final Long mcContentId) { try { - return mcQueContentDAO.getQuestionContentByQuestionText(question); + return mcQueContentDAO.getQuestionContentByQuestionText(question, mcContentId); } catch (DataAccessException e) { Index: lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/web/McAction.java =================================================================== diff -u -rebdf73e801c6cb84f02b48e4860e1d7885f7ab84 -rb9d979e7f1478db56c700664c515c4036557f29f --- lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/web/McAction.java (.../McAction.java) (revision ebdf73e801c6cb84f02b48e4860e1d7885f7ab84) +++ lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/web/McAction.java (.../McAction.java) (revision b9d979e7f1478db56c700664c515c4036557f29f) @@ -232,16 +232,16 @@ Map mapQuestionsContent=(Map) request.getSession().getAttribute(MAP_QUESTIONS_CONTENT); logger.debug("mapQuestionsContent: " + mapQuestionsContent); - mapQuestionsContent=repopulateMap(mapQuestionsContent, request); + mapQuestionsContent=repopulateMap(mapQuestionsContent, request, "questionContent"); logger.debug("mapQuestionsContent after shrinking: " + mapQuestionsContent); logger.debug("mapQuestionsContent size after shrinking: " + mapQuestionsContent.size()); - String userAction=null; if (mcAuthoringForm.getAddQuestion() != null) { userAction="addQuestion"; request.setAttribute(USER_ACTION, userAction); + logger.debug("userAction:" + userAction); int mapSize=mapQuestionsContent.size(); mapQuestionsContent.put(new Long(++mapSize).toString(), ""); @@ -278,6 +278,7 @@ { userAction="removeQuestion"; request.setAttribute(USER_ACTION, userAction); + logger.debug("userAction:" + userAction); String questionIndex =mcAuthoringForm.getQuestionIndex(); logger.debug("questionIndex:" + questionIndex); @@ -291,7 +292,10 @@ request.getSession().setAttribute(MAP_QUESTIONS_CONTENT, mapQuestionsContent); logger.debug("updated Questions Map: " + request.getSession().getAttribute(MAP_QUESTIONS_CONTENT)); - McQueContent mcQueContent =mcService.getQuestionContentByQuestionText(deletableQuestionEntry); + Long toolContentId=(Long)request.getSession().getAttribute(TOOL_CONTENT_ID); + logger.debug("toolContentId:" + toolContentId); + + McQueContent mcQueContent =mcService.getQuestionContentByQuestionText(deletableQuestionEntry, toolContentId); logger.debug("mcQueContent:" + mcQueContent); if (mcQueContent != null) @@ -309,12 +313,17 @@ { userAction="editOption"; request.setAttribute(USER_ACTION, userAction); + logger.debug("userAction:" + userAction); String questionIndex =mcAuthoringForm.getQuestionIndex(); logger.debug("questionIndex:" + questionIndex); String editableQuestionEntry=(String)mapQuestionsContent.get(questionIndex); logger.debug("editableQuestionEntry:" + editableQuestionEntry); - McQueContent mcQueContent =mcService.getQuestionContentByQuestionText(editableQuestionEntry); + + Long toolContentId=(Long)request.getSession().getAttribute(TOOL_CONTENT_ID); + logger.debug("toolContentId:" + toolContentId); + + McQueContent mcQueContent =mcService.getQuestionContentByQuestionText(editableQuestionEntry, toolContentId); logger.debug("mcQueContent:" + mcQueContent); Map mapOptionsContent= new TreeMap(new McComparator()); @@ -351,8 +360,65 @@ return (mapping.findForward(EDIT_OPTS_CONTENT)); } - logger.debug("userAction:" + userAction); + else if (mcAuthoringForm.getAddOption() != null) + { + userAction="addOption"; + request.setAttribute(USER_ACTION, userAction); + logger.debug("userAction:" + userAction); + + Map mapOptionsContent=(Map) request.getSession().getAttribute(MAP_OPTIONS_CONTENT); + logger.debug("mapOptionsContent: " + mapOptionsContent); + + mapOptionsContent=repopulateMap(mapQuestionsContent, request,"optionContent"); + logger.debug("mapOptionsContent after shrinking: " + mapOptionsContent); + logger.debug("mapOptionsContent size after shrinking: " + mapOptionsContent.size()); + + int mapSize=mapOptionsContent.size(); + mapOptionsContent.put(new Long(++mapSize).toString(), ""); + logger.debug("updated mapOptionsContent Map size: " + mapOptionsContent.size()); + request.getSession().setAttribute(MAP_OPTIONS_CONTENT, mapQuestionsContent); + logger.debug("updated Options Map: " + request.getSession().getAttribute(MAP_OPTIONS_CONTENT)); + + McContent mcContent=createContent(request, mcAuthoringForm); + logger.debug("mcContent: " + mcContent); + + /** iterate the questions Map and persist the questions into the DB*/ + Iterator itQuestionsMap = mapQuestionsContent.entrySet().iterator(); + while (itQuestionsMap.hasNext()) { + Map.Entry pairs = (Map.Entry)itQuestionsMap.next(); + logger.debug("adding the pair: " + pairs.getKey() + " = " + pairs.getValue()); + if ((pairs.getValue() != null) && (!pairs.getValue().equals(""))) + { + McQueContent mcQueContent= new McQueContent(pairs.getValue().toString(), + new Integer(pairs.getKey().toString()), + mcContent, + new HashSet(), + new HashSet() + ); + logger.debug("created mcQueContent: " + mcQueContent); + mcService.createMcQue(mcQueContent); + } + } + + + mcAuthoringForm.resetUserAction(); + + return (mapping.findForward(EDIT_OPTS_CONTENT)); + } + else if (mcAuthoringForm.getRemoveOption() != null) + { + userAction="removeOption"; + request.setAttribute(USER_ACTION, userAction); + logger.debug("userAction:" + userAction); + + String optionIndex =mcAuthoringForm.getOptionIndex(); + logger.debug("optionIndex:" + optionIndex); + + return (mapping.findForward(EDIT_OPTS_CONTENT)); + } + + mcAuthoringForm.resetUserAction(); return (mapping.findForward(LOAD_QUESTIONS)); } @@ -396,14 +462,15 @@ * @param request * @return */ - protected Map repopulateMap(Map mapQuestionContent, HttpServletRequest request) + protected Map repopulateMap(Map mapQuestionContent, HttpServletRequest request, String parameterType) { Map mapTempQuestionsContent= new TreeMap(new McComparator()); + logger.debug("parameterType: " + parameterType); long mapCounter=0; for (long i=1; i <= MAX_QUESTION_COUNT ; i++) { - String candidateQuestionEntry =request.getParameter("questionContent" + i); + String candidateQuestionEntry =request.getParameter(parameterType + i); if ( (candidateQuestionEntry != null) && (candidateQuestionEntry.length() > 0) && Index: lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/web/McAuthoringForm.java =================================================================== diff -u -r4336aafba788b801aa78c2dc27f8d07a2f932be7 -rb9d979e7f1478db56c700664c515c4036557f29f --- lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/web/McAuthoringForm.java (.../McAuthoringForm.java) (revision 4336aafba788b801aa78c2dc27f8d07a2f932be7) +++ lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/web/McAuthoringForm.java (.../McAuthoringForm.java) (revision b9d979e7f1478db56c700664c515c4036557f29f) @@ -28,6 +28,7 @@ protected String removeQuestion; protected String editOptions; protected String addOption; + protected String removeOption; protected String questionIndex; protected String optionIndex; @@ -96,6 +97,7 @@ this.removeQuestion=null; this.editOptions=null; this.addOption=null; + this.removeOption=null; this.addContent=null; this.removeContent=null; @@ -120,7 +122,8 @@ this.addQuestion=null; this.removeQuestion=null; this.editOptions=null; - this.addOption=null; + this.addOption=null; + this.removeOption=null; this.addContent=null; this.removeContent=null; @@ -706,4 +709,16 @@ public void setPassmark(String passmark) { this.passmark = passmark; } + /** + * @return Returns the removeOption. + */ + public String getRemoveOption() { + return removeOption; + } + /** + * @param removeOption The removeOption to set. + */ + public void setRemoveOption(String removeOption) { + this.removeOption = removeOption; + } } Index: lams_tool_lamc/web/WEB-INF/FCKeditor.tld =================================================================== diff -u --- lams_tool_lamc/web/WEB-INF/FCKeditor.tld (revision 0) +++ lams_tool_lamc/web/WEB-INF/FCKeditor.tld (revision b9d979e7f1478db56c700664c515c4036557f29f) @@ -0,0 +1,214 @@ + + + + + 2.3 + 1.1 + FCKeditor + http://fckeditor.net/tags-fckeditor + FCKeditor taglib + + editor + com.fredck.FCKeditor.tags.FCKeditorTag + JSP + + id + true + + + basePath + false + true + + + toolbarSet + false + true + + + width + false + true + + + height + false + true + + + customConfigurationsPath + false + true + + + editorAreaCSS + false + true + + + baseHref + false + true + + + skinPath + false + true + + + pluginsPath + false + true + + + fullPage + false + true + + + debug + false + true + + + autoDetectLanguage + false + true + + + defaultLanguage + false + true + + + contentLangDirection + false + true + + + enableXHTML + false + true + + + enableSourceXHTML + false + true + + + fillEmptyBlocks + false + true + + + formatSource + false + true + + + formatOutput + false + true + + + formatIndentator + false + true + + + geckoUseSPAN + false + true + + + startupFocus + false + true + + + forcePasteAsPlainText + false + true + + + forceSimpleAmpersand + false + true + + + tabSpaces + false + true + + + useBROnCarriageReturn + false + true + + + toolbarStartExpanded + false + true + + + toolbarCanCollapse + false + true + + + fontColors + false + true + + + fontNames + false + true + + + fontSizes + false + true + + + fontFormats + false + true + + + stylesXmlPath + false + true + + + linkBrowserURL + false + true + + + imageBrowserURL + false + true + + + flashBrowserURL + false + true + + + linkUploadURL + false + true + + + imageUploadURL + false + true + + + flashUploadURL + false + true + + + \ No newline at end of file Fisheye: Tag b9d979e7f1478db56c700664c515c4036557f29f refers to a dead (removed) revision in file `lams_tool_lamc/web/WEB-INF/McContent.hbm.xml'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag b9d979e7f1478db56c700664c515c4036557f29f refers to a dead (removed) revision in file `lams_tool_lamc/web/WEB-INF/McOptionsContent.hbm.xml'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag b9d979e7f1478db56c700664c515c4036557f29f refers to a dead (removed) revision in file `lams_tool_lamc/web/WEB-INF/McQueContent.hbm.xml'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag b9d979e7f1478db56c700664c515c4036557f29f refers to a dead (removed) revision in file `lams_tool_lamc/web/WEB-INF/McQueUsr.hbm.xml'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag b9d979e7f1478db56c700664c515c4036557f29f refers to a dead (removed) revision in file `lams_tool_lamc/web/WEB-INF/McSession.hbm.xml'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag b9d979e7f1478db56c700664c515c4036557f29f refers to a dead (removed) revision in file `lams_tool_lamc/web/WEB-INF/McUsrAttempt.hbm.xml'. Fisheye: No comparison available. Pass `N' to diff? Index: lams_tool_lamc/web/WEB-INF/images/icon_noticeboard.swf =================================================================== diff -u Binary files differ Index: lams_tool_lamc/web/WEB-INF/struts-config_1_2.dtd =================================================================== diff -u --- lams_tool_lamc/web/WEB-INF/struts-config_1_2.dtd (revision 0) +++ lams_tool_lamc/web/WEB-INF/struts-config_1_2.dtd (revision b9d979e7f1478db56c700664c515c4036557f29f) @@ -0,0 +1,686 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Fisheye: Tag b9d979e7f1478db56c700664c515c4036557f29f refers to a dead (removed) revision in file `lams_tool_lamc/web/WEB-INF/struts-template.tld'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag b9d979e7f1478db56c700664c515c4036557f29f refers to a dead (removed) revision in file `lams_tool_lamc/web/WEB-INF/struts/struts-config.xml'. Fisheye: No comparison available. Pass `N' to diff? Index: lams_tool_lamc/web/authoringMaincontent.jsp =================================================================== diff -u -r671255080ca12fba787bcf07b5d0d196fc96c5ea -rb9d979e7f1478db56c700664c515c4036557f29f --- lams_tool_lamc/web/authoringMaincontent.jsp (.../authoringMaincontent.jsp) (revision 671255080ca12fba787bcf07b5d0d196fc96c5ea) +++ lams_tool_lamc/web/authoringMaincontent.jsp (.../authoringMaincontent.jsp) (revision b9d979e7f1478db56c700664c515c4036557f29f) @@ -1,3 +1,4 @@ + <%@ taglib uri="/WEB-INF/struts-html-el.tld" prefix="html" %> <%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean" %> <%@ taglib uri="/WEB-INF/struts-logic-el.tld" prefix="logic-el" %> @@ -6,6 +7,7 @@ <%@ taglib uri="fck-editor" prefix="FCK" %> + <% String protocol = request.getProtocol(); if(protocol.startsWith("HTTPS")){ Fisheye: Tag b9d979e7f1478db56c700664c515c4036557f29f refers to a dead (removed) revision in file `lams_tool_lamc/web/editDefaultContent.jsp'. Fisheye: No comparison available. Pass `N' to diff? Index: lams_tool_lamc/web/index.jsp =================================================================== diff -u -re641617111e90d02c659127046f06b0f5c8e2845 -rb9d979e7f1478db56c700664c515c4036557f29f --- lams_tool_lamc/web/index.jsp (.../index.jsp) (revision e641617111e90d02c659127046f06b0f5c8e2845) +++ lams_tool_lamc/web/index.jsp (.../index.jsp) (revision b9d979e7f1478db56c700664c515c4036557f29f) @@ -3,7 +3,10 @@ <%@ taglib uri="/WEB-INF/struts-logic-el.tld" prefix="logic-el" %> <%@ taglib uri="/WEB-INF/c.tld" prefix="c" %> <%@ taglib uri="/WEB-INF/fmt.tld" prefix="fmt" %> +<%@ taglib uri="fck-editor" prefix="FCK" %> + + <% String userContentId="1234";