ADOBE Dreamweaver API CS5 User Manual [es, en]

ADOBE® DREAMWEAVER® CS5 & CS5.5
API Reference

Legal notices

Legal notices
Last updated 6/15/2011

Contents

Chapter 1: Introduction
About extensions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1
Extending Dreamweaver . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1
Additional resources for extension writers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1
New functions in Dreamweaver CS5 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2
Conventions used in this guide . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3
Chapter 2: The file I/O API
About configuration folders . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5
About the file I/O API . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5
Chapter 3: The HTTP API
How the HTTP API works . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14
The HTTP API . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14
Chapter 4: The Design Notes API
How Design Notes work . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 21
The Design Notes JavaScript API . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 21
The Design Notes C API . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 26
iii
Chapter 5: Fireworks integration
The FWLaunch API . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 33
Chapter 6: Flash integration
The Flash Objects API . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 39
Flash panels and dialogs functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 42
Chapter 7: Photoshop integration
How Smart Objects work . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 50
The Smart Objects API . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 50
Chapter 8: The database API
How database API functions work . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 54
Database connection functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 55
Database access functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 67
Chapter 9: The database connectivity API
Select a new connection type . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 79
Develop a new connection type . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 79
The Connection API . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 80
The generated include file . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 83
The definition file for your connection type . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 84
Last updated 6/15/2011
DREAMWEAVER API REFERENCE
Contents
Chapter 10: The source control integration API
How source control integration with Dreamweaver works . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 86
Adding source control system functionality . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 87
The source control integration API required functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 87
The source control integration API optional functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 92
Enablers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 100
Chapter 11: Application
External application functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 106
Global application functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 115
Bridge communication functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 119
Chapter 12: Workspace
History functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 122
Insert object functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 130
Keyboard functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 132
Menu functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 139
Results window functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 141
Toggle functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 153
Toolbar functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 172
Window functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 177
Information bar functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 188
Related files functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 189
Vertical Split view functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 201
Code collapse functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 203
Code view toolbar functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 209
Color functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 213
iv
Chapter 13: Site
Report functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 215
Site functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 216
Chapter 14: Document
Conversion functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 247
Command functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 248
File manipulation functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 249
Global document functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 264
Path functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 272
Selection functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 290
String manipulation functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 295
Translation functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 299
XSLT functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 301
Chapter 15: Page content
Assets panel functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 304
Behavior functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 311
Clipboard functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 320
Library and template functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 324
Last updated 6/15/2011
DREAMWEAVER API REFERENCE
Contents
Snippets panel functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 329
Spry widget editing functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 333
Inserting Spry widgets functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 335
Browser compatibility check functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 338
Chapter 16: Dynamic documents
Server components functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 346
Data source functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 347
Extension Data Manager functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 348
Live data functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 350
Live view functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 355
Server behavior functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 366
Server model functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 368
Chapter 17: Design
CSS layout functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 374
Frame and frameset functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 396
Layer and image map functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 398
Layout environment functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 401
Layout view functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 406
Resolution management functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 412
Media Query . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 414
Zoom functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 415
Guide functions and properties . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 418
Table editing functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 425
v
Chapter 18: Code
Code functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 435
Find and replace functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 439
General editing functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 445
Print function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 461
Quick Tag Editor functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 462
Code view functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 464
Live Code view functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 481
Tag editor and tag library functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 482
Chapter 19: Enablers
Enabler functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 487
Last updated 6/15/2011

Chapter 1: Introduction

The Adobe Dreamweaver CS5 API Reference describes the application programming interfaces (APIs). The APIs let you perform various supporting tasks when developing Adobe® Dreamweaver® CS5 extensions and adding program code to your Dreamweaver web pages. The APIs include the main JavaScript API which provides access to most of the core functionalities of Dreamweaver. Core functionalities of Dreamweaver means generally anything that can be done with a menu, and more. It also includes various utility APIs for performing such common tasks as reading and writing files, transferring information with HTTP, and communicating with Fireworks and Flash.
The extensive JavaScript API lets you perform a diverse set of smaller tasks. A user would perform many of these tasks when creating or editing Dreamweaver documents. These API functions are grouped by the parts of the Dreamweaver user interface that they affect. For example, the JavaScript API includes Workspace functions, Document functions, Design functions, and so on. The API functions let you perform some of the following tasks and much more in addition to these tasks:
Opening a new document
Getting or setting a font size
Finding the occurrence of a search string in HTML code
Making a toolbar visible
1

About extensions

This book assumes that you are familiar with Dreamweaver, HTML, XML, JavaScript programming and, if applicable, C programming. If you are writing extensions for building web applications, you should also be familiar with server­side scripting on at least one platform, such as Active Server Pages (ASP), ASP.NET, PHP: Hypertext Preprocessor (PHP), Adobe ColdFusion, or Java Server Pages (JSP).

Extending Dreamweaver

