|
5 600 brands
1 870 000 user's guides |
|
|
|||||||||||||||
|
Search a brand
Advanced Search
|
Our partners wish to propose you the following products
|
User manual ADOBE CS2
Diplodocs help download the user guide ADOBE CS2.
This product, although classified under the brand ADOBE, may have been manufactured by ALLAIRE, MACROMEDIA after mergers, acquisitions, or a change in name.
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 ADOBE CS2
Detailed instructions for use are in the User's Guide. SDK Programmer's Guide
bc
Adobe GoLive cs2
® ®
© 2005 Adobe Systems Incorporated. All rights reserved. AdobeÆ Creative Suite 2 GoLive® CS2 SDK Programmer's Guide for Windows® and Macintosh®. NOTICE: All information contained herein is the property of Adobe Systems Incorporated. No part of this publication (whether in hardcopy or electronic form) may be reproduced or transmitted, in any form or by any means, electronic, mechanical, photocopying, recording, or otherwise, without the prior written consent of Adobe Systems Incorporated. The software described in this document is furnished under license and may only be used or copied in accordance with the terms of such license. This publication and the information herein is furnished AS IS, is subject to change without notice, and should not be construed as a commitment by Adobe Systems Incorporated. Adobe Systems Incorporated assumes no responsibility or liability for any errors or inaccuracies, makes no warranty of any kind (express, implied, or statutory) with respect to this publication, and expressly disclaims any and all warranties of merchantability, fitness for particular purposes, and noninfringement of third party rights. Any references to company names in sample templates are for demonstration purposes only and are not intended to refer to any actual organization. Adobe, the Adobe logo, Acrobat, and GoLive are either registered trademarks or trademarks of Adobe Systems Incorporated in the United States and/or other countries. Apple, Mac, Macintosh, and Mac OS are trademarks of Apple Computer, Inc., registered in the United States and other countries. Microsoft and Windows are either registered trademarks or trademarks of Microsoft Corporation in the United States and other countries. JavaScript and all Java-related marks are trademarks or registered trademarks of Sun Microsystems, Inc. in the United States and other countries. UNIX is a registered trademark of The Open Group. All other trademarks are the property of their respective owners. If this guide is distributed with software that includes an end user agreement, this guide, as well as the software described in it, is furnished under license and may be used or copied only in accordance with the terms of such license. Except as permitted by any such license, no part of this guide may be reproduced, stored in a retrieval system, or transmitted, in any form or by any means, electronic, mechanical, recording, or otherwise, without the prior written permission of Adobe Systems Incorporated. Please note that the content in this guide is protected under copyright law even if it is not distributed with software that includes an end user license agreement. The content of this guide is furnished for informational use only, is subject to change without notice, and should not be construed as a commitment by Adobe Systems Incorporated. Adobe Systems Incorporated assumes no responsibility or liability for any errors or inaccuracies that may appear in the informational content contained in this guide. Adobe Systems Incorporated, 345 Park Avenue, San Jose, California 95110, USA.
Contents
Preface ........................................................................................................................................ 10
About Adobe GoLive CS2 SDK ................................................................................................................................................10 About This Book............................................................................................................................................................................11 Who should read this book ................................................................................................................................................11 What is in this book ...............................................................................................................................................................11 Document conventions .......................................................................................................................................................12 Typographical conventions .........................................................................................................................................12 JavaScript common properties...................................................................................................................................12 Where to Go for More Information ........................................................................................................................................13
1
Installing and Configuring the GoLive SDK............................................................................. 14
Installing the GoLive CS2 SDK..................................................................................................................................................14 Installing the core set of tools and sample extensions ............................................................................................14 Installing the core extensions .....................................................................................................................................14 Uninstalling an extension .............................................................................................................................................15 Configuring GoLive for Extension Development..............................................................................................................15 Enabling the Extend Script module ................................................................................................................................15 Enabling and disabling modules......................................................................................................................................16 Debugging Your Scripts.............................................................................................................................................................17 Error logs ...................................................................................................................................................................................17
2
How to Create an Extension...................................................................................................... 18
About Adobe GoLive CS2 Extensions ...................................................................................................................................18 What can extensions do? ....................................................................................................................................................18 Anatomy of an Extension ..........................................................................................................................................................19 Extension-building tools .....................................................................................................................................................20 Example Main.html File..............................................................................................................................................................21 Creating An Extension Module................................................................................................................................................21 Creating the Main.html file.................................................................................................................................................22 Adding SDK Tags and JavaScript Functions to the Module..........................................................................................23 Adding the module tag .......................................................................................................................................................24 Adding event-handling functions ...................................................................................................................................24 Summary ...................................................................................................................................................................................26
3
The JavaScript Environment..................................................................................................... 27
JavaScript Objects in the GoLive Environment .................................................................................................................27 Objects, elements, and properties...................................................................................................................................27 Accessing attribute values..................................................................................................................................................27 Naming objects and attributes .........................................................................................................................................28 JavaScript object collections..............................................................................................................................................29 Using the global object arrays ....................................................................................................................................29 Comparing objects..........................................................................................................................................................30 Updating references to objects ........................................................................................................................................30 Scope of Variables and Functions ..........................................................................................................................................31 Releasing Memory .................................................................................................................................................................32 Handling Events............................................................................................................................................................................32 Defining and Registering Event Handlers.....................................................................................................................33
3
Adobe GoLive CS2 SDK SDK Programmer's Guide Contents 4
Nesting Event Handlers .......................................................................................................................................................34 Sharing Data...................................................................................................................................................................................34 Persistent shared data..........................................................................................................................................................35 Non-persistent shared data................................................................................................................................................35 Communicating with other extensions .........................................................................................................................35 Sending messages to other extension modules ..................................................................................................36 Responding to a broadcast ..........................................................................................................................................36 Delays and Timeouts...................................................................................................................................................................36 Timed tasks...............................................................................................................................................................................37 Setting the JavaScript timeout..........................................................................................................................................37 Progress bars ...........................................................................................................................................................................37 Starting a progress or busy bar...................................................................................................................................38 Updating a progress or busy bar................................................................................................................................38 Progress bar example.....................................................................................................................................................39
4
Menus and Toolbars .................................................................................................................. 40
Creating Custom Menus ............................................................................................................................................................40 Basic example..........................................................................................................................................................................40 Adding the menu bar tag....................................................................................................................................................41 Defining the Menu.................................................................................................................................................................41 Defining menu items ............................................................................................................................................................42 Creating submenus ...............................................................................................................................................................43 Defining menu behavior .....................................................................................................................................................43 Using one handler to react to multiple items .......................................................................................................44 Capturing events in the menu object ......................................................................................................................44 Complete simple menu example .....................................................................................................................................45 Assigning Keyboard Shortcuts to Menu Items ..................................................................................................................45 Setting a Menu Item's State Programmatically .................................................................................................................46 Setting a menu item's checked state..............................................................................................................................46 Setting a menu item's enabled state .............................................................................................................................46 Initializing menu items.........................................................................................................................................................47 Adding Items to GoLive Menus...............................................................................................................................................48 Extending Context Menus.........................................................................................................................................................50 Registering context menu handlers................................................................................................................................51 Defining context menu handlers .....................................................................................................................................51 Creating Toolbars .........................................................................................................................................................................52
5
Windows and Controls .............................................................................................................. 54
Types of Windows ........................................................................................................................................................................54 Dialog windows......................................................................................................................................................................54 Positioning windows ............................................................................................................................................................54 Using the Dialog Editor tool...............................................................................................................................................55 Modal Dialog Windows ..............................................................................................................................................................58 Defining the modal dialog window ................................................................................................................................58 Opening and closing modal dialogs...............................................................................................................................58 Displaying a modal dialog............................................................................................................................................58 Closing a modal dialog ..................................................................................................................................................60 Palette Windows...........................................................................................................................................................................60 Showing and hiding palettes .....................................................................................................................................61 The Inspector window ...................................................................................................................................................62 Control Containers.......................................................................................................................................................................63 Creating panels.......................................................................................................................................................................63
Adobe GoLive CS2 SDK SDK Programmer's Guide 5
Creating tab panels ...............................................................................................................................................................63 Creating split panels .............................................................................................................................................................64 Autolayout of Localized Controls ...........................................................................................................................................65 Adding Controls to Windows...................................................................................................................................................66 Creating different types of controls ................................................................................................................................67 Creating radio button groups .....................................................................................................................................68 Creating text input fields ..............................................................................................................................................68 Creating source and preview controls .....................................................................................................................69 Creating controls with parameters ...........................................................................................................................69 List controls........................................................................................................................................................................70 Adding controls to a window dynamically...................................................................................................................72 Providing Behavior for Controls..............................................................................................................................................73 Handling events for a target control...............................................................................................................................73 Handling simple clicks ...................................................................................................................................................73 Handling different actions............................................................................................................................................73 Handling editing actions...............................................................................................................................................74 Handling events in a control's parent window ...........................................................................................................74 Creating Custom Controls.........................................................................................................................................................76 Defining user interactions with custom controls .......................................................................................................76 Drawing custom controls....................................................................................................................................................76 Updating a control's appearance immediately ....................................................................................................77 Defining drag-and-drop for custom controls ..............................................................................................................77 Control as Sender of a Drag Event.............................................................................................................................77 Receiving a drop event..................................................................................................................................................77
6
Custom Elements ....................................................................................................................... 78
Overview..........................................................................................................................................................................................78 Tags for creating custom elements .................................................................................................................................78 Defining A Custom Element.....................................................................................................................................................79 Defining the tag for a custom element..........................................................................................................................79 Redefining Tags Locally.................................................................................................................................................79 Defining the custom tag's palette icon and HTML content ...................................................................................80 Creating a Palette Entry in the Objects Palette .................................................................................................................81 Adding Palette Entries to a Built-in Tab ...............................................................................................................................81 Adding palette entries to a customized tab.................................................................................................................82 Defining the appearance of a custom element....................................................................................................82 Initializing a custom element box....................................................................................................................................83 Displaying a custom element box ...................................................................................................................................84 Drawing into container boxes ....................................................................................................................................84 drawBox Examples ..........................................................................................................................................................84 Resizing a custom element box........................................................................................................................................86 Built-in undo support ...........................................................................................................................................................86 Inspecting a Custom Element..................................................................................................................................................86 Initializing the Inspector window ....................................................................................................................................87 Responding to changes in the Inspector ......................................................................................................................87 Multiple Inspectors................................................................................................................................................................88 Supporting the Undo and Redo Commands .....................................................................................................................88 Undo support and document parsing ...........................................................................................................................88 The document's undo history ...........................................................................................................................................89 Creating the undo object....................................................................................................................................................89 Initializing the undo object ................................................................................................................................................89
Adobe GoLive CS2 SDK SDK Programmer's Guide 6
Implementing the undoSignal Function.......................................................................................................................90 Updating Images Dynamically ................................................................................................................................................91 Creating pictures....................................................................................................................................................................92 Drawing the image................................................................................................................................................................92 Deleting pictures....................................................................................................................................................................93
7
Editing Documents Programmatically..................................................................................... 94
The GoLive Document Object Model ..................................................................................................................................94 The Markup Tree...........................................................................................................................................................................94 Reparsing and object references .....................................................................................................................................95 Markup editing options.................................................................................................................................................95 Automatic and explicit reparsing .............................................................................................................................96 Working With Documents.........................................................................................................................................................97 Opening documents.............................................................................................................................................................97 Open a document in a document window ............................................................................................................97 Display layout view .........................................................................................................................................................98 Open a document without displaying it .................................................................................................................98 Manipulating open documents........................................................................................................................................98 Make an open document window frontmost .......................................................................................................98 Count open documents ................................................................................................................................................98 Validate document objects ..........................................................................................................................................99 Working with style sheets...................................................................................................................................................99 Creating a new HTML page ................................................................................................................................................99 Saving documents.............................................................................................................................................................. 100 Closing documents ............................................................................................................................................................ 100 Working with Selections in Document Windows .......................................................................................................... 100 Retrieving the current selection .................................................................................................................................... 101 Setting the current selection .......................................................................................................................................... 102 Using the range object...................................................................................................................................................... 102 Accessing selections through the document source............................................................................................. 104 Retrieving Objects from the Markup Tree........................................................................................................................ 104 Retrieving individual markup objects ......................................................................................................................... 105 Retrieving multiple markup objects............................................................................................................................. 106 Editing Source Code Through Markup Objects ............................................................................................................. 106 Using Markup Objects to Edit HTML Directly............................................................................................................ 106 Overriding document encoding for elements ......................................................................................................... 107
8
Editing with Layout .................................................................................................................108
Layout View and the Layout Objects ................................................................................................................................. 108 Editing displayed elements through layout objects.............................................................................................. 109 Getting the layout objects for tables, cells, and layout grids........................................................................ 109 Editing Attributes of Managed Objects................................................................................................................ 109 Example: Using layout objects................................................................................................................................. 110 Editing displayed elements through markup objects ........................................................................................... 111 Editing Text in Layout View ................................................................................................................................................... 112 Manipulating text elements............................................................................................................................................ 113 Adding text ..................................................................................................................................................................... 113 Setting the cursor position........................................................................................................................................ 113 Finding and replacing text ........................................................................................................................................ 114 Selecting and deselecting text ................................................................................................................................ 114 Manipulating Text Styles ........................................................................................................................................................ 115 Applying styles to selected text..................................................................................................................................... 116
Adobe GoLive CS2 SDK SDK Programmer's Guide 7
Editing existing styles and stylesets............................................................................................................................. 117 Inserting Elements in Layout View...................................................................................................................................... 117 Inserting raw HTML ............................................................................................................................................................ 118 Working with Tables in Layout View .................................................................................................................................. 118 Table styles ............................................................................................................................................................................ 118 Applying a table style within a table ..................................................................................................................... 119 Table cells............................................................................................................................................................................... 119 Cell styles................................................................................................................................................................................ 120 Working with Layout Grids .................................................................................................................................................... 121 Adjusting the grid............................................................................................................................................................... 121 Sizing and positioning elements on the grid............................................................................................................ 121
9
Managing Files and Folders ....................................................................................................123
Overview....................................................................................................................................................................................... 123 Using File Objects...................................................................................................................................................................... 123 Acquiring file objects ........................................................................................................................................................ 124 Determining the location of a file or folder......................................................................................................... 124 Validating file objects.................................................................................................................................................. 124 Accessing folders ............................................................................................................................................................... 125 Getting a file object from the user................................................................................................................................ 126 Creating a new file object ................................................................................................................................................ 126 Moving, Copying, and Deleting Files and Folders......................................................................................................... 127 Moving and copying files................................................................................................................................................. 127 Moving and copying folders........................................................................................................................................... 128 Deleting files or folders..................................................................................................................................................... 128 Working With Document Files ............................................................................................................................................. 128 Creating a document file.................................................................................................................................................. 128 Reading the contents of an existing file ..................................................................................................................... 129 Opening a markup document file .......................................................................................................................... 129 Opening other files ...................................................................................................................................................... 129 Changing encoding in a file...................................................................................................................................... 129 Working With Folders .............................................................................................................................................................. 130 Creating folders ................................................................................................................................................................... 130 Retrieving the contents of a folder .............................................................................................................................. 130 Getting files from a file object.................................................................................................................................. 130 Getting files from a siteReference object............................................................................................................. 131 Retrieving the contents of subfolders................................................................................................................... 132 Working with Remote Files ................................................................................................................................................... 133 Using HTTP protocol .......................................................................................................................................................... 133 Using FTP and DAV protocol........................................................................................................................................... 133 Exchanging Data with Remote Hosts ............................................................................................................................... 134 Establishing a simple HTTP connection...................................................................................................................... 134 Establishing an internet server....................................................................................................................................... 135 Example: A chat server ...................................................................................................................................................... 135
10 Managing Web Sites................................................................................................................137
Creating Files and Folders in GoLive Web Sites ............................................................................................................ 137 Adding files and folders.................................................................................................................................................... 137 Using templates................................................................................................................................................................... 138 Deleting files and folders ................................................................................................................................................. 139 Managing the Site Window ................................................................................................................................................... 139 Selecting site files programmatically........................................................................................................................... 139
Adobe GoLive CS2 SDK SDK Programmer's Guide 8
Creating custom columns in the Site window ......................................................................................................... 139 Using event handlers to display custom column content............................................................................. 140 Using named properties to display custom column content....................................................................... 140 Removing a custom column at runtime............................................................................................................... 141 Working With Site Documents ............................................................................................................................................. 142 Making a document's Site window frontmost ......................................................................................................... 142 Copying files ......................................................................................................................................................................... 143 Working with Version Control Systems............................................................................................................................. 145
11 Localization and Translation ..................................................................................................149
Dynamic UI Localization ......................................................................................................................................................... 149 Creating the localization table ....................................................................................................................................... 149 Creating a localization table in GoLive ................................................................................................................. 150 Creating an external localization table ................................................................................................................. 151 Using the localization table............................................................................................................................................. 151 Translating attribute value strings ......................................................................................................................... 151 Translating JavaScript strings................................................................................................................................... 152 Localization test features ................................................................................................................................................. 152 Document Source Translation.............................................................................................................................................. 153 Defining a translator .......................................................................................................................................................... 153 Inspecting translated elements ..................................................................................................................................... 154
12 Extending GoLive Actions.......................................................................................................156
GoLive Action Types................................................................................................................................................................. 156 Adding actions to a page ................................................................................................................................................. 156 Creating Your Own Actions ................................................................................................................................................... 157 Changing action icons ...................................................................................................................................................... 158 Anatomy of an Action File...................................................................................................................................................... 158 Action Tags .................................................................................................................................................................................. 160 csactionclass ......................................................................................................................................................................... 160 csactionparam...................................................................................................................................................................... 161 JavaScript Source for Actions................................................................................................................................................ 163 Layout Grid .................................................................................................................................................................................. 163 Action Tutorials .......................................................................................................................................................................... 165 Tutorial 1: Customizing the Actions Inspector ......................................................................................................... 165 Tutorial 2: Go to previous page action ........................................................................................................................ 166 Tutorial 3: Resize window action................................................................................................................................... 167
13 Debugging Scripts ...................................................................................................................170
Enabling Debug Services........................................................................................................................................................ 170 Using the JavaScript Command Shell................................................................................................................................ 171 Executing JavaScript commands .................................................................................................................................. 172 The Internal JavaScript Source Debugger........................................................................................................................ 173 Controlling code execution in the script Debugger window ............................................................................. 174 Customizing the Debugger Window ................................................................................................................................ 175 Troubleshooting Tips............................................................................................................................................................... 177 Null and undefined values............................................................................................................................................... 177 Case sensitivity..................................................................................................................................................................... 177 Line breaks in palette entries and string literals ...................................................................................................... 177
A
Using External Libraries ..........................................................................................................178
About External Libraries.......................................................................................................................................................... 178 Installing external libraries .............................................................................................................................................. 179
Adobe GoLive CS2 SDK SDK Programmer's Guide 9
Installing an external JavaScript library................................................................................................................ 179 Installing Binary Libraries........................................................................................................................................... 179 External JavaScript Libraries ................................................................................................................................................. 179 Including an external JavaScript file ............................................................................................................................ 180 Calling JavaScript library functions .............................................................................................................................. 180 External Binary Libraries ......................................................................................................................................................... 181 Implementing external binary libraries ...................................................................................................................... 181 Including C header files.............................................................................................................................................. 181 Bit Alignment ................................................................................................................................................................. 181 Initializing the JavaScript engine............................................................................................................................ 182 Defining external library functions ........................................................................................................................ 182 Registering external functions................................................................................................................................. 184 Implementing optional termination code .......................................................................................................... 184 Calling C library functions from JavaScript................................................................................................................ 184 Evaluating JavaScript expressions in C functions ................................................................................................... 185 Performance Issues................................................................................................................................................................... 186
Glossary ....................................................................................................................................188 Index .........................................................................................................................................192
Preface
Welcome to the Adobe® GoLive CS2 SDK Programmer's Guide. This book and its companion volume, the GoLive CS2 SDK Programmer's Reference, describe how to extend the Adobe GoLive® CS2 Web-site development environment.
About Adobe GoLive CS2 SDK
The Adobe GoLive CS2 SDK (Software Development Kit) enables you to extend the behavior and user interface of GoLive CS2. Using the GoLive CS2 SDK, you can create tools tailored to your specific GoLive tasks. The SDK can create, customize, and extend most aspects of the GoLive user interface, such as:
Menus and menu items Floating palettes and task-specific dialogs that include text, graphics, and controls Custom HTML elements, such as |