<%@ Language="VBScript" %> <% ' ***************************************************************************** ' ' info/custommerchant.cart.info6.asp ' ' GoLive design-time support for CustomMerchant shopping carts. ' ' ' ADOBE SYSTEMS INCORPORATED ' Copyright 2001-2002 Adobe Systems Incorporated. All Rights Reserved. ' ' NOTICE: Notwithstanding the terms of the Adobe GoLive End User ' License Agreement, Adobe permits you to reproduce and distribute this ' file only as an integrated part of a web site created with Adobe ' GoLive software and only for the purpose of enabling your client to ' display their web site. All other terms of the Adobe license ' agreement remain in effect. ' ----------------------------------------------------------------------------- ' Return an XML document containing information about the CustomMerchant ' shopping carts datasources available. Valid requests are: ' ' custommerchant.cart.info6.asp?datasources= ' return a list of e-commerce cart providers ' ex) .../custommerchant.cart.info6.asp?datasources=all ' ex) .../custommerchant.cart.info6.asp?datasources=distinct ' ' custommerchant.cart.info6.asp?provider= ' return the schema of a shopping cart from a specific provider ' ex) .../custommerchant.cart.info6.asp?provider=Adobe ' ' custommerchant.cart.info6.asp?provider=&test= ' return the first record results of the select ' ex) .../custommerchant.cart.info6.asp?db=Magazine&sql=select%20*%20from%20Projects&test=whatever ' ' custommerchant.cart.info6.asp?getecp= ' return raw content of ecp file ' ex) .../custommerchant.cart.info6.asp?getecp=Magazine ' ' custommerchant.cart.info6.asp?putecp=&data= ' writes raw content of ecp file ' ex) .../custommerchant.cart.info6.asp?putecp=Magazine&data=blah%20blah%20blah ' ' custommerchant.cart.info6.asp?delete= ' deletes file ' ex) .../custommerchant.cart.info6.asp?delete=Magazine.ecp ' RejectUnauthorizedCallers Response.ContentType = "text/xml" if not RuntimeDebug then on error resume next end if if Not IsEmpty(Request("getecp")) then GetECP Request("getecp") elseif Not IsEmpty(Request("putecp")) then PutECP Request("putecp"), Request("data") elseif Not IsEmpty(Request("test")) then ' must come before WriteCartSchema WriteTestCart Request("provider") elseif Not IsEmpty(Request("provider")) then WriteCartSchema Request("provider") else WriteProviders(Request("datasources") = "all") end if ' this can appear together with any of the others if Not IsEmpty(Request("delete")) then Delete Request("delete") end if if Err then WriteError end if ' ----------------------------------------------------------------------------- ' Write out the list of available providers. XML format: ' ' ' [...]* function WriteProviders(all) dim fileSystem dim folder dim file dim baseName dim prevName set fileSystem = CreateObject("Scripting.FileSystemObject") set folder = fileSystem.GetFolder(GetDataSourcePath()) Response.Write "" & vbCrLf for each file in folder.files if ucase(fileSystem.GetExtensionName(file)) = "ECP" then baseName = fileSystem.GetBaseName(file) if all then Response.Write " " & baseName & ".ecp" & vbCrLf elseif baseName <> prevName then Response.Write " " & baseName & "" & vbCrLf prevName = baseName end if end if next Response.Write "" & vbCrLf end function ' ----------------------------------------------------------------------------- ' Write out the the schema of a cart. XML format: ' ' ' [ ' ... ' [...]? ' ]* function WriteCartSchema(provider) set providerInfo = GetProviderInfo(provider) query = "action=get-cart-schema&merchant-id=" & providerInfo.merchantId set dom = GetHTTPResults(providerInfo.url, query) Response.Write dom.documentElement.firstChild.xml end function ' ----------------------------------------------------------------------------- ' Write out a test cart. XML format: ' ' ' [ ' [columnvalue]* ' ]* function WriteTestCart(provider) set xform = GetTransform() set providerInfo = GetProviderInfo(provider) query = "action=get-cart&merchant-id=" & providerInfo.merchantId & "&shopper-id=test" set dom = GetHTTPResults(providerInfo.url, query) Response.Write dom.transformNode(xform) end function ' ----------------------------------------------------------------------------- ' Return raw contents of ECP file sub GetECP(baseName) set fileSystem = CreateObject("Scripting.FileSystemObject") set file = fileSystem.OpenTextFile(GetDataSourcePath() & baseName & ".ecp", 1, false, 0) Response.Write canonicalizeCRLF(file.ReadAll) file.Close end sub ' ----------------------------------------------------------------------------- ' Write raw contents of ECP file sub PutECP(baseName, data) set fileSystem = CreateObject("Scripting.FileSystemObject") set file = fileSystem.OpenTextFile(GetDataSourcePath() & baseName & ".ecp", 2, true, 0) file.Write canonicalizeCRLF(data) file.Close end sub ' ----------------------------------------------------------------------------- ' Delete file from datasources folder sub Delete(fileName) set fileSystem = CreateObject("Scripting.FileSystemObject") fileSystem.DeleteFile GetDataSourcePath() & fileName, true end sub ' ----------------------------------------------------------------------------- ' Write out an error message as XML. function WriteError dim qt qt = chr(34) Response.Write "" & vbCrLf end function %>