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 / Objects / Server / DynamicText.js < prev    next >
Encoding:
JavaScript  |  2002-11-25  |  4.4 KB  |  161 lines

  1. // Copyright 2001-2002 Macromedia, Inc. All rights reserved.
  2.  
  3. // *************** GLOBALS VARS *****************
  4.  
  5. // ******************* API **********************
  6.  
  7. //--------------------------------------------------------------------
  8. // FUNCTION:
  9. //   objectTag
  10. //
  11. // DESCRIPTION:
  12. //   This object is used as a shim to launch the appropriate 
  13. //   server behavior for the current server model.  The individual
  14. //   server behavior files are responsible for inserting the code on the
  15. //   page, so this function just returns the empty string.
  16. //
  17. // ARGUMENTS:
  18. //   none
  19. //
  20. // RETURNS:
  21. //   string - empty string to indicate that nothing should be inserted
  22. //--------------------------------------------------------------------
  23.  
  24. function objectTag() 
  25. {
  26.   var dom = dw.getDocumentDOM();
  27.   
  28.   if (dom)
  29.   {
  30.     var serverModel = dom.serverModel.getFolderName();
  31.     
  32.     if (serverModel)
  33.     {    
  34.       var serverBehaviorFile = "";
  35.  
  36.       switch (serverModel)
  37.       {
  38.       case "ASP_VBS":
  39.       case "ASP_JS":
  40.       case "JSP":
  41.       case "UD4-ColdFusion":
  42.         serverBehaviorFile = "Dynamic Data.htm";
  43.         break;
  44.  
  45.       case "ASP.NET_Csharp":
  46.       case "ASP.NET_VB":
  47.       case "ColdFusion":
  48.       case "PHP_MySQL":
  49.         serverBehaviorFile = "DynamicText.htm";
  50.         break;
  51.  
  52.       default:
  53.         // We will launch a server behavior with a default name
  54.         // so that live objects can be implemented
  55.         // for third party server models.
  56.  
  57.         serverBehaviorFile = "DynamicText.htm";        
  58.         break;
  59.       } 
  60.  
  61.       if (serverBehaviorFile && canInsertServerObject(serverBehaviorFile))
  62.       {
  63.         dw.popupServerBehavior(serverBehaviorFile);
  64.       }
  65.     }
  66.     else
  67.     {
  68.       alert(MM.MSG_NeedServerModelForSO);
  69.     }
  70.   }
  71.   
  72.   return "";  
  73. }
  74.  
  75.  
  76. //--------------------------------------------------------------------
  77. // FUNCTION:
  78. //   canInsertServerObject
  79. //
  80. // DESCRIPTION:
  81. //   The function returns true if this object can be inserted in the
  82. //   current document.  This function, and the functions it calls should
  83. //   display the necessary error messages.
  84. //
  85. // ARGUMENTS:
  86. //   sbFileName - string - the file name of the server behavior file
  87. //     which implements this object
  88. //
  89. // RETURNS:
  90. //   boolean - true if the dialog should be displayed, or false otherwise
  91. //--------------------------------------------------------------------
  92.  
  93. function canInsertServerObject(sbFileName)
  94. {
  95.   var retVal = true;
  96.  
  97.   var curDom = dw.getDocumentDOM();
  98.   var serverModel = (curDom) ? curDom.serverModel.getFolderName() : "";
  99.   var path = dw.getConfigurationPath() + "/ServerBehaviors/" + serverModel
  100.            + "/" + sbFileName;
  101.            
  102.   if (!dwscripts.fileExists(path))
  103.   {
  104.     var err = dwscripts.sprintf(MM.MSG_NeedCommandFileForSO, path);
  105.     retVal = false;
  106.     alert(err);
  107.   }
  108.   
  109.   return retVal;
  110. }
  111.  
  112. //--------------------------------------------------------------------
  113. // FUNCTION:
  114. //   getSetupSteps
  115. //
  116. // DESCRIPTION:
  117. //   Returns an array of steps to be displayed in an instructions
  118. //   dialog.  The first element of the array is the text that appears
  119. //   above the list.  The remaining elements are the steps, which will
  120. //   be rendered in a numbered list.
  121. //
  122. //   The steps are each HTML, which may contain JavaScript event
  123. //   handlers.  The event handlers can either be a JavaScript script
  124. //   or an "event:KeyWord" syntax.  If the latter is used, then the
  125. //   handler for KeyWord is implemented internally in the Dreamweaver
  126. //   executable.
  127. //
  128. // ARGUMENTS:
  129. //   none
  130. //
  131. // RETURNS:
  132. //   the array described above
  133. //--------------------------------------------------------------------
  134. function getSetupSteps()
  135. {
  136.   return getSetupStepsForServerObject();
  137. }
  138.  
  139.  
  140.  
  141. //--------------------------------------------------------------------
  142. // FUNCTION:
  143. //   setupStepsCompleted
  144. //
  145. // DESCRIPTION:
  146. //   Returns the number of steps (in the list of steps returned from
  147. //   getSetupSteps) that have already been completed.  This number is
  148. //   used to determine how many steps will have a check mark next to
  149. //   them.
  150. //
  151. // ARGUMENTS:
  152. //   none
  153. //
  154. // RETURNS:
  155. //   An integer - the number of check marks to be displayed, or -1
  156. //   if all steps have been completed.
  157. //--------------------------------------------------------------------
  158. function setupStepsCompleted()
  159. {
  160.   return setupStepsCompletedForServerObject();
  161. }