Jump to Category Administration | Jump to Admin Preferences

<% If Not Sess_Array(48) = Session.SessionID then UpdateSessions False Response.Redirect "default.asp" End If If Len(Request.Form("B5")) > 0 then newOption = Trim(Request.Form("T4")) firstValue = Trim(Request.Form("T5")) isHidden = CLng(Request.Form("C5")) isRange = CLng(Request.Form("C6")) optArray = Trim(Request.Form("S1")) set rs = objConn.Execute("SELECT ID FROM " & tablPfx & "OptTypes WHERE optionName = '" & sqbl(newOption) & "';") If Not rs.EOF then duplicate = True rs.close If duplicate then Response.Write "

Options [" & newOption & "] already exists!

" Else If Len(newOption) > 0 AND (Len(firstValue) > 0 OR Len(optArray) > 0) then Select Case Len(firstValue) Case 0 optValueArray = Split(optArray, vbcrlf) For each rec in optValueArray rec = Trim(rec) If Len(rec) > 0 then If isHidden = 1 then rec = rec & sg firstValue = firstValue & sf & rec End If Next If Len(firstValue) > 0 then firstValue = Replace(firstValue, sf, "", 1, 1) Case Else If isHidden = 1 then firstValue = firstValue & sg End Select If Len(firstValue) > 0 then objConn.Execute("INSERT INTO " & tablPfx & "OptTypes(optionName, optionValues, allowCustom, customName, optBlank, isHidden, isRange, isSearchonly, isRadio, isVert, isPullLive, cm1, cm2, cm3, cm4, cm5) VALUES ('" & sqbl(newOption) & "','" & sqbl(firstValue) & "',0,'','0'," & isHidden & "," & isRange & ",0,0,0,0,0,1,0,0,0);") UpdateSessions False Response.Redirect "admin_options.asp?opt=" & Server.URLEncode(newOption) Else: Response.Write "

Option Name and/or Value(s) are empty!

" & msgBack & "
": disabled = true End If Else: Response.Write "

Option Name and/or Value(s) are empty!

" & msgBack & "
": disabled = true End If End If End If currentOption = Request.Form("D1") If Len(currentOption) = 0 then currentOption = Request("opt") currentSelOpt = Request("val") action = Request.Form("action") Select Case action Case "radio" If Len(currentOption) = 0 then UpdateSessions False Response.Redirect "admin_options.asp" End If isRadio = CLng(Request.Form("C8")) isVert = CLng(Request.Form("C9")) objConn.Execute("UPDATE " & tablPfx & "OptTypes SET isRadio = " & isRadio & ", isVert = " & isVert & " WHERE optionName = '" & currentOption & "';") UpdateSessions False Response.Redirect "admin_options.asp?opt=" & Server.URLEncode(currentOption) Case "duplicate" If Len(currentOption) = 0 then UpdateSessions False Response.Redirect "admin_options.asp" End If newName = Trim(Request.Form("T7")) If Len(newName) = 0 then Response.Write "

The Name Field is empty!

" & msgBack & "
" disabled = true Else set rstest = objConn.Execute("SELECT ID FROM " & tablPfx & "OptTypes WHERE optionName = '" & newName & "';") If rstest.EOF then rstest.close strSQL = "INSERT INTO " & tablPfx & "OptTypes (optionValues,allowCustom,customName,optBlank,isHidden,isRange,isSearchonly,isRadio,isVert,isPullLive,cm1,cm2,cm3,cm4,cm5) " strSQL = strSQL & "SELECT optionValues,allowCustom,customName,optBlank,isHidden,isRange,isSearchonly,isRadio,isVert,isPullLive,cm1,cm2,cm3,cm4,cm5 FROM " & tablPfx & "OptTypes " strSQL = strSQL & "WHERE optionName = '" & currentOption & "';" objConn.Execute(strSQL) objConn.Execute("UPDATE " & tablPfx & "OptTypes SET optionName = '" & newName & "' WHERE optionName IS NULL;") UpdateSessions False Response.Redirect "admin_options.asp?opt=" & Server.URLEncode(newName) Else rstest.close Response.Write "

Option Name [" & newName & "] is already in use!

