Index: lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/QaAppConstants.java =================================================================== diff -u -r2cf549098f28a78e5a5f18cdc1a7ec8eaa02787e -rcae190bef6a3e4f857bdfaff17eb3a0ae680cb72 --- lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/QaAppConstants.java (.../QaAppConstants.java) (revision 2cf549098f28a78e5a5f18cdc1a7ec8eaa02787e) +++ lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/QaAppConstants.java (.../QaAppConstants.java) (revision cae190bef6a3e4f857bdfaff17eb3a0ae680cb72) @@ -35,6 +35,7 @@ public static final String TARGET_MODE_AUTHORING ="Authoring"; public static final String TARGET_MODE_LEARNING ="Learning"; public static final String TARGET_MODE_MONITORING ="Monitoring"; + public static final String TARGET_MODE_EXPORT_PORTFOLIO ="ExportPortfolio"; public static final String AUTHORING_STARTER ="starter"; public static final String LEARNING_STARTER ="learningStarter"; @@ -140,8 +141,16 @@ public static final String USER_EXCEPTION_MONITORINGTAB_CONTENTID_REQUIRED ="userExceptionMonitoringTabContentIdRequired"; public static final String USER_EXCEPTION_DEAFULTCONTENT_NOTSETUP ="userExceptionDefaultContentNotSetup"; - /** + * export portfolio constants + */ + public static final String MODE ="mode"; + public static final String LEARNER ="learner"; + public static final String TEACHER ="teacher"; + public static final String USER_EXCEPTION_MODE_REQUIRED ="userExceptionModeRequired"; + public static final String PORTFOLIO_REPORT ="portfolioReport"; + + /** * user actions */ public static final String ADD_NEW_QUESTION ="addNewQuestion"; Index: lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/QaResources.properties =================================================================== diff -u -r4c1831729bf38bebdd629cd0b4f427e61930ae01 -rcae190bef6a3e4f857bdfaff17eb3a0ae680cb72 --- lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/QaResources.properties (.../QaResources.properties) (revision 4c1831729bf38bebdd629cd0b4f427e61930ae01) +++ lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/QaResources.properties (.../QaResources.properties) (revision cae190bef6a3e4f857bdfaff17eb3a0ae680cb72) @@ -59,10 +59,12 @@ error.defineLater =Sorry, this activity's content is not ready yet.
Please wait for your teacher to make the content ready. error.toolSessionId.required =Tool Activity Error! Can't continue
URL is not complete. The Tool Activity requires a toolSession id. error.contentId.required =Tool Activity Error! Can't continue
URL is not complete. The Tool Activity requires a content id. -error.authoringUser.notAvailable =Tool Activity Error! Can't continue. Tool Activity expects a user id.

