diff --git a/main/inc/lib/fckeditor/editor/plugins/ImageManager/assets/manager.js b/main/inc/lib/fckeditor/editor/plugins/ImageManager/assets/manager.js index ba392738f4..36ee855575 100644 --- a/main/inc/lib/fckeditor/editor/plugins/ImageManager/assets/manager.js +++ b/main/inc/lib/fckeditor/editor/plugins/ImageManager/assets/manager.js @@ -5,8 +5,14 @@ * @package ImageManager */ - // Added by Ivan Tcholakov - var FCK = window.opener.FCK ; + if ( window.opener ) + { + var FCK = window.opener.FCK ; + } + else if ( window.parent ) + { + var FCK = oEditor.FCK ; + } //Translation function i18n(str) { diff --git a/main/inc/lib/fckeditor/editor/plugins/ImageManager/assets/popup.js b/main/inc/lib/fckeditor/editor/plugins/ImageManager/assets/popup.js index 1892911036..715c30d751 100644 --- a/main/inc/lib/fckeditor/editor/plugins/ImageManager/assets/popup.js +++ b/main/inc/lib/fckeditor/editor/plugins/ImageManager/assets/popup.js @@ -50,49 +50,60 @@ function __dlg_init(bottom) { var pos = getAbsolutePos(bottom); body_height = pos.y + bottom.offsetHeight; } - if(opener && opener.Dialog && opener.Dialog._arguments) + + if (opener && opener.Dialog && opener.Dialog._arguments) + { window.dialogArguments = opener.Dialog._arguments; - if (!document.all) { - //window.sizeToContent(); - //window.sizeToContent(); // for reasons beyond understanding, - // only if we call it twice we get the - // correct size. - window.addEventListener("unload", __dlg_onclose, true); - // center on parent - var x = opener.screenX + (opener.outerWidth - window.outerWidth) / 2; - var y = opener.screenY + (opener.outerHeight - window.outerHeight) / 2; + } + else if ( !opener && window.parent ) + { + window.dialogArguments = oEditor.Dialog._arguments; + } + + if ( opener ) + { + if (!document.all) { + //window.sizeToContent(); + //window.sizeToContent(); // for reasons beyond understanding, + // only if we call it twice we get the + // correct size. + window.addEventListener("unload", __dlg_onclose, true); + // center on parent + var x = opener.screenX + (opener.outerWidth - window.outerWidth) / 2; + var y = opener.screenY + (opener.outerHeight - window.outerHeight) / 2; - // Avoiding being in the center of the page. - /* - window.moveTo(x, y); - */ + // Avoiding being in the center of the page. + /* + window.moveTo(x, y); + */ - //window.innerWidth = body.offsetWidth + 5; - //window.innerHeight = body_height + 2; - } else { - // window.dialogHeight = body.offsetHeight + 50 + "px"; - // window.dialogWidth = body.offsetWidth + "px"; - //window.resizeTo(body.offsetWidth, body_height); - var ch = body.clientHeight; - var cw = body.clientWidth; - //window.resizeBy(body.offsetWidth - cw, body_height - ch); - var W = body.offsetWidth; - var H = 2 * body_height - ch; - if(ch <= 0) H = body_height; - var x = (screen.availWidth - W) / 2; - var y = (screen.availHeight - H) / 2; - //alert('x:'+x+' y:'+y+' ch:'+ch); + //window.innerWidth = body.offsetWidth + 5; + //window.innerHeight = body_height + 2; + } else { + // window.dialogHeight = body.offsetHeight + 50 + "px"; + // window.dialogWidth = body.offsetWidth + "px"; + //window.resizeTo(body.offsetWidth, body_height); + var ch = body.clientHeight; + var cw = body.clientWidth; + //window.resizeBy(body.offsetWidth - cw, body_height - ch); + var W = body.offsetWidth; + var H = 2 * body_height - ch; + if(ch <= 0) H = body_height; + var x = (screen.availWidth - W) / 2; + var y = (screen.availHeight - H) / 2; + //alert('x:'+x+' y:'+y+' ch:'+ch); - // Avoiding being in the center of the page. - /* - if(Dialog.is_ie) - window.moveTo(x, y); - else //opera - window.moveTo(x, y - H/4); - */ + // Avoiding being in the center of the page. + /* + if(Dialog.is_ie) + window.moveTo(x, y); + else //opera + window.moveTo(x, y - H/4); + */ + } + document.body.onkeypress = __dlg_close_on_esc; } - document.body.onkeypress = __dlg_close_on_esc; }; function __dlg_translate(i18n) { diff --git a/main/inc/lib/fckeditor/editor/plugins/ImageManager/fckplugin.js b/main/inc/lib/fckeditor/editor/plugins/ImageManager/fckplugin.js index 96d2fb60f0..e3c21fe9f6 100644 --- a/main/inc/lib/fckeditor/editor/plugins/ImageManager/fckplugin.js +++ b/main/inc/lib/fckeditor/editor/plugins/ImageManager/fckplugin.js @@ -71,7 +71,7 @@ FCKToolbarItems.RegisterItem( 'ImageManager', oImageManagerItem ) ; FCKImageManager.prototype.Execute = function() { - ImageManager_click(FCK, null) + ImageManager_click(FCK, null); } function ImageManager_click(editor, sender) { @@ -229,7 +229,12 @@ function Dialog(url, action, init) { if (typeof init == "undefined") { init = window; // pass this window object by default } - Dialog._geckoOpenModal(url, action, init); + if ( FCKConfig.OpenImageManagerInANewWindow && FCKConfig.OpenImageManagerInANewWindow.toString() == 'true' ) { + Dialog._geckoOpenModal(url, action, init); + } else { + Dialog._arguments = init; + FCKDialog.OpenDialog( 'FCKDialog_ImageManager', 'Image Manager', url, 800, 600 ) ; + } }; Dialog._parentEvent = function(ev) { diff --git a/main/inc/lib/fckeditor/editor/plugins/ImageManager/manager.php b/main/inc/lib/fckeditor/editor/plugins/ImageManager/manager.php index 7578aabc1b..2df6fe72cb 100644 --- a/main/inc/lib/fckeditor/editor/plugins/ImageManager/manager.php +++ b/main/inc/lib/fckeditor/editor/plugins/ImageManager/manager.php @@ -33,6 +33,13 @@