|
- <%
- '=======================================================================================================================
- ' BUSINESS HELPERS: domain vocabulary (touch methods, outcomes, statuses) and list query-string building
- '=======================================================================================================================
-
- ' Touch methods and outcomes: Array(key, label)
- Function Businesses_Methods()
- Businesses_Methods = Array(Array("call", "Call"), Array("email", "Email"), Array("visit", "Visit"), Array("mail", "Mailed"))
- End Function
-
- Function Businesses_Outcomes()
- Businesses_Outcomes = Array( _
- Array("no_answer", "No answer"), _
- Array("left_voicemail", "Left voicemail"), _
- Array("spoke_with_someone", "Spoke with someone"), _
- Array("interested", "Interested"), _
- Array("follow_up_later", "Follow up later"), _
- Array("not_interested", "Not interested"), _
- Array("wrong_number", "Wrong number"), _
- Array("remove", "Remove from list") _
- )
- End Function
-
- ' Label for a key in one of the Array(key, label) lists above (the key itself when unknown).
- Function Businesses_Label(list, key)
- Dim item
- Businesses_Label = key & ""
- For Each item In list
- If item(0) = key Then Businesses_Label = item(1)
- Next
- End Function
-
- Function Businesses_IsKey(list, key)
- Dim item
- Businesses_IsKey = False
- For Each item In list
- If item(0) = key Then Businesses_IsKey = True
- Next
- End Function
-
- Function Businesses_StatusLabel(s)
- Select Case s
- Case "new": Businesses_StatusLabel = "New"
- Case "contacted": Businesses_StatusLabel = "Contacted"
- Case "follow_up": Businesses_StatusLabel = "Follow-up"
- Case "removed": Businesses_StatusLabel = "Removed"
- Case Else: Businesses_StatusLabel = s & ""
- End Select
- End Function
-
- Function Businesses_StatusClass(s)
- Select Case s
- Case "new": Businesses_StatusClass = "text-bg-secondary"
- Case "contacted": Businesses_StatusClass = "text-bg-info"
- Case "follow_up": Businesses_StatusClass = "text-bg-warning"
- Case "removed": Businesses_StatusClass = "text-bg-dark"
- Case Else: Businesses_StatusClass = "text-bg-light"
- End Select
- End Function
-
- ' Query string for the list: current filters with optional page / sort overrides.
- Function Businesses_QS(f, page, sort, dir)
- Dim k, s
- s = ""
- For Each k In Array("q", "industry", "status", "show", "contacted", "phone")
- If f.Exists(k) Then
- If Len(f(k)) > 0 Then s = s & "&" & k & "=" & Server.URLEncode(f(k))
- End If
- Next
- If Len(sort) > 0 Then s = s & "&sort=" & Server.URLEncode(sort)
- If Len(dir) > 0 Then s = s & "&dir=" & Server.URLEncode(dir)
- If page > 1 Then s = s & "&page=" & page
- If Len(s) > 0 Then Businesses_QS = "?" & Mid(s, 2) Else Businesses_QS = ""
- End Function
- %>
|