The expected format is either : TOOLURL?userId=A&toolContentId=B or TOOLURL?userId=A +error.authoringUser.notAvailable =Tool Activity Error! Can't continue. Tool Activity expects a user id. +error.userId.required =Tool Activity Error! Can't continue
URL is not complete. The Tool Activity requires a user id. error.userId.notNumeric =Tool Activity Error! Can't continue. The user id passed to the Tool Activity must be numerical. error.userId.existing =Tool Activity Error! Can't continue. The user id passed to the Tool Activity refers to a student that has already used the activity.
Each learner activity should be associated with a unique userId. error.defaultContent.notSetup =Tool Activity Error! Can't continue. The default content for the tool has not been setup properly. +error.mode.required =Tool Activity Error! Can't continue
URL is not complete. The Tool Activity requires a mode. #Monitoring mode resources button.startLesson =Start Lesson Index: lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/QaUtils.java =================================================================== diff -u -rab01f4417489f903865c8629d5256d7eed0736e5 -rcae190bef6a3e4f857bdfaff17eb3a0ae680cb72 --- lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/QaUtils.java (.../QaUtils.java) (revision ab01f4417489f903865c8629d5256d7eed0736e5) +++ lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/QaUtils.java (.../QaUtils.java) (revision cae190bef6a3e4f857bdfaff17eb3a0ae680cb72) @@ -277,6 +277,11 @@ return user; } + public static User createStandardUser(Integer userId) + { + return createAuthoringUser(userId); + } + public static User createUser(Integer userId) { User user=new User(); Index: lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/web/QaExportPortfolioForm.java =================================================================== diff -u --- lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/web/QaExportPortfolioForm.java (revision 0) +++ lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/web/QaExportPortfolioForm.java (revision cae190bef6a3e4f857bdfaff17eb3a0ae680cb72) @@ -0,0 +1,25 @@ +/* + * ozgurd + * Created on 26/04/2005 + * + * TODO To change the template for this generated file go to + * Window - Preferences - Java - Code Style - Code Templates + */ +package org.lamsfoundation.lams.tool.qa.web; + +/** + * ActionForm for the Monitoring environment + */ +import org.apache.struts.action.ActionForm; +import org.lamsfoundation.lams.tool.qa.QaAppConstants; + +/** + * @author Ozgur Demirtas + * + * TODO To change the template for this generated type comment go to + * Window - Preferences - Java - Code Style - Code Templates + */ +public class QaExportPortfolioForm extends ActionForm implements QaAppConstants +{ + +} Index: lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/web/QaExportPortfolioStarterAction.java =================================================================== diff -u --- lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/web/QaExportPortfolioStarterAction.java (revision 0) +++ lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/web/QaExportPortfolioStarterAction.java (revision cae190bef6a3e4f857bdfaff17eb3a0ae680cb72) @@ -0,0 +1,206 @@ +/* + * Created on 8/03/2005 + * + * TODO To change the template for this generated file go to + * Window - Preferences - Java - Code Style - Code Templates + */ + +/** + * @author Ozgur Demirtas + * + * /&mode=learner&toolSessionId=231&userId= +*/ + + +package org.lamsfoundation.lams.tool.qa.web; +import java.io.IOException; + +import javax.servlet.ServletException; +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.Action; +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.exception.ToolException; +import org.lamsfoundation.lams.tool.qa.QaAppConstants; +import org.lamsfoundation.lams.tool.qa.QaApplicationException; +import org.lamsfoundation.lams.tool.qa.QaUtils; +import org.lamsfoundation.lams.tool.qa.service.IQaService; +import org.lamsfoundation.lams.tool.qa.service.QaServiceProxy; +import org.lamsfoundation.lams.usermanagement.User; + +public class QaExportPortfolioStarterAction extends Action implements QaAppConstants { + static Logger logger = Logger.getLogger(QaExportPortfolioStarterAction.class.getName()); + + public ActionForward execute(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) + throws IOException, ServletException, QaApplicationException, ToolException + { + /** + * retrive the service + */ + IQaService qaService=null; + qaService = QaServiceProxy.getQaService(getServlet().getServletContext()); + logger.debug("retrieved qaService : " + qaService); + request.getSession().setAttribute(TOOL_SERVICE, qaService); + + + /** + * persist time zone information to session scope. + */ + QaUtils.persistTimeZone(request); + + /** + * mark the http session as an authoring activity + */ + request.getSession().setAttribute(TARGET_MODE,TARGET_MODE_EXPORT_PORTFOLIO); + + /** + * obtain and setup the current user's data + */ + + String userId=""; + userId=request.getParameter(USER_ID); + logger.debug("userId: " + userId); + try + { + User user=QaUtils.createStandardUser(new Integer(userId)); + request.getSession().setAttribute(TOOL_USER, user); + } + catch(NumberFormatException e) + { + persistError(request,"error.userId.notNumeric"); + request.setAttribute(USER_EXCEPTION_USERID_NOTNUMERIC, new Boolean(true)); + logger.debug("forwarding to: " + PORTFOLIO_REPORT); + return (mapping.findForward(PORTFOLIO_REPORT)); + } + + + if ((userId == null) || (userId.length()==0)) + { + logger.debug("error: The tool expects userId"); + persistError(request,"error.userId.required"); + request.setAttribute(USER_EXCEPTION_USERID_NOTAVAILABLE, new Boolean(true)); + logger.debug("forwarding to: " + PORTFOLIO_REPORT); + return (mapping.findForward(PORTFOLIO_REPORT)); + } + logger.debug("TOOL_USER is:" + request.getSession().getAttribute(TOOL_USER)); + + + String mode=""; + mode=request.getParameter(MODE); + logger.debug("mode: " + mode); + boolean useToolSessionId=false; + if ((mode != null) && mode.equalsIgnoreCase(LEARNER)) + { + logger.debug("mode is:" + mode + " use toolSessionId"); + useToolSessionId=true; + } + else if ((mode != null) && mode.equalsIgnoreCase(TEACHER)) + { + logger.debug("mode is:" + mode + " use toolContentId"); + useToolSessionId=false; + } + else + { + logger.debug("Warning mode is: unknown"); + persistError(request,"error.mode.required"); + request.setAttribute(USER_EXCEPTION_MODE_REQUIRED, new Boolean(true)); + logger.debug("forwarding to: " + PORTFOLIO_REPORT); + return (mapping.findForward(PORTFOLIO_REPORT)); + } + + String strToolSessionId=""; + Long toolSessionId=null; + if (useToolSessionId == true) + { + logger.debug("reading TOOL_SESSION_ID"); + strToolSessionId=request.getParameter(TOOL_SESSION_ID); + logger.debug("toolSessionId :" + strToolSessionId); + + try + { + if ((strToolSessionId != null) && (strToolSessionId.length() > 0)) + { + toolSessionId=new Long(strToolSessionId); + request.getSession().setAttribute(TOOL_SESSION_ID, toolSessionId); + } + else + { + persistError(request,"error.toolSessionId.required"); + request.setAttribute(USER_EXCEPTION_TOOLSESSIONID_REQUIRED, new Boolean(true)); + logger.debug("forwarding to: " + PORTFOLIO_REPORT); + return (mapping.findForward(PORTFOLIO_REPORT)); + } + } + catch(NumberFormatException e) + { + persistError(request,"error.sessionId.numberFormatException"); + request.setAttribute(USER_EXCEPTION_NUMBERFORMAT, new Boolean(true)); + logger.debug("forwarding to: " + PORTFOLIO_REPORT); + return (mapping.findForward(PORTFOLIO_REPORT)); + } + logger.debug("final toolSessionId :" + toolSessionId); + } + + String strToolContentId=""; + Long toolContentId=null; + + if (useToolSessionId == false) + { + logger.debug("reading TOOL_CONTENT_ID"); + strToolContentId=request.getParameter(TOOL_CONTENT_ID); + logger.debug("TOOL_CONTENT_ID: " + strToolContentId); + + try + { + if ((strToolContentId != null) && (strToolContentId.length() > 0)) + { + if (!QaUtils.existsContent(new Long(strToolContentId).longValue(), request)) + { + persistError(request,"error.content.doesNotExist"); + request.setAttribute(USER_EXCEPTION_CONTENT_DOESNOTEXIST, new Boolean(true)); + logger.debug("forwarding to: " + PORTFOLIO_REPORT); + return (mapping.findForward(PORTFOLIO_REPORT)); + } + request.getSession().setAttribute(TOOL_CONTENT_ID, new Long(strToolContentId)); + } + else + { + persistError(request,"error.contentId.required"); + request.setAttribute(USER_EXCEPTION_CONTENTID_REQUIRED, new Boolean(true)); + logger.debug("forwarding to: " + PORTFOLIO_REPORT); + return (mapping.findForward(PORTFOLIO_REPORT)); + } + } + catch(NumberFormatException e) + { + persistError(request,"error.contentId.numberFormatException"); + request.setAttribute(USER_EXCEPTION_NUMBERFORMAT, new Boolean(true)); + logger.debug("forwarding to: " + PORTFOLIO_REPORT); + return (mapping.findForward(PORTFOLIO_REPORT)); + } + } + + return (mapping.findForward(PORTFOLIO_REPORT)); + } + + + /** + * 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_laqa/web/WEB-INF/struts-config.xml =================================================================== diff -u -r4447ae1bb802ba8a16df65d880f25575d1174003 -rcae190bef6a3e4f857bdfaff17eb3a0ae680cb72 --- lams_tool_laqa/web/WEB-INF/struts-config.xml (.../struts-config.xml) (revision 4447ae1bb802ba8a16df65d880f25575d1174003) +++ lams_tool_laqa/web/WEB-INF/struts-config.xml (.../struts-config.xml) (revision cae190bef6a3e4f857bdfaff17eb3a0ae680cb72) @@ -189,6 +189,23 @@ + + + + + + + Index: lams_tool_laqa/web/WEB-INF/tiles/tiles-defs.xml =================================================================== diff -u -r16e844de3f7c34b44baee1b28e67e708f42d00bf -rcae190bef6a3e4f857bdfaff17eb3a0ae680cb72 --- lams_tool_laqa/web/WEB-INF/tiles/tiles-defs.xml (.../tiles-defs.xml) (revision 16e844de3f7c34b44baee1b28e67e708f42d00bf) +++ lams_tool_laqa/web/WEB-INF/tiles/tiles-defs.xml (.../tiles-defs.xml) (revision cae190bef6a3e4f857bdfaff17eb3a0ae680cb72) @@ -86,6 +86,19 @@ + + + + + + + + + + + + + Index: lams_tool_laqa/web/exportPortfolioIndex.jsp =================================================================== diff -u --- lams_tool_laqa/web/exportPortfolioIndex.jsp (revision 0) +++ lams_tool_laqa/web/exportPortfolioIndex.jsp (revision cae190bef6a3e4f857bdfaff17eb3a0ae680cb72) @@ -0,0 +1,6 @@ +<%@ taglib uri="/WEB-INF/struts-html-el.tld" prefix="html" %> +<%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean" %> +<%@ taglib uri="/WEB-INF/struts-logic-el.tld" prefix="logic-el" %> +<%@ taglib uri="/WEB-INF/c.tld" prefix="c" %> +<%@ taglib uri="/WEB-INF/fmt.tld" prefix="fmt" %> + Index: lams_tool_laqa/web/portfolioReport.jsp =================================================================== diff -u --- lams_tool_laqa/web/portfolioReport.jsp (revision 0) +++ lams_tool_laqa/web/portfolioReport.jsp (revision cae190bef6a3e4f857bdfaff17eb3a0ae680cb72) @@ -0,0 +1,35 @@ +<%@ taglib uri="/WEB-INF/struts-html-el.tld" prefix="html" %> +<%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean" %> +<%@ taglib uri="/WEB-INF/struts-logic-el.tld" prefix="logic-el" %> +<%@ taglib uri="/WEB-INF/c.tld" prefix="c" %> +<%@ taglib uri="/WEB-INF/fmt.tld" prefix="fmt" %> + + + + + +
+ +
+
+ + +

main portfoloio report

+
+ + + + \ No newline at end of file