%option explicit%>
<%
ShopCheckAdmin ""
'*******************************
' Version 6.50 Edits translate tables
'
' June 1, 2005
' Input parameters
' which= ' specific record in table
' dbtable=translatecategories
' idfield=translateid
' categoryid= specific category
'*******************************
dim Addaction,Updateaction, Deleteaction
dim rstemp
dim which
dim idfield
dim dbtable, conn
dim translatetable
dim languages, langcount, url
dim strlanguage, categoryid, catdescription
'dim helpfile
'helpfile="shopa_categoryhelp.htm"
setsess "currenturl","shopa_edittranslatecategories.asp"
Addaction=Request.form("add")
Updateaction=Request.form("update")
sError=""
Deleteaction=request("delete")
GetInputValues
If DeleteAction<>"" then
DeleteRecord
end if
EditOpenDatabase conn, database,dbtable
If Addaction = "" and Updateaction = "" Then
AdminPageHeader
FormatEditHelpHeader
SetDefaultvalues
GenerateForm
AdminPageTrailer
Else
AdminPageHeader
FormatEditHelpHeader
Validatefields
if serror="" then
UpdateRecord
end if
GenerateForm
AdminPageTrailer
end if
Shopclosedatabase conn
'************************
Sub GetInputValues
' ID, allows editing a record
which=request.querystring("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.querystring("idfield")
if idfield="" then
idfield="translateid"
end if
dbtable= request.querystring("table")
categoryid=request.querystring("categoryid")
url=request("url")
if url="" then
url=getsess("currenturl")
end if
ValidateTable
dim force
force="Yes"
Getlanguages languages, langcount, force
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=""
shoperror getlang("langEditSelectFail")
end sub
'*******************************************************************************
' Get the specific record and then generate form based on this record
'*******************************************************************************
Sub GenerateForm
dim sqltemp
if which <> "" then
sqltemp="select * from " & dbtable
sqltemp=sqltemp & " where " & idfield & "=" & which
set rstemp=conn.execute(sqltemp)
end if
DisplayForm
if which <> "" then
rstemp.close
set rstemp=nothing
end if
end Sub
'****************************
Sub DisplayForm()
if which <> "" then
catdescription=rstemp("catdescription")
strlanguage=rstemp("lang")
categoryid=rstemp("categoryid")
end if
%>
| <%shopwriteheader "Category Setup"%> |
|
| <%shopwriteerror sError%> |
<%
response.write "