To learn about the Dreamweaver framework and the API that enables you to build Dreamweaver extensions, see Extending Dreamweaver. Extending Dreamweaver describes the API functions that Dreamweaver calls to implement the objects, menus, floating panels, server behaviors, and so on, that comprise the various features of Dreamweaver. You can use those APIs to add objects, menus, floating panels, or other features to the product. Extending Dreamweaver also explains how to customize Dreamweaver by editing and adding tags to various HTML and XML files to add menu items or document types, and so on.

Additional resources for extension writers

To communicate with other developers who are involved in writing extensions, join the Dreamweaver extensibility news group. You can access the website for this news group at
http://www.adobe.com/cfusion/webforums/forum/categories.cfm?forumid=12&catid=190.
Last updated 6/15/2011
DREAMWEAVER API REFERENCE
Introduction

New functions in Dreamweaver CS5

The following new functions are added to the Dreamweaver CS5 JavaScript API. The headings designate the chapters and sections that contain the new functions:

Dynamic documents

The following functions are added to the Dynamic documents chapter.
Live view functions
dom.setLiveViewFollowsLinks()” on page 358
dom.getLiveViewFollowsLinks()” on page 358
dom.isLiveViewBrowsingHomeURI()” on page 358
dreamweaver.findSiteForURI()” on page 359
dom.browser.isPageNavigationHistoryEnabled()” on page 360
dom.browser.enablePageNavigationHistory()” on page 361
2
dom.browser.getPageNavigationHistoryLength()” on page 361
dom.browser.getPageNavigationHistoryPosition()” on page 361
dom.browser.goToPageNavigationHistoryPosition()” on page 362
dom.browser.getPageNavigationHistoryItem()” on page 362
dom.browser.setHomePage()” on page 363
dom.browser.getHomePage()” on page 363

Workspace

The following new functions are added to the Workspace chapter.
Related files functions
dreamweaver.getRelatedFilesFilter()” on page 190
dreamweaver.setRelatedFilesFilter()” on page 190
dreamweaver.getQuickRelatedFilesFilterStrings()” on page 190
dreamweaver.invokeRelatedFilesCustomFilterDialog()” on page 191
dreamweaver.getDynamicRelatedFilesDiscoverySetting()” on page 191
dreamweaver.setDynamicRelatedFilesDiscoverySetting()” on page 192
dreamweaver.refreshRelatedFiles()” on page 192
dreamweaver.saveAllRelatedFiles()” on page 192
dreamweaver.canSaveAllRelatedFiles()” on page 193
document.isRelatedFileViewOpen()” on page 193
Last updated 6/15/2011
DREAMWEAVER API REFERENCE
Introduction
document.getRelatedFiles()” on page 193
document.addRelatedFile()” on page 194
document.removeRelatedFile()” on page 195
document.getDependentFiles()” on page 195
...and more.

Document

The following new functions are added to the Document chapter.
DWUri.isValidURI()” on page 275
DWUri.isAbsolute()” on page 275
DWUri.isRelative()” on page 275
DWUri.isDirectory()” on page 276
DWUri.isHierarchical()” on page 276
DWUri.isOfType()” on page 276
3
DWUri.isOfFileType()” on page 277
...and more.

Code

The following new functions are added to the Code chapter.
dom.getLiveCodeHighlightsChanges()” on page 481
dom.setLiveCodeHighlightsChanges()” on page 481
...and more.

Conventions used in this guide

Typographical conventions
The following typographical conventions are used in this guide:
Code font indicates code fragments and API literals, including class names, method names, function names, type
names, scripts, SQL statements, and both HTML and XML tag and attribute names.
Italic code font indicates replaceable items in code.
The continuation symbol (¬ ) indicates that a long line of code has been broken across two or more lines. Due to
margin limits in this book’s format, what is otherwise a continuous line of code must be split. When copying the lines of code, eliminate the continuation symbol and type the lines as one line.
Curly braces ({}) that surround a function argument indicate that the argument is optional.
Last updated 6/15/2011
DREAMWEAVER API REFERENCE
Introduction
Function names that have the prefix dreamweaver.funcname can be abbreviated to dw.funcname when you are
writing code. This manual uses the full examples use the
dw. prefix, however.
dreamweaver. prefix when defining the function and in the index. Many
Naming conventions
The following naming conventions are used in this guide:
You—the developer who is responsible for writing extensions
The user—the person using Dreamweaver
4
Last updated 6/15/2011

Chapter 2: The file I/O API

Adobe® Dreamweaver® CS5 includes a C shared library called DWfile. The DWfile lets authors of objects, commands, behaviors, data translators, floating panels, and Property inspectors read and write files on the local file system. The chapter describes the File I/O API and how to use it.
For general information on how C libraries interact with the JavaScript interpreter in Dreamweaver, see “C-Level Extensibility” in Extending Dreamweaver.

About configuration folders

