Tridion ASP Custom Page

tmcsshowqueuehistory.asp
' TMCS Email Queue Custom Page
' Chris Mills November 2008

Const adExecuteStream = &H00000400
Const adCmdStoredProc = &H0004

cachefile = Server.MapPath(".") & "\tmcsshowqueuehistory.xml"
xsltfile = Server.MapPath(".") & "\tmcsshowqueuehistory.xslt"

Connectionstring = "Provider=sqloledb;Data Source=****;Initial Catalog=tridion_cm_email;User Id=*****l;Password=*****;"

set fs = Server.CreateObject("Scripting.FileSystemObject")
set xmldoc = Server.CreateObject("Microsoft.XMLDOM")
set xslt = Server.CreateObject("Microsoft.XMLDOM")
set cn = Server.CreateObject("ADODB.CONNECTION")
set cmd = Server.CreateObject("ADODB.COMMAND")
cn.ConnectionTimeout = 120 ' database is slow sometimes
cn.open Connectionstring

set cmd.ActiveConnection = cn
cmd.CommandText = "TMCS_SHOW_EMAIL_QUEUE_HISTORY"
cmd.CommandType = adCmdStoredProc
cmd.Properties("xml root").Value = "root"
cmd.Properties("Output Stream") = xmldoc

' cache file access rights problem
If fs.FileExists(cachefile) = true Then
	set f = fs.GetFile(cachefile)
	lastmod = DateDiff("s", f.DateLastModified, Now)
	If lastmod > 600 Then
		cmd.Execute , , adExecuteStream + adCmdText
		xmldoc.Save(cachefile)
	Else
		' Many users may be looking at the queue
		xmldoc.Load(cachefile)
	End If
Else
		cmd.Execute , , adExecuteStream + adCmdText
		xmldoc.Save(cachefile)
End If

cn.close
set fs = Nothing
set f = Nothing
set cn = Nothing
set cmd = Nothing

xslt.load(xsltfile)
Response.Write xmldoc.transformnode(xslt)

set xmldoc = Nothing
set xslt = Nothing

My Tridion Newsletters

SDL Tridion Nominate your MVP Candidate

Sign up and get a newsletter when new Tridion stuff is added to the site

Nominate

SDL Tridion Nominate your MVP Candidate

If you find the content of this page useful, please nominate me for the SDL Tridion MVP award.


Created: Thursday 27th May 2010 11:28 PM
Last Modified: Wednesday 30th June 2010 8:23 PM LinkedIn link: View Chris Mills' profile on LinkedIn
Valid XHTML 1.0! Valid CSS! Level A conformance icon, W3C-WAI Web Content Accessibility Guidelines 1.0