<% if isempty(request("idCategory")) then response.redirect "viewAllCategories.asp?error="& escape("ERROR: Please select a category") response.end end if %> <% on error resume next dim rs, rsRand, rsPhoto, idCategory, status_msg, title, hierarchy(4, 2) title = "Edit Category" hierarchy(0, 0) = "Home" hierarchy(0, 1) = "home.asp" hierarchy(1, 0) = "Inventory Management" hierarchy(1, 1) = "inventoryOverview.asp" hierarchy(2, 0) = "Categories" hierarchy(2, 1) = "viewAllCategories.asp" idCategory = cLng(request("idCategory")) if not isempty(request.form("btnUpdateCategory")) then set adoProc = server.createObject("ADODB.Command") proc = run_proc(adoProc, "sp_updateCategory", adExecuteNoRecords, empty) if proc <> true then status_msg = status_msg &"

ERROR: Could not update category.
"& proc &"

" else status_msg = status_msg &"

Successfully Modified Category.


" end if set adoProc = nothing end if set rs = ado.execute("exec sp_getCategory "& idCategory) if err.number <> 0 then status_msg = status_msg &"

ERROR: Could not retrieve category information.
"& err.description &"


" err.clear hierarchy(3, 0) = "Category Not Found" else hierarchy(3, 0) = "Edit: "& rs("name") end if set rsPhoto = ado.execute("exec sp_getCategoryPhotos "& idCategory) if err.number <> 0 then status_msg = status_msg &"

ERROR: Could not retrieve category photos.
"& err.description &"


" err.clear end if set rsRand = ado.execute("exec sp_getCategoryThumbnails "& idCategory) if err.number <> 0 then status_msg = status_msg &"

ERROR: Could not retrieve category thumbnails.
"& err.description &"


" end if hierarchy(3, 1) = "editCategory.asp?idCategory="& idCategory %>

edit category: <%= lcase(rs("name"))%>

<% if status_msg <> "" then %> <% end if %>
<%= left(status_msg, len(status_msg) - 6)%>
category name " />
" /> class="chk" onclick="this.form.is_active.value = (this.checked) ? 0 : 1;" />      />

random thumbnail photos
<% while not rsRand.eof for count = 1 to 2 if rsRand.eof then exit for height = 90 if rsRand("thumb_width") <> "" then width = rsRand("thumb_width") else width = 90 end if if rsRand("thumb_height") > 90 then width = height * rsRand("thumb_width") / rsRand("thumb_height") end if response.write "" response.write "" rsRand.moveNext next wend %>
photo title
<% count = 1 do while rsPhoto.state <> adStateClosed do while not (rsPhoto = nothing or rsPhoto.eof) height = 90 if rsPhoto("thumb_width") <> "" then width = rsPhoto("thumb_width") else width = 90 end if if rsPhoto("thumb_height") > 90 then width = height * rsPhoto("thumb_width") / rsPhoto("thumb_height") end if response.write "" response.write "" response.write ""& vbcrlf count = count + 1 rsPhoto.moveNext loop set rsPhoto = rsPhoto.getNextRecordSet loop %>