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 / AddASPNETParamRuntime.js < prev    next >
Encoding:
JavaScript  |  2003-09-05  |  3.9 KB  |  154 lines

  1. // Copyright 2002, 2003 Macromedia, Inc. All rights reserved.
  2.  
  3. var helpDoc = MM.HELP_cmdASPNetBuildRuntime;
  4.  
  5. var _ParamName = null;
  6. var _ParamSource = null;
  7. var _ParamDefault = new TextField("AddASPNetParamRuntime.htm", "ParamDefault");
  8.  
  9. //*************************API**************************
  10.  
  11. //--------------------------------------------------------------------
  12. // FUNCTION:
  13. //   commandButtons
  14. //
  15. // DESCRIPTION:
  16. //   Returns the array of buttons that should be displayed on the
  17. //   right hand side of the dialog.  The array is comprised
  18. //   of name, handler function name pairs.
  19. //
  20. // ARGUMENTS:
  21. //   none
  22. //
  23. // RETURNS:
  24. //   array of strings - name, handler function name pairs
  25. //--------------------------------------------------------------------
  26.  
  27. function commandButtons()
  28. {                          
  29.   return new Array(MM.BTN_OK,     "okClicked()",
  30.                    MM.BTN_Cancel, "cancelClicked()",
  31.                    MM.BTN_Help,   "displayHelp()" );
  32. }
  33.  
  34. //--------------------------------------------------------------------
  35. // FUNCTION:
  36. //   okClicked
  37. //
  38. // DESCRIPTION:
  39. //   Sets the return value to the selected DSN and closes the window.
  40. //
  41. // ARGUMENTS:
  42. //   none
  43. //
  44. // RETURNS:
  45. //   nothing
  46. //--------------------------------------------------------------------
  47.  
  48. function okClicked()
  49. {
  50.   var paramName = _ParamName.value;
  51.   var paramSource = _ParamSource.getValue();
  52.   var paramDefault = _ParamDefault.getValue();
  53.   var runtime = dwscripts.getParameterCodeFromType(paramSource, paramName, paramDefault);
  54.  
  55.   dwscripts.setCommandReturnValue(runtime);
  56.   window.close();
  57.  
  58.   return;
  59. }
  60.  
  61. //--------------------------------------------------------------------
  62. // FUNCTION:
  63. //   cancelClicked
  64. //
  65. // DESCRIPTION:
  66. //   Closes the window and returns nothing
  67. //
  68. // ARGUMENTS:
  69. //   none
  70. //
  71. // RETURNS:
  72. //   nothing
  73. //--------------------------------------------------------------------
  74.  
  75. function cancelClicked()
  76. {
  77.   dwscripts.setCommandReturnValue("");
  78.   window.close();
  79. }
  80.  
  81. //--------------------------------------------------------------------
  82. // FUNCTION:
  83. //   updateUI
  84. //
  85. // DESCRIPTION:
  86. //   This function is called by the UI controls to handle UI updates
  87. //
  88. // ARGUMENTS:
  89. //   control - string - the name of the control sending the event
  90. //   event - string - the event which is being sent
  91. //
  92. // RETURNS:
  93. //   nothing
  94. //--------------------------------------------------------------------
  95.  
  96. function updateUI(control, event)
  97. {
  98. }
  99.  
  100. //--------------------------------------------------------------------
  101. // FUNCTION:
  102. //   initializeUI
  103. //
  104. // DESCRIPTION:
  105. //   This function is called in the onLoad event.  It is responsible
  106. //   for initializing the UI.  If we are inserting a recordset, this
  107. //   is a matter of populating the connection drop down.
  108. //
  109. //   If we are modifying a recordset, this is a matter of inspecting
  110. //   the recordset tag and setting all the form elements.
  111. //
  112. // ARGUMENTS:
  113. //   none
  114. //
  115. // RETURNS:
  116. //   nothing
  117. //--------------------------------------------------------------------
  118.  
  119. function initializeUI()
  120. {
  121.   // Initialize UI elements
  122.  
  123.   _ParamName = dwscripts.findDOMObject("ParamName"); 
  124.   _ParamSource = new ListControl("ParamSource");
  125.   _ParamDefault.initializeUI();
  126.  
  127.   // Get the arguments passed in
  128.  
  129.   var cmdArgs = dwscripts.getCommandArguments();
  130.   var paramName = "";
  131.   var paramDefault = "";
  132.  
  133.   if (cmdArgs && cmdArgs.length) 
  134.   {
  135.     paramName = (cmdArgs[0] ? cmdArgs[0] : "");
  136.     paramDefault = (cmdArgs[1] ? cmdArgs[1] : "");
  137.   }
  138.  
  139.   // If the name starts with "@", remove it
  140.  
  141.   if (paramName.charAt(0) == '@')
  142.   {
  143.     paramName = paramName.substring(1, paramName.length);
  144.   }
  145.   
  146.   _ParamName.value = paramName;
  147.   _ParamDefault.setValue(paramDefault);
  148.  
  149.   var types = dwscripts.getParameterTypeArray(true);
  150.   _ParamSource.setAll(types, types);
  151.  
  152.   _ParamName.focus();
  153. }
  154.