<%'Include Data Connection%> <%'Include ADO constants include file for VBScript%> <% 'open data connection Call OpenConn() %> <%'Include Utility Scripts%> <% 'strDelimiter is declared and set in common_utils.asp 'strMode is declared and set in the header_inc.asp file Dim intDynamicFormId Dim rsDynamicForm Dim strUserLanguage Dim strDynamicFormName Dim strQueryCriteria Dim strFilterCriteriaArray Dim strSortCriteriaArray Dim bolDisplayFormEntries Dim strSelectedCheckBoxes Dim bolFormEntriesAreEditable Dim strManageFormEntries Dim intFormEntryIncrement Dim intPageCounter Dim intPageNumber Dim intPageTotal 'initialize page number to 1 intPageNumber = 1 'initialize form entry increment intFormEntryIncrement = 20 'get admin user language 'strUserLanguage = Session("UserLanguage") 'test: temporarily default to 'en' strUserLanguage = "en" 'get the dynamic form id intDynamicFormId = Request.QueryString("id") 'initialize the display form entries variable to false bolDisplayFormEntries = False 'if the id is numeric and not an empty string... If IsNumeric(intDynamicFormId) And intDynamicFormId <> "" Then Set rsDynamicForm = GetDynamicForm(intDynamicFormId) If rsDynamicForm.EOF = False Then 'populate the variable with the database fields strDynamicFormName = rsDynamicForm("DYNAMIC_FORM_NAME_EN") bolFormEntriesAreEditable = rsDynamicForm("DYNAMIC_FORM_ALLOWS_ADMIN_USERS_TO_EDIT_ENTRY") rsDynamicForm.Close Set rsDynamicForm = Nothing Else rsDynamicForm.Close Set rsDynamicForm = Nothing 'redirect the user Response.Redirect "/admin/dynamic_forms.asp" End If Else 'redirect the user Response.Redirect "/admin/dynamic_forms.asp" End If 'if a form was submitted then... If Request.Form <> "" Then 'set the display form entries variable to true bolDisplayFormEntries = True strFilterCriteriaArray = Request.Form("txtFilterCriteriaArray") strSortCriteriaArray = Request.Form("txtSortCriteriaArray") strSelectedCheckBoxes = Request.Form("txtSelectedCheckBoxes") strMode = Request.Form("txtMode") 'if criteria was submitted then... If strFilterCriteriaArray <> "" Then 'get the criteria query strQueryCriteria = GetQueryCriteria(strFilterCriteriaArray, strDelimiter) 'if criteria was not submitted then... Else 'set the criteria query variable to an empty string strQueryCriteria = "" 'end: if criteria was submitted then... End If 'get the paging logic numbers intFormEntryIncrement = CInt(Request.Form("selFormEntryIncrement")) intPageNumber = Request.Form("selPageNumber") 'if the page number was submitted then... If IsNumeric(intPageNumber) And (intPageNumber <> "") Then 'convert the submitted page number as an integer intPageNumber = CInt(intPageNumber) End If 'end: if a form was submitted then... End If 'if the application mode is delete then... If strMode = "delete" Then 'delete the selected form entries Call DeleteFormEntries(Request.Form("txtSelectedCheckboxes")) 'get the criteria info into relevant session variables Session("FilterCriteriaArray") = strFilterCriteriaArray Session("SortCriteriaArray") = strSortCriteriaArray Session("SelectedCheckBoxes") = strSelectedCheckBoxes 'give user feedback Session("FeedbackError") = err.number Session("FeedbackModule") = "dynamic_form_admin_entry" Session("FeedbackMode") = strMode Session("Referer") = "/admin/dynamic_form_entries.asp?id=" & intDynamicFormId Response.Write("") Response.Write("") 'if the mode is not delete then... Else 'if the string criteria was not submitted (page is being called or user is being redirected from edit or delete) then... If strSortCriteriaArray = "" Then 'if the sort criteria session var doesn't contain the array then... If Session("SortCriteriaArray") = "" Then 'get the string sorting criteria strSortCriteriaArray = GetSortCriteriaArray(intDynamicFormid, strDelimiter, strUserLanguage) 'if the sort criteria session var contains the array then... Else 'get the string sorting criteria from the session var strSortCriteriaArray = Session("SortCriteriaArray") 'end: if the sort criteria session var doesn't contain the array then... End If 'get the filter criteria from the session var strFilterCriteriaArray = Session("FilterCriteriaArray") 'get the selected checkboxes from the session var strSelectedCheckBoxes = Session("SelectedCheckBoxes") 'get the display status according to whether the sort criteria array is empty or not bolDisplayFormEntries = (strSortCriteriaArray <> "") End If 'if form entries are to be displayed then... If bolDisplayFormEntries Then Dim strMainFilterCriteria, strMainDateCriteria, intFormEntryCount 'get the form entries strManageFormEntries = ManageFormEntries(intFormEntryCount, strMainFilterCriteria, strMainDateCriteria, intPageTotal, intFormEntryIncrement, intPageNumber, intDynamicFormId, strDelimiter, strFilterCriteriaArray, strSortCriteriaArray, strUserLanguage, bolFormEntriesAreEditable, strSelectedCheckBoxes) 'end: if form entries are to be displayed then... End If %>
<% 'if search criteria was submitted then... If strFilterCriteriaArray <> "" Then %> <% 'if search criteria was submitted then... End If %> <% 'test 'strFilterCriteriaArray = (field id, data type id, operator id, value, field name) 'strSortCriteriaArray = (field name, data type id, is main sorting field (0/1), direction (asc/desc), field id) 'if the form entries are to be displayed then... If bolDisplayFormEntries Then %> <% 'end if: if the form entries are to be displayed then... End If 'if the form entries are to be displayed then... If bolDisplayFormEntries Then %> <% 'end if: if the form entries are to be displayed then... End If %>
Dynamic Form:
<%=strDynamicFormName%>
Search Options:
"" Then%> checked="checked"<%End If%>> Add New Search Criteria (to existing search)
New Search
Search Results match the following criteria: <%=strQueryCriteria%>
Display Form Entries where...
   
