Index: lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/McAppConstants.java
===================================================================
diff -u -r0f3f4e592b6337d5777631acfbd92d90a6211826 -r77f932966d3bc4ce011c78dc938f5a18f8f4a5c0
--- lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/McAppConstants.java (.../McAppConstants.java) (revision 0f3f4e592b6337d5777631acfbd92d90a6211826)
+++ lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/McAppConstants.java (.../McAppConstants.java) (revision 77f932966d3bc4ce011c78dc938f5a18f8f4a5c0)
@@ -44,6 +44,7 @@
public static final String MONITORING_STARTER ="monitoringStarter";
public static final String LOAD_LEARNER ="loadLearner";
public static final String LOAD_MONITORING ="loadMonitoring";
+ public static final String EXPORT_PORTFOLIO = "exportPortfolio";
public static final String INDIVIDUAL_REPORT ="individualReport";
public static final String VIEW_SUMMARY ="viewSummary";
public static final String REDO_QUESTIONS ="redoQuestions";
@@ -233,9 +234,6 @@
public static final String LIST_MONITORED_ANSWERS_CONTAINER_DTO ="listMonitoredAnswersContainerDto";
public static final String TIMEZONE ="timeZone";
- /*
- * following tell whether author prefers to have the questions listed all in one page or listed sequentially. The default is all in one page.
- */
public static final String QUESTION_LISTING_MODE ="questionListingMode";
public static final String QUESTION_LISTING_MODE_SEQUENTIAL ="questionListingModeSequential";
public static final String QUESTION_LISTING_MODE_COMBINED ="questionListingModeCombined";
@@ -244,8 +242,10 @@
public static final String MODE ="mode";
public static final String LEARNING_MODE ="learningMode";
+ public static final String EXPORT_USER_ID ="exportUserId";
+
/*
- * use exception constants
+ * exception constants
*/
public static final String USER_EXCEPTION_WRONG_FORMAT ="userExceptionWrongFormat";
public static final String USER_EXCEPTION_UNCOMPATIBLE_IDS ="userExceptionUncompatibleIds";
Index: lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/McResources.properties
===================================================================
diff -u -r279704049c2af31a1854e3696d6b96a949490ce3 -r77f932966d3bc4ce011c78dc938f5a18f8f4a5c0
--- lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/McResources.properties (.../McResources.properties) (revision 279704049c2af31a1854e3696d6b96a949490ce3)
+++ lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/McResources.properties (.../McResources.properties) (revision 77f932966d3bc4ce011c78dc938f5a18f8f4a5c0)
@@ -1,5 +1,6 @@
# Project lams_tool_lamc11
#Authoring mode resources
+label.tool.shortname =MCQ
label.authoring.mc =Multiple Choice Questions
label.basic =Basic
label.advanced =Advanced
@@ -10,6 +11,8 @@
label.authoring =MCQ Authoring
label.learning =MCQ Learning
label.preview =MCQ Preview
+label.exportPortfolio =MCQ Export Portfolio
+label.exportPortfolio.simple =Export Portfolio
label.authoring.mc.basic =Please define the questions.
label.monitoring =MCQ Monitoring
label.mc.questions =Multiple Choice Questions
@@ -143,9 +146,12 @@
options.count.zero =Please correct this: There must be at least one candidate answer.
error.passmark.notInteger =Please correct this: Pass Mark can only be an integer.
error.weights.total.invalid =Please correct this: The total weight must equal 100. Please also note that the questions with no candidate answers are being automatically removed.
+error.learner.userId.required ==Tool Activity Error! Can't continue. Tool Activity expects learner's user id.
+error.learner.user.doesNoExist ==Tool Activity Error! Learner is not ready in the tool's database yet.
error.file.notPersisted =An error occurred: The file is not viewable yet. Please save all the content first and check back.
error.learningUser.notAvailable =Tool Activity Error! Can't continue. Tool Activity expects a user id.
error.toolSession.notAvailable =Tool Activity Error! Can't continue. Tool session is not ready in the tool's database yet.
Please verify the API method: public void createToolSession(Long toolSessionId, Long toolContentId) has already been executed.
+error.toolSession.doesNoExist =Tool Activity Error! Can't continue. Tool session is not ready in the tool's database yet.
error.toolContent.notAvailable =Tool Activity Error! Can't continue. Tool content is not ready in the tool's database yet.
Please verify the API method: public void createToolSession(Long toolSessionId, Long toolContentId) has run properly.
error.learner.required =Tool Activity Error! Can't continue. The Learner records are not ready in the tool's database yet.
error.fileName.empty =Please correct this: Under "Instructions", the file(name) to upload can not be empty.
@@ -156,6 +162,7 @@
error.question.removeNotAllowed.thisScreen = The question can not be removed since one or more of the question texts has been modified. Please try again without any text modifications.
error.selectedIndex.empty =Can not continue. Please select the correct answer and click "Done".
error.content.locked =The content has been locked since it is being used by one mor more learners.
The modification of the content is not allowed.
+error.content.doesNotExist ==Tool Activity Error! Can't continue. Tool content is not ready in the tool's database yet.
error.content.inUse =The modification of the content is not allowed since one or more students has attempted the activity.
error.content.beingModified =The content can not be presented since it is being modified. Please check back later.
error.content.unstableState =The content is in an unstable state since it has been left editable while monitored.
Please use this screen to redefine the content.
@@ -205,7 +212,6 @@
error.ids.numberFormatException =Tool Activity Error! Can't continue. The content id and tool session id(s) passed to the Tool Activity must be numerical.
error.contentId.numberFormatException =Tool Activity Error! Can't continue. The content id passed to the Tool Activity must be numerical.
error.sessionId.numberFormatException =Tool Activity Error! Can't continue. The toolSession id passed to the Tool Activity must be numerical.
-error.content.doesNotExist =Tool Activity Error! Can't continue. The content id passed to the Tool Activity does not refer to an existing content.
error.toolSessions.doesNotExist =Tool Activity Error! Can't continue. One of the toolsession ids passed to the Tool Activity does not refer to an existing tool session.
error.toolSession.doesNotExist =Tool Activity Error! Can't continue. The toolsession id passed to the Tool Activity does not refer to an existing tool session.
error.content.onlyContentAndNoSessions =A report can not be generated since no tool sessions has been passed to the Tool Activity.
Index: lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/McUtils.java
===================================================================
diff -u -rdcb4bb59e05ab9fc05be18355abc22d8d5a675e9 -r77f932966d3bc4ce011c78dc938f5a18f8f4a5c0
--- lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/McUtils.java (.../McUtils.java) (revision dcb4bb59e05ab9fc05be18355abc22d8d5a675e9)
+++ lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/McUtils.java (.../McUtils.java) (revision 77f932966d3bc4ce011c78dc938f5a18f8f4a5c0)
@@ -696,6 +696,7 @@
request.getSession().removeAttribute(USER_EXCEPTION_NO_TOOL_SESSIONS);
request.getSession().removeAttribute(USER_EXCEPTION_NO_STUDENT_ACTIVITY);
request.getSession().removeAttribute(USER_EXCEPTION_MODE_REQUIRED);
+ request.getSession().removeAttribute(EXPORT_USER_ID);
logger.debug("completely cleaned the session.");
}
}
Index: lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/dao/hibernate/McUserDAO.java
===================================================================
diff -u -r5b4d6726478b83139419062ad3e880e225424046 -r77f932966d3bc4ce011c78dc938f5a18f8f4a5c0
--- lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/dao/hibernate/McUserDAO.java (.../McUserDAO.java) (revision 5b4d6726478b83139419062ad3e880e225424046)
+++ lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/dao/hibernate/McUserDAO.java (.../McUserDAO.java) (revision 77f932966d3bc4ce011c78dc938f5a18f8f4a5c0)
@@ -25,6 +25,7 @@
import org.hibernate.FlushMode;
import org.lamsfoundation.lams.tool.mc.dao.IMcUserDAO;
+import org.lamsfoundation.lams.tool.mc.pojos.McQueContent;
import org.lamsfoundation.lams.tool.mc.pojos.McQueUsr;
import org.lamsfoundation.lams.tool.mc.pojos.McSession;
import org.springframework.orm.hibernate3.HibernateTemplate;
@@ -78,24 +79,20 @@
return list;
}
- public McQueUsr getMcUserBySession(Long userId, Long sessionId)
+ public McQueUsr getMcUserBySession(final Long queUsrId, final Long mcSessionId)
{
- /*
- String query = "select mu from McQueUsr mu where mu.queUsrId=? and mu.mcSession.mcSessionId=?";
- Long[] bindingValues = new Long[2];
- bindingValues[0] = userId;
- bindingValues[1] = sessionId;
- List usersReturned = getHibernateTemplate().find(query, bindingValues);
- if (usersReturned!= null && usersReturned.size() == 0)
- {
- return null;
+ String strGetUser = "from mcQueUsr in class McQueUsr where mcQueUsr.queUsrId=:queUsrId and mcQueUsr.mcSessionId=:mcSessionId";
+ HibernateTemplate templ = this.getHibernateTemplate();
+ List list = getSession().createQuery(strGetUser)
+ .setLong("queUsrId", queUsrId.longValue())
+ .setLong("mcSessionId", mcSessionId.longValue())
+ .list();
+
+ if(list != null && list.size() > 0){
+ McQueUsr usr = (McQueUsr) list.get(0);
+ return usr;
}
- else
- {
- return (McQueUsr)usersReturned.get(0);
- }
- */
return null;
}
Index: lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/pojos/McContent.java
===================================================================
diff -u -r127c05cdcc1e19906d3f978d5d308b4e0218ec13 -r77f932966d3bc4ce011c78dc938f5a18f8f4a5c0
--- lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/pojos/McContent.java (.../McContent.java) (revision 127c05cdcc1e19906d3f978d5d308b4e0218ec13)
+++ lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/pojos/McContent.java (.../McContent.java) (revision 77f932966d3bc4ce011c78dc938f5a18f8f4a5c0)
@@ -51,6 +51,9 @@
/** persistent field */
private Long mcContentId;
+
+ /** persistent field, used for export portfolio */
+ private String content;
/** nullable persistent field */
private String title;
@@ -123,12 +126,13 @@
private Set mcAttachments;
/** full constructor */
- public McContent(Long mcContentId, String title, String instructions, boolean defineLater, boolean runOffline, Date creationDate,
+ public McContent(Long mcContentId, String content, String title, String instructions, boolean defineLater, boolean runOffline, Date creationDate,
Date updateDate, boolean questionsSequenced, boolean usernameVisible, String reportTitle, String monitoringReportTitle,
long createdBy, boolean synchInMonitor, boolean contentInUse, String offlineInstructions, String onlineInstructions,
String endLearningMessage, Integer passMark, boolean showReport, boolean showFeedback, boolean retries, Set mcQueContents, Set mcSessions,
Set mcAttachments) {
this.mcContentId = mcContentId;
+ this.content=content;
this.title = title;
this.instructions = instructions;
this.defineLater = defineLater;
@@ -182,6 +186,7 @@
{
McContent newContent = new McContent(
newContentId,
+ mc.getContent(),
mc.getTitle(),
mc.getInstructions(),
mc.isDefineLater(),
@@ -489,4 +494,16 @@
public void setCreationDate(Date creationDate) {
this.creationDate = creationDate;
}
+ /**
+ * @return Returns the content.
+ */
+ public String getContent() {
+ return content;
+ }
+ /**
+ * @param content The content to set.
+ */
+ public void setContent(String content) {
+ this.content = content;
+ }
}
Index: lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/service/IMcService.java
===================================================================
diff -u -r9995a2c37bd1ca5cafa9e41d6d30a8872bba0a80 -r77f932966d3bc4ce011c78dc938f5a18f8f4a5c0
--- lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/service/IMcService.java (.../IMcService.java) (revision 9995a2c37bd1ca5cafa9e41d6d30a8872bba0a80)
+++ lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/service/IMcService.java (.../IMcService.java) (revision 77f932966d3bc4ce011c78dc938f5a18f8f4a5c0)
@@ -65,6 +65,8 @@
public void createMcQueUsr(McQueUsr mcQueUsr) throws McApplicationException;
+ public McQueUsr getMcUserBySession(final Long queUsrId, final Long mcSessionId) throws McApplicationException;
+
public McQueUsr retrieveMcQueUsr(Long userId) throws McApplicationException;
public void createMcUsrAttempt(McUsrAttempt mcUsrAttempt) throws McApplicationException;
Index: lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/service/McServicePOJO.java
===================================================================
diff -u -r9995a2c37bd1ca5cafa9e41d6d30a8872bba0a80 -r77f932966d3bc4ce011c78dc938f5a18f8f4a5c0
--- lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/service/McServicePOJO.java (.../McServicePOJO.java) (revision 9995a2c37bd1ca5cafa9e41d6d30a8872bba0a80)
+++ lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/service/McServicePOJO.java (.../McServicePOJO.java) (revision 77f932966d3bc4ce011c78dc938f5a18f8f4a5c0)
@@ -341,6 +341,22 @@
}
}
+
+ public McQueUsr getMcUserBySession(final Long queUsrId, final Long mcSessionId) throws McApplicationException
+ {
+ try
+ {
+ return mcUserDAO.getMcUserBySession(queUsrId, mcSessionId);
+ }
+ catch (DataAccessException e)
+ {
+ throw new McApplicationException("Exception occured when lams is getting mc QueUsr: "
+ + e.getMessage(),
+ e);
+ }
+ }
+
+
public McQueUsr getMcUserByUID(Long uid) throws McApplicationException
{
try
Index: lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/web/McExportAction.java
===================================================================
diff -u
--- lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/web/McExportAction.java (revision 0)
+++ lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/web/McExportAction.java (revision 77f932966d3bc4ce011c78dc938f5a18f8f4a5c0)
@@ -0,0 +1,280 @@
+ /*
+ * Created on Jul 25, 2005
+ */
+package org.lamsfoundation.lams.tool.mc.web;
+
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+
+import org.apache.log4j.Logger;
+import org.apache.struts.Globals;
+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.ActionMessages;
+import org.lamsfoundation.lams.tool.mc.McAppConstants;
+import org.lamsfoundation.lams.tool.mc.McUtils;
+import org.lamsfoundation.lams.tool.mc.pojos.McContent;
+import org.lamsfoundation.lams.tool.mc.pojos.McQueUsr;
+import org.lamsfoundation.lams.tool.mc.pojos.McSession;
+import org.lamsfoundation.lams.tool.mc.service.IMcService;
+import org.lamsfoundation.lams.tool.mc.service.McServiceProxy;
+import org.lamsfoundation.lams.web.action.LamsDispatchAction;
+import org.lamsfoundation.lams.web.util.AttributeNames;
+
+
+/**
+ * @author Ozgur Demirtas
+ *
+ * enables the learner and teacher to export the contents of the mcq tool.
+ */
+
+public class McExportAction extends LamsDispatchAction implements McAppConstants{
+
+ static Logger logger = Logger.getLogger(McExportAction.class.getName());
+
+ public ActionForward unspecified(
+ ActionMapping mapping,
+ ActionForm form,
+ HttpServletRequest request,
+ HttpServletResponse response)
+ {
+ return mapping.findForward(EXPORT_PORTFOLIO);
+ }
+
+
+ /**
+ * provides export portfolio functionality for learner
+ * learner(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response)
+ *
+ * @param mapping
+ * @param form
+ * @param request
+ * @param response
+ * @return ActionForward
+ */
+ public ActionForward learner(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response)
+ {
+ logger.debug("dispatching export portfolio for learner...");
+ McUtils.cleanUpSessionAbsolute(request);
+
+ IMcService mcService = McUtils.getToolService(request);
+ logger.debug("retrieving mcService from session: " + mcService);
+ if (mcService == null)
+ {
+ mcService = McServiceProxy.getMcService(getServlet().getServletContext());
+ logger.debug("retrieving mcService from proxy: " + mcService);
+ request.getSession().setAttribute(TOOL_SERVICE, mcService);
+ }
+
+ McExportForm exportForm = (McExportForm)form;
+
+ /* required parameters are toolSessionId and userId */
+ boolean parametersCorrect=validateLearnerExportParameters(form, request);
+ logger.debug("learner parametersCorrect: " + parametersCorrect);
+ if (parametersCorrect == false)
+ {
+ logger.debug("learner parameters are not properly passed: " + parametersCorrect);
+ return (mapping.findForward(ERROR_LIST));
+ }
+
+ Long toolSessionId =(Long)request.getSession().getAttribute(TOOL_SESSION_ID);
+ logger.debug("toolSessionId: " + toolSessionId);
+
+ McSession mcSession=mcService.findMcSessionById(toolSessionId);
+ logger.debug("mcSession: " + mcSession);
+ if (mcSession == null)
+ {
+ persistError(request, "error.toolSession.doesNoExist");
+ McUtils.cleanUpSessionAbsolute(request);
+ return (mapping.findForward(ERROR_LIST));
+ }
+
+ Long toolSessionUid= mcSession.getUid();
+ logger.debug("mcSession is identified by : " + toolSessionUid);
+
+ Long exportUserId =(Long)request.getSession().getAttribute(EXPORT_USER_ID);
+ logger.debug("exportUserId : " + exportUserId);
+
+ McQueUsr mcQueUsr=mcService.getMcUserBySession(exportUserId, toolSessionUid);
+ logger.debug("existing tool user mcQueUsr : " + mcQueUsr);
+ if (mcQueUsr == null)
+ {
+ persistError(request, "error.learner.user.doesNoExist");
+ McUtils.cleanUpSessionAbsolute(request);
+ return (mapping.findForward(ERROR_LIST));
+ }
+
+ logger.debug("getting mcContent based on toolSessionId : " + toolSessionId);
+ McContent mcContent=mcService.retrieveMcBySessionId(toolSessionId);
+ logger.debug("mcContent : " + mcContent);
+ if (mcContent == null)
+ {
+ persistError(request, "error.content.doesNotExist");
+ McUtils.cleanUpSessionAbsolute(request);
+ return (mapping.findForward(ERROR_LIST));
+ }
+
+ exportForm.populateForm(mcContent);
+ return mapping.findForward(EXPORT_PORTFOLIO);
+ }
+
+
+ /**
+ * provides export portfolio functionality for teacher
+ * teacher(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response)
+ *
+ * @param mapping
+ * @param form
+ * @param request
+ * @param response
+ * @return ActionForward
+ */
+ public ActionForward teacher(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response)
+ {
+ //given the toolcontentId as a parameter
+ logger.debug("dispatching export portfolio for teacher...");
+ McUtils.cleanUpSessionAbsolute(request);
+
+ IMcService mcService = McUtils.getToolService(request);
+ logger.debug("retrieving mcService from session: " + mcService);
+ if (mcService == null)
+ {
+ mcService = McServiceProxy.getMcService(getServlet().getServletContext());
+ logger.debug("retrieving mcService from proxy: " + mcService);
+ request.getSession().setAttribute(TOOL_SERVICE, mcService);
+ }
+
+ McExportForm exportForm = (McExportForm)form;
+
+ /* required parameters are toolSessionId and userId */
+ boolean parametersCorrect=validateTeacherExportParameters(form, request);
+ logger.debug("learner parametersCorrect: " + parametersCorrect);
+ if (parametersCorrect == false)
+ {
+ logger.debug("teacher parameters are not properly passed: " + parametersCorrect);
+ return (mapping.findForward(ERROR_LIST));
+ }
+
+ Long toolContentId =(Long)request.getSession().getAttribute(TOOL_CONTENT_ID);
+ logger.debug("toolContentId: " + toolContentId);
+ McContent mcContent=mcService.retrieveMc(toolContentId);
+ logger.debug("mcContent:" + mcContent);
+
+ if (mcContent == null)
+ {
+ persistError(request, "error.content.doesNotExist");
+ McUtils.cleanUpSessionAbsolute(request);
+ return (mapping.findForward(ERROR_LIST));
+ }
+
+ exportForm.populateForm(mcContent);
+
+ return mapping.findForward(EXPORT_PORTFOLIO);
+ }
+
+
+
+ /**
+ * validates learner export portfolio parameters
+ * validateLearnerExportParameters(ActionForm form, HttpServletRequest request)
+ *
+ * @param form
+ * @param request
+ * @return boolean
+ */
+ protected boolean validateLearnerExportParameters(ActionForm form, HttpServletRequest request)
+ {
+ String strToolSessionId=request.getParameter(AttributeNames.PARAM_TOOL_SESSION_ID);
+
+ if ((strToolSessionId == null) || (strToolSessionId.length() == 0))
+ {
+ persistError(request, "error.toolSessionId.required");
+ McUtils.cleanUpSessionAbsolute(request);
+ return false;
+ }
+ else
+ {
+ try
+ {
+ long testToolSessionId=new Long(strToolSessionId).longValue();
+ request.getSession().setAttribute(TOOL_SESSION_ID,new Long(strToolSessionId));
+ }
+ catch(NumberFormatException e)
+ {
+ persistError(request, "error.sessionId.numberFormatException");
+ logger.debug("add error.sessionId.numberFormatException to ActionMessages.");
+ McUtils.cleanUpSessionAbsolute(request);
+ return false;
+ }
+ }
+
+ /*USER_ID should be added to AttributeNames*/
+ String userId=request.getParameter(USER_ID);
+ logger.debug("userId: " + userId);
+ if ((userId == null) || (userId.length() == 0))
+ {
+ persistError(request, "error.learner.userId.required");
+ McUtils.cleanUpSessionAbsolute(request);
+ return false;
+ }
+ request.getSession().setAttribute(EXPORT_USER_ID,new Long(userId));
+
+ return true;
+ }
+
+
+ /**
+ * validates teacher export portfolio parameters
+ * validateTeacherExportParameters(ActionForm form, HttpServletRequest request)
+ *
+ * @param form
+ * @param request
+ * @return boolean
+ */
+ protected boolean validateTeacherExportParameters(ActionForm form, HttpServletRequest request)
+ {
+ String strToolContentId=request.getParameter(AttributeNames.PARAM_TOOL_CONTENT_ID);
+ logger.debug("strToolContentId: " + strToolContentId);
+
+ if ((strToolContentId == null) || (strToolContentId.length() == 0))
+ {
+ persistError(request, "error.contentId.required");
+ McUtils.cleanUpSessionAbsolute(request);
+ return false;
+ }
+ else
+ {
+ try
+ {
+ long toolContentId=new Long(strToolContentId).longValue();
+ logger.debug("passed TOOL_CONTENT_ID : " + new Long(toolContentId));
+ request.getSession().setAttribute(TOOL_CONTENT_ID,new Long(toolContentId));
+ }
+ catch(NumberFormatException e)
+ {
+ persistError(request, "error.contentId.numberFormatException");
+ logger.debug("add error.contentId.numberFormatException to ActionMessages.");
+ McUtils.cleanUpSessionAbsolute(request);
+ return false;
+ }
+ }
+ return true;
+ }
+
+
+
+ /**
+ * persists error messages to request scope
+ * @param request
+ * @param message
+ */
+ public void persistError(HttpServletRequest request, String message)
+ {
+ ActionMessages errors= new ActionMessages();
+ errors.add(Globals.ERROR_KEY, new ActionMessage(message));
+ logger.debug("add " + message +" to ActionMessages:");
+ saveErrors(request,errors);
+ }
+}
Index: lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/web/McExportForm.java
===================================================================
diff -u
--- lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/web/McExportForm.java (revision 0)
+++ lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/web/McExportForm.java (revision 77f932966d3bc4ce011c78dc938f5a18f8f4a5c0)
@@ -0,0 +1,123 @@
+package org.lamsfoundation.lams.tool.mc.web;
+
+import org.apache.log4j.Logger;
+import org.apache.struts.action.ActionForm;
+import org.lamsfoundation.lams.tool.mc.pojos.McContent;
+
+/**
+ * @author Ozgur Demirtas
+ */
+
+public class McExportForm extends ActionForm {
+
+ static Logger logger = Logger.getLogger(McExportForm.class.getName());
+
+ private String title;
+ private String content;
+
+ private String toolContentID;
+ private String toolSessionID;
+ private String userID;
+ private String mode;
+
+ /**
+ * @return Returns the logger.
+ */
+ public static Logger getLogger() {
+ return logger;
+ }
+ /**
+ * @param logger The logger to set.
+ */
+ public static void setLogger(Logger logger) {
+ McExportForm.logger = logger;
+ }
+ /**
+ * @return Returns the content.
+ */
+ public String getContent() {
+ return content;
+ }
+ /**
+ * @param content The content to set.
+ */
+ public void setContent(String content) {
+ this.content = content;
+ }
+ /**
+ * @return Returns the mode.
+ */
+ public String getMode() {
+ return mode;
+ }
+ /**
+ * @param mode The mode to set.
+ */
+ public void setMode(String mode) {
+ this.mode = mode;
+ }
+ /**
+ * @return Returns the title.
+ */
+ public String getTitle() {
+ return title;
+ }
+ /**
+ * @param title The title to set.
+ */
+ public void setTitle(String title) {
+ this.title = title;
+ }
+ /**
+ * @return Returns the toolContentId.
+ */
+ public String getToolContentID() {
+ return toolContentID;
+ }
+ /**
+ * @param toolContentId The toolContentId to set.
+ */
+ public void setToolContentID(String toolContentId) {
+ this.toolContentID = toolContentId;
+ }
+ /**
+ * @return Returns the toolSessionId.
+ */
+ public String getToolSessionID() {
+ return toolSessionID;
+ }
+ /**
+ * @param toolSessionId The toolSessionId to set.
+ */
+ public void setToolSessionID(String toolSessionId) {
+ this.toolSessionID = toolSessionId;
+ }
+ /**
+ * @return Returns the userId.
+ */
+ public String getUserID() {
+ return userID;
+ }
+ /**
+ * @param userId The userId to set.
+ */
+ public void setUserID(String userId) {
+ this.userID = userId;
+ }
+
+ public void reset()
+ {
+ this.mode = null;
+ this.title = null;
+ this.content = null;
+ this.toolContentID = null;
+ this.toolSessionID = null;
+ this.userID = null;
+ }
+
+ public void populateForm(McContent content)
+ {
+ setTitle(content.getTitle());
+ setContent(content.getContent());
+ }
+}
Index: lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/web/McExportServlet.java
===================================================================
diff -u
--- lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/web/McExportServlet.java (revision 0)
+++ lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/web/McExportServlet.java (revision 77f932966d3bc4ce011c78dc938f5a18f8f4a5c0)
@@ -0,0 +1,45 @@
+
+package org.lamsfoundation.lams.tool.mc.web;
+
+import javax.servlet.http.Cookie;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+
+import org.lamsfoundation.lams.tool.ToolAccessMode;
+import org.lamsfoundation.lams.util.WebUtil;
+import org.lamsfoundation.lams.web.servlet.AbstractExportPortfolioServlet;
+import org.lamsfoundation.lams.web.util.AttributeNames;
+
+/**
+ * @author Ozgur Demirtas
+ *
+ */
+public class McExportServlet extends AbstractExportPortfolioServlet {
+
+ private final String FILENAME = "mc_main.html";
+
+ public String doExport(HttpServletRequest request, HttpServletResponse response, String directoryName, Cookie[] cookies)
+ {
+
+ String mode = WebUtil.readStrParam(request, AttributeNames.PARAM_MODE);
+ //Long toolContentId, toolSessionId, userId;
+ String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+request.getContextPath();
+
+ String url = basePath + "/exportPortfolio.do";
+ String urlWithParameters = null;
+
+ if (mode.equals(ToolAccessMode.LEARNER.toString()))
+ {
+ urlWithParameters = appendParametersToLearnerExportURL(request, url);
+
+ }
+ else if (mode.equals(ToolAccessMode.TEACHER.toString()))
+ {
+ urlWithParameters = appendParametersToTeacherExportURL(request, url);
+ }
+
+ writeResponseToFile(urlWithParameters, directoryName, FILENAME, cookies);
+
+ return FILENAME;
+ }
+}
Index: lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/web/McMonitoringStarterAction.java
===================================================================
diff -u -rdcb4bb59e05ab9fc05be18355abc22d8d5a675e9 -r77f932966d3bc4ce011c78dc938f5a18f8f4a5c0
--- lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/web/McMonitoringStarterAction.java (.../McMonitoringStarterAction.java) (revision dcb4bb59e05ab9fc05be18355abc22d8d5a675e9)
+++ lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/web/McMonitoringStarterAction.java (.../McMonitoringStarterAction.java) (revision 77f932966d3bc4ce011c78dc938f5a18f8f4a5c0)
@@ -250,7 +250,6 @@
String strToolContentId=request.getParameter(AttributeNames.PARAM_TOOL_CONTENT_ID);
logger.debug("strToolContentId: " + strToolContentId);
- long toolSessionId=0;
if ((strToolContentId == null) || (strToolContentId.length() == 0))
{
persistError(request, "error.contentId.required");