%@LANGUAGE="VBSCRIPT" CODEPAGE="1252"%>
<%
'response.Buffer = true
Dim rsAuthor__MMColParam
rsAuthor__MMColParam = "38" ' jules verne default
If (Request.QueryString("authorID") <> "") Then
rsAuthor__MMColParam = Request.QueryString("authorID")
End If
%>
<%
Dim rsAuthor
Dim rsAuthor_numRows
Set rsAuthor = Server.CreateObject("ADODB.Recordset")
rsAuthor.ActiveConnection = MM_cnBooks_STRING
rsAuthor.Source = "SELECT authorName FROM dbo.cwcAmazonAuthors WHERE authorID = " + Replace(rsAuthor__MMColParam, "'", "''") + ""
rsAuthor.CursorType = 0
rsAuthor.CursorLocation = 2
rsAuthor.LockType = 1
rsAuthor.Open()
if not rsAuthor.eof then
authorname = replace(replace(rsAuthor.Fields.Item("authorName").Value,",","")," ","%20")
else
authorname = "Jules%20Verne"
end if
rsAuthor_numRows = 0
%>
<%
' *** Edit Operations: declare variables
Dim MM_editAction
Dim MM_abortEdit
Dim MM_editQuery
Dim MM_editCmd
Dim MM_editConnection
Dim MM_editTable
Dim MM_editRedirectUrl
Dim MM_editColumn
Dim MM_recordId
Dim MM_fieldsStr
Dim MM_columnsStr
Dim MM_fields
Dim MM_columns
Dim MM_typeArray
Dim MM_formVal
Dim MM_delim
Dim MM_altVal
Dim MM_emptyVal
Dim MM_i
MM_editAction = CStr(Request.ServerVariables("SCRIPT_NAME"))
If (Request.QueryString <> "") Then
MM_editAction = MM_editAction & "?" & Request.QueryString
End If
' boolean to abort record edit
MM_abortEdit = false
' query string to execute
MM_editQuery = ""
%>
<%
' *** Insert Record: set variables
If (CStr(Request("MM_insert")) = "form2") Then
MM_editConnection = MM_cnBooks_STRING
MM_editTable = "dbo.cwcAmazonBooks"
MM_editRedirectUrl = "titlegetauthor.asp?uploadaddress=" & request.Form("uploadaddress")
MM_fieldsStr = "bookTitle|value|amazonString|value|uploadAddress|value|booklistcount|value"
MM_columnsStr = "bookTitle|',none,''|amazonString|',none,''|uploadAddress|',none,''|booklistcount|none,none,NULL"
' create the MM_fields and MM_columns arrays
MM_fields = Split(MM_fieldsStr, "|")
MM_columns = Split(MM_columnsStr, "|")
' set the form values
For MM_i = LBound(MM_fields) To UBound(MM_fields) Step 2
MM_fields(MM_i+1) = CStr(Request.Form(MM_fields(MM_i)))
Next
' append the query string to the redirect URL
If (MM_editRedirectUrl <> "" And Request.QueryString <> "") Then
If (InStr(1, MM_editRedirectUrl, "?", vbTextCompare) = 0 And Request.QueryString <> "") Then
MM_editRedirectUrl = MM_editRedirectUrl & "?" & Request.QueryString
Else
MM_editRedirectUrl = MM_editRedirectUrl & "&" & Request.QueryString
End If
End If
End If
%>
<%
' *** Insert Record: construct a sql insert statement and execute it
Dim MM_tableValues
Dim MM_dbValues
If (CStr(Request("MM_insert")) <> "") Then
' create the sql insert statement
MM_tableValues = ""
MM_dbValues = ""
For MM_i = LBound(MM_fields) To UBound(MM_fields) Step 2
MM_formVal = MM_fields(MM_i+1)
MM_typeArray = Split(MM_columns(MM_i+1),",")
MM_delim = MM_typeArray(0)
If (MM_delim = "none") Then MM_delim = ""
MM_altVal = MM_typeArray(1)
If (MM_altVal = "none") Then MM_altVal = ""
MM_emptyVal = MM_typeArray(2)
If (MM_emptyVal = "none") Then MM_emptyVal = ""
If (MM_formVal = "") Then
MM_formVal = MM_emptyVal
Else
if MM_fields(MM_i) = "uploadAddress" then
if request.form("textID") <> "" then
' try building a string
bid = trim(request.form("textID"))
MM_formVal = "'http://www.gutenberg.org/dirs/"
for i = 1 to len(bid)-1
MM_formVal = MM_formVal & mid(bid,i,1) & "/"
next
MM_formVal = MM_formVal & bid & "/" & bid & ".zip'"
uploadAddress = MM_formVal
else
uploadAddress = "'" & MM_formVal & "'"
MM_formVal = "'" & MM_formVal & "'"
end if
else
If (MM_altVal <> "") Then
MM_formVal = MM_altVal
ElseIf (MM_delim = "'") Then ' escape quotes
MM_formVal = "'" & Replace(MM_formVal,"'","''") & "'"
Else
MM_formVal = MM_delim + MM_formVal + MM_delim
End If
end if
End If
If (MM_i <> LBound(MM_fields)) Then
MM_tableValues = MM_tableValues & ","
MM_dbValues = MM_dbValues & ","
End If
MM_tableValues = MM_tableValues & MM_columns(MM_i)
MM_dbValues = MM_dbValues & MM_formVal
Next
MM_editQuery = "insert into " & MM_editTable & " (" & MM_tableValues & ") values (" & MM_dbValues & ")"
If (Not MM_abortEdit) Then
' execute the insert
Set MM_editCmd = Server.CreateObject("ADODB.Command")
MM_editCmd.ActiveConnection = MM_editConnection
MM_editCmd.CommandText = MM_editQuery
response.Write(MM_editQuery)
'response.Flush()
MM_editCmd.Execute
' this page is being called from the author details page - were adding a book for a known author
Dim rsTitle
Dim rsTitle_numRows
Set rsTitle = Server.CreateObject("ADODB.Recordset")
rsTitle.ActiveConnection = MM_cnBooks_STRING
rsTitle.Source = "SELECT * FROM dbo.cwcAmazonBooks WHERE uploadAddress = " & uploadAddress
rsTitle.CursorType = 0
rsTitle.CursorLocation = 2
rsTitle.LockType = 1
rsTitle.Open()
MM_editQuery = "insert into cwcAmazonBAlinks (authorID, bookID) values (" & request.form("authorID") & "," & rsTitle.Fields.Item("bookID").Value & ")"
MM_editCmd.CommandText = MM_editQuery
MM_editCmd.Execute
MM_editRedirectUrl = "book.asp?bookID=" & rsTitle.Fields.Item("bookID").Value
' update the recent additions table
mm_editquery = "insert into dbo.cwcRecentAdditions (bookID) VALUES (" & rsTitle.Fields.Item("bookID").Value & ")"
MM_editCmd.CommandText = MM_editQuery
MM_editCmd.Execute
rsTitle.Close()
Set rsTitle = Nothing
MM_editCmd.ActiveConnection.Close
' update our rss feed
' ============================================
' this bit writes resources to /mm/abacciRSS.xml
' picked up from
' home: http://ASPRSS.com/
' discuss: http://www.asplists.com/asplists/asprss.asp
' ============================================
' open your data source here and query it for information about
' the resources to be shared in your RSS XML data.
'
' for example: (you need to replace the following code)
Dim oConn
Dim sDBPath
Dim oRS
Dim sSQL
Dim sSiteTitle
Dim sSiteDescr
Dim sSiteURL
Dim sSiteDetails
Dim sImageURL
Dim sFurtherReading
Dim sAuthorNames
Dim sAuthorEmails
Dim sTitle
Dim sDescr
Dim sURL
Dim sDate
Dim sCategory
Dim sKeywords
Dim sXMLFile
Dim rsRecent
Dim rsRecent_numRows
Set rsRecent = Server.CreateObject("ADODB.Recordset")
rsRecent.ActiveConnection = MM_cnBooks_STRING
rsRecent.Source = "SELECT * FROM dbo.vCWCrssView"
rsRecent.CursorType = 0
rsRecent.CursorLocation = 2
rsRecent.LockType = 1
rsRecent.Open()
rsRecent_numRows = 0
' now start to create the XML
sSiteTitle = "New e-texts at Abacci"
sSiteDescr = "A combination of the free e-texts from Project Gutenberg and the user reviews on Amazon along with links to Microsoft Reader copies and annotated texts"
sSiteURL = "http://www.abacci.com/books/"
sSiteDetails = "www.abacci.com"
sImageURL = "http://www.abacci.com/books/i/abaccirss.gif"
sFurtherReading = ""
sAuthorNames = "Peter Shanks"
sAuthorEmails = "cybrarian@abacci.com"
If Not RSSheader ( sSiteTitle, sSiteDescr, sSiteURL, sSiteDetails, sImageURL, sFurtherReading, sAuthorNames, sAuthorEmails ) Then
Response.End
End If
' loop through recordset
Do While Not rsRecent.EOF
strFilename = trim(rsRecent.Fields.Item("bookTitle").Value)
If InStr(strFilename, ";") > 0 Then
strFilename = Trim(Left(strFilename, InStr(strFilename, ";") - 1))
ElseIf InStr(strFilename, ":") > 0 Then
strFilename = Trim(Left(strFilename, InStr(strFilename, ":") - 1))
ElseIf InStr(strFilename, "--") > 0 Then
strFilename = Trim(Left(strFilename, InStr(strFilename, "--") - 1))
ElseIf InStr(strFilename, ", Part") > 0 Then
strFilename = Trim(Left(strFilename, InStr(strFilename, ", Part") - 1))
End If
if InStr(strFilename, ", The") then
strFilename = "The " & Replace(strFilename, ", The", "")
elseif InStr(strFilename, ", An") then
strFilename = "An " & Replace(strFilename, ", An", "")
elseif InStr(strFilename, ", A") then
strFilename = "A " & Replace(strFilename, ", A", "")
elseif InStr(strFilename, ", Jr.") then
strFilename = "Jr. " & Replace(strFilename, ", Jr.", "")
end if
commapos = instr(rsRecent.Fields.Item("authorName").Value,",")
if commapos > 0 then
authorname = mid(rsRecent.Fields.Item("authorName").Value, commapos + 1) & " " & left(rsRecent.Fields.Item("authorName").Value, commapos - 1)
else
authorname = rsRecent.Fields.Item("authorName").Value
end if
authorname = trim(authorname)
' these elements are mandatory
sTitle = strFilename & " by " & authorname
sDescr = "", "
"),"&","and") & "]]>"
sURL = sSiteURL & "book.asp?bookID=" & rsRecent.Fields.Item("bookID").Value
' all following elements are optional
sDate = "" & rsRecent.Fields.Item("addDate").Value
sCategory = "e-Books"
sKeywords = "" & rsRecent.Fields.Item("authorName").Value & ", " & strFilename
' separate multiple authors with |
' overrides authors passed to RSSheader
sAuthorNames = "" & authorname
sAuthorEmails = "cybrarian@abacci.com"
If Not RSSitem ( sTitle, sDescr, sURL, sDate, sCategory, sKeywords, sAuthorNames, sAuthorEmails ) Then
Response.End
End If
' move to next record
rsRecent.moveNext
Loop
' finish off the XML
If Not RSSfooter Then
Response.End
End If
' in this case we will write the XML to the file RSS.XML
' but you could instead output the global variable
' sRSSXML to the client
sXMLFile = "/mm/abacciRSS.xml"
If Not RSSpersist ( sXMLFile ) Then
Response.End
End If
If (MM_editRedirectUrl <> "") Then
Response.Redirect(MM_editRedirectUrl)
End If
End If
End If
%>
<%
if session("supervisor") <> "true" then
response.Redirect("page/login.asp")
end if
' check for an abacci cookie
if session("uid") = "" then
If Request.Cookies("abaccibooks") <> "" Then
' get this user's previous session uid
session("uid") = Request.Cookies("abaccibooks")("uid")
else
' new user, create a new cookie for them
session("uid") = cstr(cdbl(cstr(year(now)) & cstr(month(now)) & cstr(day(now)) & cstr(timer())) * 100)
response.Cookies("abaccibooks").expires = Now() + 90
response.Cookies("abaccibooks")("uid") = session("uid")
End if
end if
Dim cmdListCount__list_ID
cmdListCount__list_ID = "0"
if(session("uid") <> "") then cmdListCount__list_ID = session("uid")
%>
<%
set cmdListCount = Server.CreateObject("ADODB.Command")
cmdListCount.ActiveConnection = MM_cnBooks_STRING
cmdListCount.CommandText = "dbo.getListCount"
cmdListCount.Parameters.Append cmdListCount.CreateParameter("@RETURN_VALUE", 3, 4)
cmdListCount.Parameters.Append cmdListCount.CreateParameter("@list_ID", 200, 1,16,cmdListCount__list_ID)
cmdListCount.CommandType = 4
cmdListCount.CommandTimeout = 0
cmdListCount.Prepared = true
set rsListCount = cmdListCount.Execute
rsListCount_numRows = 0
%>
|
Abacci > Books > Titles > Add | ||||
Add a TitleNote: add new authors before adding titles for them
|
|||||
Home | Authors | Titles | Categories | Your List | FAQ | <% if session("username") <> "" then%> Log Out | Your Account <% else %> Login <% end if %> | Contact Us | Site Map
Site Design: Megalong Multimedia