Index: lams_central/web/includes/javascript/main.js =================================================================== RCS file: /usr/local/cvsroot/lams_central/web/includes/javascript/Attic/main.js,v diff -u -r1.1.2.9 -r1.1.2.10 --- lams_central/web/includes/javascript/main.js 3 Nov 2016 16:04:03 -0000 1.1.2.9 +++ lams_central/web/includes/javascript/main.js 5 Nov 2016 10:23:47 -0000 1.1.2.10 @@ -192,13 +192,12 @@ showDialog("dialogMyProfile", { 'title' : LABELS.MY_PROFILE, 'modal' : true, - 'width' : 'auto', + 'width' : Math.max(380, Math.min(770, $(window).width() - 60)), 'height' : 430, 'open' : function() { var dialog = $(this); // load contents after opening the dialog $('iframe', dialog).attr('src', LAMS_URL + 'index.do?method=profile'); - $(this).css("maxWidth", "770px").css("margin", "auto"); // in case of mobile devices allow iframe scrolling if( /Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent) ) { @@ -294,8 +293,8 @@ 'lessonID' : lessonID }, 'autoOpen' : false, - 'height' : 600, - 'width' : 1024, + 'height': Math.max(380, Math.min(600, $(window).height() - 60)), + 'width' : Math.max(380, Math.min(1024, $(window).width() - 60)), 'title' : LABELS.MONITORING_TITLE, 'open' : function() { // load contents after opening the dialog @@ -335,8 +334,8 @@ 'orgID' : orgID }, 'modal' : false, - 'height' : 740, - 'width' : 'auto', + 'height': Math.max(380, Math.min(740, $(window).height() - 60)), + 'width' : Math.max(380, Math.min(850, $(window).width() - 60)), 'title' : LABELS.ADD_LESSON_TITLE, 'open' : function() { var dialog = $(this); @@ -345,7 +344,6 @@ .attr('src', LAMS_URL + 'home.do?method=addLesson&organisationID=' + dialog.data('orgID')); - $(this).css("maxWidth", "850px").css("margin", "auto"); // in case of mobile devices allow iframe scrolling if( /Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent) ) { @@ -395,13 +393,12 @@ 'learningLibraryID' : learningLibraryID }, 'modal' : false, - 'height' : 600, - 'width' : 'auto', + 'height' : Math.max(400, $(window).height() - 60), + 'width' : Math.max(380, Math.min(850, $(window).width() - 60)), 'title' : LABELS.SINGLE_ACTIVITY_LESSON_TITLE, 'open' : function() { var dialog = $(this), toolID = dialog.data('toolID'); - $(this).css("maxWidth", "850px").css("margin", "auto"); $.ajax({ async : false, cache : false, @@ -439,8 +436,8 @@ 'orgID' : orgID, 'lessonID' : lessonID }, - 'height' : 650, - 'width' : 'auto', + 'height': Math.max(380, Math.min(650, $(window).height() - 60)), + 'width' : Math.max(380, Math.min(800, $(window).width() - 60)), 'modal' : false, 'title' : LABELS.EMAIL_NOTIFICATIONS_TITLE, 'open' : function() { @@ -457,28 +454,24 @@ + 'monitoring/emailNotifications.do?method=getCourseView&organisationID=' + orgID); } - $(this).css("maxWidth", "800px").css("margin", "auto"); } }, true); } function showPrivateNotificationsDialog(){ var notificationDialog = showDialog("dialogPrivateNotifications", { - 'height' : 600, - 'width' : 'auto', + 'height': Math.max(380, Math.min(600, $(window).height() - 60)), + 'width' : Math.max(380, Math.min(600, $(window).width() - 60)), 'title' : LABELS.PRIVATE_NOTIFICATIONS_TITLE, 'close' : function(){ refreshPrivateNotificationCount(); $(this).remove(); }, 'open' : function() { var dialog = $(this); - $('iframe', dialog).attr('src', LAMS_URL - + 'notificationsprivate.jsp'); + $('iframe', dialog).attr('src', LAMS_URL + 'notificationsprivate.jsp'); - $(this).css("maxWidth", "600px").css("margin", "auto"); - // in case of mobile devices allow iframe scrolling if( /Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent) ) { setTimeout(function() { @@ -512,15 +505,14 @@ var id = "dialoGradebookCourse" + orgID; showDialog(id, { 'orgID' : orgID, - 'height' : 650, - 'width' : 'auto', + 'height': Math.max(380, Math.min(650, $(window).height() - 60)), + 'width' : Math.max(380, Math.min(800, $(window).width() - 60)), 'modal' : false, 'title' : LABELS.GRADEBOOK_COURSE_TITLE, 'open' : function() { // load contents after opening the dialog $('iframe', this).attr('src', LAMS_URL + 'gradebook/gradebookMonitoring.do?dispatch=courseMonitor&organisationID=' + orgID); - $(this).css("maxWidth", "800px").css("margin", "auto"); } }, true); } @@ -531,15 +523,14 @@ 'data' : { 'lessonID' : lessonID }, - 'height' : 650, - 'width' : 'auto', + 'height': Math.max(380, Math.min(650, $(window).height() - 60)), + 'width' : Math.max(380, Math.min(800, $(window).width() - 60)), 'modal' : false, 'title' : LABELS.GRADEBOOK_LESSON_TITLE, 'open' : function() { var lessonID = $(this).data('lessonID'); // load contents after opening the dialog $('iframe', this).attr('src', LAMS_URL + 'gradebook/gradebookMonitoring.do?lessonID=' + lessonID); - $(this).css("maxWidth", "800px").css("margin", "auto"); } }, true); } @@ -552,16 +543,17 @@ 'data' : { 'orgID' : orgID }, + // too little difference between min height of 380 and standard height of 400, + // so just keep it always 400 'height' : 400, - 'width' : 'auto', + 'width' : Math.max(380, Math.min(750, $(window).width() - 60)), 'modal' : false, 'title' : LABELS.GRADEBOOK_LEARNER_TITLE, 'open' : function() { var orgID = $(this).data('orgID'); // load contents after opening the dialog $('iframe', this).attr('src', LAMS_URL + 'gradebook/gradebookLearning.do?dispatch=courseLearner&organisationID=' + orgID); - $(this).css("maxWidth", "750px").css("margin", "auto"); } }, true); } @@ -572,16 +564,15 @@ 'data' : { 'lessonID' : lessonID }, - 'height' : 600, - 'width' : 'auto', + 'height': Math.max(380, Math.min(600, $(window).height() - 60)), + 'width' : Math.max(380, Math.min(610, $(window).width() - 60)), 'modal' : false, 'title' : LABELS.CONDITIONS_TITLE, 'open' : function() { var lessonID = $(this).data('lessonID'); // load contents after opening the dialog $('iframe', this).attr('src', LAMS_URL + 'lessonConditions.do?method=getIndexLessonConditions&lsId=' + lessonID); - $(this).css("maxWidth", "610px").css("margin", "auto"); } }, true); } @@ -592,16 +583,15 @@ 'data' : { 'orgID' : orgID }, - 'height' : 600, - 'width' : 'auto', + 'height': Math.max(380, Math.min(600, $(window).height() - 60)), + 'width' : Math.max(380, Math.min(830, $(window).width() - 60)), 'modal' : false, 'title' : LABELS.SEARCH_LESSON_TITLE, 'open' : function() { var orgID = $(this).data('orgID'); // load contents after opening the dialog $('iframe', this).attr('src', LAMS_URL + 'findUserLessons.do?dispatch=getResults&courseID=' + orgID); - $(this).css("maxWidth", "830px").css("margin", "auto"); } }, true); } @@ -671,7 +661,7 @@ function showAuthoringDialog(learningDesignID){ showDialog('dialogAuthoring', { 'height' : Math.max(300, $(window).height() - 40), - 'width' : 1280, + 'width' : Math.max(600, Math.min(1280, $(window).width() - 60)), 'modal' : false, 'title' : LABELS.AUTHORING_TITLE, 'beforeClose' : function(){ @@ -748,5 +738,4 @@ function closeEmailDialog(){ $('#dialogEmail').modal('hide'); -} - +} \ No newline at end of file