Click here to Skip to main content
15,895,833 members
Articles / Web Development / ASP.NET

ASP.NET Google Site Map Provider

Rate me:
Please Sign up or sign in to vote.
2.40/5 (4 votes)
10 Oct 2006CPOL9 min read 94.4K   2.7K   43  
Using the ASP.NET Provider model to generate a dynamic Google Sitemap.
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
<title>Google Site Map Provider UML Static Structure</title>
<meta name="vs_targetSchema" content="http://schemas.microsoft.com/intellisense/ie5"/>
<link href="visio.css" rel="stylesheet">
<script src="keys.js" type="text/jscript" language="jscript"></script>
<script src="find.js" type="text/jscript" language="jscript"></script>
<script type="text/jscript" language="jscript">
	
	var imgMin = new Image();
	imgMin.src = "minimize.gif";
	
	var imgMax = new Image();
	imgMax.src = "maximize.gif";

	var fileList = parent.g_FileList;
	
	function Widgets()
	{
		this.GoTo = null;
		this.Search = null;
		this.Details = null;
		this.PNZ = null;

		this.divCount = 0;
		
		this.OpenText = "Collapse all";
		this.OpenAlt = "Collapse all";
		this.ClosedText = "Expand all";
		this.ClosedAlt = "Expand all";

		this.Display = "";
		this.Img = imgMin;
		this.Text = this.OpenText;
		this.Alt = this.OpenAlt;
		
		this.ToggleAll = ToggleAll;
		this.ToggleWidget = ToggleWidget;
		this.Add = Add;
	}		

	function Add(div, name)
	{
		tmpStr = "this." + name + " = new Widget(div);"
		eval(tmpStr);
		var thisWidget = eval("this." + name);
	}

	function Widget(div)
	{
		return div;
	}	

	function ToggleAll()
	{
		var OpenCloseFunc = Widget;

		if(this.Display == "")
		{
			this.Display = "none";
			this.Img = imgMax;
			this.Text = this.ClosedText;
			this.Alt = this.ClosedAlt;
			expparent00.title = this.ClosedAlt;
			OpenCloseFunc = CloseWidget;
		}
		else
		{
			this.Display = "";
			this.Img = imgMin;
			this.Text = this.OpenText;
			this.Alt = this.OpenAlt;
			expparent00.title = this.OpenAlt;
			OpenCloseFunc = OpenWidget;
		}
		exp00.src = this.Img.src;	
		textExp.innerText = this.Text;
		exp00.alt = this.Alt;
	
		if(this.GoTo)
		{
			OpenCloseFunc(this.GoTo)
		}
		if(this.Search)
		{
			OpenCloseFunc(this.Search)
		}
		if(this.Details)
		{
			OpenCloseFunc(this.Details)
		}
		if(this.PNZ)
		{
			OpenCloseFunc(this.PNZ)
		}
	}

	function ToggleNav()
	{
		if(divCollapsedNav.style.display == "none")
		{
			divCollapsedNav.style.display = "";
			divOpenNav.style.display = "none";
			parent.frmstOuter.cols = "20,*"
			parent.document.all ('frmToolbar').noResize = true;
		}
		else
		{
			divOpenNav.style.display = "";
			divCollapsedNav.style.display = "none";
			parent.frmstOuter.cols = "237,*"
			parent.document.all ('frmToolbar').noResize = false;
		}
	}
	
	function ToggleWidget(div)
	{
		if(div.style.display == "none")
		{
			OpenWidget(div);
		}
		else
		{
			CloseWidget(div);
		}
	}

	function OpenWidget(div)
	{
		document.all(div.img).src = imgMin.src;
		div.style.display = "";
		document.all(div.img).alt = div.openAlt;
		document.all(div.img + "1").title = div.openAlt;
		document.all(div.img + "2").title = div.openAlt;
	}

	function CloseWidget(div)
	{
		document.all(div.img).src = imgMax.src;
		div.style.display = "none";
		document.all(div.img).alt = div.closedAlt;
		document.all(div.img + "1").title = div.closedAlt;
		document.all(div.img + "2").title = div.closedAlt;
	}

	function load()
	{
		parent.g_WidgetsLoaded = true;

		if (parent.g_LoadingWidgets)
		{
			parent.g_LoadingWidgets = false;
			parent.location.reload();
		}
	}

	function unload()
	{
		parent.g_LoadingWidgets = true;
	}
	
		
	var widgets = new Widgets();

