Index: lams_monitoring/conf/language/lams/ApplicationResources.properties
===================================================================
RCS file: /usr/local/cvsroot/lams_monitoring/conf/language/lams/ApplicationResources.properties,v
diff -u -r1.41 -r1.42
--- lams_monitoring/conf/language/lams/ApplicationResources.properties 22 May 2013 11:39:42 -0000 1.41
+++ lams_monitoring/conf/language/lams/ApplicationResources.properties 23 May 2013 16:37:24 -0000 1.42
@@ -286,7 +286,10 @@
button.export.learner.tooltip =Export this learner portfolio and save it on your computer for future reference
button.timechart =View Time Chart
button.timechart.tooltip =View a chart of the selected learner progress against time for each activity
-lesson.learners.page =Page
-lesson.learners.order =Order by completion
+learners.page =Page
+learners.order =Order by completion
+learners.search.phrase =Enter search query
or page number
+learners.search.phrase.go.tooltip =Run search
+learners.search.phrase.clear.tooltip =Clear search results
#======= End labels: Exported 196 labels for en AU =====
Index: lams_monitoring/web/monitor.jsp
===================================================================
RCS file: /usr/local/cvsroot/lams_monitoring/web/monitor.jsp,v
diff -u -r1.9 -r1.10
--- lams_monitoring/web/monitor.jsp 22 May 2013 11:39:42 -0000 1.9
+++ lams_monitoring/web/monitor.jsp 23 May 2013 16:37:24 -0000 1.10
@@ -302,19 +302,31 @@
+
= actX && x<= actEndX && y>= actY && y<=actEndY) {
var previousActivityId = null;
var executeForceComplete = false;
@@ -602,8 +617,9 @@
// if move to start of sequence, the value is -1
previousActivityId = transitionLine.length == 1 ?
transitionLine.attr('id').split('_')[0] : -1;
-
- var targetActivityName = act.siblings('text[id^="TextElement"]').text();
+
+ var targetActivityName = act.is('polygon') ? "Gate"
+ : act.siblings('text[id^="TextElement"]').text();
executeForceComplete = confirm(FORCE_COMPLETE_ACTIVITY_CONFIRM_LABEL
.replace('[0]', learnerName).replace('[1]', targetActivityName));
}
@@ -644,16 +660,32 @@
* Draw user icons on top of activities.
*/
function addLearnerIcons(activity) {
- var activityRect = $('rect[id="act' + activity.id + '"]', sequenceCanvas);
- var activityGroup = activityRect.parent();
- var actX = +activityRect.attr('x') + 1;
- var actY = +activityRect.attr('y') + 1;
+ var isGate = false;
+ var actX = null
+ var actY = null;
+ var activityGroup = $('g#' + activity.id, sequenceCanvas);
+ var activityShape = $('rect[id="act' + activity.id + '"]', activityGroup);
+ if (activityShape.length == 0){
+ // is it Gate activity?
+ activityShape = $('polygon', activityGroup);
+ if (activityShape.length > 0){
+ isGate = true;
+ var polygonPoints = activityShape.attr('points').split(' ');
+ var polygonStartPoints = polygonPoints[4].split(',');
+ actX = +polygonStartPoints[0];
+ actY = +polygonStartPoints[1] - 10;
+ }
+ } else {
+ actX = +activityShape.attr('x') + 1;
+ actY = +activityShape.attr('y') + 1;
+ }
+
var actTooltip = LEARNER_GROUP_LIST_TITLE_LABEL;
$.each(activity.learners, function(learnerIndex, learner){
- if (activity.learners.length > 8 && learnerIndex == 7) {
+ if (isGate || (activity.learners.length > 8 && learnerIndex == 7)) {
// maximum 8 icons fit in an activity
- var actRightBorder = actX + +activityRect.attr('width');
+ var actRightBorder = actX + (isGate? 40 : +activityShape.attr('width'));
var groupTitle = activity.learners.length + ' ' + LEARNER_GROUP_COUNT_LABEL
+ ' ' + LEARNER_GROUP_SHOW_LABEL;
// if icons do not fit in shape anymore, show a group icon
@@ -703,16 +735,15 @@
*/
function addLearnerIconsHandlers(activity) {
if (activity.learners) {
- var activityGroup = $('rect[id="act' + activity.id + '"]', sequenceCanvas).parent();
+ var activityGroup = $('g#' + activity.id, sequenceCanvas);
+ // gate activity does not allows users' view
+ var usersViewable = $('polygon', activityGroup).length == 0;
- $.each(activity.learners, function(learnerIndex, learner){
- $('image[id="act' + activity.id + 'learner' + learner.id + '"]', activityGroup)
- .dblclick(function(event){
- // double click on learner icon to see activity from his perspective
- event.stopPropagation();
- openPopUp(LAMS_URL + learner.url, "LearnActivity", 600, 800, true);
- }).css('cursor', 'pointer')
- // drag learners to force complete activities
+ $.each(activity.learners, function(learnerIndex, learner){
+ var learnerIcon = $('image[id="act' + activity.id + 'learner' + learner.id + '"]'
+ ,activityGroup);
+ learnerIcon .css('cursor', 'pointer')
+ // drag learners to force complete activities
.draggable({
'appendTo' : '#tabSequence',
'containment' : '#tabSequence',
@@ -729,16 +760,25 @@
ui.offset.left, ui.offset.top);
}
});
+
+ if (usersViewable) {
+ learnerIcon.dblclick(function(event){
+ // double click on learner icon to see activity from his perspective
+ event.stopPropagation();
+ openPopUp(LAMS_URL + learner.url, "LearnActivity", 600, 800, true);
+ });
+ }
});
-
+
+
var learnerGroupIcon = $('*[id^="act' + activity.id + 'learnerGroup"]', activityGroup);
// 0 is for no group icon, 2 is for icon + digits
if (learnerGroupIcon.length == 2) {
var activityName = $('text[id^="TextElement"]', activityGroup).text();
learnerGroupIcon.dblclick(function(event){
// double click on learner icon to see activity from his perspective
event.stopPropagation();
- showLearnerGroupDialog(activity.id, activityName, activity.learners);
+ showLearnerGroupDialog(activity.id, activityName, activity.learners, true, usersViewable);
})
}
}
@@ -951,7 +991,8 @@
*/
function updateLearnerProgressHeader(pageNumber) {
var controlRow = $('#tabLearnerControlTable tr');
- if (numberActiveLearners < 10) {
+ if (numberActiveLearners < 10
+ && (!learnersSearchPhrase || learnersSearchPhrase == '')) {
// do not show the bar at all
$('.learnersHeaderCell', controlRow).hide();
return;
@@ -967,7 +1008,7 @@
}
learnerProgressCurrentPageNumber = pageNumber;
// update "Page X / Y" field
- $('#learnersPageCounter').text(pageNumber + ' / ' + pageCount);
+ $('#learnersPageCounter').html(pageNumber + ' / ' + pageCount + ' ');
// remove arrows for shifting page numbers, if they are not needed
if (pageCount < 10) {
@@ -1023,7 +1064,7 @@
data : {
'method' : 'getLearnerProgressPageJSON',
'lessonID' : lessonId,
- 'searchPhrase' : null,
+ 'searchPhrase' : learnersSearchPhrase,
'pageNumber' : pageNumber,
'isProgressSorted' : isProgressSorted
@@ -1064,6 +1105,7 @@
* Refreshes the existing progress bars.
*/
function updateLearnersTab(){
+ // prevent double refresh
if (learnersRefreshInProgress) {
return;
}
@@ -1075,6 +1117,40 @@
learnersRefreshInProgress = false;
}
+
+/**
+ * Run search for the phrase which user provided in text field.
+ */
+function learnersRunSearchPhrase(){
+ var searchPhraseField = $('#learnersSearchPhrase');
+ learnersSearchPhrase = searchPhraseField.val();
+ if (learnersSearchPhrase && learnersSearchPhrase.trim() != '') {
+ var pageNumber = parseInt(learnersSearchPhrase);
+ // must be a positive integer
+ if (isNaN(pageNumber) || !isFinite(pageNumber) || pageNumber < 0){
+ // if it was not a number, run a normal search
+ loadLearnerProgressPage(1);
+ } else {
+ // it was a number, reset the field and go to the given page
+ learnersSearchPhrase = null;
+ searchPhraseField.val(null);
+ loadLearnerProgressPage(pageNumber);
+ }
+ } else {
+ learnersSearchPhrase = null;
+ }
+}
+
+
+/**
+ * Clears previous run search for phrase.
+ */
+function learnersClearSearchPhrase(){
+ learnersSearchPhrase = null;
+ $('#learnersSearchPhrase').val(null);
+ loadLearnerProgressPage(1);
+}
+
//********** COMMON FUNCTIONS **********
/**
@@ -1103,7 +1179,7 @@
/**
* Show a dialog with user list and optional Force Complete and View Learner buttons.
*/
-function showLearnerGroupDialog(activityId, dialogTitle, learners) {
+function showLearnerGroupDialog(activityId, dialogTitle, learners, allowForceComplete, allowView) {
var learnerGroupList = $('#learnerGroupList').empty();
var learnerGroupDialog = $('#learnerGroupDialog');
$.each(learners, function(learnerIndex, learner) {
@@ -1115,26 +1191,31 @@
.text(getLearnerDisplayName(learner))
.appendTo(learnerGroupList);
- if (activityId) {
+ if (allowForceComplete || allowView) {
learnerDiv.click(function(){
// select a learner
$(this).addClass('dialogListItemSelected')
.siblings('div.dialogListItem')
.removeClass('dialogListItemSelected');
- // enable buttons
- $('button.learnerGroupDialogSelectableButton')
- .attr('disabled', null);
- })
- .dblclick(function(){
- // same as clicking View Learner button
- openPopUp(LAMS_URL + learner.url, "LearnActivity", 600, 800, true);
+ // enable buttons
+ $('button.learnerGroupDialogSelectableButton')
+ .attr('disabled', null);
});
+ if (allowView){
+ learnerDiv.dblclick(function(){
+ // same as clicking View Learner button
+ openPopUp(LAMS_URL + learner.url, "LearnActivity", 600, 800, true);
+ });
+ }
}
});
- // no activity ID, i.e. showing finshed learners, so no buttons
- $('button.learnerGroupDialogSelectableButton').css('display', activityId ? 'inline' : 'none');
-
+ // show buttons depending on parameters
+ $('button#learnerGroupDialogForceCompleteButton')
+ .css('display', allowForceComplete ? 'inline' : 'none');
+ $('button#learnerGroupDialogViewButton')
+ .css('display', allowView ? 'inline' : 'none');
+
learnerGroupDialog
.dialog('option',
{
|