The only required function for the reports API is the processFile() function. All other functions are optional.

processFile()

Availability

Dreamweaver 4.

Description

This function is called when there is a file to process. The Report command should process the file without modifying it and use the dw.ResultsPalette.SiteReports() function, the addResultItem() function, or the resWin.addItem() function to return information about the file. Dreamweaver automatically releases each file’s DOM when it finishes.

Arguments

strFilePath

The strFilePath argument is the full path and filename of the file to process.

Returns

Dreamweaver expects nothing.

beginReporting()

Availability

Dreamweaver 4.

Description

This function is called at the start of the reporting process, before any reports are run. If the Report command returns a false value from this function, the Report command is excluded from the report run.

Arguments

target

The target argument is a string that indicates the target of the report session. It can be one of the following values: "CurrentDoc", "CurrentSite", "CurrentSiteSelection" (for the selected files in a site), or "Folder:+ the path to the folder the user selected" (for example, "Folder:c:temp").

Returns

Dreamweaver expects a Boolean value: true if the report runs successfully; false if target is excluded from the report run.

endReporting()

Availability

Dreamweaver 4.

Description

This function is called at the end of the Report process.

Arguments

None.

Returns

Dreamweaver expects nothing.

commandButtons()

Availability

Dreamweaver 4.

Description

Defines the buttons that should appear on the right side of the Options dialog box and their behavior when they are clicked. If this function is not defined, no buttons appear, and the body section of the report file expands to fill the entire dialog box.

Arguments

None.

Returns

Dreamweaver expects an array that contains an even number of elements. The first element is a string that contains the label for the topmost button. The second element is a string of JavaScript code that defines the behavior of the topmost button when it is clicked. The remaining elements define additional buttons in the same manner.

Example

The following instance of the commandButtons() function defines the OK, Cancel, and Help buttons.

 function commandButtons(){ 
    return new Array("OK" , "doCommand()" , "Cancel" , ¬ 
    "window.close()" , "Help" , "showHelp()"); 
}

configureSettings()

Availability

Dreamweaver 4.

Description

Determines whether the Report Settings button should be enabled in the Reports dialog box when this report is selected.

Arguments

None.

Returns

Dreamweaver expects a Boolean value: true if the Report Settings button should be enabled; false otherwise.

windowDimensions()

Availability

Dreamweaver 4.

Description

Sets specific dimensions for the Parameters dialog box. If this function is not defined, the window dimensions are computed automatically.

Note:

Do not define this function unless you want an Options dialog box that is larger than 640 x 480 pixels.

Arguments

platform

The value of the platform argument is either "macintosh" or "windows", depending on the user’s platform.

Returns

Dreamweaver expects a string of the form "widthInPixels,heightInPixels".

The returned dimensions are smaller than the size of the entire dialog box because they do not include the area for the OK and Cancel buttons. If the returned dimensions do not accommodate all options, scroll bars appear.

Example

The following instance of the windowDimensions() function sets the dimensions of the Parameters dialog box to 648 x 520 pixels:

 function windowDimensions(){ 
    return "648,520"; 
}

This work is licensed under a Creative Commons Attribution-Noncommercial-Share Alike 3.0 Unported License  Twitter™ and Facebook posts are not covered under the terms of Creative Commons.

Legal Notices   |   Online Privacy Policy