Index: lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/EditActivityDTO.java =================================================================== diff -u --- lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/EditActivityDTO.java (revision 0) +++ lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/EditActivityDTO.java (revision 408afbaee696ef9a560b950f9509bed0c7b92d12) @@ -0,0 +1,68 @@ +/*************************************************************************** + * 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 + * USA + * + * http://www.gnu.org/licenses/gpl.txt + * ***********************************************************************/ + +/* $$Id$$ */ +package org.lamsfoundation.lams.tool.qa; + +import org.apache.commons.lang.builder.ToStringBuilder; + + +/** + *
DTO that holds question and user attempts data for jsp purposes + *
+ * + * @author Ozgur Demirtas + */ +public class EditActivityDTO implements Comparable +{ + private String monitoredContentInUse; + + + /** + * @return Returns the monitoredContentInUse. + */ + public String getMonitoredContentInUse() { + return monitoredContentInUse; + } + /** + * @param monitoredContentInUse The monitoredContentInUse to set. + */ + public void setMonitoredContentInUse(String monitoredContentInUse) { + this.monitoredContentInUse = monitoredContentInUse; + } + public String toString() { + return new ToStringBuilder(this) + .append("monitoredContentInUse", monitoredContentInUse) + .toString(); + } + + public int compareTo(Object o) + { + EditActivityDTO editActivityDTO = (EditActivityDTO) o; + + if (editActivityDTO == null) + return 1; + else + return 0; + } + +} Index: lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/QaAppConstants.java =================================================================== diff -u -r09d8bc5a449269ac83f198afa78137b58305080c -r408afbaee696ef9a560b950f9509bed0c7b92d12 --- lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/QaAppConstants.java (.../QaAppConstants.java) (revision 09d8bc5a449269ac83f198afa78137b58305080c) +++ lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/QaAppConstants.java (.../QaAppConstants.java) (revision 408afbaee696ef9a560b950f9509bed0c7b92d12) @@ -184,6 +184,7 @@ public static final String LIST_MONITORED_ANSWERS_CONTAINER_DTO ="listMonitoredAnswersContainerDto"; public static final String SUMMARY_TOOL_SESSIONS ="summaryToolSessions"; public static final String SUMMARY_TOOL_SESSIONS_ID ="summaryToolSessionsId"; + public static final String EDIT_ACTIVITY_DTO ="editActivityDTO"; public static final String ACTIVITY_TITLE ="activityTitle"; public static final String ACTIVITY_INSTRUCTIONS ="activityInstructions"; Index: lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/web/QaAction.java =================================================================== diff -u -r0fb4d41712e31bd525abb02f100373875b1c7fc6 -r408afbaee696ef9a560b950f9509bed0c7b92d12 --- lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/web/QaAction.java (.../QaAction.java) (revision 0fb4d41712e31bd525abb02f100373875b1c7fc6) +++ lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/web/QaAction.java (.../QaAction.java) (revision 408afbaee696ef9a560b950f9509bed0c7b92d12) @@ -46,6 +46,7 @@ import org.lamsfoundation.lams.contentrepository.RepositoryCheckedException; import org.lamsfoundation.lams.contentrepository.client.IToolContentHandler; import org.lamsfoundation.lams.tool.exception.ToolException; +import org.lamsfoundation.lams.tool.qa.EditActivityDTO; import org.lamsfoundation.lams.tool.qa.QaAppConstants; import org.lamsfoundation.lams.tool.qa.QaApplicationException; import org.lamsfoundation.lams.tool.qa.QaContent; @@ -890,8 +891,6 @@ protected ActionMessages validateSubmit(HttpServletRequest request, ActionMessages errors, QaAuthoringForm qaAuthoringForm) { - //qaGeneralAuthoringDTO.setSbmtSuccess(new Integer(0).toString()); - String richTextTitle = request.getParameter(TITLE); String richTextInstructions = request.getParameter(INSTRUCTIONS); logger.debug("richTextTitle: " + richTextTitle); @@ -1322,19 +1321,21 @@ persistError(request,"error.content.inUse"); qaGeneralAuthoringDTO.setMonitoredContentInUse(new Boolean(true).toString()); } - - QaUtils.setDefineLater(request, true, strToolContentID, qaService); - - //QaUtils.setFormProperties(request, qaService, qaContent, - // qaAuthoringForm, qaGeneralAuthoringDTO, strToolContentID, defaultContentIdStr, activeModule, sessionMap, httpSessionID); + EditActivityDTO editActivityDTO = new EditActivityDTO(); + logger.debug("isContentInUse:" + isContentInUse); + if (isContentInUse == true) + { + editActivityDTO.setMonitoredContentInUse(new Boolean(true).toString()); + } + request.setAttribute(EDIT_ACTIVITY_DTO, editActivityDTO); + QaUtils.setDefineLater(request, true, strToolContentID, qaService); + qaGeneralAuthoringDTO.setToolContentID(strToolContentID); - //qaGeneralAuthoringDTO.setHttpSessionID(httpSessionID); qaGeneralAuthoringDTO.setActiveModule(activeModule); qaGeneralAuthoringDTO.setDefaultContentIdStr(defaultContentIdStr); qaAuthoringForm.setToolContentID(strToolContentID); - //qaAuthoringForm.setHttpSessionID(httpSessionID); qaAuthoringForm.setActiveModule(activeModule); qaAuthoringForm.setDefaultContentIdStr(defaultContentIdStr); qaAuthoringForm.setCurrentTab("1"); Index: lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/web/QaMonitoringAction.java =================================================================== diff -u -r09d8bc5a449269ac83f198afa78137b58305080c -r408afbaee696ef9a560b950f9509bed0c7b92d12 --- lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/web/QaMonitoringAction.java (.../QaMonitoringAction.java) (revision 09d8bc5a449269ac83f198afa78137b58305080c) +++ lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/web/QaMonitoringAction.java (.../QaMonitoringAction.java) (revision 408afbaee696ef9a560b950f9509bed0c7b92d12) @@ -82,8 +82,6 @@ /* $$Id$$ */ -// Fix public ActionForward editActivityQuestions(ActionMapping mapping,...) - package org.lamsfoundation.lams.tool.qa.web; import java.io.IOException; @@ -107,6 +105,7 @@ import org.lamsfoundation.lams.notebook.model.NotebookEntry; import org.lamsfoundation.lams.notebook.service.CoreNotebookConstants; import org.lamsfoundation.lams.tool.exception.ToolException; +import org.lamsfoundation.lams.tool.qa.EditActivityDTO; import org.lamsfoundation.lams.tool.qa.GeneralLearnerFlowDTO; import org.lamsfoundation.lams.tool.qa.GeneralMonitoringDTO; import org.lamsfoundation.lams.tool.qa.QaAppConstants; @@ -224,6 +223,15 @@ refreshStatsData(request, qaMonitoringForm, qaService, generalMonitoringDTO); generalMonitoringDTO.setEditResponse(new Boolean(false).toString()); + + EditActivityDTO editActivityDTO = new EditActivityDTO(); + boolean isContentInUse=QaUtils.isContentInUse(qaContent); + logger.debug("isContentInUse:" + isContentInUse); + if (isContentInUse == true) + { + editActivityDTO.setMonitoredContentInUse(new Boolean(true).toString()); + } + request.setAttribute(EDIT_ACTIVITY_DTO, editActivityDTO); prepareReflectionData(request, qaContent, qaService, null, false); @@ -233,8 +241,6 @@ } - - /** * switches to instructions tab of the monitoring url. * getInstructions(ActionMapping mapping, @@ -324,7 +330,16 @@ generalMonitoringDTO.setEditResponse(new Boolean(false).toString()); prepareReflectionData(request, qaContent, qaService,null, false); - + + EditActivityDTO editActivityDTO = new EditActivityDTO(); + boolean isContentInUse=QaUtils.isContentInUse(qaContent); + logger.debug("isContentInUse:" + isContentInUse); + if (isContentInUse == true) + { + editActivityDTO.setMonitoredContentInUse(new Boolean(true).toString()); + } + request.setAttribute(EDIT_ACTIVITY_DTO, editActivityDTO); + logger.debug("final generalMonitoringDTO: " + generalMonitoringDTO ); request.setAttribute(QA_GENERAL_MONITORING_DTO, generalMonitoringDTO); @@ -396,7 +411,6 @@ if (qaService.studentActivityOccurredGlobal(qaContent)) { logger.debug("student activity occurred on this content:" + qaContent); - //request.getSession().setAttribute(USER_EXCEPTION_CONTENT_IN_USE, new Boolean(true).toString()); generalMonitoringDTO.setUserExceptionContentInUse(new Boolean(true).toString()); logger.debug("forwarding to: " + LOAD_MONITORING); return (mapping.findForward(LOAD_MONITORING)); @@ -415,7 +429,19 @@ logger.debug("final generalMonitoringDTO: " + generalMonitoringDTO ); request.setAttribute(QA_GENERAL_MONITORING_DTO, generalMonitoringDTO); - + + EditActivityDTO editActivityDTO = new EditActivityDTO(); + boolean isContentInUse=QaUtils.isContentInUse(qaContent); + logger.debug("isContentInUse:" + isContentInUse); + if (isContentInUse == true) + { + editActivityDTO.setMonitoredContentInUse(new Boolean(true).toString()); + } + request.setAttribute(EDIT_ACTIVITY_DTO, editActivityDTO); + + logger.debug("final generalMonitoringDTO: " + generalMonitoringDTO ); + request.setAttribute(QA_GENERAL_MONITORING_DTO, generalMonitoringDTO); + prepareReflectionData(request, qaContent, qaService,null, false); /* note that we are casting monitoring form subclass into Authoring form*/ @@ -514,7 +540,16 @@ } generalMonitoringDTO.setEditResponse(new Boolean(false).toString()); - + + EditActivityDTO editActivityDTO = new EditActivityDTO(); + boolean isContentInUse=QaUtils.isContentInUse(qaContent); + logger.debug("isContentInUse:" + isContentInUse); + if (isContentInUse == true) + { + editActivityDTO.setMonitoredContentInUse(new Boolean(true).toString()); + } + request.setAttribute(EDIT_ACTIVITY_DTO, editActivityDTO); + prepareReflectionData(request, qaContent, qaService,null, false); logger.debug("final generalMonitoringDTO: " + generalMonitoringDTO ); @@ -537,12 +572,13 @@ GeneralMonitoringDTO generalMonitoringDTO = new GeneralMonitoringDTO(); - //ATTENTION HERE: obtain strToolContentID String strToolContentID= null; - //request.getSession().setAttribute(IS_MONITORED_CONTENT_IN_USE, new Boolean(false).toString()); generalMonitoringDTO.setMonitoredContentInUse(new Boolean(false).toString()); - - //request.getSession().setAttribute(DEFINE_LATER_IN_EDIT_MODE, new Boolean(true).toString()); + + EditActivityDTO editActivityDTO = new EditActivityDTO(); + editActivityDTO.setMonitoredContentInUse(new Boolean(false).toString()); + request.setAttribute(EDIT_ACTIVITY_DTO, editActivityDTO); + generalMonitoringDTO.setDefineLaterInEditMode(new Boolean(true).toString()); logger.debug("final generalMonitoringDTO: " + generalMonitoringDTO ); @@ -556,7 +592,8 @@ throws IOException, ServletException { logger.debug("dispatching proxy editActivityQuestions..."); - QaAction qaAction= new QaAction(); + QaAction qaAction= new QaAction(); + return qaAction.addNewQuestion(mapping, form, request, response); } @@ -568,7 +605,6 @@ logger.debug("qaMonitoringForm: " + qaMonitoringForm); String questionIndex=qaMonitoringForm.getQuestionIndex(); logger.debug("questionIndex: " + questionIndex); - //request.getSession().setAttribute(REMOVABLE_QUESTION_INDEX, questionIndex); QaAction qaAction= new QaAction(); return qaAction.removeQuestion(mapping, form, request, response); @@ -577,16 +613,13 @@ public ActionForward submitAllContent(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException { logger.debug("dispatching proxy submitAllContent..."); - //request.getSession().setAttribute(ACTIVE_MODULE, DEFINE_LATER); GeneralMonitoringDTO generalMonitoringDTO = new GeneralMonitoringDTO(); generalMonitoringDTO.setDefineLaterInEditMode(new Boolean(false).toString()); logger.debug("final generalMonitoringDTO: " + generalMonitoringDTO ); request.setAttribute(QA_GENERAL_MONITORING_DTO, generalMonitoringDTO); - - //request.getSession().setAttribute(DEFINE_LATER_IN_EDIT_MODE, new Boolean(false).toString()); QaAction qaAction= new QaAction(); return qaAction.submitAllContent(mapping, form, request, response); @@ -664,7 +697,16 @@ logger.debug("generalLearnerFlowDTO: " + generalLearnerFlowDTO); prepareReflectionData(request, qaContent, qaService,null, false); - + + EditActivityDTO editActivityDTO = new EditActivityDTO(); + boolean isContentInUse=QaUtils.isContentInUse(qaContent); + logger.debug("isContentInUse:" + isContentInUse); + if (isContentInUse == true) + { + editActivityDTO.setMonitoredContentInUse(new Boolean(true).toString()); + } + request.setAttribute(EDIT_ACTIVITY_DTO, editActivityDTO); + refreshSummaryData(request, qaContent, qaService, true, false, null, null, generalLearnerFlowDTO, false); return (mapping.findForward(LOAD_MONITORING)); @@ -750,9 +792,18 @@ logger.debug("generalLearnerFlowDTO: " + generalLearnerFlowDTO); refreshSummaryData(request, qaContent, qaService, true, false, null, null, generalLearnerFlowDTO, true); - + prepareReflectionData(request, qaContent, qaService,null, false); - + + EditActivityDTO editActivityDTO = new EditActivityDTO(); + boolean isContentInUse=QaUtils.isContentInUse(qaContent); + logger.debug("isContentInUse:" + isContentInUse); + if (isContentInUse == true) + { + editActivityDTO.setMonitoredContentInUse(new Boolean(true).toString()); + } + request.setAttribute(EDIT_ACTIVITY_DTO, editActivityDTO); + return (mapping.findForward(LOAD_MONITORING)); } @@ -799,8 +850,8 @@ QaUsrResp qaUsrResp= qaService.retrieveQaUsrResp(new Long(responseId).longValue()); logger.debug("qaUsrResp: " + qaUsrResp); - // write out the audit log entry. If you move this after the update of the response, - // then make sure you update the audit call to use a copy of the original answer + /* write out the audit log entry. If you move this after the update of the response, + then make sure you update the audit call to use a copy of the original answer */ qaService.getAuditService().logChange(QAConstants.TOOL_SIGNATURE, qaUsrResp.getQaQueUser().getQueUsrId(),qaUsrResp.getQaQueUser().getUsername(), qaUsrResp.getAnswer(), updatedResponse); @@ -849,6 +900,16 @@ refreshSummaryData(request, qaContent, qaService, true, false, null, null, generalLearnerFlowDTO, false); prepareReflectionData(request, qaContent, qaService,null, false); + + EditActivityDTO editActivityDTO = new EditActivityDTO(); + boolean isContentInUse=QaUtils.isContentInUse(qaContent); + logger.debug("isContentInUse:" + isContentInUse); + if (isContentInUse == true) + { + editActivityDTO.setMonitoredContentInUse(new Boolean(true).toString()); + } + request.setAttribute(EDIT_ACTIVITY_DTO, editActivityDTO); + return (mapping.findForward(LOAD_MONITORING)); } @@ -937,6 +998,16 @@ refreshSummaryData(request, qaContent, qaService, true, false, null, null, generalLearnerFlowDTO, false); prepareReflectionData(request, qaContent, qaService,null, false); + + EditActivityDTO editActivityDTO = new EditActivityDTO(); + boolean isContentInUse=QaUtils.isContentInUse(qaContent); + logger.debug("isContentInUse:" + isContentInUse); + if (isContentInUse == true) + { + editActivityDTO.setMonitoredContentInUse(new Boolean(true).toString()); + } + request.setAttribute(EDIT_ACTIVITY_DTO, editActivityDTO); + return (mapping.findForward(LOAD_MONITORING)); } @@ -974,6 +1045,18 @@ logger.debug("summaryToolSessionsId: " + summaryToolSessionsId); prepareReflectionData(request, qaContent, qaService,null, false); + + + EditActivityDTO editActivityDTO = new EditActivityDTO(); + boolean isContentInUse=QaUtils.isContentInUse(qaContent); + logger.debug("isContentInUse:" + isContentInUse); + if (isContentInUse == true) + { + editActivityDTO.setMonitoredContentInUse(new Boolean(true).toString()); + } + request.setAttribute(EDIT_ACTIVITY_DTO, editActivityDTO); + + request.setAttribute(SUMMARY_TOOL_SESSIONS_ID, summaryToolSessionsId); } @@ -1001,7 +1084,6 @@ ServletException { QaUtils.cleanUpSessionAbsolute(request); - /*check this again */ return (mapping.findForward(LOAD_MONITORING)); } @@ -1116,11 +1198,16 @@ { logger.debug("monitoring url does not allow editActivity since the content is in use."); persistError(request,"error.content.inUse"); - //request.getSession().setAttribute(IS_MONITORED_CONTENT_IN_USE, new Boolean(true).toString()); generalMonitoringDTO.setMonitoredContentInUse(new Boolean(true).toString()); } - + EditActivityDTO editActivityDTO = new EditActivityDTO(); + if (isContentInUse == true) + { + editActivityDTO.setMonitoredContentInUse(new Boolean(true).toString()); + } + request.setAttribute(EDIT_ACTIVITY_DTO, editActivityDTO); + Map summaryToolSessionsId=MonitoringUtil.populateToolSessionsId(request, qaContent, qaService); logger.debug("summaryToolSessionsId: " + summaryToolSessionsId); request.setAttribute(SUMMARY_TOOL_SESSIONS_ID, summaryToolSessionsId); @@ -1250,7 +1337,15 @@ generalMonitoringDTO.setCountSessionComplete(new Integer(countSessionComplete).toString()); prepareReflectionData(request, qaContent, qaService,null, false); - + + EditActivityDTO editActivityDTO = new EditActivityDTO(); + boolean isContentInUse=QaUtils.isContentInUse(qaContent); + logger.debug("isContentInUse:" + isContentInUse); + if (isContentInUse == true) + { + editActivityDTO.setMonitoredContentInUse(new Boolean(true).toString()); + } + request.setAttribute(EDIT_ACTIVITY_DTO, editActivityDTO); logger.debug("ending refreshStatsData with generalMonitoringDTO: " + generalMonitoringDTO); request.setAttribute(QA_GENERAL_MONITORING_DTO, generalMonitoringDTO); } @@ -1328,6 +1423,15 @@ prepareReflectionData(request, qaContent, qaService,null, false); + EditActivityDTO editActivityDTO = new EditActivityDTO(); + boolean isContentInUse=QaUtils.isContentInUse(qaContent); + logger.debug("isContentInUse:" + isContentInUse); + if (isContentInUse == true) + { + editActivityDTO.setMonitoredContentInUse(new Boolean(true).toString()); + } + request.setAttribute(EDIT_ACTIVITY_DTO, editActivityDTO); + logger.debug("submitting session to refresh the data from the database: "); return (mapping.findForward(LOAD_MONITORING)); } @@ -1402,6 +1506,16 @@ prepareReflectionData(request, qaContent, qaService,null, false); + EditActivityDTO editActivityDTO = new EditActivityDTO(); + boolean isContentInUse=QaUtils.isContentInUse(qaContent); + logger.debug("isContentInUse:" + isContentInUse); + if (isContentInUse == true) + { + editActivityDTO.setMonitoredContentInUse(new Boolean(true).toString()); + } + request.setAttribute(EDIT_ACTIVITY_DTO, editActivityDTO); + + logger.debug("submitting session to refresh the data from the database: "); return (mapping.findForward(LOAD_MONITORING)); } Index: lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/web/QaMonitoringStarterAction.java =================================================================== diff -u -r09d8bc5a449269ac83f198afa78137b58305080c -r408afbaee696ef9a560b950f9509bed0c7b92d12 --- lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/web/QaMonitoringStarterAction.java (.../QaMonitoringStarterAction.java) (revision 09d8bc5a449269ac83f198afa78137b58305080c) +++ lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/web/QaMonitoringStarterAction.java (.../QaMonitoringStarterAction.java) (revision 408afbaee696ef9a560b950f9509bed0c7b92d12) @@ -43,6 +43,7 @@ import org.apache.struts.action.ActionMapping; import org.apache.struts.action.ActionMessage; import org.apache.struts.action.ActionMessages; +import org.lamsfoundation.lams.tool.qa.EditActivityDTO; import org.lamsfoundation.lams.tool.qa.GeneralLearnerFlowDTO; import org.lamsfoundation.lams.tool.qa.GeneralMonitoringDTO; import org.lamsfoundation.lams.tool.qa.QaAppConstants; @@ -54,7 +55,7 @@ import org.lamsfoundation.lams.tool.qa.service.IQaService; import org.lamsfoundation.lams.tool.qa.service.QaServiceProxy; import org.lamsfoundation.lams.web.util.AttributeNames; -import org.lamsfoundation.lams.tool.qa.web.QaMonitoringAction; +import org.lamsfoundation.lams.tool.qa.web.QaMonitoringAction; /** * @@ -204,6 +205,16 @@ generalMonitoringDTO.setDeletedAttachmentList(new ArrayList()); /** ...till here **/ + EditActivityDTO editActivityDTO = new EditActivityDTO(); + boolean isContentInUse=QaUtils.isContentInUse(qaContent); + logger.debug("isContentInUse:" + isContentInUse); + if (isContentInUse == true) + { + editActivityDTO.setMonitoredContentInUse(new Boolean(true).toString()); + } + request.setAttribute(EDIT_ACTIVITY_DTO, editActivityDTO); + + qaMonitoringAction.prepareReflectionData(request, qaContent, qaService, null, false); logger.debug("final qaMonitoringForm: " + qaMonitoringForm); Index: lams_tool_laqa/web/monitoring/Edit.jsp =================================================================== diff -u -r0e25eab07d7153c61f50deb6332abc0d4ed3ec69 -r408afbaee696ef9a560b950f9509bed0c7b92d12 --- lams_tool_laqa/web/monitoring/Edit.jsp (.../Edit.jsp) (revision 0e25eab07d7153c61f50deb6332abc0d4ed3ec69) +++ lams_tool_laqa/web/monitoring/Edit.jsp (.../Edit.jsp) (revision 408afbaee696ef9a560b950f9509bed0c7b92d12) @@ -31,7 +31,7 @@
|