ShowSource.asp
<%@ Language=javascript %>
<!--#include file = "include/SetGlobals.asp"-->
<%
// get the page to display from the URL
var sPage = "" + Request.QueryString ( "page" );
// make sure it's a page we allow them to view!
switch ( sPage )
{
case "Wider":
case "COM":
case "Handle404":
case "Categories":
case "CategoryPage":
case "Columns":
case "ResultsPage":
case "Date":
case "Contact":
case "Subscribe":
case "MailToList":
break;
default:
Response.Redirect ( "NaughtyNaughty!" );
}
// output relevant meta tags
Init( "ASP source example" );
// output common top of page
Header( '<a href="work.asp">Work</a> --> <a href="' + sPage + '.asp">"' + sPage + '.asp"</a> --> Source', 3 );
// output page content
Content ( );
// output common bottom of page
Footer ( );
%>
<% /* standard page elements */ %>
<!--#include file = "utils/Init.asp"-->
<!--#include file = "utils/Header.asp"-->
<!--#include file = "utils/Footer.asp"-->
<!--#include file = "utils/ShowFile.asp"-->
<%
// ============================================
// the content of this page
// ============================================
function Content ( )
{
Out ( '<td width="20%"> </td>' );
Out ( '<td width="60%">' );
// create handle to FileSystemObject
var oFSO = Server.CreateObject ( 'Scripting.FileSystemObject' );
// each source file that we show source for could have a related
// documentation file for us to display before and after the
// source. for now, I use a generic header and footer file. the
// 'true' tells ShowFile to pass through any HTML to the browser.
ShowFile ( oFSO, 'Generic.pre', true, false );
switch ( sPage )
{
case "Categories":
case "CategoryPage":
case "Columns":
Out ( '<p><img src="images/new.gif"> <a href="Categories.zip">Download</a> all the source for the category demonstration!<p>' );
break;
}
ShowSource ( oFSO, sPage + '.asp', true );
// show any extra utility file(s) too
switch ( sPage )
{
case "Wider":
ShowSource ( oFSO, 'include/SetGlobals.asp', true );
ShowSource ( oFSO, 'utils/Header.asp', true );
break;
case "Categories":
case "CategoryPage":
case "Columns":
case "Subscribe":
case "MailToList":
ShowSource ( oFSO, 'utils/Database.asp', true );
break;
case "Categories":
case "CategoryPage":
case "Columns":
ShowSource ( oFSO, 'utils/ShowCategory.asp', true );
break;
}
// show the generic footer
ShowFile ( oFSO, 'Generic.pst', true, false );
// we've finished with the object so free the resource
oFSO = null;
Out ( '<p><center><a href="FSO.asp"><img src="images/source.gif" border=0></a></center>' );
Out ( '</td>' );
Out ( '<td width="20%"> </td>' );
}
%>
