Index: lams_central/web/includes/javascript/dialog.js =================================================================== diff -u -r605cd5a28f650eacc10700c2674c2f5817eee086 -reffd1f57d486ca2060a4b320e5004fa77377a373 --- lams_central/web/includes/javascript/dialog.js (.../dialog.js) (revision 605cd5a28f650eacc10700c2674c2f5817eee086) +++ lams_central/web/includes/javascript/dialog.js (.../dialog.js) (revision effd1f57d486ca2060a4b320e5004fa77377a373) @@ -47,12 +47,13 @@ } } - // checks whether the dialog should be created inside a current window or in a parent one. The latter is prefered + // checks whether the dialog should be created inside a current window or in a parent one. The latter is preferred //in case we want dialog to be not constrained by the boundaries of a current window - var body = initParams.isCreateInParentWindow ? parent.$("body") : 'body'; + var targetWindow = initParams.isCreateInParentWindow ? window.parent : window; // create a new dialog by cloning a template - dialog = dialogTemplate.clone().appendTo(body); + dialog = dialogTemplate.clone().appendTo(targetWindow.$('body')); + dialog.data('isCreateInParentWindow', initParams.isCreateInParentWindow); // use the input attributes or fall back to default ones initParams = $.extend({ @@ -146,11 +147,20 @@ // center the dialog or put it into previously defined position var position = dialog.data('position'); if (position !== false) { - position = position || { - 'my' : 'top', - 'at' : 'top+15px', - 'of' : window - }; + position = position || + (dialog.data('isCreateInParentWindow') ? + { + 'my' : 'center center', + 'at' : 'center center', + 'of' : targetWindow + } + : + { + 'my' : 'top', + 'at' : 'top+15px', + 'of' : window + } + ); dialog.position(position); } @@ -227,11 +237,20 @@ $('.ui-resizable-handle', dialog).hide(); } // center the dialog - (initParams.modal ? internalDialog : dialog).position({ - 'my' : 'top', - 'at' : 'center top', - 'of' : window - }); + (initParams.modal ? internalDialog : dialog).position( + dialog.data('isCreateInParentWindow') ? + { + 'my' : 'center center', + 'at' : 'center center', + 'of' : window.parent + } + : + { + 'my' : 'top', + 'at' : 'center top', + 'of' : window + } + ); internalContent.trigger('resizestop'); }); @@ -405,11 +424,10 @@ } } }, true) - - // reposition the dialog after showing because it may not fit into current viewport - dialog.on('shown.bs.modal', function(){ - dialog.css('top', '15px'); - }); + +// dialog.on('shown.bs.modal', function(){ +// dialog.css('top', '15px'); +// }); }