Server behavior functions let you manipulate the Server Behaviors panel, which you can display by selecting Window > Server Behaviors. Using these functions, you can find all the server behaviors on a page and programmatically apply a new behavior to the document or modify an existing behavior.

Note:

You can abbreviate dw.serverBehaviorInspector to dw.sbi.

dreamweaver.getParticipants()

Availability

Dreamweaver UltraDev 4.

Description

The JavaScript function, dreamweaver.getParticipants(), gets a list of participants from the user’s document. After Dreamweaver finds all the behavior’s participants, it stores those lists. Typically, you use this function with the findServerBehaviors() function (for more information, see “Server Behaviors” in Extending Dreamweaver) to locate instances of a behavior in the user’s document.

Arguments

edmlFilename

  • The edmlFilename argument is the name of the group or participant file that contains the names of the participants to locate in the user’s document. This string is the filename, without the .edml extension.

Returns

This function returns an array that contains all instances of the specified participant (or, in the case of a group file, any instance of any participant in the group) that appear in the user’s document. The array contains JavaScript objects, with one element in the array for each instance of each participant that is found in the user’s document. The array is sorted in the order that the participants appear in the document. Each JavaScript object has the following properties:

  • The participantNode property is a pointer to the participant node in the user’s document.

  • The participantName property is the name of the participant’s EDML file (without the .edml extension).

  • The parameters property is a JavaScript object that stores all the parameter/value pairs.

  • The matchRangeMin property defines the character offset from the participant node of the document to the beginning of the participant content.

  • The matchRangeMax property is an integer of the participant that defines the offset from the beginning of the participant node to the last character of the participant content.

dreamweaver.serverBehaviorInspector.getServer Behaviors()

Availability

Dreamweaver UltraDev 1.

Description

Gets a list of all the behaviors on the page. When Dreamweaver determines that the internal list of server behaviors might be out of date, it calls the findServerBehaviors() function for each currently installed behavior. Each function returns an array. Dreamweaver merges all the arrays into a single array and sorts it, based on the order in which each behavior’s selectedNode object appears in the document. Dreamweaver stores the merged array internally. The getServerBehaviors() function returns a pointer to that merged array.

Arguments

None.

Returns

An array of JavaScript objects. The findServerBehaviors() call returns the objects in the array. The objects are sorted in the order that they appear in the Server Behaviors panel.

dreamweaver.popupServerBehavior()

Availability

Dreamweaver UltraDev 1.

Description

Applies a new server behavior to the document or modifies an existing behavior. If the user must specify parameters for the behavior, a dialog box appears.

Arguments

{behaviorName} or {behaviorObject}

  • The behaviorName argument, which is optional, is a string that represents the behavior’s name, the title tag of a file, or a filename.

  • The behaviorObject argument, which is optional, is a behavior object.

    If you omit the argument, Dreamweaver runs the currently selected server behavior. If the argument is the name of a server behavior, Dreamweaver adds the behavior to the page. If the argument is one of the objects in the array that the getServerBehaviors() function returns, a dialog box appears so the user can modify the parameters for the behavior.

Returns

Nothing.

This work is licensed under a Creative Commons Attribution-Noncommercial-Share Alike 3.0 Unported License  Twitter™ and Facebook posts are not covered under the terms of Creative Commons.

Legal Notices   |   Online Privacy Policy