Index: lams_monitoring/src/java/org/lamsfoundation/lams/monitoring/web/MonitoringAction.java =================================================================== diff -u -ra09db88ffc7dee8fb92f83481015b0bc06270c19 -r9aabce20ab39a7639b3ab35a2a9e4dc20cbf4ac3 --- lams_monitoring/src/java/org/lamsfoundation/lams/monitoring/web/MonitoringAction.java (.../MonitoringAction.java) (revision a09db88ffc7dee8fb92f83481015b0bc06270c19) +++ lams_monitoring/src/java/org/lamsfoundation/lams/monitoring/web/MonitoringAction.java (.../MonitoringAction.java) (revision 9aabce20ab39a7639b3ab35a2a9e4dc20cbf4ac3) @@ -40,7 +40,6 @@ import java.util.Map; import java.util.Map.Entry; import java.util.Set; -import java.util.TreeMap; import java.util.TreeSet; import javax.servlet.ServletException; @@ -100,8 +99,8 @@ /** *

- * The action servlet that provide all the monitoring functionalities. It interact with the teacher via JSP - * monitoring interface. + * The action servlet that provide all the monitoring functionalities. It interact with the teacher via JSP monitoring + * interface. *

* * @author Jacky Fang @@ -758,19 +757,9 @@ return null; } - boolean flaFormat = WebUtil.readBooleanParam(request, "flaFormat", true); Set activities = new TreeSet(); activities.add(activityId); - // for the Flash format of LD SVGs, children activities are hidden - // and the parent activity shows all learners - if (!flaFormat && (activity.isBranchingActivity() || activity.isOptionsWithSequencesActivity())) { - Set descendants = getDescendants((ComplexActivity) activity); - for (Activity descendat : descendants) { - activities.add(descendat.getActivityId()); - } - } - List learners = getMonitoringService().getLearnersByActivities(activities.toArray(new Long[] {}), MonitoringAction.USER_PAGE_SIZE, (pageNumber - 1) * MonitoringAction.USER_PAGE_SIZE, orderAscending); @@ -1052,74 +1041,25 @@ response.sendError(HttpServletResponse.SC_FORBIDDEN, "User is not a monitor in the lesson"); return null; } - Long branchingActivityId = WebUtil.readLongParam(request, "branchingActivityID", true); Integer searchedLearnerId = WebUtil.readIntParam(request, "searchedLearnerId", true); Lesson lesson = getLessonService().getLesson(lessonId); LearningDesign learningDesign = lesson.getLearningDesign(); String contentFolderId = learningDesign.getContentFolderID(); - // find out if the LD SVG is in new Flashless (exploded) format - JSONObject responseJSON = new JSONObject(); - boolean flaFormat = false; - for (Activity activity : (Set) learningDesign.getActivities()) { - if ((activity.isBranchingActivity() || activity.isOptionsWithSequencesActivity()) - && (((ComplexActivity) activity).getXcoord() == null)) { - // if a single activity is in FLA format, all of them are - flaFormat = true; - break; - } - } - responseJSON.put("flaFormat", flaFormat); - Set activities = new HashSet(); - List contributeActivities = getContributeActivities(lessonId, true); - Map> parentToChildren = new TreeMap>(); // filter activities that are interesting for further processing for (Activity activity : (Set) learningDesign.getActivities()) { if (activity.isSequenceActivity()) { // skip sequence activities as they are just for grouping continue; } - - if (flaFormat) { - // in FLA format everything is exploded so there are no hidden child activities - activities.add(activity); - continue; - } - - Activity parentActivity = activity.getParentActivity(); - Activity parentParentActivity = parentActivity == null ? null : parentActivity.getParentActivity(); - if (parentParentActivity == null) { - activities.add(activity); - continue; - } - - if (!parentParentActivity.isOptionsWithSequencesActivity() && (!parentParentActivity.isBranchingActivity() - || parentParentActivity.getActivityId().equals(branchingActivityId))) { - activities.add(activity); - } else { - // branching and options with sequences in Flash format have hidden activities - // map the children to their parent for further processing - Set children = parentToChildren.get(parentParentActivity.getActivityId()); - if (children == null) { - children = new HashSet(); - parentToChildren.put(parentParentActivity.getActivityId(), children); - } - children.add(activity); - - // skip hidden contribute activities - if (contributeActivities != null) { - Iterator contributeActivityIterator = contributeActivities.iterator(); - while (contributeActivityIterator.hasNext()) { - if (activity.getActivityId().equals(contributeActivityIterator.next().getActivityID())) { - contributeActivityIterator.remove(); - } - } - } - } + activities.add(activity); + continue; } + JSONObject responseJSON = new JSONObject(); + List contributeActivities = getContributeActivities(lessonId, true); if (contributeActivities != null) { Gson gson = new GsonBuilder().create(); responseJSON.put("contributeActivities", new JSONArray(gson.toJson(contributeActivities))); @@ -1186,15 +1126,7 @@ // find few latest users and count of all users for each activity int learnerCount = learnerCounts.get(activityId); - if (activity.isBranchingActivity() || activity.isOptionsWithSequencesActivity()) { - // go through hidden children of complex activities and take them into account - Set children = parentToChildren.get(activityId); - if (children != null) { - for (Activity child : children) { - learnerCount += learnerCounts.get(child.getActivityId()); - } - } - } else { + if (!activity.isBranchingActivity() && !activity.isOptionsWithSequencesActivity()) { List latestLearners = getMonitoringService().getLearnersLatestByActivity(activity.getActivityId(), MonitoringAction.LATEST_LEARNER_PROGRESS_ACTIVITY_DISPLAY_LIMIT, null); @@ -1590,23 +1522,6 @@ } /** - * Gets all children and their childre etc. of the given complex activity. - */ - @SuppressWarnings("unchecked") - private Set getDescendants(ComplexActivity complexActivity) { - Set result = new HashSet(); - for (Activity child : (Set) complexActivity.getActivities()) { - child = getMonitoringService().getActivityById(child.getActivityId()); - if (child.isComplexActivity()) { - result.addAll(getDescendants((ComplexActivity) child)); - } else { - result.add(child); - } - } - return result; - } - - /** * Puts the searched learner in front of other learners in the list. */ private static List insertSearchedLearner(User searchedLearner, List latestLearners, int limit) { Index: lams_monitoring/web/css/monitorLesson.css =================================================================== diff -u -r03b0e2bc93bc7cd09dca055ec8f00ff24ec8f867 -r9aabce20ab39a7639b3ab35a2a9e4dc20cbf4ac3 --- lams_monitoring/web/css/monitorLesson.css (.../monitorLesson.css) (revision 03b0e2bc93bc7cd09dca055ec8f00ff24ec8f867) +++ lams_monitoring/web/css/monitorLesson.css (.../monitorLesson.css) (revision 9aabce20ab39a7639b3ab35a2a9e4dc20cbf4ac3) @@ -229,12 +229,6 @@ overflow: hidden; } -#closeBranchingButton { - font-weight: bold; - margin-right: 40px; - display: none; -} - img#sequenceCanvasLoading { padding: 5px 0 0 100px; display: none; Index: lams_monitoring/web/includes/javascript/monitorLesson.js =================================================================== diff -u -rce468d42d82aebffd852640018c2e80e8b42a914 -r9aabce20ab39a7639b3ab35a2a9e4dc20cbf4ac3 --- lams_monitoring/web/includes/javascript/monitorLesson.js (.../monitorLesson.js) (revision ce468d42d82aebffd852640018c2e80e8b42a914) +++ lams_monitoring/web/includes/javascript/monitorLesson.js (.../monitorLesson.js) (revision 9aabce20ab39a7639b3ab35a2a9e4dc20cbf4ac3) @@ -1,10 +1,7 @@ // ********** GLOBAL VARIABLES ********** -// copy of lesson/branching SVG so it does no need to be fetched every time -// HTML with SVG of the lesson +// copy of lesson SVG so it does no need to be fetched every time var originalSequenceCanvas = null, -// is the LD SVG in Flashless format or the old, Flash format - flaFormat = false, -// DIV container for lesson/branching SVG +// DIV container for lesson SVG // it gets accessed so many times it's worth to cache it here sequenceCanvas = $('#sequenceCanvas'), // info box show timeout @@ -33,12 +30,8 @@ // double tap support tapTimeout = 500, lastTapTime = 0, - lastTapTarget = null, + lastTapTarget = null; -// after first entering of branching in old SVGs layout gets a bit broken -// setting this property fixes it - branchingEntered = false; - // ********* GENERAL TABS FUNCTIONS ********* function initTabs(){ @@ -787,10 +780,7 @@ }, success : function(response) { if (sequenceCanvasFirstFetch) { - // once Flashless SVG format is detected, it applies for all activities - flaFormat = response.flaFormat; - - // FLA activities have uiids but no ids, set it here + // activities have uiids but no ids, set it here $.each(response.activities, function(activityIndex, activity){ $('g[uiid="' + activity.uiid + '"]', sequenceCanvas).attr('id', activity.id); }); @@ -853,7 +843,7 @@ $.each(response.activities, function(activityIndex, activity){ addActivityIconsHandlers(activity); - if (activity.url || (isBranching && !flaFormat)) { + if (activity.url) { var activityGroup = $('g[id="' + activity.id + '"]'); activityGroup.css('cursor', 'pointer'); dblTap(activityGroup, function(){ @@ -921,8 +911,7 @@ var foundActivities = [], targetActivity = null; // check all activities and "users who finished lesson" bar - // rootElement is only in Flash LDs - $('g[id]:not([id*="_to_"]):not(#rootElement)', sequenceCanvas).add('#completedLearnersContainer').each(function(){ + $('g[id]:not([id*="_to_"])', sequenceCanvas).add('#completedLearnersContainer').each(function(){ // find which activity learner was dropped on var act = $(this), coord = { @@ -1065,15 +1054,15 @@ // add group of users icon var appendTarget = $('svg', sequenceCanvas)[0], // branching and gates require extra adjustments - isNewBranching = [10,11,12,13].indexOf(activity.type) > -1 && flaFormat, + isBranching = [10,11,12,13].indexOf(activity.type) > -1, isGate = [3,4,5,14].indexOf(activity.type) > -1; if (activity.learnerCount > 0){ var groupTitle = activity.learnerCount + ' ' + LABELS.LEARNER_GROUP_COUNT + ' ' + LABELS.LEARNER_GROUP_SHOW, element = appendXMLElement('image', { 'id' : 'act' + activity.id + 'learnerGroup', - 'x' : isNewBranching ? coord.x + 2 : (isGate ? coord.x + 10 : coord.x2 - 18), - 'y' : isNewBranching ? coord.y - 12 : coord.y + 1, + 'x' : isBranching ? coord.x + 2 : (isGate ? coord.x + 10 : coord.x2 - 18), + 'y' : isBranching ? coord.y - 12 : coord.y + 1, 'height' : 16, 'width' : 16, 'xlink:href' : LAMS_URL + 'images/icons/group.png', @@ -1083,43 +1072,21 @@ // add a small number telling how many learners are in the group element = appendXMLElement('text', { 'id' : 'act' + activity.id + 'learnerGroupText', - 'x' : isNewBranching ? coord.x + 9 : (isGate ? coord.x + 17 : coord.x2 - 9), - 'y' : isNewBranching ? coord.y + 12 : coord.y + 25, + 'x' : isBranching ? coord.x + 9 : (isGate ? coord.x + 17 : coord.x2 - 9), + 'y' : isBranching ? coord.y + 12 : coord.y + 25, 'text-anchor': 'middle', 'font-family': 'Verdana', 'font-size' : 8, 'style' : 'cursor : pointer' }, activity.learnerCount, appendTarget); appendXMLElement('title', null, groupTitle, element); - - if (activity.learners) { - // draw single icons for the first few learners; - // don't do it for gate and optional activities, and new branching/optional sequences format - if ([3,4,5,7,13,14].indexOf(activity.type) == -1 && !flaFormat) { - $.each(activity.learners, function(learnerIndex, learner){ - var learnerDisplayName = getLearnerDisplayName(learner); - element = appendXMLElement('image', { - 'id' : 'act' + activity.id + 'learner' + learner.id, - 'x' : coord.x + learnerIndex*15 + 1, - // a bit lower for Optional Activity - 'y' : coord.y, - 'height' : 16, - 'width' : 16, - 'xlink:href' : LAMS_URL + 'images/icons/' - + (learner.id == sequenceSearchedLearner ? 'user_red.png' : 'user.png'), - 'style' : 'cursor : pointer' - }, null, appendTarget); - appendXMLElement('title', null, learnerDisplayName, element); - }); - } - } } if (activity.requiresAttention) { var element = appendXMLElement('image', { 'id' : 'act' + activity.id + 'attention', - 'x' : isNewBranching ? coord.x + 14 : coord.x2 - 19, - 'y' : isNewBranching ? coord.y + 6 : coord.y2 - 19, + 'x' : isBranching ? coord.x + 14 : coord.x2 - 19, + 'y' : isBranching ? coord.y + 6 : coord.y2 - 19, 'height' : 16, 'width' : 16, 'xlink:href' : LAMS_URL + 'images/icons/exclamation.png', @@ -1194,8 +1161,7 @@ url : LAMS_URL + 'monitoring/monitoring.do', data : { 'method' : 'getCurrentLearners', - 'activityID' : activity.id, - 'flaFormat' : flaFormat + 'activityID' : activity.id } }; showLearnerGroupDialog(ajaxProperties, activity.title, false, true, usersViewable, false); @@ -1302,8 +1268,8 @@ } } - // special processing for new format of branching and optional sequences - if ([10,11,12,13].indexOf(activity.type) > -1 && flaFormat) { + // special processing for branching and optional sequences + if ([10,11,12,13].indexOf(activity.type) > -1) { return { 'x' : activity.x, 'y' : activity.y @@ -1314,28 +1280,16 @@ if (group.length == 0) { return; } - var elem = $('rect, path', group), - // if it's a rectangle, it has these attributes; rectangles are in old SVGs - width = elem.attr('width'), - height = elem.attr('height'); - if (width) { + var path = $('path', group).attr('d'), + // extract width and height from path M,hv... or M h v ... + match = /h\s?(\d+)\s?v\s?(\d+)/.exec(path); + if (match) { return { 'x' : activity.x, - 'y' : activity.y, - 'x2' : activity.x + +width, - 'y2' : activity.y + +height + 'y' : activity.y + 1, + 'x2' : activity.x + +match[1], + 'y2' : activity.y + +match[2] } - } else { - // extract width and height from path M,hv... or M h v ... - var match = /h\s?(\d+)\s?v\s?(\d+)/.exec(elem.attr('d')); - if (match) { - return { - 'x' : activity.x, - 'y' : activity.y + 1, - 'x2' : activity.x + +match[1], - 'y2' : activity.y + +match[2] - } - } } } @@ -1560,8 +1514,6 @@ sequenceCanvas.css({ 'padding-top' : canvasPaddingTop, - // after first entering of Branching in old SVGs we need this adjustment - 'padding-bottom' : branchingEntered ? 20 : 0, 'padding-left' : canvasPaddingLeft, 'width' : canvasWidth - canvasPaddingLeft, 'height' : canvasHeight - canvasPaddingTop