beautypg.com

The server formats api functions, Applyformat() – Adobe Extending Dreamweaver CS4 User Manual

Page 311

background image

305

EXTENDING DREAMWEAVER CS4

Server formats

Scenarios in which the data formatting functions are
called

The data formatting functions are called in the following scenarios:

In the Dynamic Data or the Dynamic Text dialog box, the user selects a node from the data source tree and a format
from the Format menu. When the user selects the format, Dreamweaver calls the

generateDynamicDataRef()

function and passes the return value from the

generateDynamicDataRef()

function to the

formatDynamicDataRef()

function. The return value from the

formatDynamicDataRef()

function appears in

the Code setting of the dialog box. After the user clicks OK, the string of code is inserted into the user’s document.
Next, Dreamweaver calls the

applyFormat()

function to insert a function declaration. For more information, see

generateDynamicDataRef()

” on page 301. A similar process occurs when the user works with the Bindings panel.

If the user changes the format or deletes the dynamic data item, the

deleteFormat()

function is called. The

deleteFormat()

function removes the support scripts from the document.

When the user clicks the Plus (+) button in the Edit Format List dialog box, Dreamweaver displays a menu that
contains all the format types for the specified server model. Each format type corresponds to a file in the
Configuration/ServerFormats/currentServerModel folder.

If the user selects a format from the Plus (+) menu that requires a user-specified parameter, Dreamweaver executes
the

onload

handler on the

body

tag and displays the Parameters dialog box, which shows the parameters for the

format type. In this dialog box, when the user selects parameters for the format and clicks OK, Dreamweaver calls
the

applyFormatDefinition()

function.

If the selected format does not need to display a Parameters dialog box, Dreamweaver calls the

applyFormatDefinition()

function when the user selects the format type from the Plus (+) menu.

Later, if the user edits the format by selecting it in the Edit Format List dialog box and clicking the Edit button,
Dreamweaver calls the

inspectFormatDefinition()

function before the Parameters dialog box appears, so the

form controls can be initialized to the correct values.

The server formats API functions

The server formats API consists of the following data formatting functions.

applyFormat()

Availability
Dreamweaver UltraDev 1.

Description
This function can edit a user’s document by adding a format function declaration to it. When a user selects a format
from the Format text field in the Dynamic Data or the Dynamic Text dialog box or in the Bindings panel,
Dreamweaver makes two changes to the user’s document: It adds the appropriate format function before the HTML
tag (if it’s not already there), and it changes the dynamic data object to call the appropriate format function.

Dreamweaver adds the function declaration by calling the

applyFormat()

JavaScript function in the data format file.

It changes the dynamic data object by calling the

formatDynamicDataRef()

function.

This manual is related to the following products: