Index: lams_monitoring/src/java/org/lamsfoundation/lams/monitoring/web/MonitoringAction.java =================================================================== RCS file: /usr/local/cvsroot/lams_monitoring/src/java/org/lamsfoundation/lams/monitoring/web/MonitoringAction.java,v diff -u -r1.17 -r1.18 --- lams_monitoring/src/java/org/lamsfoundation/lams/monitoring/web/MonitoringAction.java 1 Feb 2006 04:43:02 -0000 1.17 +++ lams_monitoring/src/java/org/lamsfoundation/lams/monitoring/web/MonitoringAction.java 8 Feb 2006 22:58:50 -0000 1.18 @@ -125,6 +125,27 @@ throw new IOException("Unable to get user. User in session manager is "+user); } + + /** + * @param wddxPacket + * @return + */ + private String extractURL(String wddxPacket) { + String url = null; + String previousString = ""; + int index = wddxPacket.indexOf(previousString); + if ( index > -1 && index+previousString.length() < wddxPacket.length() ) { + url = wddxPacket.substring(index+previousString.length()); + index = url.indexOf(""); + url = url.substring(0,index); + } + // replace any & with & + url = url.replace("&","&"); + url = WebUtil.convertToFullURL(url); + + return url; + } + //--------------------------------------------------------------------- // Struts Dispatch Method @@ -568,15 +589,21 @@ String wddxPacket = monitoringService.getAllContributeActivities(lessonID); return outputPacket(mapping, request, response, wddxPacket, "details"); } + public ActionForward getLearnerActivityURL(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response)throws IOException,LamsToolServiceException{ this.monitoringService = MonitoringServiceProxy.getMonitoringService(getServlet().getServletContext()); Integer userID = new Integer(WebUtil.readIntParam(request,"userID")); Long activityID = new Long(WebUtil.readLongParam(request,"activityID")); + //Show learner in monitor in a single call: extract URL and redirect it rather than returning the WDDX packet + String wddxPacket = monitoringService.getLearnerActivityURL(activityID,userID); - return outputPacket(mapping, request, response, wddxPacket, "details"); + String url = extractURL(wddxPacket); + response.sendRedirect(response.encodeRedirectURL(url)); + + return null; } public ActionForward getActivityContributionURL(ActionMapping mapping, ActionForm form,