namespace UDDI.Web
{
using System;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.ComponentModel;
using System.Collections;
using System.Collections.Specialized;
using System.Web.Configuration;
using UDDI;
/// ********************************************************************
/// public class SideNav
/// --------------------------------------------------------------------
///
/// Produces the Side navigatio bar.
///
/// ********************************************************************
///
public class SideNav : System.Web.UI.WebControls.WebControl
{
protected string root;
protected string roots;
/// ****************************************************************
/// protected Render
/// ----------------------------------------------------------------
///
/// Renders the control.
///
/// ----------------------------------------------------------------
///
/// The output stream.
///
/// ****************************************************************
///
protected override void Render( HtmlTextWriter output )
{
HttpRequest request = HttpContext.Current.Request;
root = ( "/" == request.ApplicationPath ) ? "" : request.ApplicationPath;
if( 1 == Config.GetInt( "Security.HTTPS", 0 ) )
roots = "https://" + request.Url.Host + root;
else
roots = "http://" + request.Url.Host + root;
root = "http://" + request.Url.Host + root;
output.WriteLine( "
" );
output.WriteLine( " |
" );
RenderMenuHeader( output, "LINKS" );
RenderMenuItem( output, "Home", "/default.aspx", "", false );
RenderMenuItem( output, "News", "http://www.uddi.org/news.html", "", false );
RenderMenuHeader( output, "TOOLS" );
RenderMenuItem( output, "Register", "/register.aspx", "/registrationcomplete.aspx", true );
RenderMenuItem( output, "Publish", "/edit/default.aspx", "", true );
RenderMenuItem( output, "Search", "/search/default.aspx", "", false );
RenderMenuHeader( output, "DEVELOPERS" );
RenderMenuItem( output, "For Developers", "/developer/default.aspx", "/developer/techOverview.aspx;/developer/KnownIssues.aspx", false );
RenderMenuItem( output, "Solutions", "/solutions.aspx", "", false );
RenderMenuHeader( output, "HELP" );
RenderMenuItem( output, "Help", "/help/default.aspx", "", false );
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 );
RenderMenuItem( output, "Policies", "/policies/default.aspx", "/policies/privacypolicy.aspx;/policies/termsofuse.aspx", false );
RenderMenuItem( output, "About UDDI", "/about/default.aspx", "", false );
RenderMenuItem( output, "Contact Us", "/contact/default.aspx", "", false );
output.WriteLine("");
output.WriteLine("");
output.WriteLine(" | ");
output.WriteLine("
");
output.WriteLine( "
" );
}
/// ****************************************************************
/// private RenderMenuHeader
/// ----------------------------------------------------------------
///
/// Renders a menu header.
///
/// ----------------------------------------------------------------
///
/// The output stream.
///
///
///
/// Menu header name.
///
/// ****************************************************************
///
private void RenderMenuHeader( HtmlTextWriter output, string name )
{
output.WriteLine( " " );
output.WriteLine( " | " );
output.WriteLine( "
" );
output.WriteLine( " " );
output.WriteLine( " | " );
output.WriteLine( " " );
output.WriteLine( "
" );
}
/// ****************************************************************
/// private RenderMenuItem
/// ----------------------------------------------------------------
///
/// Renders a menu item.
///
/// ----------------------------------------------------------------
///
/// The output stream.
///
///
///
/// Menu item name.
///
///
///
/// Menu item url.
///
///
///
/// Alternate URLs that this menu item is associated with.
///
/// ****************************************************************
///
private void RenderMenuItem( HtmlTextWriter output, string name, string url, string alternateURLs, bool secure )
{
string thisPage = HttpContext.Current.Request.ServerVariables["SCRIPT_NAME"].ToLower();
bool currentPage = false;
if( url.ToLower() == thisPage )
currentPage = true;
else if( null != alternateURLs )
{
alternateURLs = ";" + alternateURLs.ToLower() + ";";
if( alternateURLs.IndexOf( thisPage ) >= 0 )
currentPage = true;
}
string color = ( currentPage ? "#ffffff" : "#f1f1f1" );
string border = ( currentPage ? "border-bottom: 1px solid #639ACE; border-top: 1px solid #639ACE; border-left: 1px solid #639ACE;" : " border-right: solid 1px #639ACE;" );
output.WriteLine( " " );
output.WriteLine( " | " );
output.WriteLine( " " + name.Replace( " ", " " ) + " | " );
output.WriteLine( "
" );
}
}
}