MACROMEDIA DREAMWEAVER MX 2004-EXTENDING DREAMWEAVER Manual

Other manuals for DREAMWEAVER MX 2004-EXTENDING DREAMWEAVER: Manual

Summary of DREAMWEAVER MX 2004-EXTENDING DREAMWEAVER

  • Page 1

    Extending dreamweaver.

  • Page 2

    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 3...

  • Page 3: Contents

    3 contents chapter 1: introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13 background. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14 installing an extension. . . . . . . . . . . . . . . ...

  • Page 4

    4 contents changing the default file type. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 33 customizing the interpretation of third-party tags . . . . . . . . . . . . . . . . . . . . . . 34 working with browser profiles. . . . . . . . . . . . . . . . . . . . . . . . . . ....

  • Page 5

    Contents 5 part ii: extension apis chapter 6: insert bar objects . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 113 how object files work . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 113 the insert bar definition file . . . . . ...

  • Page 6

    6 contents menu commands . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 154 modifying the commands menu . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 154 how menu commands work. . . . . . . . . . . . . . . . . . . . . . . . . . ....

  • Page 7

    Contents 7 file="command_file_path" . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 184 domrequired="true" or "false" . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 184 enabled="script" . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ....

  • Page 8

    8 contents chapter 12: property inspectors . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 217 how property inspector files work. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 218 the property inspector api . . . . . . . . . . . . . . . . . . . . . . . ....

  • Page 9

    Contents 9 deleteserverbehavior() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 255 displayhelp() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 256 findserverbehaviors() . . . . . . . . . . . . . . . . . . . . ...

  • Page 10

    10 contents chapter 16: data sources . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 293 how data sources work . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 293 the data sources api . . . . . . . . . . . . . . . . . . . . . . ...

  • Page 11

    Contents 11 chapter 19: server models . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 327 how customizing server models works . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 327 the server model api functions . . . . . . . . . . . . . . . . . . . . . . ....

  • Page 12

    12 contents jsobject *js_newarrayobject() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 361 long js_getarraylength() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 361 jsbool js_getelement(). . . . . . . . . . . . . . . . . . . . . . . . . . . . ....

  • Page 13: Chapter 1

    13 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 a...

  • Page 14

    14 chapter 1: introduction 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 ...

  • Page 15

    What’s new in extending dreamweaver 15 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 supp...

  • Page 16

    16 chapter 1: introduction • 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 explanati...

  • Page 17

    Conventions used in this guide 17 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 ...

  • Page 18

    18 chapter 1: introduction.

  • Page 19: Part I

    Part i overview 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...

  • Page 21: Chapter 2

    21 chapter 2 extending dreamweaver the following features of macromedia dreamweaver mx 2004 let you create extensions: • an html parser (also called a renderer), which makes it possible to design user interfaces (uis) for extensions using form fields, layers, images, and other html elements. Dreamwe...

  • Page 22

    22 chapter 2: extending dreamweaver tag library and editor extensions work with the associated tag library files. Tag library and editor extensions can modify attributes of existing tag dialogs, create new tag dialogs, and add tags to the tag library. Tag library and editor extension files are store...

  • Page 23

    Configuration folders and extensions 23 code hints are menus that offer a typing shortcut by displaying a list of strings that potentially complete the string you are typing. If one of the strings in the menu matches the string that you started to type, you can select it to insert it in place of the...

  • Page 24

    24 chapter 2: extending dreamweaver the configuration/shared folder does not correspond to a specific extension type. It is the central repository for utility functions, classes, and images that are used by more than one extension. The files in the configuration/shared/common folder are designed to ...

  • Page 25

    Extension apis 25 multiuser configuration folders for the multiuser operating systems of windows xp, windows 2000, and macintosh os x, dreamweaver creates a separate configuration folder for each user in addition to the dreamweaver configuration folder. Any time dreamweaver or a javascript extension...

  • Page 26

    26 chapter 2: extending dreamweaver how dreamweaver processes javascript in extensions dreamweaver checks the configuration/extension_name folder during startup. If it encounters an extension file within the folder, dreamweaver processes the javascript by completing the following steps: • compiling ...

  • Page 27

    Localizing an extension 27 displaying help the displayhelp() function, which is part of several extension apis, causes dreamweaver to do the following two things when you include it in your extension: • add a help button to the interface. • call displayhelp() when the user clicks the help button. Yo...

  • Page 28

    28 chapter 2: extending dreamweaver now your javascript files can refer to these translatable strings by calling the dw.Loadstring() function, as shown in the following example: function initializeui() { ... If (problemyhasoccured) { alert(dw.Loadstring("featurex/subproblemy"); } } you can use slash...

  • Page 29

    Customizing dreamweaver 29 customizing dreamweaver you can customize dreamweaver in many ways, which lets you work in a manner that’s familiar, comfortable, and efficient for you. This section describes advanced methods for customizing dreamweaver, with a focus on editing configuration files. About ...

  • Page 30

    30 chapter 2: extending dreamweaver for mac os x platforms: :users::library:application support: ¬ macromedia:dreamweaver mx 2004:configuration note: to install extensions that all users can use in a multiuser operating system, you must be logged in as administrator (windows) or root (mac os x). Dre...

  • Page 31

    Customizing dreamweaver 31 about mm_deleted_files.Xml tag syntax the mm_deleted_files.Xml file contains a structured list of items that describe configuration files that dreamweaver is to ignore. These items are described by xml tags, which you can edit in a text editor. The following sections descr...

  • Page 32

    32 chapter 2: extending dreamweaver reinstalling and uninstalling dreamweaver in a multiuser environment after you install dreamweaver, if you later reinstall it or upgrade to a later version, dreamweaver automatically makes backup copies of existing user configuration files, so that if you’ve custo...

  • Page 33

    Customizing dreamweaver 33 to change the appearance of a dialog box: 1 in dreamweaver, select edit > preferences, and then select the code rewriting category. 2 unselect the rename form items when pasting option. Unselecting this option ensures that form items retain their original names when you co...

  • Page 34

    34 chapter 2: extending dreamweaver to add new file types to the menu in the file > open dialog box: 1 make a backup copy of the extensions.Txt file in the configuration folder. 2 open extensions.Txt in dreamweaver or a text editor. 3 add a new line for each new file type. In capital letters, enter ...

  • Page 35

    Customizing dreamweaver 35 you can define two kinds of tags using tagspec : normal html-style tags and string-delimited tags. String-delimited tags start with one string and end with another string; they’re like empty html tags (such as img ) in that they don’t surround content and don’t have closin...

  • Page 36

    36 chapter 2: extending dreamweaver • content_model describes what kinds of content the tag can contain and where in an html file the tag can appear. Valid values are "block_model" , "head_model" , "marker_model" , and "script_model" : ■ block_model specifies that the tag can contain block-level ele...

  • Page 37

    Customizing dreamweaver 37 • equivalent_tag specifies simple html equivalents for certain coldfusion form-related tags. Not intended for use with other tags. • is_visual indicates whether the tag has a direct visual effect on the page. For example, the coldfusion tag cfgraph doesn’t specify a value ...

  • Page 38

    38 chapter 2: extending dreamweaver to change the highlighting color of third-party tags: 1 select edit > preferences, and select the highlighting category. 2 click the third-party tags color box to display the color picker. 3 select a color, and click ok to close the preferences dialog box. For inf...

  • Page 39

    Working with browser profiles 39 to turn off dreamweaver encoding options: 1 select edit > preferences, and select the code rewriting category. 2 deselect either or both special characters options. For information on the other code rewriting preferences, see dreamweaver help (help > using dreamweave...

  • Page 40

    40 chapter 2: extending dreamweaver the following example shows the syntax for a tag entry: unsupportedattribute1 !Error !Msg="the unsupportedattribute1 attribute of the htmltag tag is not supported.Try using supportedattribute1 for a similar effect." supportedattribute1 supportedattribute2 (validva...

  • Page 41

    Working with browser profiles 41 creating and editing a browser profile you can create a browser profile by modifying an existing profile. For example, to create a profile for a future version of microsoft internet explorer, you can open the profile for the most recent version of internet explorer t...

  • Page 42

    42 chapter 2: extending dreamweaver changing ftp mappings the ftpextensionmap.Txt file (windows) and the ftpextensionmapmac.Txt file (macintosh) map filename extensions to ftp transfer modes (ascii or binary). Each line in each of the two files includes a filename extension (such as gif) and either ...

  • Page 43

    Extensible document types in dreamweaver 43 document type definition file the central component of extensible document types is the document type definition file. There might be several definition files, all of which are located in the configuration/documenttypes folder. Each definition file contain...

  • Page 44

    44 chapter 2: extending dreamweaver if you need to create a new document type, you can either add your entry to the document definition file that macromedia provides (mmdocumenttypes.Xml) or add a custom definition file to the configuration/documenttypes folder. Note: the newdocuments subfolder resi...

  • Page 45

    Extensible document types in dreamweaver 45 in the previous example, the loadstring element identifies the localized strings that dreamweaver should use for the title and description for asp-js type documents. For more information about localized strings, see “localized strings” on page 50 . The fol...

  • Page 46

    46 chapter 2: extending dreamweaver internaltype yes a broad classification of how dreamweaver treats a file. The internaltype identifies whether the design view is enabled for this document and handles special cases such as dreamweaver templates or extensions. The following values are valid: dynami...

  • Page 47

    Extensible document types in dreamweaver 47 note: when the user saves a new document, dreamweaver examines the list of extensions for the current platform that are associated with the document type ( winfileextension and macfileextension ). Dreamweaver selects the first string in the list and uses i...

  • Page 48

    48 chapter 2: extending dreamweaver when dreamweaver starts, it reads all document type definition files and builds a list of valid document types. Dreamweaver treats any entries within the definition files that have nonexistent server models as nonserver model document types. Dreamweaver ignores en...

  • Page 49

    Extensible document types in dreamweaver 49 document extensions and file types by default, dreamweaver shows all the file types it recognizes in the file > open dialog box. After creating a new document type, extension developers need to update the appropriate extensions.Txt file. If the user is on ...

  • Page 50

    50 chapter 2: extending dreamweaver to change the dreamweaver default file > 0pen file type: 1 make a backup copy of the extensions.Txt file in the configuration folder. 2 open extensions.Txt in dreamweaver or a text editor. 3 cut the line that corresponds to the new default, and paste it at the beg...

  • Page 51

    Extensible document types in dreamweaver 51 note: string identifiers, such as myjspdoctype/description in the previous example, must be unique within the application. Dreamweaver, when it starts, parses all xml files within the configuration/strings folder and loads these unique strings. Rules for d...

  • Page 52

    52 chapter 2: extending dreamweaver.

  • Page 53: Chapter 3

    53 chapter 3 user interfaces for extensions most extensions are built to receive information from the user through a user interface (ui). If you plan to submit your extension for macromedia certification, you need to follow the guidelines that are available within the extension manager files on the ...

  • Page 54

    54 chapter 3: user interfaces for extensions consider the following basic guidelines when you design an extension ui: • if you want a name for your extension, place the name in the title tag of your html file. Dreamweaver displays the name in the extension title bar. • keep text labels on the left s...

  • Page 55

    Using custom ui controls in extensions 55 the following examples show the base property inspector without the doctype statement, which improves form-control rendering, and then with the doctype statement. The base property inspector as it appears in design view without the doctype statement. The bas...

  • Page 56

    56 chapter 3: user interfaces for extensions as with normal (noneditable) select lists, editable select lists have a selectedindex property (see “objects, properties, and methods of the dreamweaver dom” on page 68 ). This property returns -1 if the text box is selected. To read the value of an activ...

  • Page 57

    Using custom ui controls in extensions 57 edittext="editable text"> opt 1 opt 2 opt 3 opt 1 opt 2 opt 3 to use this sample, save it to the dreamweaver configuration/commands folder as editableselecttest.Htm. Restart dreamweaver, and select editableselecttest from the commands menu. Database controls...

  • Page 58

    58 chapter 3: user interfaces for extensions the following figure shows an advanced recordset dialog box that uses a database tree control and a variable grid control: adding a database tree control the database tree control has the following attributes: any option tags that are placed inside the se...

  • Page 59

    Using custom ui controls in extensions 59 to add a database tree control to a dialog box, you can use the following sample code with appropriate substitutions for quoted variables: type="mmdatabasetree" connection="connectionname" noexpandbuttons showheaders> type="mmdatabasetree" connection="connec...

  • Page 60

    60 chapter 3: user interfaces for extensions adding tree controls tree controls display data in a hierarchical format and let users expand and collapse nodes in the tree. The mm:treecontrol tag lets you create tree controls for any type of information; unlike the database tree control that is descri...

  • Page 61

    Using custom ui controls in extensions 61 creating a tree control the mm:treecontrol tag creates a tree control and can use one or more tags to add structure, as described in the following list: • mm:treecolumn is an empty, optional tag that defines a column in the tree control. • mm:treenode is an ...

  • Page 62

    62 chapter 3: user interfaces for extensions the mm:treenode attributes are described in the following table: for example, the following tree control has all its nodes expanded: manipulating content within a tree control tree controls and the nodes within them are implemented as html tags. They are ...

  • Page 63

    Adding flash content to dreamweaver 63 //add the new node to the top of the selected node’s children selnode.Innerhtml = ' selected>' + selnode.Innerhtml; deleting nodes to delete the currently selected node from the document structure, use the innerhtml or outerhtml properties. The following exampl...

  • Page 64

    64 chapter 3: user interfaces for extensions a simple flash dialog box example in this example, you use dreamweaver to create a new command that displays a swf file called myflash.Swf when the user clicks the command in the commands menu. For specific information about creating commands before tryin...

  • Page 65

    Adding flash content to dreamweaver 65 save the file again. Next, exit and restart dreamweaver. Select the command > my flash movie menu option, and your flash content appears in a dreamweaver dialog box, as shown in the following figure: this example shows a simple implementation of dreamweaver’s f...

  • Page 66

    66 chapter 3: user interfaces for extensions.

  • Page 67: Chapter 4

    67 chapter 4 the dreamweaver document object model in macromedia dreamweaver mx 2004, the document object model (dom) is a critically important structure for extension builders. It lets you access and manipulate elements within a user’s document and within the extension file. A dom defines the compo...

  • Page 68

    68 chapter 4: the dreamweaver document object model which document dom? It is important to distinguish between the dom of the user’s document and the dom of the extension. The information in this chapter applies to both types of dreamweaver documents, but the way that you reference each dom is diffe...

  • Page 69

    The dreamweaver dom 69 document forms • (an array of form objects) images • (an array of image objects) layers • (an array of layer, ilayer, and absolutely positioned div and span objects ) child objects by name • nodetype • parentnode • childnodes • documentelement • body • url • parentwindow • get...

  • Page 70

    70 chapter 4: the dreamweaver document object model checkbox radio in addition to the properties that are available for all tags: checked form • in addition to the methods that are available for all tags: blur() focus() onclick password text file hidden image (field) textarea in addition to the prop...

  • Page 71

    The dreamweaver dom 71 properties and methods of the document object the following table details the properties and methods of the document object that are taken from dom level 1 and used in dreamweaver. A bullet (•) marks read-only properties. Property or method return value nodetype • node.Documen...

  • Page 72

    72 chapter 4: the dreamweaver document object model properties and methods of html tag objects every html tag is represented by a javascript object. Tags are organized in a tree hierarchy, where tag x is a parent of tag y , if y falls completely within x ’s opening and closing tags ( x content y con...

  • Page 73

    The dreamweaver dom 73 properties and methods of text objects each contiguous block of text in an html document (for example, the text within a p tag) is represented by a javascript object. Text objects never have children. The following table describes the properties and methods of text objects tha...

  • Page 74

    74 chapter 4: the dreamweaver document object model properties and methods of comment objects a javascript object represents each html comment. The following table details the properties and methods of comment objects that are taken from dom level 1 and are used in dreamweaver. A bullet (•) marks re...

  • Page 75

    The dreamweaver dom 75 the dreamweaver object has a property called systemscript that lets you query the language of the user’s operating system. Use this property if you need to include special cases in your extension code for localized operating systems, as shown in the following example: if (drea...

  • Page 76

    76 chapter 4: the dreamweaver document object model.

  • Page 77: Chapter 5

    77 chapter 5 customizing code view macromedia dreamweaver mx 2004 uses two devices in code view that help you enter code quickly and make your code readable and accurate. These two devices are code hints and code coloring. In addition, dreamweaver validates your code for the target browsers that you...

  • Page 78

    78 chapter 5: customizing code view the codehints.Xml file the codehints.Xml file contains the following entities: • a list of all the menu groups dreamweaver displays the list of menu groups when you select the code hints category from the preferences dialog box. You can open the preferences dialog...

  • Page 79

    Code hints 79 code hints tags the codehints.Xml file contains the following tags, which define code hints menus. You can use these tags to define additional code hints menus. Description the codehints tag is the root of the codehints.Xml file. Attributes none. Contents one or more menugroup tags. Co...

  • Page 80

    80 chapter 5: customizing code view description the description tag contains text that dreamweaver displays when you select the menu group from the preferences dialog box. The description text displays below the list of menu groups. The description text might optionally contain a single a tag where ...

  • Page 81

    Code hints 81 • the casesensitive attribute specifies whether the pattern is case-sensitive. The possible values for the casesensitive attribute are true , false , or a subset of the comma-separated list that you specify for the doctypes attribute. The list of document types lets you specify that th...

  • Page 82

    82 chapter 5: customizing code view container the menu tag. Example mm/images/hintmisc.Gif" /> description this tag replaces the menu tag for specifying function arguments and object methods for a code hints pop-up menu. When you type a function or method name in code view, dreamweaver opens a menu ...

  • Page 83

    Code coloring 83 container the menugroup tag. Example // function example // object method example code coloring dreamweaver lets you customize or extend the code coloring schemes that you see in code view so that you can add new keywords to a scheme or add code coloring schemes for new document typ...

  • Page 84

    84 chapter 5: customizing code view the following excerpt from the colors.Xml file illustrates the hierarchy of tags in a code coloring style file: "codecolor_htmlentity" bold= "true" italic= "true" /> "codecolor_javascriptnative" text= "#009999" /> "codecolor_javascriptnumber" text= "#ff0000" /> … ...

  • Page 85

    Code coloring 85 notice that the syntaxcolor and tagcolor tags in the colors.Xml file assign color and style values to an id string value. The id value is then used in the codecoloring.Xml file to assign a style to a scheme tag. For example, the defaulttag tag in the codecoloring.Xml excerpt has an ...

  • Page 86

    86 chapter 5: customizing code view description optional. Text values that delimit the end of the text block for this scheme. The blockend and blockstart tags must be paired and the combination must be unique. Values are not evaluated as case-sensitive. The blockend value can be one character. Multi...

  • Page 87

    Code coloring 87 description a list of characters that represent brackets. Attributes name , id • name="bracket_name" a string that assigns a name to the list of brackets. • id="id_string" required. An identifier string that maps color and style to this syntax item. Example "bracket" id= "codecolor_...

  • Page 88

    88 chapter 5: customizing code view description a text string that delimits the start of a comment block. You must specify the commentstart and commentend tags in pairs. Multiple commentstart … /commentend pairs are allowed. Attributes none. Example description a text string that delimits the end of...

  • Page 89

    Code coloring 89 example description an empty tag that indicates css rules and holds code coloring attributes. Attributes name , id • name="cssproperty_name" a string that assigns a name to the css property. • id="id_string" required. An identifier string that maps color and style to this syntax ite...

  • Page 90

    90 chapter 5: customizing code view description optional. This tag applies only to tag-based syntax (that is, where ignoretags="no" ). If this tag is present, then all tag attributes are colored according to the style assigned to this tag. If this tag is omitted, then attributes are colored the same...

  • Page 91

    Code coloring 91 description a text string that delimits the start of a comment that continues until the end of the current line. Multiple endoflinecomment … /endoflinecomment tags are allowed. Attributes none. Example description an empty tag that indicates that html special characters should be re...

  • Page 92

    92 chapter 5: customizing code view description a list of characters, each of which dreamweaver can recognize as the first character in an identifier. Attributes name , id • name="idchar1_name" a string that assigns a name to the list of identifier characters. • id="id_string" required. An identifie...

  • Page 93

    Code coloring 93 attributes none. Example no description specifies whether markup tags should be ignored. Values are yes and no ; the default is yes . Set to no when syntax is for tag markup language that is delimited by and > . Set to yes when syntax is for a programming language. Attributes none. ...

  • Page 94

    94 chapter 5: customizing code view description list of keywords for type specified in category attribute. Multiple keywords tags are allowed. Attributes name , id • name="keywords_name" a string that assigns a name to the list of keywords. • id="id_string" required. An identifier string that maps c...

  • Page 95

    Code coloring 95 description specifies a list of searchpattern tags. Attributes name , id , delimiter , escape • name="stringstart_name" a string that assigns a name to the list of search pattern strings. • id="id_string" required. An identifier string that maps color and style to this syntax item. ...

  • Page 96

    96 chapter 5: customizing code view description a string of characters that define a regular search pattern using supported wildcard characters. Multiple searchpattern tags are allowed. Attributes none. Container the regexp tag. Example description these tags contain a text string that represents th...

  • Page 97

    Code coloring 97 description contains a text string that represents the delimiter of a string escape character. Multiple stringesc tags are allowed. Attributes none. Example description this tag groups one or more tags to which you can assign a unique color and style. Attributes id , name , taglibra...

  • Page 98

    98 chapter 5: customizing code view sample code header here's some editable text   example "asp-js,asp-vb, asp.Net_csharp, asp.Net_vb, coldfusion,cfc, html, jsp,libraryitem,php_mysql " scheme= "innertext" > "asp-js,asp-vb, asp.Net_csharp, asp.Net_vb, coldfusion,cfc, html, jsp,libraryitem,php_my...

  • Page 99

    Code coloring 99 innertag this value is identical to the outertag value, except that the tag coloring is taken from the scheme inside the delimiters. This is currently used for the html tag. Nametag this value specifies that the blockstart string is the opening of a tag and blockend string is the cl...

  • Page 100

    100 chapter 5: customizing code view to make the process of defining schemes more flexible, dreamweaver lets you specify wildcard and escape characters. Wildcard characters the following is a list of wildcard characters that dreamweaver supports, along with the strings to specify them and descriptio...

  • Page 101

    Code coloring 101 escape characters the following is a list of escape characters that dreamweaver supports, along with the strings to specify them and descriptions of their usage. Maximum string length the maximum length allowed for a data string is 100 characters. For example, the following blocken...

  • Page 102

    102 chapter 5: customizing code view scheme precedence dreamweaver uses the following algorithm to color text syntax in code view: 1 dreamweaver determines the initial syntax scheme based on the document type of the current file. The file document type is matched against the scheme.Documenttype attr...

  • Page 103

    Code coloring 103 editing schemes you can edit the styles for a code coloring scheme either by editing the code coloring file or by selecting the code coloring category in the dreamweaver preferences dialog box, as shown in the following figure: for fields that you can specify more than once, such a...

  • Page 104

    104 chapter 5: customizing code view to edit styles for a scheme using the code coloring category in the preferences dialog box, double-click a document type, or click the edit coloring scheme button, to open the edit coloring scheme dialog box. To edit the style for a particular element, select it ...

  • Page 105

    Code coloring 105 code coloring examples the following code coloring examples illustrate the code coloring schemes for a cascading style document and a javascript document. The lists of keywords in the javascript example are abbreviated for the sake of keeping the example short. Css code coloring "c...

  • Page 106

    106 chapter 5: customizing code view javascript code coloring "javascript" id= "javascript" doctypes= "javascript" priority= "50" > no yes "asp-js,asp- vb,asp.Net_csharp,asp.Net_vb,coldfusion,cfc,html,jsp,libraryitem,dwtemplate ,php_mysql" scheme= "outertag" >]]> ]]> "asp-js,asp- vb,asp.Net_csharp,a...

  • Page 107

    Code validation 107 alert( "word " + i + " is " + arraywords[i]); } } var tokens = new array( "hello" , "world" ); displaywords(tokens); ]]> javascript sample text the sample text for the javascript scheme illustrates the javascript code coloring scheme as follows: * javascript */ function displaywo...

  • Page 108

    108 chapter 5: customizing code view description this tag is the root node for a set of property and value tags that are supported by a particular browser. Attributes none. Contents the property and value tags. Container none. Example . . . Description defines a supported css property for the browse...

  • Page 109

    Code validation 109 • message="message_string" the message attribute defines a message string that dreamweaver displays when it finds the property in a document. The message string describes possible limitations or workarounds for the property value. Contents value container css-support example desc...

  • Page 110

    110 chapter 5: customizing code view changing default html formatting to change general code formatting preferences, use the code format category of the preferences dialog box. To change the format of specific tags and attributes, use the tag library editor (edit > tag libraries). For more informati...

  • Page 111: Part II

    Part ii extension apis learn about functions that you need to write when you create new objects, toolbars, tag editors, floating panels, server behaviors, components, or server models. Chapter 6: insert bar objects. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ...

  • Page 113: Chapter 6

    113 chapter 6 insert bar objects in dreamweaver, objects insert specific strings of code into a user’s document. Objects commonly reside on the insert bar, on the insert menu, or both, so users can add content, such as images, layers, and tables, by clicking icons or menu options. You can add items ...

  • Page 114

    114 chapter 6: insert bar objects when a user selects an object by clicking an icon on the insert bar or by selecting an item on the insert menu, the following events occur: 1 dreamweaver calls the caninsertobject() function to determine whether to show a dialog box. 2 the object file is scanned for...

  • Page 115

    The insert bar definition file 115 note: although the insertbar and category tags use and closing tags to denote the end of their content, the tags button, checkbutton, and separator do not have related closing tags. Instead button, checkbutton, and separator use a slash (/) before the closing brack...

  • Page 116

    116 chapter 6: insert bar objects description this tag defines a pop-up menu for the insert bar. Attributes id, image, {showif}, {name}, {folder} example id="dw_imagemenu" name="images" image="common\imagemenu.Gif" folder="images"> image="common\image.Gif" enabled="" showif="" file="common\image.Htm...

  • Page 117

    The insert bar definition file 117 example name = "standard view" image="tools\standard view.Gif" checked="_view_standard" command="dw.Getdocumentdom().Setshowlayoutview(false)"/> description this tag displays a vertical line on the insert bar. Attributes {showif} example insert bar definition tag a...

  • Page 118

    118 chapter 6: insert bar objects showif="enabler" description this attribute specifies that this button should appear on the insert bar only if the given dreamweaver enabler is a true value. If you do not specify showif , the button always appears. The possible enablers are _servermodel_asp, _serve...

  • Page 119

    The insert bar definition file 119 command="api_function" description instead of referring dreamweaver to an html file with the code to insert, you can use this tag to specify a command that dreamweaver performs when the button is clicked with this tag. Example command="dw.Showtagchooser()" file="fi...

  • Page 120

    120 chapter 6: insert bar objects to reload extensions 1 control-click (windows) or option-click (macintosh) the categories menu in the insert bar’s title bar. 2 select reload extensions. Note: remember that in a multiuser operating system, you should edit copies of configuration files in your user ...

  • Page 121

    The insert bar definition file 121 to change the order of categories in the insert bar: 1 save a backup copy of insertbar.Xml (with a name such as insertbar.Backup.Xml). 2 open the original insertbar.Xml file. 3 find the category tag that corresponds to the category you want to move, and select that...

  • Page 122

    122 chapter 6: insert bar objects the objects api this section describes the functions in the objects api. You must define either the insertobject() or the objecttag() function. For details about these functions, see “insertobject()” on page 123 . The remaining functions are optional. Caninsertobjec...

  • Page 123

    The objects api 123 example the following example opens the myobjecthelp.Htm file in a browser; this file explains how to use the extension: function displayhelp(){ var myhelpfile = dw.Getconfigurationpath() + '/extensionshelp/myobjecthelp.Htm'; dw.Browsedocument(myhelpfile); } isdomrequired() descr...

  • Page 124

    124 chapter 6: insert bar objects returns dreamweaver expects a string that contains an error message or an empty string. If it returns an empty string, the object dialog box closes when the user clicks ok. If it is not empty, dreamweaver displays the error message and the dialog box remains. Enable...

  • Page 125

    The objects api 125 arguments none. Returns dreamweaver expects the string to insert into the user’s document. Example the following example of the objecttag() function inserts an object/embed combination for a specific activex control and plug-in: function objecttag() { return '' + ' + 'codebase=...

  • Page 126

    126 chapter 6: insert bar objects a simple insert object example this example adds an object to the insert bar so users can add a line through (strikethrough) selected text by clicking a button. This object is useful if a user needs to make editorial comments on a document. Because this example perf...

  • Page 127

    A simple insert object example 127 after dreamweaver applies the formatting, it should return the cursor to the document without any messages or prompting. The following example shows how the objecttag() function now reads: function objecttag() { // determine if the user is in code view. Var dom = d...

  • Page 128

    128 chapter 6: insert bar objects save this file to the configuration/objects/text folder as strikethrough.Htm, and create a graphic (gif format, 18 x 18 pixels) for use on the insert bar, as shown in the following figure: name the graphic file strikethrough.Gif, and save it in the configuration/obj...

  • Page 129

    A simple insert object example 129 to separate the html object definition file from the supporting javascript functions, create a new js file in the same folder as the original html file (for example, strikethrough.Js) and paste all the javascript functions into that file. Remove the functions from ...

  • Page 130

    dw.Getfocus(true) == 'html'){ var upcasetag = (dw.Getpreferencestring("source format", "tags upper case", "") == 'true'); /...

  • Page 131

    A simple insert object example 131 now, you can reload extensions, and test the dialog box. Clicking the red text checkbox changes the font color: clicking the ok button performs the objecttag() function, which adds the strikethrough:.

  • Page 132

    132 chapter 6: insert bar objects building an insert bar pop-up menu the dreamweaver insert bar introduces a new organization for objects and now supports pop-up menus to help organize objects into smaller groups, as shown in the following figure. The following example builds a new category on the i...

  • Page 133

    A simple insert object example 133 dom.Applyfontmarkup("color", "#0000ff"); } // just return -- don't do anything else. Return; } save addblue.Htm in the editorial folder. Now you can create an image for the blue text object, an 18 x 18 pixel gif, which will look like the following figure: save the ...

  • Page 134

    134 chapter 6: insert bar objects next, within the opening and closing category tags, add the pop-up menu using the menubutton tag and the following attributes, including a unique id (for more information about attributes, see “insert bar definition tag attributes” on page 117 ): image="editorial\st...

  • Page 135: Chapter 7

    135 chapter 7 commands macromedia dreamweaver mx 2004 commands can perform almost any kind of edit to a user’s current document, other open documents, or any html document on a local drive. Commands can insert, remove, or rearrange html tags and attributes, comments, and text. Commands are html file...

  • Page 136

    136 chapter 7: commands adding commands to the commands menu dreamweaver automatically adds any files that are inside the configuration/commands folder to the bottom of the commands menu. To prevent a command from appearing in the commands menu, insert the following comment on the first line of the ...

  • Page 137

    The commands api 137 returns dreamweaver expects an array that contains an even number of elements. The first element is a string that contains the label for the topmost button. The second element is a string of javascript code that defines the behavior of the topmost button when it is clicked. The ...

  • Page 138

    138 chapter 7: commands windowdimensions() description sets specific dimensions for the parameters dialog box. If this function is not defined, the window dimensions are computed automatically. Note: do not define this function unless you want an options dialog box that is larger than 640 x 480 pixe...

  • Page 139

    A simple command example 139 creating the ui the ui is a form that contains two radio buttons that let the user select uppercase or lowercase. The following example shows the html code to create the form: uppercase lowercase the contents of the title tag, make uppercase or lowercase , appears in the...

  • Page 140

    140 chapter 7: commands writing the javascript code the following example consists of two extension api functions, canacceptcommand() and commandbuttons() , which dreamweaver calls, and one user-defined function, changecase() which is called from the commandbuttons() function. Canacceptcommand() whe...

  • Page 141

    A simple command example 141 the next part of the return statement ( && (theselnode.Nodetype == node.Text_node ) checks to see if the selected node type is text. If so, the canacceptcommand() function returns the value true . If the node type is not text, the test continues to see if the node has ch...

  • Page 142

    142 chapter 7: commands commandbuttons() when the user clicks a menu item, the extension needs a mechanism that lets the user select uppercase or lowercase. The ui provides this mechanism by defining two radio buttons to let the user make that choice. The commandbuttons() function causes dreamweaver...

  • Page 143

    A simple command example 143 next, changecase() calls getselectednode() to retrieve the node that contains the selected text. It also retrieves any child nodes ( theselnode.Childnodes) in case the selection is a tag that contains text, such as text : // get the node containing the selection var thes...

  • Page 144

    144 chapter 7: commands finally, changecase() resets the selection and calls window.Close() to close the ui. The code looks like the following example: // set the selection back to where it was when you // started thedom.Setselection(thesel[0],thesel[1]); window.Close(); // close extension ui } runn...

  • Page 145: Chapter 8

    145 chapter 8 menus and menu commands macromedia dreamweaver mx 2004 creates all its menus from the structure defined in the menus.Xml file in the dreamweaver configuration/menus folder. You can rearrange, rename, and remove menu items by editing the menus.Xml file. You can also add, change, and rem...

  • Page 146

    146 chapter 8: menus and menu commands about the menus.Xml file the menus.Xml file contains a structured list of menu bars, menus, menu items, separators, shortcut lists, and keyboard shortcuts. These items are described by xml tags that you can edit in a text editor. Note: be careful when making ch...

  • Page 147

    About the menus.Xml file 147 example the main (document window) menu bar uses the following menubar tag: description provides information about a menu or submenu to appear in the dreamweaver menu structure. Attributes name, {app}, id, {platform}, {showif} • name the name of the menu as it will appea...

  • Page 148

    148 chapter 8: menus and menu commands attributes name, id, {app}, {key}, {platform}, {enabled}, {arguments}, {command}, {file}, {checked}, {dynamic}, {isdomrequired}, {showif} • name the menu item name that appears in the menu. An underscore indicates that the following letter is the command’s acce...

  • Page 149

    About the menus.Xml file 149 • dynamic if present, indicates that a menu item is to be determined dynamically, by an html file; the file contains javascript code to set the text and state of the menu item. If you specify a tag as dynamic , you must also specify a file attribute. • isdomrequired indi...

  • Page 150

    150 chapter 8: menus and menu commands description specifies a shortcut list in the menus.Xml file. Attributes {app}, id, {platform} • app the name of the application in which the shortcut list is available. Not currently used. • id the id for the shortcut list. It should be the same as the menu id ...

  • Page 151

    Changing menus and menu items 151 • id a unique identifier for a shortcut. • name a name for the command executed by the keyboard shortcut, in the style of a menu item name. For example, the name attribute for the f12 shortcut is "preview in primary browser " . Contents none (empty tag). Container t...

  • Page 152

    152 chapter 8: menus and menu commands to move a menu: 1 quit dreamweaver. 2 make a backup copy of the menus.Xml file. 3 open menus.Xml in a text editor such as bbedit, homesite, or wordpad. (don’t open it in dreamweaver.) 4 cut an entire menu and its contents, from the opening menu tag to the closi...

  • Page 153

    Changing menus and menu items 153 8 between the double quotation marks (") of the key attribute, enter the new keyboard shortcut. Use a plus (+) sign between the keys in a key combination. For more information about modifiers, see the description of the menuitem tag in . If the keyboard shortcut is ...

  • Page 154

    154 chapter 8: menus and menu commands menu commands menu commands make menus more flexible and dynamic. As with regular commands, menu commands can perform almost any kind of edit to the current document, other open documents, or any html document on a local drive. The menu commands api expands the...

  • Page 155

    Menu commands 155 to delete a command you’ve created: 1 select commands > edit command list. A dialog box appears, listing all the commands you can delete. (commands that are in the default commands menu don’t appear on this list and can’t be deleted using this approach.) 2 select a command to delet...

  • Page 156

    156 chapter 8: menus and menu commands 9 the user selects options in the dialog box. Dreamweaver executes event handlers that are associated with the fields as the user encounters them. 10 the user clicks one of the buttons that are defined by the commandbuttons() function. 11 dreamweaver executes t...

  • Page 157

    The menu commands api 157 example the following example of the commandbuttons() function defines the ok, cancel, and help buttons: function commandbuttons(){ return new array("ok" , "docommand()" , "cancel" , ¬ "window.Close()" , "help" , "showhelp()"); } getdynamiccontent() description retrieves th...

  • Page 158

    158 chapter 8: menus and menu commands iscommandchecked() description determines whether to display a check mark next to the menu item. Arguments {arg1}, {arg2},...{argn} • if it is a dynamic menu item, the unique id that the getdynamiccontents() function specifies is the only argument. Otherwise, i...

  • Page 159

    The menu commands api 159 receivearguments() description processes any arguments passed from a menu item or from the dw.Runcommand() function. If it is a dynamic menu item, it processes the dynamic menu item id. Arguments {arg1}, {arg2},...{argn} • if it is a dynamic menu item, the unique id that th...

  • Page 160

    160 chapter 8: menus and menu commands example function setmenutext() { if (arguments.Length != 1) return ""; var whattodo = arguments[0]; if (whattodo == "undo") return dw.Getundotext(); else if (whattodo == "redo") return dw.Getredotext(); else return ""; } windowdimensions() description sets spec...

  • Page 161

    A simple menu command 161 a simple menu command this simple menu command example shows how undo and redo menu commands might work. The undo menu item reverses the effect of a user’s editing operation, and the redo item reverses an undo operation and restores the effect of the user’s last editing ope...

  • Page 162

    162 chapter 8: menus and menu commands canacceptcommand() dreamweaver calls the canacceptcommand() function for each menu item in the mymenu menu to determine whether it should be enabled or disabled. In the mymenu.Htm file, the canacceptcommand() function checks the value of arguments[0] to determi...

  • Page 163

    A simple menu command 163 for more information about the dw.Undo() and dw.Redo() functions, see the dreamweaver api reference. In this command, the receivearguments() function processes the arguments and executes the command. More complex menu commands might call different functions to execute the c...

  • Page 164

    164 chapter 8: menus and menu commands placing the command file in the menu folder to implement the menu undo and redo menu items, you must save the mymenu.Htm command file in the dreamweaver configuration/menus folder or a subfolder that you create. The location of the file must agree with the loca...

  • Page 165

    A dynamic menu 165 writing the javascript code because the first menuitem tag contains the dynamic attribute, dreamweaver calls the getdynamiccontent() function in the pib_dynamic.Js file, which is shown in the following example: function getdynamiccontent(itemid) { var browsers = null; var pib = nu...

  • Page 166

    166 chapter 8: menus and menu commands canacceptcommand() dreamweaver next calls the canacceptcommand() function for each menuitem tag that references a command file with the file attribute. If the canacceptcommand() function returns the value false , the menu item is dimmed. If the canacceptcommand...

  • Page 167

    A dynamic menu 167 // for server connections, the files will // already be remote urls. If (selfile.Indexof("://") == (-1)) { var urlprefix = "file:///"; var strtemp = selfile.Substr(urlprefix.Length); if (selfile.Indexof(urlprefix) == -1) bhavepreviewtarget = false; else if (strtemp.Indexof("/") ==...

  • Page 168

    168 chapter 8: menus and menu commands for each item in the selected list, the function tests for the presence of the character string " :// ". If it is not found, the code performs a series of tests on the list item. If the item is not in the form of a file:/// url ( if (selfile.Indexof(urlprefix) ...

  • Page 169

    A dynamic menu 169 // only launch the browser if we have a valid browser selected if (thebrowser != "file:///" && typeof(thebrowser) != "undefined" && thebrowser.Length > 0) { if (dw.Getfocus(true) == 'site') { // only get the first item of the selection because // browsedocument() can't take an arr...

  • Page 170

    170 chapter 8: menus and menu commands if the user entered the shortcut keys ( f12 or ctrl+f12 ) and no primary or secondary browser has been specified, a dialog box appears to inform the user. If the user clicks ok, the function calls the function dw.Showpreferencesdialog() with the browsers argume...

  • Page 171: Chapter 9

    171 chapter 9 toolbars you can create a toolbar for macromedia dreamweaver mx 2004 simply by creating a file that defines the toolbar and placing that file in the configuration/toolbars folder. Within a toolbar file, you can define items such as check buttons, radio buttons, text boxes, and pop-up m...

  • Page 172

    172 chapter 9: toolbars how toolbars behave in windows, dreamweaver toolbars generally act the same as standard windows toolbars. Dreamweaver toolbars have the following characteristics: • you can drag and drop toolbars to dock them, undock them, and reposition them relative to other toolbars. • you...

  • Page 173

    The toolbar definition file 173 5 dreamweaver calls the getcurrentvalue() function on every update cycle, as specified by the update attribute, to determine what value to display for the control. 6 the user selects an item on the toolbar. 7 dreamweaver calls the receivearguments() function to proces...

  • Page 174

    174 chapter 9: toolbars description defines a toolbar. Dreamweaver displays the items and separators from left to right in the specified order, laying out the items automatically. The toolbar file does not specify control over the spacing between the items, but you can specify the widths of certain ...

  • Page 175

    The toolbar definition file 175 as with the initiallyvisible attribute, the initialposition attribute applies only the first time that dreamweaver loads the toolbar. After that, the toolbar’s position is saved to the registry or the dreamweaver preferences file. You can reset the position of the too...

  • Page 176

    176 chapter 9: toolbars description defines a single toolbar item. Toolbar items include buttons, radio buttons, check buttons, combo boxes, pop-up menus, and so on. For a list of the types of toolbar items that you can define, see “toolbar item tags” on page 177 . Attributes the attributes vary, de...

  • Page 177

    Toolbar item tags 177 description inserts a separator at the current location in the toolbar. Attributes {showif} • the showif attribute specifies that the separator should appear only on the toolbar if the given script returns true . For example, you can use the showif attribute to show the separat...

  • Page 178

    178 chapter 9: toolbars example image="toolbars/images/mm/refresh.Gif" disabledimage="toolbars/images/mm/refresh_dis.Gif" tooltip="refresh design view (f5)" enabled="((dw.Getdocumentdom() != null) && (dw.Getdocumentdom().Getview() != 'browse') && (!Dw.Getdocumentdom().Isdesignviewupdated()))" comman...

  • Page 179

    Toolbar item tags 179 radio buttons act the same as the code view, design view, and split view buttons on the dreamweaver document toolbar. Attributes id, image, tooltip, checked, command, {showif}, {disabledimage}, {overimage}, {label}, {file}, {domrequired}, {enabled}, {update}, {arguments} for a ...

  • Page 180

    dw.Getfocus() == 'html'" menuid="dwcodenavpopup" update="onviewchange"/> description a dropdown menu is a nonedi...

  • Page 181

    Toolbar item tags 181 container the toolbar tag or the toolbarset tag. Example width="300" tooltip="address" label="address: " file="toolbars/mm/addressurl.Htm" update="onbrowserpagebusychange"/> description an edit control box is a text-editing box that executes its command when the user changes te...

  • Page 182

    182 chapter 9: toolbars container the toolbar tag or the toolbarset tag. Example image="toolbars/images/colorpickericon.Gif" disabledimage="toolbars/images/colorpickericond.Gif" colorrect="0 12 16 16" tooltip="text color" domrequired="false" file="toolbars/mine/colorexample.Htm" update="onselchange"...

  • Page 183

    Item tag attributes 183 if an icon is specified for a color picker, the icon replaces the color picker entirely. If the colorrect attribute is also set, the current color appears on top of the icon in the specified rectangle. Example image="toolbars/images/mm/codenav.Gif" disabledimage="image_path" ...

  • Page 184

    184 chapter 9: toolbars width="number" optional. This attribute applies only to text box, pop-up menu, and combo box items by specifying the width of the item in pixels. If you do not specify the width attribute, dreamweaver uses a reasonable default width. Example width="150" menuid="menu_id" this ...

  • Page 185

    Item tag attributes 185 enabled="script" optional. As with menus, the script returns a value that specifies whether the item is enabled. If you do not specify this attribute, it defaults to enabled. The enabled attribute is equivalent to the canacceptcommand() function in a toolbar command file. Exa...

  • Page 186

    186 chapter 9: toolbars the following list shows the possible handlers for update_frequency_list , from least to most frequent. If you do not specify the update attribute, the update frequency defaults to onedit frequency. You can specify multiple update frequencies, separated by commas. The handler...

  • Page 187

    The toolbar command api 187 example on a toolbar that has undo and redo buttons, each button calls the menu command file, edit_clipboard.Htm, and passes an argument that specifies the action, as shown in the following example: image="toolbars/images/mm/undo.Gif" disabledimage="toolbars/images/mm/und...

  • Page 188

    188 chapter 9: toolbars returns dreamweaver expects a boolean value; true if the item is enabled; false otherwise. Example function canacceptcommand() { return (dw.Getdocumentdom() != null); } getcurrentvalue() availability dreamweaver mx. Description returns the current value to display in the item...

  • Page 189

    The toolbar command api 189 the name getdynamiccontent() is a misnomer because this function should be used even if the list of entries in the menu is fixed. For example, the text_size.Htm file in the configuration/ menus/mm folder is not a dynamic menu; it is designed to be called from each one of ...

  • Page 190

    190 chapter 9: toolbars getmenuid() availability dreamweaver mx. Description only valid for menu buttons. Dreamweaver calls the getmenuid() function to get the id of the menu that should appear when the user clicks the button. Arguments none. Returns dreamweaver expects a string that contains a menu...

  • Page 191

    The toolbar command api 191 getupdatefrequency() availability dreamweaver mx. Description specifies how often to run the handlers for the enabled , checked , showif , and value attributes to update the visible state of the item. You must specify the update frequency for toolbar items because they ar...

  • Page 192

    192 chapter 9: toolbars returns dreamweaver expects a boolean value: true if the item is checked; false otherwise. Example the following example determines which item, if any, should be checked in a pop-up menu of paragraph formats and css styles: function iscommandchecked() { var bchecked = false; ...

  • Page 193

    The toolbar command api 193 example function isdomrequired() { return false; } receivearguments() availability dreamweaver mx. Description processes any arguments that pass from a toolbar item. The receivearguments() function is equivalent to the command attribute in a toolbar item tag. Arguments fo...

  • Page 194

    194 chapter 9: toolbars arguments none. Returns dreamweaver expects a boolean value: true if the item appears; false otherwise. Example function showif() { var retval = false; var dom = dw.Getdocumentdom(); if(dom) { var view = dom.Getview(); if(view == ‘design’) { retval = true; } } return retval; ...

  • Page 195

    A simple toolbar command file 195 writing the javascript code when the user interacts with the text box, it causes dreamweaver to invoke the edittitle.Htm command file in the toolbars/mm folder. This file contains three javascript functions that operate on the title text box. These functions are can...

  • Page 196

    196 chapter 9: toolbars until the user enters a title for the document, the gettitle() function returns untitled document, which appears in the text box. After the user enters a title, the gettitle() function returns that value, and dreamweaver displays it as the new document title. Placing the file...

  • Page 197: Chapter 10

    197 chapter 10 reports you can use the reports api functions to create custom site reports or modify the set of prewritten reports that come with macromedia dreamweaver mx 2004. You can access site reports only through the site reports dialog box. You can use the results window api to create a stand...

  • Page 198

    198 chapter 10: reports how site reports work 1 reports are accessible through the site > reports... Menu. When it is selected, this menu item displays a dialog box from which the user selects reports to run on a choice of targets. 2 the user selects which files to run the selected reports on using ...

  • Page 199

    The reports api 199 the reports api the only required function for the reports api is the processfile() function. All other functions are optional. Processfile() availability dreamweaver 4. Description this function is called when there is a file to process. The report command should process the fil...

  • Page 200

    200 chapter 10: reports endreporting() availability dreamweaver 4. Description this function is called at the end of the report process. Arguments none. Returns dreamweaver expects nothing. Commandbuttons() availability dreamweaver 4. Description defines the buttons that should appear on the right s...

  • Page 201

    The reports api 201 configuresettings() availability dreamweaver 4. Description determines whether the report settings button should be enabled in the reports dialog box when this report is selected. Arguments none. Returns dreamweaver expects a boolean value: true if the report settings button shou...

  • Page 202

    202 chapter 10: reports.

  • Page 203: Chapter 11

    203 chapter 11 tag libraries and editors macromedia dreamweaver mx 2004 users can use tag editors to insert new tags, edit existing tags, and access reference information about tags. Dreamweaver comes with editors for the following languages: html, asp.Net, cfml, jrun, and jsp. You can customize tag...

  • Page 204

    204 chapter 11: tag libraries and editors tag library file format a tag library consists of a single root file, the taglibraries.Vtm file, that lists every installed tag, plus a vtml file for each tag in the tag library. The taglibraries.Vtm file functions as a table of contents and contains pointer...

  • Page 205

    Tag library file format 205 the taglibrary tag groups one or more tags into a tag library. When you import tags or create a new set of tags, you can group them into tag libraries. Typically, a taglibrary grouping corresponds to a set of tags that are defined in a javaserver pages (jsp) tld file, an ...

  • Page 206

    206 chapter 11: tag libraries and editors the following table lists tagref attributes : because the tagref.Prefix attribute can override the taglibrary.Prefix attribute, the relationship between the two attributes can be confusing. The following table shows the relationship between the taglibrary.Pr...

  • Page 207

    Tag library file format 207 the following table lists the attributes that define tags: attribute description mandatory/ optional tag.Bind used by the data binding panel. When you select a tag of this type, the bind attribute indicates the default attribute for data binding. Optional tag.Casesensitiv...

  • Page 208

    208 chapter 11: tag libraries and editors note: in versions before dreamweaver mx, tag information is stored in the configuration/ tagattributelist.Txt file . The tag chooser the tag chooser lets you view tags in functional groups so you can easily access frequently used tags. In order to add a tag ...

  • Page 209

    The tag chooser 209 id"> desc='description for incorporated reference' reference="language,topic[,subtopic]" id="unique id"> reference="language[,topic[,subtopic]]" id="unique id"/> ... More elements to display in the list view ... Desc='description for incorporated reference' reference="language,to...

  • Page 210

    210 chapter 11: tag libraries and editors the following table lists the attributes of the element tag, which represents the tag to insert: creating a new tag editor the examples in this section use cfweather , a hypothetical coldfusion tag designed to extract the current temperature from a weather d...

  • Page 211

    Creating a new tag editor 211 registering the tag in the tag library for dreamweaver to recognize the new tag, it must be identified in the taglibraries.Vtm file, which is located in the configuration/taglibraries folder. However, if the user is on multiuser platform (such as windows xp, windows 200...

  • Page 212

    212 chapter 11: tag libraries and editors creating a tag definition (vtml) file when a user selects a registered tag using the tag chooser or a tag editor, dreamweaver searches for a corresponding vtml file for the tag definition. To create a tag definition file: 1 in a text editor, create a file wi...

  • Page 213

    Creating a new tag editor 213 // in tagdialogcmns.Js (note that it's been included) // for more information about this function, look at the comments // for applytagcommon in tagdialogcmn.Js tagdialog.Applytagcommon(tagnodeobj, theuiobjects); } function initializeui() { // define two arrays for the ...

  • Page 214

    214 chapter 11: tag libraries and editors adding a tag to tag chooser to add the cfweather tag to the tag chooser: 1 modify the tagchooser.Xml file in the configuration/taglibraries/cfml folder by adding a new category called third party tags, which features the cfweather tag, as shown in the follow...

  • Page 215

    Tag editor apis 215 example suppose the user edits the following tag: if the editor contains a text field for editing the zip attribute, the function needs to initialize the form element so that the user sees the actual zip code in the text field, rather than an empty field. The following code perfo...

  • Page 216

    216 chapter 11: tag libraries and editors applytag() availability dreamweaver mx. Description when the user clicks ok, dreamweaver calls the validatetag() function. If the validatetag() function returns a true value, dreamweaver calls this function and passes the dom object that represents the curre...

  • Page 217: Chapter 12

    217 chapter 12 property inspectors the property inspector is perhaps the most familiar floating panel in the macromedia dreamweaver mx 2004 interface. It is indispensable for defining, reviewing, and changing the name, size, appearance, and other attributes of the selection as well as for launching ...

  • Page 218

    218 chapter 12: property inspectors the following comment is appropriate for an inspector that is designed to inspect the happy tag: in some cases, you might want to specify that your extension use only dreamweaver extension rendering (and not the previous rendering engine) by inserting the followin...

  • Page 219

    The property inspector api 219 the property inspector api two of the property inspector api functions ( caninspectselection() and inspectselection() ) are required. Caninspectselection() description determines whether the property inspector is appropriate for the current selection. Arguments none. U...

  • Page 220

    220 chapter 12: property inspectors example the following example of the displayhelp() function opens a file in a browser window. The file explains the fields of the property inspector. Function displayhelp(){ dw.Browsedocument(‘http://www.Hooha.Com/dw/inspectors/insphelp.Html’); } inspectselection(...

  • Page 221

    The property inspector api 221 function inspectselection(){ // get the dom of the current document var // thedom = dw.Getdocumentdom(); // get the selected node var theobj = thedom.Getselectednode(); // get the value of the type attribute on the intj tag var // thetype = theobj.Getattribute('type');...

  • Page 222

    222 chapter 12: property inspectors name="interjectionimage"> height:17px; z-index:16; left: 44px; top: 5px">interjection left: 125px; top: 3px; width: 431px; height: 32px"> onchange="setinterjectiontag()"> jeepers jinkies zoinks onchange="setinterjectiontag()"> jeepers jinkies zoinks.

  • Page 223: Chapter 13

    223 chapter 13 floating panels you can create any kind of floating panel or inspector without the size and layout limitations of property inspectors. Although a custom property inspector should be your first choice for setting the properties of the current selection, custom floating panels offer mor...

  • Page 224

    224 chapter 13: floating panels when one of the files inside the configuration folder calls the dw.Getfloatervisibility(floatername) , dw.Setfloatervisibility(floatername) , or dw.Togglefloater(floatername) functions, the following events occur: 1 if floatername is not one of the reserved floating p...

  • Page 225

    The floating panel api 225 example // the following instance of displayhelp() opens // in a browser a file that explains how to use // the extension. Function displayhelp(){ var myhelpfile = dw.Getconfigurationpath() + '/extensionshelp/superduperhelp.Htm'; dw.Browsedocument(myhelpfile); } documented...

  • Page 226

    226 chapter 13: floating panels arguments none. Returns dreamweaver expects a string containing the words "left" , "right" , "top" , and "bottom" , or a combination of them, that specifies where dreamweaver can dock the floating panel. Example getdockingside() { return dock_side = “left top”; } init...

  • Page 227

    The floating panel api 227 returns dreamweaver expects a string of the form "floatername1,floatername2,...Floaternamen" . Example the following example of the initialtabs() function specifies that the first time the floating panel appears, it should be tabbed with the scripteditor floating panel: fu...

  • Page 228

    228 chapter 13: floating panels isresizable() availability dreamweaver 4. Description determines whether a user can resize a floating panel. If the function is not defined or returns a true value, the user can resize the floating panel. If the function returns a false value, the user cannot resize t...

  • Page 229

    The floating panel api 229 /* check to see if the node is a script marker */ if (thenode.Nodetype == node.Element_node && ¬ thenode.Tagname == "script"){ document.Layers['blanklayer'].Visibility = 'hidden'; document.Layers['scriptlayer'].Visibility = 'visible';} else{ document.Layers['scriptlayer']....

  • Page 230

    230 chapter 13: floating panels /* display information for the next unprocessed layer. Displaylayer() is a function you would write to perform the "magic". */ displaylayer(document.Layers[document.Numprocessed]); /* if there's more work to do, set a timeout to process * the next layer. If we're fini...

  • Page 231

    Script editor: a floating panel extension 231 (no script selected) visibility: visible"> onblur="updatescript()"> onblur="updatescript()"> both div tags use the style attribute to specify the position ( absolute ), size ( width: 422px and height:181px ), and default visibility setting ( visible ) of...

  • Page 232

    232 chapter 13: floating panels the selectionchanged() function for the script editor contains the following code: function selectionchanged(){ /* get the selected node */ var thedom = dw.Getdocumentdom(); var thenode = thedom.Getselectednode(); /* check to see if the node is a script marker */ if (...

  • Page 233

    Script editor: a floating panel extension 233 if the selected node is not an element, or it is not a script tag, the selectionchanged() function makes the layer blanklayer visible and hides scriptlayer . The blanklayer floating panel displays the text (no script selected), as shown in the following ...

  • Page 234

    234 chapter 13: floating panels creating a menu item it is not sufficient to save the script editor code in the configuration/floaters folder. You must also call either the dw.Setfloatervisibility('scripteditor',true) function or the dw.Togglefloater('scripteditor') function to load the floating pan...

  • Page 235: Chapter 14

    235 chapter 14 behaviors behaviors let users make their html pages interactive. They offer web designers an easy way to assign actions to page elements by filling in an html form. You should write behavior actions when you want to share functions with users or when you want to insert the same javasc...

  • Page 236

    236 chapter 14: behaviors how behaviors work when a user selects an html element in a dreamweaver document and clicks the plus (+) button, the following events occur: 1 dreamweaver calls the canacceptbehavior() function in each action file to see whether this action is appropriate for the document o...

  • Page 237

    The behaviors api 237 the behaviors api two behaviors api functions are required ( applybehavior() and behaviorfunction() ); the rest are optional. Applybehavior() description this function inserts into the user’s document an event handler that calls the function that the behaviorfunction() function...

  • Page 238

    238 chapter 14: behaviors document.Theform.Width.Value); if (document.Theform.Height.Value) argarray[arrayindex++] = ("height=" + ¬ document.Theform.Height.Value); theurl = escape(document.Theform.Url.Value); thename = document.Theform.Winname.Value; return "mm_openbrwindow('"+theurl+"',¬ '"+thename...

  • Page 239

    The behaviors api 239 canacceptbehavior() description this function determines whether the action is allowed for the selected html element and specifies the default event that should trigger the action. Can also check for the existence of certain objects (such as swf files) in the user’s document an...

  • Page 240

    240 chapter 14: behaviors example // the following instance of displayhelp() opens // in a browser a file that explains how to use // the extension. Function displayhelp(){ var myhelpfile = dw.Getconfigurationpath() + '/extensionshelp/superduperhelp.Htm'; dw.Browsedocument(myhelpfile); } deletebehav...

  • Page 241

    The behaviors api 241 • the url argument type specifies that the argument is both a navigational url and a dependent url or that it is a url of an unknown type and should appear in the site map and be considered a dependent file when downloading from or uploading to a server. • the ns4.0ref argument...

  • Page 242

    242 chapter 14: behaviors inspectbehavior() description this function inspects the function call for a previously applied behavior in the user’s document and sets the values of the options in the parameters dialog box accordingly. If the inspectbehavior() function is not defined, the default option ...

  • Page 243

    The behaviors api 243 the returned dimensions are smaller than the size of the entire dialog box because they do not include the area for the ok and cancel buttons. If the returned dimensions do not accommodate all options, scroll bars appear. Example the following instance of windowdimensions() set...

  • Page 244

    244 chapter 14: behaviors //******************* api ********************** function canacceptbehavior(){ return true; } // return the name of the function to be inserted into // the head of the user's document function behaviorfunction(){ return "checkbrowserbrand"; } // create the function call tha...

  • Page 245

    The behaviors api 245 netscape navigator: onclick="browseforurls('nsurl')"> microsoft internet explorer: onclick="browseforurls('ieurl')">.

  • Page 246

    246 chapter 14: behaviors.

  • Page 247: Chapter 15

    247 chapter 15 server behaviors macromedia dreamweaver mx 2004 provides users with an interface for adding server behaviors into their documents to perform server-side tasks such as filtering records based on user criteria, paging through records, linking result lists to details pages, and inserting...

  • Page 248

    248 chapter 15: server behaviors note: for information about participants, participant groups, and how dreamweaver edml files are structured, see “extension data markup language” on page 248 . Dreamweaver architecture when you use the server behavior builder to create a dreamweaver-specific extensio...

  • Page 249

    Dreamweaver architecture 249 participant files a participant represents a single code block on the page, such as a server tag, an html tag, or an attribute. A participant file must be listed in a group file to be available to a dreamweaver document author. Several group files can use a single partic...

  • Page 250

    250 chapter 15: server behaviors to create a new dynamic page document: 1 in dreamweaver, select the file > new menu option. 2 in the new document dialog box, select category: dynamic page and dynamic page: asp javascript 3 click create. To use the server behavior builder to define your new server b...

  • Page 251

    How the server behavior api functions are called 251 how the server behavior api functions are called the server behavior api functions are called in the following scenarios: • the findserverbehaviors() function is called when the document opens and again when the participant is edited. It searches ...

  • Page 252

    252 chapter 15: server behaviors if you do not want a file that is in the serverbehaviors folder to appear in the menu, put the following statement on the first line in the html file: • when the user selects an item from the menu, the canapplyserverbehavior() function is called. If that function ret...

  • Page 253

    The server behavior api 253 the server behavior api you can manage server behaviors with the following api functions. Analyzeserverbehavior() availability dreamweaver ultradev 1 description lets server behaviors set their incomplete and deleted properties. After the findserverbehaviors() function is...

  • Page 254

    254 chapter 15: server behaviors applyserverbehavior() availability dreamweaver ultradev 1. Description reads values from the form elements in the dialog box and adds the behavior to the user’s document. Dreamweaver calls this function when the user clicks ok in the server behaviors dialog box. If t...

  • Page 255

    The server behavior api 255 copyserverbehavior() availability dreamweaver ultradev 1. Description implementing the copyserverbehavior() function is optional. Users can copy instances of the specified server behavior. In the following example, this function is implemented for recordsets. If a user se...

  • Page 256

    256 chapter 15: server behaviors displayhelp() description if this function is defined, a help button appears below the ok and cancel buttons in the dialog box. This function is called when the user clicks the help button. Arguments none. Returns dreamweaver expects nothing. Example // the following...

  • Page 257

    The server behavior api 257 inspectserverbehavior() availability dreamweaver ultradev 1. Description determines the settings for the server behavior dialog box, based on the specified behavior object. Dreamweaver calls the inspectserverbehavior() function when a user opens a server behavior dialog b...

  • Page 258

    258 chapter 15: server behaviors server behavior implementation functions these functions can be added or edited within the html script files or the specified javascript files that are listed within the html script file. Dwscripts.Findsbs() availability dreamweaver mx (this function replaces the fin...

  • Page 259

    Server behavior implementation functions 259 dwscripts.Applysb() availability dreamweaver mx (this function replaces the applysb() function from earlier versions of dreamweaver). Description inserts or updates runtime code for the server behavior. If the sbobj parameter has a null value, it inserts ...

  • Page 260

    260 chapter 15: server behaviors arguments sbobj • the sbobj argument is the server behavior object instance that you want to remove from the user’s document. Returns dreamweaver expects nothing. Example the following example deletes all the participants of the sbobj server behavior, except the part...

  • Page 261

    Editing edml files 261 the edml tag declares that runtime code needs to be searched. Each ... Subtag defines one pattern in the runtime code that must be identified. For the redirect if empty example, there are two patterns. In the following example, to extract parameter values from response.Redirec...

  • Page 262

    262 chapter 15: server behaviors the asp runtime code is wrapped within the cdata tag, as shown in the following example: ]] because of the cdata tag, the asp tags , along with the other content within the tag, aren’t processed. Instead, the extension data manager (edm) receives the uninterpreted te...

  • Page 263

    Group edml file tags 263 required no. Serverbehavior description the serverbehavior attribute indicates which server behavior can use the group. When any of the group’s participant quicksearch strings are found in the document, the server behavior that is indicated by the serverbehavior attribute ha...

  • Page 264

    264 chapter 15: server behaviors value the exact name of a data source file within a configuration/datasources folder, as shown in the following example: datasource="mycomdatasource.Htm"> this group defines a new implementation of the repeat region server behavior to use if you use the com data sour...

  • Page 265

    Group edml file tags 265 this group attribute defines the long version of the myserverbehavior subtype. You would also have a version with the subtype="shortversion" attribute. In the applyserverbehaviors() function, you can indicate which group should be applied by setting the mm_subtype property o...

  • Page 266

    266 chapter 15: server behaviors attributes the following items are valid attributes of the groupparticipants tag. Selectparticipant description indicates which participant should be selected and highlighted in the document when an instance is selected in the server behaviors panel. The server behav...

  • Page 267

    Group edml file tags 267 name description this attribute names a particular participant to be included in the group. The name attribute on the groupparticipant tag should be the same as the filename of the participant (without the .Edml file extension). Parent groupparticipant type attribute. Requir...

  • Page 268

    268 chapter 15: server behaviors • the multiple value indicates that the participant is optional and multiple copies of it can be associated with the server behavior. Any parameters that are unique to this participant are not used when grouping participants because they might have different values. ...

  • Page 269

    Participant edml files 269 required no. Description this tag is a simple search string that is used for performance reasons. It cannot be a regular expression. If the string is found in the current document, the rest of the search patterns are called to locate specific instances. This string can be ...

  • Page 270

    270 chapter 15: server behaviors value the value is the text to insert in the document. If any parts of the text need customizing, they can be passed in later as parameters. Parameters should be embedded within two at ( @@ ) signs. Because this text can interfere with the edml structure, it should u...

  • Page 271

    Participant edml files 271 • the beforeselection value inserts the text before the current selection or insertion point. If there is no selection, it inserts the text at the end of the body tag. • the replaceselection value replaces the current selection with the text. If there is no selection, it i...

  • Page 272

    272 chapter 15: server behaviors required this attribute is required only if the insert location contains the word node . Value the tagtype__tag value is a user-specified name for the node parameter that passes with the parameter object to the dwscripts.Applysb() function. For example, if you insert...

  • Page 273

    Participant edml files 273 attributes the following items are valid attributes of the searchpatterns tag. Wheretosearch description this attribute specifies where to search for the participant text. This attribute is related to the insert location, so be sure to set each attribute carefully (see “lo...

  • Page 274

    274 chapter 15: server behaviors description this tag is a pattern that identifies participant text and extracts parameter values from it. Each parameter subexpression must be enclosed in parentheses (). You can have patterns with no parameters (which are used to identify participant text), patterns...

  • Page 275

    Participant edml files 275 sometimes you might want to assign the entire contents of the limited search location to a parameter. In that case, provide no pattern, as shown in the following example: my_option_name this example sets the optionlabel parameter to the entire innerhtml contents of an opti...

  • Page 276

    276 chapter 15: server behaviors there are two parameters (with some text in between them) to extract. Given the text: , the first subexpression in the search pattern matches "a" , so p1="a" . The second subexpression is ignored (note the ,, in the paramname value). The third subexpression matches "...

  • Page 277

    Participant edml files 277 type attribute. Required no. Values true , false • the value is true if the searchpattern is not necessary to identify the participant. • the value is false (default) if the searchpattern tag is required. For example, consider the following simple recordset string: var rec...

  • Page 278

    278 chapter 15: server behaviors type block tag. Required no. Description this tag is a specific type of regular expression that lets you update participant text precisely. There should be at least one update pattern definition for every unique parameter that is declared in the insertion text (of th...

  • Page 279

    Participant edml files 279 if the participant text is long and complex, you might need multiple patterns to update a single parameter, as shown in the following example: recordset1.Cursortype = 0; recordset1.Cursorlocation = 2; recordset1.Locktype = 3; %> to update the recordset name in all three po...

  • Page 280

    280 chapter 15: server behaviors description this tag is an optional advanced feature lets you control how to delete a participant. Without this tag, the participant is deleted by removing it completely but only if no server behaviors refer to it. By specifying a tag, you can specify that it should ...

  • Page 281

    Participant edml files 281 • the attribute+attribname value, when applied to tags, removes only the specified attribute. It is meaningless for directives and attributes. • the attribute+* value removes all attributes for tags. It is meaningless for directives and attributes. If your server behavior ...

  • Page 282

    282 chapter 15: server behaviors description this tag contains a list of translation instructions where each instruction indicates where to search for the participant and what to do with the participant. Parent translator type block tag. Required no. Description this tag contains a single translatio...

  • Page 283

    Participant edml files 283 limitsearch description this attribute limits the search to some part of the wheretosearch tag. Parent translation type attribute. Required no. Translationtype description this attribute indicates the type of translation to perform. These types are preset and give the tran...

  • Page 284

    284 chapter 15: server behaviors • the tabbed region start value indicates that the translated tags define the beginning of a tabbed outline, as shown in the following example: translationtype="tabbed region start"> • the tabbed region end value indicates that the translated tags define the end of a...

  • Page 285

    Participant edml files 285 description this tag specifies a single attribute (or translated attribute) to add to the translated tag. Parent attributes type block tag. Required yes (at least one). Values the attributename="attributevalue" specification sets an attribute to a value. Typically, the att...

  • Page 286

    286 chapter 15: server behaviors description this optional tag should be inserted at the end of the translated section. This tag enables certain other extensions, such as custom property inspectors, to find the translation. Parent translation type block tag. Required no. Values the tagname value is ...

  • Page 287

    Server behavior techniques 287 next, the searchpattern tag searches the document more precisely than the quicksearch tag and extracts parameter values from the participant code. The search patterns specify where to search (the wheretosearch attribute) with a series of searchpattern tags that contain...

  • Page 288

    288 chapter 15: server behaviors now the participant is recognized, even if the telephone number is not found. How participants are matched if a server behavior has more than one participant, the participants must be identified in the user’s document and matched. If the user applies multiple instanc...

  • Page 289

    Server behavior techniques 289 within the html tag, matching can also use position information. In the following example, there are two participants, one that is added before the selection and another that is added after the selection: random html selection here these two participants are without pa...

  • Page 290

    290 chapter 15: server behaviors search pattern resolution dreamweaver supports the following actions by using the participant searchpatterns functionality: • file transfer dependency • updating the file paths for any file reference (such as those for include files) when dreamweaver creates server m...

  • Page 291

    Server behavior techniques 291 if the user customizes participant code in the document, the participant might not be recognized if the search patterns look for the old code. Shorter search patterns can let the user customize the participant code in their document; however, updating the server behavi...

  • Page 292

    292 chapter 15: server behaviors deleting server behaviors default deletion and dependency counts the user can delete an instance that is selected in the server behaviors panel by clicking the minus (-) button or pressing delete. All the participants are removed except for the ones that are shared b...

  • Page 293: Chapter 16

    293 chapter 16 data sources the macromedia dreamweaver mx 2004 data sources api functions let you add data sources, which appear in the plus (+) menu in the bindings panel (for related information, see the function dreamweaver.Dbi.Getdatasources() in the dreamweaver api reference). Data source files...

  • Page 294

    294 chapter 16: data sources 3 dreamweaver goes through each file in the appropriate server model folder, calling the finddynamicsources() function in each file. For each value in the returned array, dreamweaver calls the generatedynamicsourcebindings() function in the same file to get a new list of...

  • Page 295

    The data sources api 295 the data sources api the functions in the data sources api let you find, add, edit, and delete data sources and also generate and inspect dynamic data objects. Adddynamicsource() availability dreamweaver ultradev 1. Description adds a dynamic data source. Because there is on...

  • Page 296

    296 chapter 16: data sources arguments sourcename , bindingname • the sourcename argument is the name of the top-level node to which the child node is associated. • the bindingname argument is the name of the child node. Returns dreamweaver expects nothing. Displayhelp() description if this function...

  • Page 297

    The data sources api 297 returns dreamweaver expects a boolean value: true if the function has handled the edit; false otherwise. Finddynamicsources() availability dreamweaver ultradev 1. Description returns the top-level nodes from the data source tree that appears in the dynamic data or the dynami...

  • Page 298

    298 chapter 16: data sources arguments sourcename , bindingname • the sourcename argument is the name of the top-level node that is associated with the child node. • the bindingname argument is the name of the child node from which you want to generate a dynamic data object. Returns dreamweaver expe...

  • Page 299

    A simple data source example 299 inspectdynamicdataref() availability dreamweaver ultradev 1. Description determines the corresponding node in the data source tree from a dynamic data object. The inspectdynamicdataref() function compares the string that dreamweaver passes in to the string that gener...

  • Page 300

    300 chapter 16: data sources creating the data source definition file first, when a user clicks on the bindings plus (+) menu, dreamweaver searches the datasources folder for the current server model to gather all available data sources defined in the folder’s html (htm) files. So, to make a new dat...

  • Page 301

    A simple data source example 301 creating the javascript file that implements the data sources api functions after you have defined the name of the data source, the name of the supporting script files, and the code for the working dreamweaver document, you need to write out the javascript functions ...

  • Page 302

    302 chapter 16: data sources retlist.Push(new datasource("mydatasource", mydatasource_filename, false, "mydatasource.Htm")) } } return retlist; } function generatedynamicsourcebindings(sourcename) { var retval = new array(); var siteurl = dw.Getsiteroot(); //for localized object name if (sourcename ...

  • Page 303

    A simple data source example 303 { retarray[0] = params.Sourcename; retarray[1] = params.Bindingname; } } return retarray; } function deletedynamicsource(sourcename, bindingname) { var siteurl = dw.Getsiteroot(); if (siteurl.Length) { //for localized object name if (sourcename != "mydatasource") { s...

  • Page 304

    304 chapter 16: data sources save the file in the configuration/commands folder as mydatasource_variable.Htm. Then, as shown in the following example, the supporting javascript file simply determines the buttons for the dialog box and how to assign the user input from the dialog box: //*************...

  • Page 305

    A simple data source example 305 to test your new data source: 1 with the pointer in the document, click on the bindings plus (+) menu to see all the available data sources. Mydatasource should appear at the bottom of the list: 2 click the mydatasource data source option, and the mydatasource variab...

  • Page 306

    306 chapter 16: data sources 4 drag the variable to your document, and dreamweaver will insert the appropriate code from the edml file:.

  • Page 307: Chapter 17

    307 chapter 17 server formats chapter 16, “data sources,” on page 293 , discusses how macromedia dreamweaver mx 2004 inserts dynamic data into a user’s document by adding a server expression at the appropriate location. When a visitor requests the document from the web server, that server expression...

  • Page 308

    308 chapter 17: server formats how data formatting works all format files reside in the configuration/serverformats/currentservermodel folder. Each subfolder contains one xml file and multiple html files. The formats.Xml file describes all the choices in the format menu. Dreamweaver automatically ad...

  • Page 309

    When the data formatting functions are called 309 the edit format list plus (+) menu if you do not want a file in the serverformats folder to appear in the edit format list plus (+) menu, add the following statement as the first line of the html file: to determine the contents of the menu, dreamweav...

  • Page 310

    310 chapter 17: server formats the server formats api the server formats api consists of the following data formatting functions. Applyformat() availability dreamweaver ultradev 1. Description this function can edit a user’s document by adding a format function declaration to it. When a user selects...

  • Page 311

    The server formats api 311 arguments format • the format argument corresponds to the javascript format object. The function must set the expression property of the javascript object to be the regular expression for the format. The function can also set other, arbitrarily named properties of the obje...

  • Page 312

    312 chapter 17: server formats dreamweaver adds the function declaration by calling the applyformat() javascript function in the data format file. It changes the dynamic data object by calling the formatdynamicdataref() function. The formatdynamicdataref() function is called when the user selects a ...

  • Page 313: Chapter 18

    313 chapter 18 components programmers use various strategies to encapsulate their work because experience shows that well- organized programs are easier to maintain, enhance, and reuse. Different technologies offer programmers different ways to accomplish this encapsulation, and different names desc...

  • Page 314

    314 chapter 18: components how to customize the component panel the dreamweaver component panel lets users load and work with components. It lists all the available component types that are compatible with each enabled server model. For instance, because javabeans can work only on a javaserver page ...

  • Page 315

    Component panel files 315 adding a service component to add a new lightweight directory access protocol (ldap) service using dreamweaver mx: 1 using existing component type files as a model (such as the files in the application folder configuration/components/common/webservices) create all the requi...

  • Page 316

    316 chapter 18: components populating the tree control use the componentrec property to populate a component panel tree control, so that it appears within the component panel in the proper location. Every node in a tree control must have the following properties: for example, the following webservic...

  • Page 317

    Component panel api functions 317 returns an array of componentrec objects. Example see function getcomponentchildren(componentrec) in the webservices.Js file in the configuration/components/common/webservices folder. Getcontextmenuid() availability dreamweaver mx. Description: returns the context m...

  • Page 318

    318 chapter 18: components getcodeviewdropcode() availability dreamweaver mx. Description this function gets the code that is dragged and dropped in code view from the component panel or the code that is cut, copied, or pasted from the component panel. Arguments componentrec • the componentrec argum...

  • Page 319

    Component panel api functions 319 getsetupsteps() availability dreamweaver mx. Description dreamweaver calls this function if the setupstepscompleted() function returns zero or a positive integer. This function controls the server-side setup instructions, which can be implemented using extensions th...

  • Page 320

    320 chapter 18: components example the following example sets four steps for coldfusion components, and provides a hypertext link in the fourth step so the user can enter the rds user name and password: function getsetupsteps() { var dosdk = false; dom = dw.Getdocumentdom(); if (dom && dom.Servermod...

  • Page 321

    Component panel api functions 321 returns an integer that represents the number of setup steps the user has completed, as described in the following list: • a value of either zero or a positive integer indicates the number of completed steps. • a value of -1 indicates that all the necessary steps ar...

  • Page 322

    (componentrec.O...

  • Page 323

    Component panel api functions 323 example in the following example, the extension has a chance to handle a double-click on the tree node item; if it returns the value false , the default behavior is to expand/collapse the nodes. Function handledoubleclick(componentrec) { var selectedobj = dw.Serverc...

  • Page 324

    324 chapter 18: components arguments none. Returns an array of toolbar buttons in left-to-right order. Example the following example assigns properties to the toolbar buttons: function toolbarcontrols() { var toolbarbtnarray = new array(); dom = dw.Getdocumentdom(); var plusbutton = new toolbarcontr...

  • Page 325

    Component panel api functions 325 toolbarbtnarray.Push(plusbutton); var minusbutton = new toolbarcontrolrec(); minusbutton.Image= minusbuttonup; minusbutton.Pressedimage= minusbuttondown; minusbutton.Disabledimage= minusbuttondisabled; minusbutton.Toolstyle= "left"; minusbutton.Tooltiptext= mm.Msg_w...

  • Page 326

    326 chapter 18: components.

  • Page 327: Chapter 19

    327 chapter 19 server models server models are the technologies that run scripts on a server. When users define a new site, they can identify the server model that they want to use at the site level and at the individual document level. This server model handles any dynamic elements that the user ad...

  • Page 328

    328 chapter 19: server models the server model api functions this section describes the functions that configure server models for dreamweaver. Canrecognizedocument() availability dreamweaver mx. Description when opening a document (and when more than one server model claims a file extension), dream...

  • Page 329

    The server model api functions 329 description returns the document file extensions with which a server model can work. For example, the asp server model supports .Asp and .Htm file extensions. This function returns an array of strings, and dreamweaver uses these strings to populate the default page...

  • Page 330

    330 chapter 19: server models getserverextension() availability dreamweaver ultradev 4, deprecated in dreamweaver mx. Description this function returns the default file extension of files that use the current server model. The servermodel object is set to the server model of the currently selected s...

  • Page 331

    The server model api functions 331 getserverlanguages() availability dreamweaver ultradev 1, deprecated in dreamweaver mx. Description this function returns the supported scripting languages of a server model with an array of strings. Dreamweaver uses these strings to populate the default scripting ...

  • Page 332

    332 chapter 19: server models getservermodeldelimiters() availability dreamweaver mx. Description this function returns the script delimiters that the application server uses, and it indicates whether each delimiter can participate in merging code blocks. You can access this returned value from java...

  • Page 333

    The server model api functions 333 getservermodelfoldername() availability dreamweaver mx. Description this function returns the folder name to use for this server model within the configuration folder. You can access this value from javascript by calling the dom.Servermodel.Getfoldername() function...

  • Page 334

    334 chapter 19: server models getversionarray() availability dreamweaver ultradev 1, deprecated in dreamweaver mx. Description this function retrieves the mapping of server technologies to version numbers. This function is called by the dom.Servermodel.Getserverversion() function. Arguments none. Re...

  • Page 335: Chapter 20

    335 chapter 20 data translators data translators translate specialized markup—server-side includes, conditional javascript statements, or other code such as php3, jsp, cfml, or asp—into code that macromedia dreamweaver mx 2004 can read and display. In dreamweaver, you can translate attributes within...

  • Page 336

    336 chapter 20: data translators • pastes or drags content into or within the document window • saves changes to a dependent file • invokes a command, behavior, server behavior, property inspector, or other extension that sets the innerhtml or outerhtml property of any tag object or the data propert...

  • Page 337

    The data translator api 337 7 the rundefault string specifies when this translator executes. The following list gives the possible string values: note: if you set rundefault to "byextension" but do not specify any extensions (see step 4 ), the effect is the same as setting "allfiles". If you set run...

  • Page 338

    338 chapter 20: data translators translatemarkup() description this function performs the translation. Arguments docname , siteroot , doccontent • the docname argument is a string that contains the file:// url for the document to be translated. • the siteroot argument is a string that contains the f...

  • Page 339

    Determining what kind of translator to use 339 arguments docname , siteroot , doccontent • the docname argument is a string that contains the file:// url for the document to be translated. • the siteroot argument is a string that contains the file:// url for the root of the site that contains the do...

  • Page 340

    340 chapter 20: data translators adding a translated attribute to a tag attribute translation relies on the dreamweaver parser to ignore server markup. By default, dreamweaver already ignores the most common kinds of server markup (including asp, cfml, and php); if you use server markup that has dif...

  • Page 341

    Adding a translated attribute to a tag 341 a simple attribute translator example to better understand attribute translation, it’s helpful to look at an example. The following translator is pound conditional (poco) markup, a syntax that’s somewhat similar to asp or php. The first step in making this ...

  • Page 342

    342 chapter 20: data translators // boolean indicating whether the attribute is part of // the conditional statement var truestart; // the beginning of the true case var falsestart; // the beginning of the false case var truevalue; // the html that would render in the true case var attname; // the n...

  • Page 343

    Adding a translated attribute to a tag 343 break; } } transvalue = attname + '="' + truevalue + '"'; transatt = ' mmtranslatedvalue' + count + '="' + ¬ escape(transvalue) + '"'; outstr = outstr.Substring(0,end+4) + transatt + ¬ outstr.Substring(end+4); // if attandvalue is true, and tokens is greate...

  • Page 344

    344 chapter 20: data translators returnarray[8] = "50"; // return returnarray } inspecting translated attributes when server markup specifies a single attribute and the attribute is represented in a property inspector, dreamweaver displays the server markup in the property inspector, as shown in the...

  • Page 345

    Locking translated tags or blocks of code 345 locking translated tags or blocks of code in most cases, you want a translator to change markup so that dreamweaver can display it, but you want to save the original markup, not the changes. For such cases, dreamweaver provides special xml tags in which ...

  • Page 346

    346 chapter 20: data translators [about us] [help] a simple block/tag translator example to help understand translation, look at a translator that is written entirely in javascript, which does not rely on a c library for any functionality. The following translator example would be more efficient if ...

  • Page 347

    A simple block/tag translator example 347 // in the document. Var replcode = replacekenttag(); // calls the replacekenttag() function // to get the code that will replace kent. Var outstr = ""; // the string to be returned after translation //if the document does not contain any content, terminate t...

  • Page 348

    348 chapter 20: data translators replcode = replcode + imgtag; replcode = replcode + end; return replcode; } /****************************************************************** * the getimage() function determines which image to display * * based on the day of the week, the time of day and the * * u...

  • Page 349

    A simple block/tag translator example 349 //or else it's after 6pm but before the stroke of midnight }else if (sfhour >= 18){ //if it's saturday if (day == 6){ imageref = "images/kent_dancing.Jpg"; //if it's not saturday, check the user's platform }else if (platform == "macppc"){ imageref = "images/...

  • Page 350

    350 chapter 20: data translators the caninspectselection() function for the untranslated happy property inspector is simple. Because the selection type is exact, it can return a value of true without further analysis. For the translated happy property inspector, this function is more complicated; th...

  • Page 351

    A simple block/tag translator example 351 after you parse the orig attribute to populate the fields in the property inspector for the translated tag, the next step is probably to set the value of the orig attribute if the user changes the value in any of the fields. You might find restrictions again...

  • Page 352

    352 chapter 20: data translators finding bugs in your translator if the translatemarkup() function contains certain types of errors, the translator loads properly, but it fails without an error message when you invoke it. Although failing silently prevents dreamweaver from becoming unstable, it can ...

  • Page 353: Chapter 21

    353 chapter 21 c-level extensibility the c-level extensibility mechanism lets you implement macromedia dreamweaver mx 2004 extensibility files using a combination of javascript and custom c code. You define functions using c, bundle them in a dynamic linked library (dll) or a shared library, save th...

  • Page 354

    354 chapter 21: c-level extensibility readcontentsoffile(jscontext *cx, jsobject *obj, unsigned int ¬ argc, jsval *argv, jsval *rval) { char *filename, *filecontents; jsbool success; unsigned int length; /* make sure caller passed in exactly one argument. If not, * then tell the interpreter to abort...

  • Page 355

    Data types 355 note: the library can be implemented in either c or c++, but the file that contains the mm_init() function and the mm_state macro must be implemented in c. The c++ compiler garbles function names, which makes it impossible for dreamweaver to find the mm_init() function. C-level extens...

  • Page 356

    356 chapter 21: c-level extensibility the c-level api the c-level extensibility api consists of the following functions: typedef jsbool (*jsnative)(jscontext *cx, jsobject *obj, unsigned int argc, jsval *argv, jsval *rval) description this function signature describes c-level implementations of java...

  • Page 357

    The c-level api 357 char *js_valuetostring() description this function extracts a function argument from a jsval structure, converts it to a string, if possible, and passes the converted value back to the caller. Note: do not modify the returned buffer pointer or you might corrupt the data structure...

  • Page 358

    358 chapter 21: c-level extensibility jsbool js_valuetodouble() description this function extracts a function argument from a jsval structure, converts it to a double (if possible), and passes the converted value back to the caller. Arguments jscontext *cx , jsval v , double *dp • the cx argument is...

  • Page 359

    The c-level api 359 returns a boolean value: js_true indicates success; js_false indicates failure. Jsbool js_stringtovalue() description this function stores a string return value in a jsval structure. It allocates a new javascript string object. Arguments jscontext *cx , char *bytes , size_t sz , ...

  • Page 360

    360 chapter 21: c-level extensibility jsval js_booleantovalue() description this function stores a boolean return value in a jsval structure. Arguments jsbool bv • the bv argument is a boolean value: js_true indicates success; js_false indicates failure. Returns a jsval structure that contains the b...

  • Page 361

    The c-level api 361 arguments jsobject *obj • typically, this argument is passed in and converted using the js_valuetoobject() function. Returns a pointer to a null-terminated string. The caller should not free this string when it finishes. Jsobject *js_newarrayobject() description this function cre...

  • Page 362

    362 chapter 21: c-level extensibility jsbool js_getelement() description this function reads a single element of an array object. Arguments jscontext *cx , jsobject *obj , unsigned int index , jsval *v • the cx argument is the opaque jscontext pointer that passes to the javascript function. • the ob...

  • Page 363

    The c-level api 363 jsbool js_executescript() description this function compiles and executes a javascript string. If the script generates a return value, it returns in *rval . Arguments jscontext *cx , jsobject *obj , char *script , unsigned int sz , jsval *rval • the cx argument is the opaque jsco...

  • Page 364

    364 chapter 21: c-level extensibility file access and multiuser configuration api macromedia recommends that you always use the file access and multiuser configuration api to access the file system through c-level extensions. For files other than configuration files, the functions access the specifi...

  • Page 365

    File access and multiuser configuration api 365 c-level extensions, or shared libraries, must use the file access and multiuser configuration api to read and write to the dreamweaver configuration folder. Using the file access and multiuser configuration api lets dreamweaver read and write to the us...

  • Page 366

    366 chapter 21: c-level extensibility arguments char *fileurl, char *constraints • the char *fileurl argument is a pointer to a string that names the folder for which you want a list of the contents. The string must have the format of a file:// url. The function accepts valid wildcard characters of ...

  • Page 367

    File access and multiuser configuration api 367 int mm_openconfigfile() availability dreamweaver mx. Description this function opens the file and returns an operating system file handle. You can use the operating system file handle in calls to system file functions. You must close the file handle wi...

  • Page 368

    368 chapter 21: c-level extensibility jsbool mm_getconfigfileattributes() availability dreamweaver mx. Description this function finds the file and returns the attributes of the file. You can set any of the arguments except fileurl to null if you do not need the value. Arguments char *fileurl, unsig...

  • Page 369

    File access and multiuser configuration api 369 jsbool mm_setconfigfileattributes() availability dreamweaver mx. Description this function sets the attributes that you specify for the file, if they are different from the current attributes. If the specified file url is in the dreamweaver configurati...

  • Page 370

    370 chapter 21: c-level extensibility arguments char *fileurl • the char *fileurl argument is a pointer to a file:// url string that names the configuration folder that you want to create. Returns a boolean value: js_true indicates success; js_false indicates failure. Example char *dwconfig = "file:...

  • Page 371

    Calling a c function from javascript 371 arguments char *fileurl • the char *fileurl argument is a pointer to a string that names the configuration folder to remove, which is provided as a file:// url. Returns a boolean value: js_true indicates success; js_false indicates failure. Example char dwcon...

  • Page 372

    372 chapter 21: c-level extensibility to call the computesum() function from the insert horizontal rule object: 1 create a folder called jsextensions in the configuration folder within the dreamweaver application folder. 2 copy sample.Dll (windows) or sample (macintosh) to the jsextensions folder. 3...

  • Page 373: Part III

    Part iii appendix find information about supporting files and reference resources that can aid in developing macromedia dreamweaver mx 2004 extensions. Appendix a: the shared folder . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 375 part iii.

  • Page 375: Appendix A

    375 appendix a the shared folder the shared folder is the central repository for utility functions, classes, and images that are commonly used by all extensions. Any extension can reference the files in the shared folder’s subfolders, and you can add custom common utilities to the ones already provi...

  • Page 376

    376 appendix a: the shared folder the common folder the common folder has shared scripts and classes for use in third-party extensions. Codebehindmgr.Js contains functions for creating a code-behind document. A code-behind document lets you create distinct pages that separate the code for user inter...

  • Page 377

    The shared folder contents 377 the mm folder the mm folder contains the shared scripts, images, and classes used by the extensions that come with dreamweaver, including the scripts for building a navigation bar, specifying preload calls, and the shortcut key definitions. Listcontrolclass.Js contains...

  • Page 378

    378 appendix a: the shared folder the scripts folder the scripts subfolder contains the following utility functions: the scripts folder also contains two subfolders, class and cmn. Cfcutilities.Js contains utility functions related to coldfusion components. Functions parse attributes from within the...

  • Page 379

    The shared folder contents 379 the class folder the class folder contains the following utility functions: classcheckbox.Js helps manipulate a checkbox control in your html extension. Fileclass.Js contains class that represents a file in the file system. The paths are represented by urls for cross-p...

  • Page 380

    380 appendix a: the shared folder the cmn folder the cmn folder contains the following utility functions: dateid.Js contains two functions, createdateid() and decipherdateid() . Given three strings, dayformat, dateformat, and timeformat, createdateid() creates an id for them. Given a date array, dec...

  • Page 381

    The shared folder contents 381 other folders the following list describes other folders of interest in the shared folder: • controls the controls folder contains the elements used to build a server behavior. These controls include interfaces for text and recordset menus. Note: these controls are use...

  • Page 382

    382 appendix a: the shared folder using the shared folder look first in the dreamweaver configuration/shared/common folder for useful extension code because this folder contains the most current and commonly used functionality. Extensions can leverage the resources in the shared folder for their own...

  • Page 383: Index

    383 index a action files 235 adddynamicsource() 295 alert() 68 analyzeserverbehavior() 253 apis, types of behaviors 237 c-level extensibility 356 commands 136 component panel 316 data formatting 307 data sources 295 data translator 335 floating panel 224 menu commands 156 objects 122 property inspec...

  • Page 384

    384 index sample code 243 user experience 236 behaviors api applybehavior() 237 behaviorfunction() 238 canacceptbehavior() 239 deletebehavior() 240 displayhelp() 239 identifybehaviorarguments() 240 inspectbehavior() 242 windowdimensions() 242 binding inspector 293 block/tag translators about 339 deb...

  • Page 385

    Index 385 commentstart tag 88 css sample text 105 cssimport tag 88 cssmedia tag 88 cssproperty tag 89 cssselector tag 89 cssvalue tag 89 defaultattribute tag 90 defaulttag tag 90 defaulttext tag 90 editing schemes 103 endoflinecomment tag 91 entity tag 91 examples 105 file 83 functionkeyword tag 91 ...

  • Page 386

    386 index customizing appearance of dialog boxes 32 browser profiles 29 default documents 32 definition of 29 dreamweaver 13 editing configuration files 29 in a multiuser environment 29 insert bar 29 interpretation of third-party tags 34 menus 29 page designs 32 third-party tags 29 customtext value,...

  • Page 387

    Index 387 dwscripts functions applysb() 259 deletesb() 259 findsbs() 258 dynamic data dialog box 293 dynamic menus sample code 164 user experience 155 dynamic templates 48 dynamic text dialog box 293 e edit format list plus (+) pop-up menu 309 editcontrol tag 181 editdynamicsource() 296 editing 151 ...

  • Page 388

    388 index findsbs() 258 findserverbehaviors() 256 flash swf files, displaying in dreamweaver 63 floating panel api displayhelp() 224 documentedited() 225 getdockingside() 225 initialposition() 226 initialtabs() 226 isatarget() 227 isavailableincodeview() 227 isresizable() 228 selectionchanged() 228 ...

  • Page 389

    Index 389 insert bar object example 126 files 113 reordering 121 insert bar object extensions, definition 21 insertbar tag 115 insertbar.Xml file 113, 121 insertobject() 123 inserttext tag 269, 270 inspectbehavior() 242 inspectdynamicdataref() 299 inspectformatdefinition() 312 inspector extensions, ...

  • Page 390

    390 index menus changing 29, 151 commands 154 definition 23 modifying pop-up and context 153 menus.Xml file about 146 changing 151 menu tag 147 menubar tag 146 menuitem tag 147 separator tag 149 shortcut tag 150 shortcutlist tag 150 mm treecolumn 61 treenode 61 mm_configfileexists() 366 mm_deleted_f...

  • Page 391

    Index 391 of tag objects 72 of text objects 73 parentwindow property 71 participant files 249 participant tag 268 participants 247 parttype attribute 267 password (field) object 68 pasteserverbehavior() 257 processfile() 199 property inspector api caninspectselection() 219 displayhelp() 219 inspects...

  • Page 392

    392 index server behavior extensions, definition 22 server format extensions, definition 22 server formats api applyformat() 310 applyformatdefinition() 310 deleteformat() 311 formatdynamicdataref() 311 inspectformatdefinition() 312 server model api about 327 canrecognizedocument() 328 getfileextens...

  • Page 393

    Index 393 file definition 173 how commands work 172 how toolbars work 171 include/ tag 175 item tags 177 itemref/ tag 176 itemtype/ tag 176 menubutton tag 179 radiobutton tag 178 separator tag 177 simple command file 194 tag attributes 182 toolbar tag 173, 174 toolbars.Xml file 171 toolbars.Xml file...

  • Page 394

    394 index.