On Microsoft Windows 2000 and Windows XP, and Mac OS X platforms, users have their own copies of configuration files. Whenever Dreamweaver writes to a configuration file, Dreamweaver writes it to the user’s Configuration folder. Similarly, when Dreamweaver reads a configuration file, Dreamweaver searches for it first in the user’s Configuration folder and then in the Dreamweaver Configuration folder. DWfile functions use the same mechanism. In other words, if your extension reads or writes a file in the Dreamweaver Configuration folder, your extension also accesses the user’s Configuration folder. For more information about configuration folders on multiuser platforms, see Extending Dreamweaver.
5

About the file I/O API

All functions in the file I/O API are methods of the DWfile object.

DWfile.copy()

Availability
Dreamweaver 3.
Description
This function copies the specified file to a new location.
Arguments
originalURL, copyURL
The originalURL argument, which is expressed as a file:// URL, is the file you want to copy.
The copyURL argument, which is expressed as a file:// URL, is the location where you want to save the copied file.
Returns
A Boolean value: true if the copy succeeds; false otherwise.
Example
The following code copies a file called myconfig.cfg to myconfig_backup.cfg:
Last updated 6/15/2011
DREAMWEAVER API REFERENCE
The file I/O API
var fileURL = "file:///c|/Config/myconfig.cfg"; var newURL ="file:///c|/Config/myconfig_backup.cfg"; DWfile.copy(fileURL, newURL);

DWfile.createFolder()

Availability
Dreamweaver 2.
Description
This function creates a folder at the specified location.
Arguments
folderURL
The folderURL argument, which is expressed as a file:// URL, is the location of the folder you want to create.
Returns
A Boolean value: true if the folder is created successfully; false otherwise.
6
Example
The following code tries to create a folder called tempFolder at the top level of the C drive and displays an alert box that indicates whether the operation was successful:
var folderURL = "file:///c|/tempFolder"; if (DWfile.createFolder(folderURL)){
alert("Created " + folderURL);
}else{
alert("Unable to create " + folderURL);
}

DWfile.exists()

Availability
Dreamweaver 2.
Description
This function tests for the existence of the specified file.
Arguments
fileURL
The fileURL argument, which is expressed as a file:// URL, is the requested file.
Returns
A Boolean value: true if the file exists; false otherwise.
Example
The following code checks for the mydata.txt file and displays an alert message that tells the user whether the file exists:
Last updated 6/15/2011
DREAMWEAVER API REFERENCE
The file I/O API
var fileURL = "file:///c|/temp/mydata.txt"; if (DWfile.exists(fileURL)){
alert(fileURL + " exists!");
}else{
alert(fileURL + " does not exist.");
}

DWfile.getAttributes()

Availability
Dreamweaver 2.
Description
This function gets the attributes of the specified file or folder.
Arguments
fileURL
The fileURL argument, which is expressed as a file:// URL, is the file or folder for which you want to get attributes.
7
Returns
A string that represents the attributes of the specified file or folder. If the file or folder does not exist, this function returns a
null value. The following characters in the string represent the attributes:
R is read only.
D is folder.
H is hidden.
S is system file or folder.
Example
The following code gets the attributes of the mydata.txt file and displays an alert box if the file is read only:
var fileURL = "file:///c|/temp/mydata.txt"; var str = DWfile.getAttributes(fileURL); if (str && (str.indexOf("R") != -1)){
alert(fileURL + " is read only!");
}

DWfile.getModificationDate()

Availability
Dreamweaver 2.
Description
This function gets the time when the file was last modified.
Last updated 6/15/2011
DREAMWEAVER API REFERENCE
The file I/O API
Arguments
fileURL
The fileURL argument, which is expressed as a file:// URL, is the file for which you are checking the last modified time.
Returns
A string that contains a hexadecimal number that represents the number of time units that have elapsed since some base time. The exact meaning of time units and base time is platform-dependent; in Windows, for example, a time unit is 100ns, and the base time is January 1st, 1600.
Example
It’s useful to call the function twice and compare the return values because the value that this function returns is platform-dependent and is not a recognizable date and time. The following code example gets the modification dates of file1.txt and file2.txt and displays an alert message that indicates which file is newer:
var file1 = "file:///c|/temp/file1.txt"; var file2 = "file:///c|/temp/file2.txt"; var time1 = DWfile.getModificationDate(file1); var time2 = DWfile.getModificationDate(file2); if (time1 == time2){
alert("file1 and file2 were saved at the same time");
}else if (time1 < time2){
alert("file1 older that file2");
}else{
alert("file1 is newer than file2");
}
8

DWfile.getCreationDate()

Availability
Dreamweaver 4.
Description
This function gets the time when the file was created.
Arguments
fileURL
The fileURL argument, which is expressed as a file:// URL, is the file for which you are checking the creation time.
Returns
A string that contains a hexadecimal number that represents the number of time units that have elapsed since some base time. The exact meaning of time units and base time is platform-dependent; in Windows, for example, a time unit is 100ns, and the base time is January 1st, 1600.
Example
You can call this function and the DWfile.getModificationDate() function on a file to compare the modification date to the creation date:
Last updated 6/15/2011
DREAMWEAVER API REFERENCE
The file I/O API
var file1 = "file:///c|/temp/file1.txt"; var time1 = DWfile.getCreationDate(file1); var time2 = DWfile.getModificationDate(file1); if (time1 == time2){
alert("file1 has not been modified since it was created");
}else if (time1 < time2){
alert("file1 was last modified on " + time2);
}

