home *** CD-ROM | disk | FTP | other *** search
/ Practical Internet Web Designer 86 / PIWD86.iso / pc / contents / dreamweaver / software / dwmx2004.exe / Disk1 / data1.cab / Configuration_En / Commands / SelectDSN.js < prev    next >
Encoding:
JavaScript  |  2003-09-05  |  3.5 KB  |  163 lines

  1. // Copyright 2000, 2001, 2002, 2003 Macromedia, Inc. All rights reserved.
  2.  
  3.  
  4. // *************** GLOBALS VARS *****************
  5.  
  6. var HELP_DOC = MM.HELP_cmdSelectDSNList;
  7.  
  8. var DSN_SELECT_OBJ;
  9.  
  10.  
  11. //*************************API**************************
  12.  
  13. //--------------------------------------------------------------------
  14. // FUNCTION:
  15. //   commandButtons
  16. //
  17. // DESCRIPTION:
  18. //   Returns the array of buttons that should be displayed on the
  19. //   right hand side of the dialog.  The array is comprised
  20. //   of name, handler function name pairs.
  21. //
  22. // ARGUMENTS:
  23. //   none
  24. //
  25. // RETURNS:
  26. //   array of strings - name, handler function name pairs
  27. //--------------------------------------------------------------------
  28.  
  29. function commandButtons()
  30. {
  31.   return new Array(MM.BTN_OK,     "okClicked()",
  32.                    MM.BTN_Cancel, "cancelClicked()",
  33.                    MM.BTN_Help,   "displayHelp()" );
  34. }
  35.  
  36.  
  37. //--------------------------------------------------------------------
  38. // FUNCTION:
  39. //   okClicked
  40. //
  41. // DESCRIPTION:
  42. //   Sets the return value to the selected DSN and closes the window.
  43. //
  44. // ARGUMENTS:
  45. //   none
  46. //
  47. // RETURNS:
  48. //   nothing
  49. //--------------------------------------------------------------------
  50.  
  51. function okClicked()
  52. {
  53.   var retVal = DSN_SELECT_OBJ.get();
  54.   
  55.   dwscripts.setCommandReturnValue(retVal);
  56.   
  57.   // reset the options list
  58.   DSN_SELECT_OBJ.setAll(new Array(MM.LABEL_Loading));
  59.   
  60.   window.close();
  61. }
  62.  
  63.  
  64. //--------------------------------------------------------------------
  65. // FUNCTION:
  66. //   cancelClicked
  67. //
  68. // DESCRIPTION:
  69. //   Closes the window and returns nothing
  70. //
  71. // ARGUMENTS:
  72. //   none
  73. //
  74. // RETURNS:
  75. //   nothing
  76. //--------------------------------------------------------------------
  77.  
  78. function cancelClicked()
  79. {
  80.   dwscripts.setCommandReturnValue("");
  81.  
  82.   // reset the options list
  83.   DSN_SELECT_OBJ.setAll(new Array(MM.LABEL_Loading));
  84.   
  85.   window.close();
  86. }
  87.  
  88.  
  89. //--------------------------------------------------------------------
  90. // FUNCTION:
  91. //   displayHelp
  92. //
  93. // DESCRIPTION:
  94. //   Displays the built-in Dreamweaver help.
  95. //
  96. // ARGUMENTS:
  97. //   none
  98. //
  99. // RETURNS:
  100. //   nothing
  101. //--------------------------------------------------------------------
  102.  
  103. function displayHelp()
  104. {
  105.   // Replace the following call if you are modifying this file for your own use.
  106.   dwscripts.displayDWHelp(HELP_DOC);
  107. }
  108.  
  109.  
  110.  
  111. //*******************LOCAL FUNCTIONS*********************
  112.  
  113. //--------------------------------------------------------------------
  114. // FUNCTION:
  115. //   initializeUI
  116. //
  117. // DESCRIPTION:
  118. //   Find the dom objects that will be used to manipualte the dialog
  119. //
  120. // ARGUMENTS:
  121. //   none
  122. //
  123. // RETURNS:
  124. //   nothing
  125. //--------------------------------------------------------------------
  126.  
  127. function initializeUI()
  128. {
  129.   DSN_SELECT_OBJ = new ListControl("dsn");
  130.  
  131.   var args = dwscripts.getCommandArguments();
  132.   if (args && args.length)
  133.   {
  134.     var selectedDSN = args[0];
  135.     var useHTTP = args[1];
  136.   }
  137.   else if (MM.useHTTP)
  138.   {
  139.     // special case to handle old references to this dialog
  140.     selectedDSN = MM.commandReturnValue;
  141.     useHTTP = MM.useHTTP;
  142.   }  
  143.   
  144.   if (useHTTP)
  145.   {
  146.     //use Remote DSN List
  147.     var remoteDSNs = MMDB.getRemoteDsnList();
  148.     DSN_SELECT_OBJ.setAll(remoteDSNs, remoteDSNs);
  149.   }
  150.   else
  151.   {
  152.     //use Local DSN List
  153.     var localDSNs = MMDB.getLocalDsnList();
  154.     DSN_SELECT_OBJ.setAll(localDSNs, localDSNs);
  155.   }
  156.  
  157.   if(!DSN_SELECT_OBJ.pickValue(selectedDSN))
  158.   {
  159.     DSN_SELECT_OBJ.setIndex(0);
  160.   }
  161.  
  162. }
  163.