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 / RepeatedRegion.js < prev    next >
Encoding:
JavaScript  |  2002-11-25  |  4.5 KB  |  164 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 = "Repeated Region.htm";
  43.         break;
  44.  
  45.       case "ASP.NET_Csharp":
  46.       case "ASP.NET_VB":
  47.       case "ColdFusion":
  48.       case "PHP_MySQL":
  49.         serverBehaviorFile = "RepeatedRegion.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 = "RepeatedRegion.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. // FUNCTION:
  77. //   getSetupSteps
  78. //
  79. // DESCRIPTION:
  80. //   Returns an array of steps to be displayed in an instructions
  81. //   dialog.  The first element of the array is the text that appears
  82. //   above the list.  The remaining elements are the steps, which will
  83. //   be rendered in a numbered list.
  84. //
  85. //   The steps are each HTML, which may contain JavaScript event
  86. //   handlers.  The event handlers can either be a JavaScript script
  87. //   or an "event:KeyWord" syntax.  If the latter is used, then the
  88. //   handler for KeyWord is implemented internally in the Dreamweaver
  89. //   executable.
  90. //
  91. // ARGUMENTS:
  92. //   none
  93. //
  94. // RETURNS:
  95. //   the array described above
  96. //--------------------------------------------------------------------
  97. function getSetupSteps()
  98. {
  99.   return getSetupStepsForServerObject();
  100. }
  101.  
  102.  
  103.  
  104. //--------------------------------------------------------------------
  105. // FUNCTION:
  106. //   setupStepsCompleted
  107. //
  108. // DESCRIPTION:
  109. //   Returns the number of steps (in the list of steps returned from
  110. //   getSetupSteps) that have already been completed.  This number is
  111. //   used to determine how many steps will have a check mark next to
  112. //   them.
  113. //
  114. // ARGUMENTS:
  115. //   none
  116. //
  117. // RETURNS:
  118. //   An integer - the number of check marks to be displayed, or -1
  119. //   if all steps have been completed.
  120. //--------------------------------------------------------------------
  121. function setupStepsCompleted()
  122. {
  123.   return setupStepsCompletedForServerObject();
  124. }
  125.  
  126.  
  127.  
  128. // ***************** LOCAL FUNCTIONS  ******************
  129.  
  130. //--------------------------------------------------------------------
  131. // FUNCTION:
  132. //   canInsertServerObject
  133. //
  134. // DESCRIPTION:
  135. //   The function returns true if this object can be inserted in the
  136. //   current document.  This function, and the functions it calls should
  137. //   display the necessary error messages.
  138. //
  139. // ARGUMENTS:
  140. //   sbFileName - string - the file name of the server behavior file
  141. //     which implements this object
  142. //
  143. // RETURNS:
  144. //   boolean - true if the dialog should be displayed, or false otherwise
  145. //--------------------------------------------------------------------
  146.  
  147. function canInsertServerObject(sbFileName)
  148. {
  149.   var retVal = true;
  150.  
  151.   var curDom = dw.getDocumentDOM();
  152.   var serverModel = (curDom) ? curDom.serverModel.getFolderName() : "";
  153.   var path = dw.getConfigurationPath() + "/ServerBehaviors/" + serverModel
  154.            + "/" + sbFileName;
  155.            
  156.   if (!dwscripts.fileExists(path))
  157.   {
  158.     var err = dwscripts.sprintf(MM.MSG_NeedCommandFileForSO, path);
  159.     retVal = false;
  160.     alert(err);
  161.   }
  162.   
  163.   return retVal;
  164. }