To create a new type of connection, including the dialog box with which users interact, you must implement the following three functions: findConnection() , inspectConnection() , and applyConnection() . You write these three functions and include them in the .js implementation file that is associated with your new connection type
The applyConnection() function returns an HTML source within an include file. You can see examples of the HTML source in the The generated include file . The findConnection() function takes the HTML source and extracts its properties. You can implement findConnection() to use the search patterns in XML files to extract the information that returns from applyConnection() . For an example of such an implementation, see the following two JavaScript files:
connection_common.js |
Located in Configuration/Connections/Shared folder |
When the user opens a site, goes through each file in the Connections folder, opens it, and passes the contents to findConnection() . If the contents of a file match the criteria for a valid connection, findConnection() returns a connection object. then lists all the connection objects in the Database Explorer panel.
When the user opens a connection dialog box and chooses to create a new connection or duplicate or edit an existing connection, calls inspectConnection() and passes back the same connection object that findConnection() created. In this way, can populate the dialog box with the connection information.
When the user clicks OK in a connection dialog box, calls applyConnection() to build the HTML, which is placed in the connection include file that is located in the Configuration/Connections folder. The applyConnection() function returns an empty string that indicates there is an error in one of the fields and the dialog box should not be closed. The include file has the default file extension type for the current server model.
When the user adds to the page a server behavior that uses the connection, such as a record set or a stored procedure, adds a statement to the page that includes the connection include file.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117