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 / AddASPNETParam.js < prev    next >
Encoding:
JavaScript  |  2003-09-05  |  4.3 KB  |  190 lines

  1. // Copyright 2002, 2003 Macromedia, Inc. All rights reserved.
  2.  
  3. var helpDoc = MM.HELP_cmdASPNetAddParam;
  4.  
  5. var _ParamName = null;
  6. var _ParamType = null;
  7. var _ParamValue = null;
  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.   
  52.   if (paramName != "")
  53.   {
  54.     var paramValue = _ParamValue.value;
  55.  
  56.     if (paramValue != "")
  57.     {
  58.       var retVal = new Array();
  59.  
  60.       retVal.push(_ParamName.value);
  61.       retVal.push(_ParamType.get());
  62.       retVal.push(_ParamValue.value);
  63.  
  64.       dwscripts.setCommandReturnValue(retVal);
  65.       window.close();
  66.     }
  67.     else
  68.     {
  69.       alert(MM.MSG_NeedParamValue);
  70.       _ParamValue.focus();
  71.     }
  72.   }
  73.   else
  74.   {
  75.     alert(MM.MSG_NeedParamName);
  76.     _ParamName.focus();
  77.   }
  78. }
  79.  
  80. //--------------------------------------------------------------------
  81. // FUNCTION:
  82. //   cancelClicked
  83. //
  84. // DESCRIPTION:
  85. //   Closes the window and returns nothing
  86. //
  87. // ARGUMENTS:
  88. //   none
  89. //
  90. // RETURNS:
  91. //   nothing
  92. //--------------------------------------------------------------------
  93.  
  94. function cancelClicked()
  95. {
  96.   dwscripts.setCommandReturnValue("");
  97.   window.close();
  98. }
  99.  
  100. //--------------------------------------------------------------------
  101. // FUNCTION:
  102. //   updateUI
  103. //
  104. // DESCRIPTION:
  105. //   This function is called by the UI controls to handle UI updates
  106. //
  107. // ARGUMENTS:
  108. //   control - string - the name of the control sending the event
  109. //   event - string - the event which is being sent
  110. //
  111. // RETURNS:
  112. //   nothing
  113. //--------------------------------------------------------------------
  114.  
  115. function updateUI(control, event)
  116. {
  117. }
  118.  
  119. //--------------------------------------------------------------------
  120. // FUNCTION:
  121. //   initializeUI
  122. //
  123. // DESCRIPTION:
  124. //   This function is called in the onLoad event.  It is responsible
  125. //   for initializing the UI.  If we are inserting a recordset, this
  126. //   is a matter of populating the connection drop down.
  127. //
  128. //   If we are modifying a recordset, this is a matter of inspecting
  129. //   the recordset tag and setting all the form elements.
  130. //
  131. // ARGUMENTS:
  132. //   none
  133. //
  134. // RETURNS:
  135. //   nothing
  136. //--------------------------------------------------------------------
  137.  
  138. function initializeUI()
  139. {
  140.   // Initialize UI elements
  141.  
  142.   var cmdArgs = dwscripts.getCommandArguments();
  143.  
  144.   _ParamName = dwscripts.findDOMObject("ParamName"); 
  145.   _ParamType = new ListControl("ParamType");
  146.   _ParamValue = dwscripts.findDOMObject("ParamValue");
  147.  
  148.   var paramName = "";
  149.   var paramType = "";
  150.   var paramValue = "";
  151.  
  152.   if (cmdArgs)
  153.   {
  154.     if (cmdArgs.length > 0)
  155.     {
  156.       var databaseType = cmdArgs[0];
  157.       var types = SBDatabaseCallASPNET.getParamTypeList(databaseType);
  158.     
  159.       _ParamType.setAll(types);
  160.     }
  161.  
  162.     if (cmdArgs.length > 3)
  163.     {
  164.       paramName = cmdArgs[1];
  165.       paramType = cmdArgs[2];
  166.       paramValue = cmdArgs[3];
  167.     }
  168.   }
  169.    
  170.   _ParamName.value = paramName;
  171.   _ParamType.pick(paramType);
  172.   _ParamValue.value = paramValue;
  173.  
  174.   _ParamName.focus();
  175. }
  176.  
  177. function OnBuildValueClicked()
  178. {
  179.   var cmdArgs = new Array();
  180.   
  181.   cmdArgs.push(_ParamName.value);
  182.     
  183.   cmdArgs = dwscripts.callCommand("AddASPNETParamRuntime", cmdArgs);
  184.  
  185.   if (cmdArgs)
  186.   {
  187.     _ParamValue.value = cmdArgs;
  188.   }
  189. }
  190.