utils/ShowFile.asp
<%
// have we advertized our mailing list yet?
var bDoneLink = false;
// ============================================
// display the contents of the given file
// ============================================
function ShowFile ( oFSO, sFile, bPassHTML, bShowName )
{
var ForReading = 1;
// var ForWriting = 2;
// var ForAppending = 8;
// open asp file for reading
var fFile = oFSO.OpenTextFile ( Server.MapPath( sFile ), ForReading );
// read entire file contents into variable
var s = fFile.ReadAll ( );
if ( !bPassHTML )
{
// replace & with & so HTML displayed, not interpreted
s = s.replace ( /&/g, '&' );
// replace < with < so HTML displayed, not interpreted
s = s.replace ( /</g, '<' );
// replace newline with HTML equivalent
s = s.replace ( /\n/g, '<br>' );
// replace tabs with 3 spaces
s = s.replace ( /\t/g, ' ' );
// show filename and change font color for source code
s = '<font color="black">' + s + '</font>';
if ( bShowName )
s = '<h4>' + sFile + '</h4>' + s;
}
Out ( s );
fFile.Close ( );
}
// ============================================
// show a source file outside the table
// ============================================
function ShowSource ( oFSO, sFile, bShowName )
{
// advertize our mailing list before the first source file
if ( !bDoneLink )
{
bDoneLink = true;
Out ( '<p><b>Get informed when the source code below changes!</b> <a href="subscribe.asp">Subscribe to our mailing list.</a>' );
}
Out ( '</td>' );
Out ( '<td width="20%"> </td></tr><tr><td colspan=3 width="100%" bgcolor="#ff9900">' );
// show news file
ShowFile ( oFSO, sFile, false, bShowName );
Out ( '</td></tr><tr><td width="20%"> </td>' );
Out ( '<td width="60%">' );
}
%>