" & msgBack & "
" disabled = true End If End If Case "searchonly" If Len(currentOption) = 0 then UpdateSessions False Response.Redirect "admin_options.asp" End If act = Request.Form("C10") Select Case act Case "1": isSearchonly = 1 Case Else: isSearchonly = 0 End Select objConn.Execute("UPDATE " & tablPfx & "OptTypes SET isSearchonly = " & isSearchonly & " WHERE optionName = '" & currentOption & "';") UpdateSessions False Response.Redirect "admin_options.asp?opt=" & Server.URLEncode(currentOption) Case "delete" If Len(currentOption) = 0 then UpdateSessions False Response.Redirect "admin_options.asp" End If objConn.Execute("DELETE FROM " & tablPfx & "OptTypes WHERE optionName = '" & currentOption & "';") For I = 1 to 20 objConn.Execute("UPDATE " & tablPfx & "Cat SET catOptType" & I & "='0' WHERE catOptType" & I & "='" & currentOption & "';") Next For I = 0 to 6 objConn.Execute("UPDATE " & tablPfx & "Config SET uOptType" & I & "='0' WHERE uOptType" & I & "='" & currentOption & "';") Next UpdateSessions False Response.Redirect "admin_options.asp" Case "sort" If Len(currentOption) = 0 then UpdateSessions False Response.Redirect "admin_options.asp" End If newValues = CStr(Request.Form("strVal")) selectedValue = Request.Form("D2") If Len(newValues) > 0 then objConn.Execute("UPDATE " & tablPfx & "OptTypes SET optionValues = '" & newValues & "' WHERE optionName = '" & currentOption & "';") UpdateSessions False Response.Redirect "admin_options.asp?opt=" & Server.URLEncode(currentOption) & "&val=" & Server.URLEncode(selectedValue) Else Response.Write "

Unknown error!

" & msgBack & "
" disabled = true End If Case "unhide" If Len(currentOption) = 0 then UpdateSessions False Response.Redirect "admin_options.asp" End If set rs = objConn.Execute("SELECT optionValues, optBlank, isHidden FROM " & tablPfx & "OptTypes WHERE optionName = '" & currentOption & "';") If Not rs.EOF then newOptValues = Replace(rs(0), sg, "") If Not rs(1) = "0" then newOptBlank = Replace(rs(1), sg, ""): Else: newOptBlank = "0": End If objConn.Execute("UPDATE " & tablPfx & "OptTypes SET optionValues = '" & newOptValues & "', isHidden = 0, optBlank = '" & newOptBlank & "' WHERE optionName = '" & currentOption & "';") End If rs.close UpdateSessions False Response.Redirect "admin_options.asp?opt=" & Server.URLEncode(currentOption) Case "hide" If Len(currentOption) = 0 then UpdateSessions False Response.Redirect "admin_options.asp" End If set rs = objConn.Execute("SELECT optionValues, optBlank, isHidden FROM " & tablPfx & "OptTypes WHERE optionName = '" & currentOption & "';") If Not rs.EOF then optValues = rs(0) optValuesArray = Split(optValues, sf) For I = 0 to Ubound(optValuesArray) optValuesArray(I) = optValuesArray(I) & sg Next newOptValues = Join(optValuesArray, sf) If Not rs(1) = "0" then newOptBlank = rs(1) & sg: Else: newOptBlank = "0": End If objConn.Execute("UPDATE " & tablPfx & "OptTypes SET optionValues = '" & newOptValues & "', isHidden = 1, optBlank = '" & newOptBlank & "' WHERE optionName = '" & currentOption & "';") For I = 0 to 6 objConn.Execute("UPDATE " & tablPfx & "Config SET uOptType" & I & "='0' WHERE uOptType" & I & "='" & currentOption & "';") Next End If rs.close UpdateSessions False Response.Redirect "admin_options.asp?opt=" & Server.URLEncode(currentOption) Case "range" If Len(currentOption) = 0 then UpdateSessions False Response.Redirect "admin_options.asp" End If set rs = objConn.Execute("SELECT allowCustom FROM " & tablPfx & "OptTypes WHERE optionName = '" & currentOption & "' AND allowCustom = 1;") If rs.EOF then rs.close objConn.Execute("UPDATE " & tablPfx & "OptTypes SET isRange = 1 WHERE optionName = '" & currentOption & "';") UpdateSessions False Response.Redirect "admin_options.asp?opt=" & Server.URLEncode(currentOption) Else Response.Write "

Range Option Set cannot have a Custom Input (please see Admin Help manual).

