Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Editing header file

Status
Not open for further replies.

jfgonzalez

Technical User
Apr 16, 2002
36
US
Hi,

Is it possible to edit the header section of the .available.csp file?

What I'd like to do is to insert a date field that will reflect "last updated". Currently our database is reloaded with new data and the cubes are reprocessed every night. When this job is finished, it sends an e-mail to the administrators that the load succeeded. A co-worker has an agent set up to process an html file (currently called date.htm) with a new data whenever it sees the words "Success" in the subject field of the e-mail and the idea is to display the text of this html file somewhere in the header of the .csp file, probably right below the User Name.

I've tried inserting this as a Server Side include but have gotten nowhere so far, and I've looked everywhere at the documentation both online and off. Has anybody tried anything like this before?
 
It can be done, but the version of CE will make a significant difference. This code for a "message of the day" may help as-is though. I'm not providing the location of the code or the calling of the function because this will be version dependent. I am using this successfully in CE9 and working on the migration to v10.

Code:
// Custom code to display a "message of the day" (MOTD)
var motdFilePath = "D:\\Data\\Crystal Decisions\\MOTD.TXT";
// (The FSO apparently cannot access remote drives, like T:.)
var fileSystem = new ActiveXObject( "Scripting.FileSystemObject" );
if ( fileSystem.FileExists( motdFilePath) )
{
	var motdExists = true;
	var motdLabel = "Administrator's message, ";
	var motdCaption = "Administrator`s message, ";	// Cannot use a ' in the Caption
	var motdFile = fileSystem.GetFile( motdFilePath);
	// Get date string(s) from 'Day Mon DD HH:MI:SS TmZ YYYY'
	// (A date is displayed so the user can see if the message has been read previously.)
	var motdDate;	// from Day Mon DD, YYYY (HH:MI TmZ)
	motdDate = String( motdFile.DateLastModified).substr(0,10) + ", ";
	motdDate += String( motdFile.DateLastModified).substr(24,4) + " (";
	motdDate += String( motdFile.DateLastModified).substr(11,5);
	motdDate += String( motdFile.DateLastModified).substr(19,4) + ")";
	motdCaption += "<BR>" + motdDate;
}
else
	var motdExists = false;

function showMOTD()
{
	var motdText = motdFile.OpenAsTextStream();
	while ( ! motdText.AtEndOfStream )
		Response.Write( motdText.ReadLine() + "<BR>" );
	motdText.Close();
}
%>
<!-- Simple alternate method: (included in the v9 customization)
Message of the Day<PRE> -->
<!-- # include file="../../../../../../../motd.txt" --><!-- D:\ -->
<!--  ^-(not included)
</PRE>
-->
 
I am using CE 9. Previously I had something like this --

//SERVER-SIDE STRING VARIABLES FOR LOCALIZING
//*********************************************************************
var L_WELCOME_1 = "Account: ";
var L_LAST_UPDATED = “Last Updated: “;
var L_DATE = "10/18/2004 ";

then at line 1056 I amended the code to include the server side string variables:

// DISPLAY CUSTOM WELCOME MESSAGE ON PAGE HEADER
Response.Write("<span class='headerWelcome'>" + L_WELCOME_1 + "<br>" + username + "<br>" + L_LAST_UPDATED + "<br>" + L_DATE + "</span>" + vbCRLF);
%>

I fiddled with this rather quickly just so I would have an idea where I could insert my date on the header (and because it was my first time fiddling with any of the out-of-the-box CE files and I didn't want to break anything too badly) and found that if I just insert straight text, it works fine. However, when I tried writing specific Server Side code or an include statement, I kept getting errors. I will experiment with your code and see where that takes me. Thanks.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top