views:

821

answers:

2

I am a complete beginner trying to develop for FCKeditor so please bear with me here. I have been tasked with developing a custom plugin that will allow users to browse a specific set of images that the user uploads. Essentially the user first attaches images, then uses the FCKeditor to insert those images.

So I have my plugin directory:

  • lang
  • fckplugin.js
  • img.png (for the toolbar button)

I am looking for some help on strategy for the custom file browser (lets call it mybrowser.asp).

1) Should mybrowser.asp be in the plugin directory? It is dynamic and only applies to one specific area of the site.

2) How should I pass the querystring to mybrowser.asp?

3) Any other recommendations for developing FCKeditor plugins? Any sample plugins that might be helpful to me?

EDIT: The querystring passed to the plugin page will be the exact same as the one on the host page. (This is a very specific plugin that will only be used in one place)

+1  A: 

You don't need the lang directory unless you're planning on supporting multiple languages. But even then, I would get the plugin working in one language first.

I would probably put mybrowser.asp in the plugin directory.

Here's some code for fckplugin.js to get you started.

// Register the related command. 
// RegisterCommand takes the following arguments: CommandName, DialogCommand 
// FCKDialogCommand takes the following arguments: CommandName, 
//    Dialog Title, Path to HTML file, Width, Height

FCKCommands.RegisterCommand( 
    'MyBrowser', 
    new FCKDialogCommand( 
        'My Browser', 
        'Select An Image',
        FCKPlugins.Items['MyBrowser'].Path + 'mybrowser.asp',
        500,
        250) 
);

// Create the toolbar button. 
// FCKToolbarButton takes the following arguments: CommandName, Button Caption 

var button = new FCKToolbarButton( 'MyBrowser', 'Select An Image' ) ; 
button.IconPath = FCKPlugins.Items['MyBrowser'].Path + 'img.png' ; 
FCKToolbarItems.RegisterItem( 'MyBrowser', button ) ;

Edit: I haven't tested this, but you should be able to append the querystring by doing something along these lines.

        'Select An Image',
        FCKPlugins.Items['MyBrowser'].Path + 'mybrowser.asp' + window.top.location.search,
        500,
Patrick McElhaney
A: 

You might not need to write your own file browser as this functionality is built in. If you check the fckconfig.js file and search for var _FileBrowserLanguage you can specify your server language and it should hopefully use the equivalent file in the editor -> filemanager -> connectors folder.

If you check the docs hopefully that should hopefully keep you on the right track.

Ian Oxley