%Option Explicit%>
<%
'**********************************************************************************
' Version 6.50 Content management
' shopcontent.asp?type=news
' shopcontent.asp?type=news&template=xxx
' Allows you to add content using the content table
' VP-ASP 6.50 June 28, 2004
'*********************************************************************************
Dim CatalogId, dbtable, idfield, contentdbc, dbc, crs, contentid
Dim messagetype
Dim template
'VP-ASP 6.08a - moved down below generate meta tags
'shoppageheader
setSess "CurrentURL","default.asp"
'contentid = request("contentid")
if contentid > "" then
if NOT isnumeric(contentid) then
HandleError "Content ID must be a numeric value"
end if
end if
shopopendatabase contentdbc
generatecontentsql sql
OpenRecordSet contentdbc, crs, sql
InitializeSystem
shoppagetop
'debugwrite sql
If crs.eof then
handleerror "No content record assigned to homepage"
else
messagetype = crs("messagetype")
WriteImpressions
'VP-ASP 6.08a - Generate Dynamic Meta tags
setupdynamiccontent contentdbc, contentid, messagetype
if crs("loggedin") <> true then
Formatcontent crs
else
if Getsess ("login") > "" then
Formatcontent crs
else
shopwriteerror getlang("langcustadminloginrequired")
end if
end if
end if
closerecordset crs
shopclosedatabase contentdbc
shoppagefoot
'****************************************************
' write a message
'***************************************************
sub handleError (msg)
shopwriteError msg
end sub
'
'***************************************************************
' Use temaplte or just displaye it
'**************************************************************
Sub Formatcontent (crs)
dim message, message2, image
'message=crs("message")
if contentid = "" then
dim getcontentsql, getcontentrs
getcontentsql = "select contentid from content WHERE messagetype = '" & messagetype & "'"
OpenRecordSet contentdbc, getcontentrs, getcontentsql
if getcontentrs.eof then
shoperrror "There has been an error retrieving the ID for this content."
else
contentid = getcontentrs("contentid")
end if
closerecordset getcontentrs
end if
message=translatelanguage(contentdbc, "content", "message","contentid", contentid, crs("message"))
'message2=crs("message2")
message2=translatelanguage(contentdbc, "content", "message2","contentid", contentid, crs("message2"))
contentid=crs("contentid")
image=crs("contentimage")
If isnull(image) then image=""
Gettemplate crs, template
if template<>"" then
ShopMergetemplate "content", template, contentid, "contentid"
If serror<>"" then
handleError serror
end if
exit sub
end if
If image<>"" then
Formatimage image
end if
response.write message & "
"
response.write message2
end sub
Sub GetTemplate (crs, template)
dim dbtemplate, suffix
template=gettextfield("template")
dbtemplate=crs("template")
If template="" then
if not isnull(dbtemplate) then
template=dbtemplate
end if
end if
if template="" then exit sub
suffix=right(template,3)
if lcase(suffix)<>"htm" then
template=""
end if
end sub
Sub formatimage (image)
Response.write "
"
response.write ""
response.write "