[svn r22306] FS#2867 - The online editor: Integration of the ImageManager with the editor's dialog system: Passing dialog's parameters, establishing access to the language translations, isolation of no-relevant code to the in-dialog mode.

skala
Ivan Tcholakov 17 years ago
parent 245d89756c
commit e41f588671
  1. 10
      main/inc/lib/fckeditor/editor/plugins/ImageManager/assets/manager.js
  2. 85
      main/inc/lib/fckeditor/editor/plugins/ImageManager/assets/popup.js
  3. 9
      main/inc/lib/fckeditor/editor/plugins/ImageManager/fckplugin.js
  4. 39
      main/inc/lib/fckeditor/editor/plugins/ImageManager/manager.php

@ -5,8 +5,14 @@
* @package ImageManager * @package ImageManager
*/ */
// Added by Ivan Tcholakov if ( window.opener )
var FCK = window.opener.FCK ; {
var FCK = window.opener.FCK ;
}
else if ( window.parent )
{
var FCK = oEditor.FCK ;
}
//Translation //Translation
function i18n(str) { function i18n(str) {

@ -50,49 +50,60 @@ function __dlg_init(bottom) {
var pos = getAbsolutePos(bottom); var pos = getAbsolutePos(bottom);
body_height = pos.y + bottom.offsetHeight; body_height = pos.y + bottom.offsetHeight;
} }
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;
// Avoiding being in the center of the page. if (opener && opener.Dialog && opener.Dialog._arguments)
/* {
window.moveTo(x, y); window.dialogArguments = opener.Dialog._arguments;
*/ }
else if ( !opener && window.parent )
{
window.dialogArguments = oEditor.Dialog._arguments;
}
//window.innerWidth = body.offsetWidth + 5; if ( opener )
//window.innerHeight = body_height + 2; {
} else { if (!document.all) {
// window.dialogHeight = body.offsetHeight + 50 + "px"; //window.sizeToContent();
// window.dialogWidth = body.offsetWidth + "px"; //window.sizeToContent(); // for reasons beyond understanding,
//window.resizeTo(body.offsetWidth, body_height); // only if we call it twice we get the
var ch = body.clientHeight; // correct size.
var cw = body.clientWidth; window.addEventListener("unload", __dlg_onclose, true);
//window.resizeBy(body.offsetWidth - cw, body_height - ch); // center on parent
var W = body.offsetWidth; var x = opener.screenX + (opener.outerWidth - window.outerWidth) / 2;
var H = 2 * body_height - ch; var y = opener.screenY + (opener.outerHeight - window.outerHeight) / 2;
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. // Avoiding being in the center of the page.
/* /*
if(Dialog.is_ie)
window.moveTo(x, y); window.moveTo(x, y);
else //opera */
window.moveTo(x, y - H/4);
*/ //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);
*/
}
document.body.onkeypress = __dlg_close_on_esc;
} }
document.body.onkeypress = __dlg_close_on_esc;
}; };
function __dlg_translate(i18n) { function __dlg_translate(i18n) {

@ -71,7 +71,7 @@
FCKToolbarItems.RegisterItem( 'ImageManager', oImageManagerItem ) ; FCKToolbarItems.RegisterItem( 'ImageManager', oImageManagerItem ) ;
FCKImageManager.prototype.Execute = function() { FCKImageManager.prototype.Execute = function() {
ImageManager_click(FCK, null) ImageManager_click(FCK, null);
} }
function ImageManager_click(editor, sender) { function ImageManager_click(editor, sender) {
@ -229,7 +229,12 @@ function Dialog(url, action, init) {
if (typeof init == "undefined") { if (typeof init == "undefined") {
init = window; // pass this window object by default 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) { Dialog._parentEvent = function(ev) {

@ -33,6 +33,13 @@
<script type="text/javascript"> <script type="text/javascript">
/*<![CDATA[*/ /*<![CDATA[*/
var oEditor = null ;
if ( !window.opener && window.parent )
{
// The image manager is inside a dialog.
oEditor = window.parent.InnerDialogLoaded() ;
}
var thumbdir = "<?php echo $IMConfig['thumbnail_dir']; ?>"; var thumbdir = "<?php echo $IMConfig['thumbnail_dir']; ?>";
var base_url = "<?php echo $manager->getBaseURL(); ?>"; var base_url = "<?php echo $manager->getBaseURL(); ?>";
@ -40,18 +47,34 @@
var server_name = "<?php echo $IMConfig['server_name']; ?>"; var server_name = "<?php echo $IMConfig['server_name']; ?>";
window.resizeTo(800, 500); var _editor_lang = 'en' ;
if ( window.opener )
if(window.opener.ImageManager && window.opener.ImageManager.I18N) {
window.resizeTo( 800, 500 ) ;
if ( window.opener.ImageManager && window.opener.ImageManager.I18N )
{
I18N = window.opener.ImageManager.I18N ;
}
if ( window.opener._editor_lang )
{
_editor_lang = window.opener._editor_lang ;
}
}
else if ( window.parent )
{ {
I18N = window.opener.ImageManager.I18N; _editor_lang = oEditor._editor_lang ;
if ( oEditor.ImageManager && oEditor.ImageManager.I18N )
{
I18N = oEditor.ImageManager.I18N ;
}
} }
// language object not found? // Language object not found?
if (!this.I18N) if (!this.I18N)
{ {
// Read it now - copy in next script block // Read it now - copy in next script block
document.write('<script type="text/javascript" src="lang/' + window.opener._editor_lang + '.js"><\/script>'); document.write( '<script type="text/javascript" src="lang/' + _editor_lang + '.js"><\/script>' );
} }
/*]]>*/ /*]]>*/
@ -92,9 +115,9 @@
<?php } ?> <?php } ?>
<?php } ?> <?php } ?>
</select> </select>
<a href="#" onclick="javascript: goUpDir();" title="Directory Up"><img src="img/btnFolderUp.gif" height="15" width="15" alt="Directory Up" />&nbsp;<span>Directory Up</span></a> <a href="javascript: void(0);" onclick="javascript: goUpDir();" title="Directory Up"><img src="img/btnFolderUp.gif" height="15" width="15" alt="Directory Up" />&nbsp;<span>Directory Up</span></a>
<?php if($IMConfig['safe_mode'] == false && $IMConfig['allow_new_dir']) { ?> <?php if($IMConfig['safe_mode'] == false && $IMConfig['allow_new_dir']) { ?>
<a href="#" onclick="newFolder();" title="New Folder"><img src="img/btnFolderNew.gif" height="15" width="15" alt="New Folder" /></a> <a href="javascript: void(0);" onclick="newFolder();" title="New Folder"><img src="img/btnFolderNew.gif" height="15" width="15" alt="New Folder" /></a>
<?php } ?> <?php } ?>
<div id="messages" style="display: none;"><span id="message"></span><img SRC="img/dots.gif" width="22" height="12" alt="..." /></div> <div id="messages" style="display: none;"><span id="message"></span><img SRC="img/dots.gif" width="22" height="12" alt="..." /></div>
<iframe src="images.php" name="imgManager" id="imgManager" class="imageFrame" scrolling="auto" title="Image Selection" frameborder="0"></iframe> <iframe src="images.php" name="imgManager" id="imgManager" class="imageFrame" scrolling="auto" title="Image Selection" frameborder="0"></iframe>

Loading…
Cancel
Save