Code:
<html>
<head>
<!---auto refresh code--->
<script type=text/javascript>
// The time out value is set to be 600,000 milli-seconds (or 600 seconds; 10 minutes)
setTimeout(' document.location=document.location' ,600000);
</script>
<!---end auto refresh code--->
</head>
<body>
<cfset temp= Expandpath("./")>
<cffunction name="WDDXFileWrite" output="no" returnType="void">
<cfargument name="file" required="yes">
<cfargument name="var" required="yes">
<cfset var tempPacket = "">
<!--- serialize --->
<cfwddx action="cfml2wddx" input="#var#" output="tempPacket">
<!--- write the file --->
<cffile action="write" file="#file#" output="#tempPacket#">
</cffunction>
<cffunction name="WDDXFileRead" output="no">
<cfargument name="file" required="yes">
<cfset var tempPacket = "">
<cfset var tempVar = "">
<!--- make sure the file exists, otherwise, throw an error --->
<cfif NOT fileExists(file)>
<cfthrow message="WDDXFileRead() error: File Does Not Exist" detail="The file #file# called in WDDXFileRead() does not exist">
</cfif>
<!--- read the file --->
<cffile action="read" file="#file#" variable="tempPacket">
<!--- make sure it is a valid WDDX Packet --->
<cfif NOT isWDDX(tempPacket)>
<cfthrow message="WDDXFileRead() error: Bad Packet" detail="The file #file# called in WDDXFileRead() does not contain a valid WDDX packet">
</cfif>
<!--- deserialize --->
<cfwddx action="wddx2cfml" input="#tempPacket#" output="tempVar">
<cfreturn tempVar>
</cffunction>
<cffunction name="addRow" output="yes" returnType="query">
<cfargument name="theQuery" required="yes">
<cfargument name="Name" required="yes">
<cfargument name="reportTime" required="yes">
<cfargument name="reportType" required="yes">
<cfargument name="Message" required="yes">
<cfset newRow = QueryAddRow(theQuery, 1)>
<cfset temp = QuerySetCell(theQuery, "Name", "#name#")>
<cfset temp = QuerySetCell(theQuery, "reportTime", "#reportTime#")>
<cfset temp = QuerySetCell(theQuery, "reportType", "#reportType#")>
<cfset temp = QuerySetCell(theQuery, "Message", "#message#")>
<cfreturn thequery>
</cffunction>
<cfset filename="#temp#report.wddx">
<cfif isdefined("form.name")>
<cfif fileexists(filename)>
<cfset report = WDDXFileRead(#filename#)>
<cfset myQuery = QueryNew("Name, reportTime, reportType, Message", "VarChar, Time, VarChar, VarChar")>
<cfoutput query="report">
<cfif reportTime gt DateAdd("d",-3,now())>
<cfset temp = addRow(myQuery,Name,reportTime,reportType,Message)>
</cfif>
</cfoutput>
<cfset temp = addRow(myQuery,form.name,now(),form.reportType,form.message)>
<cfset temp=WDDXFileWrite(filename,myQuery)>
<cfelse>
<cfset myQuery = QueryNew("Name, reportTime, reportType, Message", "VarChar, Time, VarChar, VarChar")>
<cfset temp = addRow(myQuery,form.name,now(),form.reportType,form.message)>
<cfset temp=WDDXFileWrite(filename,myQuery)>
</cfif>
</cfif>
<cfif fileexists(filename)>
<cfset report = WDDXFileRead(#filename#)>
<cfquery name="report" dbtype="query">
select name,reportTime as reporttime, reportType, message from report order by reporttime desc
</cfquery>
<table cellpadding=0 cellspacing=0><tr width=100%>
<cfoutput query="report">
<td><b>#Name#</b>,#dateformat(reportTime,"long")# #timeformat(reportTime,"HH:mm:ss")#</td></tr><tr><td><b>Type:</b> #reportType#</td></tr><tr><td> #Message# <br><br><br> </td></tr>
</cfoutput>
</tr></table>
</cfif>
<cfform method="post" name="shiftreport" action="report.cfm" format="html">
Name: <cfinput name="name" maxlength="40" style="BACKGROUND: none; FONT-FAMILY: verdana; face: arial" required = "yes" message="Name is Required">
<select name="reportType">
<option value="">-Select Type-</option>
<option value="Outage">Outage</option>
<option value="Critical">Critical</option>
<option value="Major">Major</option>
<option value="Info">Info</option>
<option value="MOPs">MOPs</option>
</select>
<br>
Shift Report:<br>
<cftextarea cols="50" rows="10" name="message" wrap style="BACKGROUND: none; FONT-FAMILY: verdana; face: arial" required = "yes" message="Message is Required"></cftextarea>
<br>
<input class=button type="submit" value="submit" style=" FONT-FAMILY: verdana; face: arial"><br>
</cfform>
</body>
</html>
that setup was made to auto post the type of report selected, and log the time, after 48 hours it hides the message all coded by myself, so edit at will.
Bookmarks