d DREAMWEAVER 8 Extending Dreamweaver
Extending Dreamweaver
Contents Introduction 9 Background Installing an extension Creating an extension Additional resources for extension writers What's new in Dreamweaver Conventions used in this guide 113 PART 1: CUSTOMIZING DREAMWEAVER Chapter 1: Customizing Dreamweaver weav Customizing Dreamweaver in a multiuser environment Working with browser profiles Changing FTPl Extensible document types in Dreamweaver Chapter 2: Customizing Code view 55 C 55 Code coloring Code validation Changing default HTML formatting PART 2: OVERVIEW OF EXTENDING DREAMWEAVER Chapter 3: Extending Dreamweaver Types of Dreamweaver extensions Configuration folders and extensions 9o25 Extension APls Localizing an extension 107 Working with the Extension manager 109
3 Contents Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .9 Background . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .9 Installing an extension . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10 Creating an extension . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10 Additional resources for extension writers . . . . . . . . . . . . . . . . . . . . . . . . .11 What’s new in Dreamweaver . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .11 Conventions used in this guide . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13 PART 1: CUSTOMIZING DREAMWEAVER Chapter 1: Customizing Dreamweaver . . . . . . . . . . . . . . . . . . . . . . 17 Ways to customize Dreamweaver . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17 Customizing Dreamweaver in a multiuser environment. . . . . . . . . . . . .27 Working with browser profiles. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 30 Changing FTP mappings . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 34 Extensible document types in Dreamweaver . . . . . . . . . . . . . . . . . . . . . 35 Chapter 2: Customizing Code View . . . . . . . . . . . . . . . . . . . . . . . 55 Code hints . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 55 Code coloring . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 63 Code validation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 92 Changing default HTML formatting . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 95 PART 2: OVERVIEW OF EXTENDING DREAMWEAVER Chapter 3: Extending Dreamweaver . . . . . . . . . . . . . . . . . . . . . . 99 Types of Dreamweaver extensions . . . . . . . . . . . . . . . . . . . . . . . . . . . . 100 Configuration folders and extensions. . . . . . . . . . . . . . . . . . . . . . . . . . . .102 Extension APIs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .105 Localizing an extension. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 107 Working with the Extension Manager . . . . . . . . . . . . . . . . . . . . . . . . . . .109
Chapter 4: User Interfaces for Extensions Designing an extension user interface 111 Dreamweaver HTML rendering control Using custom UI controls in extensions Adding Flash content to Dreamweaver Chapter 5: The Dreamweaver Document Object Model Which document Dom? The Dreamweaver dOM PART 3: EXTENSION APIS Chapter 6: Insert Bar objects How object files work The insert bar definition file Modifying the Insert bar A simple insert object example The Objects API Chapter 7: Commands 167 How commands work 167 Adding commands to the Commands menu A simple command example 168 The Commands APl Chapter 8: Menus and Menu Commands About the menus. xml file Changing menus and menu commands Menu commands 194 A simple menu command example A dynamic menu example 201 Chapter 9: Toolbars ..21 How toolbars work .215 a simple toolbar command file 218 The toolbar definition file 220 Toolbar item tags. .226 Item tag attributes The toolbar command api 238
4 Contents Chapter 4: User Interfaces for Extensions. . . . . . . . . . . . . . . . . . . 111 Designing an extension user interface . . . . . . . . . . . . . . . . . . . . . . . . . . . 111 Dreamweaver HTML rendering control . . . . . . . . . . . . . . . . . . . . . . . . . .112 Using custom UI controls in extensions . . . . . . . . . . . . . . . . . . . . . . . . . .113 Adding Flash content to Dreamweaver . . . . . . . . . . . . . . . . . . . . . . . . . 124 Chapter 5: The Dreamweaver Document Object Model . . . . . . 127 Which document DOM? . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 128 The Dreamweaver DOM . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 128 PART 3: EXTENSION APIS Chapter 6: Insert Bar Objects . . . . . . . . . . . . . . . . . . . . . . . . . . . . 139 How object files work . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 140 The Insert bar definition file . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .141 Modifying the Insert bar . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 148 A simple insert object example. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 150 The Objects API. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .161 Chapter 7: Commands . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 167 How commands work. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 167 Adding commands to the Commands menu . . . . . . . . . . . . . . . . . . . . . 168 A simple command example . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 168 The Commands API . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 176 Chapter 8: Menus and Menu Commands . . . . . . . . . . . . . . . . . . 181 About the menus.xml file . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 182 Changing menus and menu commands . . . . . . . . . . . . . . . . . . . . . . . . . .191 Menu commands . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 194 A simple menu command example . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 197 A dynamic menu example . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 201 The Menu Commands API . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 209 Chapter 9: Toolbars . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 215 How toolbars work . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 215 A simple toolbar command file . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 218 The toolbar definition file . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 220 Toolbar item tags. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .226 Item tag attributes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .232 The toolbar command API. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .238
Chapter 10: Reports Site 249 Stand-alone reports The Reports APl 256 Chapter 11: Tag Libraries and Editors Tag libra The Tag Chooser 268 A simple example of creating a new tag editor Tag editor APIs Chapter 12: Property Inspectors How Property inspector files a simple Property inspector example 282 The Property inspector APl Chapter 13: Floating Panels 289 How floating panel files work 290 A simple floating panel example The Floating panel API 297 Chapter 14: Behaviors How Behaviors work 306 A simple behavior example The Behaviors apl Chapter 15: Server Behaviors Dreamweaver architecture A simple server behavior example 324 How the server Behavior api functions are called The server Behavior APl Server behavior implementation functions 335 Editing EDML files 337 Group EDML file tags 340 Participant EDML files Server behavior techniques ontents 5
Contents 5 Chapter 10: Reports . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 249 Site reports . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 249 Stand-alone reports. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 253 The Reports API . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 256 Chapter 11: Tag Libraries and Editors . . . . . . . . . . . . . . . . . . . . . . 261 Tag library file format . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 262 The Tag Chooser . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 268 A simple example of creating a new tag editor . . . . . . . . . . . . . . . . . . 270 Tag editor APIs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 275 Chapter 12: Property Inspectors . . . . . . . . . . . . . . . . . . . . . . . . . 279 How Property inspector files work . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .281 A simple Property inspector example . . . . . . . . . . . . . . . . . . . . . . . . . . 282 The Property inspector API . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 285 Chapter 13: Floating Panels. . . . . . . . . . . . . . . . . . . . . . . . . . . . . 289 How floating panel files work. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 290 A simple floating panel example . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .291 The Floating panel API . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 297 Chapter 14: Behaviors . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 305 How Behaviors work . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 306 A simple behavior example. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 307 The Behaviors API . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .312 Chapter 15: Server Behaviors . . . . . . . . . . . . . . . . . . . . . . . . . . . . 321 Dreamweaver architecture . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 322 A simple server behavior example . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 324 How the Server Behavior API functions are called. . . . . . . . . . . . . . . 326 The Server Behavior API . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 329 Server behavior implementation functions . . . . . . . . . . . . . . . . . . . . . . 335 Editing EDML files . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 337 Group EDML file tags . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 340 Participant EDML files . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 347 Server behavior techniques . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 369
Chapter 16: Data Sources 379 How data sources work 380 A simple data source example The Data Sources APl Chapter 17: Server Formats How data formatting works 400 When the data formatting functions are called 402 The server Formats APl 403 Chapter 18: Components 40 Component basics 407 Extending the Components panel 408 How to customize the Components panel 408 Components panel files Components panel API functions Chapter 19: Server Models How customizing server models works The server Model APi functions Chapter 20: Data Translators 433 How data translators work 434 determining what kind of translator to use .435 Adding a translated attribute to a tag .435 Inspecting translated attributes Locking translated tags or blocks of code Creating Property inspectors for locked content 439 Finding bugs in your translator A simple attribute translator example 443 A simple block/tag translator example 447 The Data Translator APl Chapter 21: C-Level Extensibility 457 How integrating C functions works C-level extensibility and the Java Script interpreter 459 Data types The c-level APl File Access and Multiuser Configuration API 470 Calling a C function from JavaScrip 6 Contents
6 Contents Chapter 16: Data Sources . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 379 How data sources work . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 380 A simple data source example . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .382 The Data Sources API . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 391 Chapter 17: Server Formats. . . . . . . . . . . . . . . . . . . . . . . . . . . . . 399 How data formatting works . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 400 When the data formatting functions are called . . . . . . . . . . . . . . . . . . 402 The Server Formats API . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 403 Chapter 18: Components . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 407 Component basics. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .407 Extending the Components panel . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 408 How to customize the Components panel . . . . . . . . . . . . . . . . . . . . . . 408 Components panel files . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 409 Components panel API functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 412 Chapter 19: Server Models . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 423 How customizing server models works . . . . . . . . . . . . . . . . . . . . . . . . .423 The Server Model API functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 424 Chapter 20: Data Translators . . . . . . . . . . . . . . . . . . . . . . . . . . . 433 How data translators work. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 434 Determining what kind of translator to use . . . . . . . . . . . . . . . . . . . . . .435 Adding a translated attribute to a tag . . . . . . . . . . . . . . . . . . . . . . . . . . .435 Inspecting translated attributes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .437 Locking translated tags or blocks of code . . . . . . . . . . . . . . . . . . . . . . .437 Creating Property inspectors for locked content . . . . . . . . . . . . . . . . 439 Finding bugs in your translator . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 442 A simple attribute translator example . . . . . . . . . . . . . . . . . . . . . . . . . . 443 A simple block/tag translator example . . . . . . . . . . . . . . . . . . . . . . . . . .447 The Data Translator API. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 452 Chapter 21: C-Level Extensibility . . . . . . . . . . . . . . . . . . . . . . . . 457 How integrating C functions works . . . . . . . . . . . . . . . . . . . . . . . . . . . . .457 C-level extensibility and the JavaScript interpreter . . . . . . . . . . . . . . 459 Data types . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 460 The C-level API . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 461 File Access and Multiuser Configuration API . . . . . . . . . . . . . . . . . . . .470 Calling a C function from JavaScript. . . . . . . . . . . . . . . . . . . . . . . . . . . .479