Leaked source code of windows server 2003
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

159 lines
6.7 KiB

  1. namespace UDDI.Web
  2. {
  3. using System;
  4. using System.Web;
  5. using System.Web.UI;
  6. using System.Web.UI.WebControls;
  7. using System.ComponentModel;
  8. using System.Collections;
  9. using System.Collections.Specialized;
  10. using System.Web.Configuration;
  11. using UDDI;
  12. /// ********************************************************************
  13. /// public class SideNav
  14. /// --------------------------------------------------------------------
  15. /// <summary>
  16. /// Produces the Side navigatio bar.
  17. /// </summary>
  18. /// ********************************************************************
  19. ///
  20. public class SideNav : System.Web.UI.WebControls.WebControl
  21. {
  22. protected string root;
  23. protected string roots;
  24. /// ****************************************************************
  25. /// protected Render
  26. /// ----------------------------------------------------------------
  27. /// <summary>
  28. /// Renders the control.
  29. /// </summary>
  30. /// ----------------------------------------------------------------
  31. /// <param name="output">
  32. /// The output stream.
  33. /// </param>
  34. /// ****************************************************************
  35. ///
  36. protected override void Render( HtmlTextWriter output )
  37. {
  38. HttpRequest request = HttpContext.Current.Request;
  39. root = ( "/" == request.ApplicationPath ) ? "" : request.ApplicationPath;
  40. if( 1 == Config.GetInt( "Security.HTTPS", 0 ) )
  41. roots = "https://" + request.Url.Host + root;
  42. else
  43. roots = "http://" + request.Url.Host + root;
  44. root = "http://" + request.Url.Host + root;
  45. output.WriteLine( "<TABLE cellpadding='4' cellspacing='0' border='0' width='100%' height='100%'>" );
  46. output.WriteLine( "<TR><TD height='4' colspan='2' style='border-right: solid 1px #639ACE;'><IMG src='/images/trans_pixel.gif' width='1' height='1' border='0'></TD></TR>" );
  47. RenderMenuHeader( output, "LINKS" );
  48. RenderMenuItem( output, "Home", "/default.aspx", "", false );
  49. RenderMenuItem( output, "News", "http://www.uddi.org/news.html", "", false );
  50. RenderMenuHeader( output, "TOOLS" );
  51. RenderMenuItem( output, "Register", "/register.aspx", "/registrationcomplete.aspx", true );
  52. RenderMenuItem( output, "Publish", "/edit/default.aspx", "", true );
  53. RenderMenuItem( output, "Search", "/search/default.aspx", "", false );
  54. RenderMenuHeader( output, "DEVELOPERS" );
  55. RenderMenuItem( output, "For Developers", "/developer/default.aspx", "/developer/techOverview.aspx;/developer/KnownIssues.aspx", false );
  56. RenderMenuItem( output, "Solutions", "/solutions.aspx", "", false );
  57. RenderMenuHeader( output, "HELP" );
  58. RenderMenuItem( output, "Help", "/help/default.aspx", "", false );
  59. RenderMenuItem( output, "Frequently Asked Questions", "/about/faq.aspx", "/about/faqbasics.aspx;/about/faqcost.aspx;/about/faqoperators.aspx;/about/faqregistration.aspx;/about/faqscope.aspx;/about/faqsearching.aspx;/about/faqsecurity.aspx;/about/faqtech.aspx", false );
  60. RenderMenuItem( output, "Policies", "/policies/default.aspx", "/policies/privacypolicy.aspx;/policies/termsofuse.aspx", false );
  61. RenderMenuItem( output, "About UDDI", "/about/default.aspx", "", false );
  62. RenderMenuItem( output, "Contact Us", "/contact/default.aspx", "", false );
  63. output.WriteLine("<TR>");
  64. output.WriteLine("<TD COLSPAN='2' HEIGHT='100%' STYLE='border-right : solid 1px #639ACE;'>");
  65. output.WriteLine("&nbsp;</TD>");
  66. output.WriteLine("</TR>");
  67. output.WriteLine( "</TABLE>" );
  68. }
  69. /// ****************************************************************
  70. /// private RenderMenuHeader
  71. /// ----------------------------------------------------------------
  72. /// <summary>
  73. /// Renders a menu header.
  74. /// </summary>
  75. /// ----------------------------------------------------------------
  76. /// <param name="output">
  77. /// The output stream.
  78. /// </param>
  79. ///
  80. /// <param name="name">
  81. /// Menu header name.
  82. /// </param>
  83. /// ****************************************************************
  84. ///
  85. private void RenderMenuHeader( HtmlTextWriter output, string name )
  86. {
  87. output.WriteLine( " <TR>" );
  88. output.WriteLine( " <TD colspan='2' height='8' style='border-right: solid 1px #639ACE;'><IMG height='1' src='"+root + "/images/trans_pixel.gif" +"' width='1' border='0'></TD>" );
  89. output.WriteLine( " </TR>" );
  90. output.WriteLine( " <TR>" );
  91. output.WriteLine( " <TD bgcolor='#F1F1F1' width='10'></TD>" );
  92. output.WriteLine( " <TD class='menu_cell_border'><FONT class='menu_head'>" + name + "</FONT></TD>" );
  93. output.WriteLine( " </TR>" );
  94. }
  95. /// ****************************************************************
  96. /// private RenderMenuItem
  97. /// ----------------------------------------------------------------
  98. /// <summary>
  99. /// Renders a menu item.
  100. /// </summary>
  101. /// ----------------------------------------------------------------
  102. /// <param name="output">
  103. /// The output stream.
  104. /// </param>
  105. ///
  106. /// <param name="name">
  107. /// Menu item name.
  108. /// </param>
  109. ///
  110. /// <param name="url">
  111. /// Menu item url.
  112. /// </param>
  113. ///
  114. /// <param name="alternateURLs">
  115. /// Alternate URLs that this menu item is associated with.
  116. /// </param>
  117. /// ****************************************************************
  118. ///
  119. private void RenderMenuItem( HtmlTextWriter output, string name, string url, string alternateURLs, bool secure )
  120. {
  121. string thisPage = HttpContext.Current.Request.ServerVariables["SCRIPT_NAME"].ToLower();
  122. bool currentPage = false;
  123. if( url.ToLower() == thisPage )
  124. currentPage = true;
  125. else if( null != alternateURLs )
  126. {
  127. alternateURLs = ";" + alternateURLs.ToLower() + ";";
  128. if( alternateURLs.IndexOf( thisPage ) >= 0 )
  129. currentPage = true;
  130. }
  131. string color = ( currentPage ? "#ffffff" : "#f1f1f1" );
  132. string border = ( currentPage ? "border-bottom: 1px solid #639ACE; border-top: 1px solid #639ACE; border-left: 1px solid #639ACE;" : " border-right: solid 1px #639ACE;" );
  133. output.WriteLine( " <TR>" );
  134. output.WriteLine( " <TD bgcolor='#F1F1F1' width='10'></TD>" );
  135. output.WriteLine( " <TD style='" + border + "' bgcolor='" + color + "' onmouseover='this.style.backgroundColor=\"#CCCCCC\"' onmouseout='this.style.backgroundColor=\"\"' onclick='window.navigate(\"" + url + "\")' style='cursor: hand'><A class='nav' href='" + ( secure ? roots : root ) + url + "'>" + name.Replace( " ", "&nbsp;" ) + "</A></TD>" );
  136. output.WriteLine( " </TR>" );
  137. }
  138. }
  139. }