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

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