How to develop a new connection type

 < Day Day Up > 

The following steps outline the process for creating a new connection type:

1.

Create the layout for the connection dialog box.

Create an HTML file that lays out the user interface (UI) for your connection dialog box. Name this file using the name of the connection (for example, myConnection.htm). For information about creating a dialog box, see Getting Started with Dreamweaver.

Make sure this HTML file includes a reference to the JavaScript implementation file that you define in Step 2, "Create a JavaScript file that implements at least the following elements:" on page 606, as shown in the following example:

 <head>   <script src="/books/4/533/1/html/2/../myConnectionImpl.js"></script> </head> 

Store this HTML file, which defines your connection dialog box, in the Configuration/Connections/server-model/platform folder (where the platform is either Windows or Macintosh).

For example, the default ADO connection dialog box for an ASP JavaScript document on a Windows platform is stored in the ASP_Js/Win folder and is named Connection_ado_conn_string.htm.

NOTE

At runtime, Macromedia Dreamweaver dynamically builds the list of connection types that are available to the user from the collection of dialog boxes that are in the ASP_Js/Win folder.

The Configuration/ServerModels folder has HTML files that define each server model. Inside each HTML file is the getServerModelFolderName() function, which returns the name of the folder that is associated with the server model. The following example shows the function for the ASP JavaScript document type:

 function getServerModelFolderName() {   return "ASP_JS"; } 

You can also look at the MMDocumentTypes.xml file, which is located in the Configuration/DocumentTypes folder, to determine the mapping between server models and document types.

2.

Create a JavaScript file that implements at least the following elements:

Element

Description

Examples

A set of variables

Each variable defines a specific connection property

Type of connection, data source name, and so on

A set of buttons

Each button appears in the connection dialog box

Test, Help, and so on (OK and Cancel are automatically included)

Connectivity functions

Together, these functions define the Connectivity API

findConnection()

applyConnection()

inspectConnection()


You can select any name for this implementation file, but it must have a .js extension (for example, myConnectionImpl.js). You can store this implementation file on either your local or a remote computer. You might want to store your implementation file in the appropriate subfolder within the Configuration/Connections folder.

NOTE

The HTML file that you defined in Step 1, "Create the layout for the connection dialog box." on page 605 must include this connection type implementation file.


Unless you need to define connection parameters other than the ones provided in the standard connection_includefile.edml file, these two steps are the minimum to create a new connection dialog box.

NOTE

The title of the dialog box that the user sees is in the title tag, which is specified in the HTML document.


The functions listed in the next section let you create a connection dialog box. Along with implementing the calls for generating include files for the user, you can register your connectivity type within the server model section of the connection XML file.

For information about the Database Connectivity API that is associated with creating a new connection, see "Database connection functions" on page 574.

     < Day Day Up > 


    Developing Extensions for Macromedia Dreamweaver 8
    Developing Extensions for Macromedia Dreamweaver 8
    ISBN: 0321395409
    EAN: 2147483647
    Year: 2005
    Pages: 282

    flylib.com © 2008-2017.
    If you may any questions please contact us: flylib@qtcs.net