Tài liệu hạn chế xem trước, để xem đầy đủ mời bạn chọn Tải xuống
1
/ 119 trang
THÔNG TIN TÀI LIỆU
Thông tin cơ bản
Định dạng
Số trang
119
Dung lượng
2,37 MB
Nội dung
1062 Part VII ✦ Extending Dreamweaver Whenever API functions require the DOM object, such as the dom.getSelection() func- tion and others discussed in the following sections, you must first get the DOM of the current document. In all the examples that follow, the variable theDOM is understood to have been established early on, like this: var theDOM = dreamweaver.getDocumentDOM(“document”); The dom.getSelection() function How a behavior performs is quite often dictated by what tag the user selects prior to attaching the behavior. The getSelection() function is the first step toward getting all the information necessary to control your behavior based on a user selection. I emphasize “first step” because this function returns the selection in the form of byte offsets in memory. A byte offset is a num- ber that points to a memory address. In the case of the getSelection() function, the two byte offsets that are returned mark the beginning and end of the selection in memory. For example, you open a new page in Dreamweaver, type in a phrase such as “The Key Points,” and then select the first word, “The.” If you used the getSelection function like this: var selArray = theDOM.getSelection(); alert(selArray); the alert box would return 161,164, which denotes the beginning byte (161) and the ending byte ( 164) offset of the selected word, “The.” If your beginning and ending byte offsets are the same (as in 164,164), then nothing is selected. This fact comes in handy when you want to make sure that the user has selected something before proceeding. To examine what is contained within the byte offsets returned by the getSelection() function, you have to use the offsetsToNode() function, explained later in this section. The dom.setSelection() function Just as getSelection() retrieves the memory offsets of the current selection, the setSelection() function sets a new pair of memory offsets and thus a new selection. The setSelection() function takes two arguments: offsetBegin and offsetEnd. setSelection() is most often used to restore a user’s selection after various document manipulations have taken place. In this example, the selection is first stored in a variable via getSelection() and then, after much document modification, restored by setSelection: var currSelection = theDOM.getSelection(); // document altering code goes here theDom.setSelection(currSelection[0],currSelection[1]); If the new setting does not conform to a valid HTML selection, such as the attributes within a tag, the selection expands to include the entire tag. You can also use setSelection to deselect anything on the page after completing a behavior. All that’s required is that the two arguments be equal. Using the preceding example, the fol- lowing code: theDOM.setSelection(currSelection[1],currSelection[1]); places the cursor after the previous selection, whereas theDOM.setSelection(currSelection[0],currSelection[0]); places it before the selection. Note Note 434931-6 ch35.F 7/18/02 7:05 AM Page 1062 Simpo PDF Merge and Split Unregistered Version - http://www.simpopdf.com 1063 Chapter 35 ✦ Creating a Behavior The dom.offsetsToNode() function The offsetsToNode() function serves as a translator, converting the byte memory offsets retrieved by getSelection() into readable data. For this reason, you often see the following code combination: selArr = theDOM.getSelection(); selObj = theDOM.offsetsToNode(selArr[0],selArr[1]); where getSelection() returns the array of the selection and the object referenced by that array. As indicated, offsetsToNode() takes two arguments: offsetBegin and offsetEnd, usually expressed as the initial ( 0) and next (1) array elements. After you’ve used offsetsToNode to get the selected object, you can examine or manipulate it. For example, in the custom Replicator command (included on the CD-ROM that accompanies this book), I used offsetsToNode to see if the selection made was appropriate (text only) and, if not, to call a help function: var offsets = theDOM.getSelection(); var selObj = theDOM.offsetsToNode(offsets[0],offsets[1]); if (selObj.nodeType != Node.TEXT_NODE) { helpMe2(); } The dom.nodeToOffsets() function As the name indicates, nodeToOffsets() is the inverse of offsetsToNode(). Instead of con- verting memory offsets to an object, nodeToOffsets takes an object reference and returns its memory offsets. This is useful when you need to manipulate a substring of the selection, usually text. For example, in the custom command Change Case (included on the CD-ROM that comes with this book), after the selected object is retrieved via getSelection and offsetsToNode, nodeToOffsets expresses it in an array that can be uppercased or lowercased at the click of a button. Here’s a fragment of the code from the custom upperCase() function: var theDom = dreamweaver.getDocumentDOM(“document”); var offsets = theDom.getSelection(); var theNode = theDom.offsetsToNode(offsets[0],offsets[1]); if (theNode.nodeType == Node.TEXT_NODE) { var nodeOffsets = theDom.nodeToOffsets(theNode); offsets[0] = offsets[0] - nodeOffsets[0]; offsets[1] = offsets[1] - nodeOffsets[0]; var nodeText = theNode.data; theNode.data = nodeText.substring(0,offsets[0]) + nodeText.substring(offsets[0], offsets[1]).toUpperCase() + nodeText.substring(offsets[1], nodeText.length); } Because nodeToOffsets returns two memory offsets, you can use these as the arguments in setSelection to choose an object on the page. If, for instance, you wanted to select the first link on the page, you use the code as follows: var theDom = dreamweaver.getDocumentDOM(“document”); var theLink = theDom.links[0]; var offsets = theDom.nodeToOffsets(theLink); 434931-6 ch35.F 7/18/02 7:05 AM Page 1063 Simpo PDF Merge and Split Unregistered Version - http://www.simpopdf.com 1064 Part VII ✦ Extending Dreamweaver theDom.setSelection(offsets[0],offsets[1]);The dreamweaver.getTokens() function The getTokens() function is often used in the inspectBehavior() function because it does such a good job of parsing a string. A token is a group of text characters that do not contain any of the specified separators. Generally, the separators in a function are the parentheses that surround the arguments and the commas that separate them. The getTokens() function takes two arguments —the string to be parsed and the separators —and puts the results in an array. For example, note the following string doGroovoid(‘false’,’Fanfare-Arrival’); To extract the two arguments from this statement, use the getTokens() function as follows: getTokens(“doGroovoid(‘false’,’Fanfare-Arrival’)”,”’(),”); If you set this function equal to an array called argArray, you get the following results: argArray[0] = ‘doGroovoid’; argArray[1] = ‘false’; argArray[2] = ‘Fanfare-Arrival’; Usually the first element of the array, the function name, is ignored. The dreamweaver.getElementRef() function The getElementRef() function is used to gather browser-specific references to a particular object and place them into an array. The getElementRef() function takes two arguments: The first argument is either NS 4.0 or IE 4.0, which reference the Netscape and Internet Explorer formats, respectively; and the second argument is the tag being examined. The string returned puts the specified tag in the format of the named browser. If, for example, getElementRef() is used to get the object ref- erence to a specific layer in Netscape terms, like var theObjNS = dreamweaver.getElementRef(“NS 4.0”, tagArr[i]); the variable, theObjNS, is set to something like document.layers[‘newLayer’]; On the other hand, the same layer, in Internet Explorer terms, like this var theObjIE = dreamweaver.getElementRef(“IE 4.0”, tagArr[i]); returns a string like document.all.newLayer1. Both getElementRef() and getObjectRefs() return browser-correct references for both browsers for the following tags: <a>, <area>, <applet>, <embed>, <select>, <option>, <textarea>, <object>, and <img>. Additionally, references for the tags <div>, <span>, and <input> are returned correctly for Internet Explorer, as <layer> and <ilayer> are for Netscape. Absolutely positioned <div> and <span> tags are also returned correctly for Netscape, but others return the message “cannot reference <tag>”. Naming objects and layers is often critical in JavaScript, as it certainly is with getElementRef() and getObjectRefs(). Dreamweaver can’t return references for unnamed objects; you get back an “unnamed <tag>” message for those. Furthermore, Dreamweaver can’t handle references to a named object if it is in an unnamed layer or form. To help with the naming task, Dreamweaver automatically assigns a name attribute to forms and an ID attribute to layers as they are created. Caution 434931-6 ch35.F 7/18/02 7:05 AM Page 1064 Simpo PDF Merge and Split Unregistered Version - http://www.simpopdf.com 1065 Chapter 35 ✦ Creating a Behavior The dreamweaver.getBehaviorTag() function The getBehaviorTag() function returns the tag selected to implement the current behavior. The getBehaviorTag() function can also be incorporated into the behavior setup code to steer the user in the appropriate direction. The getBehaviorTag() function returns the entire tag — name, attributes, values, and any text selected — exactly as it is written (capitalization, spaces, etc.). In most situations, you need to find only the relevant portion of the tag, its name ( img), for example. You can find the relevant portion of a tag by using JavaScript’s indexOf() method to search a string (the entire tag) for a specified substring. The following code looks to see if the tag selected for the behavior is an <img> tag and, if it’s not, alerts the users to what’s required: function initializeUI() { // uppercase the tag to make indexOf() searching easier var theTag = dreamweaver.getBehaviorTag().toUpperCase(); if (theTag.indexOf(‘IMG’) != -1)) { // Behavior UI initilaization goes here } else { alert(“This behavior requires you select an IMAGE to proceed.”); } } Using the initializeUI() function to block access to a behavior is different from using the canAcceptBehavior() function to block access. With the getBehaviorTag() tech- nique, the user is informed of what the problem is, rather than simply denied access. The dreamweaver.getBehaviorElement() function Another method to discover which tag was selected for the invoked behavior is the getBehaviorElement() function. The major difference between this function and the getBehaviorTag() function is that the former returns the DOM reference to the tag, whereas the latter returns the tag itself. After you have the DOM reference of the behavior tag, you can uncover a terrific amount of information about the tag and its attributes. Like getBehaviorTag(), getBehaviorElement() is most often used to determine if the user has selected an appropriate tag for the chosen behavior. If the tag is inappropriate, a helpful message can be displayed to guide the user to a better option. The getBehaviorElement() function returns either a DOM reference or null. Circumstances under which null is returned by getBehaviorElement() are as follows: ✦ The function was not invoked from a script called by the Behaviors panel. ✦ The behavior called is part of a timeline. ✦ The function was invoked from a script called by dreamweaver.popupAction(). ✦ The function was invoked as part of a Behaviors panel that is attaching an event to a link wrapper ( <a href=”#”> </a>), and the link wrapper has not yet been created. ✦ The function is called outside of a behavior. The following example assumes that the required tag must be an embedded plugin that is visible on the page: function initializeUI() { var theTag = dreamweaver.getBehaviorElement(); Note 434931-6 ch35.F 7/18/02 7:05 AM Page 1065 Simpo PDF Merge and Split Unregistered Version - http://www.simpopdf.com 1066 Part VII ✦ Extending Dreamweaver var tagGood = (theTag.tagName == “EMBED” && theTag.getAttribute(“HIDDEN”) == null); if (tagGood) { // Behavior User Interface code goes here } else { alert(“This behavior can not be applied to hidden plug-ins”); } } The dreamweaver.browseForFileURL() function The browseForFileURL() function enables the user, instead of entering an entire path by hand, to locate a file via a dialog box. You can specify whether you want an Open, Save, or Select style dialog box, as well as the label in the title bar. You can even enable the Preview panel for images. No matter which options you choose, the browseForFileURL() function returns the pathname of the file expressed as a file://URL. The browseForFileURL() function follows this syntax: browseForFileURL(‘Open’|’Save’|’Select’, ‘Title Bar Label’, true|false); The first argument, either Open, Save, or Select, specifies the type of dialog box. The Select File dialog box displays additional local root information in its lower portion. The second argument is displayed in the title bar of the dialog box; if you don’t want to insert your own title, you must specify an empty string ‘’ (two single quotes, with nothing in-between) for the argument, as in this example: browseForFileURL(‘open’,’’,false); The final argument is a Boolean and indicates whether the Preview dialog box for selecting images is to be displayed. If no title bar label is given and the Preview dialog argument is true, the title displayed is Select Image Source. The browseForFileURL() function is generally called by a secondary function that is trig- gered by an onClick event attached to a Browse (Choose) button, which in turn is next to a text field that enables the user to enter the path by hand. Typically this secondary function is called browseFile() and takes one argument, fieldToStoreURL. For instance, the code for a Browse (Choose) button often reads as follows: <input type=”text” name=”textFile”> <input value=”Browse ” type=”button” name=”button” onClick=”browseFile(document.theForm.textFile.value)”> The browseFile() function then calls the built-in browseForFileURL() function, which opens the Select File dialog box and, if the dialog box is returned with a filename, assigns that filename to a variable. In the standard browseFile() function, shown here, the returned filename is then assigned to a text box value for the given field, which makes the name appear in the text box: function browseFile(fieldToStoreURL) { var fileName = “”; fileName = browseForFileURL() //returns a local filename if (fileName) fieldToStoreURL.value = fileName; } 434931-6 ch35.F 7/18/02 7:05 AM Page 1066 Simpo PDF Merge and Split Unregistered Version - http://www.simpopdf.com 1067 Chapter 35 ✦ Creating a Behavior The dreamweaver.getDocumentPath() function Dreamweaver includes several local document functions that aid in the reading, editing, and storing of current and external documents. The getDocumentPath() function is one of these; as the name states, this function returns the path of the specified document. The path returned is in the file://URL format, so that a file located at c:\sites\index.html returns file://c|/sites/ as its path. The getDocumentPath() function takes one argument: the source document. This argument can be “document”, “parent”, “parent.frames[number]”, or “parent.frames [‘framename’]” as described earlier in the getDocumentDOM() function. If the document specified has not been saved, getDocumentPath() returns an empty string. The dreamweaver.getConfigurationPath() function The Configuration folder can be considered the hub of Dreamweaver extensibility. It contains not only all the standard HTML files, such as the behaviors and objects, that are read into the system when Dreamweaver starts, but also various other files that control the look and feel of the menus in other areas. As such, it’s often useful to be able to find the path to the Configuration folder so that other files can be created, read, edited, and stored. And that’s exactly what getConfigurationPath() does. One sample use of this function, included with Dreamweaver, is part of the secret behind the Rollover object. To a trained eye, the Rollover object is unlike any other — in fact, it’s not really an object at all; it’s a command masquerading as an object. The getConfigurationPath() function plays a key role in the JavaScript file, rollover.js, with this code: var rolloverCmdURL = dreamweaver.getConfigurationPath() + “/Commands/Rollover.htm”; var rolloverDoc = dreamweaver.getDocumentDOM( rolloverCmdURL ); In the first line, getConfigurationPath is used to locate the Rollover.htm file in the Configuration\Commands subfolder and assign it to a variable. This enables the object to retrieve the DOM for manipulation with the getDocumentDOM() function. Like getDocumentPath(), getConfigurationPath() formats the path as file://URL. The dreamweaver.getSiteRoot() function Dreamweaver depends on the establishment of a local site root for much of its Web site management facility: All site-root–relative links and references are based upon the location of the site root folder. The capability to uncover its file location is important for any behav- iors or other extensibility files that work on the site root level. Dreamweaver supplies such a capability with the getSiteRoot() function. Very straightforward to use, getSiteRoot() does not take an argument; and it returns a file://URL format reference to the local site root of the currently selected document. If an empty string is returned, it means that the file has not been saved. The dreamweaver.releaseDocument() function If you’re working with a complex document with a lot of images, layers, tables, and text, you’re going to have a lot of HTML to deal with. Accessing the DOM for that page can take up a sig- nificant chunk of your memory. If you’re working with multiple pages, you could begin to run Note 434931-6 ch35.F 7/18/02 7:05 AM Page 1067 Simpo PDF Merge and Split Unregistered Version - http://www.simpopdf.com 1068 Part VII ✦ Extending Dreamweaver low on memory before the behavior closes and the memory is automatically freed. With the releaseDocument() function, you can get back the memory as soon as possible, whenever you request it. The releaseDocument() function’s one argument is the DOM of the document in question. You obtain the DOM argument by using the getDocumentDOM() function. You can see this function demonstrated in Dreamweaver’s displayHelp.js file, which is used to direct all the help requested, contextually. The dreamweaver.browseDocument() function Should a help file get too big for an alert dialog box, you might need to provide access to a larger file. Dreamweaver enables you to open any specified file — including an expanded help file — within the primary browser. The browseDocument() function takes one argument, the path to the required file (an absolute URL): dreamweaver.browseDocument(“http://www.idest.com/help/etable.htm”); As noted in Chapter 34, you can use browseDocument() to access an absolute URL from the Web or a file from a local drive. To display a local file, you need to combine browseDocument() with another function such as getConfigurationPath(). The example offered here shows how to use the two functions together to programmatically display Dreamweaver’s InsertMenu.htm file: function displayMenu() { var menuPath = dreamweaver.getConfigurationPath() + Æ “/Objects/InsertMenu.htm”; dreamweaver.browseDocument(menuPath); } The dreamweaver.openDocument() and dreamweaver.createDocument() functions The openDocument() and createDocument() functions provide similar capabilities although they possess similar restrictions. The openDocument() function is equivalent to selecting File ➪ Open and selecting a file from the Open dialog box. The createDocument() function, as the name implies, creates a new, blank document, based on the standard default.htm file. In either case, the document loads into a Dreamweaver window and is brought forward. The createDocument() function does not need an argument to work and automatically returns the DOM of the new document. For example, the following code var theNewDoc = dreamweaver.createDocument(); is the same as using getDocumentDOM() for a new page. The openDocument() function requires an argument in the form of a file://URL. If the URL is given in relative terms, the file is relative to the extensibility file calling the function. For instance, to open a file located one directory up from the Commands folder, you need to refer to it as follows in a custom command: dreamweaver.openDocument(“ /Extensions.txt”); You can also use the same technique referred to earlier in the browseDocument() function to access files with the Configuration folder as a base. 434931-6 ch35.F 7/18/02 7:05 AM Page 1068 Simpo PDF Merge and Split Unregistered Version - http://www.simpopdf.com 1069 Chapter 35 ✦ Creating a Behavior Although the twin functions, openDocument and createDocument(), cannot be used within a behavior, they can be called from a custom command or Property inspector. Therefore, it’s possible to use the popupCommand() function to access a command that employs openDocument() or createDocument(). The dreamweaver.saveDocument() function After all your edits and modifications have been finished, you need a way to store the file. The aptly named saveDocument() function performs just that chore for you. This function takes two arguments, documentObject and fileURL; the first corresponds to the DOM of the file to be saved, and the second to the location where this file is to be saved. Again, fileURL is relative to the extensibility file. If you omit the fileURL argument in Dreamweaver 4+, the file is saved to its current location if it has already been saved; if not, a Save dialog box is displayed. The saveDocument function returns true if successful and false if the file-storing attempt fails. If the file specified is noted as read-only, Dreamweaver attempts to check it out; if it is unsuc- cessful, an error message appears. The dreamweaver.editLockedRegions() function Dreamweaver templates are based on a combination of locked and editable regions. Normally, these regions are designated in the Document window, but you can use the editLockedRegions() function to lock and unlock a template’s regions programatically. The editLockedRegions() function works by entering true as the function’s argument if you want to unlock all the current document’s locked regions, and false to lock them again. After the routine calling editLockedRegions() ends, all regions revert to their default status. Due to potentially undesirable results from using this function, Macromedia recommends that only custom data translators use editLockedRegions(). The dreamweaver.popupAction() and dreamweaver.runCommand() functions Although the popupAction() and runCommand() functions are not directly useful to behavior creators because they cannot be called from within a behavior, they do enable considerable cross-pollination of Dreamweaver extensible objects. Invoking these functions calls an existing behavior or command and presents its dialog box to the user — except you use these func- tions to call the behaviors or commands from within a custom object, command, or Property inspector. The popupAction() function takes two arguments: the name of the action file and the gen- eral function call of the action. The action chosen must be in Dreamweaver’s Configuration\ Behaviors\Actions subfolder. For example, code to call the Play Sound behavior could look like this: var goPS = dreamweaver.popupAction(“Play Sound.htm”,”MM_controlSound(,,)”); Caution Note Note 434931-6 ch35.F 7/18/02 7:05 AM Page 1069 Simpo PDF Merge and Split Unregistered Version - http://www.simpopdf.com 1070 Part VII ✦ Extending Dreamweaver To call an action in a subfolder of the Actions folder, you need to specify the path. For exam- ple, if you want to call one of the standard Timeline actions — these actions reside in the Actions\Timeline subfolder — it’s necessary to state the action name as Timeline\Go to Timeline Frame.htm. The general function call can be found near the end of the applyBehavior() function, where the return value is specified, or as the behaviorFunction() return value. The popupAction() function returns the completed function call, including whatever param- eters are selected by the user. In the previous example, if the user had chosen “Play” and selected “brazil.mid” as the file, the result ( goPS) would be similar to the following: “MM_controlSound(‘play’,document.CS911946210190.’brazil.mid’)”; The second argument is a unique name generated by Dreamweaver as part of the function. Everything is written into the user’s page, except the event handler and its corresponding function call, both of which are handled by the calling object, command, or Property inspector. The runCommand() function is a bit simpler; this function requires only one argument: the name of the command file. Any file named must be located in the Configuration\Commands folder. The runCommand() function does not return a value but simply executes the specified command. The dreamweaver.latin1ToNative() and dreamweaver.nativeToLatin1() functions Dreamweaver provides two functions to help with the localization of your behaviors around the globe. Many countries use font encodings other than Latin 1, which is standard in the United States and several Western European countries. To convert a string of text for a user interface from Latin 1 encoding to that of the user’s machine, use the latin1ToNative() function. The argument, a text string, should be already translated into the other language. To convert a text string from the user’s encoding system to Latin 1, use the inverse function, nativeToLatin1(). Neither of these functions has an effect in Windows systems, which are already based on Latin 1. The dreamweaver.relativeToAbsoluteURL() function As more programs such as Fireworks and Director are capable of outputting HTML, behaviors and other extensions are being employed to access their documents. It’s often necessary to find the absolute URL of a selected file in order to get the document’s DOM or open it. The relativeToAbsoluteURL() function returns this needed information, given three arguments: ✦ docPathURL: The portion of the current document’s relative pathname excluding the filename. For example, if the file in question were to be found at images\austria.gif, the docPathURL would be images/. ✦ siteRootURL: The file://URL of the current site root, as returned from the getSiteRoot() function. ✦ relativeURL: The full relative pathname of the selected file (for example, images/ austria.gif). Note Note Tip 434931-6 ch35.F 7/18/02 7:05 AM Page 1070 Simpo PDF Merge and Split Unregistered Version - http://www.simpopdf.com 1071 Chapter 35 ✦ Creating a Behavior The syntax for the function is as follows: var absoluteURL = dreamweaver.relativeToAbsoluteURL(docPathURL,siteRootURL,relativeURL); Of the three arguments, only docPathURL is a little tricky. After you have the relativeURL, which can be returned from the browseForFileURL() function, you need to examine the pathname and extract the first part of the path leading up to the actual filename. To do so, use the JavaScript function lastIndexOf to find the final “/” character and extract the previous substring. For example: function docBase() { var docURL = dreamweaver.getDocumentPath(“document”); var index = docURL.lastIndexOf(‘/’); if ( index == -1 ) { // If there is no additional path, return nothing return “”; } else { return docURL.substring(0, index); } } Behavior API You’ve seen most of the behavior API functions applied in a previous section, “Step 2: Create the action file.” You use the behavior API to create behaviors. Its primary functions are as follows: Function Role canAcceptBehavior() Determines whether an action is allowed for the selected HTML element windowDimensions() Sets the width and height of the parameter form dialog box; only define this function if you are creating a Parameters dialog box larger than 640 × 480 pixels applyBehavior() Attaches the behavior function to the selected tag inspectBehavior() Restores user-selected values to the parameter form for re-editing behaviorFunction() Writes a function within <script> </script> tags in the <head> of the HTML file deleteBehavior() Removes a behavior from the HTML file identifyBehaviorArguments() Notes the behavior arguments that need to be altered if the file is moved displayHelp() Attaches a Help button to the behavior’s parameter form dialog box 434931-6 ch35.F 7/18/02 7:05 AM Page 1071 Simpo PDF Merge and Split Unregistered Version - http://www.simpopdf.com [...]... Record dialog box appears, as shown in Figure 36 -10 2 From the Insert Record dialog box, choose the connection from the drop-down list If you need to establish a new connection, select Define 108 9 444931-6 ch36.F 7/18/02 7:05 AM Page 109 0 Simpo PDF Merge and Split Unregistered Version - http://www.simpopdf.com 109 0 Part VII ✦ Extending Dreamweaver Figure 36 -10: Users may add new data directly to a connected... closing tag Dreamweaver automatically places the code in the Using server behaviors Altering applied server behaviors Working with Dreamweaver s server behaviors Adding new server behaviors Crafting custom server behaviors ✦ ✦ ✦ ✦ 444931-6 ch36.F 7/18/02 7:05 AM Page 108 0 Simpo PDF Merge and Split Unregistered Version - http://www.simpopdf.com 108 0 Part VII ✦ Extending Dreamweaver proper place... server behavior and reapply it 108 1 444931-6 ch36.F 7/18/02 7:05 AM Page 108 2 Simpo PDF Merge and Split Unregistered Version - http://www.simpopdf.com 108 2 Part VII ✦ Extending Dreamweaver Figure 36-2: When modifying certain server behaviors, some fields, such as the Link field in this Go To Detail Page dialog box, are disabled and cannot be changed Standard Server Behaviors Dreamweaver ships with over... original dialog box by selecting Simple on the advanced Recordset dialog box 10 Click OK when you’re done CrossReference For more information on defining recordsets, see Chapter 15 108 3 444931-6 ch36.F 7/18/02 7:05 AM Page 108 4 Simpo PDF Merge and Split Unregistered Version - http://www.simpopdf.com 108 4 Part VII ✦ Extending Dreamweaver Repeat Region The Repeat Region server behavior replicates a selected... ‘resizePatch()’; //return fn call with args } 107 7 434931-6 ch35.F 7/18/02 7:05 AM Page 107 8 Simpo PDF Merge and Split Unregistered Version - http://www.simpopdf.com 107 8 Part VII ✦ Extending Dreamweaver Summary Although creating a custom behavior is not a simple task, it is a vastly rewarding one — both from the programmer’s and the user’s perspectives Dreamweaver gives you tremendous power to automate... option on a order confirmation page 109 5 444931-6 ch36.F 7/18/02 7:05 AM Page 109 6 Simpo PDF Merge and Split Unregistered Version - http://www.simpopdf.com 109 6 Part VII ✦ Extending Dreamweaver 3 To trigger the server behavior with a link, choose the Log Out When Link Clicked option and make sure your selected link is chosen in the list If no link was preselected, Dreamweaver offers to apply the server... the Where Column field 5 Enter the variable in the URL parameter in the Matches URL Parameter field 6 Click OK when you’re done 108 5 444931-6 ch36.F 7/18/02 7:05 AM Page 108 6 Simpo PDF Merge and Split Unregistered Version - http://www.simpopdf.com 108 6 Part VII ✦ Extending Dreamweaver Figure 36-6: An alternative method for creating a detail page uses the Move To Specific Record server behavior CrossReference... server behavior isn’t available in ColdFusion, NET or PHP CrossReference For more on master-detail Web applications, see Chapter 19 108 7 444931-6 ch36.F 7/18/02 7:05 AM Page 108 8 Simpo PDF Merge and Split Unregistered Version - http://www.simpopdf.com 108 8 Part VII ✦ Extending Dreamweaver Requirements: A selected page element and at least one recordset To attach a Go To Detail Page server behavior, follow... action: function identifyBehaviorArguments(fnCallStr) { var argArray; argArray = extractArgs(fnCallStr); if (argArray.length == 5) { 107 3 434931-6 ch35.F 7/18/02 7:05 AM Page 107 4 Simpo PDF Merge and Split Unregistered Version - http://www.simpopdf.com 107 4 Part VII ✦ Extending Dreamweaver return “other,URL,URL,other”; } else { return “”; } } As with the inspectBehavior() function, the array for the function... Text; Numeric; Date; Date MS Access; Checkbox Y, N; Checkbox 1,0; Check -1,0; and Checkbox MS Access 9 Click OK when you’re done 109 1 444931-6 ch36.F 7/18/02 7:05 AM Page 109 2 Simpo PDF Merge and Split Unregistered Version - http://www.simpopdf.com 109 2 Part VII ✦ Extending Dreamweaver CrossReference For more information on the Update Record server behavior, see Chapter 19 Delete Record The Delete Record . theTag = dreamweaver. getBehaviorElement(); Note 434931-6 ch35.F 7/18/02 7:05 AM Page 106 5 Simpo PDF Merge and Split Unregistered Version - http://www.simpopdf.com 106 6 Part VII ✦ Extending Dreamweaver var. 7/18/02 7:05 AM Page 106 6 Simpo PDF Merge and Split Unregistered Version - http://www.simpopdf.com 106 7 Chapter 35 ✦ Creating a Behavior The dreamweaver. getDocumentPath() function Dreamweaver includes. display Dreamweaver s InsertMenu.htm file: function displayMenu() { var menuPath = dreamweaver. getConfigurationPath() + Æ “/Objects/InsertMenu.htm”; dreamweaver. browseDocument(menuPath); } The dreamweaver. openDocument()