DWfile.getCreationDateObj()

Availability
Dreamweaver MX.
Description
This function gets the JavaScript object that represents the time when the file was created.
Arguments
fileURL
9
The fileURL argument, which is expressed as a file:// URL, is the file for which you are checking the creation time.
Returns
A JavaScript Date object that represents the date and time when the specified file was created.

DWfile.getModificationDateObj()

Availability
Dreamweaver MX.
Description
This function gets the JavaScript Date object that represents the time when the file was last modified.
Arguments
fileURL
The fileURL argument, which is expressed as a file:// URL, is the file for which you are checking the time of the most
recent modification.
Returns
A JavaScript Date object that represents the date and time when the specified file was last modified.

DWfile.getSize()

Availability
Dreamweaver MX.
Last updated 6/15/2011
DREAMWEAVER API REFERENCE
The file I/O API
Description
This function gets the size of a specified file.
Arguments
fileURL
The fileURL argument, which is expressed as a file:// URL, is the file for which you are checking the size.
Returns
An integer that represents the actual size, in bytes, of the specified file.

DWfile.listFolder()

Availability
Dreamweaver 2.
Description
This function gets a list of the contents of the specified folder.
10
Arguments
folderURL, {constraint}
The folderURL argument is the folder for which you want a contents list, which is expressed as a file:// URL, plus
an optional wildcard file mask. Valid wildcards are asterisks (*), which match one or more characters, and question marks (?), which match a single character.
The constraint argument, if it is supplied, must be either "files" (return only files) or "directories" (return
only folders). If it is omitted, the function returns files and folders.
Returns
An array of strings that represents the contents of the folder.
Example
The following code gets a list of all the text (TXT) files in the C:/temp folder and displays the list in an alert message:
var folderURL = "file:///c|/temp"; var fileMask = "*.txt"; var list = DWfile.listFolder(folderURL + "/" + fileMask, "files"); if (list){
alert(folderURL + " contains: " + list.join("\n"));
}

DWfile.read()

Availability
Dreamweaver 2.
Description
This function reads the contents of the specified file into a string.
Last updated 6/15/2011
DREAMWEAVER API REFERENCE
The file I/O API
Arguments
fileURL
The fileURL argument, which is expressed as a file:// URL, is the file you want to read.
Returns
A string that contains the contents of the file or a null value if the read fails.
Example
The following code reads the mydata.txt file and, if it is successful, displays an alert message with the contents of the file:
var fileURL = "file:///c|/temp/mydata.txt"; var str = DWfile.read(fileURL); if (str){
alert(fileURL + " contains: " + str);
}

DWfile.remove()

Availability
Dreamweaver 3.
11
Description
This function deletes the specified file.
Arguments
fileURL
The fileURL argument, which is expressed as a file:// URL, is the file you want to remove.
Returns
A Boolean value: true value if the operation succeeds; false otherwise.
Example
The following example uses the DWfile.getAttributes() function to determine whether the file is read-only and
confirm() function to display a Yes/No dialog box to the user:
the
function deleteFile(){
var delAnyway = false; var selIndex = document.theForm.menu.selectedIndex;
var selFile = document.theForm.menu.options[selIndex].value;
if (DWfile.getAttributes(selFile).indexOf('R') != -1){
delAnyway = confirm('This file is read-only. Delete anyway?'); if (delAnyway){
DWfile.remove(selFile);
}
}
}
Last updated 6/15/2011
DREAMWEAVER API REFERENCE
The file I/O API

DWfile.setAttributes()

Availability
Dreamweaver MX.
Description
This function sets the system-level attributes of a particular file.
Arguments
fileURL, strAttrs
The fileURL argument, which is expressed as a file:// URL, identifies the file for which you are setting the attributes.
The strAttrs argument specifies the system-level attributes for the file that is identified by the fileURL argument.
The following table describes valid attribute values and their meaning:
Attribute Value Description
12
R
W
H
V
Read only
Writable (overrides R)
Hidden
Visible (overrides H)
Acceptable values for the strAttrs string are R, W, H, V, RH, RV, WH, or WV.
You should not use R and W together because they are mutually exclusive. If you combine them, R becomes meaningless, and the file is set as writable ( exclusive. If you combine them,
H becomes meaningless, and the file is set as visible (V).
W). You should not use H and V together because they are also mutually
If you specify H or V without specifying an R or W read/write attribute, the existing read/write attribute for the file is not changed. Likewise, if you specify
R or W, without specifying an H or V visibility attribute, the existing visibility
attribute for the file is not changed.
Returns
Nothing.

DWfile.write()

