%option explicit%>
<%
ShopCheckAdmin "shopa_editdisplay.asp"
'*******************************
' Version 6.50 Content table editor
' Display fields in one record of one table
' setting field to keyword "NULL" sets field to empty
' April 9, 2004
' Sept 28, fix Ole error on SQL server
' Dec 4, 2004 Fix content image
'*******************************
dim Addaction,Updateaction, Deleteaction
dim rstemp
dim which
dim idfield
dim dbtable, conn
dim helpfile
Dim featuretypes(20), yesnos(3), yesnocount, featuretypecount
dim strfeaturenum, strfeatureprice, strfeatureid, strfeaturedefault
dim strmessage, strmessage2, strmessagetype, strimage, strhide, strloggedin
dim strother1, strother2, strother3, strlanguage
'=========================
'VP-ASP 600 - insertion of page impressions
'12/10/2005
'=========================
dim strimpressions
'=========================
'=========================
'VP-ASP 600 - insertion of date product was added
'12/10/2005
'=========================
dim datCdateupdated, datCdateadded
'=========================
'VP-ASP 6.50 - whether this page is the homepage or not
dim strhomepage
Dim Novalue, yesvalue
'Language Modification
dim strcatlanguage
Addaction=Request.form("add")
Updateaction=Request.form("update")
Deleteaction=request("delete")
SetupDefaults
GetInputValues
If DeleteAction<>"" then
DeleteRecord
end if
sError=""
EditOpenDatabase conn, database,dbtable
If Addaction = "" and Updateaction = "" Then
AdminPageHeader
GenerateForm
AdminPageTrailer
Else
AdminPageHeader
UpdateRecord
GenerateForm
AdminPageTrailer
end if
Shopclosedatabase conn
'************************
Sub GetInputValues
' ID, allows editing a record
which=request("which")
'VP-ASP 6.09 - Precautionary Security Fix
if which > "" then
If not isnumeric(which) then
shoperror "Content Id must be numeric"
end if
end if
idfield=request("idfield")
dbtable= request("table")
If idfield="" then
dbtable="content"
idfield="contentid"
end if
ValidateTable
If dbtable="" then
shoperror getlang("LangEditSelectFail")
end if
End Sub
'
Sub ValidateTable
'********************************************
'See if user has access to this table
Dim UserTables, i
dim tablecount
if getconfig("XRestrictAdminTables")<>"Yes" then exit sub
UserTables=GetSess("UserTables")
If Isnull(UserTables) then
exit sub
end if
if UserTables="" then
exit Sub
else
UserTables=split(GetSess("UserTables"),",",-1,1)
end if
tablecount=ubound(UserTables)
for i = 0 to tablecount
if ucase(dbtable)=ucase(Usertables(i)) then
exit sub
end if
next
dbtable=""
end sub
Sub GenerateForm
dim sqltemp
if which <> "" then
sqltemp="select * from " & dbtable
sqltemp=sqltemp & " where " & idfield & "=" & which
'Debugwrite sqltemp
set rstemp=conn.execute(sqltemp)
end if
DisplayForm
if which <> "" then
rstemp.close
set rstemp=nothing
end if
end Sub
'****************************
Sub DisplayForm()
strhide=yesnos(1)
strloggedin=yesnos(1)
strhomepage=yesnos(1)
if which <> "" then
GetFieldvalue "contentid","contentid",strfeatureid
getfieldvalue getlang("LangCommontype"),"messagetype",strmessagetype
getfieldvalue getlang("LangGiftMessage"),"message",strmessage
getfieldvalue getlang("LangGiftMessage") & " 2","message2",strmessage2
getfieldvalue "Hide","hide",strhide
getfieldvalue getlang("LangProductImage"),"contentimage",strimage
getfieldvalue getlang("LangProductTemplate"),"template",strtemplate
getfieldvalue getlang("Langlanguage"),"contentlanguage",strlanguage
getfieldvalue getlang("LangOtherfields") & " 1","other1",strother1
getfieldvalue getlang("LangOtherfields") & " 2","other2",strother2
getfieldvalue getlang("LangOtherfields") & " 3","other3",strother3
'=========================
'VP-ASP 600 - insertion of page impressions
'12/10/2005
'=========================
getfieldvalue "Impressions","impressions",strimpressions
if (strimpressions = "") or (isnull(strimpressions)) then
strimpressions = 0
end if
'=========================
'=========================
'VP-ASP 600 - insertion of date product was added
'12/10/2005
'=========================
getfieldvalue "Date Added","cdateadded",datcdateadded
getfieldvalue "Date Updated","cdateupdated",datcdateupdated
'=========================
getfieldvalue "Logged In","loggedin",strloggedin
If strhide="" then
strhide=yesnos(1)
end if
If strloggedin="" then
strloggedin=yesnos(1)
end if
CorrectBooleanProgram strhide ' turn into yes no
CorrectBooleanProgram strloggedin ' turn into yes no
'VP-ASP 6.50 - is this page the homepage?
getfieldvalue "Homepage","homepage",strhomepage
If strhomepage="" then
strhomepage=yesnos(1)
end if
CorrectBooleanProgram strhomepage ' turn into yes no
end if
%>
| <%shopwriteheader "Content Setup"%> |
|
| <%shopwriteerror sError%> |
<%
response.write "