Hi there,
I'm creating a stripped down version of the Image plugin. My version doesn't have any tabs, just an browse/upload, a drop-down containing previously uploaded images and a 'place' button, to place the selected image into the Document.
<code>
// Register the related commands.
FCKCommands.RegisterCommand( 'Place_Image' , new FCKDialogCommand( FCKLang['costaPlaceImageTitle'] , FCKLang['costaPlaceImageTitle'] , FCKConfig.CostaPath + 'index.php?module=cms&action=InsertImage' , 500, 400 ) ) ;
// Create the "Find" toolbar button.
var oPlaceImage = new FCKToolbarButton( 'Place_Image', FCKLang['costaPlaceImageTitle'] ) ;
oPlaceImage.IconPath = FCKConfig.PluginsPath + 'placeimage/costaPlaceImage.gif' ;
FCKToolbarItems.RegisterItem( 'Place_Image', oPlaceImage ) ; // 'My_Find' is the name used in the Toolbar config.
</code>
I've used the FCKDialogueCommand as my starting point and used custom skins. The FrameCell points at my own .php file, which creates a custom-built form. This php file is actually part of a framework and therefore a bit complex to include, but basically it outputs an HTML page with a form on it and some javascript functions that are triggered when buttons are clicked.
The problem I'm having is that I can't figure out how to get the selected image from my custom Image pop-up's $_POST vars into the EditorDocument in the window.opener window.
I've put this in:
<code>
var oEditor = window.parent.InnerDialogLoaded() ;
</code>
...which does return a valid FCK object because I can <code>alert(oEditor.FCKConfig.SkinPath);</code> on it and I get valid output.
However, if I try to do this:
<code>Image = oEditor.EditorDocument.createElement('IMG');
Image.src=path;
window.close();</code>
I get this javascript error message:
'oEditor.EditorDocument' is null or not an object.
What am I doing wrong?
Thanks,
Noel da Costa
Lead Developer
http://www.magharl.co.uk
Sun, 06/11/2006 - 19:53
#1