<%@ Language=VBScript %> <% '************************************************************************* ' DO NOT MODIFY THIS SCRIPT IF YOU WANT UPDATES TO WORK! ' Function : Product Review Maintenance ' Product : CandyPress Store Administration ' Version : 2.5 ' Modified : February 2004 ' Copyright: Copyright (C) 2004 CandyPress.Com ' See "license.txt" for this product for details regarding ' licensing, usage, disclaimers, distribution and general ' copyright requirements. If you don't have a copy of this ' file, you may request one at webmaster@candypress.com '************************************************************************* Option explicit Response.Buffer = true const adminLevel = 1 %> <% 'Database dim mySQL, cn, rs, rs2 'Reviews dim idReview dim idProduct dim revDate dim revDateInt dim revAuditInfo dim revStatus dim revRating dim revName dim revLocation dim revEmail dim revSubj dim revDetail 'Products dim description 'Work Fields dim I dim item dim count dim pageSize dim totalPages dim showArr dim sortField dim curPage dim showStatus dim showRating dim showPhrase dim showProd '************************************************************************* 'Open Database Connection call openDB() 'Store Configuration if loadConfig() = false then response.redirect "sysMsg.asp?errMsg=" & server.URLEncode("Could not load Store Configuration settings.") end if 'Set Row Colors dim rowColor, col1, col2 col1 = "#DDDDDD" col2 = "#EEEEEE" 'Set Number of Items per Page pageSize = 20 'Get Page to show curPage = Request.Form("curPage") 'Form if len(curPage) = 0 then curPage = Request.QueryString("curPage") 'QueryString end if 'Get showStatus showStatus = Request.Form("showStatus") 'Form if len(showStatus) = 0 then showStatus = Request.QueryString("showStatus") 'QueryString end if 'Get showRating showRating = Request.Form("showRating") 'Form if len(showRating) = 0 then showRating = Request.QueryString("showRating") 'QueryString end if 'Get showPhrase showPhrase = Request.Form("showPhrase") 'Form if len(showPhrase) = 0 then showPhrase = Request.QueryString("showPhrase") 'QueryString end if 'Get showProd showProd = Request.Form("showProd") 'Form if len(showProd) = 0 then showProd = Request.QueryString("showProd") 'QueryString end if 'Check if a Cookie Reset was requested if Request.QueryString("resetCookie") = "1" then Response.Cookies("ReviewSearch").expires = Date() - 30 else 'Check if a Cookie Recall was requested if Request.QueryString("recallCookie") = "1" then for each item in Request.Cookies if item = "ReviewSearch" then showArr = Split(Request.Cookies(item),"*|*") curPage = showArr(0) showStatus = showArr(1) showRating = showArr(2) showPhrase = showArr(3) showProd = showArr(4) end if next else 'Save Search Criteria in a Cookie Response.Cookies("ReviewSearch") = navCookie(curPage) Response.Cookies("ReviewSearch").expires = Date() + 30 end if end if 'After attempting to retrieve the search criteria through the various 'mechanisms above (Form/QueryString/Cookie), check that some of the 'critical values are valid. If not, set to default values. if len(curPage) = 0 or not isNumeric(curPage) then curPage = 1 else curPage = CLng(curPage) end if 'Check what we will be sorting the results on sortField = Request.Form("sortField") 'Form if len(sortField) = 0 then sortField = Request.QueryString("sortField") 'QueryString end if if len(sortField) = 0 then sortField = "revDate DESC" end if %>

Review Maintenance

<% if len(trim(Request.QueryString("msg"))) > 0 then %> <%=Request.QueryString("msg")%>

<% end if %>
Status =   Rating =  
Show Reviews containing the phrase  
Show all reviews for  

