Index: lams_central/web/includes/javascript/groupDisplay.js
===================================================================
RCS file: /usr/local/cvsroot/lams_central/web/includes/javascript/groupDisplay.js,v
diff -u -r1.37 -r1.37.2.1
--- lams_central/web/includes/javascript/groupDisplay.js 13 Jan 2014 10:58:17 -0000 1.37
+++ lams_central/web/includes/javascript/groupDisplay.js 28 Apr 2015 09:48:55 -0000 1.37.2.1
@@ -151,36 +151,60 @@
function showMonitorLessonDialog(lessonID) {
- var dialog = $('#dialogContainer').dialog({
+ var dialogName = "dialogMonitorLesson" + lessonID,
+ dialog = $('#' + dialogName);
+ if (dialog.length > 0) {
+ // is it open already?
+ dialog.dialog('moveToTop');
+ return;
+ }
+
+ // create a new dialog by cloning a template
+ dialog = $('#dialogContainer').clone();
+ dialog.attr('id', dialogName);
+ $('iframe', dialog).attr('id', null);
+
+ dialog.dialog({
'lessonID' : lessonID,
'autoOpen' : false,
'height' : 600,
'width' : 1024,
- 'modal' : true,
- 'resizable' : false,
+ 'modal' : false,
+ 'draggable' : false,
+ 'resizable' : true,
'hide' : 'fold',
'open' : function() {
// load contents after opening the dialog
- $('#dialogFrame').attr('src', LAMS_URL
+ $('iframe', this).attr('src', LAMS_URL
+ 'home.do?method=monitorLesson&lessonID='
+ $(this).dialog('option', 'lessonID'));
},
'beforeClose' : function(){
- $('#dialogFrame').attr('src', null);
+ $('iframe', this).attr('src', null);
},
'close' : function() {
- // refresh if lesson was added
- if ($(this).dialog('option', 'refresh')) {
- loadOrgTab(null, true);
- }
- $(this).dialog('destroy');
+ // completely delete the dialog
+ $(this).remove();
}
});
+ // tell the dialog contents that it was resized
+ dialog.closest('.ui-dialog').on('resizestop', function(event, ui){
+ var frame = $('iframe', dialog)[0],
+ win = frame.contentWindow || frame.contentDocument;
+ win.resizeSequenceCanvas(ui.size.width, ui.size.height);
+ });
// tabs are the title bar, so remove dialog's one
dialog.closest('.ui-dialog').children('.ui-dialog-titlebar').remove();
dialog.dialog('open');
}
+
+function moveDialogToTop(dialogName) {
+ // called from withing dialog's iframe
+ $('#' + dialogName).dialog('moveToTop');
+}
+
+
function showAddLessonDialog(orgID) {
var dialog = $('#dialogContainer').dialog({
'orgID' : orgID,
@@ -483,10 +507,10 @@
dialog.dialog('option', 'refresh', save).dialog('close');
}
-function closeMonitorLessonDialog(refresh) {
- // was the dialog just closed or a new lesson really added?
+function closeMonitorLessonDialog(dialogName, refresh) {
+ // was the dialog just closed or
// if latter, refresh the list
- $("#dialogContainer").dialog('option', 'refresh', refresh ? true : false)
+ $("#" + dialogName).dialog('option', 'refresh', refresh ? true : false)
.dialog('close');
}
@@ -531,7 +555,7 @@
data : "method=removeLesson&lessonID=" + lessonID,
type : "post",
success : function(json) {
- if (json.removeLesson == "true") {
+ if (json.removeLesson == true) {
loadOrgTab(null, true);
} else {
alert(json.removeLesson);
Index: lams_monitoring/web/monitor.jsp
===================================================================
RCS file: /usr/local/cvsroot/lams_monitoring/web/monitor.jsp,v
diff -u -r1.27.2.6 -r1.27.2.7
--- lams_monitoring/web/monitor.jsp 10 Apr 2015 16:37:39 -0000 1.27.2.6
+++ lams_monitoring/web/monitor.jsp 28 Apr 2015 09:48:56 -0000 1.27.2.7
@@ -173,7 +173,7 @@
-
+
Index: lams_monitoring/web/css/monitorLesson.css
===================================================================
RCS file: /usr/local/cvsroot/lams_monitoring/web/css/monitorLesson.css,v
diff -u -r1.15 -r1.15.2.1
--- lams_monitoring/web/css/monitorLesson.css 28 Apr 2014 12:05:55 -0000 1.15
+++ lams_monitoring/web/css/monitorLesson.css 28 Apr 2015 09:48:56 -0000 1.15.2.1
@@ -1,7 +1,6 @@
/********** GENERAL/DIALOG STYLES **********/
div#tabs {
width: 99%;
- height: 574px;
overflow: hidden;
border: none;
}
@@ -88,7 +87,7 @@
/********** LESSON TAB STYLES **********/
div#tabLesson {
- height: 540px;
+/* height: 540px;*/
overflow: auto;
}
@@ -179,7 +178,6 @@
/********** SEQUENCE TAB STYLES **********/
div#sequenceCanvas {
text-align: center;
- height: 478px;
width: 1024px;
overflow: auto;
}
@@ -243,7 +241,6 @@
}
div#tabLearnersContainer {
- height: 500px;
overflow: auto;
}
Index: lams_monitoring/web/includes/javascript/monitorLesson.js
===================================================================
RCS file: /usr/local/cvsroot/lams_monitoring/web/includes/javascript/monitorLesson.js,v
diff -u -r1.44.2.6 -r1.44.2.7
--- lams_monitoring/web/includes/javascript/monitorLesson.js 28 Jan 2015 13:47:33 -0000 1.44.2.6
+++ lams_monitoring/web/includes/javascript/monitorLesson.js 28 Apr 2015 09:48:56 -0000 1.44.2.7
@@ -55,6 +55,45 @@
sequenceInfoDialog.dialog('close');
}
}
+ }).draggable({
+ // scroll plugin has to be disabled here as it throws errors
+ // when dragging helper appended to parent document
+ 'scroll' : false,
+ 'handle' : $('#tabs>ul'),
+ 'helper' : function(){
+ // since this code is inside an iframe, the helper is
+ // a transparent div with black borders attached to parent document
+ var dialogName = "dialogMonitorLesson" + lessonId,
+ dialog = $('#' + dialogName, window.parent.document).closest('.ui-dialog'),
+ helper = dialog.clone().empty();
+ helper.css({
+ 'border': 'thin black solid',
+ 'width' : dialog.width(),
+ 'height' : dialog.height(),
+ 'background' : 'transparent'
+ });
+ return helper;
+ },
+ 'appendTo' : window.parent.document.body,
+ 'drag' : function(event, ui) {
+ // adjust position to be relative to parent document, not iframe contents
+ var dialogName = "dialogMonitorLesson" + lessonId,
+ dialog = $('#' + dialogName, window.parent.document).closest('.ui-dialog');
+ ui.position.top += dialog.position().top;
+ ui.position.left += dialog.position().left;
+ },
+ 'stop' : function(event, ui) {
+ var dialogName = "dialogMonitorLesson" + lessonId,
+ dialog = $('#' + dialogName, window.parent.document).closest('.ui-dialog');
+ dialog.offset({
+ 'top' : ui.offset.top,
+ 'left' : ui.offset.left
+ });
+ }
+ }).mousedown(function(){
+ // bring clicked Monitor window to front
+ var dialogName = "dialogMonitorLesson" + lessonId;
+ window.parent.moveDialogToTop(dialogName);
});
}
@@ -313,7 +352,7 @@
success : function() {
if (state == 7) {
// user chose to finish the lesson, close monitoring and refresh the lesson list
- window.parent.closeMonitorLessonDialog(true);
+ closeMonitorLessonDialog(true);
} else {
refreshMonitor('lesson');
}
@@ -746,18 +785,7 @@
// if it was faded out by showBranchingSequence()
.fadeIn();
- var canvasHeight = sequenceCanvas.height(),
- canvasWidth = Math.min('1010', sequenceCanvas.width()),
- svg = $('svg', sequenceCanvas),
- canvasPaddingTop = Math.max(0, canvasHeight/2 - svg.attr('height')/2),
- canvasPaddingLeft = Math.max(0, canvasWidth/2 - svg.attr('width')/2);
-
- sequenceCanvas.css({
- 'padding-top' : canvasPaddingTop,
- 'padding-left' : canvasPaddingLeft,
- 'width' : canvasWidth - canvasPaddingLeft,
- 'height' : canvasHeight - canvasPaddingTop
- });
+ resizeSequenceCanvas();
}
});
}
@@ -1398,7 +1426,7 @@
} else {
openPopUp(LAMS_URL + 'home.do?method=author&layout=editonfly&learningDesignID=' + ldId,
'LiveEdit', 600, 800, false);
- window.parent.closeMonitorLessonDialog();
+ closeMonitorLessonDialog();
}
}
});
@@ -1428,6 +1456,33 @@
$('#closeBranchingButton').hide();
}
+/**
+ * Adjusts sequence canvas (SVG) based on space available in the dialog.
+ */
+function resizeSequenceCanvas(width, height){
+ // Initial resize sends no parameters.
+ // When resizing the dialog, parameters are sent.
+ // Taking body's dimensions when resizing yields erroneous results.
+ width = width || $('body').width();
+ height = height || $('body').height();
+ var sequenceCanvas = $('#sequenceCanvas'),
+ // can it be done nicer?
+ canvasHeight = height - $('#tabs>ul').height() - $('#sequenceTopButtonsContainer').height()
+ - Math.min(20, $('#completedLearnersContainer').height()) - 45,
+ canvasWidth = width - 15,
+ svg = $('svg', sequenceCanvas),
+ // center a small SVG inside large DIV
+ canvasPaddingTop = Math.max(0, canvasHeight/2 - svg.attr('height')/2),
+ canvasPaddingLeft = Math.max(0, canvasWidth/2 - svg.attr('width')/2);
+
+ sequenceCanvas.css({
+ 'padding-top' : canvasPaddingTop,
+ 'padding-left' : canvasPaddingLeft,
+ 'width' : canvasWidth - canvasPaddingLeft,
+ 'height' : canvasHeight - canvasPaddingTop
+ });
+}
+
//********** LEARNERS TAB FUNCTIONS **********
/**
@@ -1692,6 +1747,14 @@
/**
+ * Tells parent document to close this Monitor dialog.
+ */
+function closeMonitorLessonDialog(refresh) {
+ var dialogName = "dialogMonitorLesson" + lessonId;
+ window.parent.closeMonitorLessonDialog(dialogName, refresh);
+}
+
+/**
* Show a dialog with user list and optional Force Complete and View Learner buttons.
*/
function showLearnerGroupDialog(activityId, dialogTitle, learners, allowForceComplete, allowView, allowEmail) {