Index: lams_build/lib/lams/lams-central.jar =================================================================== diff -u -r9349bab097150a4a15cf4c6c10b7946400c3fbd0 -r333795a363a0275e5f1fd182c9f6acaf7a8b7edd Binary files differ Index: lams_build/lib/lams/lams.jar =================================================================== diff -u -r9349bab097150a4a15cf4c6c10b7946400c3fbd0 -r333795a363a0275e5f1fd182c9f6acaf7a8b7edd Binary files differ Index: lams_tool_survey/src/java/org/lamsfoundation/lams/tool/survey/SurveyConstants.java =================================================================== diff -u -r8e090b3ddf269cdffececa4bc55a9333da5b0858 -r333795a363a0275e5f1fd182c9f6acaf7a8b7edd --- lams_tool_survey/src/java/org/lamsfoundation/lams/tool/survey/SurveyConstants.java (.../SurveyConstants.java) (revision 8e090b3ddf269cdffececa4bc55a9333da5b0858) +++ lams_tool_survey/src/java/org/lamsfoundation/lams/tool/survey/SurveyConstants.java (.../SurveyConstants.java) (revision 333795a363a0275e5f1fd182c9f6acaf7a8b7edd) @@ -174,7 +174,7 @@ public static final String ATTR_REFLECTION = "notebookEntry"; public static final String ATTR_PORTRAIT_ID = "portraitId"; - + public static final int SORT_BY_DEAFAULT = 0; public static final int SORT_BY_ANSWER_ASC = 1; public static final int SORT_BY_ANSWER_DESC = 2; Fisheye: Tag 333795a363a0275e5f1fd182c9f6acaf7a8b7edd refers to a dead (removed) revision in file `lams_tool_survey/src/java/org/lamsfoundation/lams/tool/survey/web/controller/AuthoringConditionAction.java'. Fisheye: No comparison available. Pass `N' to diff? Index: lams_tool_survey/src/java/org/lamsfoundation/lams/tool/survey/web/controller/AuthoringConditionController.java =================================================================== diff -u --- lams_tool_survey/src/java/org/lamsfoundation/lams/tool/survey/web/controller/AuthoringConditionController.java (revision 0) +++ lams_tool_survey/src/java/org/lamsfoundation/lams/tool/survey/web/controller/AuthoringConditionController.java (revision 333795a363a0275e5f1fd182c9f6acaf7a8b7edd) @@ -0,0 +1,440 @@ +/**************************************************************** + * 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.0 + * as published by the Free Software Foundation. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * 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 + * **************************************************************** + */ + +package org.lamsfoundation.lams.tool.survey.web.controller; + +import java.util.ArrayList; +import java.util.LinkedList; +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; + +import org.apache.commons.lang.StringUtils; +import org.apache.commons.lang.math.NumberUtils; +import org.apache.struts.action.ActionForm; +import org.apache.struts.action.ActionMessages; +import org.apache.struts.util.LabelValueBean; +import org.lamsfoundation.lams.learningdesign.TextSearchConditionComparator; +import org.lamsfoundation.lams.tool.survey.SurveyConstants; +import org.lamsfoundation.lams.tool.survey.model.SurveyCondition; +import org.lamsfoundation.lams.tool.survey.model.SurveyQuestion; +import org.lamsfoundation.lams.tool.survey.service.ISurveyService; +import org.lamsfoundation.lams.tool.survey.util.QuestionsComparator; +import org.lamsfoundation.lams.tool.survey.web.form.SurveyConditionForm; +import org.lamsfoundation.lams.util.WebUtil; +import org.lamsfoundation.lams.web.util.SessionMap; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Qualifier; +import org.springframework.stereotype.Controller; +import org.springframework.validation.Errors; +import org.springframework.web.bind.annotation.RequestMapping; + +/** + * Auxiliary action in author mode. It contains operations with SurveyCondition. The rest of operations are located in + * AuthoringAction action. + * + * @author Marcin Cieslak + * @see org.lamsfoundation.lams.tool.survey.web.controller.AuthoringAction + */ +@Controller +@RequestMapping("/authoringCondition") +public class AuthoringConditionController { + + @Autowired + @Qualifier("lasurvSurveyService") + private ISurveyService surveyService; + + /** + * Display empty page for a new condition. + * + * @param surveyConditionForm + * @param request + * @return + */ + + @RequestMapping("/newConditionInit") + public String newConditionInit(HttpServletRequest request) { + + SurveyConditionForm surveyConditionForm = new SurveyConditionForm(); + String sessionMapId = request.getParameter(SurveyConstants.ATTR_SESSION_MAP_ID); + surveyConditionForm.setSessionMapID(sessionMapId); + populateFormWithPossibleItems(surveyConditionForm, request); + surveyConditionForm.setOrderId(-1); + request.setAttribute("surveyConditionForm", surveyConditionForm); + return "pages/authoring/addCondition"; + } + + /** + * Display edit page for an existing condition. + * + * @param SurveyConditionForm + * @param request + * @return + */ + @RequestMapping("/editCondition") + public String editCondition(SurveyConditionForm SurveyConditionForm, HttpServletRequest request) { + + String sessionMapID = SurveyConditionForm.getSessionMapID(); + SessionMap sessionMap = (SessionMap) request.getSession().getAttribute(sessionMapID); + + int orderId = NumberUtils.stringToInt(request.getParameter(SurveyConstants.PARAM_ORDER_ID), -1); + SurveyCondition condition = null; + if (orderId != -1) { + SortedSet conditionSet = getSurveyConditionSet(sessionMap); + List conditionList = new ArrayList<>(conditionSet); + condition = conditionList.get(orderId); + if (condition != null) { + populateConditionToForm(orderId, condition, SurveyConditionForm, request); + } + } + + populateFormWithPossibleItems(SurveyConditionForm, request); + return condition == null ? null : "/pages/authoring/addCondition"; + } + + /** + * This method will get necessary information from condition form and save or update into HttpSession + * condition list. Notice, this save is not persist them into database, just save HttpSession + * temporarily. Only they will be persist when the entire authoring page is being persisted. + * + * @param mapping + * @param form + * @param request + * @param response + * @return + * @throws ServletException + */ + @RequestMapping("/saveOrUpdateCondition") + public String saveOrUpdateCondition(SurveyConditionForm surveyConditionForm, Errors errors, + HttpServletRequest request) { + +// ActionErrors errors = validateSurveyCondition(conditionForm, request); + + validateSurveyCondition(surveyConditionForm, request, errors); + if (errors.hasErrors()) { + populateFormWithPossibleItems(surveyConditionForm, request); + return "pages/authoring/addCondition"; + } + + try { + extractFormToSurveyCondition(request, surveyConditionForm); + } catch (Exception e) { + + errors.reject("error.condition"); + if (errors.hasErrors()) { + populateFormWithPossibleItems(surveyConditionForm, request); + return "pages/authoring/addCondition"; + } + } + + request.setAttribute(SurveyConstants.ATTR_SESSION_MAP_ID, surveyConditionForm.getSessionMapID()); + + return "pages/authoring/conditionList"; + } + + /** + * Remove condition from HttpSession list and update page display. As authoring rule, all persist only happen when + * user submit whole page. So this remove is just impact HttpSession values. + * + * @param mapping + * @param surveyConditionForm + * @param request + * @param response + * @return + */ + @RequestMapping("/removeCondition") + public String removeCondition(ActionForm surveyConditionForm, HttpServletRequest request) { + + // get back sessionMAP + String sessionMapID = WebUtil.readStrParam(request, SurveyConstants.ATTR_SESSION_MAP_ID); + SessionMap sessionMap = (SessionMap) request.getSession().getAttribute(sessionMapID); + + int orderId = NumberUtils.stringToInt(request.getParameter(SurveyConstants.PARAM_ORDER_ID), -1); + if (orderId != -1) { + SortedSet conditionSet = getSurveyConditionSet(sessionMap); + List conditionList = new ArrayList<>(conditionSet); + SurveyCondition condition = conditionList.remove(orderId); + for (SurveyCondition otherCondition : conditionSet) { + if (otherCondition.getOrderId() > orderId) { + otherCondition.setOrderId(otherCondition.getOrderId() - 1); + } + } + conditionSet.clear(); + conditionSet.addAll(conditionList); + // add to delList + List deletedList = getDeletedSurveyConditionList(sessionMap); + deletedList.add(condition); + } + + request.setAttribute(SurveyConstants.ATTR_SESSION_MAP_ID, sessionMapID); + return "pages/authoring/conditionList"; + } + + /** + * Move up current item. + * + * @param mapping + * @param form + * @param request + * @param response + * @return + */ + @RequestMapping("/upCondition") + private String upCondition(HttpServletRequest request) { + return switchItem(request, true); + } + + /** + * Move down current item. + * + * @param mapping + * @param form + * @param request + * @param response + * @return + */ + @RequestMapping("/downCondition") + private String downCondition(HttpServletRequest request) { + return switchItem(request, false); + } + + @RequestMapping("/switchItem") + public String switchItem(HttpServletRequest request, boolean up) { + // get back sessionMAP + String sessionMapID = WebUtil.readStrParam(request, SurveyConstants.ATTR_SESSION_MAP_ID); + SessionMap sessionMap = (SessionMap) request.getSession().getAttribute(sessionMapID); + + int orderId = NumberUtils.stringToInt(request.getParameter(SurveyConstants.PARAM_ORDER_ID), -1); + if (orderId != -1) { + SortedSet conditionSet = getSurveyConditionSet(sessionMap); + List conditionList = new ArrayList<>(conditionSet); + // get current and the target item, and switch their sequnece + SurveyCondition condition = conditionList.get(orderId); + SurveyCondition repCondition; + if (up) { + repCondition = conditionList.get(--orderId); + } else { + repCondition = conditionList.get(++orderId); + } + int upSeqId = repCondition.getOrderId(); + repCondition.setOrderId(condition.getOrderId()); + condition.setOrderId(upSeqId); + + // put back list, it will be sorted again + conditionSet.clear(); + conditionSet.addAll(conditionList); + } + + request.setAttribute(SurveyConstants.ATTR_SESSION_MAP_ID, sessionMapID); + return "pages/authoring/conditionList"; + } + + // ************************************************************************************* + // Private methods for internal needs + // ************************************************************************************* + + /** + * List containing survey conditions. + * + * @param request + * @return + */ + private SortedSet getSurveyConditionSet(SessionMap sessionMap) { + SortedSet list = (SortedSet) sessionMap + .get(SurveyConstants.ATTR_CONDITION_SET); + if (list == null) { + list = new TreeSet<>(new TextSearchConditionComparator()); + sessionMap.put(SurveyConstants.ATTR_CONDITION_SET, list); + } + return list; + } + + private SortedSet getSurveyQuestionSet(SessionMap sessionMap) { + SortedSet list = (SortedSet) sessionMap.get(SurveyConstants.ATTR_QUESTION_LIST); + if (list == null) { + list = new TreeSet<>(new QuestionsComparator()); + sessionMap.put(SurveyConstants.ATTR_QUESTION_LIST, list); + } + return list; + } + + /** + * Get the deleted condition list, which could be persisted or non-persisted items. + * + * @param request + * @return + */ + private List getDeletedSurveyConditionList(SessionMap sessionMap) { + return getListFromSession(sessionMap, SurveyConstants.ATTR_DELETED_CONDITION_LIST); + } + + /** + * Get java.util.List from HttpSession by given name. + * + * @param request + * @param name + * @return + */ + private List getListFromSession(SessionMap sessionMap, String name) { + List list = (List) sessionMap.get(name); + if (list == null) { + list = new ArrayList(); + sessionMap.put(name, list); + } + return list; + } + + /** + * This method will populate condition information to its form for edit use. + * + * @param orderId + * @param condition + * @param form + * @param request + */ + private void populateConditionToForm(int orderId, SurveyCondition condition, SurveyConditionForm form, + HttpServletRequest request) { + form.populateForm(condition); + if (orderId >= 0) { + form.setOrderId(orderId + 1); + } + } + + /** + * This method will populate questions to choose to the form for edit use. + * + * @param sequenceId + * @param condition + * @param form + * @param request + */ + private void populateFormWithPossibleItems(SurveyConditionForm conditionForm, HttpServletRequest request) { + // get back sessionMAP + String sessionMapID = conditionForm.getSessionMapID(); + SessionMap sessionMap = (SessionMap) request.getSession().getAttribute(sessionMapID); + + Set questions = getSurveyQuestionSet(sessionMap); + + // Initialise the LabelValueBeans in the possibleOptions array. + + List lvBeans = new LinkedList<>(); + int i = 0; + for (SurveyQuestion question : questions) { + if (question.getType() == SurveyConstants.QUESTION_TYPE_TEXT_ENTRY) { + lvBeans.add( + new LabelValueBean(question.getShortTitle(), new Integer(question.getSequenceId()).toString())); + } + } + conditionForm.setPossibleItems(lvBeans.toArray(new LabelValueBean[] {})); + } + + /** + * Extract form content to SurveyCondition. + * + * @param request + * @param form + * @throws QaException + */ + private void extractFormToSurveyCondition(HttpServletRequest request, SurveyConditionForm form) throws Exception { + + SessionMap sessionMap = (SessionMap) request.getSession().getAttribute(form.getSessionMapID()); + // check whether it is "edit(old item)" or "add(new item)" + SortedSet conditionSet = getSurveyConditionSet(sessionMap); + int orderId = form.getOrderId(); + SurveyCondition condition = null; + + if (orderId == -1) { // add + String properConditionName = surveyService.createConditionName(conditionSet); + condition = form.extractCondition(); + condition.setName(properConditionName); + int maxOrderId = 1; + if (conditionSet != null && conditionSet.size() > 0) { + SurveyCondition last = conditionSet.last(); + maxOrderId = last.getOrderId() + 1; + } + condition.setOrderId(maxOrderId); + conditionSet.add(condition); + } else { // edit + List conditionList = new ArrayList<>(conditionSet); + condition = conditionList.get(orderId - 1); + form.extractCondition(condition); + } + + Integer[] selectedItems = form.getSelectedItems(); + Set conditionQuestions = new TreeSet<>(new QuestionsComparator()); + Set questions = getSurveyQuestionSet(sessionMap); + + for (Integer selectedItem : selectedItems) { + for (SurveyQuestion question : questions) { + if (selectedItem.equals(new Integer(question.getSequenceId()))) { + conditionQuestions.add(question); + } + } + } + condition.setQuestions(conditionQuestions); + } + + /** + * Validate SurveyCondition + * + * @param conditionForm + * @return + */ + private void validateSurveyCondition(SurveyConditionForm conditionForm, HttpServletRequest request, Errors errors) { + + String formConditionName = conditionForm.getDisplayName(); + if (StringUtils.isBlank(formConditionName)) { + + errors.reject("error.condition.name.blank"); + } else { + + Integer formConditionOrderId = conditionForm.getOrderId(); + + String sessionMapID = conditionForm.getSessionMapID(); + SessionMap sessionMap = (SessionMap) request.getSession().getAttribute(sessionMapID); + SortedSet conditionSet = getSurveyConditionSet(sessionMap); + for (SurveyCondition condition : conditionSet) { + if (formConditionName.equals(condition.getDisplayName()) + && !formConditionOrderId.equals(condition.getOrderId())) { + + errors.reject("error.condition.duplicated.name"); + break; + } + } + } + + // should be selected at least one question + Integer[] selectedItems = conditionForm.getSelectedItems(); + if (selectedItems == null || selectedItems.length == 0) { + errors.reject("error.condition.no.questions.selected"); + } + + } + + private ActionMessages validate(SurveyConditionForm form, HttpServletRequest request) { + return new ActionMessages(); + } +} \ No newline at end of file Index: lams_tool_survey/src/java/org/lamsfoundation/lams/tool/survey/web/controller/AuthoringController.java =================================================================== diff -u -r92cf398e695b34f71b03ecba27659e4b214920d8 -r333795a363a0275e5f1fd182c9f6acaf7a8b7edd --- lams_tool_survey/src/java/org/lamsfoundation/lams/tool/survey/web/controller/AuthoringController.java (.../AuthoringController.java) (revision 92cf398e695b34f71b03ecba27659e4b214920d8) +++ lams_tool_survey/src/java/org/lamsfoundation/lams/tool/survey/web/controller/AuthoringController.java (.../AuthoringController.java) (revision 333795a363a0275e5f1fd182c9f6acaf7a8b7edd) @@ -39,7 +39,6 @@ import javax.servlet.ServletException; import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpSession; import org.apache.commons.beanutils.PropertyUtils; @@ -245,14 +244,15 @@ * @return */ @RequestMapping("/newItemInit") - public String newItemlInit(QuestionForm questionForm, HttpServletRequest request) { + public String newItemlInit(@ModelAttribute("surveyItemForm") QuestionForm surveyItemForm, + HttpServletRequest request) { List instructionList = new ArrayList(AuthoringController.INIT_INSTRUCTION_COUNT); for (int idx = 0; idx < AuthoringController.INIT_INSTRUCTION_COUNT; idx++) { instructionList.add(""); } request.setAttribute("instructionList", instructionList); - if (questionForm.getItemType() == SurveyConstants.QUESTION_TYPE_TEXT_ENTRY) { + if (surveyItemForm.getItemType() == SurveyConstants.QUESTION_TYPE_TEXT_ENTRY) { return "pages/authoring/parts/addopenquestion"; } else { return "pages/authoring/parts/addchoicequestion"; @@ -297,8 +297,8 @@ * @throws ServletException */ @RequestMapping("/saveOrUpdateItem") - public String saveOrUpdateItem(@ModelAttribute("surveyItemForm") QuestionForm surveyItemForm, Errors errors, HttpServletRequest request) - throws Exception { + public String saveOrUpdateItem(@ModelAttribute("surveyItemForm") QuestionForm surveyItemForm, Errors errors, + HttpServletRequest request) throws Exception { // get instructions: List instructionList = getInstructionsFromRequest(request); @@ -415,8 +415,7 @@ } @RequestMapping("/definelater") - public String definelater(SurveyForm surveyForm, HttpServletRequest request, HttpServletResponse response) - throws Exception { + public String definelater(SurveyForm startForm, HttpServletRequest request) throws Exception { // update define later flag to true Long contentId = new Long(WebUtil.readLongParam(request, AttributeNames.PARAM_TOOL_CONTENT_ID)); @@ -450,12 +449,12 @@ // Get contentFolderID and save to form. String contentFolderID = WebUtil.readStrParam(request, AttributeNames.PARAM_CONTENT_FOLDER_ID); - surveyForm.setContentFolderID(contentFolderID); + startForm.setContentFolderID(contentFolderID); // initial Session Map SessionMap sessionMap = new SessionMap<>(); request.getSession().setAttribute(sessionMap.getSessionID(), sessionMap); - surveyForm.setSessionMapID(sessionMap.getSessionID()); + startForm.setSessionMapID(sessionMap.getSessionID()); survey = service.getSurveyByContentId(contentId); // if survey does not exist, try to use default content instead. @@ -470,7 +469,7 @@ questions = new ArrayList<>(survey.getQuestions()); } - surveyForm.setSurvey(survey); + startForm.setSurvey(survey); // init it to avoid null exception in following handling if (questions == null) { @@ -501,9 +500,10 @@ conditionSet.clear(); conditionSet.addAll(survey.getConditions()); - sessionMap.put(SurveyConstants.ATTR_SURVEY_FORM, surveyForm); + sessionMap.put(SurveyConstants.ATTR_SURVEY_FORM, startForm); request.getSession().setAttribute(AttributeNames.PARAM_NOTIFY_CLOSE_URL, request.getParameter(AttributeNames.PARAM_NOTIFY_CLOSE_URL)); + request.setAttribute("startForm", startForm); return "pages/authoring/start"; } @@ -547,7 +547,8 @@ * @throws ServletException */ @RequestMapping("/update") - public String updateContent(SurveyForm authoringForm, HttpServletRequest request) throws Exception { + public String updateContent(@ModelAttribute("authoringForm") SurveyForm authoringForm, HttpServletRequest request) + throws Exception { // get back sessionMAP SessionMap sessionMap = (SessionMap) request.getSession() @@ -654,6 +655,7 @@ authoringForm.setSurvey(surveyPO); request.setAttribute(AuthoringConstants.LAMS_AUTHORING_SUCCESS_FLAG, Boolean.TRUE); + request.setAttribute("authoringForm", authoringForm); return "pages/authoring/authoring"; } Index: lams_tool_survey/src/java/org/lamsfoundation/lams/tool/survey/web/controller/ChartAction.java =================================================================== diff -u -r92cf398e695b34f71b03ecba27659e4b214920d8 -r333795a363a0275e5f1fd182c9f6acaf7a8b7edd --- lams_tool_survey/src/java/org/lamsfoundation/lams/tool/survey/web/controller/ChartAction.java (.../ChartAction.java) (revision 92cf398e695b34f71b03ecba27659e4b214920d8) +++ lams_tool_survey/src/java/org/lamsfoundation/lams/tool/survey/web/controller/ChartAction.java (.../ChartAction.java) (revision 333795a363a0275e5f1fd182c9f6acaf7a8b7edd) @@ -31,19 +31,17 @@ import javax.servlet.http.HttpServletResponse; import org.apache.log4j.Logger; -import org.apache.struts.action.Action; -import org.apache.struts.action.ActionForm; -import org.apache.struts.action.ActionForward; -import org.apache.struts.action.ActionMapping; -import org.apache.struts.util.MessageResources; import org.lamsfoundation.lams.tool.survey.SurveyConstants; import org.lamsfoundation.lams.tool.survey.dto.AnswerDTO; import org.lamsfoundation.lams.tool.survey.model.SurveyOption; import org.lamsfoundation.lams.tool.survey.service.ISurveyService; import org.lamsfoundation.lams.util.WebUtil; import org.lamsfoundation.lams.web.util.AttributeNames; -import org.springframework.web.context.WebApplicationContext; -import org.springframework.web.context.support.WebApplicationContextUtils; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Qualifier; +import org.springframework.context.MessageSource; +import org.springframework.stereotype.Controller; +import org.springframework.web.bind.annotation.RequestMapping; import com.fasterxml.jackson.databind.node.JsonNodeFactory; import com.fasterxml.jackson.databind.node.ObjectNode; @@ -53,26 +51,31 @@ * * @author Steve.Ni */ -public class ChartAction extends Action { +@Controller +public class ChartAction { private static Logger logger = Logger.getLogger(ChartAction.class); - private static ISurveyService surveyService; - private MessageResources resource; + @Autowired + @Qualifier("lasurvSurveyService") + private ISurveyService surveyService; - @Override - public ActionForward execute(ActionMapping mapping, ActionForm form, HttpServletRequest request, - HttpServletResponse response) throws IOException, ServletException { - resource = getResources(request); + @Autowired + @Qualifier("lasurvMessageSource") + private MessageSource resource; + @RequestMapping("/showChart") + public String execute(HttpServletRequest request, HttpServletResponse response) + throws IOException, ServletException { + Long sessionId = WebUtil.readLongParam(request, AttributeNames.PARAM_TOOL_SESSION_ID); Long questionUid = WebUtil.readLongParam(request, SurveyConstants.ATTR_QUESTION_UID); // if excludeUserId received exclude this user's answers - AnswerDTO answer = getSurveyService().getQuestionResponse(sessionId, questionUid); + AnswerDTO answer = surveyService.getQuestionResponse(sessionId, questionUid); if (answer.getType() == SurveyConstants.QUESTION_TYPE_TEXT_ENTRY) { ChartAction.logger.error("Error question type : Text entry can not generate chart."); - response.getWriter().print(resource.getMessage(SurveyConstants.ERROR_MSG_CHART_ERROR)); + response.getWriter().print(resource.getMessage(SurveyConstants.ERROR_MSG_CHART_ERROR, null, null)); return null; } @@ -88,7 +91,7 @@ if (answer.isAppendText()) { ObjectNode nomination = JsonNodeFactory.instance.objectNode(); - nomination.put("name", resource.getMessage(SurveyConstants.MSG_OPEN_RESPONSE)); + nomination.put("name", resource.getMessage(SurveyConstants.MSG_OPEN_RESPONSE, null, null)); nomination.put("value", (Double) answer.getOpenResponse()); responseJSON.withArray("data").add(nomination); } @@ -98,12 +101,4 @@ return null; } - private ISurveyService getSurveyService() { - if (ChartAction.surveyService == null) { - WebApplicationContext wac = WebApplicationContextUtils - .getRequiredWebApplicationContext(getServlet().getServletContext()); - ChartAction.surveyService = (ISurveyService) wac.getBean(SurveyConstants.SURVEY_SERVICE); - } - return ChartAction.surveyService; - } } \ No newline at end of file Fisheye: Tag 333795a363a0275e5f1fd182c9f6acaf7a8b7edd refers to a dead (removed) revision in file `lams_tool_survey/src/java/org/lamsfoundation/lams/tool/survey/web/controller/ClearSessionAction.java'. Fisheye: No comparison available. Pass `N' to diff? Index: lams_tool_survey/src/java/org/lamsfoundation/lams/tool/survey/web/controller/ClearSessionController.java =================================================================== diff -u --- lams_tool_survey/src/java/org/lamsfoundation/lams/tool/survey/web/controller/ClearSessionController.java (revision 0) +++ lams_tool_survey/src/java/org/lamsfoundation/lams/tool/survey/web/controller/ClearSessionController.java (revision 333795a363a0275e5f1fd182c9f6acaf7a8b7edd) @@ -0,0 +1,64 @@ +/**************************************************************** + * 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.0 + * as published by the Free Software Foundation. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * 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 + * **************************************************************** + */ + +package org.lamsfoundation.lams.tool.survey.web.controller; + +import java.io.IOException; + +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; +import javax.servlet.http.HttpSession; + +import org.lamsfoundation.lams.authoring.web.LamsAuthoringFinishController; +import org.lamsfoundation.lams.tool.ToolAccessMode; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Controller; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.context.WebApplicationContext; + +/** + * This class give a chance to clear HttpSession when user save/close authoring page. + * + * @author Steve.Ni + * + * @version $Revision$ + */ +@Controller +public class ClearSessionController extends LamsAuthoringFinishController { + + @Autowired + private WebApplicationContext applicationContext; + + @RequestMapping("/clearsession") + public void execute(HttpServletRequest request, HttpServletResponse response) throws IOException { + super.execute(request, response, applicationContext); + } + + @Override + public void clearSession(String customiseSessionID, HttpSession session, ToolAccessMode mode) { + if (mode.isAuthor()) { + session.removeAttribute(customiseSessionID); + } + } + +} Index: lams_tool_survey/src/java/org/lamsfoundation/lams/tool/survey/web/controller/LearningAction.java =================================================================== diff -u -r92cf398e695b34f71b03ecba27659e4b214920d8 -r333795a363a0275e5f1fd182c9f6acaf7a8b7edd --- lams_tool_survey/src/java/org/lamsfoundation/lams/tool/survey/web/controller/LearningAction.java (.../LearningAction.java) (revision 92cf398e695b34f71b03ecba27659e4b214920d8) +++ lams_tool_survey/src/java/org/lamsfoundation/lams/tool/survey/web/controller/LearningAction.java (.../LearningAction.java) (revision 333795a363a0275e5f1fd182c9f6acaf7a8b7edd) @@ -1,751 +1,751 @@ -/**************************************************************** - * 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.0 - * as published by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * 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 - * **************************************************************** - */ - -package org.lamsfoundation.lams.tool.survey.web.controller; - -import java.io.IOException; -import java.sql.Timestamp; -import java.util.ArrayList; -import java.util.Collection; -import java.util.Date; -import java.util.List; -import java.util.Map; -import java.util.SortedMap; -import java.util.TimeZone; -import java.util.TreeMap; - -import javax.servlet.ServletException; -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; -import javax.servlet.http.HttpSession; - -import org.apache.commons.lang.StringEscapeUtils; -import org.apache.commons.lang.StringUtils; -import org.apache.log4j.Logger; -import org.apache.struts.action.Action; -import org.apache.struts.action.ActionErrors; -import org.apache.struts.action.ActionForm; -import org.apache.struts.action.ActionForward; -import org.apache.struts.action.ActionMapping; -import org.apache.struts.action.ActionMessage; -import org.apache.struts.action.ActionRedirect; -import org.lamsfoundation.lams.learning.web.bean.ActivityPositionDTO; -import org.lamsfoundation.lams.learning.web.util.LearningWebUtil; -import org.lamsfoundation.lams.notebook.model.NotebookEntry; -import org.lamsfoundation.lams.notebook.service.CoreNotebookConstants; -import org.lamsfoundation.lams.tool.ToolAccessMode; -import org.lamsfoundation.lams.tool.survey.SurveyConstants; -import org.lamsfoundation.lams.tool.survey.dto.AnswerDTO; -import org.lamsfoundation.lams.tool.survey.model.Survey; -import org.lamsfoundation.lams.tool.survey.model.SurveyAnswer; -import org.lamsfoundation.lams.tool.survey.model.SurveyQuestion; -import org.lamsfoundation.lams.tool.survey.model.SurveySession; -import org.lamsfoundation.lams.tool.survey.model.SurveyUser; -import org.lamsfoundation.lams.tool.survey.service.ISurveyService; -import org.lamsfoundation.lams.tool.survey.service.SurveyApplicationException; -import org.lamsfoundation.lams.tool.survey.util.IntegerComparator; -import org.lamsfoundation.lams.tool.survey.util.SurveyWebUtils; -import org.lamsfoundation.lams.tool.survey.web.form.AnswerForm; -import org.lamsfoundation.lams.tool.survey.web.form.ReflectionForm; -import org.lamsfoundation.lams.usermanagement.dto.UserDTO; -import org.lamsfoundation.lams.util.DateUtil; -import org.lamsfoundation.lams.util.WebUtil; -import org.lamsfoundation.lams.web.session.SessionManager; -import org.lamsfoundation.lams.web.util.AttributeNames; -import org.lamsfoundation.lams.web.util.SessionMap; -import org.springframework.web.context.WebApplicationContext; -import org.springframework.web.context.support.WebApplicationContextUtils; - -import com.fasterxml.jackson.databind.node.ArrayNode; -import com.fasterxml.jackson.databind.node.JsonNodeFactory; -import com.fasterxml.jackson.databind.node.ObjectNode; - -/** - * - * @author Steve.Ni - * - * @version $Revision$ - */ -public class LearningAction extends Action { - - private static Logger log = Logger.getLogger(LearningAction.class); - - @Override - public ActionForward execute(ActionMapping mapping, ActionForm form, HttpServletRequest request, - HttpServletResponse response) throws IOException, ServletException { - - String param = mapping.getParameter(); - // -----------------------Survey Learner function --------------------------- - if (param.equals("start")) { - return start(mapping, form, request, response); - } - if (param.equals("previousQuestion")) { - return previousQuestion(mapping, form, request, response); - } - if (param.equals("nextQuestion")) { - return nextQuestion(mapping, form, request, response); - } - if (param.equals("doSurvey")) { - return doSurvey(mapping, form, request, response); - } - - if (param.equals("retake")) { - return retake(mapping, form, request, response); - } - - if (param.equals("showOtherUsersAnswers")) { - return showOtherUsersAnswers(mapping, form, request, response); - } - - if (param.equals("getOpenResponses")) { - return getOpenResponses(mapping, form, request, response); - } - - if (param.equals("finish")) { - return finish(mapping, form, request, response); - } - - // ================ Reflection ======================= - if (param.equals("newReflection")) { - return newReflection(mapping, form, request, response); - } - if (param.equals("submitReflection")) { - return submitReflection(mapping, form, request, response); - } - - return mapping.findForward(SurveyConstants.ERROR); - } - - /** - * Read survey data from database and put them into HttpSession. It will redirect to init.do directly after this - * method run successfully. - * - * This method will avoid read database again and lost un-saved resouce item lost when user "refresh page", - * - */ - private ActionForward start(ActionMapping mapping, ActionForm form, HttpServletRequest request, - HttpServletResponse response) { - - AnswerForm answerForm = (AnswerForm) form; - // initial Session Map - SessionMap sessionMap = new SessionMap<>(); - String sessionMapID = sessionMap.getSessionID(); - request.getSession().setAttribute(sessionMapID, sessionMap); - answerForm.setSessionMapID(sessionMapID); - - // save toolContentID into HTTPSession - ToolAccessMode mode = WebUtil.readToolAccessModeParam(request, AttributeNames.PARAM_MODE, true); - Long sessionId = new Long(request.getParameter(AttributeNames.PARAM_TOOL_SESSION_ID)); - // it will be use when submissionDeadline or lock on finish page. - request.setAttribute(SurveyConstants.ATTR_SESSION_MAP_ID, sessionMapID); - - // get back the survey and question list and display them on page - ISurveyService service = getSurveyService(); - SurveyUser surveyUser = null; - if ((mode != null) && mode.isTeacher()) { - // monitoring mode - user is specified in URL - surveyUser = getSpecifiedUser(service, sessionId, - WebUtil.readIntParam(request, AttributeNames.PARAM_USER_ID, false)); - // setting Learner - Long userID = WebUtil.readLongParam(request, AttributeNames.PARAM_USER_ID, true); - answerForm.setUserID(userID); - } else { - surveyUser = getCurrentUser(service, sessionId); - } - - List answers = service.getQuestionAnswers(sessionId, surveyUser.getUid()); - Survey survey = service.getSurveyBySessionId(sessionId); - - // get notebook entry - String entryText = new String(); - NotebookEntry notebookEntry = service.getEntry(sessionId, CoreNotebookConstants.NOTEBOOK_TOOL, - SurveyConstants.TOOL_SIGNATURE, surveyUser.getUserId().intValue()); - - if (notebookEntry != null) { - entryText = notebookEntry.getEntry(); - } - - // get session from shared session. - HttpSession ss = SessionManager.getSession(); - - // basic information - sessionMap.put(SurveyConstants.ATTR_TITLE, survey.getTitle()); - sessionMap.put(SurveyConstants.ATTR_SURVEY_INSTRUCTION, survey.getInstructions()); - // check whehter finish lock is on/off - boolean lock = survey.getLockWhenFinished() && surveyUser.isSessionFinished(); - sessionMap.put(SurveyConstants.ATTR_FINISH_LOCK, lock); - sessionMap.put(SurveyConstants.ATTR_LOCK_ON_FINISH, survey.getLockWhenFinished()); - sessionMap.put(SurveyConstants.ATTR_SHOW_ON_ONE_PAGE, survey.isShowOnePage()); - sessionMap.put(SurveyConstants.ATTR_SHOW_OTHER_USERS_ANSWERS, survey.isShowOtherUsersAnswers()); - sessionMap.put(SurveyConstants.ATTR_USER_FINISHED, surveyUser.isSessionFinished()); - sessionMap.put(SurveyConstants.ATTR_USER, surveyUser); - - sessionMap.put(AttributeNames.PARAM_TOOL_SESSION_ID, sessionId); - sessionMap.put(AttributeNames.ATTR_MODE, mode); - // reflection information - sessionMap.put(SurveyConstants.ATTR_REFLECTION_ON, survey.isReflectOnActivity()); - sessionMap.put(SurveyConstants.ATTR_REFLECTION_INSTRUCTION, survey.getReflectInstructions()); - sessionMap.put(SurveyConstants.ATTR_REFLECTION_ENTRY, entryText); - - // add define later support - if (survey.isDefineLater()) { - return mapping.findForward(SurveyConstants.DEFINE_LATER); - } - - // set contentInUse flag to true! - survey.setContentInUse(true); - survey.setDefineLater(false); - service.saveOrUpdateSurvey(survey); - - ActivityPositionDTO activityPosition = LearningWebUtil.putActivityPositionInRequestByToolSessionId(sessionId, - request, getServlet().getServletContext()); - sessionMap.put(AttributeNames.ATTR_ACTIVITY_POSITION, activityPosition); - - // check if there is submission deadline - Date submissionDeadline = survey.getSubmissionDeadline(); - if (submissionDeadline != null) { - // store submission deadline to sessionMap - sessionMap.put(SurveyConstants.ATTR_SUBMISSION_DEADLINE, submissionDeadline); - - UserDTO learnerDto = (UserDTO) ss.getAttribute(AttributeNames.USER); - TimeZone learnerTimeZone = learnerDto.getTimeZone(); - Date tzSubmissionDeadline = DateUtil.convertToTimeZoneFromDefault(learnerTimeZone, submissionDeadline); - Date currentLearnerDate = DateUtil.convertToTimeZoneFromDefault(learnerTimeZone, new Date()); - - // calculate whether submission deadline has passed, and if so forward to "submissionDeadline" - if (currentLearnerDate.after(tzSubmissionDeadline)) { - return mapping.findForward("submissionDeadline"); - } - } - - // init survey item list - SortedMap surveyItemList = getQuestionList(sessionMap); - surveyItemList.clear(); - if (answers != null) { - for (AnswerDTO answer : answers) { - surveyItemList.put(answer.getSequenceId(), answer); - } - } - if (survey.isShowOnePage()) { - answerForm.setQuestionSeqID(null); - } else { - if (surveyItemList.size() > 0) { - answerForm.setQuestionSeqID(surveyItemList.firstKey()); - } - } - sessionMap.put(SurveyConstants.ATTR_TOTAL_QUESTIONS, surveyItemList.size()); - answerForm.setCurrentIdx(1); - - if (surveyItemList.size() < 2) { - answerForm.setPosition(SurveyConstants.POSITION_ONLY_ONE); - } else { - answerForm.setPosition(SurveyConstants.POSITION_FIRST); - } - - // if session is finished go to result pages. - if (surveyUser.isSessionFinished() && !survey.isShowOtherUsersAnswers()) { - return mapping.findForward(SurveyConstants.FORWARD_RESULT); - - //if show other users is ON and response is finalized - show results page with other users answers - } else if (survey.isShowOtherUsersAnswers() && surveyUser.isResponseFinalized()) { - ActionRedirect redirect = new ActionRedirect(mapping.findForwardConfig("resultOtherUsers")); - redirect.addParameter(SurveyConstants.ATTR_SESSION_MAP_ID, sessionMapID); - return redirect; - - } else { - return mapping.findForward(SurveyConstants.SUCCESS); - } - } - - private ActionForward nextQuestion(ActionMapping mapping, ActionForm form, HttpServletRequest request, - HttpServletResponse response) { - AnswerForm answerForm = (AnswerForm) form; - Integer questionSeqID = answerForm.getQuestionSeqID(); - String sessionMapID = answerForm.getSessionMapID(); - - SessionMap sessionMap = (SessionMap) request.getSession() - .getAttribute(sessionMapID); - SortedMap surveyItemMap = getQuestionList(sessionMap); - - ActionErrors errors = getAnswer(request, surveyItemMap.get(questionSeqID)); - if (!errors.isEmpty()) { - return mapping.getInputForward(); - } - - // go to next question - boolean next = false; - for (Map.Entry entry : surveyItemMap.entrySet()) { - if (entry.getKey().equals(questionSeqID)) { - next = true; - // failure tolerance: if arrive last one - questionSeqID = entry.getKey(); - continue; - } - if (next) { - questionSeqID = entry.getKey(); - break; - } - } - // get current question index of total questions - int currIdx = new ArrayList<>(surveyItemMap.keySet()).indexOf(questionSeqID) + 1; - answerForm.setCurrentIdx(currIdx); - // failure tolerance - if (questionSeqID.equals(surveyItemMap.lastKey())) { - answerForm.setPosition(SurveyConstants.POSITION_LAST); - } else { - answerForm.setPosition(SurveyConstants.POSITION_INSIDE); - } - answerForm.setQuestionSeqID(questionSeqID); - return mapping.findForward(SurveyConstants.SUCCESS); - } - - private ActionForward previousQuestion(ActionMapping mapping, ActionForm form, HttpServletRequest request, - HttpServletResponse response) { - AnswerForm answerForm = (AnswerForm) form; - Integer questionSeqID = answerForm.getQuestionSeqID(); - String sessionMapID = answerForm.getSessionMapID(); - - SessionMap sessionMap = (SessionMap) request.getSession() - .getAttribute(sessionMapID); - SortedMap surveyItemMap = getQuestionList(sessionMap); - - ActionErrors errors = getAnswer(request, surveyItemMap.get(questionSeqID)); - if (!errors.isEmpty()) { - return mapping.getInputForward(); - } - - SortedMap subMap = surveyItemMap.headMap(questionSeqID); - if (subMap.isEmpty()) { - questionSeqID = surveyItemMap.firstKey(); - } else { - questionSeqID = subMap.lastKey(); - } - - // get current question index of total questions - int currIdx = new ArrayList<>(surveyItemMap.keySet()).indexOf(questionSeqID) + 1; - answerForm.setCurrentIdx(currIdx); - - if (questionSeqID.equals(surveyItemMap.firstKey())) { - answerForm.setPosition(SurveyConstants.POSITION_FIRST); - } else { - answerForm.setPosition(SurveyConstants.POSITION_INSIDE); - } - answerForm.setQuestionSeqID(questionSeqID); - return mapping.findForward(SurveyConstants.SUCCESS); - } - - private ActionForward retake(ActionMapping mapping, ActionForm form, HttpServletRequest request, - HttpServletResponse response) { - AnswerForm answerForm = (AnswerForm) form; - Integer questionSeqID = answerForm.getQuestionSeqID(); - - String sessionMapID = answerForm.getSessionMapID(); - SessionMap sessionMap = (SessionMap) request.getSession() - .getAttribute(sessionMapID); - - SortedMap surveyItemMap = getQuestionList(sessionMap); - Collection surveyItemList = surveyItemMap.values(); - - if (surveyItemList.size() < 2 || (questionSeqID != null && questionSeqID > 0)) { - answerForm.setPosition(SurveyConstants.POSITION_ONLY_ONE); - } else { - answerForm.setPosition(SurveyConstants.POSITION_FIRST); - } - if (questionSeqID == null || questionSeqID <= 0) { - Boolean onePage = (Boolean) sessionMap.get(SurveyConstants.ATTR_SHOW_ON_ONE_PAGE); - if (!onePage && surveyItemList.size() > 0) { - answerForm.setQuestionSeqID(surveyItemMap.firstKey()); - questionSeqID = surveyItemMap.firstKey(); - } - } - - // get current question index of total questions - int currIdx = new ArrayList<>(surveyItemMap.keySet()).indexOf(questionSeqID) + 1; - answerForm.setCurrentIdx(currIdx); - - return mapping.findForward(SurveyConstants.SUCCESS); - } - - private ActionForward showOtherUsersAnswers(ActionMapping mapping, ActionForm form, HttpServletRequest request, - HttpServletResponse response) { - ISurveyService service = getSurveyService(); - String sessionMapID = request.getParameter("sessionMapID"); - request.setAttribute("sessionMapID", sessionMapID); - SessionMap sessionMap = (SessionMap) request.getSession() - .getAttribute(sessionMapID); - - SortedMap surveyItemMap = getQuestionList(sessionMap); - Long sessionId = (Long) sessionMap.get(AttributeNames.PARAM_TOOL_SESSION_ID); - - List answerDtos = new ArrayList<>(); - for (SurveyQuestion question : surveyItemMap.values()) { - AnswerDTO answerDto = service.getQuestionResponse(sessionId, question.getUid()); - answerDtos.add(answerDto); - } - request.setAttribute("answerDtos", answerDtos); - - SurveyUser surveyLearner = (SurveyUser) sessionMap.get(SurveyConstants.ATTR_USER); - service.setResponseFinalized(surveyLearner.getUid()); - - int countFinishedUser = service.getCountFinishedUsers(sessionId); - request.setAttribute(SurveyConstants.ATTR_COUNT_FINISHED_USERS, countFinishedUser); - - return mapping.findForward(SurveyConstants.SUCCESS); - } - - /** - * Get OpenResponses. - */ - private ActionForward getOpenResponses(ActionMapping mapping, ActionForm form, HttpServletRequest request, - HttpServletResponse res) throws IOException, ServletException { - ISurveyService service = getSurveyService(); - - Long questionUid = WebUtil.readLongParam(request, "questionUid"); - Long sessionId = WebUtil.readLongParam(request, "sessionId"); - - //paging parameters of tablesorter - int size = WebUtil.readIntParam(request, "size"); - int page = WebUtil.readIntParam(request, "page"); - Integer isSort1 = WebUtil.readIntParam(request, "column[0]", true); - - int sorting = SurveyConstants.SORT_BY_DEAFAULT; - if (isSort1 != null && isSort1.equals(0)) { - sorting = SurveyConstants.SORT_BY_ANSWER_ASC; - } else if (isSort1 != null && isSort1.equals(1)) { - sorting = SurveyConstants.SORT_BY_ANSWER_DESC; - } - - List responses = service.getOpenResponsesForTablesorter(sessionId, questionUid, page, size, sorting); - - ArrayNode rows = JsonNodeFactory.instance.arrayNode(); - - ObjectNode responcedata = JsonNodeFactory.instance.objectNode(); - responcedata.put("total_rows", service.getCountResponsesBySessionAndQuestion(sessionId, questionUid)); - - for (String response : responses) { - //ArrayNode cell=JsonNodeFactory.instance.arrayNode(); - //cell.put(HtmlUtils.htmlEscape(user.getFirstName()) + " " + HtmlUtils.htmlEscape(user.getLastName()) + " [" + HtmlUtils.htmlEscape(user.getLogin()) + "]"); - - ObjectNode responseRow = JsonNodeFactory.instance.objectNode(); - responseRow.put("answer", StringEscapeUtils.escapeCsv(response)); -// responseRow.put("attemptTime", response.getAttemptTime()); - - rows.add(responseRow); - } - responcedata.set("rows", rows); - res.setContentType("application/json;charset=utf-8"); - res.getWriter().print(new String(responcedata.toString())); - return null; - } - - private ActionForward doSurvey(ActionMapping mapping, ActionForm form, HttpServletRequest request, - HttpServletResponse response) { - ISurveyService service = getSurveyService(); - - AnswerForm answerForm = (AnswerForm) form; - Integer questionSeqID = answerForm.getQuestionSeqID(); - String sessionMapID = answerForm.getSessionMapID(); - SessionMap sessionMap = (SessionMap) request.getSession() - .getAttribute(sessionMapID); - - // validate - SortedMap surveyItemMap = getQuestionList(sessionMap); - Collection surveyItemList = surveyItemMap.values(); - - SurveyUser surveyLearner = (SurveyUser) sessionMap.get(SurveyConstants.ATTR_USER); - Long sessionId = (Long) sessionMap.get(AttributeNames.PARAM_TOOL_SESSION_ID); - - ActionErrors errors; - if ((questionSeqID == null) || questionSeqID.equals(0)) { - errors = getAnswers(request); - } else { - errors = getAnswer(request, surveyItemMap.get(questionSeqID)); - } - if (!errors.isEmpty()) { - return mapping.getInputForward(); - } - - List answerList = new ArrayList<>(); - for (AnswerDTO question : surveyItemList) { - if (question.getAnswer() != null) { - question.getAnswer().setUser(surveyLearner); - answerList.add(question.getAnswer()); - } - } - - service.updateAnswerList(answerList); - - request.setAttribute(SurveyConstants.ATTR_SESSION_MAP_ID, sessionMapID); - - Survey survey = service.getSurveyBySessionId(sessionId); - if (survey.isNotifyTeachersOnAnswerSumbit()) { - service.notifyTeachersOnAnswerSumbit(sessionId, surveyLearner); - } - - return mapping.findForward(SurveyConstants.SUCCESS); - } - - /** - * Finish learning session. - * - * @param mapping - * @param form - * @param request - * @param response - * @return - */ - private ActionForward finish(ActionMapping mapping, ActionForm form, HttpServletRequest request, - HttpServletResponse response) { - - // get back SessionMap - String sessionMapID = request.getParameter(SurveyConstants.ATTR_SESSION_MAP_ID); - SessionMap sessionMap = (SessionMap) request.getSession() - .getAttribute(sessionMapID); - - // get mode and ToolSessionID from sessionMAP - Long sessionId = (Long) sessionMap.get(AttributeNames.PARAM_TOOL_SESSION_ID); - - ISurveyService service = getSurveyService(); - // get sessionId from HttpServletRequest - String nextActivityUrl = null; - try { - HttpSession ss = SessionManager.getSession(); - UserDTO user = (UserDTO) ss.getAttribute(AttributeNames.USER); - Long userID = new Long(user.getUserID().longValue()); - - nextActivityUrl = service.finishToolSession(sessionId, userID); - request.setAttribute(SurveyConstants.ATTR_NEXT_ACTIVITY_URL, nextActivityUrl); - } catch (SurveyApplicationException e) { - LearningAction.log.error("Failed get next activity url:" + e.getMessage()); - } - - return mapping.findForward(SurveyConstants.SUCCESS); - } - - /** - * Display empty reflection form. - * - * @param mapping - * @param form - * @param request - * @param response - * @return - */ - private ActionForward newReflection(ActionMapping mapping, ActionForm form, HttpServletRequest request, - HttpServletResponse response) { - - // get session value - String sessionMapID = WebUtil.readStrParam(request, SurveyConstants.ATTR_SESSION_MAP_ID); - - ReflectionForm refForm = (ReflectionForm) form; - HttpSession ss = SessionManager.getSession(); - UserDTO user = (UserDTO) ss.getAttribute(AttributeNames.USER); - - refForm.setUserID(user.getUserID()); - refForm.setSessionMapID(sessionMapID); - - // get the existing reflection entry - ISurveyService submitFilesService = getSurveyService(); - - SessionMap map = (SessionMap) request.getSession().getAttribute(sessionMapID); - Long toolSessionID = (Long) map.get(AttributeNames.PARAM_TOOL_SESSION_ID); - NotebookEntry entry = submitFilesService.getEntry(toolSessionID, CoreNotebookConstants.NOTEBOOK_TOOL, - SurveyConstants.TOOL_SIGNATURE, user.getUserID()); - - if (entry != null) { - refForm.setEntryText(entry.getEntry()); - } - - return mapping.findForward(SurveyConstants.SUCCESS); - } - - /** - * Submit reflection form input database. - * - * @param mapping - * @param form - * @param request - * @param response - * @return - */ - private ActionForward submitReflection(ActionMapping mapping, ActionForm form, HttpServletRequest request, - HttpServletResponse response) { - ReflectionForm refForm = (ReflectionForm) form; - Integer userId = refForm.getUserID(); - - String sessionMapID = WebUtil.readStrParam(request, SurveyConstants.ATTR_SESSION_MAP_ID); - SessionMap sessionMap = (SessionMap) request.getSession() - .getAttribute(sessionMapID); - Long sessionId = (Long) sessionMap.get(AttributeNames.PARAM_TOOL_SESSION_ID); - - ISurveyService service = getSurveyService(); - - // check for existing notebook entry - NotebookEntry entry = service.getEntry(sessionId, CoreNotebookConstants.NOTEBOOK_TOOL, - SurveyConstants.TOOL_SIGNATURE, userId); - - if (entry == null) { - // create new entry - service.createNotebookEntry(sessionId, CoreNotebookConstants.NOTEBOOK_TOOL, SurveyConstants.TOOL_SIGNATURE, - userId, refForm.getEntryText()); - } else { - // update existing entry - entry.setEntry(refForm.getEntryText()); - entry.setLastModified(new Date()); - service.updateEntry(entry); - } - - return finish(mapping, form, request, response); - } - - // ************************************************************************************* - // Private method - // ************************************************************************************* - /** - * Get answer by special question. - */ - private ActionErrors getAnswer(HttpServletRequest request, AnswerDTO answerDto) { - ActionErrors errors = new ActionErrors(); - // get sessionMap - String sessionMapID = request.getParameter(SurveyConstants.ATTR_SESSION_MAP_ID); - SessionMap sessionMap = (SessionMap) request.getSession() - .getAttribute(sessionMapID); - Long sessionID = (Long) sessionMap.get(AttributeNames.PARAM_TOOL_SESSION_ID); - - SurveyAnswer answer = getAnswerFromPage(request, answerDto, sessionID); - answerDto.setAnswer(answer); - validateAnswers(request, answerDto, errors, answer); - if (!errors.isEmpty()) { - addErrors(request, errors); - } - return errors; - } - - /** - * Get all answer for all questions in this page - * - * @param request - * @return - */ - private ActionErrors getAnswers(HttpServletRequest request) { - ActionErrors errors = new ActionErrors(); - // get sessionMap - String sessionMapID = request.getParameter(SurveyConstants.ATTR_SESSION_MAP_ID); - SessionMap sessionMap = (SessionMap) request.getSession() - .getAttribute(sessionMapID); - Long sessionID = (Long) sessionMap.get(AttributeNames.PARAM_TOOL_SESSION_ID); - Collection answerDtoList = getQuestionList(sessionMap).values(); - - for (AnswerDTO answerDto : answerDtoList) { - SurveyAnswer answer = getAnswerFromPage(request, answerDto, sessionID); - answerDto.setAnswer(answer); - validateAnswers(request, answerDto, errors, answer); - } - if (!errors.isEmpty()) { - addErrors(request, errors); - } - return errors; - } - - private void validateAnswers(HttpServletRequest request, AnswerDTO question, ActionErrors errors, - SurveyAnswer answer) { - boolean isAnswerEmpty = ((answer.getChoices() == null) && StringUtils.isBlank(answer.getAnswerText())); - - // for mandatory questions, answer can not be null. - if (!question.isOptional() && isAnswerEmpty) { - errors.add(SurveyConstants.ERROR_MSG_KEY + question.getUid(), - new ActionMessage(SurveyConstants.ERROR_MSG_MANDATORY_QUESTION)); - } - if ((question.getType() == SurveyConstants.QUESTION_TYPE_SINGLE_CHOICE) && question.isAppendText() - && !isAnswerEmpty) { - // for single choice, user only can choose one option or open text (if it has) - if (!StringUtils.isBlank(answer.getAnswerChoices()) && !StringUtils.isBlank(answer.getAnswerText())) { - errors.add(SurveyConstants.ERROR_MSG_KEY + question.getUid(), - new ActionMessage(SurveyConstants.ERROR_MSG_SINGLE_CHOICE)); - } - } - } - - private SurveyAnswer getAnswerFromPage(HttpServletRequest request, AnswerDTO question, Long sessionID) { - - String[] choiceList = request.getParameterValues(SurveyConstants.PREFIX_QUESTION_CHOICE + question.getUid()); - String textEntry = request.getParameter(SurveyConstants.PREFIX_QUESTION_TEXT + question.getUid()); - - SurveyAnswer answer = question.getAnswer(); - if (answer == null) { - answer = new SurveyAnswer(); - } - answer.setAnswerChoices(SurveyWebUtils.getChoicesStr(choiceList)); - answer.setChoices(choiceList); - - answer.setAnswerText(textEntry); - - ISurveyService service = getSurveyService(); - answer.setUser(getCurrentUser(service, sessionID)); - answer.setUpdateDate(new Timestamp(new Date().getTime())); - answer.setSurveyQuestion(question); - return answer; - } - - private ISurveyService getSurveyService() { - WebApplicationContext wac = WebApplicationContextUtils - .getRequiredWebApplicationContext(getServlet().getServletContext()); - return (ISurveyService) wac.getBean(SurveyConstants.SURVEY_SERVICE); - } - - /** - * List save current survey items. - * - * @param request - * @return - */ - private SortedMap getQuestionList(SessionMap sessionMap) { - SortedMap list = (SortedMap) sessionMap - .get(SurveyConstants.ATTR_QUESTION_LIST); - if (list == null) { - list = new TreeMap<>(new IntegerComparator()); - sessionMap.put(SurveyConstants.ATTR_QUESTION_LIST, list); - } - return list; - } - - private SurveyUser getCurrentUser(ISurveyService service, Long sessionId) { - // try to get form system session - HttpSession ss = SessionManager.getSession(); - // get back login user DTO - UserDTO user = (UserDTO) ss.getAttribute(AttributeNames.USER); - SurveyUser surveyUser = service.getUserByIDAndSession(new Long(user.getUserID().intValue()), sessionId); - - if (surveyUser == null) { - SurveySession session = service.getSurveySessionBySessionId(sessionId); - surveyUser = new SurveyUser(user, session); - service.createUser(surveyUser); - } - return surveyUser; - } - - private SurveyUser getSpecifiedUser(ISurveyService service, Long sessionId, Integer userId) { - return service.getUserByIDAndSession(new Long(userId.intValue()), sessionId); - } - -} +///**************************************************************** +// * 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.0 +// * as published by the Free Software Foundation. +// * +// * This program is distributed in the hope that it will be useful, +// * but WITHOUT ANY WARRANTY; without even the implied warranty of +// * 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 +// * **************************************************************** +// */ +// +//package org.lamsfoundation.lams.tool.survey.web.controller; +// +//import java.io.IOException; +//import java.sql.Timestamp; +//import java.util.ArrayList; +//import java.util.Collection; +//import java.util.Date; +//import java.util.List; +//import java.util.Map; +//import java.util.SortedMap; +//import java.util.TimeZone; +//import java.util.TreeMap; +// +//import javax.servlet.ServletException; +//import javax.servlet.http.HttpServletRequest; +//import javax.servlet.http.HttpServletResponse; +//import javax.servlet.http.HttpSession; +// +//import org.apache.commons.lang.StringEscapeUtils; +//import org.apache.commons.lang.StringUtils; +//import org.apache.log4j.Logger; +//import org.apache.struts.action.Action; +//import org.apache.struts.action.ActionErrors; +//import org.apache.struts.action.ActionForm; +//import org.apache.struts.action.ActionForward; +//import org.apache.struts.action.ActionMapping; +//import org.apache.struts.action.ActionMessage; +//import org.apache.struts.action.ActionRedirect; +//import org.lamsfoundation.lams.learning.web.bean.ActivityPositionDTO; +//import org.lamsfoundation.lams.learning.web.util.LearningWebUtil; +//import org.lamsfoundation.lams.notebook.model.NotebookEntry; +//import org.lamsfoundation.lams.notebook.service.CoreNotebookConstants; +//import org.lamsfoundation.lams.tool.ToolAccessMode; +//import org.lamsfoundation.lams.tool.survey.SurveyConstants; +//import org.lamsfoundation.lams.tool.survey.dto.AnswerDTO; +//import org.lamsfoundation.lams.tool.survey.model.Survey; +//import org.lamsfoundation.lams.tool.survey.model.SurveyAnswer; +//import org.lamsfoundation.lams.tool.survey.model.SurveyQuestion; +//import org.lamsfoundation.lams.tool.survey.model.SurveySession; +//import org.lamsfoundation.lams.tool.survey.model.SurveyUser; +//import org.lamsfoundation.lams.tool.survey.service.ISurveyService; +//import org.lamsfoundation.lams.tool.survey.service.SurveyApplicationException; +//import org.lamsfoundation.lams.tool.survey.util.IntegerComparator; +//import org.lamsfoundation.lams.tool.survey.util.SurveyWebUtils; +//import org.lamsfoundation.lams.tool.survey.web.form.AnswerForm; +//import org.lamsfoundation.lams.tool.survey.web.form.ReflectionForm; +//import org.lamsfoundation.lams.usermanagement.dto.UserDTO; +//import org.lamsfoundation.lams.util.DateUtil; +//import org.lamsfoundation.lams.util.WebUtil; +//import org.lamsfoundation.lams.web.session.SessionManager; +//import org.lamsfoundation.lams.web.util.AttributeNames; +//import org.lamsfoundation.lams.web.util.SessionMap; +//import org.springframework.web.context.WebApplicationContext; +//import org.springframework.web.context.support.WebApplicationContextUtils; +// +//import com.fasterxml.jackson.databind.node.ArrayNode; +//import com.fasterxml.jackson.databind.node.JsonNodeFactory; +//import com.fasterxml.jackson.databind.node.ObjectNode; +// +///** +// * +// * @author Steve.Ni +// * +// * @version $Revision$ +// */ +//public class LearningAction extends Action { +// +// private static Logger log = Logger.getLogger(LearningAction.class); +// +// @Override +// public ActionForward execute(ActionMapping mapping, ActionForm form, HttpServletRequest request, +// HttpServletResponse response) throws IOException, ServletException { +// +// String param = mapping.getParameter(); +// // -----------------------Survey Learner function --------------------------- +// if (param.equals("start")) { +// return start(mapping, form, request, response); +// } +// if (param.equals("previousQuestion")) { +// return previousQuestion(mapping, form, request, response); +// } +// if (param.equals("nextQuestion")) { +// return nextQuestion(mapping, form, request, response); +// } +// if (param.equals("doSurvey")) { +// return doSurvey(mapping, form, request, response); +// } +// +// if (param.equals("retake")) { +// return retake(mapping, form, request, response); +// } +// +// if (param.equals("showOtherUsersAnswers")) { +// return showOtherUsersAnswers(mapping, form, request, response); +// } +// +// if (param.equals("getOpenResponses")) { +// return getOpenResponses(mapping, form, request, response); +// } +// +// if (param.equals("finish")) { +// return finish(mapping, form, request, response); +// } +// +// // ================ Reflection ======================= +// if (param.equals("newReflection")) { +// return newReflection(mapping, form, request, response); +// } +// if (param.equals("submitReflection")) { +// return submitReflection(mapping, form, request, response); +// } +// +// return mapping.findForward(SurveyConstants.ERROR); +// } +// +// /** +// * Read survey data from database and put them into HttpSession. It will redirect to init.do directly after this +// * method run successfully. +// * +// * This method will avoid read database again and lost un-saved resouce item lost when user "refresh page", +// * +// */ +// private ActionForward start(ActionMapping mapping, ActionForm form, HttpServletRequest request, +// HttpServletResponse response) { +// +// AnswerForm answerForm = (AnswerForm) form; +// // initial Session Map +// SessionMap sessionMap = new SessionMap<>(); +// String sessionMapID = sessionMap.getSessionID(); +// request.getSession().setAttribute(sessionMapID, sessionMap); +// answerForm.setSessionMapID(sessionMapID); +// +// // save toolContentID into HTTPSession +// ToolAccessMode mode = WebUtil.readToolAccessModeParam(request, AttributeNames.PARAM_MODE, true); +// Long sessionId = new Long(request.getParameter(AttributeNames.PARAM_TOOL_SESSION_ID)); +// // it will be use when submissionDeadline or lock on finish page. +// request.setAttribute(SurveyConstants.ATTR_SESSION_MAP_ID, sessionMapID); +// +// // get back the survey and question list and display them on page +// ISurveyService service = getSurveyService(); +// SurveyUser surveyUser = null; +// if ((mode != null) && mode.isTeacher()) { +// // monitoring mode - user is specified in URL +// surveyUser = getSpecifiedUser(service, sessionId, +// WebUtil.readIntParam(request, AttributeNames.PARAM_USER_ID, false)); +// // setting Learner +// Long userID = WebUtil.readLongParam(request, AttributeNames.PARAM_USER_ID, true); +// answerForm.setUserID(userID); +// } else { +// surveyUser = getCurrentUser(service, sessionId); +// } +// +// List answers = service.getQuestionAnswers(sessionId, surveyUser.getUid()); +// Survey survey = service.getSurveyBySessionId(sessionId); +// +// // get notebook entry +// String entryText = new String(); +// NotebookEntry notebookEntry = service.getEntry(sessionId, CoreNotebookConstants.NOTEBOOK_TOOL, +// SurveyConstants.TOOL_SIGNATURE, surveyUser.getUserId().intValue()); +// +// if (notebookEntry != null) { +// entryText = notebookEntry.getEntry(); +// } +// +// // get session from shared session. +// HttpSession ss = SessionManager.getSession(); +// +// // basic information +// sessionMap.put(SurveyConstants.ATTR_TITLE, survey.getTitle()); +// sessionMap.put(SurveyConstants.ATTR_SURVEY_INSTRUCTION, survey.getInstructions()); +// // check whehter finish lock is on/off +// boolean lock = survey.getLockWhenFinished() && surveyUser.isSessionFinished(); +// sessionMap.put(SurveyConstants.ATTR_FINISH_LOCK, lock); +// sessionMap.put(SurveyConstants.ATTR_LOCK_ON_FINISH, survey.getLockWhenFinished()); +// sessionMap.put(SurveyConstants.ATTR_SHOW_ON_ONE_PAGE, survey.isShowOnePage()); +// sessionMap.put(SurveyConstants.ATTR_SHOW_OTHER_USERS_ANSWERS, survey.isShowOtherUsersAnswers()); +// sessionMap.put(SurveyConstants.ATTR_USER_FINISHED, surveyUser.isSessionFinished()); +// sessionMap.put(SurveyConstants.ATTR_USER, surveyUser); +// +// sessionMap.put(AttributeNames.PARAM_TOOL_SESSION_ID, sessionId); +// sessionMap.put(AttributeNames.ATTR_MODE, mode); +// // reflection information +// sessionMap.put(SurveyConstants.ATTR_REFLECTION_ON, survey.isReflectOnActivity()); +// sessionMap.put(SurveyConstants.ATTR_REFLECTION_INSTRUCTION, survey.getReflectInstructions()); +// sessionMap.put(SurveyConstants.ATTR_REFLECTION_ENTRY, entryText); +// +// // add define later support +// if (survey.isDefineLater()) { +// return mapping.findForward(SurveyConstants.DEFINE_LATER); +// } +// +// // set contentInUse flag to true! +// survey.setContentInUse(true); +// survey.setDefineLater(false); +// service.saveOrUpdateSurvey(survey); +// +// ActivityPositionDTO activityPosition = LearningWebUtil.putActivityPositionInRequestByToolSessionId(sessionId, +// request, getServlet().getServletContext()); +// sessionMap.put(AttributeNames.ATTR_ACTIVITY_POSITION, activityPosition); +// +// // check if there is submission deadline +// Date submissionDeadline = survey.getSubmissionDeadline(); +// if (submissionDeadline != null) { +// // store submission deadline to sessionMap +// sessionMap.put(SurveyConstants.ATTR_SUBMISSION_DEADLINE, submissionDeadline); +// +// UserDTO learnerDto = (UserDTO) ss.getAttribute(AttributeNames.USER); +// TimeZone learnerTimeZone = learnerDto.getTimeZone(); +// Date tzSubmissionDeadline = DateUtil.convertToTimeZoneFromDefault(learnerTimeZone, submissionDeadline); +// Date currentLearnerDate = DateUtil.convertToTimeZoneFromDefault(learnerTimeZone, new Date()); +// +// // calculate whether submission deadline has passed, and if so forward to "submissionDeadline" +// if (currentLearnerDate.after(tzSubmissionDeadline)) { +// return mapping.findForward("submissionDeadline"); +// } +// } +// +// // init survey item list +// SortedMap surveyItemList = getQuestionList(sessionMap); +// surveyItemList.clear(); +// if (answers != null) { +// for (AnswerDTO answer : answers) { +// surveyItemList.put(answer.getSequenceId(), answer); +// } +// } +// if (survey.isShowOnePage()) { +// answerForm.setQuestionSeqID(null); +// } else { +// if (surveyItemList.size() > 0) { +// answerForm.setQuestionSeqID(surveyItemList.firstKey()); +// } +// } +// sessionMap.put(SurveyConstants.ATTR_TOTAL_QUESTIONS, surveyItemList.size()); +// answerForm.setCurrentIdx(1); +// +// if (surveyItemList.size() < 2) { +// answerForm.setPosition(SurveyConstants.POSITION_ONLY_ONE); +// } else { +// answerForm.setPosition(SurveyConstants.POSITION_FIRST); +// } +// +// // if session is finished go to result pages. +// if (surveyUser.isSessionFinished() && !survey.isShowOtherUsersAnswers()) { +// return mapping.findForward(SurveyConstants.FORWARD_RESULT); +// +// //if show other users is ON and response is finalized - show results page with other users answers +// } else if (survey.isShowOtherUsersAnswers() && surveyUser.isResponseFinalized()) { +// ActionRedirect redirect = new ActionRedirect(mapping.findForwardConfig("resultOtherUsers")); +// redirect.addParameter(SurveyConstants.ATTR_SESSION_MAP_ID, sessionMapID); +// return redirect; +// +// } else { +// return mapping.findForward(SurveyConstants.SUCCESS); +// } +// } +// +// private ActionForward nextQuestion(ActionMapping mapping, ActionForm form, HttpServletRequest request, +// HttpServletResponse response) { +// AnswerForm answerForm = (AnswerForm) form; +// Integer questionSeqID = answerForm.getQuestionSeqID(); +// String sessionMapID = answerForm.getSessionMapID(); +// +// SessionMap sessionMap = (SessionMap) request.getSession() +// .getAttribute(sessionMapID); +// SortedMap surveyItemMap = getQuestionList(sessionMap); +// +// ActionErrors errors = getAnswer(request, surveyItemMap.get(questionSeqID)); +// if (!errors.isEmpty()) { +// return mapping.getInputForward(); +// } +// +// // go to next question +// boolean next = false; +// for (Map.Entry entry : surveyItemMap.entrySet()) { +// if (entry.getKey().equals(questionSeqID)) { +// next = true; +// // failure tolerance: if arrive last one +// questionSeqID = entry.getKey(); +// continue; +// } +// if (next) { +// questionSeqID = entry.getKey(); +// break; +// } +// } +// // get current question index of total questions +// int currIdx = new ArrayList<>(surveyItemMap.keySet()).indexOf(questionSeqID) + 1; +// answerForm.setCurrentIdx(currIdx); +// // failure tolerance +// if (questionSeqID.equals(surveyItemMap.lastKey())) { +// answerForm.setPosition(SurveyConstants.POSITION_LAST); +// } else { +// answerForm.setPosition(SurveyConstants.POSITION_INSIDE); +// } +// answerForm.setQuestionSeqID(questionSeqID); +// return mapping.findForward(SurveyConstants.SUCCESS); +// } +// +// private ActionForward previousQuestion(ActionMapping mapping, ActionForm form, HttpServletRequest request, +// HttpServletResponse response) { +// AnswerForm answerForm = (AnswerForm) form; +// Integer questionSeqID = answerForm.getQuestionSeqID(); +// String sessionMapID = answerForm.getSessionMapID(); +// +// SessionMap sessionMap = (SessionMap) request.getSession() +// .getAttribute(sessionMapID); +// SortedMap surveyItemMap = getQuestionList(sessionMap); +// +// ActionErrors errors = getAnswer(request, surveyItemMap.get(questionSeqID)); +// if (!errors.isEmpty()) { +// return mapping.getInputForward(); +// } +// +// SortedMap subMap = surveyItemMap.headMap(questionSeqID); +// if (subMap.isEmpty()) { +// questionSeqID = surveyItemMap.firstKey(); +// } else { +// questionSeqID = subMap.lastKey(); +// } +// +// // get current question index of total questions +// int currIdx = new ArrayList<>(surveyItemMap.keySet()).indexOf(questionSeqID) + 1; +// answerForm.setCurrentIdx(currIdx); +// +// if (questionSeqID.equals(surveyItemMap.firstKey())) { +// answerForm.setPosition(SurveyConstants.POSITION_FIRST); +// } else { +// answerForm.setPosition(SurveyConstants.POSITION_INSIDE); +// } +// answerForm.setQuestionSeqID(questionSeqID); +// return mapping.findForward(SurveyConstants.SUCCESS); +// } +// +// private ActionForward retake(ActionMapping mapping, ActionForm form, HttpServletRequest request, +// HttpServletResponse response) { +// AnswerForm answerForm = (AnswerForm) form; +// Integer questionSeqID = answerForm.getQuestionSeqID(); +// +// String sessionMapID = answerForm.getSessionMapID(); +// SessionMap sessionMap = (SessionMap) request.getSession() +// .getAttribute(sessionMapID); +// +// SortedMap surveyItemMap = getQuestionList(sessionMap); +// Collection surveyItemList = surveyItemMap.values(); +// +// if (surveyItemList.size() < 2 || (questionSeqID != null && questionSeqID > 0)) { +// answerForm.setPosition(SurveyConstants.POSITION_ONLY_ONE); +// } else { +// answerForm.setPosition(SurveyConstants.POSITION_FIRST); +// } +// if (questionSeqID == null || questionSeqID <= 0) { +// Boolean onePage = (Boolean) sessionMap.get(SurveyConstants.ATTR_SHOW_ON_ONE_PAGE); +// if (!onePage && surveyItemList.size() > 0) { +// answerForm.setQuestionSeqID(surveyItemMap.firstKey()); +// questionSeqID = surveyItemMap.firstKey(); +// } +// } +// +// // get current question index of total questions +// int currIdx = new ArrayList<>(surveyItemMap.keySet()).indexOf(questionSeqID) + 1; +// answerForm.setCurrentIdx(currIdx); +// +// return mapping.findForward(SurveyConstants.SUCCESS); +// } +// +// private ActionForward showOtherUsersAnswers(ActionMapping mapping, ActionForm form, HttpServletRequest request, +// HttpServletResponse response) { +// ISurveyService service = getSurveyService(); +// String sessionMapID = request.getParameter("sessionMapID"); +// request.setAttribute("sessionMapID", sessionMapID); +// SessionMap sessionMap = (SessionMap) request.getSession() +// .getAttribute(sessionMapID); +// +// SortedMap surveyItemMap = getQuestionList(sessionMap); +// Long sessionId = (Long) sessionMap.get(AttributeNames.PARAM_TOOL_SESSION_ID); +// +// List answerDtos = new ArrayList<>(); +// for (SurveyQuestion question : surveyItemMap.values()) { +// AnswerDTO answerDto = service.getQuestionResponse(sessionId, question.getUid()); +// answerDtos.add(answerDto); +// } +// request.setAttribute("answerDtos", answerDtos); +// +// SurveyUser surveyLearner = (SurveyUser) sessionMap.get(SurveyConstants.ATTR_USER); +// service.setResponseFinalized(surveyLearner.getUid()); +// +// int countFinishedUser = service.getCountFinishedUsers(sessionId); +// request.setAttribute(SurveyConstants.ATTR_COUNT_FINISHED_USERS, countFinishedUser); +// +// return mapping.findForward(SurveyConstants.SUCCESS); +// } +// +// /** +// * Get OpenResponses. +// */ +// private ActionForward getOpenResponses(ActionMapping mapping, ActionForm form, HttpServletRequest request, +// HttpServletResponse res) throws IOException, ServletException { +// ISurveyService service = getSurveyService(); +// +// Long questionUid = WebUtil.readLongParam(request, "questionUid"); +// Long sessionId = WebUtil.readLongParam(request, "sessionId"); +// +// //paging parameters of tablesorter +// int size = WebUtil.readIntParam(request, "size"); +// int page = WebUtil.readIntParam(request, "page"); +// Integer isSort1 = WebUtil.readIntParam(request, "column[0]", true); +// +// int sorting = SurveyConstants.SORT_BY_DEAFAULT; +// if (isSort1 != null && isSort1.equals(0)) { +// sorting = SurveyConstants.SORT_BY_ANSWER_ASC; +// } else if (isSort1 != null && isSort1.equals(1)) { +// sorting = SurveyConstants.SORT_BY_ANSWER_DESC; +// } +// +// List responses = service.getOpenResponsesForTablesorter(sessionId, questionUid, page, size, sorting); +// +// ArrayNode rows = JsonNodeFactory.instance.arrayNode(); +// +// ObjectNode responcedata = JsonNodeFactory.instance.objectNode(); +// responcedata.put("total_rows", service.getCountResponsesBySessionAndQuestion(sessionId, questionUid)); +// +// for (String response : responses) { +// //ArrayNode cell=JsonNodeFactory.instance.arrayNode(); +// //cell.put(HtmlUtils.htmlEscape(user.getFirstName()) + " " + HtmlUtils.htmlEscape(user.getLastName()) + " [" + HtmlUtils.htmlEscape(user.getLogin()) + "]"); +// +// ObjectNode responseRow = JsonNodeFactory.instance.objectNode(); +// responseRow.put("answer", StringEscapeUtils.escapeCsv(response)); +//// responseRow.put("attemptTime", response.getAttemptTime()); +// +// rows.add(responseRow); +// } +// responcedata.set("rows", rows); +// res.setContentType("application/json;charset=utf-8"); +// res.getWriter().print(new String(responcedata.toString())); +// return null; +// } +// +// private ActionForward doSurvey(ActionMapping mapping, ActionForm form, HttpServletRequest request, +// HttpServletResponse response) { +// ISurveyService service = getSurveyService(); +// +// AnswerForm answerForm = (AnswerForm) form; +// Integer questionSeqID = answerForm.getQuestionSeqID(); +// String sessionMapID = answerForm.getSessionMapID(); +// SessionMap sessionMap = (SessionMap) request.getSession() +// .getAttribute(sessionMapID); +// +// // validate +// SortedMap surveyItemMap = getQuestionList(sessionMap); +// Collection surveyItemList = surveyItemMap.values(); +// +// SurveyUser surveyLearner = (SurveyUser) sessionMap.get(SurveyConstants.ATTR_USER); +// Long sessionId = (Long) sessionMap.get(AttributeNames.PARAM_TOOL_SESSION_ID); +// +// ActionErrors errors; +// if ((questionSeqID == null) || questionSeqID.equals(0)) { +// errors = getAnswers(request); +// } else { +// errors = getAnswer(request, surveyItemMap.get(questionSeqID)); +// } +// if (!errors.isEmpty()) { +// return mapping.getInputForward(); +// } +// +// List answerList = new ArrayList<>(); +// for (AnswerDTO question : surveyItemList) { +// if (question.getAnswer() != null) { +// question.getAnswer().setUser(surveyLearner); +// answerList.add(question.getAnswer()); +// } +// } +// +// service.updateAnswerList(answerList); +// +// request.setAttribute(SurveyConstants.ATTR_SESSION_MAP_ID, sessionMapID); +// +// Survey survey = service.getSurveyBySessionId(sessionId); +// if (survey.isNotifyTeachersOnAnswerSumbit()) { +// service.notifyTeachersOnAnswerSumbit(sessionId, surveyLearner); +// } +// +// return mapping.findForward(SurveyConstants.SUCCESS); +// } +// +// /** +// * Finish learning session. +// * +// * @param mapping +// * @param form +// * @param request +// * @param response +// * @return +// */ +// private ActionForward finish(ActionMapping mapping, ActionForm form, HttpServletRequest request, +// HttpServletResponse response) { +// +// // get back SessionMap +// String sessionMapID = request.getParameter(SurveyConstants.ATTR_SESSION_MAP_ID); +// SessionMap sessionMap = (SessionMap) request.getSession() +// .getAttribute(sessionMapID); +// +// // get mode and ToolSessionID from sessionMAP +// Long sessionId = (Long) sessionMap.get(AttributeNames.PARAM_TOOL_SESSION_ID); +// +// ISurveyService service = getSurveyService(); +// // get sessionId from HttpServletRequest +// String nextActivityUrl = null; +// try { +// HttpSession ss = SessionManager.getSession(); +// UserDTO user = (UserDTO) ss.getAttribute(AttributeNames.USER); +// Long userID = new Long(user.getUserID().longValue()); +// +// nextActivityUrl = service.finishToolSession(sessionId, userID); +// request.setAttribute(SurveyConstants.ATTR_NEXT_ACTIVITY_URL, nextActivityUrl); +// } catch (SurveyApplicationException e) { +// LearningAction.log.error("Failed get next activity url:" + e.getMessage()); +// } +// +// return mapping.findForward(SurveyConstants.SUCCESS); +// } +// +// /** +// * Display empty reflection form. +// * +// * @param mapping +// * @param form +// * @param request +// * @param response +// * @return +// */ +// private ActionForward newReflection(ActionMapping mapping, ActionForm form, HttpServletRequest request, +// HttpServletResponse response) { +// +// // get session value +// String sessionMapID = WebUtil.readStrParam(request, SurveyConstants.ATTR_SESSION_MAP_ID); +// +// ReflectionForm refForm = (ReflectionForm) form; +// HttpSession ss = SessionManager.getSession(); +// UserDTO user = (UserDTO) ss.getAttribute(AttributeNames.USER); +// +// refForm.setUserID(user.getUserID()); +// refForm.setSessionMapID(sessionMapID); +// +// // get the existing reflection entry +// ISurveyService submitFilesService = getSurveyService(); +// +// SessionMap map = (SessionMap) request.getSession().getAttribute(sessionMapID); +// Long toolSessionID = (Long) map.get(AttributeNames.PARAM_TOOL_SESSION_ID); +// NotebookEntry entry = submitFilesService.getEntry(toolSessionID, CoreNotebookConstants.NOTEBOOK_TOOL, +// SurveyConstants.TOOL_SIGNATURE, user.getUserID()); +// +// if (entry != null) { +// refForm.setEntryText(entry.getEntry()); +// } +// +// return mapping.findForward(SurveyConstants.SUCCESS); +// } +// +// /** +// * Submit reflection form input database. +// * +// * @param mapping +// * @param form +// * @param request +// * @param response +// * @return +// */ +// private ActionForward submitReflection(ActionMapping mapping, ActionForm form, HttpServletRequest request, +// HttpServletResponse response) { +// ReflectionForm refForm = (ReflectionForm) form; +// Integer userId = refForm.getUserID(); +// +// String sessionMapID = WebUtil.readStrParam(request, SurveyConstants.ATTR_SESSION_MAP_ID); +// SessionMap sessionMap = (SessionMap) request.getSession() +// .getAttribute(sessionMapID); +// Long sessionId = (Long) sessionMap.get(AttributeNames.PARAM_TOOL_SESSION_ID); +// +// ISurveyService service = getSurveyService(); +// +// // check for existing notebook entry +// NotebookEntry entry = service.getEntry(sessionId, CoreNotebookConstants.NOTEBOOK_TOOL, +// SurveyConstants.TOOL_SIGNATURE, userId); +// +// if (entry == null) { +// // create new entry +// service.createNotebookEntry(sessionId, CoreNotebookConstants.NOTEBOOK_TOOL, SurveyConstants.TOOL_SIGNATURE, +// userId, refForm.getEntryText()); +// } else { +// // update existing entry +// entry.setEntry(refForm.getEntryText()); +// entry.setLastModified(new Date()); +// service.updateEntry(entry); +// } +// +// return finish(mapping, form, request, response); +// } +// +// // ************************************************************************************* +// // Private method +// // ************************************************************************************* +// /** +// * Get answer by special question. +// */ +// private ActionErrors getAnswer(HttpServletRequest request, AnswerDTO answerDto) { +// ActionErrors errors = new ActionErrors(); +// // get sessionMap +// String sessionMapID = request.getParameter(SurveyConstants.ATTR_SESSION_MAP_ID); +// SessionMap sessionMap = (SessionMap) request.getSession() +// .getAttribute(sessionMapID); +// Long sessionID = (Long) sessionMap.get(AttributeNames.PARAM_TOOL_SESSION_ID); +// +// SurveyAnswer answer = getAnswerFromPage(request, answerDto, sessionID); +// answerDto.setAnswer(answer); +// validateAnswers(request, answerDto, errors, answer); +// if (!errors.isEmpty()) { +// addErrors(request, errors); +// } +// return errors; +// } +// +// /** +// * Get all answer for all questions in this page +// * +// * @param request +// * @return +// */ +// private ActionErrors getAnswers(HttpServletRequest request) { +// ActionErrors errors = new ActionErrors(); +// // get sessionMap +// String sessionMapID = request.getParameter(SurveyConstants.ATTR_SESSION_MAP_ID); +// SessionMap sessionMap = (SessionMap) request.getSession() +// .getAttribute(sessionMapID); +// Long sessionID = (Long) sessionMap.get(AttributeNames.PARAM_TOOL_SESSION_ID); +// Collection answerDtoList = getQuestionList(sessionMap).values(); +// +// for (AnswerDTO answerDto : answerDtoList) { +// SurveyAnswer answer = getAnswerFromPage(request, answerDto, sessionID); +// answerDto.setAnswer(answer); +// validateAnswers(request, answerDto, errors, answer); +// } +// if (!errors.isEmpty()) { +// addErrors(request, errors); +// } +// return errors; +// } +// +// private void validateAnswers(HttpServletRequest request, AnswerDTO question, ActionErrors errors, +// SurveyAnswer answer) { +// boolean isAnswerEmpty = ((answer.getChoices() == null) && StringUtils.isBlank(answer.getAnswerText())); +// +// // for mandatory questions, answer can not be null. +// if (!question.isOptional() && isAnswerEmpty) { +// errors.add(SurveyConstants.ERROR_MSG_KEY + question.getUid(), +// new ActionMessage(SurveyConstants.ERROR_MSG_MANDATORY_QUESTION)); +// } +// if ((question.getType() == SurveyConstants.QUESTION_TYPE_SINGLE_CHOICE) && question.isAppendText() +// && !isAnswerEmpty) { +// // for single choice, user only can choose one option or open text (if it has) +// if (!StringUtils.isBlank(answer.getAnswerChoices()) && !StringUtils.isBlank(answer.getAnswerText())) { +// errors.add(SurveyConstants.ERROR_MSG_KEY + question.getUid(), +// new ActionMessage(SurveyConstants.ERROR_MSG_SINGLE_CHOICE)); +// } +// } +// } +// +// private SurveyAnswer getAnswerFromPage(HttpServletRequest request, AnswerDTO question, Long sessionID) { +// +// String[] choiceList = request.getParameterValues(SurveyConstants.PREFIX_QUESTION_CHOICE + question.getUid()); +// String textEntry = request.getParameter(SurveyConstants.PREFIX_QUESTION_TEXT + question.getUid()); +// +// SurveyAnswer answer = question.getAnswer(); +// if (answer == null) { +// answer = new SurveyAnswer(); +// } +// answer.setAnswerChoices(SurveyWebUtils.getChoicesStr(choiceList)); +// answer.setChoices(choiceList); +// +// answer.setAnswerText(textEntry); +// +// ISurveyService service = getSurveyService(); +// answer.setUser(getCurrentUser(service, sessionID)); +// answer.setUpdateDate(new Timestamp(new Date().getTime())); +// answer.setSurveyQuestion(question); +// return answer; +// } +// +// private ISurveyService getSurveyService() { +// WebApplicationContext wac = WebApplicationContextUtils +// .getRequiredWebApplicationContext(getServlet().getServletContext()); +// return (ISurveyService) wac.getBean(SurveyConstants.SURVEY_SERVICE); +// } +// +// /** +// * List save current survey items. +// * +// * @param request +// * @return +// */ +// private SortedMap getQuestionList(SessionMap sessionMap) { +// SortedMap list = (SortedMap) sessionMap +// .get(SurveyConstants.ATTR_QUESTION_LIST); +// if (list == null) { +// list = new TreeMap<>(new IntegerComparator()); +// sessionMap.put(SurveyConstants.ATTR_QUESTION_LIST, list); +// } +// return list; +// } +// +// private SurveyUser getCurrentUser(ISurveyService service, Long sessionId) { +// // try to get form system session +// HttpSession ss = SessionManager.getSession(); +// // get back login user DTO +// UserDTO user = (UserDTO) ss.getAttribute(AttributeNames.USER); +// SurveyUser surveyUser = service.getUserByIDAndSession(new Long(user.getUserID().intValue()), sessionId); +// +// if (surveyUser == null) { +// SurveySession session = service.getSurveySessionBySessionId(sessionId); +// surveyUser = new SurveyUser(user, session); +// service.createUser(surveyUser); +// } +// return surveyUser; +// } +// +// private SurveyUser getSpecifiedUser(ISurveyService service, Long sessionId, Integer userId) { +// return service.getUserByIDAndSession(new Long(userId.intValue()), sessionId); +// } +// +//} Index: lams_tool_survey/src/java/org/lamsfoundation/lams/tool/survey/web/form/AnswerForm.java =================================================================== diff -u -r2f725f8ef2aa09a2663b2335bf67213074426d11 -r333795a363a0275e5f1fd182c9f6acaf7a8b7edd --- lams_tool_survey/src/java/org/lamsfoundation/lams/tool/survey/web/form/AnswerForm.java (.../AnswerForm.java) (revision 2f725f8ef2aa09a2663b2335bf67213074426d11) +++ lams_tool_survey/src/java/org/lamsfoundation/lams/tool/survey/web/form/AnswerForm.java (.../AnswerForm.java) (revision 333795a363a0275e5f1fd182c9f6acaf7a8b7edd) @@ -23,16 +23,14 @@ package org.lamsfoundation.lams.tool.survey.web.form; -import org.apache.struts.action.ActionForm; - /** * Survey Item Form. * * @author Steve.Ni * * @version $Revision$ */ -public class AnswerForm extends ActionForm { +public class AnswerForm { private String sessionMapID; private Integer questionSeqID; private int position; Index: lams_tool_survey/src/java/org/lamsfoundation/lams/tool/survey/web/form/QuestionForm.java =================================================================== diff -u -r2f725f8ef2aa09a2663b2335bf67213074426d11 -r333795a363a0275e5f1fd182c9f6acaf7a8b7edd --- lams_tool_survey/src/java/org/lamsfoundation/lams/tool/survey/web/form/QuestionForm.java (.../QuestionForm.java) (revision 2f725f8ef2aa09a2663b2335bf67213074426d11) +++ lams_tool_survey/src/java/org/lamsfoundation/lams/tool/survey/web/form/QuestionForm.java (.../QuestionForm.java) (revision 333795a363a0275e5f1fd182c9f6acaf7a8b7edd) @@ -25,8 +25,6 @@ import javax.servlet.http.HttpServletRequest; -import org.apache.struts.action.ActionForm; -import org.apache.struts.action.ActionMapping; import org.lamsfoundation.lams.tool.survey.model.SurveyQuestion; /** @@ -36,7 +34,7 @@ * * @version $Revision$ */ -public class QuestionForm extends ActionForm { +public class QuestionForm { private String itemIndex; //1: single or multiple choice question;3:open text question @@ -53,8 +51,7 @@ question = new SurveyQuestion(); } - @Override - public void reset(ActionMapping mapping, HttpServletRequest request) { + public void reset(HttpServletRequest request) { if (question != null) { question.setAppendText(false); question.setOptional(false); Index: lams_tool_survey/src/java/org/lamsfoundation/lams/tool/survey/web/form/ReflectionForm.java =================================================================== diff -u -r2f725f8ef2aa09a2663b2335bf67213074426d11 -r333795a363a0275e5f1fd182c9f6acaf7a8b7edd --- lams_tool_survey/src/java/org/lamsfoundation/lams/tool/survey/web/form/ReflectionForm.java (.../ReflectionForm.java) (revision 2f725f8ef2aa09a2663b2335bf67213074426d11) +++ lams_tool_survey/src/java/org/lamsfoundation/lams/tool/survey/web/form/ReflectionForm.java (.../ReflectionForm.java) (revision 333795a363a0275e5f1fd182c9f6acaf7a8b7edd) @@ -21,19 +21,17 @@ * **************************************************************** */ - package org.lamsfoundation.lams.tool.survey.web.form; import org.apache.log4j.Logger; -import org.apache.struts.validator.ValidatorForm; /** * * Reflection Form. * * */ -public class ReflectionForm extends ValidatorForm { +public class ReflectionForm { private static final long serialVersionUID = -9054365604649146735L; private static Logger logger = Logger.getLogger(ReflectionForm.class.getName()); Index: lams_tool_survey/src/java/org/lamsfoundation/lams/tool/survey/web/form/SurveyConditionForm.java =================================================================== diff -u -r2f725f8ef2aa09a2663b2335bf67213074426d11 -r333795a363a0275e5f1fd182c9f6acaf7a8b7edd --- lams_tool_survey/src/java/org/lamsfoundation/lams/tool/survey/web/form/SurveyConditionForm.java (.../SurveyConditionForm.java) (revision 2f725f8ef2aa09a2663b2335bf67213074426d11) +++ lams_tool_survey/src/java/org/lamsfoundation/lams/tool/survey/web/form/SurveyConditionForm.java (.../SurveyConditionForm.java) (revision 333795a363a0275e5f1fd182c9f6acaf7a8b7edd) @@ -20,13 +20,12 @@ * **************************************************************** */ - package org.lamsfoundation.lams.tool.survey.web.form; import org.apache.struts.util.LabelValueBean; import org.lamsfoundation.lams.tool.survey.model.SurveyCondition; import org.lamsfoundation.lams.tool.survey.model.SurveyQuestion; -import org.lamsfoundation.lams.web.TextSearchActionForm; +import org.lamsfoundation.lams.web.TextSearchForm; /** * A text search form with additional parameters for Survey needs. @@ -35,7 +34,7 @@ * @author Marcin Cieslak * */ -public class SurveyConditionForm extends TextSearchActionForm { +public class SurveyConditionForm extends TextSearchForm { /** * Names of the questions that could be selected by a user. */ Index: lams_tool_survey/src/java/org/lamsfoundation/lams/tool/survey/web/form/SurveyForm.java =================================================================== diff -u -r2f725f8ef2aa09a2663b2335bf67213074426d11 -r333795a363a0275e5f1fd182c9f6acaf7a8b7edd --- lams_tool_survey/src/java/org/lamsfoundation/lams/tool/survey/web/form/SurveyForm.java (.../SurveyForm.java) (revision 2f725f8ef2aa09a2663b2335bf67213074426d11) +++ lams_tool_survey/src/java/org/lamsfoundation/lams/tool/survey/web/form/SurveyForm.java (.../SurveyForm.java) (revision 333795a363a0275e5f1fd182c9f6acaf7a8b7edd) @@ -27,8 +27,6 @@ import org.apache.commons.lang.StringUtils; import org.apache.log4j.Logger; -import org.apache.struts.action.ActionForm; -import org.apache.struts.action.ActionMapping; import org.apache.struts.upload.FormFile; import org.lamsfoundation.lams.tool.survey.model.Survey; @@ -39,7 +37,7 @@ * * User: Dapeng.Ni */ -public class SurveyForm extends ActionForm { +public class SurveyForm { private static final long serialVersionUID = 3599879328307492312L; private static Logger logger = Logger.getLogger(SurveyForm.class.getName()); @@ -67,9 +65,8 @@ } } - @Override - public void reset(ActionMapping mapping, HttpServletRequest request) { - String param = mapping.getParameter(); + public void reset(HttpServletRequest request, String param) { + // if it is start page, all data read out from database or current session // so need not reset checkbox to refresh value! if (!StringUtils.equals(param, "start") && !StringUtils.equals(param, "initPage")) { Index: lams_tool_survey/web/WEB-INF/tags/TextSearch.tag =================================================================== diff -u -r7b79396263b36a933d66390fb9ab12821956d59d -r333795a363a0275e5f1fd182c9f6acaf7a8b7edd --- lams_tool_survey/web/WEB-INF/tags/TextSearch.tag (.../TextSearch.tag) (revision 7b79396263b36a933d66390fb9ab12821956d59d) +++ lams_tool_survey/web/WEB-INF/tags/TextSearch.tag (.../TextSearch.tag) (revision 333795a363a0275e5f1fd182c9f6acaf7a8b7edd) @@ -53,10 +53,10 @@ <%-- Default value for message key --%> - + - + @@ -86,41 +86,41 @@ -
+ - +

- +
- +
- +
- +
Index: lams_tool_survey/web/pages/authoring/addCondition.jsp =================================================================== diff -u -r92cf398e695b34f71b03ecba27659e4b214920d8 -r333795a363a0275e5f1fd182c9f6acaf7a8b7edd --- lams_tool_survey/web/pages/authoring/addCondition.jsp (.../addCondition.jsp) (revision 92cf398e695b34f71b03ecba27659e4b214920d8) +++ lams_tool_survey/web/pages/authoring/addCondition.jsp (.../addCondition.jsp) (revision 333795a363a0275e5f1fd182c9f6acaf7a8b7edd) @@ -10,7 +10,7 @@
<%@ include file="/common/messages.jsp"%> - +
@@ -21,7 +21,7 @@ <%-- Text search form fields are being included --%>

- +
-