home *** CD-ROM | disk | FTP | other *** search
/ PC User 2003 September / Australian PC User - September 2003 (CD1).iso / magstuff / web / files / dwmx61.exe / Disk1 / data1.cab / Configuration_En / ServerModels / Jsp / dwscriptsServerImpl.js < prev   
Encoding:
JavaScript  |  2002-11-25  |  19.9 KB  |  890 lines

  1. // Copyright 2002 Macromedia, Inc. All rights reserved.
  2.  
  3. // *************** GLOBALS VARS *****************
  4.  
  5. // ***************** LOCAL FUNCTIONS  ******************
  6.  
  7. //--------------------------------------------------------------------
  8. // FUNCTION:
  9. //   queueDefaultDocEdits
  10. //
  11. // DESCRIPTION:
  12. //   This function is called before the docEdits are applied to the
  13. //   page to allow any default doc edits to be added.  We will add
  14. //   the VBSCRIPT language tag.
  15. //
  16. // ARGUMENTS:
  17. //   none
  18. //
  19. // RETURNS:
  20. //   nothing
  21. //--------------------------------------------------------------------
  22.  
  23. function queueDefaultDocEdits()
  24. {
  25.   var partList = dw.getParticipants("PageDirective_main");
  26.   if (!partList || partList.length == 0)  // does not currently exist
  27.   {
  28.     var encoding = dw.getDocumentDOM().getCharSet();
  29.     if (encoding != "")
  30.     {
  31.        encoding = "text/html; charset=" + encoding;
  32.     }
  33.  
  34.     var paramObj = new Object();
  35.     paramObj.ContentType = encoding;
  36.     paramObj.Language = "java";
  37.     paramObj.Imports = "java.sql.*";
  38.     paramObj.ErrorPage = "";
  39.     dwscripts.queueDocEditsForParticipant("PageDirective_main",paramObj);
  40.   }
  41.   else
  42.   {
  43.     dwscripts.queueParticipantInfo("PageDirective_main", partList[0].participantNode);
  44.   }
  45.  
  46.   partList = dw.getParticipants("SetEncoding_language");
  47.     
  48.   if (partList && partList.length)
  49.   {
  50.     dwscripts.queueParticipantInfo("SetEncoding_language", partList[0].participantNode);
  51.   }    
  52. }
  53.  
  54.  
  55. //--------------------------------------------------------------------
  56. // FUNCTION:
  57. //   encodeDynamicExpression
  58. //
  59. // DESCRIPTION:
  60. //   This function prepares a dynamic expression for insertion onto
  61. //   the page.  It is assumed that this expression will be used
  62. //   within a larger dynamic statement, therefore all server markup
  63. //   is stripped.
  64. //
  65. // ARGUMENTS:
  66. //   expression - string - the dyanmic expression to encode
  67. //
  68. // RETURNS:
  69. //   string
  70. //--------------------------------------------------------------------
  71.  
  72. function encodeDynamicExpression(expression)
  73. {
  74.   var retVal = "";
  75.   expression = expression.toString();
  76.  
  77.   if (hasServerMarkup(expression))
  78.   {
  79.     retVal = trimServerMarkup(expression);
  80.   }
  81.   else
  82.   {
  83.     // quote all values for JSP
  84.     if (!dwscripts.isQuoted(expression))
  85.     {
  86.       retVal = "\"" + dwscripts.escQuotes(expression) + "\"";
  87.     }
  88.     else
  89.     {
  90.       retVal = expression;
  91.     }
  92.   }
  93.  
  94.   return retVal;
  95. }
  96.  
  97.  
  98. //--------------------------------------------------------------------
  99. // FUNCTION:
  100. //   decodeDynamicExpression
  101. //
  102. // DESCRIPTION:
  103. //   This function prepares a dynamic expression for display within
  104. //   a dialog box.  Quotes are removed,a nd server markup is re-added.
  105. //
  106. // ARGUMENTS:
  107. //   expression - string - the dynamic expression to prepare for display
  108. //
  109. // RETURNS:
  110. //   string
  111. //--------------------------------------------------------------------
  112.  
  113. function decodeDynamicExpression(expression)
  114. {
  115.   var retVal = "";
  116.  
  117.   expression = dwscripts.trim(expression.toString());
  118.   var unquoted = dwscripts.trimQuotes(expression);
  119.  
  120.   if (dwscripts.isQuoted(expression))
  121.   {
  122.     retVal = dwscripts.unescQuotes(unquoted);
  123.   }
  124.   else
  125.   {
  126.     retVal = "<%= " + expression + " %>";
  127.   }
  128.  
  129.   return retVal;
  130. }
  131.  
  132.  
  133. //--------------------------------------------------------------------
  134. // FUNCTION:
  135. //   hasServerMarkup
  136. //
  137. // DESCRIPTION:
  138. //   This function returns true if the given expression contains
  139. //   server markup.
  140. //
  141. // ARGUMENTS:
  142. //   expression - string - the expression to test for server markup
  143. //
  144. // RETURNS:
  145. //   boolean
  146. //--------------------------------------------------------------------
  147.  
  148. function hasServerMarkup(expression)
  149. {
  150.   expression = expression.toString();
  151.   return (expression.indexOf("<%") != -1 && expression.indexOf("%>") != -1);
  152. }
  153.  
  154.  
  155. //--------------------------------------------------------------------
  156. // FUNCTION:
  157. //   trimServerMarkup
  158. //
  159. // DESCRIPTION:
  160. //   This function returns the given expression with any server markup
  161. //   removed.
  162. //
  163. // ARGUMENTS:
  164. //   expression - string - the expression to remove server markup from
  165. //
  166. // RETURNS:
  167. //   string
  168. //--------------------------------------------------------------------
  169.  
  170. function trimServerMarkup(expression)
  171. {
  172.   var retVal = expression.toString();
  173.  
  174.   if (retVal.length)
  175.   {
  176.     var begininlineindex = retVal.indexOf("<%=");
  177.     var endinlineindex  =  retVal.indexOf("%>");
  178.     if ((begininlineindex != -1) && (endinlineindex!=-1))
  179.     {
  180.       retVal = retVal.substring(begininlineindex+3, endinlineindex);
  181.     }
  182.     else
  183.     {
  184.       var begininlineindex = retVal.indexOf("<%");
  185.       var endinlineindex  =  retVal.indexOf("%>");
  186.       if ((begininlineindex != -1) && (endinlineindex!=-1))
  187.       {
  188.         retVal = retVal.substring(begininlineindex+3, endinlineindex);
  189.       }
  190.     }
  191.  
  192.     retVal = dwscripts.trim(retVal);
  193.   }
  194.  
  195.   return retVal;
  196. }
  197.  
  198.  
  199. //--------------------------------------------------------------------
  200. // FUNCTION:
  201. //   getDBColumnTypeEnum
  202. //
  203. // DESCRIPTION:
  204. //   This function returns the enumerated value corresponding to the
  205. //   given column type.  The enumeration numbers should match those
  206. //   used by the databases themselves.
  207. //
  208. // ARGUMENTS:
  209. //   columnType - string - a column type as returned by the MMDB functions
  210. //
  211. // RETURNS:
  212. //   enumeration number
  213. //--------------------------------------------------------------------
  214.  
  215. var DB_COLUMN_ENUM_MAP = null;
  216.  
  217. function getDBColumnTypeEnum(columnType)
  218. {
  219.   var retVal = 0;
  220.  
  221.   columnType = String(columnType);
  222.  
  223.   if (dwscripts.isNumber(columnType))
  224.   {
  225.     retVal = dwscripts.getNumber(columnType);
  226.   }
  227.   else
  228.   {
  229.     if (DB_COLUMN_ENUM_MAP == null)
  230.     {
  231.       var a = new Array();
  232.  
  233.       a["null"] = 0;
  234.       a["char"] = 1;
  235.       a["numeric"] = 2;
  236.       a["int identity"]=2; //as varchar
  237.       a["counter"]=2;
  238.       a["varnumeric"] = 2;
  239.       a["number"] = 2;
  240.       a["money"]=2;
  241.       a["smallmoney"]=2;
  242.       a["uniqueidentifier"]=2;
  243.       a["rowid"]=2;
  244.       a["mediumint"]=2;
  245.       a["decimal"] = 3;
  246.       a["integer"] = 4;
  247.       a["long"] = 4;
  248.       a["int"] = 4;
  249.       a["mediumint"] = 4; //integer
  250.       a["smallint"] = 5;
  251.       a["float"] = 6;
  252.       a["float unsigned zerofill"] = 6; //double
  253.  
  254.       a["real"] = 7;
  255.       a["double"] = 8;
  256.       a["double unsigned zerofill"] = 8;
  257.  
  258.       a["longchar"] = 12; 
  259.       a["varchar"] = 12;
  260.  
  261.       a["date"] = 91;
  262.       a["time"] = 92;
  263.       a["timestamp"] = 93;
  264.       a["datetime"] = 93;
  265.       a["smalldatetime"]=93;
  266.       a["year"] = 93; //dbdate
  267.  
  268.       a["varchar2"] = 1111;
  269.  
  270.       a["distinct"] = 2001;
  271.       a["struct"] = 2002;
  272.       a["enum"] = 2002; //var char
  273.       a["set"] = 2002; //userdefined
  274.       a["array"] = 2003;
  275.       a["blob"] = 2004;
  276.       a["image"]=2004;
  277.       a["clob"] = 2005;
  278.       a["ref"] = 2006;
  279.       a["ref cursor"] = 2006;
  280.  
  281.       a["longvarchar"] = -1;
  282.       a["binary"] = -2;
  283.       a["raw"] = -2;
  284.       a["varbinary"] = -3;
  285.       a["longvarbinary"] = -4;
  286.       a["bigint"] = -5;
  287.       a["tinyint"] = -6;
  288.       a["bit"] = -7;
  289.       a["nchar"] = -8;
  290.       a["nvarchar"] = -9;
  291.       a["nvarchar2"] = -9;
  292.       a["text"] = -10;
  293.       a["ntext"] = -10;
  294.       a["tinytext"] = -10; //varchar
  295.       a["mediumtext"] = -10; //varchar
  296.       a["longtext"] = -10; //longvarchar
  297.       a["pl/sql"]=2006; //oracle specific pl/sql
  298.       a["object"]=2006; //oracle specific object
  299.       a["id"]=12; //as varchar
  300.  
  301.  
  302.       DB_COLUMN_ENUM_MAP = a;
  303.     }
  304.  
  305.     if (DB_COLUMN_ENUM_MAP != null)
  306.     {
  307.       if (columnType.indexOf("pl/sql")!=-1)
  308.       {
  309.         columnType = "pl/sql";
  310.       }
  311.  
  312.       retVal = DB_COLUMN_ENUM_MAP[columnType.toLowerCase()];
  313.  
  314.       if (retVal == null)
  315.       {
  316.         alert(dwscripts.sprintf(MM.MSG_SQLTypeAsNumNotInMap,columnType));
  317.         retVal = 0;
  318.       }
  319.     }
  320.   }
  321.  
  322.   return retVal;
  323. }
  324.  
  325.  
  326. //--------------------------------------------------------------------
  327. // FUNCTION:
  328. //   getDBColumnTypeAsString
  329. //
  330. // DESCRIPTION:
  331. //   This function returns a string representation of the given
  332. //   column type.
  333. //
  334. // ARGUMENTS:
  335. //   columnType - string - a column type string returned from MMDB
  336. //
  337. // RETURNS:
  338. //   string
  339. //--------------------------------------------------------------------
  340.  
  341. var DB_COLUMN_STRING_MAP = null;
  342.  
  343. function getDBColumnTypeAsString(columnType)
  344. {
  345.   var retVal = "Empty";
  346.  
  347.   var typeNum = getDBColumnTypeEnum(columnType);
  348.  
  349.   if (DB_COLUMN_STRING_MAP == null)
  350.   {
  351.     var a = new Array();
  352.  
  353.     a['0'] = "Null";
  354.     a['1'] = "Char";
  355.     a['2'] = "Numeric";
  356.     a['3'] = "Decimal";
  357.     a['4'] = "Integer";
  358.     a['5'] = "SmallInt";
  359.     a['6'] = "Float";
  360.     a['7'] = "Real";
  361.     a['8'] = "Double";
  362.     a['12'] = "VarChar";
  363.  
  364.     a['91'] = "Date";
  365.     a['92'] = "Time";
  366.     a['93'] = "Timestamp";
  367.  
  368.     a['1111'] = "VarChar2";
  369.  
  370.     a['2001'] = "Distinct";
  371.     a['2002'] = "Struct";
  372.     a['2003'] = "Array";
  373.     a['2004'] = "Blob";
  374.     a['2005'] = "Clob";
  375.     a['2006'] = "Ref";
  376.  
  377.     a['-1'] = "LongVarChar";
  378.     a['-2'] = "Binary";
  379.     a['-3'] = "VarBinary";
  380.     a['-4'] = "LongVarBinary";
  381.     a['-5'] = "BigInt";
  382.     a['-6'] = "TinyInt";
  383.     a['-7'] = "Bit";
  384.     a['-8'] = "NChar";
  385.     a['-9'] = "NVarChar";
  386.     a['-10'] = "Text";
  387.  
  388.     DB_COLUMN_STRING_MAP = a;
  389.   }
  390.  
  391.   if (DB_COLUMN_STRING_MAP != null)
  392.   {
  393.     retVal = DB_COLUMN_STRING_MAP[String(typeNum)];
  394.   }
  395.  
  396.   if (retVal == null)
  397.   {
  398.     alert(dwscripts.sprintf(MM.MSG_SQLTypeNotInMap, columnType));
  399.     retVal = "";
  400.   }
  401.  
  402.   return retVal;
  403. }
  404.  
  405.  
  406. //--------------------------------------------------------------------
  407. // FUNCTION:
  408. //   isNumericDBColumnType
  409. //
  410. // DESCRIPTION:
  411. //   Returns true if the given column type is numeric.
  412. //
  413. //   If we do not recognize the type of a column as any of the
  414. //   other categories, we default to numeric.
  415. //
  416. // ARGUMENTS:
  417. //   columnType - string - a column type string returned from MMDB
  418. //
  419. // RETURNS:
  420. //   boolean
  421. //--------------------------------------------------------------------
  422.  
  423. function isNumericDBColumnType(columnType)
  424. {
  425.   var retVal = true;
  426.  
  427.   var typeNum = getDBColumnTypeEnum(columnType);
  428.  
  429.   // assume the numeric type, unless it is called out in one
  430.   //  of the other functions below.
  431.  
  432.   switch (typeNum)
  433.   {
  434.     case 1:
  435.     case 12:
  436.     case 91:
  437.     case 92:
  438.     case 93:
  439.     case -1:
  440.     case -8:
  441.     case -9:
  442.     case -10:
  443.     case 1111:
  444.       retVal = false;
  445.   }
  446.  
  447.   return retVal;
  448. }
  449.  
  450.  
  451. //--------------------------------------------------------------------
  452. // FUNCTION:
  453. //   isIntegerDBColumnType
  454. //
  455. // DESCRIPTION:
  456. //   Returns true if the given column type is integer.
  457. //
  458. // ARGUMENTS:
  459. //   columnType - string - a column type string returned from MMDB
  460. //
  461. // RETURNS:
  462. //   boolean
  463. //--------------------------------------------------------------------
  464.  
  465. function isIntegerDBColumnType(columnType)
  466. {
  467.   var retVal  = false;
  468.  
  469.   var typeNum = getDBColumnTypeEnum(columnType);
  470.  
  471.   switch (typeNum)
  472.   {
  473.     case 4:
  474.     case 5:
  475.     case -5:
  476.     case -6:
  477.       retVal = true;
  478.   }
  479.  
  480.   return retVal;
  481. }
  482.  
  483.  
  484. //--------------------------------------------------------------------
  485. // FUNCTION:
  486. //   isDoubleDBColumnType
  487. //
  488. // DESCRIPTION:
  489. //   Returns true if the given column type is double.
  490. //
  491. // ARGUMENTS:
  492. //   columnType - string - a column type string returned from MMDB
  493. //
  494. // RETURNS:
  495. //   boolean
  496. //--------------------------------------------------------------------
  497.  
  498. function isDoubleDBColumnType(columnType)
  499. {
  500.   var retVal  = false;
  501.  
  502.   var typeNum = getDBColumnTypeEnum(columnType);
  503.  
  504.   switch (typeNum)
  505.   {
  506.     case 8:
  507.       retVal = true;
  508.   }
  509.  
  510.   return retVal;
  511. }
  512.  
  513.  
  514. //--------------------------------------------------------------------
  515. // FUNCTION:
  516. //   isStringDBColumnType
  517. //
  518. // DESCRIPTION:
  519. //   This function returns true if the given column type represents
  520. //   a string value
  521. //
  522. // ARGUMENTS:
  523. //   columnType - string - a column type string returned from MMDB
  524. //
  525. // RETURNS:
  526. //   boolean
  527. //--------------------------------------------------------------------
  528.  
  529. function isStringDBColumnType(columnType)
  530. {
  531.   var retVal = false;
  532.  
  533.   var typeNum = getDBColumnTypeEnum(columnType);
  534.  
  535.   switch (typeNum)
  536.   {
  537.     case 1:
  538.     case 12:
  539.     case -1:
  540.     case -8:
  541.     case -9:
  542.     case -10:
  543.     case 1111:
  544.       retVal = true;
  545.   }
  546.  
  547.   return retVal;
  548. }
  549.  
  550.  
  551. //--------------------------------------------------------------------
  552. // FUNCTION:
  553. //   isBinaryDBColumnType
  554. //
  555. // DESCRIPTION:
  556. //   This function returns true if the given column type represents
  557. //   binary data
  558. //
  559. // ARGUMENTS:
  560. //   columnType - string - a column type string returned from MMDB
  561. //
  562. // RETURNS:
  563. //   boolean
  564. //--------------------------------------------------------------------
  565.  
  566. function isBinaryDBColumnType(columnType)
  567. {
  568.   var retVal = false;
  569.  
  570.   var typeNum = getDBColumnTypeEnum(columnType);
  571.  
  572.   switch (typeNum)
  573.   {
  574.     case -2:
  575.     case -3:
  576.     case -4:
  577.     case -7:
  578.       retVal = true;
  579.   }
  580.  
  581.   if (!retVal)
  582.   {
  583.       switch (columnType)
  584.       {
  585.         case "image":
  586.             retVal = true;
  587.       }
  588.   }
  589.  
  590.   return retVal;
  591. }
  592.  
  593.  
  594. //--------------------------------------------------------------------
  595. // FUNCTION:
  596. //   isDateDBColumnType
  597. //
  598. // DESCRIPTION:
  599. //   This function returns true if the given column type represents
  600. //   a date or time value
  601. //
  602. // ARGUMENTS:
  603. //   columnType - string - a column type string returned from MMDB
  604. //
  605. // RETURNS:
  606. //   boolean
  607. //--------------------------------------------------------------------
  608.  
  609. function isDateDBColumnType(columnType)
  610. {
  611.   var retVal = false;
  612.  
  613.   var typeNum = dwscripts.getDBColumnTypeEnum(columnType);
  614.  
  615.   switch (typeNum)
  616.   {
  617.     case 91:
  618.     case 92:
  619.     case 93:
  620.       retVal = true;
  621.   }
  622.  
  623.   return retVal;
  624. }
  625.  
  626.  
  627. //--------------------------------------------------------------------
  628. // FUNCTION:
  629. //   isBooleanDBColumnType
  630. //
  631. // DESCRIPTION:
  632. //   This function returns true if the given column type represents
  633. //   binary data
  634. //
  635. // ARGUMENTS:
  636. //   columnType - string - a column type string returned from MMDB
  637. //
  638. // RETURNS:
  639. //   boolean
  640. //--------------------------------------------------------------------
  641.  
  642. function isBooleanDBColumnType(columnType)
  643. {
  644.   var retVal = false;
  645.  
  646.   var typeNum = getDBColumnTypeEnum(columnType);
  647.  
  648.   switch (typeNum)
  649.   {
  650.     case -7:
  651.       retVal = true;
  652.   }
  653.  
  654.   return retVal;
  655. }
  656.  
  657.  
  658. //--------------------------------------------------------------------
  659. // FUNCTION:
  660. //   isCurrencyDBColumnType
  661. //
  662. // DESCRIPTION:
  663. //   This function returns true if the given column type represents
  664. //   a monetary value
  665. //
  666. // ARGUMENTS:
  667. //   columnType - string - a column type string returned from MMDB
  668. //
  669. // RETURNS:
  670. //   boolean
  671. //--------------------------------------------------------------------
  672.  
  673. function isCurrencyDBColumnType(columnType)
  674. {
  675.   var retVal = false;
  676.   switch (columnType)
  677.   {
  678.     case "money":
  679.     case "smallmoney":
  680.       retVal = true;
  681.   }
  682.  
  683.   return retVal;
  684. }
  685.  
  686.  
  687. ////////////////////////////////////////////////////////////////////////////////
  688. //These are some helper functions used by SSI infrastructure and not
  689. //part of the Server API.
  690. ////////////////////////////////////////////////////////////////////////////////
  691.  
  692.  
  693. //--------------------------------------------------------------------
  694. // FUNCTION:
  695. //   getRecordsetNames
  696. //
  697. // DESCRIPTION:
  698. //   Returns a list of all recordset names on the page.
  699. //
  700. // ARGUMENTS:
  701. //   dontIncludeStoredProcRS - boolean (optional). 'true' if should not
  702. //     include recordsets returned from stored procedures. defaults to
  703. //     'false'.
  704. //
  705. // RETURNS:
  706. //   array of strings
  707. //--------------------------------------------------------------------
  708.  
  709. function getRecordsetNames(dontIncludeStoredProcRS)
  710. {
  711.   if (!dontIncludeStoredProcRS) dontIncludeStoredProcRS = false;
  712.  
  713.   var nameList = new Array();
  714.   var currentdom = dreamweaver.getDocumentDOM();
  715.  
  716.   if (currentdom) {
  717.     var nodes = currentdom.getElementsByTagName("MM_RECORDSET");
  718.     for (var index =0 ; index < nodes.length ; index++)
  719.     {
  720.       var node = nodes.item(index);
  721.       if (node)
  722.       {
  723.         nameList.push(node.getAttribute("NAME"));
  724.       }
  725.     }
  726.  
  727.     if (!dontIncludeStoredProcRS)
  728.     {
  729.       var nodes = currentdom.getElementsByTagName("MM_CALLRESSET");
  730.       for (var index =0 ; index < nodes.length ; index++)
  731.       {
  732.         var node = nodes.item(index);
  733.         if (node)
  734.         {
  735.           nameList.push(node.getAttribute("NAME"));
  736.         }
  737.       }
  738.     }
  739.   }
  740.  
  741.   return nameList;
  742. }
  743.  
  744.  
  745. //--------------------------------------------------------------------
  746. // FUNCTION:
  747. //   getRepeatedRegionNames
  748. //
  749. // DESCRIPTION:
  750. //   Returns a list of all repeated region names on the page.
  751. //
  752. // ARGUMENTS:
  753. //   None
  754. //
  755. // RETURNS:
  756. //   array of strings
  757. //--------------------------------------------------------------------
  758.  
  759. function getRepeatedRegionNames()
  760. {
  761.   var nameList = new Array();
  762.   var currentdom = dreamweaver.getDocumentDOM();
  763.  
  764.   if (currentdom)
  765.   {
  766.     var nodes = currentdom.getElementsByTagName("MM_REPEATEDREGION");
  767.     for (var index =0 ; index < nodes.length ; index++)
  768.     {
  769.       var node = nodes.item(index);
  770.       if (node)
  771.       {
  772.         nameList.push(node.getAttribute("NAME"));
  773.       }
  774.     }
  775.   }
  776.  
  777.   return nameList;
  778. }
  779.  
  780.  
  781. //--------------------------------------------------------------------
  782. // FUNCTION:
  783. //   findSourceNode
  784. //
  785. // DESCRIPTION:
  786. //   Returns a data source name by name.
  787. //
  788. // ARGUMENTS:
  789. //   elementName - string - the name of the data source
  790. //
  791. // RETURNS:
  792. //   DOM node pointer
  793. //--------------------------------------------------------------------
  794.  
  795. function findSourceNode(elementName)
  796. {
  797.   var foundnode = null;
  798.   var currentdom = dreamweaver.getDocumentDOM();
  799.  
  800.   if (currentdom)
  801.   {
  802.     var nodes = currentdom.getElementsByTagName("MM_RECORDSET");
  803.     for (var index =0 ; index < nodes.length ; index++)
  804.     {
  805.       var node = nodes.item(index);
  806.       if (node)
  807.       {
  808.         if(node.getAttribute("NAME") == elementName)
  809.         {
  810.           foundnode = node;
  811.         }
  812.       }
  813.     }
  814.  
  815.     if (!foundnode)
  816.     {
  817.       var nodes = currentdom.getElementsByTagName("MM_CALLABLE");
  818.       for (var index =0 ; index < nodes.length ; index++)
  819.       {
  820.         var node = nodes.item(index);
  821.         if (node)
  822.         {
  823.           if(node.getAttribute("NAME") == elementName)
  824.           {
  825.             foundnode = node;
  826.           }
  827.         }
  828.       }
  829.     }
  830.  
  831.     if (!foundnode)
  832.     {
  833.       var nodes = currentdom.getElementsByTagName("MM_CALLRESSET");
  834.       for (var index =0 ; index < nodes.length ; index++)
  835.       {
  836.         var node = nodes.item(index);
  837.         if (node)
  838.         {
  839.           if(node.getAttribute("NAME") == elementName)
  840.           {
  841.             foundnode = node;
  842.           }
  843.         }
  844.       }
  845.     }
  846.   }
  847.  
  848.   return foundnode;
  849. }
  850.  
  851.  
  852. //--------------------------------------------------------------------
  853. // FUNCTION:
  854. //   getColumnNames
  855. //
  856. // DESCRIPTION:
  857. //   Returns the column names for the given recordset.
  858. //   If rs is not specified the column names for the first recordset
  859. //   are returned.
  860. //
  861. // ARGUMENTS:
  862. //   rs - string - optional - the name of a data source
  863. //
  864. // RETURNS:
  865. //   array of strings
  866. //--------------------------------------------------------------------
  867.  
  868. function getColumnNames(rs)
  869. {
  870.   var rsDOM, nameList = new Array();
  871.  
  872.   dataSourceNode = findSourceNode(rs);
  873.  
  874.   if (dataSourceNode && dataSourceNode.tagName == "MM_RECORDSET")
  875.   {
  876.     rsDOM = dreamweaver.getDocumentDOM(dreamweaver.getConfigurationPath() + "/DataSources/Jsp/Recordset.htm");
  877.   }
  878.   else if (dataSourceNode && dataSourceNode.tagName == "MM_CALLRESSET")
  879.   {
  880.     var rsDOM = dreamweaver.getDocumentDOM(dreamweaver.getConfigurationPath() + "/DataSources/Jsp/Callable.htm");
  881.   }
  882.  
  883.   if (rsDOM)
  884.   {
  885.     nameList = rsDOM.parentWindow.generateDynamicSourceBindings(rs);
  886.   }
  887.  
  888.   return nameList;
  889. }
  890.