" & msgBack & "
" disabled = true End If Case "unrange" If Len(currentOption) = 0 then UpdateSessions False Response.Redirect "admin_options.asp" End If objConn.Execute("UPDATE " & tablPfx & "OptTypes SET isRange = 0, isSearchonly = 0 WHERE optionName = '" & currentOption & "';") UpdateSessions False Response.Redirect "admin_options.asp?opt=" & Server.URLEncode(currentOption) Case "modify" If Len(currentOption) = 0 then UpdateSessions False Response.Redirect "admin_options.asp" End If modValue = CStr(Trim(Request.Form("T6"))) modValue = sqbl(modValue) modValue = Replace(Replace(modValue, "<", "<"), ">", ">") originalValue = CStr(Trim(Request.Form("D2"))) set rs = objConn.Execute("SELECT optionValues, optBlank, isHidden FROM " & tablPfx & "OptTypes WHERE optionName = '" & currentOption & "';") If not rs.EOF then optionValues = rs(0) optBlank = rs(1) isHidden = CLng(rs(2)) rs.close optionValuesArray = Split(optionValues, sf) For each rec in optionValuesArray If lcase(rec) = lcase(modValue) then Response.Write "

You have not modified value or value [" & modValue & "] is already in the list!

" & msgBack & "
" notValid = True disabled = true End If Next If not notValid then For I = 0 to Ubound(optionValuesArray) If optionValuesArray(I) = originalValue then If isHidden = 1 then modValue = modValue & sg optionValuesArray(I) = modValue optionValues = Join(optionValuesArray, sf) End If Next If optBlank = originalValue then setBlank = ", optBlank = '" & modValue & "' " objConn.Execute("UPDATE " & tablPfx & "OptTypes SET optionValues = '" & sqbl(optionValues) & "'" & setBlank & " WHERE optionName = '" & currentOption & "';") UpdateSessions False Response.Redirect "admin_options.asp?opt=" & Server.URLEncode(currentOption) & "&val=" & Server.URLEncode(modValue) End If End If Case "remove" If Len(currentOption) = 0 then UpdateSessions False Response.Redirect "admin_options.asp" End If selectedValue = Request.Form("D2") If Len(selectedValue) = 0 then Response.Write "

Please Select a value.

" & msgBack & "
" disabled = true Else set rs = objConn.Execute("SELECT optionValues, optBlank FROM " & tablPfx & "OptTypes WHERE optionName = '" & currentOption & "';") If not rs.EOF then optValues = rs(0) optBlank = rs(1) rs.close valuesArray = Split(optValues, sf) If Ubound(valuesArray) = 0 then Response.Write "

Cannot remove the last Value.

" & msgBack & "
" disabled = true Else For each rec in valuesArray If not CStr(rec) = CStr(selectedValue) then newValues = newValues & sf & rec End If Next newValues = Replace(newValues, sf, "", 1,1) If optBlank = selectedValue then setBlank = ", optBlank = '0' " objConn.Execute("UPDATE " & tablPfx & "OptTypes SET optionValues = '" & newValues & "'" & setBlank & " WHERE optionName = '" & currentOption & "';") UpdateSessions False Response.Redirect "admin_options.asp?opt=" & Server.URLEncode(currentOption) End If End If End If Case "allow" If Len(currentOption) = 0 then UpdateSessions False Response.Redirect "admin_options.asp" End If If CLng(Request.Form("isRange")) = 1 then Response.Write "

Cannot create Custom Field for Range Option Set.

" & msgBack & "
" disabled = True Else isAllow = CLng(Request.Form("C1")) isAllowText = Trim(Request.Form("T2")) objConn.Execute("UPDATE " & tablPfx & "OptTypes SET allowCustom = " & isAllow & ", customName = '" & sqbl(isAllowText) & "' WHERE optionName = '" & currentOption & "';") UpdateSessions False Response.Redirect "admin_options.asp?opt=" & Server.URLEncode(currentOption) End If Case "add" If Len(currentOption) = 0 then UpdateSessions False Response.Redirect "admin_options.asp" End If newValue = CStr(Trim(Request.Form("T1"))) isBlank = CLng(Request.Form("C4")) newValue = sqbl(newValue) newValue = Replace(Replace(newValue, "<", "<"), ">", ">") set rs = objConn.Execute("SELECT optionValues, isHidden FROM " & tablPfx & "OptTypes WHERE optionName = '" & currentOption & "';") If not rs.EOF then optionValues = rs(0) isHidden = CLng(rs(1)) If isHidden = 1 then newValue = newValue & sg rs.close optionValuesArray = Split(optionValues, sf) For each rec in optionValuesArray If lcase(rec) = lcase(newValue) then Response.Write "

Value [" & newValue & "] is already in the list!

