How stand-alone reports work, A simple stand-alone report example, Create the dialog box ui – Adobe Extending Dreamweaver CS4 User Manual
Page 202
196
EXTENDING DREAMWEAVER CS4
Reports
How stand-alone reports work
1
The custom command, which is the command you create to generate the report, opens a new results window by
calling the
dw.createResultsWindow()
function and storing the returned results object in a window variable. The
remaining functions in this process should be called as methods of this object.
2
The custom command initializes the title and format of the Results window by calling the
setTitle()
and
SetColumnWidths()
functions as methods of the Results window object.
3
The command can either start adding items to the Results window immediately by calling the
addItem()
function,
or it can begin iterating through a list of files by calling the
setFileList()
and
startProcessing()
functions as
methods of the Results window object.
4
When the command calls
resWin.startProcessing()
, Dreamweaver calls the
processFile()
function for each
file URL in the list. Define the
processFile()
function in the stand-alone command. It receives the file URL as its
only argument. Use the
setCallbackCommands()
function of the Results window object if you want Dreamweaver
to call the
processFile()
function in some other command.
5
To call the
addItem()
function, the
processFile()
function needs to have access to the Results window that was
created by the stand-alone command. The
processFile()
function can also call the
stopProcessing()
function
of the Results window object to stop processing the list of files.
A simple stand-alone report example
The simple stand-alone report extension lists all the images referenced in a particular file and displays the report in the
Results window.
You create this extension by creating the dialog box UI and writing the JavaScript code.
This example creates two files in the Configuration/Commands folder: List images.htm, which defines the UI of the
dialog box that appears when the user selects the custom command, and Listimages.js, which contains the JavaScript
code specific to this report.
Create the dialog box UI
The body section of the HTML file specifies the contents of the dialog box that appears when the user selects the
custom command and calls any JavaScript files required.
1
Create the Configuration/Commands/Listimages.htm file.
2
Enter the following in the Listimages.htm file: