Our partners wish to propose you the following products
Visit MACROMEDIA official site
User manual MACROMEDIA DREAMWEAVER MX 2004- EXTENDING DREAMWEAVER
Diplodocs help download the user guide MACROMEDIA DREAMWEAVER MX 2004- EXTENDING DREAMWEAVER.
Preview of the first 3 pages of manual
You either have JavaScript turned off or an old version of Adobe Flash Player
Get the latest Flash Player.
User guide MACROMEDIA DREAMWEAVER MX 2004- EXTENDING DREAMWEAVER
Detailed instructions for use are in the User's Guide.
Extending Dreamweaver
Trademarks Add Life to the Web, Afterburner, Aftershock, Andromedia, Allaire, Animation PowerPack, Aria, Attain, Authorware, Authorware Star, Backstage, Bright Tiger, Clustercats, Cold Fusion, Contribute, Design in Motion, Director, Dream Templates, Dreamweaver, Drumbeat 2000, EDJE, EJIPT, Extreme 3D, Fireworks, Flash, Fontographer, FreeHand, Generator, HomeSite, JFusion, JRun, Kawa, Know Your Site, Knowledge Objects, Knowledge Stream, Knowledge Track, LikeMinds, Lingo, Live Effects, MacRecorder Logo and Design, Macromedia, Macromedia Action!, Macromedia Flash, Macromedia M Logo & Design, Macromedia Spectra, Macromedia xRes Logo and Design, MacroModel, Made with Macromedia, Made with Macromedia Logo and Design, MAGIC Logo and Design, Mediamaker, Movie Critic, Open Sesame!, Roundtrip HTML, Shockwave, Sitespring, SoundEdit, Titlemaker, UltraDev, Web Design 101, what the web can be, and Xtra are either registered or trademarks of Macromedia, Inc. and may be registered in the United States or in other jurisdictions including internationally. Other product names, logos, designs, titles, words or phrases mentioned within this publication may be trademarks, servicemarks, or tradenames of Macromedia, Inc. or other entities and may be registered in certain jurisdictions including internationally. Third-Party Information This guide contains links to third-party websites that are not under the control of Macromedia, and Macromedia is not responsible for the content on any linked site. If you access a third-party website mentioned in this guide, then you do so at your own risk. Macromedia provides these links only as a convenience, and the inclusion of the link does not imply that Macromedia endorses or accepts any responsibility for the content on those third-party sites. Third Party Software Notices and/or Additional Terms and Conditions can be found at www.macromedia.com/go/thirdparty/. Opera ® browser Copyright © 1995-2002 Opera Software ASA and its suppliers. All rights reserved. Apple Disclaimer APPLE COMPUTER, INC. MAKES NO WARRANTIES, EITHER EXPRESS OR IMPLIED, REGARDING THE ENCLOSED COMPUTER SOFTWARE PACKAGE, ITS MERCHANTABILITY OR ITS FITNESS FOR ANY PARTICULAR PURPOSE. THE EXCLUSION OF IMPLIED WARRANTIES IS NOT PERMITTED BY SOME STATES. THE ABOVE EXCLUSION MAY NOT APPLY TO YOU. THIS WARRANTY PROVIDES YOU WITH SPECIFIC LEGAL RIGHTS. THERE MAY BE OTHER RIGHTS THAT YOU MAY HAVE WHICH VARY FROM STATE TO STATE. Copyright © 1997-2003 Macromedia, Inc and its licensors. All rights reserved. This manual may not be copied, photocopied, reproduced, translated, or converted to any electronic or machine-readable form in whole or in part without prior written approval of Macromedia, Inc. Part Number ZDW70M300 Acknowledgments Senior Management: Sheila McGinn Project Management: Robert Berry Writing: Robert Berry, David Jacowitz Editing Management: Lisa Stanziano Editing: Mary Kraemer, Noreen Maher Production Management: Patrice O'Neill Media Design and Production: Adam Barnett, Aaron Begley, Chris Basmajian, John Francis, Jeff Harmon Special thanks to Jay London, Jeff Schang, Lori Hylan-Cho, Hisami Scott, Sam Mathews, Jake Cockrell, Russ Helfand, Randy Edmunds, George Comninos, Rosana Francescato, Charles Nadeau, and the entire Dreamweaver engineering and QA teams. First Edition: September 2003 Macromedia, Inc. 600 Townsend St. San Francisco, CA 94103
CONTENTS
CHAPTER 1: Introduction.
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13 14 14 14 15 15 16 16 16 17
Background. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Installing an extension. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Additional resources for extension writers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . What's new in Extending Dreamweaver. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Documentation Changes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Macromedia Press. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Removed Features . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Errata . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Conventions used in this guide . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
PART I: Overview
CHAPTER 2: Extending Dreamweaver .
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 21 21 22 23 25 25 25 26 27 27 27 28 28 29 29 29 31 32 32 32 32
Types of Dreamweaver extensions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Other ways to extend Dreamweaver . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Configuration folders and extensions. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Multiuser Configuration folders . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Running scripts at startup or shutdown . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Extension APIs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . How Dreamweaver processes JavaScript in extensions. . . . . . . . . . . . . . . . . . . . Displaying Help . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Localizing an extension . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . XML String files . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Localizable Strings with Embedded Values . . . . . . . . . . . . . . . . . . . . . . . . . . . . Working with the Extension Manager . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Customizing Dreamweaver . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . About customizing Dreamweaver . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . About customizing Dreamweaver in a multiuser environment . . . . . . . . . . . . . About mm_deleted_files.xml tag syntax . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Reinstalling and uninstalling Dreamweaver in a multiuser environment . . . . . . Customizing default documents . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Customizing page designs. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Customizing the appearance of dialog boxes . . . . . . . . . . . . . . . . . . . . . . . . . . .
3
Changing the default file type. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 33 Customizing the interpretation of third-party tags . . . . . . . . . . . . . . . . . . . . . . 34 Working with browser profiles. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 39 About browser-profile formatting . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 39 Creating and editing a browser profile . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 41 Changing FTP mappings . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 42 Extensible document types in Dreamweaver . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 42 Opening a document in Dreamweaver . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 51
CHAPTER 3: User Interfaces for Extensions.
. . . . . . . . . . . . . . . . . . . . . . . . . . . . 53
Designing an extension user interface . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 53 Dreamweaver HTML rendering control . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 54 Using custom UI controls in extensions. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 55 Editable select lists . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 55 Database controls . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 57 Adding a variable grid control. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 59 Adding tree controls . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 60 Manipulating content within a tree control . . . . . . . . . . . . . . . . . . . . . . . . . . . 62 A color button control for extensions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 63 Adding Flash content to Dreamweaver . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 63 A simple Flash dialog box example . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 64
CHAPTER 4: The Dreamweaver Document Object Model.
. . . . . . . . . . . . . . . . . 67
Which document DOM? . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 68 The Dreamweaver DOM . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 68 Objects, properties, and methods of the Dreamweaver DOM . . . . . . . . . . . . . 68 Properties and methods of the document object . . . . . . . . . . . . . . . . . . . . . . . 71 Properties and methods of HTML tag objects . . . . . . . . . . . . . . . . . . . . . . . . . 72 Properties and methods of text objects . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 73 Properties and methods of comment objects . . . . . . . . . . . . . . . . . . . . . . . . . . 74 The dreamweaver and site objects . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 74
CHAPTER 5: Customizing Code View
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 77
Code Hints . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 77 The CodeHints.xml file . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 78 Code Hints tags . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 79 Code coloring . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 83 Code coloring files . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 83 Scheme block delimiter coloring. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 97 Scheme processing . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 99 Editing schemes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 103 Code coloring examples . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 105 Code validation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 107
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 108 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 108 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 109 Changing default HTML formatting . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 110
4
Contents
PART II: Extension APIs
CHAPTER 6: Insert Bar Objects
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 113
How object files work . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 113 The Insert bar definition file . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 114 Insertbar.xml tag hierarchy . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 114 Insert bar definition tags. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 115 Insert bar definition tag attributes. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 117 Modifying the Insert bar. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 119 Adding objects to the Insert bar . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 121 Adding objects to the Insert menu . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 121 The Objects API . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 122 canInsertObject() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 122 displayHelp() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 122 isDomRequired() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 123 insertObject() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 123 objectTag() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 124 windowDimensions() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 125 A simple Insert Object example . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 126
CHAPTER 7: Commands.
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 135
How commands work . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 135 Adding commands to the Commands menu . . . . . . . . . . . . . . . . . . . . . . . . . . . . 136 The Commands API . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 136 canAcceptCommand() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 136 commandButtons() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 136 isDomRequired() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 137 receiveArguments(). . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 137 windowDimensions() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 138 A simple Command example. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 138 Creating the UI . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 139 Writing the JavaScript code . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 140 Running the command. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 144
CHAPTER 8: Menus and Menu Commands
. . . . . . . . . . . . . . . . . . . . . . . . . . . . 145
About the menus.xml file . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 146 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 146 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 147 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 147 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 149 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 150 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 150 Changing menus and menu items . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 151 Changing the name of a menu item or menu . . . . . . . . . . . . . . . . . . . . . . . . . 152 Changing keyboard shortcuts . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 152
Contents
5
Menu Commands . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 154 Modifying the Commands menu . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 154 How menu commands work. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 155 The Menu Commands API . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 156 canAcceptCommand() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 156 commandButtons() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 156 getDynamicContent() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 157 isCommandChecked() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 158 receiveArguments() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 159 setMenuText() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 159 windowDimensions() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 160 A simple menu command . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 161 Creating the menu items . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 161 Writing the JavaScript code . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 161 Placing the command file in the Menu folder . . . . . . . . . . . . . . . . . . . . . . . . . 164 A dynamic menu . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 164 Creating the dynamic menu items . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 164 Writing the JavaScript code . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 165
CHAPTER 9: Toolbars . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 171
How toolbars work . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 171 How toolbars behave . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 172 How toolbar commands work . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 172 The toolbar definition file . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 173 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 174 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 175 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 176 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 176 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 177 Toolbar item tags. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 177 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 177 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 178 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 178 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 179 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 180 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 180 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 181 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 181 Item tag attributes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 182 id="unique_id". . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 182 showIf="script". . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 182 image="image_path" . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 182 disabledImage="image_path" . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 183 overImage="image_path" . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 183 tooltip="tooltip string" . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 183 label="label string" . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 183 width="number" . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 184 menuID="menu_id" . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 184 colorRect="left top right bottom". . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 184
6
Contents
file="command_file_path" . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . domRequired="true" or "false" . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . enabled="script" . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . checked="script". . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . value="script" . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . update="update_frequency_list". . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . command="script" . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . arguments="argument_list" . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . The toolbar command API . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . canAcceptCommand() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . getCurrentValue(). . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . getDynamicContent() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . getMenuID() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . getUpdateFrequency() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . isCommandChecked() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . isDOMRequired() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . receiveArguments(). . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . showIf() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . A simple toolbar command file . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Creating the text box . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Writing the JavaScript code . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Placing the files in the Toolbars folder . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
CHAPTER 10: Reports
184 184 185 185 185 185 186 186 187 187 188 188 190 191 191 192 193 193 194 194 195 196
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 197 198 198 199 199 199 200 200 201 201
How site reports work . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . How stand-alone reports work. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . The Reports API . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . processFile() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . beginReporting() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . endReporting() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . commandButtons() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . configureSettings() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . windowDimensions() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
CHAPTER 11: Tag Libraries and Editors
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 203 204 208 210 214 214 215 216
Tag library file format . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . The Tag Chooser. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Creating a new tag editor . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Tag editor APIs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . inspectTag() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . validateTag(). . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . applyTag() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Contents
7
CHAPTER 12: Property Inspectors
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 217
How Property inspector files work. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 218 The Property inspector API . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 219 canInspectSelection() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 219 displayHelp() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 219 inspectSelection() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 220
CHAPTER 13: Floating Panels
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 223
How floating panel files work . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 223 The Floating panel API . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 224 displayHelp() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 224 documentEdited() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 225 getDockingSide() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 225 initialPosition(). . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 226 initialTabs() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 226 isATarget() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 227 isAvailableInCodeView() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 227 isResizable() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 228 selectionChanged() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 228 Script Editor: a floating panel extension . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 230 Creating the floating panels . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 230 Writing the JavaScript code . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 231 Saving the file in the Floaters folder . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 233 Creating a menu item . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 234
CHAPTER 14: Behaviors .
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 235
How Behaviors work . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 236 Inserting multiple functions in the user's file. . . . . . . . . . . . . . . . . . . . . . . . . . 236 The Behaviors API . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 237 applyBehavior() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 237 behaviorFunction() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 238 canAcceptBehavior(). . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 239 displayHelp() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 239 deleteBehavior() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 240 identifyBehaviorArguments() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 240 inspectBehavior() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 242 windowDimensions() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 242 What to do when an action requires a return value . . . . . . . . . . . . . . . . . . . . . 243
CHAPTER 15: Server Behaviors .
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 247
Dreamweaver architecture . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 248 How the Server Behavior API functions are called . . . . . . . . . . . . . . . . . . . . . . . . 251 The Server Behavior API . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 253 analyzeServerBehavior() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 253 applyServerBehavior(). . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 254 canApplyServerBehavior(). . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 254 copyServerBehavior() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 255
8
Contents
deleteServerBehavior() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 255 displayHelp() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 256 findServerBehaviors() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 256 inspectServerBehavior() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 257 pasteServerBehavior() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 257 Server behavior implementation functions. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 258 dwscripts.findSBs(). . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 258 dwscripts.applySB() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 259 dwscripts.deleteSB() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 259 Editing EDML files. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 260 Regular expressions. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 260 Notes about EDML structure . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 261 Group EDML file tags . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 262 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 262 attributes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 262 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 265 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 265 attributes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 266 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 266 attributes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 266 Participant EDML files . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 268 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 268 attributes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 268 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 269 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 269 attributes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 270 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 272 attributes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 273 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 274 attributes. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 275 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 277 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 278 attributes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 279 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 280 attributes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 280 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 281 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 281 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 282 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 282 attributes. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 282 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 284 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 284 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 285 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 285 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 286 Server behavior techniques . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 286 Finding server behaviors . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 286 Updating server behaviors. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 290 Deleting server behaviors . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 292 Avoiding conflicts with share-in-memory JavaScript files . . . . . . . . . . . . . . . . 292
Contents
9
CHAPTER 16: Data Sources .
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 293
How data sources work . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 293 The Data Sources API . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 295 addDynamicSource() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 295 deleteDynamicSource(). . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 295 displayHelp() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 296 editDynamicSource() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 296 findDynamicSources() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 297 generateDynamicDataRef() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 297 generateDynamicSourceBindings() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 298 inspectDynamicDataRef() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 299 A simple data source example . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 299 Creating the data source definition file . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 300 Creating the EDML file . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 300 Creating the JavaScript file that implements the Data Sources API functions . 301 Creating the supporting command files for user input . . . . . . . . . . . . . . . . . . 303 Using the new data source . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 304
CHAPTER 17: Server Formats
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 307
How data formatting works. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 308 The Formats.xml file . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 308 The Edit Format List Plus (+) menu . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 309 When the data formatting functions are called . . . . . . . . . . . . . . . . . . . . . . . . . . 309 The Server Formats API . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 310 applyFormat(). . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 310 applyFormatDefinition() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 310 deleteFormat() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 311 formatDynamicDataRef(). . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 311 inspectFormatDefinition() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 312
CHAPTER 18: Components.
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 313
How to customize the Component panel . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 314 Component panel files . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 314 Component panel API functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 316 getComponentChildren() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 316 getContextMenuId(). . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 317 getCodeViewDropCode(). . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 318 getSetupSteps() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 319 setupStepsCompleted(). . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 320 handleDesignViewDrop(). . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 321 handleDoubleClick() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 322 toolbarControls() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 323
10
Contents
CHAPTER 19: Server Models
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 327 327 328 328 328 329 330 330 331 331 332 332 333 333 334
How customizing server models works . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . The Server Model API functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . canRecognizeDocument(). . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . getFileExtensions() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . getLanguageSignatures() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . getServerExtension(). . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . getServerInfo() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . getServerLanguages() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . getServerModelExtDataNameUD4() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . getServerModelDelimiters() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . getServerModelDisplayName() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . getServerModelFolderName(). . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . getServerSupportsCharset() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . getVersionArray() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
CHAPTER 20: Data Translators .
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 335 335 336 336 338 338 339 340 344 345 346 352
How data translators work. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . The Data Translator API . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . getTranslatorInfo() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . translateMarkup(). . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . liveDataTranslateMarkup() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Determining what kind of translator to use . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Adding a translated attribute to a tag. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Inspecting translated attributes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Locking translated tags or blocks of code. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . A simple block/tag translator example . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Finding bugs in your translator . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
CHAPTER 21: C-Level Extensibility
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 353
How integrating C functions works. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 353 C-level extensibility and the JavaScript interpreter. . . . . . . . . . . . . . . . . . . . . . . . 355 Data types . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 355 The C-level API . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 356 typedef JSBool (*JSNative)(JSContext *cx, JSObject *obj, unsigned int argc, jsval *argv, jsval *rval) . . . . . . . . . . . . . . . . . . . . . . . . . . 356 JSBool JS_DefineFunction(). . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 356 char *JS_ValueToString() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 357 JSBool JS_ValueToInteger() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 357 JSBool JS_ValueToDouble() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 358 JSBool JS_ValueToBoolean() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 358 JSBool JS_ValueToObject() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 358 JSBool JS_StringToValue() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 359 JSBool JS_DoubleToValue() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 359 JSVal JS_BooleanToValue() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 360 JSVal JS_IntegerToValue() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 360 JSVal JS_ObjectToValue() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 360 char *JS_ObjectType() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 360
Contents
11
JSObject *JS_NewArrayObject() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 361 long JS_GetArrayLength() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 361 JSBool JS_GetElement(). . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 362 JSBool JS_SetElement() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 362 JSBool JS_ExecuteScript() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 363 JSBool JS_ReportError() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 363 File Access and Multiuser Configuration API . . . . . . . . . . . . . . . . . . . . . . . . . . . 364 JS_Object MM_GetConfigFolderList() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 365 JSBool MM_ConfigFileExists() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 366 int MM_OpenConfigFile() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 367 JSBool MM_GetConfigFileAttributes() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 368 JSBool MM_SetConfigFileAttributes(). . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 369 JSBool MM_CreateConfigFolder(). . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 369 JSBool MM_RemoveConfigFolder() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 370 JSBool MM_DeleteConfigFile() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 370 Calling a C function from JavaScript. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 371
PART III: Appendix
APPENDIX A: The Shared Folder . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . 375
The Shared folder contents . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 375 The Common folder . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 376 The MM folder . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 377 Other folders . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 381 Using the Shared folder . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 382
INDEX
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 383
12
Contents
CHAPTER 1 Introduction
This book describes the Macromedia Dreamweaver MX 2004 framework and application programming interface (API) that lets you build extensions to Dreamweaver. Extensions typically perform the following types of tasks:
· Automating changes to the user's current document, such as inserting HTML, CFML, or · · ·
JavaScript; changing text or image properties; or sorting tables Interacting with the application to automatically open or close windows, open or close documents, change keyboard shortcuts, and more Connecting to data sources, which lets Dreamweaver users create dynamic, data-driven pages Inserting and managing blocks of server code in the current document
You might want to write an extension to handle a commonly used, and therefore repetitive, task. Such an extension could be useful to many web developers. On the other hand, you might have a unique requirement that you can satisfy only by writing an extension for that specific situation. In both cases, Dreamweaver provides an extensive set of tools that you can use to add to or customize its functionality. This book describes the API functions that Dreamweaver calls to implement the various objects, menus, floating panels, server behaviors, and so on, that comprise the features of Dreamweaver. To add an object, menu, floating panel, or other feature to Dreamweaver, you must code the functions that the particular type of extension requires. This book describes the arguments that Dreamweaver passes to these functions and also the values that Dreamweaver expects these functions to return. This book 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. For information on the utility and general purpose JavaScript APIs that you can use to perform various support operations in your Dreamweaver extensions, see the Dreamweaver API Reference. If you plan to create extensions that work with databases, you might also want to review the sections in Getting Started with Dreamweaver about making connections to databases.
13
Background
Most Dreamweaver extensions are written in HTML and JavaScript. This book assumes that you are familiar with Dreamweaver, HTML, XML, and JavaScript programming. If you are implementing C extensions, the book assumes that you know how to create and use C dynamic linked libraries (DLLs). 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), ColdFusion, or Java Server Pages (JSP).
Installing an extension
As you become familiar with the process of writing extensions, you might want to explore the extensions and resources that are available through the Macromedia Exchange website (www.macromedia.com/exchange). Installing an existing extension introduces you to some of the tools that you need to work with in your own extensions.
To install an extension, use the following procedure:
1 Download and install the Extension Manager, which is available on the Macromedia 2 3 4 5
Downloads website (www.macromedia.com/software/downloads). Log on to the Macromedia Exchange website (www.macromedia.com/exchange). From the available extensions, select one that you want to use. Click the Download link to download the extension package. Save the extension package in the Dreamweaver MX 2004/Downloaded Extensions folder of your installed Dreamweaver folder. In the Extension Manager, select File > Install Extension. In Dreamweaver, select Commands > Manage Extensions to start the Extension Manager. The Extension Manager automatically installs the extension from the Downloaded Extension folder into Dreamweaver.
Some extensions need Dreamweaver to restart before you can use them. If you are running Dreamweaver when you install the extension, you might be prompted to quit and restart the application. To view basic information on the extension after its installation, go to the Extension Manager (Commands > Manage Extensions) in Dreamweaver.
Additional resources for extension writers
To communicate with other developers who are involved in writing extensions, you might want to join the Dreamweaver extensibility newsgroup. You can access the website for this newsgroup at www.macromedia.com/go/extending_newsgrp/.
14
Chapter 1: Introduction
What's new in Extending Dreamweaver
Dreamweaver MX 2004 includes the following new features and interfaces that are extensible.
· New Insert Bar
The Insert Bar is now divided into separate categories (instead of tabs) for grouping various objects, and also supports pop-up menus. This new grouping and functionality presents a less cluttered user interface. Users can now group their favorite objects into a Favorites category for their own quick reference. Extensions can be added to their own category or pop-up menu and grouped with other existing objects. See Chapter 6, "Insert Bar Objects," on page 113. Extensible code coloring Lets you add new keywords to an existing code coloring scheme or create a new one. If you develop new JavaScript functions to use in your client-side script, for example, you can add the names of these functions to the keywords section so that they display in the color that is specified in Preferences. You can also add new code coloring schemes for a new document type. For more information, see Chapter 5, "Customizing Code View," on page 77. The cssimport and cssmedia tags support code coloring rules for the @import and @media functions of the style element in a cascading style sheet. For more information, see Chapter 5, "Customizing Code View," on page 77. API support for Flash Elements (SWC files). Extension developers can add their own Flash Elements to the Insert Bar, Insert menu, or other Toolbars so users can insert them into documents by simply clicking a button or menu option. See "Flash Integration" in the Dreamweaver API Reference. Enhanced support for "code behind" pages can be found in the CodeBehindMgr.js file in the Dreamweaver Configuration/Shared/Common folder. See Appendix A, "The Shared folder contents," on page 375. Integration of Customizing Dreamweaver content. Material formerly available only as a separate document download from the Macromedia website is now integrated into this book.
·
· ·
· ·
Documentation Changes Extending Dreamweaver MX has been divided into two books: Extending Dreamweaver and the Dreamweaver API Reference. Extending Dreamweaver describes how to build various types of Dreamweaver extensions, including the functions that you must write to create each type. It also describes how to customize Dreamweaver by modifying some of its configurable HTML and XML files. The Dreamweaver API Reference describes the two APIs that let you perform various supporting tasks in your Dreamweaver extensions. The Extending Dreamweaver book is designed to serve the user who wants to learn how to build a Dreamweaver extension. The Dreamweaver API Reference is designed to serve the experienced Dreamweaver programmer who wants to quickly locate the right function to accomplish a particular task. Dividing the material into two books also clarifies the distinction between the extension API functions that an extension author must code, and which Dreamweaver calls, and the JavaScript and Utility API functions that a programmer can call to accomplish various tasks from within an extension. Extending Dreamweaver includes the following improvements to help new extension authors to get started.
What's new in Extending Dreamweaver
15
· New and updated examples
New examples have been added for the Insert Bar, Components, Data Sources, Flash Integration, and the Shared folder. The examples in the Commands, Menu Commands, Toolbars, and Floating Panels chapters have been updated with graphics and explanations to make them easier to understand. New organization Some material has been reorganized to improve clarity. The JavaScript API functions in the Dreamweaver API Reference, for example, have been organized into chapters that designate which part of Dreamweaver the functions affect. Description of Shared folder contents (see Appendix A) The Dreamweaver Configuration/Shared folder holds several files and subfolders containing HTML and JavaScript code that implement various Dreamweaver features and user interfaces. These files are in the Shared folder because the HTML and JavaScript code are commonly useful. Appendix A briefly describes what is contained in the most useful files and subfolders inside the Configuration/Shared folder. Revised Components chapter The Components chapter has been revised for clarity and depth, including more function examples.
·
·
·
For information on the new functions that have been added to the Utility API and the JavaScript API, see the Dreamweaver API Reference. Macromedia Press Improve your Dreamweaver skills with books from Macromedia Press. Check out the latest content written by the experts. See www.macromedia.com/go/dw2004_help_mmp.
Removed Features
In Dreamweaver MX 2004, several features have been removed. As a result, the following material has been removed from Extending Dreamweaver:
· References to the Dreamweaver 4 style workspace · The JavaScript Debugger chapter
For information on all the features that have been removed from Dreamweaver, see Using Dreamweaver. For information on the functions that have been removed from the Utility and JavaScript APIs, see the Dreamweaver API Reference.
Errata
A current list of known issues can be found in the Extensibility section of the Dreamweaver Support Center (www.macromedia.com/go/extending_errata).
16
Chapter 1: Introduction
Conventions used in this guide
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. Function names that have the prefix dreamweaver. as in dreamweaver.funcname, can be abbreviated to dw.funcname when you are writing code. This manual uses the full dreamweaver. prefix when defining the function and in the index. Many examples use the shorter dw. prefix, however.
The following naming conventions are used in this guide:
· You--the developer who is responsible for writing extensions · The user--the person using Dreamweaver · The visitor--the person who views the web page that the user created
Conventions used in this guide
17
18
Chapter 1: Introduction
PART I Overview
PART I
Learn the fundamental concepts of the Macromedia Dreamweaver MX 2004 interface and how to customize and extend Dreamweaver to suit your web development needs. These fundamental concepts include the Dreamweaver folders, extension APIs, Dreamweaver interface components, the Dreamweaver Document Object Model (DOM), and Dreamweaver document types. Chapter 2: Extending Dreamweaver. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 21 Chapter 3: User Interfaces for Extensions. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 53 Chapter 4: The Dreamweaver Document Object Model . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 67 Chapter 5: Customizing Code View. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 77
If this document matches the user guide, instructions manual or user manual, feature sets, schematics you are looking for, download it now. Diplodocs provides you a fast and easy access to the user manual MACROMEDIA DREAMWEAVER MX 2004- EXTENDING DREAMWEAVER .
MACROMEDIA offer a product for which we do not have the user manual? Let us know what you are looking for: user guide, owner's manual, online manual, operating instructions, quick start guide, mounting instructions, schematics, service manual, installation instructions, RTFM.
Diplodocs allows you to download user manual MACROMEDIA DREAMWEAVER MX 2004- EXTENDING DREAMWEAVER, user guide MACROMEDIA DREAMWEAVER MX 2004- EXTENDING DREAMWEAVER, instructions MACROMEDIA DREAMWEAVER MX 2004- EXTENDING DREAMWEAVER, owner's manual MACROMEDIA DREAMWEAVER MX 2004- EXTENDING DREAMWEAVER, online manual MACROMEDIA DREAMWEAVER MX 2004- EXTENDING DREAMWEAVER.
Access web reviews MACROMEDIA DREAMWEAVER MX 2004- EXTENDING DREAMWEAVER, , Software.