Availability
Dreamweaver 2.
Description
This function writes the specified string to the specified file. If the specified file does not yet exist, it is created.
Arguments
fileURL, text, {mode}
The fileURL argument, which is expressed as a file://URL, is the file to which you are writing.
Note: If the path contains spaces, this function will not write files.
Last updated 6/15/2011
DREAMWEAVER API REFERENCE
The file I/O API
The text argument indicates the string the function has to write.
The mode argument, if it is supplied, must be append. If this argument is omitted, the string overwrites the contents
of the file.
Returns
A Boolean value: true if the string is successfully written to the file; false otherwise.
Example
The following code attempts to write the string xxx to the mydata.txt file and displays an alert message if the write operation succeeds. It then tries to append the string succeeds. After executing this script, the mydata.txt file contains the text
var fileURL = "file:///c|/temp/mydata.txt"; if (DWfile.write(fileURL, "xxx")){
alert("Wrote xxx to " + fileURL); } if (DWfile.write(fileURL, "aaa", "append")){
alert("Appended aaa to " + fileURL); }
aaa to the file and displays a second alert if the write operation
xxxaaa and nothing else.
13
Last updated 6/15/2011

Chapter 3: The HTTP API

Extensions are not limited to working in the local file system. Adobe® Dreamweaver® provides a mechanism to get information from and send information to a web server by using hypertext transfer protocol (HTTP). The chapter describes the HTTP API and how to use it.

How the HTTP API works

All functions in the HTTP API are methods of the MMHttp object. Most of these functions take a URL as an argument, and most return an object. The default port for URL arguments is 80. To specify a port other than 80, append a colon and the port number to the URL, as shown in the following example:
MMHttp.getText("http://www.myserver.com:8025");
For functions that return an object, the object has two properties: statusCode and data.
The statusCode property indicates the status of the operation; possible values include, but are not limited to, the following values:
14
200: Status OK
400: Unintelligible request
404: Requested URL not found
405: Server does not support requested method
500: Unknown server error
503: Server capacity reached
For a comprehensive list of status codes for your server, check with your Internet service provider or system administrator.
The value of the data property varies according to the function; possible values are specified in the individual function listings.
Functions that return an object also have a callback version. Callback functions let other functions execute while the web server processes an HTTP request. This capability is useful if you are making multiple HTTP requests from Dreamweaver. The callback version of a function passes its ID and return value directly to the function that is specified as its first argument.

The HTTP API

This section details the functions that are methods of the MMHttp object.

MMHttp.clearServerScriptsFolder()

Availability
Dreamweaver MX.
Last updated 6/15/2011
DREAMWEAVER API REFERENCE
The HTTP API
Description
Deletes the _mmServerScripts folder—and all its files—under the root folder for the current site, which can be local or remote. The _mmServerScripts folder is located in Configuration/Connections/Scripts/server-model/_mmDBScripts folder.
Arguments
serverScriptsfolder
The serverScriptsfolder argument is a string that names a particular folder, relative to the Configuration folder on
the application server, from which you want to retrieve and clear server scripts.
Returns
An object that represents the reply from the server. The data property of this object is a string that contains the contents of the deleted scripts. If an error occurs, Dreamweaver reports it in the
statusCode property of the returned
object.
Example
The following code, in a menu command file inside the Configuration/Menus folder, removes all the files from the _mmServerScripts folder when it is called from a menu:
15
<!-- MENU-LOCATION=NONE --> <html> <head> <TITLE>Clear Server Scripts</TITLE> <SCRIPT SRC="ClearServerScripts.js"></SCRIPT> <SCRIPT LANGUAGE="javascript"> </SCRIPT> <body onLoad="MMHttp.clearServerScriptsFolder()"> </body> </html>

MMHttp.clearTemp()

Description
This function deletes all the files in the Configuration/Temp folder, which is located in the Dreamweaver application folder.
Arguments
None.
Returns
Nothing.
Example
The following code, when saved in a file within the Configuration/Shutdown folder, removes all the files from the Configuration/Temp folder when the user quits Dreamweaver:
Last updated 6/15/2011
DREAMWEAVER API REFERENCE
The HTTP API
<html> <head> <title>Clean Up Temp Files on Shutdown</title> </head> <body onLoad="MMHttp.clearTemp()"> </body> </html>

MMHttp.getFile()

Description
This function gets the file at the specified URL and saves it in the Configuration/Temp folder, which is located in the Dreamweaver application folder. Dreamweaver automatically creates subfolders that mimic the folder structure of the server; for example, if the specified file is at www.dreamcentral.com/people/index.html, Dreamweaver stores the index.html file in the People folder inside the www.dreamcentral.com folder.
Arguments
URL, {prompt}, {saveURL}, {titleBarLabel}
The URL argument is an absolute URL on a web server; if http:// is omitted from the URL, Dreamweaver assumes
HTTP protocol.
The prompt argument, which is optional, is a Boolean value that specifies whether to prompt the user to save the
file. If saveURL is outside the Configuration/Temp folder, a prompt value of
The saveURL argument, which is optional, is the location on the user’s hard disk where the file should be saved,
which is expressed as a file:// URL. If prompt is a
true value or saveURL is outside the Configuration/Temp folder,
the user can override saveURL in the Save dialog box.
The titleBarLabel argument, which is optional, is the label that should appear in the title bar of the Save dialog box.
false is ignored for security reasons.
16
Returns
An object that represents the reply from the server. The data property of this object is a string that contains the location where the file is saved, which is expressed as a file:// URL. Normally, the
statusCode property of the object
contains the status code that is received from the server. However, if a disk error occurs while Dreamweaver is saving the file on the local drive, the
statusCode property contains an integer that represents one of the following error codes
if the operation is not successful:
1: Unspecified error
2: File not found
3: Invalid path
4: Number of open files limit reached
5: Access denied
6: Invalid file handle
7: Cannot remove current working folder
8: No more folder entries
9: Error setting file pointer
10: Hardware error
11: Sharing violation
Last updated 6/15/2011
DREAMWEAVER API REFERENCE
The HTTP API
12: Lock violation
13: Disk full
14: End of file reached
Example
The following code gets an HTML file, saves all the files in the Configuration/Temp folder, and then opens the local copy of the HTML file in a browser:
var httpReply = MMHttp.getFile("http://www.dreamcentral.com/people/profiles/scott.html", false); if (Boolean == 200){
var saveLoc = httpReply.data;
dw.browseDocument(saveLoc); }