Form Entries displayed per page:

[ Display All <%If bolDisplayFormEntries Then%>| Delete Selected Form Entries | View Reports<%End If%> ]
[ <%If intPageNumber > 1 Then%><< Previous Page | <%End If%>Page of <%=intPageTotal%> <%If intPageNumber < intPageTotal Then%>| Next Page >><%End If%> ] <%If intFormEntryCount > 0 Then%> <% Dim strEntries If intFormEntryCount = 1 Then 'if the user language is not english then... If LCase(strUserLanguage) <> "en" Then strEntries = "soumission." Else strEntries = "entry." End If Else 'if the user language is not english then... If LCase(strUserLanguage) <> "en" Then strEntries = "soumissions." Else strEntries = "entries." End If End If %> <% If strFilterCriteriaArray <> "" Then 'if the user language is not english then... If LCase(strUserLanguage) <> "en" Then %>    La recherche a retournée <%=intFormEntryCount & " " & strEntries%> <% Else %>    Search criteria returned <%=intFormEntryCount & " " & strEntries%> <% End If %> <% Else 'if the user language is not english then... If LCase(strUserLanguage) <> "en" Then %>    Il y a un total de <%=intFormEntryCount & " " & strEntries%> <% Else %>    There is a total of <%=intFormEntryCount & " " & strEntries%> <% End If End If %> <% End If %>
<% 'output the form entries Response.Write strManageFormEntries %>
[ Display All <%If bolDisplayFormEntries Then%>| Delete Selected Form Entries | View Reports<%End If%> ]
<% 'set session vars to empty strings Session("FilterCriteriaArray") = "" Session("SortCriteriaArray") = "" Session("SelectedCheckBoxes") = "" 'end: if the application mode is delete then... End If 'close the data connection Call CloseConn() %>