Index: lams_tool_assessment/src/java/org/lamsfoundation/lams/tool/assessment/web/controller/AuthoringController.java
===================================================================
diff -u -re6dc4db4137cfd6b07a4aa79711b9d12b39fb78e -r5d2334856d8fb3cbed3108641e3c4ea6d526cd70
--- lams_tool_assessment/src/java/org/lamsfoundation/lams/tool/assessment/web/controller/AuthoringController.java (.../AuthoringController.java) (revision e6dc4db4137cfd6b07a4aa79711b9d12b39fb78e)
+++ lams_tool_assessment/src/java/org/lamsfoundation/lams/tool/assessment/web/controller/AuthoringController.java (.../AuthoringController.java) (revision 5d2334856d8fb3cbed3108641e3c4ea6d526cd70)
@@ -84,7 +84,6 @@
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.ResponseStatus;
-import org.springframework.web.context.WebApplicationContext;
import org.springframework.web.util.HtmlUtils;
import com.fasterxml.jackson.databind.node.ArrayNode;
@@ -105,8 +104,6 @@
private IAssessmentService service;
@Autowired
private IQbService qbService;
- @Autowired
- WebApplicationContext applicationcontext;
/**
* Read assessment data from database and put them into HttpSession. It will redirect to init.do directly after this
@@ -373,12 +370,13 @@
return "pages/authoring/randomQuestion";
} else {
- // sessionMapID and questionType is already supplied as parameters
+ String url = "redirect:" + Configuration.get(ConfigurationKeys.SERVER_URL) + "qb/edit/initNewQuestion.do?"
+ + request.getQueryString();
boolean isAuthoringRestricted = (boolean) sessionMap.get(AssessmentConstants.ATTR_IS_AUTHORING_RESTRICTED);
- String params = "?" + AssessmentConstants.ATTR_IS_AUTHORING_RESTRICTED + "=" + isAuthoringRestricted;
+ url = WebUtil.appendParameterToURL(url, AssessmentConstants.ATTR_IS_AUTHORING_RESTRICTED,
+ String.valueOf(isAuthoringRestricted));
- forwardToEditQbQuestionController(request, response, "/qb/edit/initNewQuestion.do", params);
- return null;
+ return url;
}
}
@@ -412,28 +410,17 @@
boolean isAuthoringRestricted = (boolean) sessionMap.get(AssessmentConstants.ATTR_IS_AUTHORING_RESTRICTED);
AssessmentQuestion question = questionReference.getQuestion();
- // sessionMapID and questionType is already supplied as parameters
- String params = "?" + AssessmentConstants.ATTR_IS_AUTHORING_RESTRICTED + "=" + isAuthoringRestricted;
- params += "&qbQuestionUid=" + question.getQbQuestion().getUid();
+ String url = "redirect:" + Configuration.get(ConfigurationKeys.SERVER_URL) + "qb/edit/editQuestion.do?"
+ + request.getQueryString();
+ url = WebUtil.appendParameterToURL(url, AssessmentConstants.ATTR_IS_AUTHORING_RESTRICTED,
+ String.valueOf(isAuthoringRestricted));
+ url = WebUtil.appendParameterToURL(url, "qbQuestionUid", question.getQbQuestion().getUid().toString());
- forwardToEditQbQuestionController(request, response, "/qb/edit/editQuestion.do", params);
- return null;
+ return url;
}
}
/**
- * Forwards to the specified jsp page from Assessment tool.
- */
- private void forwardToEditQbQuestionController(HttpServletRequest request, HttpServletResponse response, String url,
- String params) throws ServletException, IOException {
- String serverURLContextPath = Configuration.get(ConfigurationKeys.SERVER_URL_CONTEXT_PATH);
- serverURLContextPath = serverURLContextPath.startsWith("/") ? serverURLContextPath : "/" + serverURLContextPath;
- serverURLContextPath += serverURLContextPath.endsWith("/") ? "" : "/";
- applicationcontext.getServletContext().getContext(serverURLContextPath).getRequestDispatcher(url + params)
- .forward(request, response);
- }
-
- /**
* This method will get necessary information from assessment question form and save or update into
* HttpSession
AssessmentQuestionList. 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
@@ -721,7 +708,6 @@
.intValue();
ArrayNode rows = JsonNodeFactory.instance.arrayNode();
- int i = 1;
for (QbQuestion question : questions) {
ArrayNode questionData = JsonNodeFactory.instance.arrayNode();
questionData.add(question.getUid());