MMHttp.getFileCallback()

Description
This function gets the file at the specified URL, saves it in the Configuration/Temp folder inside the Dreamweaver application folder, and then calls the specified function with the request ID and reply result. When saving the file locally, Dreamweaver automatically creates subfolders that mimic the folder structure of the server; for example, if the specified file is at www.dreamcentral.com/people/index.html, Dreamweaver stores the index.html file in the People folder inside the www.dreamcentral.com folder.
17
Arguments
callbackFunction, URL, {prompt}, {saveURL}, {titleBarLabel}
The callbackFunction argument is the name of the JavaScript function to call when the HTTP request is complete.
The URL argument is an absolute URL on a web server; if http:// is omitted from the URL, Dreamweaver assumes
HTTP protocol.
The prompt argument, which is optional, is a Boolean value that specifies whether to prompt the user to save the
file. If saveURL argument specifies a location outside the Configuration/Temp folder, a prompt value of
false is
ignored for security reasons.
The saveURL argument, which is optional, is the location on the user’s hard disk where the file should be saved,
which is expressed as a file:// URL. If prompt is a
true value or saveURL is outside the Configuration/Temp folder,
the user can override saveURL in the Save dialog box.
The titleBarLabel argument, which is optional, is the label that should appear in the title bar of the Save dialog box.
Returns
An object that represents the reply from the server. The data property of this object is a string that contains the location where the file was saved, which is expressed as a file:// URL. Normally the
statusCode property of the object
contains the status code that is received from the server. However, if a disk error occurs while Dreamweaver is saving the file on the local drive, the
statusCode property contains an integer that represents an error code. See
MMHttp.getFile()” on page 16 for a list of possible error codes.
Last updated 6/15/2011
DREAMWEAVER API REFERENCE
The HTTP API

MMHttp.getText()

Availability
Dreamweaver UltraDev 4, enhanced in Dreamweaver MX.
Description
Retrieves the contents of the document at the specified URL.
Arguments
URL, {serverScriptsFolder}
The URL argument is an absolute URL on a web server. If http:// is omitted from the URL, Dreamweaver assumes
HTTP protocol.
The serverScriptsFolder argument is an optional string that names a particular folder—relative to the Configuration
folder on the application server—from which you want to retrieve server scripts. To retrieve the scripts, Dreamweaver uses the appropriate transfer protocol (such as FTP, WebDAV, or Remote File System). Dreamweaver copies these files to the _mmServerScripts subfolder under the root folder for the current site.
If an error occurs, Dreamweaver reports it in the statusCode property of the returned object.
18

MMHttp.getTextCallback()

Availability
Dreamweaver UltraDev 4, enhanced in Dreamweaver MX.
Description
Retrieves the contents of the document at the specified URL and passes it to the specified function.
Arguments
callbackFunc, URL, {serverScriptsFolder}
The callbackFunc argument is the JavaScript function to call when the HTTP request is complete.
The URL argument is an absolute URL on a web server; if http:// is omitted from the URL, Dreamweaver assumes
HTTP protocol.
The serverScriptsFolder argument is an optional string that names a particular folder—relative to the Configuration
folder on the application server—from which you want to retrieve server scripts. To retrieve the scripts, Dreamweaver uses the appropriate transfer protocol (such as FTP, WebDAV, or Remote File System). Dreamweaver retrieves these files and passes them to the function that callbackFunc identifies.
If an error occurs, Dreamweaver MX reports it in the statusCode property of the returned object.

MMHttp.postText()