<% 'Specify fields and table mySQL="SELECT a.idReview,a.revDate,a.revAuditInfo,a.revStatus," _ & " a.revRating,a.revName,a.revLocation,a.revSubj," _ & " b.description " _ & "FROM reviews a, products b " _ & "WHERE a.idProduct = b.idProduct " 'revStatus if len(showStatus) > 0 then mySQL = mySQL & "AND revStatus = '" & showStatus & "' " end if 'revRating if len(showRating) > 0 then mySQL = mySQL & "AND revRating = " & showRating & " " end if 'Search Phrase if len(showPhrase) > 0 then mySQL = mySQL _ & "AND (revSubj LIKE '%" & replace(showPhrase,"'","''") & "%' " _ & "OR revDetail LIKE '%" & replace(showPhrase,"'","''") & "%' " _ & "OR revName LIKE '%" & replace(showPhrase,"'","''") & "%' " _ & "OR revLocation LIKE '%" & replace(showPhrase,"'","''") & "%' " _ & "OR revAuditInfo LIKE '%" & replace(showPhrase,"'","''") & "%') " end if 'idProduct if len(showProd) > 0 then mySQL = mySQL & "AND a.idProduct = " & showProd & " " end if 'Sort Order mySQL = mySQL & "ORDER BY " & sortField set rs = openRSopen(mySQL,0,adOpenStatic,adLockReadOnly,adCmdText,pageSize) if rs.eof then %> <% else rs.MoveFirst rs.PageSize = pageSize totalPages = rs.PageCount rs.AbsolutePage = curPage %> <% rowColor = col1 %> <% rowColor = col2 do while not rs.eof and count < rs.pageSize %> <% count = count + 1 rs.movenext 'Switch Row Color if rowColor = col2 then rowColor = col1 else rowColor = col2 end if loop %> <% end if call closeRS(rs) %>

No Reviews matched search criteria.

<% call pageNavigation("selectPageTop") %> Sort :
Review Summary Status Rating  
<%=formatTheDate(rs("revDate"))%> - <%=server.HTMLEncode(rs("revSubj") & "")%>
<%=server.HTMLEncode(rs("revName") & "") & " - " & server.HTMLEncode(rs("revLocation") & "")%>
<%=rs("description")%>
IP : " target="_blank"><%=rs("revAuditInfo")%>
<% select case trim(UCase(rs("revStatus"))) case "A" Response.Write "ACT" case "I" Response.Write "PEN" case "R" Response.Write "REJ" case else Response.Write "" & rs("revStatus") & "" end select %> <%=ratingImage(rs("revRating"))%> [ ">edit ] ">
<% call pageNavigation("selectPageBot") %> Delete Selected Reviews?

Help and Instructions :
Overview - Product reviews are allowed/disallowed per product using the Product Maintenance function. You can also specify if new reviews will be "activated" immediately after being entered by the customer, or if they need to be approved first.

Status - The Status field will tell you if a review is active, pending, or rejected.

ACT - Active review. This review will be displayed in the list of reviews for the product.
PEN - Pending (Inactive) review. This review is awaiting authorization before being viewable.
REJ - Rejected review. The review has been deliberately removed from the list of viewable reviews.

Note : To prevent "spamming", the software checks the IP address of the customer against existing reviews for a particular product. It is therefore suggested that you do not delete unwanted reviews, but mark them as "rejected" instead. This will ensure that the customer will be unable to add another review for that product, as long as they use the same IP address.

Find Review(s) - You can limit the list of Reviews on this page by selecting one of several review options, or combination of options by using the "Find" functions.

Edit Review - Click on "edit" to change a review.

Delete Review - Check the box next to any reviews you want to delete, and click the button at the bottom of the list of reviews.

<% call closedb() %> <% '********************************************************************* 'Make QueryString for Paging '********************************************************************* function navQueryStr(pageNum) navQueryStr = "?curPage=" & server.URLEncode(pageNum) _ & "&showStatus=" & server.URLEncode(showStatus) _ & "&showRating=" & server.URLEncode(showRating) _ & "&showPhrase=" & server.URLEncode(showPhrase) _ & "&showProd=" & server.URLEncode(showProd) end function '********************************************************************* 'Make Cookie Value for Paging '********************************************************************* function navCookie(pageNum) navCookie = pageNum & "*|*" _ & showStatus & "*|*" _ & showRating & "*|*" _ & showPhrase & "*|*" _ & showProd end function '********************************************************************* 'Display page navigation '********************************************************************* sub pageNavigation(formFieldName) Response.Write "Page " Response.Write " of " & TotalPages & "  " Response.Write "[ " if curPage > 1 then Response.Write "Back" else Response.Write "Back" end if Response.Write " | " if curPage < TotalPages then Response.Write "Next" else Response.Write "Next" end if Response.Write " ]" end sub %>