%option explicit%>
<%
Const FeaturetypeList="Dropdown,Checkbox,Radio,SelectList,Usertext,Userprice,Quantity,Multiplier,QtyProduct,Textarea"
ShopCheckAdmin "shopa_editdisplay.asp"
'*******************************
' VP-ASP 6.00 June 29, 2005
' Display fields in one record of one table
' setting field to keyword "NULL" sets field to empty
' Feb 7, 2004
' Sept 11, add Qtyproduct
' Dec 5, 2005 Fix featuremulti in non English environment
' May 30, 2005 add translink link
'*******************************
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
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 "ID must be numeric"
end if
end if
idfield=request("idfield")
dbtable= request("table")
If idfield="" then
dbtable="prodfeatures"
idfield="id"
end if
database=request("database")
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
'Debugwrite "table being chnaged from " & dbtable
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()
strfeaturemulti=yesnos(1)
strfeaturerequired=yesnos(1)
strfeaturedefault=yesnos(1)
if which <> "" then
GetFieldvalue "featureid","id",strfeatureid
GetFieldvalue "feature Number","featurenum",strfeaturenum
GetFieldvalue "feature caption","featurecaption",strfeaturecaption
GetFieldvalue "feature name","featurename",strfeaturename
GetFieldvalue "feature price","featureprice",strfeatureprice
GetFieldvalue "feature Type","featuretype",strfeaturetype
GetFieldvalue "feature multi","featuremulti",strfeaturemulti
' not really a boolean field
If strfeaturemulti="" then
strfeaturemulti=yesnos(1)
end if
GetFieldvalue "feature required","featurerequired",strfeaturerequired
' in shopproductsubs
CorrectBooleanProgram strfeaturerequired ' turn into yes no
GetFieldvalue "feature image","featureimage",strfeatureimage
GetFieldvalue "feature weight","featureweight",strfeatureweight
GetFieldvalue getlang("LangOtherfields") & " ","featureother",strfeatureother
GetFieldvalue getlang("LangOtherfields") & " 1","featureother1",strfeatureother1
GetFieldvalue getlang("LangOtherfields"),"featuredefault",strfeaturedefault
GetFieldvalue "feature percent","featurepercent",strfeaturepercent
if isnull(strfeaturedefault) then
strfeaturedefault=0
end if
CorrectBooleanProgram strfeaturedefault ' turn into yes no
end if
%>
| <%shopwriteheader "Product Features Setup"%> |
|
| <%shopwriteerror sError%> |
<%
response.write "