Availability
Dreamweaver UltraDev 4, enhanced in Dreamweaver MX.
Last updated 6/15/2011
DREAMWEAVER API REFERENCE
The HTTP API
Description
Performs an HTTP post of the specified data to the specified URL. Typically, the data associated with a post operation is form-encoded text, but it could be any type of data that the server expects to receive.
Arguments
URL, dataToPost, {contentType}, {serverScriptsFolder}
The URL argument is an absolute URL on a web server; if http:// is omitted from the URL, Dreamweaver assumes
HTTP protocol.
The dataToPost argument is the data to post. If the third argument is "application/x-www-form-urlencoded"
or omitted, dataToPost must be form-encoded according to section 8.2.1 of the RFC 1866 specification (available
www.faqs.org/rfcs/rfc1866.html).
at
The contentType argument, which is optional, is the content type of the data to post. If omitted, this argument
defaults to
"application/x-www-form-urlencoded".
The serverScriptsFolder argument is an optional string that names a particular folder—relative to the Configuration
folder on the application server—to which you want to post the data. To post the data, Dreamweaver uses the appropriate transfer protocol (such as FTP, WebDAV, or Remote File System).
If an error occurs, Dreamweaver reports it in the statusCode property of the returned object.
19
Example
In the following example of an MMHttp.postText() function call, assume that a developer has placed the myScripts.cfm file in a folder named DeployScripts, which is located in the Configuration folder on the local computer:
MMHttp.postText(
"http://ultraqa8/DeployScripts/myScripts.cfm",
"arg1=Foo",
"application/x-www-form-urlencoded",
"Configuration/DeployScripts/" )
When Dreamweaver executes this function call, the following sequence occurs:
1 The myScripts.cfm file in the Configuration/DeployScripts folder on the local computer is copied to another folder
named DeployScripts, which is a subfolder of the root folder on the ultraqa8 website. To deploy the files, Dreamweaver uses the protocol specified in the site configuration properties.
2 Dreamweaver uses HTTP protocol to post the arg1=Foo data to the web server.
3 As a result of the post request, the web server on ultraqa8 executes the myScripts.cfm script using the arg1 data.

MMHttp.postTextCallback()

Availability
Dreamweaver UltraDev 4, enhanced in Dreamweaver MX.
Description
Performs an HTTP post of the text to the specified URL and passes the reply from the server to the specified function. Typically, the data associated with a post operation is form-encoded text, but it could be any type of data that the server expects to receive.
Last updated 6/15/2011
DREAMWEAVER API REFERENCE
The HTTP API
Arguments
callbackFunc, URL, dataToPost, {contentType}, {serverScriptsFolder}
The callbackFunc argument is the name of the JavaScript function to call when the HTTP request is complete.
The URL argument is an absolute URL on a web server; if http:// is omitted from the URL, Dreamweaver assumes
HTTP protocol.
The dataToPost argument is the data to be posted. If the third argument is "application/x-www-form-
urlencoded" or omitted, data must be form-encoded according to section 8.2.1 of the RFC 1866 specification
(available at
www.faqs.org/rfcs/rfc1866.html).
The contentType argument, which is optional, is the content type of the data to be posted. If omitted, this argument
defaults to
"application/x-www-form-urlencoded".
The serverScriptsFolder argument is an optional string. It names a particular folder, relative to the Configuration
folder on the application server—to which you want to post the data. To post the data, Dreamweaver uses the appropriate transfer protocol (such as FTP, WebDAV, or Remote File System). Dreamweaver retrieves these data and passes them to the function identified by callbackFunc.
If an error occurs, Dreamweaver reports it in the statusCode property of the returned object.
20
Last updated 6/15/2011

Chapter 4: The Design Notes API

Adobe® Dreamweaver®, Adobe® Fireworks®, and Adobe® Flash® give web designers and developers a way to store and retrieve extra information about documents. The information is stored in files that are called Design Notes. It gives extra information about documents like review comments, change notes, or the source file for a GIF or JPEG.
For more information about using the Design Notes feature from within Dreamweaver, see Using Dreamweaver.

How Design Notes work

Each Design Notes file stores information for a single document. If one or more documents in a folder has an associated Design Notes file, Dreamweaver creates a _notes subfolder where Design Notes files can be stored. The _notes folder and the Design Notes files that it contains are not visible in the Site panel, but they appear in the Finder (Macintosh) or Windows Explorer. A Design Notes filename comprises the main filename plus the .mno extension. For example, the Design Notes file that is associated with avocado8.gif is avocado8.gif.mno.
Design Notes files are XML files that store information in a series of key/value pairs. The key describes the type of information that is being stored, and the value represents the information. Keys are limited to 64 characters.
21
The following example shows the Design Notes file for foghorn.gif.mno:
<?xml version="1.0" encoding="iso-8859-1" ?> <info>
<infoitem key="FW_source" value="file:///C|sites/dreamcentral/images/sourceFiles/¬
foghorn.png" /> <infoitem key="Author" value="Heidi B." /> <infoitem key="Status" value="Final draft, approved by Jay L." />
</info>

The Design Notes JavaScript API

All functions in the Design Notes JavaScript API are methods of the MMNotes object. MMNotes is a C shared library that lets extensions authors read and write Design Notes files. As with the DWfile shared library, MMNotes has a JavaScript API that lets you call the functions. The functions are called from objects, commands, behaviors, floating panels, Property inspectors, and data translators in the library. The MMNotes shared library can be used independently, even if Dreamweaver is not installed.

MMNotes.close()

