A simple site report example, Create the report definition – Adobe Extending Dreamweaver CS4 User Manual
Page 200

194
EXTENDING DREAMWEAVER CS4
Reports
At this point, Dreamweaver clears all items from the Site Reports tab of the Results panel. Dreamweaver calls the
beginReporting()
function in each report before the reporting process begins. If a report returns a
false
value
from this function, it is removed from the report run.
5
Each file is passed to each report that was selected in the Reports dialog box using the
processFile()
function. If
the report needs to include information about this file in the results list, it should call the
dw.resultsPalette.siteReports.addResultItem()
function. This process continues until all files that
pertain to the user’s selection are processed or the user clicks the Stop button in the bottom of the window.
Dreamweaver displays the name of each file being processed and the number of files that remain to be processed.
6
Dreamweaver calls the
endReporting()
function in each report after all the files have been processed and the
reporting process completes.
A simple site report example
The simple extension example lists all the images referenced in a particular file, an entire site, selected files, or a folder
and displays the report in the Results window under the Site Results tab.
To create this extension, you create the report definition and write the JavaScript code.
This example creates two files in the HTML Reports folder: List images.htm, which contains the report definition, and
List Images.js, which contains the JavaScript code specific to this report. In addition, you reference the Reports.js file,
which is included with Dreamweaver.
Create the report definition
The report definition specifies the name of the report as it appears in the Reports dialog box, calls any JavaScript files
required, and defines the user interface of the Settings dialog box, if needed.
1
Create the file Configuration/Reports/HTML Reports/List images.htm.
2
Add the following to specify the name of the report that you want to appear in the Reports dialog box in the title of
the HTML page.
3
At the end of the file, add the
script
tag and specify the Reports.js file in the
src
attribute.
4
At the end of the file, add another
script
tag and specify the List Images.js file, which you will create next, in the
src
attribute.
5
Close the
head
tag, include opening and closing
body
tags, and close the
html
tag.
6
Save the file as List Images.js in the Configuration/Reports/HTML Reports folder.