Index: lams_tool_lamc/db/sql/insert_lams_tool_lamc.sql =================================================================== RCS file: /usr/local/cvsroot/lams_tool_lamc/db/sql/Attic/insert_lams_tool_lamc.sql,v diff -u -r1.3 -r1.4 Binary files differ Index: lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/dao/IMcQueContentDAO.java =================================================================== RCS file: /usr/local/cvsroot/lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/dao/IMcQueContentDAO.java,v diff -u -r1.5 -r1.6 --- lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/dao/IMcQueContentDAO.java 14 Oct 2005 20:23:15 -0000 1.5 +++ lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/dao/IMcQueContentDAO.java 18 Oct 2005 15:21:43 -0000 1.6 @@ -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 =================================================================== RCS file: /usr/local/cvsroot/lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/dao/hibernate/McQueContentDAO.java,v diff -u -r1.7 -r1.8 --- lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/dao/hibernate/McQueContentDAO.java 15 Oct 2005 15:21:56 -0000 1.7 +++ lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/dao/hibernate/McQueContentDAO.java 18 Oct 2005 15:21:43 -0000 1.8 @@ -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 =================================================================== RCS file: /usr/local/cvsroot/lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/service/IMcService.java,v diff -u -r1.4 -r1.5 --- lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/service/IMcService.java 17 Oct 2005 11:05:30 -0000 1.4 +++ lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/service/IMcService.java 18 Oct 2005 15:21:43 -0000 1.5 @@ -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 =================================================================== RCS file: /usr/local/cvsroot/lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/service/McServicePOJO.java,v diff -u -r1.5 -r1.6 --- lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/service/McServicePOJO.java 17 Oct 2005 11:05:30 -0000 1.5 +++ lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/service/McServicePOJO.java 18 Oct 2005 15:21:43 -0000 1.6 @@ -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 =================================================================== RCS file: /usr/local/cvsroot/lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/web/McAction.java,v diff -u -r1.8 -r1.9 --- lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/web/McAction.java 17 Oct 2005 11:05:39 -0000 1.8 +++ lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/web/McAction.java 18 Oct 2005 15:21:43 -0000 1.9 @@ -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 =================================================================== RCS file: /usr/local/cvsroot/lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/web/McAuthoringForm.java,v diff -u -r1.7 -r1.8 --- lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/web/McAuthoringForm.java 15 Oct 2005 15:21:56 -0000 1.7 +++ lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/web/McAuthoringForm.java 18 Oct 2005 15:21:43 -0000 1.8 @@ -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/authoringMaincontent.jsp =================================================================== RCS file: /usr/local/cvsroot/lams_tool_lamc/web/Attic/authoringMaincontent.jsp,v diff -u -r1.8 -r1.9 --- lams_tool_lamc/web/authoringMaincontent.jsp 14 Oct 2005 20:23:14 -0000 1.8 +++ lams_tool_lamc/web/authoringMaincontent.jsp 18 Oct 2005 15:22:47 -0000 1.9 @@ -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 1.2 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 =================================================================== RCS file: /usr/local/cvsroot/lams_tool_lamc/web/Attic/index.jsp,v diff -u -r1.2 -r1.3 --- lams_tool_lamc/web/index.jsp 12 Oct 2005 16:39:20 -0000 1.2 +++ lams_tool_lamc/web/index.jsp 18 Oct 2005 15:22:47 -0000 1.3 @@ -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"; Index: lams_tool_lamc/web/WEB-INF/FCKeditor.tld =================================================================== RCS file: /usr/local/cvsroot/lams_tool_lamc/web/WEB-INF/Attic/FCKeditor.tld,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ lams_tool_lamc/web/WEB-INF/FCKeditor.tld 18 Oct 2005 15:22:47 -0000 1.1 @@ -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 1.3 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 1.2 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 1.4 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 1.3 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 1.2 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 1.2 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/struts-config_1_2.dtd =================================================================== RCS file: /usr/local/cvsroot/lams_tool_lamc/web/WEB-INF/Attic/struts-config_1_2.dtd,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ lams_tool_lamc/web/WEB-INF/struts-config_1_2.dtd 18 Oct 2005 15:22:47 -0000 1.1 @@ -0,0 +1,686 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Fisheye: Tag 1.2 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? Index: lams_tool_lamc/web/WEB-INF/images/icon_noticeboard.swf =================================================================== RCS file: /usr/local/cvsroot/lams_tool_lamc/web/WEB-INF/images/Attic/icon_noticeboard.swf,v diff -u Binary files differ Fisheye: Tag 1.3 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?