" & msgBack & "
" notValid = True disabled = true End If Next If not notValid then optionValues = optionValues & sf & newValue If isBlank = 1 then setBlank = ", optBlank = '" & newValue & "' " objConn.Execute("UPDATE " & tablPfx & "OptTypes SET optionValues = '" & sqbl(optionValues) & "'" & setBlank & " WHERE optionName = '" & currentOption & "';") UpdateSessions False Response.Redirect "admin_options.asp?opt=" & Server.URLEncode(currentOption) & "&val=" & Server.URLEncode(newValue) End If End If Case Else set rs = objConn.Execute("SELECT " & tablPfx & "OptTypes.* FROM " & tablPfx & "OptTypes;") If rs.EOF then Response.Write "

Options List is Empty

" disabled = True Else If Len(currentOption) > 0 then selected = True Select Case selected Case True Do While NOT rs.EOF nextOption = rs(1) If nextOption = currentOption then strOptions = strOptions & "" optValues = rs(2) isAllow = CLng(rs(3)) isAllowText = rs(4) optBlank = rs(5) isHidden = CLng(rs(6)) isRange = CLng(rs(7)) isSearchonly = CLng(rs(8)) isRadio = CLng(rs(9)) isVert = CLng(rs(10)) Else: strOptions = strOptions & "" End If rs.MoveNext Loop Case False I = 0 Do While NOT rs.EOF nextOption = rs(1) If I = 0 then strOptions = strOptions & "" optValues = rs(2) isAllow = CLng(rs(3)) isAllowText = rs(4) optBlank = rs(5) isHidden = CLng(rs(6)) isRange = CLng(rs(7)) isSearchonly = CLng(rs(8)) isRadio = CLng(rs(9)) isVert = CLng(rs(10)) Else: strOptions = strOptions & "" End If rs.MoveNext I = I + 1 Loop End Select valArray = Split(optValues, sf) If Len(currentSelOpt) = 0 then currentSelOpt = valArray(0) For I = 0 to Ubound(valArray) If valArray(I) = optBlank then vaStyle = "style=""color: red;""" vaMark = " **" Else vaStyle = Empty vaMark = Empty End If If valArray(I) = currentSelOpt then strValues = strValues & "" Else: strValues = strValues & "" End If Next For I = 0 to Ubound(valArray) If valArray(I) = currentSelOpt then strValuesP = strValuesP & "" Else: strValuesP = strValuesP & "" End If Next End If Select Case isHidden Case 1 changeHidden = "" Case Else If isRange = 1 then If CBool(isSearchonly) then onlysearch = "checked" changeRange = "" changeRange = changeRange & "  - Search Only" Else changeRange = "" If isRadio = 0 Then changeHidden = "" End If End Select rs.close End Select If not disabled then %>
>
<% Call Build_Box_Top("650", 150, "Options Builder", "xl") %> <% If isHidden = 0 then %> <% End If %>
Options List: Selected Option Values: Add/Modify Value:





  

   
*New Value: - Blank **
 
*Selected Value:
*** Custom Entry:
> - Allow Custom Override
Custom Prompt: 
 
Selected Option Preview:
   <% If isAllow then %> <%= isAllowText %>   <% End If %>
<% If isHidden = 1 then Response.Write "Hidden " If isRange = 1 then Response.Write "Range " If isRadio = 1 then Response.Write "Radio Button " %>
Additional Functions (for currently selected option set)
 
New Name:  <%= changeHidden %> <%= changeRange %>
 
value="1">- Make Radio Button  value="1">- Align Vertically ****
* Values cannot contain a single quote (')
** Creates a "bail out value". One blank value can be created per options set. However you still need to specify a value name for it. Example Set: married|divorced|single|widowed|No answer. If the last value is set to be blank and if selected by a user, the field will remain blank and will not be displayed at view ad page.
*** Specify whether option set can be overridden by user with a custom value. "Custom Prompt" directs user to enter custom value. Can be set as "Other:" or similar. Check box (automatically inserted) must be selected by a user to enter a custom value in the text field.
**** Radio Button does not work with "Custom Override" or "Hidden" options. On Search pages Radio button would be converted into regular drop-down box.
 
<% Call Build_Box_Bottom("") %>
<% End If %>
<% Call Build_Box_Top("650", 20, "Create New Option Set", "xl") %>
 
New Option Name:  
First Value:   Or -create by entering a text *** >>
* Range:
** Hidden:
 
* Creates a regular options set but if made searchable this set would appear as 2 option boxes on Advanced Search allowing to create a searchable range.
NOTE: All option values for a Range options set must be a number.
** Make Option set hidden from ad view pages (will appear during ad post and Advanced Search if selected).
*** Create Multiple values atonce. One option value per line.
 
<% Call Build_Box_Bottom("") %>