Description
This function closes the specified Design Notes file and saves any changes. If all the key/value pairs are removed, Dreamweaver deletes the Design Notes file. If it is the last Design Notes file in the _notes folder, Dreamweaver deletes the folder also.
Note: Always call the MMNotes.close() function when you finish with Design Notes so Dreamweaver writes to the file.
Last updated 6/15/2011
DREAMWEAVER API REFERENCE
The Design Notes API
Arguments
fileHandle
The fileHandle argument is the file handle that the MMNotes.open() function returns.
Returns
Nothing.
Example
See “MMNotes.set()” on page 26.

MMNotes.filePathToLocalURL()

Description
This function converts the specified local drive path to a file:// URL.
Arguments
drivePath
22
The drivePath argument is a string that contains the full drive path.
Returns
A string that contains the file:// URL for the specified file.
Example
A call to MMNotes.filePathToLocalURL('C:\sites\webdev\index.htm') returns
"file:///c|/sites/webdev/index.htm".

MMNotes.get()

Description
This function gets the value of the specified key in the specified Design Notes file.
Arguments
fileHandle, keyName
The fileHandle argument is the file handle that MMNotes.open() returns.
The keyName argument is a string that contains the name of the key.
Returns
A string that contains the value of the key.
Example
See “MMNotes.getKeys()” on page 23.
Last updated 6/15/2011
DREAMWEAVER API REFERENCE
The Design Notes API

MMNotes.getKeyCount()

Description
This function gets the number of key/value pairs in the specified Design Notes file.
Arguments
fileHandle
The fileHandle argument is the file handle that the MMNotes.open() function returns.
Returns
An integer that represents the number of key/value pairs in the Design Notes file.

MMNotes.getKeys()

Description
This function gets a list of all the keys in a Design Notes file.
23
Arguments
fileHandle
The fileHandle argument is the file handle that the MMNotes.open() function returns.
Returns
An array of strings where each string contains the name of a key.
Example
The following code might be used in a custom floating panel to display the Design Notes information for the active document:
var noteHandle = MMNotes.open(dw.getDocumentDOM().URL); var theKeys = MMNotes.getKeys(noteHandle); var noteString = ""; var theValue = ""; for (var i=0; i < theKeys.length; i++){
theValue = MMNotes.get(noteHandle,theKeys[i]); noteString +=0theKeys[i] + " = " theValue + "\n";
} document.theForm.bigTextField.value = noteString; // always close noteHandle MMNotes.close(noteHandle);

MMNotes.getSiteRootForFile()

Description
This function determines the site root for the specified Design Notes file.
Last updated 6/15/2011
DREAMWEAVER API REFERENCE
The Design Notes API
Arguments
fileURL
The fileURL argument, which is expressed as a file:// URL, is the path to a local file.
Returns
A string that contains the path of the Local Root folder for the site, which is expressed as a file:// URL, or an empty string if Dreamweaver is not installed or the Design Notes file is outside any site that is defined with Dreamweaver. This function searches for all the sites that are defined in Dreamweaver.

MMNotes.getVersionName()

Description
This function gets the version name of the MMNotes shared library, which indicates the application that implemented it.
Arguments
None.
Returns
A string that contains the name of the application that implemented the MMNotes shared library.
24
Example
Calling the MMNotes.getVersionName() function from a Dreamweaver command, object, behavior, Property inspector, floating panel, or data translator returns function from Fireworks also returns was created by the Dreamweaver engineering team.
"Dreamweaver" because Fireworks uses the same version of the library, which
"Dreamweaver". Calling the MMNotes.getVersionName()

MMNotes.getVersionNum()

Description
This function gets the version number of the MMNotes shared library.
Arguments
None.
Returns
A string that contains the version number.

MMNotes.localURLToFilePath()

Description
This function converts the specified file:// URL to a local drive path.
Last updated 6/15/2011
DREAMWEAVER API REFERENCE
The Design Notes API
Arguments
fileURL
The fileURL argument, which is expressed as a file:// URL, is the path to a local file.
Returns
A string that contains the local drive path for the specified file.
Example
A call to MMNotes.localURLToFilePath('file:///MacintoshHD/images/moon.gif') returns
"MacintoshHD:images:moon.gif".

MMNotes.open()

Description
This function opens the Design Notes file that is associated with the specified file or creates one if none exists.
Arguments
filePath, {bForceCreate}
25
The filePath argument, which is expressed as a file:// URL, is the path to the main file with which the Design Notes
file is associated.
The bForceCreate argument is a Boolean value that indicates whether to create the note even if Design Notes is
turned off for the site or if the filePath argument is not associated with any site.
Returns
The file handle for the Design Notes file or 0 if the file was not opened or created.
Example
See “MMNotes.set()” on page 26.

MMNotes.remove()

Description
The function removes the specified key (and its value) from the specified Design Notes file.
Arguments
fileHandle, keyName
The fileHandle argument is the file handle that the MMNotes.open() function returns.
The keyName argument is a string that contains the name of the key to remove.
Returns
A Boolean value: true indicates the operation is successful; false otherwise.
Last updated 6/15/2011
Loading...
+ 498 hidden pages