Index: lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/QaAppConstants.java =================================================================== diff -u -ra4cd73bee5754b50f4ffbd330d1af3eaaf8c6d6c -r9df1d5a98cca04bad889e37e9e9bf91ade33b5fb --- lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/QaAppConstants.java (.../QaAppConstants.java) (revision a4cd73bee5754b50f4ffbd330d1af3eaaf8c6d6c) +++ lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/QaAppConstants.java (.../QaAppConstants.java) (revision 9df1d5a98cca04bad889e37e9e9bf91ade33b5fb) @@ -64,9 +64,6 @@ public static final String LOAD ="load"; public static final String LOAD_QUESTIONS ="load"; public static final String LOAD_STARTER ="starter"; - public static final String AUTHORING_BASIC ="authoringBasic"; - public static final boolean MODE_OPTIONAL = false; - public static final String DISABLE_TOOL ="disabled"; public static final String IS_DEFINE_LATER ="isDefineLater"; public static final String LEARNING_MODE ="learningMode"; @@ -76,34 +73,18 @@ public static final String IS_ADD_QUESTION ="isAddQuestion"; public static final String IS_REMOVE_QUESTION ="isRemoveQuestion"; public static final String IS_REMOVE_CONTENT ="isRemoveContent"; - - /* - * tab controllers, constants for authoring page html tabs, used within jsp - */ - public static final String CHOICE ="choice"; - public static final String CHOICE_TYPE_BASIC ="choiceTypeBasic"; - public static final String CHOICE_TYPE_ADVANCED ="choiceTypeAdvanced"; - public static final String CHOICE_TYPE_INSTRUCTIONS ="choiceTypeInstructions"; public static final String SELECTION_CASE ="selectionCase"; /* * authoring mode constants */ public static final String MAP_QUESTION_CONTENT ="mapQuestionContent"; public static final String DEFAULT_QUESTION_CONTENT ="defaultQuestionContent"; - public static final String TITLE ="title"; - public static final String INSTRUCTIONS ="instructions"; - public static final String CREATION_DATE ="creationDate"; - public static final String USERNAME_VISIBLE ="usernameVisible"; public static final String ONLINE_INSTRUCTIONS ="onlineInstructions"; public static final String OFFLINE_INSTRUCTIONS ="offlineInstructions"; public static final String END_LEARNING_MESSSAGE ="endLearningMessage"; - public static final String CONTENT_LOCKED ="contentLocked"; public static final String ON ="ON"; public static final String OFF ="OFF"; - public static final String IS_USERNAME_VISIBLE_MONITORING ="isUsernameVisibleMonitoring"; - public static final String IS_SYNCH_INMONITOR_MONITORING ="isSynchInMonitorMonitoring"; - public static final String IS_QUESTIONS_SEQUENCED_MONITORING ="isQuestionsSequencedMonitoring"; public static final String RICHTEXT_OFFLINEINSTRUCTIONS ="richTextOfflineInstructions"; public static final String RICHTEXT_ONLINEINSTRUCTIONS ="richTextOnlineInstructions"; public static final String RICHTEXT_TITLE ="richTextTitle"; @@ -121,7 +102,6 @@ public static final String COMPLETED ="COMPLETED"; public static final String MAP_TOOL_SESSIONS ="mapToolSessions"; - public static final String RESPONSE_INDEX ="responseIndex"; public static final Integer MAX_TOOL_SESSION_COUNT =new Integer(500); public static final String IS_TOOL_SESSION_CHANGED ="isToolSessionChanged"; public static final String USER_EXCEPTION_WRONG_FORMAT ="userExceptionWrongFormat"; @@ -143,13 +123,13 @@ public static final String USER_EXCEPTION_NO_TOOL_SESSIONS ="userExceptionNoToolSessions"; public static final String USER_EXCEPTION_NO_STUDENT_ACTIVITY ="userExceptionNoStudentActivity"; public static final String COUNT_SESSION_COMPLETE ="countSessionComplete"; + public static final String CURRENT_MONITORED_TOOL_SESSION ="currentMonitoredToolSession"; - public static final String TOP_MARK ="topMark"; - public static final String LOWEST_MARK ="lowestMark"; - public static final String AVERAGE_MARK ="averageMark"; public static final String COUNT_ALL_USERS ="countAllUsers"; public static final String CURRENT_MONITORING_TAB ="currentMonitoringTab"; 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"; /* * export portfolio constants @@ -200,53 +180,16 @@ /* * Monitoring Mode constants */ - public static final String REPORT_TITLE_MONITOR ="reportTitleMonitor"; - public static final String MONITOR_USER_ID ="userId"; - public static final String MONITORING_REPORT ="monitoringReport"; - public static final String MONITORING_ERROR ="monitoringError"; - public static final String MAP_MONITORING_QUESTIONS ="mapMonitoringQuestions"; - public static final String SUMMARY_TOOL_SESSIONS ="summaryToolSessions"; - public static final String SUMMARY_TOOL_SESSIONS_ID ="summaryToolSessionsId"; - public static final String CURRENT_MONITORED_TOOL_SESSION ="currentMonitoredToolSession"; - public static final String CHOICE_MONITORING ="choiceMonitoring"; - public static final String CHOICE_TYPE_MONITORING_SUMMARY ="choiceTypeMonitoringSummary"; - public static final String CHOICE_TYPE_MONITORING_INSTRUCTIONS ="choiceTypeMonitoringInstructions"; - public static final String CHOICE_TYPE_MONITORING_EDITACTIVITY ="choiceTypeMonitoringEditActivity"; - public static final String CHOICE_TYPE_MONITORING_STATS ="choiceTypeMonitoringStats"; - public static final String MONITORING_INSTRUCTIONS_VISITED ="monitoringInstructionsVisited"; - public static final String MONITORING_EDITACTIVITY_VISITED ="monitoringEditActivityVisited"; - public static final String MONITORING_STATS_VISITED ="monitoringStatsVisited"; - public static final String DATAMAP_EDITABLE ="dataMapEditable"; - public static final String DATAMAP_EDITABLE_RESPONSE_ID ="dataMapEditableResponseId"; - public static final String DATAMAP_HIDDEN_RESPONSE_ID ="dataMapHiddenResponseId"; - public static final String MONITORED_CONTENT_ID ="monitoredContentId"; - public static final String START_MONITORING_SUMMARY_REQUEST ="startMonitoringSummaryRequest"; - public static final String STOP_RENDERING_QUESTIONS ="stopRenderingQuestions"; public static final String EDITACTIVITY_EDITMODE ="editActivityEditMode"; public static final String RENDER_MONITORING_EDITACTIVITY ="renderMonitoringEditActivity"; public static final String NO_AVAILABLE_SESSIONS ="noAvailableSessions"; - - public static final String IS_MONITORING_DEFINE_LATER ="isMonitoringDefineLater"; public static final String NO_TOOL_SESSIONS_AVAILABLE ="noToolSessionAvailable"; - public static final String ORIGINAL_TOOL_SESSIONS ="originalToolSessions"; - public static final String MONITORED_OFFLINE_INSTRUCTIONS ="monitoredOfflineInstructions"; - public static final String MONITORED_ONLINE_INSTRUCTIONS ="monitoredOnlineInstructions"; - public static final String MONITORING_INSTRUCTIONS_UPDATE_MESSAGE ="monitoringInstructionsUpdateMessage"; - + public static final String TIMEZONE ="timeZone"; + public static final String TIMEZONE_ID ="timeZoneId"; /* * Monitor and Learning common constants - used in jsp reporting */ - public static final String FULLNAME ="fullName"; - public static final String ANSWER ="answer"; - public static final String ATIME ="aTime"; - public static final String FORMATTED_ATIME ="formattedAtime"; - public static final String RESPONSE_ID ="responseId"; - public static final String RESPONSE_HIDDEN ="responseHidden"; - public static final String CURRENTLEARNER_FULLNAME ="currentLearnerFullname"; - public static final String ATTR_USERDATA ="qa_user"; - public static final String TIMEZONE ="timeZone"; - public static final String TIMEZONE_ID ="timeZoneId"; public static final String QUESTION_LISTING_MODE ="questionListingMode"; public static final String QUESTION_LISTING_MODE_SEQUENTIAL ="questionListingModeSequential"; Index: lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/QaUtils.java =================================================================== diff -u -rbb041188ecb180ae9cd8e01428c8f431aa89bd93 -r9df1d5a98cca04bad889e37e9e9bf91ade33b5fb --- lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/QaUtils.java (.../QaUtils.java) (revision bb041188ecb180ae9cd8e01428c8f431aa89bd93) +++ lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/QaUtils.java (.../QaUtils.java) (revision 9df1d5a98cca04bad889e37e9e9bf91ade33b5fb) @@ -102,49 +102,7 @@ */ public static void cleanupSession(HttpServletRequest request) { - /* remove session attributes in Authoring mode */ - request.getSession().removeAttribute(DEFAULT_QUESTION_CONTENT); - request.getSession().removeAttribute(MAP_QUESTION_CONTENT); - request.getSession().removeAttribute(CHOICE); - request.getSession().removeAttribute(IS_DEFINE_LATER); - request.getSession().removeAttribute(DISABLE_TOOL); - request.getSession().removeAttribute(CHOICE_TYPE_BASIC); - request.getSession().removeAttribute(CHOICE_TYPE_ADVANCED); - request.getSession().removeAttribute(CHOICE_TYPE_INSTRUCTIONS); - request.getSession().removeAttribute(REPORT_TITLE); - request.getSession().removeAttribute(INSTRUCTIONS); - request.getSession().removeAttribute(TITLE); - request.getSession().removeAttribute(CONTENT_LOCKED); - - /* remove session attributes in Learner mode */ - request.getSession().removeAttribute(MAP_ANSWERS); - request.getSession().removeAttribute(MAP_QUESTION_CONTENT_LEARNER); - request.getSession().removeAttribute(CURRENT_QUESTION_INDEX); - request.getSession().removeAttribute(TOTAL_QUESTION_COUNT); - request.getSession().removeAttribute(CURRENT_ANSWER); - request.getSession().removeAttribute(USER_FEEDBACK); - request.getSession().removeAttribute(AttributeNames.PARAM_TOOL_SESSION_ID); - request.getSession().removeAttribute(QUESTION_LISTING_MODE); - request.getSession().removeAttribute(QUESTION_LISTING_MODE_SEQUENTIAL); - request.getSession().removeAttribute(QUESTION_LISTING_MODE_COMBINED); - request.getSession().removeAttribute(MAP_USER_RESPONSES); - request.getSession().removeAttribute(MAP_MAIN_REPORT); - request.getSession().removeAttribute(REPORT_TITLE_LEARNER); - request.getSession().removeAttribute(END_LEARNING_MESSAGE); - request.getSession().removeAttribute(IS_TOOL_ACTIVITY_OFFLINE); - - /* remove session attributes in Monitoring mode */ - request.getSession().removeAttribute(MAP_TOOL_SESSIONS); - request.getSession().removeAttribute(MAP_MONITORING_QUESTIONS); - - /* remove session attributes used commonly */ - request.getSession().removeAttribute(IS_USERNAME_VISIBLE); - request.getSession().removeAttribute(REPORT_TITLE_MONITOR); - request.getSession().removeAttribute(IS_ALL_SESSIONS_COMPLETED); - request.getSession().removeAttribute(CHECK_ALL_SESSIONS_COMPLETED); - request.getSession().removeAttribute(AttributeNames.PARAM_TOOL_CONTENT_ID); - request.getSession().removeAttribute(ATTR_USERDATA); - request.getSession().removeAttribute(TARGET_MODE); + } /** @@ -176,50 +134,8 @@ } - /** - * Helper method to retrieve the user data. We always load up from http - * session first to optimize the performance. If no session cache available, - * we load it from data source. - * @param request A standard Servlet HttpServletRequest class. - * @param surveyService the service facade of qa tool - * @return the user data value object - */ - public static User getUserData(HttpServletRequest request,IQaService qaService) throws QaApplicationException - { - User userCompleteData = (User) request.getSession().getAttribute(ATTR_USERDATA); - logger.debug(logger + " " + "QaUtils" + "retrieving userCompleteData: " + userCompleteData); - /* - * if no session cache available, retrieve it from data source - */ - if (userCompleteData == null) - { - /* - * WebUtil.getUsername(request,DEVELOPMENT_FLAG) returns the current learner's username based on - * user principals defined in the container. If no username is defined in the container, we get a RunTimeException. - */ - - /* - * pass testing flag as false to obtain user principal - */ - try - { - String userName=getUsername(request,false); - userCompleteData = qaService.getCurrentUserData(userName); - } - catch(QaApplicationException e) - { - logger.debug(logger + " " + "QaUtils" + " Exception occured: Tool expects the current user is an authenticated user and he has a security principal defined. Can't continue!: " + e); - throw new QaApplicationException("Exception occured: " + - "Tool expects the current user is an authenticated user and he has a security principal defined. Can't continue!"); - } - - logger.debug(logger + " " + "QaUtils" + "retrieving userCompleteData from service: " + userCompleteData); - /* this can be redundant as we keep the User data in TOOL_USER */ - request.getSession().setAttribute(ATTR_USERDATA, userCompleteData); - } - return userCompleteData; - } + public static int getCurrentUserId(HttpServletRequest request) throws QaApplicationException { HttpSession ss = SessionManager.getSession(); @@ -320,6 +236,7 @@ request.getSession().setAttribute(TIMEZONE_ID, timeZone.getID()); } + /** * stores the rich text values on the forms into the session scope * persistRichText(HttpServletRequest request) Index: lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/web/LearningUtil.java =================================================================== diff -u -rbb041188ecb180ae9cd8e01428c8f431aa89bd93 -r9df1d5a98cca04bad889e37e9e9bf91ade33b5fb --- lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/web/LearningUtil.java (.../LearningUtil.java) (revision bb041188ecb180ae9cd8e01428c8f431aa89bd93) +++ lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/web/LearningUtil.java (.../LearningUtil.java) (revision 9df1d5a98cca04bad889e37e9e9bf91ade33b5fb) @@ -163,327 +163,11 @@ } - /** - * creates a data structure to hold learner report data - * buidLearnerReport(HttpServletRequest request, Map mapQuestions, Map mapAnswers) - * - * calls processUserResponses() to do some of the work - * @param HttpServletRequest request, Map mapQuestions, Map mapAnswers - * return void - * - */ - protected void buidLearnerReport(HttpServletRequest request, int toolSessionIdCounter, IQaService qaService) - { - /* - * find out the current tool session - */ - Long toolSessionId=(Long) request.getSession().getAttribute(AttributeNames.PARAM_TOOL_SESSION_ID); - logger.debug("processUserResponses using toolSessionId: " + toolSessionId); - - /* - * holds all the tool sessions passed in from the url - * used in monitoring mode - */ - Map mapToolSessions=(Map)request.getSession().getAttribute(MAP_TOOL_SESSIONS); - logger.debug("retrieving MAP_TOOL_SESSIONS from the session: " + mapToolSessions); - - /* - * keys of the Map refers to questions and values refers to user info and their entries - * used in learning mode - */ - Map mapMainReport= new TreeMap(new QaStringComparator()); - logger.debug("mapMainReport created with QaStringComparator"); - - Long toolContentId=(Long) request.getSession().getAttribute(AttributeNames.PARAM_TOOL_CONTENT_ID); - logger.debug("current toolContentId: " + toolContentId); - QaContent qaContent=qaService.loadQa(toolContentId.longValue()); - logger.debug("retrieve qaContent: " + qaContent); - - /* - * Reason for commentting the line below. When the user response is updated in monitor - * qaContent.getQaQueContents() would failed for some reason. Hence I've created a new - * method retrieveQaQueContentsByToolContentId() to work around this problem. I'm not - * sure why qaContent.getQaQueContents() fails but I assume it's a transation problem. - * - * Anthony - */ - //Set qaQueContents = qaContent.getQaQueContents(); - List qaQueContents = qaService.retrieveQaQueContentsByToolContentId(toolContentId.longValue()); - Iterator contentIterator=qaQueContents.iterator(); - - logger.debug("content iteration count: " + qaQueContents.size()); - - int questionIndex=0; - /* - * used to iterate responses to questions within the tool sessions in the jsp level in the monitoring mode - */ - Map mapQuestions= new TreeMap(new QaStringComparator()); - logger.debug("mapQuestions created with QaStringComparator"); - - /* - * used to iterate questions within the tool sessions in the jsp level in the monitoring mode - */ - Map mapMonitoringQuestions= new TreeMap(new QaStringComparator()); - logger.debug("mapMonitoringQuestions created with QaStringComparator"); - - while (contentIterator.hasNext()) - { - QaQueContent qaQueContent=(QaQueContent)contentIterator.next(); - logger.debug("retrieve qaQueContent: " + qaQueContent); - if (qaQueContent != null) - { - /* - * obtain All responses from ALL users to this question - */ - Set qaUsrResps=qaQueContent.getQaUsrResps(); - logger.debug("the set of user responses qaUsrResps: " + qaUsrResps); - - /* - * deal with all responses - */ - questionIndex=questionIndex+1; - logger.debug("current questionIndex: " + questionIndex); - - String targetMode=(String) request.getSession().getAttribute(TARGET_MODE); - logger.debug("TARGET_MODE: " + targetMode); - - logger.debug("buidLearnerReport for TARGET_MODE: " + targetMode); - if (targetMode.equalsIgnoreCase(TARGET_MODE_MONITORING)) - { - Map mapUserResponses=processUserResponses(request, qaUsrResps, questionIndex, new TreeMap()); - /* - * Map mapQuestions for holding the question index /responses pair - */ - mapQuestions.put(new Integer(questionIndex).toString(),mapUserResponses); - logger.debug("getting mapQuestions: " + mapQuestions); - /* - * Map mapQuestions for holding the questions themselves - */ - mapMonitoringQuestions.put(new Integer(questionIndex).toString(),qaQueContent.getQuestion()); - logger.debug("getting mapMonitoringQuestions: " + mapMonitoringQuestions); - request.getSession().setAttribute(MAP_MONITORING_QUESTIONS,mapMonitoringQuestions); - - mapToolSessions.put(toolSessionId.toString(), mapQuestions); - logger.debug("mapToolSessionsupdated: " + mapToolSessions); - request.getSession().setAttribute(MAP_TOOL_SESSIONS,mapToolSessions); - logger.debug("MAP_TOOL_SESSIONS in session updated: " + mapToolSessions); - } - else - { - Map mapUserResponses= new TreeMap(new QaComparator()); - mapUserResponses=processUserResponses(request, qaUsrResps, questionIndex, mapUserResponses); - mapMainReport.put(qaQueContent.getQuestion(), mapUserResponses); - } - } - } - logger.debug("mapMainReport: " + mapMainReport); - request.getSession().setAttribute(MAP_MAIN_REPORT, mapMainReport); - } - /** - * This method prepares the report to eb presented in both leraning and monitoring mode. - * In learning mode in places the curresnt user's data in the first row. - * In monitoring mode, it just presents data as it reads into the Map as usual. - * - * - * Reporting in Learning mode is different than reporting in monitoring mode in two main respects: - * 1- Use of username visible applies only to learning mode - * 2- Placing the current user's name first in the generated list only applies to learning mode - * - * prepares ALL responses to a particular question and - * makes it available to the UI. - * processUserResponses(Set qaUsrResps) - * return void - * @param qaUsrResps - */ - protected Map processUserResponses(HttpServletRequest request, Set qaUsrResps, int questionIndex, Map mapUserResponses) - { - logger.debug("will be processing user responses: "); - - /* - * find out the current tool session - */ - Long toolSessionId=(Long) request.getSession().getAttribute(AttributeNames.PARAM_TOOL_SESSION_ID); - logger.debug("processUserResponses using toolSessionId: " + toolSessionId); - - /* - * find out the tool's mode. We produce different reports for learning and monitoring - */ - String targetMode=(String)request.getSession().getAttribute(TARGET_MODE); - logger.debug("TARGET_MODE: " + targetMode); - - if (targetMode.equalsIgnoreCase(TARGET_MODE_MONITORING)) - { - logger.debug("processUserResponses for TARGET_MODE: " + targetMode); - - if (qaUsrResps.isEmpty()) - logger.debug("the set of user responses for a particular question is empty."); - - Iterator itResps=qaUsrResps.iterator(); - /* - * obtain each response and the user that replied with that response - */ - int responseIndex=0; - while (itResps.hasNext()) - { - QaUsrResp qaUsrResp=(QaUsrResp)itResps.next(); - logger.debug("using qaUsrResp: " + qaUsrResp + " with responseIndex: " + responseIndex); - /* - * Don't include the blank answers in the report. Make sure it is the requirement. - */ - if ((qaUsrResp != null) && (qaUsrResp.getAnswer() != null) && (!qaUsrResp.getAnswer().equals(""))) - { - logger.debug("iterated qaUsrResp:" + qaUsrResp); - logger.debug("isResponseHidden: " + qaUsrResp.isHidden()); - QaQueUsr qaQueUsr=qaUsrResp.getQaQueUser(); - /* find out what you need to display: fullname or login (userName)? */ - logger.debug("iterated qaQueUsr fullName:" + qaQueUsr.getFullname()); - logger.debug("iterated qaQueUsr userName:" + qaQueUsr.getUsername()); - logger.debug("iterated qaQueUsr userName:" + qaQueUsr.getQaSession()); - logger.debug("using responseIndex: " + responseIndex); - - QaSession qaSession=qaQueUsr.getQaSession(); - if (toolSessionId.equals(qaSession.getQaSessionId())) - { - responseIndex=responseIndex+1; - logger.debug("responseIndex incremented to: " + responseIndex); - mapUserResponses.put(new Integer(responseIndex).toString(), qaQueUsr.getFullname() + " " + qaUsrResp.getAttemptTime() + " " + qaUsrResp.getAnswer()); - logger.debug("setting attemptTime: " + "aTime" + questionIndex +""+ responseIndex + "---------" + qaUsrResp.getAttemptTime()); - logger.debug("setting final monitoring report data with:" + toolSessionId + " " + questionIndex + " " + responseIndex); - - request.getSession().setAttribute(FULLNAME + toolSessionId + "" + questionIndex +""+ responseIndex, qaQueUsr.getFullname()); - request.getSession().setAttribute(ANSWER + toolSessionId + "" + questionIndex +""+ responseIndex, qaUsrResp.getAnswer()); - request.getSession().setAttribute(ATIME + toolSessionId + "" + questionIndex +""+ responseIndex, qaUsrResp.getAttemptTime()); - request.getSession().setAttribute(TIMEZONE_ID + questionIndex + "" + responseIndex, qaUsrResp.getTimezone()); - request.getSession().setAttribute(RESPONSE_ID + toolSessionId + "" + questionIndex +""+ responseIndex, qaUsrResp.getResponseId()); - - boolean isResponseHidden=qaUsrResp.isHidden(); - logger.debug("isResponseHidden: " + isResponseHidden); - request.getSession().setAttribute(RESPONSE_HIDDEN + toolSessionId + "" + questionIndex +""+ responseIndex, new Boolean(isResponseHidden)); - } - } - } - } - else if (targetMode.equalsIgnoreCase(TARGET_MODE_LEARNING)) - { - logger.debug("processUserResponses for TARGET_MODE: " + targetMode); - /* - * find out whos is the current user. Important to know for reporting responses in learning mode - */ - HttpSession ss = SessionManager.getSession(); - /* get back login user DTO */ - UserDTO toolUser = (UserDTO) ss.getAttribute(AttributeNames.USER); - logger.debug("retrieving toolUser: " + toolUser + " userName: " + toolUser.getLogin()); - /* - * !!double check if String userName=toolUser.getLogin(); - */ - - /* - * see whether you have to report only the current learner's name and make invisible all the other learner's names in the report. - * A boolean true isUsernameVisible indicates that all user names to be displayed. - * Only applies to learning mode. - */ - - Boolean isUsernameVisible=(Boolean)request.getSession().getAttribute(IS_USERNAME_VISIBLE); - logger.debug("IS_USERNAME_VISIBLE: " + isUsernameVisible); - - - if (qaUsrResps.isEmpty()) - logger.debug("the set of user responses for a particular question is empty."); - - Iterator itResps=qaUsrResps.iterator(); - /* - * obtain each response and the user that replied with that response - */ - int responseIndex=0; - while (itResps.hasNext()) - { - QaUsrResp qaUsrResp=(QaUsrResp)itResps.next(); - logger.debug("using qaUsrResp: " + qaUsrResp + " with responseIndex: " + responseIndex); - /* - * Don't include the blank answers in the report. Make sure it is the requirement. - */ - if ((qaUsrResp != null) && (!qaUsrResp.isHidden()) && (qaUsrResp.getAnswer() != null) && (!qaUsrResp.getAnswer().equals(""))) - { - logger.debug("iterated qaUsrResp:" + qaUsrResp); - QaQueUsr qaQueUsr=qaUsrResp.getQaQueUser(); - //find out what you need to display: fullname or login (userName)? - logger.debug("iterated qaQueUsr fullName:" + qaQueUsr.getFullname()); - logger.debug("iterated qaQueUsr userName:" + qaQueUsr.getUsername()); - logger.debug("iterated qaQueUsr userName:" + qaQueUsr.getQaSession()); - logger.debug("using responseIndex: " + responseIndex); - - /* - * find out if the current tool user's login(userName) is the same as the iterated user's userName. - * If there is a match we need to display that person first in the report - * !!do this when User objkect issue is resolved!!! - */ - - /* - * these are all the other users. See if we have the permission to display their names. - * if we are permitted, get ready to display all available information - */ - - /* - * get user's tool session - */ - QaSession qaSession=qaQueUsr.getQaSession(); - logger.debug("iterated qaQueUsr userName:" + qaSession.getQaSessionId()); - logger.debug("incoming toolSessionId versus user's toolSessionId:" + toolSessionId + " versus " + qaSession.getQaSessionId()); - - logger.debug("toolSessionId versus iterated session id: " + toolSessionId + "--" + qaSession.getQaSessionId()); - logger.debug("learner report includes only those responses in the same tool session: " + toolSessionId); - if (toolSessionId.equals(qaSession.getQaSessionId())) - { - - responseIndex=responseIndex+1; - logger.debug("responseIndex incremented to: " + responseIndex); - if (isUsernameVisible.booleanValue()) - { - logger.debug("IS_USERNAME_VISIBLE:" + isUsernameVisible.booleanValue()); - mapUserResponses.put(new Integer(responseIndex).toString(), qaQueUsr.getFullname() + " " + qaUsrResp.getAttemptTime() + " " + qaUsrResp.getAnswer()); - logger.debug("Building request level response data with: " + - "fullname" + questionIndex +""+ responseIndex); - request.getSession().setAttribute(FULLNAME + questionIndex +""+ responseIndex, qaQueUsr.getFullname()); - - } - else /* we won't display the usernames of these users*/ - { - logger.debug("IS_USERNAME_VISIBLE:" + isUsernameVisible.booleanValue()); - mapUserResponses.put(new Integer(responseIndex).toString(), " " + qaUsrResp.getAttemptTime() + " " + qaUsrResp.getAnswer()); - logger.debug("Building request level response data with: " + - "aTime" + questionIndex +""+ responseIndex); - } - /* - * place these whether username visible or not - */ - - logger.debug("setting attemptTime: " + "aTime" + questionIndex +""+ responseIndex + - "---------" + qaUsrResp.getAttemptTime() +"-----" + qaUsrResp.getTimezone() ); - - request.getSession().setAttribute(ANSWER + questionIndex +""+ responseIndex, qaUsrResp.getAnswer()); - request.getSession().setAttribute(ATIME + questionIndex +""+ responseIndex, qaUsrResp.getAttemptTime()); - request.getSession().setAttribute(FORMATTED_ATIME + questionIndex +""+ responseIndex, QaUtils.getFormattedDateString(qaUsrResp.getAttemptTime())); - logger.debug("setting formattedDatetime"); - request.getSession().setAttribute(TIMEZONE_ID + questionIndex +""+ responseIndex, qaUsrResp.getTimezone()); - - if (qaQueUsr.getUsername().equalsIgnoreCase(toolUser.getLogin())) - { - request.getSession().setAttribute(FULLNAME + questionIndex +""+ responseIndex, qaQueUsr.getFullname()); - logger.debug("include fullName for current learner: " + "fullName" + questionIndex +""+ responseIndex + "---" + qaQueUsr.getFullname()); - logger.debug("current learner:" + qaQueUsr.getUsername()); - request.getSession().setAttribute(CURRENTLEARNER_FULLNAME , qaQueUsr.getFullname()); - logger.debug("current learner fullname:" + qaQueUsr.getFullname()); - } - } - } - } - } - logger.debug("Learner report MAP_USER_RESPONSES: " + mapUserResponses); - return mapUserResponses; - } + + /** * feedBackAnswersProgress(HttpServletRequest request, int currentQuestionIndex) Index: lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/web/MonitoringUtil.java =================================================================== diff -u -r4beb496ffd830646c5752e770f04ca60e56ef231 -r9df1d5a98cca04bad889e37e9e9bf91ade33b5fb --- lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/web/MonitoringUtil.java (.../MonitoringUtil.java) (revision 4beb496ffd830646c5752e770f04ca60e56ef231) +++ lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/web/MonitoringUtil.java (.../MonitoringUtil.java) (revision 9df1d5a98cca04bad889e37e9e9bf91ade33b5fb) @@ -79,30 +79,7 @@ } - /** - * cleanupMonitoringSession(HttpServletRequest request) - * @param request - */ - public void cleanupMonitoringSession(HttpServletRequest request) - { - request.getSession().removeAttribute(MAP_TOOL_SESSIONS); - request.getSession().removeAttribute(MAP_MONITORING_QUESTIONS); - request.getSession().removeAttribute(CURRENT_MONITORED_TOOL_SESSION); - request.getSession().removeAttribute(MAP_USER_RESPONSES); - request.getSession().removeAttribute(DATAMAP_EDITABLE); - request.getSession().removeAttribute(CHOICE_MONITORING); - request.getSession().removeAttribute(DATAMAP_EDITABLE_RESPONSE_ID); - request.getSession().removeAttribute(DATAMAP_HIDDEN_RESPONSE_ID); - - /* remove session attributes used commonly */ - request.getSession().removeAttribute(IS_USERNAME_VISIBLE); - request.getSession().removeAttribute(REPORT_TITLE_MONITOR); - request.getSession().removeAttribute(IS_ALL_SESSIONS_COMPLETED); - request.getSession().removeAttribute(CHECK_ALL_SESSIONS_COMPLETED); - request.getSession().removeAttribute(AttributeNames.PARAM_TOOL_CONTENT_ID); - request.getSession().removeAttribute(ATTR_USERDATA); - request.getSession().removeAttribute(TARGET_MODE); - } + Index: lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/web/QAction.java =================================================================== diff -u -rf2b7c28c53bfee9c676b5a836e42b71e0e1bf20f -r9df1d5a98cca04bad889e37e9e9bf91ade33b5fb --- lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/web/QAction.java (.../QAction.java) (revision f2b7c28c53bfee9c676b5a836e42b71e0e1bf20f) +++ lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/web/QAction.java (.../QAction.java) (revision 9df1d5a98cca04bad889e37e9e9bf91ade33b5fb) @@ -239,35 +239,22 @@ request.getSession().setAttribute(EDITACTIVITY_EDITMODE, new Boolean(true)); return (mapping.findForward(LOAD_QUESTIONS)); } - - /* - * look after defineLater flag - */ - Long monitoredContentId=(Long)request.getSession().getAttribute(MONITORED_CONTENT_ID); - logger.debug("MONITORED_CONTENT_ID: " + monitoredContentId); - if (monitoredContentId != null) - { - qaService.unsetAsDefineLater(monitoredContentId); - logger.debug("MONITORED_CONTENT_ID has been unset as defineLater: "); - } - List attachmentList = (List) request.getSession().getAttribute(ATTACHMENT_LIST); - List deletedAttachmentList = (List) request.getSession().getAttribute(DELETED_ATTACHMENT_LIST); + List attachmentList = (List) request.getSession().getAttribute(ATTACHMENT_LIST); + List deletedAttachmentList = (List) request.getSession().getAttribute(DELETED_ATTACHMENT_LIST); - authoringUtil.reconstructQuestionContentMapForSubmit(mapQuestionContent, request); - - logger.debug("before saveOrUpdateQaContent."); - QaContent qaContent = authoringUtil.saveOrUpdateQaContent(mapQuestionContent, qaService, qaAuthoringForm); - logger.debug("after saveOrUpdateQaContent."); + authoringUtil.reconstructQuestionContentMapForSubmit(mapQuestionContent, request); + logger.debug("before saveOrUpdateQaContent."); + QaContent qaContent = authoringUtil.saveOrUpdateQaContent(mapQuestionContent, qaService, qaAuthoringForm); + logger.debug("after saveOrUpdateQaContent."); - saveAttachments(qaContent, attachmentList, deletedAttachmentList, mapping, request); - - errors.clear(); - errors.add(Globals.ERROR_KEY, new ActionMessage("submit.successful")); - request.getSession().setAttribute(SUBMIT_SUCCESS, new Integer(1)); - logger.debug("setting SUBMIT_SUCCESS to 1."); + saveAttachments(qaContent, attachmentList, deletedAttachmentList, mapping, request); + + errors.clear(); + errors.add(Globals.ERROR_KEY, new ActionMessage("submit.successful")); + request.getSession().setAttribute(SUBMIT_SUCCESS, new Integer(1)); + logger.debug("setting SUBMIT_SUCCESS to 1."); - saveErrors(request,errors); qaAuthoringForm.resetUserAction(); @@ -505,8 +492,6 @@ learningUtil.createUsersAndResponses(mapAnswers, request, qaService); qaLearningForm.resetUserActions(); qaLearningForm.setSubmitAnswersContent(null); - /*start generating a report for the Learner*/ - learningUtil.buidLearnerReport(request,1, qaService); Long toolContentId=(Long) request.getSession().getAttribute(AttributeNames.PARAM_TOOL_CONTENT_ID); learningUtil.lockContent(toolContentId.longValue(), qaService); logger.debug("content has been locked"); Fisheye: Tag 9df1d5a98cca04bad889e37e9e9bf91ade33b5fb refers to a dead (removed) revision in file `lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/web/QaExportPortfolioForm.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 9df1d5a98cca04bad889e37e9e9bf91ade33b5fb refers to a dead (removed) revision in file `lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/web/QaExportPortfolioStarterAction.java'. Fisheye: No comparison available. Pass `N' to diff? Index: lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/web/QaLearningStarterAction.java =================================================================== diff -u -rf2b7c28c53bfee9c676b5a836e42b71e0e1bf20f -r9df1d5a98cca04bad889e37e9e9bf91ade33b5fb --- lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/web/QaLearningStarterAction.java (.../QaLearningStarterAction.java) (revision f2b7c28c53bfee9c676b5a836e42b71e0e1bf20f) +++ lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/web/QaLearningStarterAction.java (.../QaLearningStarterAction.java) (revision 9df1d5a98cca04bad889e37e9e9bf91ade33b5fb) @@ -400,9 +400,7 @@ if (localToolSession.equals(incomingToolSessionId.toString())) { logger.debug("the learner has already responsed to this content, just generate a read-only report."); - LearningUtil learningUtil= new LearningUtil(); - learningUtil.buidLearnerReport(request,1, qaService); - logger.debug("buidLearnerReport called successfully, forwarding to: " + LEARNER_REPORT); + return (mapping.findForward(LEARNER_REPORT)); } } Index: lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/web/QaMonitoringAction.java =================================================================== diff -u -r4beb496ffd830646c5752e770f04ca60e56ef231 -r9df1d5a98cca04bad889e37e9e9bf91ade33b5fb --- lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/web/QaMonitoringAction.java (.../QaMonitoringAction.java) (revision 4beb496ffd830646c5752e770f04ca60e56ef231) +++ lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/web/QaMonitoringAction.java (.../QaMonitoringAction.java) (revision 9df1d5a98cca04bad889e37e9e9bf91ade33b5fb) @@ -1,24 +1,24 @@ -/* - *Copyright (C) 2005 LAMS Foundation (http://lamsfoundation.org) - * - *This program is free software; you can redistribute it and/or modify - *it under the terms of the GNU General Public License as published by - *the Free Software Foundation; either version 2 of the License, or - *(at your option) any later version. - * - *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 - */ - +/*************************************************************************** + * Copyright (C) 2005 LAMS Foundation (http://lamsfoundation.org) + * ============================================================= + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * 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 + * ***********************************************************************/ /** * @author Ozgur Demirtas */ @@ -321,6 +321,18 @@ } + public ActionForward doneMonitoring(ActionMapping mapping, + ActionForm form, + HttpServletRequest request, + HttpServletResponse response) throws IOException, + ServletException + { + //McUtils.cleanUpSessionAbsolute(request); + /*forward outside of the app. Currently it is index.jsp */ + return (mapping.findForward(LOAD_STARTER)); + } + + /** * persists error messages to request scope * persistError(HttpServletRequest request, String message) Index: lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/web/QaStarterAction.java =================================================================== diff -u -rf2b7c28c53bfee9c676b5a836e42b71e0e1bf20f -r9df1d5a98cca04bad889e37e9e9bf91ade33b5fb --- lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/web/QaStarterAction.java (.../QaStarterAction.java) (revision f2b7c28c53bfee9c676b5a836e42b71e0e1bf20f) +++ lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/web/QaStarterAction.java (.../QaStarterAction.java) (revision 9df1d5a98cca04bad889e37e9e9bf91ade33b5fb) @@ -141,8 +141,7 @@ qaAuthoringForm.resetRadioBoxes(); request.getSession().setAttribute(IS_DEFINE_LATER,"false"); - request.getSession().setAttribute(DISABLE_TOOL,""); - + IQaService qaService = QaServiceProxy.getQaService(getServlet().getServletContext()); logger.debug("retrieving qaService from session: " + qaService); @@ -211,41 +210,7 @@ } } - qaAuthoringForm.setToolContentId(contentID.toString()); - Boolean isMonitoringEditActivityVisited=(Boolean)request.getSession().getAttribute(MONITORING_EDITACTIVITY_VISITED); - logger.debug("isMonitoringEditActivityVisited: " + isMonitoringEditActivityVisited); - - Long monitoredContentId=(Long)request.getSession().getAttribute(MONITORED_CONTENT_ID); - logger.debug("MONITORED_CONTENT_ID: " + monitoredContentId); - - request.getSession().setAttribute(RENDER_MONITORING_EDITACTIVITY,new Boolean(false)); - - Boolean startMonitoringSummaryRequest=(Boolean)request.getAttribute(START_MONITORING_SUMMARY_REQUEST); - if ((startMonitoringSummaryRequest != null) && (startMonitoringSummaryRequest.booleanValue())) - { - logger.debug("will render Monitoring Edit Activity screen"); - if ((isMonitoringEditActivityVisited != null) && (isMonitoringEditActivityVisited.booleanValue())) - { - if (monitoredContentId != null) - { - /* request is from Edit Activity tab in monitoring */ - strToolContentId=monitoredContentId.toString(); - logger.debug("request is from Edit Activity tab in monitoring: " + monitoredContentId); - logger.debug("using MONITORED_CONTENT_ID: " + monitoredContentId); - request.getSession().setAttribute(RENDER_MONITORING_EDITACTIVITY,new Boolean(true)); - } - } - } - else - { - logger.debug("will render authoring screen"); - /* request is from authoring environment */ - request.setAttribute(START_MONITORING_SUMMARY_REQUEST, new Boolean(false)); - logger.debug("request is from authoring environment: "); - strToolContentId=request.getParameter(AttributeNames.PARAM_TOOL_CONTENT_ID); - } - logger.debug("usable strToolContentId: " + strToolContentId); /* * find out if the passed tool content id exists in the db @@ -297,14 +262,10 @@ ActionMessages errors= new ActionMessages(); errors.add(Globals.ERROR_KEY, new ActionMessage("error.content.inUse")); saveErrors(request,errors); - request.getSession().setAttribute(CONTENT_LOCKED, new Boolean(true)); logger.debug("forwarding to:" + LOAD); return (mapping.findForward(LOAD)); } - request.getSession().setAttribute(CONTENT_LOCKED, new Boolean(qaContent.isContentLocked())); - logger.debug("CONTENT_LOCKED: " + request.getSession().getAttribute(CONTENT_LOCKED)); - QaUtils.setDefaultSessionAttributes(request, qaContent, qaAuthoringForm); QaUtils.populateUploadedFilesData(request, qaContent, qaService); request.getSession().setAttribute(IS_DEFINE_LATER, new Boolean(qaContent.isDefineLater())); @@ -462,7 +423,6 @@ /* * load questions page */ - logger.debug("START_MONITORING_SUMMARY_REQUEST: " + request.getAttribute(START_MONITORING_SUMMARY_REQUEST)); logger.debug("RENDER_MONITORING_EDITACTIVITY: " + request.getAttribute(RENDER_MONITORING_EDITACTIVITY)); qaAuthoringForm.resetUserAction(); return (mapping.findForward(LOAD_QUESTIONS)); @@ -503,7 +463,6 @@ public ActionForward startMonitoringSummary(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException, QaApplicationException { - request.setAttribute(START_MONITORING_SUMMARY_REQUEST, new Boolean(true)); return execute(mapping, form, request, response); } Index: lams_tool_laqa/web/WEB-INF/struts-config.xml =================================================================== diff -u -rbb041188ecb180ae9cd8e01428c8f431aa89bd93 -r9df1d5a98cca04bad889e37e9e9bf91ade33b5fb --- lams_tool_laqa/web/WEB-INF/struts-config.xml (.../struts-config.xml) (revision bb041188ecb180ae9cd8e01428c8f431aa89bd93) +++ lams_tool_laqa/web/WEB-INF/struts-config.xml (.../struts-config.xml) (revision 9df1d5a98cca04bad889e37e9e9bf91ade33b5fb) @@ -188,6 +188,12 @@ path="/monitoring/MonitoringMaincontent.jsp" redirect="true" /> + + - - - - - Index: lams_tool_laqa/web/authoring/BasicContent.jsp =================================================================== diff -u -rf2b7c28c53bfee9c676b5a836e42b71e0e1bf20f -r9df1d5a98cca04bad889e37e9e9bf91ade33b5fb --- lams_tool_laqa/web/authoring/BasicContent.jsp (.../BasicContent.jsp) (revision f2b7c28c53bfee9c676b5a836e42b71e0e1bf20f) +++ lams_tool_laqa/web/authoring/BasicContent.jsp (.../BasicContent.jsp) (revision 9df1d5a98cca04bad889e37e9e9bf91ade33b5fb) @@ -29,8 +29,6 @@
- - @@ -146,73 +144,6 @@
-
-
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
: - -
: - -
- : - -
: -   -
- -
- - - - -
- - - -
- -
-
-