<%option explicit%>
<!-- #include file="shop$db.asp" -->
<!-- #include file="shop$language2.asp" -->
<%
'**********************************************************
' Version 4.00 October 11, 2001 VP-ASP
' prompts for type of export
'**********************************************************
ShopCheckAdmin "shopa_editdisplay.asp"
dim sAction
dim currentURL
dim returnURL
Dim Fieldnames(10)
Dim Fieldvalues(10)
Dim optionCount
Dim OptionNames(5)
Dim Optionfieldname
Dim fieldname
Dim Fieldvalue
Dim Fieldcount
Dim cSelect
dim captions(10)
cSelect=LangCommonSelect
sAction=request("Action")
if sAction="" then
  sAction=request("Action.x")
end if  
currentURL=CurrentFile
returnURL=GetSess("CurrentURL")
if saction="" then
    AdminPageHeader
    GetFieldnames 
    GetFieldValues
    DisplayForm
    AdminPageTrailer
else
    ProcessForm
    response.redirect returnURL & "?SpecialFunction=" & langSpecialExport 
end if
Sub DisplayForm
dim i
        response.write "<form name=editform action=" & currentURL & " method=POST>"
	Response.Write(getconfig("xfont") & LangEdit02 & "<br>")
	Response.Write("Table Name = " & Getsess("Table") & "</font><br>")
	Response.Write(getconfig("xfont") & sError & "</font><br>")
	Response.Write(tabledef)
        for i=0 to fieldcount
               fieldname = fieldnames(i)
               fieldvalue = fieldvalues(i)
               FormatRow fieldname,fieldvalue, captions(i)
         next
'         Response.Write(tablerow & tablecolumn & trim(optionfieldname) & tablecolumnend & "<td>")
'         GenerateSelectNV optionNames,GetSess(optionfieldname),optionfieldname, optioncount, cSelect
'         Response.write "</td></tr>"
         Response.Write(TabledefEnd & "<p>")
         If Getconfig("xbuttoncontinue")="" then
             Response.Write("<input type=submit name=action value=""" & LangCommonContinue & """>")
         else
            Response.Write("<input type=image name=action src=""" & getconfig("xbuttoncontinue") & """>")
         end if    
         Response.Write("</form>")
 	 response.write "<hr></p>"
end sub
Sub FormatRow (fieldname,fieldvalue, caption)
Response.Write(tablerow & tablecolumn & caption & tablecolumnEnd & "<td><input size=50 name=" & fieldname & " value=" & Chr(34) & fieldvalue & Chr(34) & "></td></tr>")
end sub
Sub ProcessForm
dim strname
dim strvalue
Dim Key
For Each key in Request.Form
  strname = key
  strvalue = Request.Form(key)
  SetSess strname, strvalue
'  debugwrite key & "=" &  strvalue
Next
end sub
'

Sub GetFieldnames
Fieldnames(0)="ExportFilename"
Fieldnames(1)="Exportlocation"
Fieldnames(2)="Exportdelimiter"
fieldcount=2
OptionNames(0)="No"
OptionNames(1)="Yes"
OptionFieldName="ExportIdField"
OptionCount=2
captions(0)=LangMenuFileName
captions(1)=LangDirectory
captions(2)=LangDelimiter
end sub
'
Sub GetFieldvalues
Dim strvalue
Dim i
if GetSess("ExportIdField")="" then
     SetDefaultValues
else
   for i = 0 to fieldcount
      fieldvalues(i)=Getsess(fieldnames(i))
   next
end if
end sub
Sub SetDefaultValues
SetSess "ExportFileName",GetSess("table") & ".txt"
Fieldvalues(0)=GetSess("ExportfileName")
Setsess "exportlocation",""
Fieldvalues(1)=getsess("exportlocation")
SetSess "Exportdelimiter",","
FieldValues(2)=GetSess("ExportDelimiter")
end sub
'
Function CurrentFile 
CurrentFile="shopa_exportsetup.asp"
end function
%>'