</script>

</head>
<body onload="load();" onunload="unload();">
<div id="divOpenNav" class="nav">

	<table id="tabToc" width="100%" class="navTocColor" style="margin-bottom:1px;" cellspacing="0" cellpadding="0" border="0" height="20">
	<tr>
	<td width="2"><a href="javascript:ToggleNav();" title="Collapse navigation frame" id="linkNavOpen"><img src="toc.gif" alt="Collapse navigation frame" width="22" height="17" border="0"></a></td>
	<td align="left"><p class="p1"><a href="javascript:ToggleNav();" title="Collapse navigation frame" class="a1">Hide</a></p></td>
	<td align="right"><p class="p1"><a href="javascript:widgets.ToggleAll()" id="textExp" class="a1">Collapse all</a></p></td>
	<td width="2">
		<div style="padding:2pt,1.5pt,0pt,0pt"><a href="javascript:widgets.ToggleAll()" title="Collapse all" id="expparent00"><img id="exp00" alt="Collapse all" src="minimize.gif" width="15" height="15" border="0"></a></div>
	</td>
	</tr>
	</table>
	
	
	<div id="divGoto" class="holder">
		<table width="100%" cellspacing="0" cellpadding="0" border="0" class="holderTable">
		<tr><td>
			<div class="fillcolor">
				<table width="100%" cellspacing="0" cellpadding="1" border="0" class="fillcolor">
				<tr>
				<td><a id="exp01" title="Collapse Go to Page" href="javascript:widgets.ToggleWidget(hideGoto);"><p class="label">Go to Page</p></a></td>
				<td width="15"><a id="exp02" title="Collapse Go to Page" href="javascript:widgets.ToggleWidget(hideGoto);"><img id="exp0" alt="Collapse Go to Page" src="minimize.gif" width="15" height="15" border="0"></a></td>
				</tr>
				</table>
			</div>
		</td></tr>
		<tr><td>
			<div id="hideGoto" img="exp0" class="hider" openAlt="Collapse Go to Page" closedAlt="Expand Go to Page">
				<form class="page" ID="formPage" onsubmit="parent.GoToPage(Select1.value); return false;">
					<table width="100%" cellspacing="0" cellpadding="3" border="0">	
					<tr>
					<td>
					<select class="formText" ID="Select1" NAME="Select1" title="Select page from list. Press Enter to go to the selected page." onkeyup="if(window.event.keyCode == 13) {parent.GoToPage(Select1.value);} return false;">
					<script type="text/jscript" language="jscript">
						var options = "";
						for (var count = 0; count < fileList.length; count++)
						{
							options += '<option value="' + count + '">' + fileList[count].PageName + '</option>';
						}

						document.write (options);
					</script>
					</select>
					</td>
					<td width="18" class="gobutton">
					<input type="image" src="go.gif" name="go" alt="Go to selected page" width="18" height="18" border="0">
					</td>
					</tr>
					</table>
				</form>
			</div>
		</td></tr>
		</table>	
		
		<script type="text/jscript" language="jscript">
			widgets.Add(hideGoto, "GoTo");
		</script>
	</div>

	
	<div id="divPNZ" class="holder">
		<table width="100%" cellspacing="0" cellpadding="0" border="0" class="holderTable">
		<tr><td>
			<div class="fillcolor">
				<table width="100%" cellspacing="0" cellpadding="1" border="0" class="fillcolor">
				<tr>
				<td><a id="exp41" title="Collapse Pan and Zoom" href="javascript:widgets.ToggleWidget(hidePNZ);"><p class="label">Pan and Zoom</p></a></td>
				<td width="15"><a id="exp42" title="Collapse Pan and Zoom" href="javascript:widgets.ToggleWidget(hidePNZ);"><img id="exp4" alt="Collapse Pan and Zoom" src="minimize.gif" width="15" height="15" border="0"></a></td>
				</tr>
				</table>
			</div>
		</td></tr>
		<tr><td>
			<div id="hidePNZ" style="text-align:right;" img="exp4" class="hiderScroll" openAlt="Collapse Pan and Zoom" closedAlt="Expand Pan and Zoom">
				<table width="220" border="0" cellpadding="0" cellspacing="0">
				<tr>
				<td align="center" valign="middle">
					<iframe title="Pan and Zoom window" longdesc="Pan and Zoom window" id="ifrmPNZ" src="zoom.htm" width="170" height="170" frameborder="0" marginheight="0" marginwidth="0" scrolling="no" style="border: #cccccc 1px solid;"></iframe>
				</td>
					
				<td>
					<table id="tabScale" width="17" cellspacing="0" cellpadding="0" border="0">
						<tr><td><a href="javascript:tickSelect(100);" title="Zoom page to 100%"><img src="fullpage.gif" alt="Zoom page to 100%" border="0"></a></td></tr>
						<tr><td><a href="javascript:ZoomUpDown(1);" title="Zoom in"><img src="panplus.gif" alt="Zoom in" border="0"></a></td></tr>
						<tr><td><a href="javascript:tickSelect(500);" title="Zoom to 500%"><img id="t500" src="tick-off.gif" alt="Zoom to 500%" width="17" height="11" border="0"></a></td></tr>
						<tr><td><a href="javascript:tickSelect(450);" title="Zoom to 450%"><img id="t450" src="tick-off.gif" alt="Zoom to 450%" width="17" height="11" border="0"></a></td></tr>
						<tr><td><a href="javascript:tickSelect(400);" title="Zoom to 400%"><img id="t400" src="tick-off.gif" alt="Zoom to 400%" width="17" height="11" border="0"></a></td></tr>
						<tr><td><a href="javascript:tickSelect(350);" title="Zoom to 350%"><img id="t350" src="tick-off.gif" alt="Zoom to 350%" width="17" height="11" border="0"></a></td></tr>
						<tr><td><a href="javascript:tickSelect(300);" title="Zoom to 300%"><img id="t300" src="tick-off.gif" alt="Zoom to 300%" width="17" height="11" border="0"></a></td></tr>
						<tr><td><a href="javascript:tickSelect(250);" title="Zoom to 250%"><img id="t250" src="tick-off.gif" alt="Zoom to 250%" width="17" height="11" border="0"></a></td></tr>
						<tr><td><a href="javascript:tickSelect(200);" title="Zoom to 200%"><img id="t200" src="tick-off.gif" alt="Zoom to 200%" width="17" height="11" border="0"></a></td></tr>
						<tr><td><a href="javascript:tickSelect(150);" title="Zoom to 150%"><img id="t150" src="tick-off.gif" alt="Zoom to 150%" width="17" height="11" border="0"></a></td></tr>
						<tr><td><a href="javascript:tickSelect(100);" title="Zoom to 100%" id="a100"><img id="t100" src="tick-on.gif" alt="Zoom to 100%" width="17" height="11" border="0"></a></td></tr>
						<tr><td><a href="javascript:tickSelect(50);" title="Zoom to 50%"><img id="t50" src="tick-off.gif" alt="Zoom to 50%" width="17" height="11" border="0"></a></td></tr>
						<tr><td><a href="javascript:tickSelect(10);" title="Zoom to 10%"><img id="t10" src="tick-off.gif" alt="Zoom to 10%" width="17" height="11" border="0"></a></td></tr>
						<tr><td><a href="javascript:ZoomUpDown(-1);" title="Zoom out"><img src="panminus.gif" alt="Zoom out" border="0"></a></td></tr>
					</table>
				</td>
				</tr>
				</table>
			</div>			
		</td></tr>
		</table>
		
		<script type="text/jscript" language="jscript">
			widgets.Add(hidePNZ, "PNZ");

			var zoomLevels = new Array(10, 50, 100, 150, 200, 250, 300, 350, 400, 450, 500);

			var tickOff = new Image();
			tickOff.src = "tick-off.gif";
			
			var tickFoc = new Image();
			tickFoc.src = "tick-foc.gif";
			
			var tickOn = new Image();
			tickOn.src = "tick-on.gif";

			function tickFocus()
			{
				var elem = window.event.srcElement;
				if(elem.state == "off")
				{
					elem.src = tickFoc.src;
				}
			}			
			
			function tickBlur(percentZoom)
			{
				var elem = window.event.srcElement;
				if(elem.state == "off")
				{
					elem.src = tickOff.src;
				}
			}

			function tickSelect(percentZoom)
			{
				if (parent.viewMgr &&
					parent.viewMgr.Zoom)
				{
					changeTick(percentZoom);
					parent.viewMgr.Zoom(percentZoom);					
				}

				if(frames.item(0).zoomRectDiv)
				{
					frames.item(0).g_width = parseInt(frames.item(0).zoomRectDiv.style.pixelWidth) 
					frames.item(0).g_height = parseInt(frames.item(0).zoomRectDiv.style.pixelHeight)
					frames.item(0).g_newLeft = parseInt(frames.item(0).zoomRectDiv.style.left)
					frames.item(0).g_newTop = parseInt(frames.item(0).zoomRectDiv.style.top)
				}
			}

			function changeTick(percentZoom)
			{
				img = elemScale.all("t" + percentZoom);
									
				img.src = tickOn.src;
				
				if(elemScale.tickSelected && elemScale.tickSelected != img)
				{
					elemScale.tickSelected.src = tickOff.src;
				}
				elemScale.tickSelected = img;
			}
			
			function ZoomUpDown(increment)
			{
				if (elemScale.tickSelected)
				{
					var curZoomLevel = elemScale.tickSelected.id.substring (1);
					var newZoomLevelIndex = IndexFromLevel (curZoomLevel * 1.0);
					if (newZoomLevelIndex >= 0)
					{
						var img = elemScale.all("t" + zoomLevels[newZoomLevelIndex + increment]);
						if (img)
						{
							tickSelect(img.id.substring(1));
						}
					}
				}
				else
				{
					tickSelect (100);
				}
			}

			function IndexFromLevel (zoomLevel)
			{
				for (var count = 0; count < zoomLevels.length; count++)
				{
					if (zoomLevels[count] == zoomLevel)
					{
						return count;
					}
				}

				return -1;
			}
			
			elemScale = document.all("tabScale");
			if(elemScale)
			{
				elemScale.onmouseover = tickFocus;
				elemScale.onmouseout = tickBlur;
			}
		</script>
	</div>

	
	<div id="divDetails" class="holder">
		<table width="100%" cellspacing="0" cellpadding="0" border="0" class="holderTable">
		<tr><td>
			<div class="fillcolor">
				<table width="100%" cellspacing="0" cellpadding="1" border="0" class="fillcolor">
				<tr>
				<td><a id="exp21" title="Collapse Details" href="javascript:widgets.ToggleWidget(hideDetails);"><p class="label">Details</p></a></td>
				<td width="15"><a id="exp22" title="Collapse Details" href="javascript:widgets.ToggleWidget(hideDetails);"><img id="exp2" alt="Collapse Details" src="minimize.gif" width="15" height="15" border="0"></a></td>
				</tr>
				</table>
			</div>
		</td></tr>
		<tr><td>
			<div id="hideDetails" class="hiderScroll" img="exp2" openAlt="Collapse Details" closedAlt="Expand Details">
				<P class="p2" class="detsPara">CTRL+click a shape in the drawing to view details.</P>
			</div>
		</td></tr>
		</table>		
		
		<script type="text/jscript" language="jscript">
			widgets.Add(hideDetails, "Details");
			widgets.divCount++;
		
		</script>
	</div>

	
	<div id="divSearch" class="holder">
		<table width="100%" cellspacing="0" cellpadding="0" border="0" class="holderTable">
		<tr><td>
			<div class="fillcolor">
				<table width="100%" cellspacing="0" cellpadding="1" border="0" class="fillcolor">
				<tr>
				<td><a id="exp11" title="Collapse Search Pages" href="javascript:widgets.ToggleWidget(hideSearch);"><p class="label">Search Pages</p></a></td>
				<td width="15"><a id="exp12" title="Collapse Search Pages" href="javascript:widgets.ToggleWidget(hideSearch);"><img src="minimize.gif" id="exp1" alt="Collapse Search Pages" width="15" height="15" border="0"></a></td>
				</tr>
				</table>
			</div>

		</td></tr>
		<tr><td>	

			<div id="hideSearch" img="exp1" class="hiderScroll" openAlt="Collapse Search Pages" closedAlt="Expand Search Pages">
								<form name=theForm onsubmit="FindOnClick(); return false;" ID="Form1">
									<table width="100%" cellspacing="0" cellpadding="3" border="0">
									<tr>
									<td width="100%">
										<input class="formText" type="text" name="findString" maxlength="255" size="26" title="Enter text for search. Press Enter to begin search.">
									</td>
									<td width="18" class="gobutton">
										<input type="image" src="go.gif" alt="Start searching" width="18" height="18" ID="GoButton" NAME="GoButton">
									</td>
									</tr>
									<tr>
									<td colspan="2" class="p2">
										<a href="javascript:{};" tabindex="0" onclick="TogglePlus(hideAdvSrch,as0);" class="blu1"><img src="plus.gif" alt="Shows/hides advanced searching options" border="0" id="as0">Advanced</a>
											<div id="hideAdvSrch" class="hiderScroll" style="display:none;">
												<b>Search By:</b>
												<div id="divS"></div>
											</div>
										<hr width="100%" size="1" color="#cccccc">
										<div id="hideResults" class="hiderScroll" style="display:none;"></div>
									</td>
									</tr>
									</table>
								</form>
			</div>					

		</td></tr>
		</table>
		
		
		<script type="text/jscript" language="jscript">
			widgets.Add(hideSearch, "Search");
			widgets.divCount += 2;
			
			makeAdvancedFindCheckboxes(divS);
			
			
			var imgPlus = new Image();
			imgPlus.src = "plus.gif";
	
			var imgMinus = new Image();
			imgMinus.src = "minus.gif";
			
			function TogglePlus(div, img, container)
			{
				if(typeof(img) == "string")	
					img = document.all(img)
				if(typeof(div) == "string")
					div = document.all(div)
					
				widget = widgets.Search;
				if(div && img)
				{
					if(div.style.display == "none")
					{
						div.style.display = "";
						img.src = imgMinus.src;
						div.open = "true";
					}
					else
					{
						div.style.display = "none";
						img.src = imgPlus.src;
						
						div.open = "false";
					}
				}
			}
		
		</script>
	</div>


</div>

<div id="divCollapsedNav" class="navTocColor" style="display:none;width:100%;height:100%;">
	<a href="javascript:ToggleNav();" title="Expand navigation frame" id="linkNavClosed"><img src="toc2.gif" alt="Expand navigation frame" border="0"></a>
</div>	


</body>
</html>

By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.

If a file you wish to view isn't highlighted, and is a text file (not binary), please let us know and we'll add colourisation support for it.

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


Written By
Product Manager DNN Corp
Australia Australia
Bruce Chapman is the Product Manager for Cloud Services at DNN. He’s been an active member of the DNN Community since 2006 as a contributor, vendor and now employee of DNN Corp.

You can read his blog at http://dnnsoftware.com/blog or follow him on Twitter @brucerchapman

Comments and Discussions