<% Response.Buffer = EW_RESPONSE_BUFFER %> <% Session.Timeout = 20 %> <% Call ew_Header(False, EW_CHARSET) %> <% ' Define page object Dim Listings_list Set Listings_list = New cListings_list Set Page = Listings_list ' Page init processing Listings_list.Page_Init() ' Page main processing Listings_list.Page_Main() ' Global Page Rendering event (in userfn*.asp) Page_Rendering() ' Page Rendering event Listings_list.Page_Render() %> <% If Listings.Export = "" Then %> <% End If %> <% Listings_list.ShowPageHeader() %> <% Listings_list.ShowMessage %> <% If Listings_list.ExportOptions.Visible Then %>
<% Listings_list.ExportOptions.Render "body", "", "", "", "", "" %>
<% End If %> <% If (Listings.Export = "") Or (EW_EXPORT_MASTER_RECORD And Listings.Export = "print") Then %> <% End If %> <% ' Load recordset Set Listings_list.Recordset = Listings_list.LoadRecordset() Listings_list.TotalRecs = Listings_list.Recordset.RecordCount Listings_list.StartRec = 1 If Listings_list.DisplayRecs <= 0 Then ' Display all records Listings_list.DisplayRecs = Listings_list.TotalRecs End If If Not (Listings.ExportAll And Listings.Export <> "") Then Listings_list.SetUpStartRec() ' Set up start record position End If Listings_list.RenderOtherOptions() %>

 

<% Listings_list.AddEditOptions.Render "body", "", "", "", "", "" Listings_list.DetailOptions.Render "body", "", "", "", "", "" Listings_list.ActionOptions.Render "body", "", "", "", "", "" %>

 

<% If Listings.Export = "" Then %>
<% If Listings.CurrentAction <> "gridadd" And Listings.CurrentAction <> "gridedit" Then %>
<% If Listings_list.TotalRecs > 0 Then %> <% End If %>
<% If Not IsObject(Listings_list.Pager) Then Set Listings_list.Pager = ew_NewNumericPager(Listings_list.StartRec, Listings_list.DisplayRecs, Listings_list.TotalRecs, Listings_list.RecRange) %> <% If Listings_list.Pager.RecordCount > 0 Then %>
<% If Listings_list.Pager.ButtonCount > 0 Then %>    <% End If %> <%= Language.Phrase("Record") %> <%= Listings_list.Pager.FromIndex %> <%= Language.Phrase("To") %> <%= Listings_list.Pager.ToIndex %> <%= Language.Phrase("Of") %> <%= Listings_list.Pager.RecordCount %>
<% Else %> <% If Listings_list.SearchWhere = "0=101" Then %>

<%= Language.Phrase("EnterSearchCriteria") %>

<% Else %>

<%= Language.Phrase("NoRecord") %>

<% End If %> <% End If %>
    
<% End If %>
<% End If %>
<% If Listings_list.TotalRecs > 0 Then %> <% If (Listings.ExportAll And Listings.Export <> "") Then Listings_list.StopRec = Listings_list.TotalRecs Else ' Set the last record to display If Listings_list.TotalRecs > Listings_list.StartRec + Listings_list.DisplayRecs - 1 Then Listings_list.StopRec = Listings_list.StartRec + Listings_list.DisplayRecs - 1 Else Listings_list.StopRec = Listings_list.TotalRecs End If End If ' Move to first record Listings_list.RecCnt = Listings_list.StartRec - 1 If Not Listings_list.Recordset.Eof Then Listings_list.Recordset.MoveFirst If Listings_list.StartRec > 1 Then Listings_list.Recordset.Move Listings_list.StartRec - 1 ElseIf Not Listings.AllowAddDeleteRow And Listings_list.StopRec = 0 Then Listings_list.StopRec = Listings.GridAddRowCount End If Listings_list.RowCnt = 0 ' Output date rows Do While CLng(Listings_list.RecCnt) < CLng(Listings_list.StopRec) Listings_list.RecCnt = Listings_list.RecCnt + 1 If CLng(Listings_list.RecCnt) >= CLng(Listings_list.StartRec) Then Listings_list.RowCnt = Listings_list.RowCnt + 1 Listings_list.ColCnt = Listings_list.ColCnt + 1 If Listings_list.ColCnt > Listings_list.RecPerRow Then Listings_list.ColCnt = 1 ' Set up key count Listings_list.KeyCount = Listings_list.RowIndex Call Listings.ResetAttrs() Listings.CssClass = "" If Listings.CurrentAction = "gridadd" Then Else Call Listings_list.LoadRowValues(Listings_list.Recordset) ' Load row values End If Listings.RowType = EW_ROWTYPE_VIEW ' Render view ' Set up row id / data-rowindex Listings.RowAttrs.AddAttributes Array(Array("data-rowindex", Listings_list.RowCnt), Array("id", "r" & Listings_list.RowCnt & "_Listings"), Array("data-rowtype", Listings.RowType)) ' Render row Call Listings_list.RenderRow() ' Render list options Call Listings_list.RenderListOptions() %> <% If Listings_list.ColCnt = 1 Then %> <% End If %> <% If Listings_list.ColCnt = Listings_list.RecPerRow Then %> <% End If %> <% End If If Listings.CurrentAction <> "gridadd" Then Listings_list.Recordset.MoveNext() End If Loop %> <% If Listings_list.ColCnt < Listings_list.RecPerRow Then %> <% For i = 1 to Listings_list.RecPerRow - Listings_list.ColCnt %> <% Next %> <% End If %>
> <% If Listings.ID.Visible Then ' ID %> > > <%= Listings.ID.ListViewValue %> <% End If %> <% If Listings.ListNum.Visible Then ' ListNum %> > > <%= Listings.ListNum.ListViewValue %> <% End If %> <% If Listings.Price.Visible Then ' Price %> > > <%= Listings.Price.ListViewValue %> <% End If %> <% If Listings.Category.Visible Then ' Category %> > > <%= Listings.Category.ListViewValue %> <% End If %> <% If Listings.Address.Visible Then ' Address %> > > <%= Listings.Address.ListViewValue %> <% End If %> <% If Listings.City.Visible Then ' City %> > > <%= Listings.City.ListViewValue %> <% End If %> <% If Listings.Style.Visible Then ' Style %> > > <%= Listings.Style.ListViewValue %> <% End If %> <% If Listings.Bedrooms.Visible Then ' Bedrooms %> > > <%= Listings.Bedrooms.ListViewValue %> <% End If %> <% If Listings.Baths.Visible Then ' Baths %> > > <%= Listings.Baths.ListViewValue %> <% End If %> <% If Listings.LotSize.Visible Then ' LotSize %> > > <%= Listings.LotSize.ListViewValue %> <% End If %> <% If Listings.MainThumbnail.Visible Then ' MainThumbnail %> > <% If Listings.MainThumbnail.LinkAttributes <> "" Then %> <% If Not ew_Empty(Listings.MainThumbnail.Upload.DbValue) Then %> > <% ElseIf Listings.CurrentAction <> "I" And Listings.CurrentAction <> "edit" And Listings.CurrentAction <> "gridedit" Then %>   <% End If %> <% Else %> <% If Not ew_Empty(Listings.MainThumbnail.Upload.DbValue) Then %> > <% ElseIf Listings.CurrentAction <> "I" And Listings.CurrentAction <> "edit" And Listings.CurrentAction <> "gridedit" Then %>   <% End If %> <% End If %> <% End If %>
<% If Listings.Export <> "" Or Listings.SortUrl(Listings.ID) = "" Then %>
<%= Listings.ID.FldCaption %>
<% Else %>
<%= Listings.ID.FldCaption %><% If Listings.ID.Sort = "ASC" Then %><% ElseIf Listings.ID.Sort = "DESC" Then %><% End If %>
<% End If %>
<% If Listings.Export <> "" Or Listings.SortUrl(Listings.ListNum) = "" Then %>
<%= Listings.ListNum.FldCaption %>
<% Else %>
<%= Listings.ListNum.FldCaption %><% If Listings.ListNum.Sort = "ASC" Then %><% ElseIf Listings.ListNum.Sort = "DESC" Then %><% End If %>
<% End If %>
<% If Listings.Export <> "" Or Listings.SortUrl(Listings.Price) = "" Then %>
<%= Listings.Price.FldCaption %>
<% Else %>
<%= Listings.Price.FldCaption %><% If Listings.Price.Sort = "ASC" Then %><% ElseIf Listings.Price.Sort = "DESC" Then %><% End If %>
<% End If %>
<% If Listings.Export <> "" Or Listings.SortUrl(Listings.Category) = "" Then %>
<%= Listings.Category.FldCaption %>
<% Else %>
<%= Listings.Category.FldCaption %><% If Listings.Category.Sort = "ASC" Then %><% ElseIf Listings.Category.Sort = "DESC" Then %><% End If %>
<% End If %>
<% If Listings.Export <> "" Or Listings.SortUrl(Listings.Address) = "" Then %>
<%= Listings.Address.FldCaption %>
<% Else %>
<%= Listings.Address.FldCaption %><% If Listings.Address.Sort = "ASC" Then %><% ElseIf Listings.Address.Sort = "DESC" Then %><% End If %>
<% End If %>
<% If Listings.Export <> "" Or Listings.SortUrl(Listings.City) = "" Then %>
<%= Listings.City.FldCaption %>
<% Else %>
<%= Listings.City.FldCaption %><% If Listings.City.Sort = "ASC" Then %><% ElseIf Listings.City.Sort = "DESC" Then %><% End If %>
<% End If %>
<% If Listings.Export <> "" Or Listings.SortUrl(Listings.Style) = "" Then %>
<%= Listings.Style.FldCaption %>
<% Else %>
<%= Listings.Style.FldCaption %><% If Listings.Style.Sort = "ASC" Then %><% ElseIf Listings.Style.Sort = "DESC" Then %><% End If %>
<% End If %>
<% If Listings.Export <> "" Or Listings.SortUrl(Listings.Bedrooms) = "" Then %>
<%= Listings.Bedrooms.FldCaption %>
<% Else %>
<%= Listings.Bedrooms.FldCaption %><% If Listings.Bedrooms.Sort = "ASC" Then %><% ElseIf Listings.Bedrooms.Sort = "DESC" Then %><% End If %>
<% End If %>
<% If Listings.Export <> "" Or Listings.SortUrl(Listings.Baths) = "" Then %>
<%= Listings.Baths.FldCaption %>
<% Else %>
<%= Listings.Baths.FldCaption %><% If Listings.Baths.Sort = "ASC" Then %><% ElseIf Listings.Baths.Sort = "DESC" Then %><% End If %>
<% End If %>
<% If Listings.Export <> "" Or Listings.SortUrl(Listings.LotSize) = "" Then %>
<%= Listings.LotSize.FldCaption %>
<% Else %>
<%= Listings.LotSize.FldCaption %><% If Listings.LotSize.Sort = "ASC" Then %><% ElseIf Listings.LotSize.Sort = "DESC" Then %><% End If %>
<% End If %>
<% If Listings.Export <> "" Or Listings.SortUrl(Listings.MainThumbnail) = "" Then %>
<%= Listings.MainThumbnail.FldCaption %>
<% Else %>
<%= Listings.MainThumbnail.FldCaption %><% If Listings.MainThumbnail.Sort = "ASC" Then %><% ElseIf Listings.MainThumbnail.Sort = "DESC" Then %><% End If %>
<% End If %>
<% ' Render list options (body, bottom) Listings_list.ListOptions.Render "body", "", Listings_list.RowCnt, "", "", "" %>
 
<% End If %> <% If Listings.CurrentAction = "" Then %> <% End If %>
<% ' Close recordset and connection Listings_list.Recordset.Close Set Listings_list.Recordset = Nothing %> <% If Listings_list.TotalRecs > 0 Then %> <% If Listings.Export = "" Then %>
<% If Listings.CurrentAction <> "gridadd" And Listings.CurrentAction <> "gridedit" Then %>
<% If Listings_list.TotalRecs > 0 Then %> <% End If %>
<% If Not IsObject(Listings_list.Pager) Then Set Listings_list.Pager = ew_NewNumericPager(Listings_list.StartRec, Listings_list.DisplayRecs, Listings_list.TotalRecs, Listings_list.RecRange) %> <% If Listings_list.Pager.RecordCount > 0 Then %>
<% If Listings_list.Pager.ButtonCount > 0 Then %>    <% End If %> <%= Language.Phrase("Record") %> <%= Listings_list.Pager.FromIndex %> <%= Language.Phrase("To") %> <%= Listings_list.Pager.ToIndex %> <%= Language.Phrase("Of") %> <%= Listings_list.Pager.RecordCount %>
<% Else %> <% If Listings_list.SearchWhere = "0=101" Then %>

<%= Language.Phrase("EnterSearchCriteria") %>

<% Else %>

<%= Language.Phrase("NoRecord") %>

<% End If %> <% End If %>
    
<% End If %>

 

<% Listings_list.AddEditOptions.Render "body", "bottom", "", "", "", "" Listings_list.DetailOptions.Render "body", "bottom", "", "", "", "" Listings_list.ActionOptions.Render "body", "bottom", "", "", "", "" %>
<% End If %> <% End If %>
<% If Listings.Export = "" Then %> <% End If %> <% Listings_list.ShowPageFooter() If EW_DEBUG_ENABLED Then Response.Write ew_DebugMsg() %> <% If Listings.Export = "" Then %> <% End If %> <% ' Drop page object Set Listings_list = Nothing %> <% ' ----------------------------------------------------------------- ' Page Class ' Class cListings_list ' Page ID Public Property Get PageID() PageID = "list" End Property ' Project ID Public Property Get ProjectID() ProjectID = "{12BC18A2-ED1A-47F6-85E6-20DCF9697D09}" End Property ' Table Name Public Property Get TableName() TableName = "Listings" End Property ' Page Object Name Public Property Get PageObjName() PageObjName = "Listings_list" End Property ' Grid form hidden field names Dim FormName Dim FormActionName Dim FormKeyName Dim FormOldKeyName Dim FormBlankRowName Dim FormKeyCountName ' Page Name Public Property Get PageName() PageName = ew_CurrentPage() End Property ' Page Url Public Property Get PageUrl() PageUrl = ew_CurrentPage() & "?" If Listings.UseTokenInUrl Then PageUrl = PageUrl & "t=" & Listings.TableVar & "&" ' add page token End Property ' Common urls Dim AddUrl Dim EditUrl Dim CopyUrl Dim DeleteUrl Dim ViewUrl Dim ListUrl ' Export urls Dim ExportPrintUrl Dim ExportHtmlUrl Dim ExportExcelUrl Dim ExportWordUrl Dim ExportXmlUrl Dim ExportCsvUrl Dim ExportPdfUrl ' Inline urls Dim InlineAddUrl Dim InlineCopyUrl Dim InlineEditUrl Dim GridAddUrl Dim GridEditUrl Dim MultiDeleteUrl Dim MultiUpdateUrl ' Message Public Property Get Message() Message = Session(EW_SESSION_MESSAGE) End Property Public Property Let Message(v) Dim msg msg = Session(EW_SESSION_MESSAGE) Call ew_AddMessage(msg, v) Session(EW_SESSION_MESSAGE) = msg End Property Public Property Get FailureMessage() FailureMessage = Session(EW_SESSION_FAILURE_MESSAGE) End Property Public Property Let FailureMessage(v) Dim msg msg = Session(EW_SESSION_FAILURE_MESSAGE) Call ew_AddMessage(msg, v) Session(EW_SESSION_FAILURE_MESSAGE) = msg End Property Public Property Get SuccessMessage() SuccessMessage = Session(EW_SESSION_SUCCESS_MESSAGE) End Property Public Property Let SuccessMessage(v) Dim msg msg = Session(EW_SESSION_SUCCESS_MESSAGE) Call ew_AddMessage(msg, v) Session(EW_SESSION_SUCCESS_MESSAGE) = msg End Property Public Property Get WarningMessage() WarningMessage = Session(EW_SESSION_WARNING_MESSAGE) End Property Public Property Let WarningMessage(v) Dim msg msg = Session(EW_SESSION_WARNING_MESSAGE) Call ew_AddMessage(msg, v) Session(EW_SESSION_WARNING_MESSAGE) = msg End Property ' Show Message Public Sub ShowMessage() Dim hidden, html, sMessage hidden = False html = "" ' Message sMessage = Message Call Message_Showing(sMessage, "") If sMessage <> "" Then ' Message in Session, display If Not hidden Then sMessage = "" & sMessage html = html & "
" & sMessage & "
" Session(EW_SESSION_MESSAGE) = "" ' Clear message in Session End If ' Warning message Dim sWarningMessage sWarningMessage = WarningMessage Call Message_Showing(sWarningMessage, "warning") If sWarningMessage <> "" Then ' Message in Session, display If Not hidden Then sWarningMessage = "" & sWarningMessage html = html & "
" & sWarningMessage & "
" Session(EW_SESSION_WARNING_MESSAGE) = "" ' Clear message in Session End If ' Success message Dim sSuccessMessage sSuccessMessage = SuccessMessage Call Message_Showing(sSuccessMessage, "success") If sSuccessMessage <> "" Then ' Message in Session, display If Not hidden Then sSuccessMessage = "" & sSuccessMessage html = html & "
" & sSuccessMessage & "
" Session(EW_SESSION_SUCCESS_MESSAGE) = "" ' Clear message in Session End If ' Failure message Dim sErrorMessage sErrorMessage = FailureMessage Call Message_Showing(sErrorMessage, "failure") If sErrorMessage <> "" Then ' Message in Session, display If Not hidden Then sErrorMessage = "" & sErrorMessage html = html & "
" & sErrorMessage & "
" Session(EW_SESSION_FAILURE_MESSAGE) = "" ' Clear message in Session End If Response.Write "
" & html & "
" End Sub Dim PageHeader Dim PageFooter ' Show Page Header Public Sub ShowPageHeader() Dim sHeader sHeader = PageHeader Call Page_DataRendering(sHeader) If sHeader <> "" Then ' Header exists, display Response.Write "

" & sHeader & "

" End If End Sub ' Show Page Footer Public Sub ShowPageFooter() Dim sFooter sFooter = PageFooter Call Page_DataRendered(sFooter) If sFooter <> "" Then ' Footer exists, display Response.Write "

" & sFooter & "

" End If End Sub ' ----------------------- ' Validate Page request ' Public Function IsPageRequest() If Listings.UseTokenInUrl Then IsPageRequest = False If Not (ObjForm Is Nothing) Then IsPageRequest = (Listings.TableVar = ObjForm.GetValue("t")) End If If Request.QueryString("t").Count > 0 Then IsPageRequest = (Listings.TableVar = Request.QueryString("t")) End If Else IsPageRequest = True End If End Function ' ----------------------------------------------------------------- ' Class initialize ' - init objects ' - open ADO connection ' Private Sub Class_Initialize() If IsEmpty(StartTimer) Then StartTimer = Timer ' Init start time ' Grid form hidden field names FormName = "fListingslist" FormActionName = "k_action" FormKeyName = "k_key" FormOldKeyName = "k_oldkey" FormBlankRowName = "k_blankrow" FormKeyCountName = "key_count" ' Initialize language object If IsEmpty(Language) Then Set Language = New cLanguage Call Language.LoadPhrases() End If ' Initialize table object If IsEmpty(Listings) Then Set Listings = New cListings Set Table = Listings ' Initialize urls ExportPrintUrl = PageUrl & "export=print" ExportExcelUrl = PageUrl & "export=excel" ExportWordUrl = PageUrl & "export=word" ExportHtmlUrl = PageUrl & "export=html" ExportXmlUrl = PageUrl & "export=xml" ExportCsvUrl = PageUrl & "export=csv" ExportPdfUrl = PageUrl & "export=pdf" AddUrl = "Listingsadd.asp" InlineAddUrl = PageUrl & "a=add" GridAddUrl = PageUrl & "a=gridadd" GridEditUrl = PageUrl & "a=gridedit" MultiDeleteUrl = "Listingsdelete.asp" MultiUpdateUrl = "Listingsupdate.asp" ' Initialize form object Set ObjForm = Nothing ' Intialize page id (for backward compatibility) EW_PAGE_ID = "list" ' Initialize table name (for backward compatibility) EW_TABLE_NAME = "Listings" ' Open connection to the database If IsEmpty(Conn) Then Call ew_Connect() ' List options Set ListOptions = New cListOptions ListOptions.TableVar = Listings.TableVar ' Export options Set ExportOptions = New cListOptions ExportOptions.TableVar = Listings.TableVar ExportOptions.Tag = "span" ExportOptions.TagClassName = "ewExportOption" ' Other options Set AddEditOptions = New cListOptions AddEditOptions.Tag = "span" AddEditOptions.TagClassName = "ewAddEditOption" Set DetailOptions = New cListOptions DetailOptions.Tag = "span" DetailOptions.TagClassName = "ewDetailOption" Set ActionOptions = New cListOptions ActionOptions.Tag = "span" ActionOptions.TagClassName = "ewActionOption" End Sub ' ----------------------------------------------------------------- ' Subroutine Page_Init ' - called before page main ' - check Security ' - set up response header ' - call page load events ' Sub Page_Init() ' Get grid add count Dim gridaddcnt gridaddcnt = Request.QueryString(EW_TABLE_GRID_ADD_ROW_COUNT) If IsNumeric(gridaddcnt) Then If gridaddcnt > 0 Then Listings.GridAddRowCount = gridaddcnt End If End If ' Set up list options SetupListOptions() gbOldSkipHeaderFooter = gbSkipHeaderFooter gbSkipHeaderFooter = True ' Global page loading event (in userfn7.asp) Page_Loading() ' Page load event, used in current page Page_Load() ' Setup other options SetupOtherOptions() ' Set "checkbox" visible If UBound(Listings.CustomActions.CustomArray) >= 0 Then ListOptions.GetItem("checkbox").Visible = True End If End Sub ' ----------------------------------------------------------------- ' Class terminate ' - clean up page object ' Private Sub Class_Terminate() Call Page_Terminate("") End Sub ' ----------------------------------------------------------------- ' Subroutine Page_Terminate ' - called when exit page ' - clean up ADO connection and objects ' - if url specified, redirect to url ' Sub Page_Terminate(url) gbSkipHeaderFooter = gbOldSkipHeaderFooter ' Page unload event, used in current page Call Page_Unload() ' Global page unloaded event (in userfn60.asp) Call Page_Unloaded() Dim sRedirectUrl sReDirectUrl = url Call Page_Redirecting(sReDirectUrl) If Not (Conn Is Nothing) Then Conn.Close ' Close Connection Set Conn = Nothing Set Listings = Nothing Set ListOptions = Nothing Set ObjForm = Nothing ' Go to url if specified If sReDirectUrl <> "" Then If Response.Buffer Then Response.Clear Response.Redirect sReDirectUrl End If End Sub ' ' Subroutine Page_Terminate (End) ' ---------------------------------------- Dim ListOptions ' List options Dim ExportOptions ' Export options Dim AddEditOptions ' Other options (add edit) Dim DetailOptions ' Other options (detail) Dim ActionOptions ' Other options (action) Dim DisplayRecs ' Number of display records Dim StartRec, StopRec, TotalRecs, RecRange Dim SearchWhere Dim RecCnt Dim EditRowCnt Dim StartRowCnt Dim RowCnt, RowIndex Dim Attrs Dim RecPerRow, ColCnt Dim KeyCount Dim RowAction Dim RowOldKey ' Row old key (for copy) Dim DbMasterFilter, DbDetailFilter Dim MasterRecordExists Dim MultiSelectKey Dim Command Dim RestoreSearch Dim Recordset, OldRecordset ' ----------------------------------------------------------------- ' Page main processing ' Sub Page_Main() DisplayRecs = 20 RecRange = 10 RecCnt = 0 ' Record count KeyCount = 0 ' Key count StartRowCnt = 1 ' Multi Column RecPerRow = 3 ColCnt = 0 ' Search filters Dim sSrchAdvanced, sSrchBasic, sFilter sSrchAdvanced = "" ' Advanced search filter sSrchBasic = "" ' Basic search filter SearchWhere = "" ' Search where clause sFilter = "" ' Restore search RestoreSearch = False ' Get command Command = LCase(Request.QueryString("cmd")&"") ' Master/Detail DbMasterFilter = "" ' Master filter DbDetailFilter = "" ' Detail filter If IsPageRequest Then ' Validate request ' Process custom action first ProcessCustomAction() ' Set up records per page dynamically SetUpDisplayRecs() ' Handle reset command ResetCmd() ' Set up Breadcrumb SetupBreadcrumb() ' Hide list options If Listings.Export <> "" Then Call ListOptions.HideAllOptions(Array("sequence")) ListOptions.UseDropDownButton = False ' Disable drop down button ListOptions.UseButtonGroup = False ' Disable button group ElseIf Listings.CurrentAction = "gridadd" Or Listings.CurrentAction = "gridedit" Then Call ListOptions.HideAllOptions(Array()) ListOptions.UseDropDownButton = False ' Disable drop down button ListOptions.UseButtonGroup = False ' Disable button group End If ' Hide export options If Listings.Export <> "" Or Listings.CurrentAction <> "" Then ExportOptions.HideAllOptions(Array()) End If ' Hide other options If Listings.Export <> "" Then AddEditOptions.HideAllOptions(Array()) DetailOptions.HideAllOptions(Array()) ActionOptions.HideAllOptions(Array()) End If ' Get and validate search values for advanced search Call LoadSearchValues() ' Get search values If Not ValidateSearch() Then FailureMessage = gsSearchError End If ' Restore search parms from Session if not searching / reset If Command <> "search" And Command <> "reset" And Command <> "resetall" And CheckSearchParms() Then Call RestoreSearchParms() End If ' Call Recordset SearchValidated event Call Listings.Recordset_SearchValidated() ' Set Up Sorting Order SetUpSortOrder() ' Get search criteria for advanced search If gsSearchError = "" Then sSrchAdvanced = AdvancedSearchWhere() End If End If ' End Validate Request ' Restore display records If Listings.RecordsPerPage <> "" Then DisplayRecs = Listings.RecordsPerPage ' Restore from Session Else DisplayRecs = 20 ' Load default End If ' Load Sorting Order LoadSortOrder() ' Load search default if no existing search criteria If Not CheckSearchParms() Then ' Load advanced search from default If LoadAdvancedSearchDefault() Then sSrchAdvanced = AdvancedSearchWhere() End If End If ' Build search criteria Call ew_AddFilter(SearchWhere, sSrchAdvanced) Call ew_AddFilter(SearchWhere, sSrchBasic) ' Call Recordset Searching event Call Listings.Recordset_Searching(SearchWhere) ' Save search criteria If Command = "search" And Not RestoreSearch Then Listings.SearchWhere = SearchWhere ' Save to Session StartRec = 1 ' Reset start record counter Listings.StartRecordNumber = StartRec Else SearchWhere = Listings.SearchWhere End If sFilter = "" Call ew_AddFilter(sFilter, DbDetailFilter) Call ew_AddFilter(sFilter, SearchWhere) ' Set up filter in Session Listings.SessionWhere = sFilter Listings.CurrentFilter = "" End Sub ' ----------------------------------------------------------------- ' Set up number of records displayed per page ' Sub SetUpDisplayRecs() Dim sWrk sWrk = Request.QueryString(EW_TABLE_REC_PER_PAGE) If sWrk <> "" Then If IsNumeric(sWrk) Then DisplayRecs = CInt(sWrk) Else If LCase(sWrk) = "all" Then ' Display all records DisplayRecs = -1 Else DisplayRecs = 20 ' Non-numeric, load default End If End If Listings.RecordsPerPage = DisplayRecs ' Save to Session ' Reset start position StartRec = 1 Listings.StartRecordNumber = StartRec End If End Sub ' ----------------------------------------------------------------- ' Build filter for all keys ' Function BuildKeyFilter() Dim rowindex, sThisKey Dim sKey Dim sWrkFilter, sFilter sWrkFilter = "" ' Update row index and get row key rowindex = 1 ObjForm.Index = rowindex sThisKey = ObjForm.GetValue("k_key") & "" Do While (sThisKey <> "") If SetupKeyValues(sThisKey) Then sFilter = Listings.KeyFilter If sWrkFilter <> "" Then sWrkFilter = sWrkFilter & " OR " sWrkFilter = sWrkFilter & sFilter Else sWrkFilter = "0=1" Exit Do End If ' Update row index and get row key rowindex = rowindex + 1 ' Next row ObjForm.Index = rowindex sThisKey = ObjForm.GetValue("k_key") & "" Loop BuildKeyFilter = sWrkFilter End Function ' ----------------------------------------------------------------- ' Set up key values ' Function SetupKeyValues(key) Dim arrKeyFlds arrKeyFlds = Split(key&"", EW_COMPOSITE_KEY_SEPARATOR) If UBound(arrKeyFlds) >= 0 Then Listings.ID.FormValue = arrKeyFlds(0) If Not IsNumeric(Listings.ID.FormValue) Then SetupKeyValues = False Exit Function End If End If SetupKeyValues = True End Function ' Return Advanced Search Where based on QueryString parameters Function AdvancedSearchWhere() Dim sWhere sWhere = "" ' Field ListNum Call BuildSearchSql(sWhere, Listings.ListNum, False) ' Field Price Call BuildSearchSql(sWhere, Listings.Price, False) ' Field Category Call BuildSearchSql(sWhere, Listings.Category, False) ' Field City Call BuildSearchSql(sWhere, Listings.City, False) ' Field Bedrooms Call BuildSearchSql(sWhere, Listings.Bedrooms, False) ' Field Baths Call BuildSearchSql(sWhere, Listings.Baths, False) ' Field water_body Call BuildSearchSql(sWhere, Listings.water_body, False) AdvancedSearchWhere = sWhere ' Set up search parm If sWhere <> "" Then Command = "search" End If If Command = "search" Then Call Listings.ListNum.AdvancedSearch.Save() ' ListNum Call Listings.Price.AdvancedSearch.Save() ' Price Call Listings.Category.AdvancedSearch.Save() ' Category Call Listings.City.AdvancedSearch.Save() ' City Call Listings.Bedrooms.AdvancedSearch.Save() ' Bedrooms Call Listings.Baths.AdvancedSearch.Save() ' Baths Call Listings.water_body.AdvancedSearch.Save() ' water_body End If End Function ' Build search sql Sub BuildSearchSql(Where, Fld, MultiValue) Dim FldParm, FldVal, FldOpr, FldCond, FldVal2, FldOpr2 FldParm = Mid(Fld.FldVar, 3) FldVal = Fld.AdvancedSearch.SearchValue FldOpr = Fld.AdvancedSearch.SearchOperator FldCond = Fld.AdvancedSearch.SearchCondition FldVal2 = Fld.AdvancedSearch.SearchValue2 FldOpr2 = Fld.AdvancedSearch.SearchOperator2 Dim sWrk sWrk = "" FldOpr = UCase(Trim(FldOpr)) If (FldOpr = "") Then FldOpr = "=" FldOpr2 = UCase(Trim(FldOpr2)) If FldOpr2 = "" Then FldOpr2 = "=" If EW_SEARCH_MULTI_VALUE_OPTION = 1 Then MultiValue = False If FldOpr <> "LIKE" Then MultiValue = False If FldOpr2 <> "LIKE" And FldVal2 <> "" Then MultiValue = False If MultiValue Then Dim sWrk1, sWrk2 ' Field value 1 If FldVal <> "" Then sWrk1 = ew_GetMultiSearchSql(Fld, FldOpr, FldVal) Else sWrk1 = "" End If ' Field value 2 If FldVal2 <> "" And FldCond <> "" Then sWrk2 = ew_GetMultiSearchSql(Fld, FldOpr2, FldVal2) Else sWrk2 = "" End If ' Build final SQL sWrk = sWrk1 If sWrk2 <> "" Then If sWrk <> "" Then sWrk = "(" & sWrk & ") " & FldCond & " (" & sWrk2 & ")" Else sWrk = sWrk2 End If End If Else FldVal = ConvertSearchValue(Fld, FldVal) FldVal2 = ConvertSearchValue(Fld, FldVal2) sWrk = ew_GetSearchSql(Fld, FldVal, FldOpr, FldCond, FldVal2, FldOpr2) End If Call ew_AddFilter(Where, sWrk) End Sub ' Convert search value Function ConvertSearchValue(Fld, FldVal) If FldVal = EW_NULL_VALUE Or FldVal = EW_NOT_NULL_VALUE Then ConvertSearchValue = FldVal Else ConvertSearchValue = FldVal If Fld.FldDataType = EW_DATATYPE_BOOLEAN Then If FldVal <> "" Then ConvertSearchValue = ew_IIf(FldVal&"" = "1", "True", "False") ElseIf Fld.FldDataType = EW_DATATYPE_DATE Then If FldVal <> "" Then ConvertSearchValue = ew_UnFormatDateTime(FldVal, Fld.FldDateTimeFormat) End If End If End Function ' Check if search parm exists Function CheckSearchParms() If Listings.ListNum.AdvancedSearch.IssetSession() Then CheckSearchParms = True Exit Function End If If Listings.Price.AdvancedSearch.IssetSession() Then CheckSearchParms = True Exit Function End If If Listings.Category.AdvancedSearch.IssetSession() Then CheckSearchParms = True Exit Function End If If Listings.City.AdvancedSearch.IssetSession() Then CheckSearchParms = True Exit Function End If If Listings.Bedrooms.AdvancedSearch.IssetSession() Then CheckSearchParms = True Exit Function End If If Listings.Baths.AdvancedSearch.IssetSession() Then CheckSearchParms = True Exit Function End If If Listings.water_body.AdvancedSearch.IssetSession() Then CheckSearchParms = True Exit Function End If CheckSearchParms = False End Function ' Clear all search parameters Sub ResetSearchParms() ' Clear search where SearchWhere = "" Listings.SearchWhere = SearchWhere ' Clear advanced search parameters Call ResetAdvancedSearchParms() End Sub ' Load advanced search default values Function LoadAdvancedSearchDefault() LoadAdvancedSearchDefault = False End Function ' ----------------------------------------------------------------- ' Clear all advanced search parameters ' Sub ResetAdvancedSearchParms() ' Clear advanced search parameters Call Listings.ListNum.AdvancedSearch.UnsetSession() Call Listings.Price.AdvancedSearch.UnsetSession() Call Listings.Category.AdvancedSearch.UnsetSession() Call Listings.City.AdvancedSearch.UnsetSession() Call Listings.Bedrooms.AdvancedSearch.UnsetSession() Call Listings.Baths.AdvancedSearch.UnsetSession() Call Listings.water_body.AdvancedSearch.UnsetSession() End Sub ' ----------------------------------------------------------------- ' Restore all search parameters ' Sub RestoreSearchParms() ' Restore search flag RestoreSearch = True ' Restore advanced search values Call Listings.ListNum.AdvancedSearch.Load() Call Listings.Price.AdvancedSearch.Load() Call Listings.Category.AdvancedSearch.Load() Call Listings.City.AdvancedSearch.Load() Call Listings.Bedrooms.AdvancedSearch.Load() Call Listings.Baths.AdvancedSearch.Load() Call Listings.water_body.AdvancedSearch.Load() End Sub ' ----------------------------------------------------------------- ' Set up Sort parameters based on Sort Links clicked ' Sub SetUpSortOrder() Dim sOrderBy Dim sSortField, sLastSort, sThisSort Dim bCtrl ' Check for an Order parameter If Request.QueryString("order").Count > 0 Then Listings.CurrentOrder = Request.QueryString("order") Listings.CurrentOrderType = Request.QueryString("ordertype") Listings.StartRecordNumber = 1 ' Reset start position End If End Sub ' ----------------------------------------------------------------- ' Load Sort Order parameters ' Sub LoadSortOrder() Dim sOrderBy sOrderBy = Listings.SessionOrderBy ' Get order by from Session If sOrderBy = "" Then If Listings.SqlOrderBy <> "" Then sOrderBy = Listings.SqlOrderBy Listings.SessionOrderBy = sOrderBy End If End If End Sub ' ----------------------------------------------------------------- ' Reset command based on querystring parameter cmd= ' - RESET: reset search parameters ' - RESETALL: reset search & master/detail parameters ' - RESETSORT: reset sort parameters ' Sub ResetCmd() ' Check if reset command If Left(Command,5) = "reset" Then ' Reset search criteria If Command = "reset" Or Command = "resetall" Then Call ResetSearchParms() End If ' Reset Sort Criteria If Command = "resetsort" Then Dim sOrderBy sOrderBy = "" Listings.SessionOrderBy = sOrderBy End If ' Reset start position StartRec = 1 Listings.StartRecordNumber = StartRec End If End Sub ' Set up list options Sub SetupListOptions() Dim item ' Add group option item ListOptions.Add(ListOptions.GroupOptionName) Set item = ListOptions.GetItem(ListOptions.GroupOptionName) item.Body = "" item.OnLeft = False item.Visible = False ' View ListOptions.Add("view") Set item = ListOptions.GetItem("view") item.CssStyle = "white-space: nowrap;" item.Visible = True item.OnLeft = False ' Checkbox ListOptions.Add("checkbox") Set item = ListOptions.GetItem("checkbox") item.Visible = False item.OnLeft = False item.Header = "" item.ShowInDropDown = False item.ShowInButtonGroup = False ' Drop down button for ListOptions ListOptions.UseDropDownButton = False ListOptions.DropDownButtonPhrase = Language.Phrase("ButtonListOptions") ListOptions.UseButtonGroup = False ListOptions.ButtonClass = "btn-small" ' Class for button group Call ListOptions_Load() ' Set up group item visibility ListOptions.GetItem(ListOptions.GroupOptionName).Visible = ListOptions.GroupOptionVisible End Sub ' Render list options Sub RenderListOptions() Dim item, links ListOptions.LoadDefault() If True Then ' Commented out by Webmaster ListOptions.GetItem("view").Body = "" & Language.Phrase("ViewLink") & "" Else ListOptions.GetItem("view").Body = "" End If ListOptions.GetItem("checkbox").Body = "" Call RenderListOptionsExt() Call ListOptions_Rendered() End Sub ' Set up other options Sub SetupOtherOptions() Dim opt, item, DetailTableLink, ar, i Set opt = ActionOptions ' Set up options default Set opt = AddEditOptions opt.DropDownButtonPhrase = Language.Phrase("ButtonAddEdit") opt.UseDropDownButton = False opt.UseButtonGroup = True opt.ButtonClass = "btn-small" ' Class for button group Call opt.Add(opt.GroupOptionName) Set item = opt.GetItem(opt.GroupOptionName) item.Body = "" item.Visible = False Set opt = DetailOptions opt.DropDownButtonPhrase = Language.Phrase("ButtonDetails") opt.UseDropDownButton = False opt.UseButtonGroup = True opt.ButtonClass = "btn-small" ' Class for button group Call opt.Add(opt.GroupOptionName) Set item = opt.GetItem(opt.GroupOptionName) item.Body = "" item.Visible = False Set opt = ActionOptions opt.DropDownButtonPhrase = Language.Phrase("ButtonActions") opt.UseDropDownButton = False opt.UseButtonGroup = True opt.ButtonClass = "btn-small" ' Class for button group Call opt.Add(opt.GroupOptionName) Set item = opt.GetItem(opt.GroupOptionName) item.Body = "" item.Visible = False End Sub ' Render other options Sub RenderOtherOptions() Dim opt, item, i, Action, Name Set opt = ActionOptions For i = 0 to UBound(Listings.CustomActions.CustomArray) Action = Listings.CustomActions.CustomArray(i)(0) Name = Listings.CustomActions.CustomArray(i)(1) ' Add custom action Call opt.Add("custom_" & Action) Set item = opt.GetItem("custom_" & Action) item.Body = "" & Name & "" Next ' Hide grid edit, multi-delete and multi-update If TotalRecs <= 0 Then Set opt = AddEditOptions Set item = opt.GetItem("gridedit") If (Not item Is Nothing) Then item.Visible = False Set opt = ActionOptions Set item = opt.GetItem("multidelete") If (Not item Is Nothing) Then item.Visible = False Set item = opt.GetItem("multiupdate") If (Not item Is Nothing) Then item.Visible = False End If End Sub ' Process custom action Sub ProcessCustomAction() Dim sFilter, sSql, UserAction, Processed sFilter = Listings.GetKeyFilter UserAction = Request.Form("useraction") & "" Processed = False If sFilter <> "" And UserAction <> "" Then Listings.CurrentFilter = sFilter sSql = Listings.SQL Conn.BeginTrans ' Load recordset Dim Rs Set Rs = ew_LoadRecordset(sSql) If Not Rs.Eof Then Rs.MoveFirst ' Call row custom action event Do While Not Rs.Eof Processed = Row_CustomAction(UserAction, Rs) If Not Processed Then Exit Do Else Rs.MoveNext End If Loop Rs.Close Set Rs = Nothing If Processed Then Conn.CommitTrans ' Commit the changes If SuccessMessage = "" Then SuccessMessage = Replace(Language.Phrase("CustomActionCompleted"), "%s", UserAction) ' Set up success message End If Else Conn.RollbackTrans ' Rollback transaction ' Set up error message If SuccessMessage <> "" Or FailureMessage <> "" Then ' Use the message, do nothing ElseIf Listings.CancelMessage <> "" Then FailureMessage = Listings.CancelMessage Listings.CancelMessage = "" Else FailureMessage = Replace(Language.Phrase("CustomActionCancelled"), "%s", UserAction) End If End If End If End Sub Function RenderListOptionsExt() End Function Dim Pager ' ----------------------------------------------------------------- ' Set up Starting Record parameters based on Pager Navigation ' Sub SetUpStartRec() Dim PageNo ' Exit if DisplayRecs = 0 If DisplayRecs = 0 Then Exit Sub If IsPageRequest Then ' Validate request ' Check for a START parameter If Request.QueryString(EW_TABLE_START_REC).Count > 0 Then StartRec = Request.QueryString(EW_TABLE_START_REC) Listings.StartRecordNumber = StartRec ElseIf Request.QueryString(EW_TABLE_PAGE_NO).Count > 0 Then PageNo = Request.QueryString(EW_TABLE_PAGE_NO) If IsNumeric(PageNo) Then StartRec = (PageNo-1)*DisplayRecs+1 If StartRec <= 0 Then StartRec = 1 ElseIf StartRec >= ((TotalRecs-1)\DisplayRecs)*DisplayRecs+1 Then StartRec = ((TotalRecs-1)\DisplayRecs)*DisplayRecs+1 End If Listings.StartRecordNumber = StartRec End If End If End If StartRec = Listings.StartRecordNumber ' Check if correct start record counter If Not IsNumeric(StartRec) Or StartRec = "" Then ' Avoid invalid start record counter StartRec = 1 ' Reset start record counter Listings.StartRecordNumber = StartRec ElseIf CLng(StartRec) > CLng(TotalRecs) Then ' Avoid starting record > total records StartRec = ((TotalRecs-1)\DisplayRecs)*DisplayRecs+1 ' Point to last page first record Listings.StartRecordNumber = StartRec ElseIf (StartRec-1) Mod DisplayRecs <> 0 Then StartRec = ((StartRec-1)\DisplayRecs)*DisplayRecs+1 ' Point to page boundary Listings.StartRecordNumber = StartRec End If End Sub ' ----------------------------------------------------------------- ' Load search values for validation ' Function LoadSearchValues() ' Load search values Listings.ListNum.AdvancedSearch.SearchValue = Request.QueryString("x_ListNum") If Listings.ListNum.AdvancedSearch.SearchValue&"" <> "" Then Command = "search" Listings.ListNum.AdvancedSearch.SearchOperator = Request.QueryString("z_ListNum") Listings.Price.AdvancedSearch.SearchValue = Request.QueryString("x_Price") If Listings.Price.AdvancedSearch.SearchValue&"" <> "" Then Command = "search" Listings.Price.AdvancedSearch.SearchOperator = Request.QueryString("z_Price") Listings.Price.AdvancedSearch.SearchCondition = Request.QueryString("v_Price") Listings.Price.AdvancedSearch.SearchValue2 = Request.QueryString("y_Price") If Listings.Price.AdvancedSearch.SearchValue2&"" <> "" Then Command = "search" Listings.Price.AdvancedSearch.SearchOperator2 = Request.QueryString("w_Price") Listings.Category.AdvancedSearch.SearchValue = Request.QueryString("x_Category") If Listings.Category.AdvancedSearch.SearchValue&"" <> "" Then Command = "search" Listings.Category.AdvancedSearch.SearchOperator = Request.QueryString("z_Category") Listings.City.AdvancedSearch.SearchValue = Request.QueryString("x_City") If Listings.City.AdvancedSearch.SearchValue&"" <> "" Then Command = "search" Listings.City.AdvancedSearch.SearchOperator = Request.QueryString("z_City") Listings.Bedrooms.AdvancedSearch.SearchValue = Request.QueryString("x_Bedrooms") If Listings.Bedrooms.AdvancedSearch.SearchValue&"" <> "" Then Command = "search" Listings.Bedrooms.AdvancedSearch.SearchOperator = Request.QueryString("z_Bedrooms") Listings.Baths.AdvancedSearch.SearchValue = Request.QueryString("x_Baths") If Listings.Baths.AdvancedSearch.SearchValue&"" <> "" Then Command = "search" Listings.Baths.AdvancedSearch.SearchOperator = Request.QueryString("z_Baths") Listings.water_body.AdvancedSearch.SearchValue = Request.QueryString("x_water_body") If Listings.water_body.AdvancedSearch.SearchValue&"" <> "" Then Command = "search" Listings.water_body.AdvancedSearch.SearchOperator = Request.QueryString("z_water_body") End Function ' ----------------------------------------------------------------- ' Load recordset ' Function LoadRecordset() ' Call Recordset Selecting event Dim sFilter sFilter = Listings.CurrentFilter Call Listings.Recordset_Selecting(sFilter) Listings.CurrentFilter = sFilter ' Load list page sql Dim sSql sSql = Listings.ListSQL Call ew_SetDebugMsg("LoadRecordset: " & sSql) ' Show SQL for debugging ' Load recordset Dim RsRecordset Set RsRecordset = ew_LoadRecordset(sSql) ' Call Recordset Selected event Call Listings.Recordset_Selected(RsRecordset) Set LoadRecordset = RsRecordset End Function ' ----------------------------------------------------------------- ' Load row based on key values ' Function LoadRow() Dim RsRow, sSql, sFilter sFilter = Listings.KeyFilter ' Call Row Selecting event Call Listings.Row_Selecting(sFilter) ' Load sql based on filter Listings.CurrentFilter = sFilter sSql = Listings.SQL Call ew_SetDebugMsg("LoadRow: " & sSql) ' Show SQL for debugging Set RsRow = ew_LoadRow(sSql) If RsRow.Eof Then LoadRow = False Else LoadRow = True RsRow.MoveFirst Call LoadRowValues(RsRow) ' Load row values End If RsRow.Close Set RsRow = Nothing End Function ' ----------------------------------------------------------------- ' Load row values from recordset ' Sub LoadRowValues(RsRow) Dim sDetailFilter If Not EW_DEBUG_ENABLED Then On Error Resume Next If RsRow.Eof Then Exit Sub ' Call Row Selected event Call Listings.Row_Selected(RsRow) Listings.ID.DbValue = RsRow("ID") Listings.ListNum.DbValue = RsRow("ListNum") Listings.Price.DbValue = RsRow("Price") Listings.Category.DbValue = RsRow("Category") Listings.SubCat.DbValue = RsRow("SubCat") Listings.Directions.DbValue = RsRow("Directions") Listings.Address.DbValue = RsRow("Address") Listings.City.DbValue = RsRow("City") Listings.County.DbValue = RsRow("County") Listings.Photo.Upload.DbValue = RsRow("Photo") Listings.Style.DbValue = RsRow("Style") Listings.Rooms.DbValue = RsRow("Rooms") Listings.Bedrooms.DbValue = RsRow("Bedrooms") Listings.Baths.DbValue = RsRow("Baths") Listings.Half_Baths.DbValue = RsRow("Half_Baths") Listings.q_baths.DbValue = RsRow("q_baths") Listings.Features.DbValue = RsRow("Features") Listings.Exterior.DbValue = RsRow("Exterior") Listings.Basement.DbValue = RsRow("Basement") Listings.Roof.DbValue = RsRow("Roof") Listings.YearBuilt.DbValue = RsRow("YearBuilt") Listings.Seasonal.DbValue = RsRow("Seasonal") Listings.Equipment.DbValue = RsRow("Equipment") Listings.LotSize.DbValue = RsRow("LotSize") Listings.Frontage.DbValue = RsRow("Frontage") Listings.water_body.DbValue = RsRow("water_body") Listings.Lot_Desc.DbValue = RsRow("Lot_Desc") Listings.Zoning.DbValue = RsRow("Zoning") Listings.Map.DbValue = RsRow("Map") Listings.Road_Frntg.DbValue = RsRow("Road_Frntg") Listings.Taxes.DbValue = RsRow("Taxes") Listings.Book.DbValue = RsRow("Book") Listings.zPage.DbValue = RsRow("Page") Listings.TotalSquareFoot.DbValue = RsRow("TotalSquareFoot") Listings.Color.DbValue = RsRow("Color") Listings.Water.DbValue = RsRow("Water") Listings.Sewer.DbValue = RsRow("Sewer") Listings.Disclosures1.DbValue = RsRow("Disclosures1") Listings.Disclosures2.DbValue = RsRow("Disclosures2") Listings.Disclosured3.Upload.DbValue = RsRow("Disclosured3") Listings.Image1.Upload.DbValue = RsRow("Image1") Listings.Image2.Upload.DbValue = RsRow("Image2") Listings.Image3.Upload.DbValue = RsRow("Image3") Listings.Image4.Upload.DbValue = RsRow("Image4") Listings.Image5.Upload.DbValue = RsRow("Image5") Listings.Image6.Upload.DbValue = RsRow("Image6") Listings.Image7.Upload.DbValue = RsRow("Image7") Listings.Image8.Upload.DbValue = RsRow("Image8") Listings.Image10.Upload.DbValue = RsRow("Image10") Listings.Image11.Upload.DbValue = RsRow("Image11") Listings.Image12.Upload.DbValue = RsRow("Image12") Listings.State.DbValue = RsRow("State") Listings.Zip.DbValue = RsRow("Zip") Listings.Kitchen.DbValue = RsRow("Kitchen") Listings.Den.DbValue = RsRow("Den") Listings.UserName.DbValue = RsRow("UserName") Listings.L_UserID.DbValue = RsRow("L_UserID") Listings.AgencyID.DbValue = RsRow("AgencyID") Listings.Ref_Num.DbValue = RsRow("Ref_Num") Listings.iDate.DbValue = RsRow("iDate") Listings.fDate.DbValue = RsRow("fDate") Listings.ContractExpiryDate.DbValue = RsRow("ContractExpiryDate") Listings.LivingRoom.DbValue = RsRow("LivingRoom") Listings.Office.DbValue = RsRow("Office") Listings.DiningRoom.DbValue = RsRow("DiningRoom") Listings.MasterBath.DbValue = RsRow("MasterBath") Listings.OtherBath.DbValue = RsRow("OtherBath") Listings.OtherBath1.DbValue = RsRow("OtherBath1") Listings.Bedroom1.DbValue = RsRow("Bedroom1") Listings.Bedroom2.DbValue = RsRow("Bedroom2") Listings.Bedroom3.DbValue = RsRow("Bedroom3") Listings.Bedroom4.DbValue = RsRow("Bedroom4") Listings.Bedroom5.DbValue = RsRow("Bedroom5") Listings.TextPrice.DbValue = RsRow("TextPrice") Listings.Photo2.DbValue = RsRow("Photo2") Listings.Thumbnail.Upload.DbValue = RsRow("Thumbnail") Listings.MainThumbnail.Upload.DbValue = RsRow("MainThumbnail") Listings.zEmail.DbValue = RsRow("Email") Listings.URL.DbValue = RsRow("URL") Listings.Garage.DbValue = RsRow("Garage") Listings.other_info.DbValue = RsRow("other_info") Listings.Fd_Size.DbValue = RsRow("Fd_Size") Listings.Location.DbValue = RsRow("Location") Listings.Shore_Rights.DbValue = RsRow("Shore_Rights") Listings.VirtualTour.DbValue = RsRow("VirtualTour") Listings.ImagesDirectory.DbValue = RsRow("ImagesDirectory") Listings.LotNum.DbValue = RsRow("LotNum") Listings.Condition.DbValue = RsRow("Condition") Listings.HeatingCost.DbValue = RsRow("HeatingCost") Listings.Electric.DbValue = RsRow("Electric") Listings.Windows.DbValue = RsRow("Windows") Listings.Thumb1.DbValue = RsRow("Thumb1") Listings.Thumb2.DbValue = RsRow("Thumb2") Listings.Thumb3.DbValue = RsRow("Thumb3") Listings.Thumb4.DbValue = RsRow("Thumb4") Listings.Thumb5.DbValue = RsRow("Thumb5") Listings.Thumb6.DbValue = RsRow("Thumb6") Listings.Thumb7.DbValue = RsRow("Thumb7") Listings.Thumb8.DbValue = RsRow("Thumb8") Listings.Hit_Counter.DbValue = RsRow("Hit_Counter") Listings.Thumb9.DbValue = RsRow("Thumb9") Listings.Thumb10.DbValue = RsRow("Thumb10") Listings.Thumb11.DbValue = RsRow("Thumb11") Listings.Thumb12.DbValue = RsRow("Thumb12") Listings.Thumb13.DbValue = RsRow("Thumb13") Listings.Thumb14.DbValue = RsRow("Thumb14") Listings.Thumb15.DbValue = RsRow("Thumb15") Listings.Thumb16.DbValue = RsRow("Thumb16") Listings.Image9.DbValue = RsRow("Image9") Listings.Image13.DbValue = RsRow("Image13") Listings.Image14.DbValue = RsRow("Image14") Listings.Image15.DbValue = RsRow("Image15") Listings.Image16.DbValue = RsRow("Image16") Listings.Activate.DbValue = ew_IIf(RsRow("Activate"), "1", "0") Listings.View.DbValue = RsRow("View") Listings.BuildingSize.DbValue = RsRow("BuildingSize") Listings.Featured.DbValue = ew_IIf(RsRow("Featured"), "1", "0") End Sub ' Load DbValue from recordset Sub LoadDbValues(Rs) If Not EW_DEBUG_ENABLED Then On Error Resume Next If Rs.Eof Then Exit Sub Listings.ID.m_DbValue = Rs("ID") Listings.ListNum.m_DbValue = Rs("ListNum") Listings.Price.m_DbValue = Rs("Price") Listings.Category.m_DbValue = Rs("Category") Listings.SubCat.m_DbValue = Rs("SubCat") Listings.Directions.m_DbValue = Rs("Directions") Listings.Address.m_DbValue = Rs("Address") Listings.City.m_DbValue = Rs("City") Listings.County.m_DbValue = Rs("County") Listings.Photo.Upload.DbValue = Rs("Photo") Listings.Style.m_DbValue = Rs("Style") Listings.Rooms.m_DbValue = Rs("Rooms") Listings.Bedrooms.m_DbValue = Rs("Bedrooms") Listings.Baths.m_DbValue = Rs("Baths") Listings.Half_Baths.m_DbValue = Rs("Half_Baths") Listings.q_baths.m_DbValue = Rs("q_baths") Listings.Features.m_DbValue = Rs("Features") Listings.Exterior.m_DbValue = Rs("Exterior") Listings.Basement.m_DbValue = Rs("Basement") Listings.Roof.m_DbValue = Rs("Roof") Listings.YearBuilt.m_DbValue = Rs("YearBuilt") Listings.Seasonal.m_DbValue = Rs("Seasonal") Listings.Equipment.m_DbValue = Rs("Equipment") Listings.LotSize.m_DbValue = Rs("LotSize") Listings.Frontage.m_DbValue = Rs("Frontage") Listings.water_body.m_DbValue = Rs("water_body") Listings.Lot_Desc.m_DbValue = Rs("Lot_Desc") Listings.Zoning.m_DbValue = Rs("Zoning") Listings.Map.m_DbValue = Rs("Map") Listings.Road_Frntg.m_DbValue = Rs("Road_Frntg") Listings.Taxes.m_DbValue = Rs("Taxes") Listings.Book.m_DbValue = Rs("Book") Listings.zPage.m_DbValue = Rs("Page") Listings.TotalSquareFoot.m_DbValue = Rs("TotalSquareFoot") Listings.Color.m_DbValue = Rs("Color") Listings.Water.m_DbValue = Rs("Water") Listings.Sewer.m_DbValue = Rs("Sewer") Listings.Disclosures1.m_DbValue = Rs("Disclosures1") Listings.Disclosures2.m_DbValue = Rs("Disclosures2") Listings.Disclosured3.Upload.DbValue = Rs("Disclosured3") Listings.Image1.Upload.DbValue = Rs("Image1") Listings.Image2.Upload.DbValue = Rs("Image2") Listings.Image3.Upload.DbValue = Rs("Image3") Listings.Image4.Upload.DbValue = Rs("Image4") Listings.Image5.Upload.DbValue = Rs("Image5") Listings.Image6.Upload.DbValue = Rs("Image6") Listings.Image7.Upload.DbValue = Rs("Image7") Listings.Image8.Upload.DbValue = Rs("Image8") Listings.Image10.Upload.DbValue = Rs("Image10") Listings.Image11.Upload.DbValue = Rs("Image11") Listings.Image12.Upload.DbValue = Rs("Image12") Listings.State.m_DbValue = Rs("State") Listings.Zip.m_DbValue = Rs("Zip") Listings.Kitchen.m_DbValue = Rs("Kitchen") Listings.Den.m_DbValue = Rs("Den") Listings.UserName.m_DbValue = Rs("UserName") Listings.L_UserID.m_DbValue = Rs("L_UserID") Listings.AgencyID.m_DbValue = Rs("AgencyID") Listings.Ref_Num.m_DbValue = Rs("Ref_Num") Listings.iDate.m_DbValue = Rs("iDate") Listings.fDate.m_DbValue = Rs("fDate") Listings.ContractExpiryDate.m_DbValue = Rs("ContractExpiryDate") Listings.LivingRoom.m_DbValue = Rs("LivingRoom") Listings.Office.m_DbValue = Rs("Office") Listings.DiningRoom.m_DbValue = Rs("DiningRoom") Listings.MasterBath.m_DbValue = Rs("MasterBath") Listings.OtherBath.m_DbValue = Rs("OtherBath") Listings.OtherBath1.m_DbValue = Rs("OtherBath1") Listings.Bedroom1.m_DbValue = Rs("Bedroom1") Listings.Bedroom2.m_DbValue = Rs("Bedroom2") Listings.Bedroom3.m_DbValue = Rs("Bedroom3") Listings.Bedroom4.m_DbValue = Rs("Bedroom4") Listings.Bedroom5.m_DbValue = Rs("Bedroom5") Listings.TextPrice.m_DbValue = Rs("TextPrice") Listings.Photo2.m_DbValue = Rs("Photo2") Listings.Thumbnail.Upload.DbValue = Rs("Thumbnail") Listings.MainThumbnail.Upload.DbValue = Rs("MainThumbnail") Listings.zEmail.m_DbValue = Rs("Email") Listings.URL.m_DbValue = Rs("URL") Listings.Garage.m_DbValue = Rs("Garage") Listings.other_info.m_DbValue = Rs("other_info") Listings.Fd_Size.m_DbValue = Rs("Fd_Size") Listings.Location.m_DbValue = Rs("Location") Listings.Shore_Rights.m_DbValue = Rs("Shore_Rights") Listings.VirtualTour.m_DbValue = Rs("VirtualTour") Listings.ImagesDirectory.m_DbValue = Rs("ImagesDirectory") Listings.LotNum.m_DbValue = Rs("LotNum") Listings.Condition.m_DbValue = Rs("Condition") Listings.HeatingCost.m_DbValue = Rs("HeatingCost") Listings.Electric.m_DbValue = Rs("Electric") Listings.Windows.m_DbValue = Rs("Windows") Listings.Thumb1.m_DbValue = Rs("Thumb1") Listings.Thumb2.m_DbValue = Rs("Thumb2") Listings.Thumb3.m_DbValue = Rs("Thumb3") Listings.Thumb4.m_DbValue = Rs("Thumb4") Listings.Thumb5.m_DbValue = Rs("Thumb5") Listings.Thumb6.m_DbValue = Rs("Thumb6") Listings.Thumb7.m_DbValue = Rs("Thumb7") Listings.Thumb8.m_DbValue = Rs("Thumb8") Listings.Hit_Counter.m_DbValue = Rs("Hit_Counter") Listings.Thumb9.m_DbValue = Rs("Thumb9") Listings.Thumb10.m_DbValue = Rs("Thumb10") Listings.Thumb11.m_DbValue = Rs("Thumb11") Listings.Thumb12.m_DbValue = Rs("Thumb12") Listings.Thumb13.m_DbValue = Rs("Thumb13") Listings.Thumb14.m_DbValue = Rs("Thumb14") Listings.Thumb15.m_DbValue = Rs("Thumb15") Listings.Thumb16.m_DbValue = Rs("Thumb16") Listings.Image9.m_DbValue = Rs("Image9") Listings.Image13.m_DbValue = Rs("Image13") Listings.Image14.m_DbValue = Rs("Image14") Listings.Image15.m_DbValue = Rs("Image15") Listings.Image16.m_DbValue = Rs("Image16") Listings.Activate.m_DbValue = ew_IIf(Rs("Activate"), "1", "0") Listings.View.m_DbValue = Rs("View") Listings.BuildingSize.m_DbValue = Rs("BuildingSize") Listings.Featured.m_DbValue = ew_IIf(Rs("Featured"), "1", "0") End Sub ' Load old record Function LoadOldRecord() ' Load key values from Session Dim bValidKey bValidKey = True If Listings.GetKey("ID")&"" <> "" Then Listings.ID.CurrentValue = Listings.GetKey("ID") ' ID Else bValidKey = False End If ' Load old recordset If bValidKey Then Listings.CurrentFilter = Listings.KeyFilter Dim sSql sSql = Listings.SQL Set OldRecordset = ew_LoadRecordset(sSql) Call LoadRowValues(OldRecordset) ' Load row values Else OldRecordset = Null End If LoadOldRecord = bValidKey End Function ' ----------------------------------------------------------------- ' Render row values based on field settings ' Sub RenderRow() ' Initialize urls ViewUrl = Listings.ViewUrl("") EditUrl = Listings.EditUrl("") InlineEditUrl = Listings.InlineEditUrl CopyUrl = Listings.CopyUrl("") InlineCopyUrl = Listings.InlineCopyUrl DeleteUrl = Listings.DeleteUrl ' Convert decimal values if posted back If Listings.Price.FormValue = Listings.Price.CurrentValue And IsNumeric(Listings.Price.CurrentValue) Then Listings.Price.CurrentValue = ew_StrToFloat(Listings.Price.CurrentValue) End If ' Call Row Rendering event Call Listings.Row_Rendering() ' --------------------------------------- ' Common render codes for all row types ' --------------------------------------- ' ID Listings.ID.CellCssStyle = "white-space: nowrap;" ' ListNum ' Price ' Category ' SubCat ' Directions ' Address ' City ' County ' Photo ' Style ' Rooms ' Bedrooms ' Baths ' Half_Baths ' q_baths ' Features ' Exterior ' Basement ' Roof ' YearBuilt ' Seasonal ' Equipment ' LotSize ' Frontage ' water_body ' Lot_Desc ' Zoning ' Map ' Road_Frntg ' Taxes ' Book ' Page ' TotalSquareFoot ' Color ' Water ' Sewer ' Disclosures1 ' Disclosures2 ' Disclosured3 ' Image1 ' Image2 ' Image3 ' Image4 ' Image5 ' Image6 ' Image7 ' Image8 ' Image10 ' Image11 ' Image12 ' State ' Zip ' Kitchen ' Den ' UserName ' L_UserID ' AgencyID ' Ref_Num ' iDate ' fDate ' ContractExpiryDate ' LivingRoom ' Office ' DiningRoom ' MasterBath ' OtherBath ' OtherBath1 ' Bedroom1 ' Bedroom2 ' Bedroom3 ' Bedroom4 ' Bedroom5 ' TextPrice ' Photo2 ' Thumbnail ' MainThumbnail ' Email ' URL ' Garage ' other_info ' Fd_Size ' Location ' Shore_Rights ' VirtualTour ' ImagesDirectory ' LotNum ' Condition ' HeatingCost ' Electric ' Windows ' Thumb1 ' Thumb2 ' Thumb3 ' Thumb4 ' Thumb5 ' Thumb6 ' Thumb7 ' Thumb8 ' Hit_Counter ' Thumb9 ' Thumb10 ' Thumb11 ' Thumb12 ' Thumb13 ' Thumb14 ' Thumb15 ' Thumb16 ' Image9 ' Image13 ' Image14 ' Image15 ' Image16 ' Activate ' View ' BuildingSize ' Featured ' ----------- ' View Row ' ----------- If Listings.RowType = EW_ROWTYPE_VIEW Then ' View row ' ID Listings.ID.ViewValue = Listings.ID.CurrentValue Listings.ID.ViewCustomAttributes = "" ' ListNum Listings.ListNum.ViewValue = Listings.ListNum.CurrentValue Listings.ListNum.ViewCustomAttributes = "" ' Price Listings.Price.ViewValue = Listings.Price.CurrentValue Listings.Price.ViewValue = ew_FormatCurrency(Listings.Price.ViewValue, 0, -2, -2, -2) Listings.Price.ViewCustomAttributes = "" ' Category If Listings.Category.CurrentValue & "" <> "" Then sFilterWrk = "[Category]" & ew_SearchString("=", Listings.Category.CurrentValue, EW_DATATYPE_STRING) sSqlWrk = "SELECT DISTINCT [Category], [Category] AS [DispFld], '' AS [Disp2Fld], '' AS [Disp3Fld], '' AS [Disp4Fld] FROM [Listings]" sWhereWrk = "" sLookupTblFilter = "[AgencyID]=" & getAgencyID() & " AND [Activate]=True" Call ew_AddFilter(sWhereWrk, sLookupTblFilter) Call ew_AddFilter(sWhereWrk, sFilterWrk) ' Call Lookup selecting Call Listings.Lookup_Selecting(Listings.Category, sWhereWrk) If sWhereWrk <> "" Then sSqlWrk = sSqlWrk & " WHERE " & sWhereWrk sSqlWrk = sSqlWrk & " ORDER BY [Category]" Set RsWrk = Conn.Execute(sSqlWrk) If Not RsWrk.Eof Then Listings.Category.ViewValue = RsWrk("DispFld") Else Listings.Category.ViewValue = Listings.Category.CurrentValue End If RsWrk.Close Set RsWrk = Nothing Else Listings.Category.ViewValue = Null End If Listings.Category.ViewCustomAttributes = "" ' SubCat Listings.SubCat.ViewValue = Listings.SubCat.CurrentValue Listings.SubCat.ViewCustomAttributes = "" ' Address Listings.Address.ViewValue = Listings.Address.CurrentValue Listings.Address.ViewCustomAttributes = "" ' City If Listings.City.CurrentValue & "" <> "" Then sFilterWrk = "[City]" & ew_SearchString("=", Listings.City.CurrentValue, EW_DATATYPE_STRING) sSqlWrk = "SELECT DISTINCT [City], [City] AS [DispFld], '' AS [Disp2Fld], '' AS [Disp3Fld], '' AS [Disp4Fld] FROM [Listings]" sWhereWrk = "" sLookupTblFilter = "[AgencyID]=" & getAgencyID() & " AND [Activate]=True" Call ew_AddFilter(sWhereWrk, sLookupTblFilter) Call ew_AddFilter(sWhereWrk, sFilterWrk) ' Call Lookup selecting Call Listings.Lookup_Selecting(Listings.City, sWhereWrk) If sWhereWrk <> "" Then sSqlWrk = sSqlWrk & " WHERE " & sWhereWrk sSqlWrk = sSqlWrk & " ORDER BY [City] ASC" Set RsWrk = Conn.Execute(sSqlWrk) If Not RsWrk.Eof Then Listings.City.ViewValue = RsWrk("DispFld") Else Listings.City.ViewValue = Listings.City.CurrentValue End If RsWrk.Close Set RsWrk = Nothing Else Listings.City.ViewValue = Null End If Listings.City.ViewCustomAttributes = "" ' County Listings.County.ViewValue = Listings.County.CurrentValue Listings.County.ViewCustomAttributes = "" ' Photo Listings.Photo.UploadPath = "/ListingImages/" If Not ew_Empty(Listings.Photo.Upload.DbValue) Then Listings.Photo.ViewValue = Listings.Photo.Upload.DbValue Listings.Photo.ImageWidth = 300 Listings.Photo.ImageHeight = 0 Listings.Photo.ImageAlt = Listings.Photo.FldAlt Listings.Photo.ViewValue = ew_UploadPathEx(False, Listings.Photo.UploadPath) & Listings.Photo.Upload.DbValue Else Listings.Photo.ViewValue = "" End If Listings.Photo.ViewCustomAttributes = "" ' Style Listings.Style.ViewValue = Listings.Style.CurrentValue Listings.Style.ViewCustomAttributes = "" ' Rooms Listings.Rooms.ViewValue = Listings.Rooms.CurrentValue Listings.Rooms.ViewCustomAttributes = "" ' Bedrooms Listings.Bedrooms.ViewValue = Listings.Bedrooms.CurrentValue Listings.Bedrooms.ViewCustomAttributes = "" ' Baths Listings.Baths.ViewValue = Listings.Baths.CurrentValue Listings.Baths.ViewCustomAttributes = "" ' Half_Baths Listings.Half_Baths.ViewValue = Listings.Half_Baths.CurrentValue Listings.Half_Baths.ViewCustomAttributes = "" ' q_baths Listings.q_baths.ViewValue = Listings.q_baths.CurrentValue Listings.q_baths.ViewCustomAttributes = "" ' Exterior Listings.Exterior.ViewValue = Listings.Exterior.CurrentValue Listings.Exterior.ViewCustomAttributes = "" ' Basement Listings.Basement.ViewValue = Listings.Basement.CurrentValue Listings.Basement.ViewCustomAttributes = "" ' Roof Listings.Roof.ViewValue = Listings.Roof.CurrentValue Listings.Roof.ViewCustomAttributes = "" ' YearBuilt Listings.YearBuilt.ViewValue = Listings.YearBuilt.CurrentValue Listings.YearBuilt.ViewCustomAttributes = "" ' Seasonal Listings.Seasonal.ViewValue = Listings.Seasonal.CurrentValue Listings.Seasonal.ViewCustomAttributes = "" ' LotSize Listings.LotSize.ViewValue = Listings.LotSize.CurrentValue Listings.LotSize.ViewCustomAttributes = "" ' Frontage Listings.Frontage.ViewValue = Listings.Frontage.CurrentValue Listings.Frontage.ViewCustomAttributes = "" ' water_body If Listings.water_body.CurrentValue & "" <> "" Then sFilterWrk = "[water_body]" & ew_SearchString("=", Listings.water_body.CurrentValue, EW_DATATYPE_STRING) sSqlWrk = "SELECT DISTINCT [water_body], [water_body] AS [DispFld], '' AS [Disp2Fld], '' AS [Disp3Fld], '' AS [Disp4Fld] FROM [Listings]" sWhereWrk = "" sLookupTblFilter = "[AgencyID]=" & getAgencyID() & " AND [Activate]=True" Call ew_AddFilter(sWhereWrk, sLookupTblFilter) Call ew_AddFilter(sWhereWrk, sFilterWrk) ' Call Lookup selecting Call Listings.Lookup_Selecting(Listings.water_body, sWhereWrk) If sWhereWrk <> "" Then sSqlWrk = sSqlWrk & " WHERE " & sWhereWrk sSqlWrk = sSqlWrk & " ORDER BY [water_body] ASC" Set RsWrk = Conn.Execute(sSqlWrk) If Not RsWrk.Eof Then Listings.water_body.ViewValue = RsWrk("DispFld") Else Listings.water_body.ViewValue = Listings.water_body.CurrentValue End If RsWrk.Close Set RsWrk = Nothing Else Listings.water_body.ViewValue = Null End If Listings.water_body.ViewCustomAttributes = "" ' Lot_Desc Listings.Lot_Desc.ViewValue = Listings.Lot_Desc.CurrentValue Listings.Lot_Desc.ViewCustomAttributes = "" ' Zoning Listings.Zoning.ViewValue = Listings.Zoning.CurrentValue Listings.Zoning.ViewCustomAttributes = "" ' Map Listings.Map.ViewValue = Listings.Map.CurrentValue Listings.Map.ViewCustomAttributes = "" ' Road_Frntg Listings.Road_Frntg.ViewValue = Listings.Road_Frntg.CurrentValue Listings.Road_Frntg.ViewCustomAttributes = "" ' Taxes Listings.Taxes.ViewValue = Listings.Taxes.CurrentValue Listings.Taxes.ViewCustomAttributes = "" ' Book Listings.Book.ViewValue = Listings.Book.CurrentValue Listings.Book.ViewCustomAttributes = "" ' Page Listings.zPage.ViewValue = Listings.zPage.CurrentValue Listings.zPage.ViewCustomAttributes = "" ' TotalSquareFoot Listings.TotalSquareFoot.ViewValue = Listings.TotalSquareFoot.CurrentValue Listings.TotalSquareFoot.ViewCustomAttributes = "" ' Color Listings.Color.ViewValue = Listings.Color.CurrentValue Listings.Color.ViewCustomAttributes = "" ' Water Listings.Water.ViewValue = Listings.Water.CurrentValue Listings.Water.ViewCustomAttributes = "" ' Sewer Listings.Sewer.ViewValue = Listings.Sewer.CurrentValue Listings.Sewer.ViewCustomAttributes = "" ' Disclosures1 Listings.Disclosures1.ViewValue = Listings.Disclosures1.CurrentValue Listings.Disclosures1.ViewCustomAttributes = "" ' Disclosures2 Listings.Disclosures2.ViewValue = Listings.Disclosures2.CurrentValue Listings.Disclosures2.ViewCustomAttributes = "" ' Disclosured3 If Not ew_Empty(Listings.Disclosured3.Upload.DbValue) Then Listings.Disclosured3.ViewValue = Listings.Disclosured3.Upload.DbValue Listings.Disclosured3.ViewValue = Listings.Disclosured3.Upload.DbValue Else Listings.Disclosured3.ViewValue = "" End If Listings.Disclosured3.ViewCustomAttributes = "" ' Image1 Listings.Image1.UploadPath = "ListingImages/" If Not ew_Empty(Listings.Image1.Upload.DbValue) Then Listings.Image1.ViewValue = Listings.Image1.Upload.DbValue Listings.Image1.ImageAlt = Listings.Image1.FldAlt Listings.Image1.ViewValue = ew_UploadPathEx(False, Listings.Image1.UploadPath) & Listings.Image1.Upload.DbValue Else Listings.Image1.ViewValue = "" End If Listings.Image1.ViewCustomAttributes = "" ' Image2 Listings.Image2.UploadPath = "ListingImages/" If Not ew_Empty(Listings.Image2.Upload.DbValue) Then Listings.Image2.ViewValue = Listings.Image2.Upload.DbValue Listings.Image2.ImageAlt = Listings.Image2.FldAlt Listings.Image2.ViewValue = ew_UploadPathEx(False, Listings.Image2.UploadPath) & Listings.Image2.Upload.DbValue Else Listings.Image2.ViewValue = "" End If Listings.Image2.ViewCustomAttributes = "" ' Image3 Listings.Image3.UploadPath = "ListingImages/" If Not ew_Empty(Listings.Image3.Upload.DbValue) Then Listings.Image3.ViewValue = Listings.Image3.Upload.DbValue Listings.Image3.ImageAlt = Listings.Image3.FldAlt Listings.Image3.ViewValue = ew_UploadPathEx(False, Listings.Image3.UploadPath) & Listings.Image3.Upload.DbValue Else Listings.Image3.ViewValue = "" End If Listings.Image3.ViewCustomAttributes = "" ' Image4 Listings.Image4.UploadPath = "ListingImages/" If Not ew_Empty(Listings.Image4.Upload.DbValue) Then Listings.Image4.ViewValue = Listings.Image4.Upload.DbValue Listings.Image4.ImageAlt = Listings.Image4.FldAlt Listings.Image4.ViewValue = ew_UploadPathEx(False, Listings.Image4.UploadPath) & Listings.Image4.Upload.DbValue Else Listings.Image4.ViewValue = "" End If Listings.Image4.ViewCustomAttributes = "" ' Image5 Listings.Image5.UploadPath = "ListingImages/" If Not ew_Empty(Listings.Image5.Upload.DbValue) Then Listings.Image5.ViewValue = Listings.Image5.Upload.DbValue Listings.Image5.ImageAlt = Listings.Image5.FldAlt Listings.Image5.ViewValue = ew_UploadPathEx(False, Listings.Image5.UploadPath) & Listings.Image5.Upload.DbValue Else Listings.Image5.ViewValue = "" End If Listings.Image5.ViewCustomAttributes = "" ' Image6 Listings.Image6.UploadPath = "ListingImages/" If Not ew_Empty(Listings.Image6.Upload.DbValue) Then Listings.Image6.ViewValue = Listings.Image6.Upload.DbValue Listings.Image6.ImageAlt = Listings.Image6.FldAlt Listings.Image6.ViewValue = ew_UploadPathEx(False, Listings.Image6.UploadPath) & Listings.Image6.Upload.DbValue Else Listings.Image6.ViewValue = "" End If Listings.Image6.ViewCustomAttributes = "" ' Image7 Listings.Image7.UploadPath = "ListingImages/" If Not ew_Empty(Listings.Image7.Upload.DbValue) Then Listings.Image7.ViewValue = Listings.Image7.Upload.DbValue Listings.Image7.ImageAlt = Listings.Image7.FldAlt Listings.Image7.ViewValue = ew_UploadPathEx(False, Listings.Image7.UploadPath) & Listings.Image7.Upload.DbValue Else Listings.Image7.ViewValue = "" End If Listings.Image7.ViewCustomAttributes = "" ' Image8 Listings.Image8.UploadPath = "ListingImages/" If Not ew_Empty(Listings.Image8.Upload.DbValue) Then Listings.Image8.ViewValue = Listings.Image8.Upload.DbValue Listings.Image8.ImageAlt = Listings.Image8.FldAlt Listings.Image8.ViewValue = ew_UploadPathEx(False, Listings.Image8.UploadPath) & Listings.Image8.Upload.DbValue Else Listings.Image8.ViewValue = "" End If Listings.Image8.ViewCustomAttributes = "" ' Image10 Listings.Image10.UploadPath = "ListingImages/" If Not ew_Empty(Listings.Image10.Upload.DbValue) Then Listings.Image10.ViewValue = Listings.Image10.Upload.DbValue Listings.Image10.ImageAlt = Listings.Image10.FldAlt Listings.Image10.ViewValue = ew_UploadPathEx(False, Listings.Image10.UploadPath) & Listings.Image10.Upload.DbValue Else Listings.Image10.ViewValue = "" End If Listings.Image10.ViewCustomAttributes = "" ' Image11 Listings.Image11.UploadPath = "ListingImages/" If Not ew_Empty(Listings.Image11.Upload.DbValue) Then Listings.Image11.ViewValue = Listings.Image11.Upload.DbValue Listings.Image11.ImageAlt = Listings.Image11.FldAlt Listings.Image11.ViewValue = ew_UploadPathEx(False, Listings.Image11.UploadPath) & Listings.Image11.Upload.DbValue Else Listings.Image11.ViewValue = "" End If Listings.Image11.ViewCustomAttributes = "" ' Image12 Listings.Image12.UploadPath = "ListingImages/" If Not ew_Empty(Listings.Image12.Upload.DbValue) Then Listings.Image12.ViewValue = Listings.Image12.Upload.DbValue Listings.Image12.ImageAlt = Listings.Image12.FldAlt Listings.Image12.ViewValue = ew_UploadPathEx(False, Listings.Image12.UploadPath) & Listings.Image12.Upload.DbValue Else Listings.Image12.ViewValue = "" End If Listings.Image12.ViewCustomAttributes = "" ' State Listings.State.ViewValue = Listings.State.CurrentValue Listings.State.ViewCustomAttributes = "" ' Zip Listings.Zip.ViewValue = Listings.Zip.CurrentValue Listings.Zip.ViewCustomAttributes = "" ' Kitchen Listings.Kitchen.ViewValue = Listings.Kitchen.CurrentValue Listings.Kitchen.ViewCustomAttributes = "" ' Den Listings.Den.ViewValue = Listings.Den.CurrentValue Listings.Den.ViewCustomAttributes = "" ' UserName Listings.UserName.ViewValue = Listings.UserName.CurrentValue Listings.UserName.ViewCustomAttributes = "" ' L_UserID Listings.L_UserID.ViewValue = Listings.L_UserID.CurrentValue Listings.L_UserID.ViewCustomAttributes = "" ' AgencyID Listings.AgencyID.ViewValue = Listings.AgencyID.CurrentValue Listings.AgencyID.ViewCustomAttributes = "" ' Ref_Num Listings.Ref_Num.ViewValue = Listings.Ref_Num.CurrentValue Listings.Ref_Num.ViewCustomAttributes = "" ' iDate Listings.iDate.ViewValue = Listings.iDate.CurrentValue Listings.iDate.ViewValue = ew_FormatDateTime(Listings.iDate.ViewValue, 6) Listings.iDate.ViewCustomAttributes = "" ' fDate Listings.fDate.ViewValue = Listings.fDate.CurrentValue Listings.fDate.ViewValue = ew_FormatDateTime(Listings.fDate.ViewValue, 6) Listings.fDate.ViewCustomAttributes = "" ' ContractExpiryDate Listings.ContractExpiryDate.ViewValue = Listings.ContractExpiryDate.CurrentValue Listings.ContractExpiryDate.ViewValue = ew_FormatDateTime(Listings.ContractExpiryDate.ViewValue, 6) Listings.ContractExpiryDate.ViewCustomAttributes = "" ' LivingRoom Listings.LivingRoom.ViewValue = Listings.LivingRoom.CurrentValue Listings.LivingRoom.ViewCustomAttributes = "" ' Office Listings.Office.ViewValue = Listings.Office.CurrentValue Listings.Office.ViewCustomAttributes = "" ' DiningRoom Listings.DiningRoom.ViewValue = Listings.DiningRoom.CurrentValue Listings.DiningRoom.ViewCustomAttributes = "" ' MasterBath Listings.MasterBath.ViewValue = Listings.MasterBath.CurrentValue Listings.MasterBath.ViewCustomAttributes = "" ' OtherBath Listings.OtherBath.ViewValue = Listings.OtherBath.CurrentValue Listings.OtherBath.ViewCustomAttributes = "" ' OtherBath1 Listings.OtherBath1.ViewValue = Listings.OtherBath1.CurrentValue Listings.OtherBath1.ViewCustomAttributes = "" ' Bedroom1 Listings.Bedroom1.ViewValue = Listings.Bedroom1.CurrentValue Listings.Bedroom1.ViewCustomAttributes = "" ' Bedroom2 Listings.Bedroom2.ViewValue = Listings.Bedroom2.CurrentValue Listings.Bedroom2.ViewCustomAttributes = "" ' Bedroom3 Listings.Bedroom3.ViewValue = Listings.Bedroom3.CurrentValue Listings.Bedroom3.ViewCustomAttributes = "" ' Bedroom4 Listings.Bedroom4.ViewValue = Listings.Bedroom4.CurrentValue Listings.Bedroom4.ViewCustomAttributes = "" ' Bedroom5 Listings.Bedroom5.ViewValue = Listings.Bedroom5.CurrentValue Listings.Bedroom5.ViewCustomAttributes = "" ' TextPrice Listings.TextPrice.ViewValue = Listings.TextPrice.CurrentValue Listings.TextPrice.ViewCustomAttributes = "" ' Photo2 Listings.Photo2.ViewValue = Listings.Photo2.CurrentValue Listings.Photo2.ViewCustomAttributes = "" ' Thumbnail Listings.Thumbnail.UploadPath = "listingimages/" If Not ew_Empty(Listings.Thumbnail.Upload.DbValue) Then Listings.Thumbnail.ViewValue = Listings.Thumbnail.Upload.DbValue Listings.Thumbnail.ImageWidth = 180 Listings.Thumbnail.ImageHeight = 0 Listings.Thumbnail.ImageAlt = Listings.Thumbnail.FldAlt Listings.Thumbnail.ViewValue = ew_UploadPathEx(False, Listings.Thumbnail.UploadPath) & Listings.Thumbnail.Upload.DbValue Else Listings.Thumbnail.ViewValue = "" End If Listings.Thumbnail.ViewCustomAttributes = "" ' MainThumbnail Listings.MainThumbnail.UploadPath = "/ListingImages/" If Not ew_Empty(Listings.MainThumbnail.Upload.DbValue) Then Listings.MainThumbnail.ViewValue = Listings.MainThumbnail.Upload.DbValue Listings.MainThumbnail.ImageWidth = 180 Listings.MainThumbnail.ImageHeight = 0 Listings.MainThumbnail.ImageAlt = Listings.MainThumbnail.FldAlt Listings.MainThumbnail.ViewValue = ew_UploadPathEx(False, Listings.MainThumbnail.UploadPath) & Listings.MainThumbnail.Upload.DbValue Else Listings.MainThumbnail.ViewValue = "" End If Listings.MainThumbnail.ViewCustomAttributes = "" ' Email Listings.zEmail.ViewValue = Listings.zEmail.CurrentValue Listings.zEmail.ViewCustomAttributes = "" ' URL Listings.URL.ViewValue = Listings.URL.CurrentValue Listings.URL.ViewCustomAttributes = "" ' Garage Listings.Garage.ViewValue = Listings.Garage.CurrentValue Listings.Garage.ViewCustomAttributes = "" ' other_info Listings.other_info.ViewValue = Listings.other_info.CurrentValue Listings.other_info.ViewCustomAttributes = "" ' Fd_Size Listings.Fd_Size.ViewValue = Listings.Fd_Size.CurrentValue Listings.Fd_Size.ViewCustomAttributes = "" ' Location Listings.Location.ViewValue = Listings.Location.CurrentValue Listings.Location.ViewCustomAttributes = "" ' Shore_Rights Listings.Shore_Rights.ViewValue = Listings.Shore_Rights.CurrentValue Listings.Shore_Rights.ViewCustomAttributes = "" ' ImagesDirectory Listings.ImagesDirectory.ViewValue = Listings.ImagesDirectory.CurrentValue Listings.ImagesDirectory.ViewCustomAttributes = "" ' LotNum Listings.LotNum.ViewValue = Listings.LotNum.CurrentValue Listings.LotNum.ViewCustomAttributes = "" ' Condition Listings.Condition.ViewValue = Listings.Condition.CurrentValue Listings.Condition.ViewCustomAttributes = "" ' HeatingCost Listings.HeatingCost.ViewValue = Listings.HeatingCost.CurrentValue Listings.HeatingCost.ViewCustomAttributes = "" ' Windows Listings.Windows.ViewValue = Listings.Windows.CurrentValue Listings.Windows.ViewCustomAttributes = "" ' Thumb1 Listings.Thumb1.ViewValue = Listings.Thumb1.CurrentValue Listings.Thumb1.ViewCustomAttributes = "" ' Thumb2 Listings.Thumb2.ViewValue = Listings.Thumb2.CurrentValue Listings.Thumb2.ViewCustomAttributes = "" ' Thumb3 Listings.Thumb3.ViewValue = Listings.Thumb3.CurrentValue Listings.Thumb3.ViewCustomAttributes = "" ' Thumb4 Listings.Thumb4.ViewValue = Listings.Thumb4.CurrentValue Listings.Thumb4.ViewCustomAttributes = "" ' Thumb5 Listings.Thumb5.ViewValue = Listings.Thumb5.CurrentValue Listings.Thumb5.ViewCustomAttributes = "" ' Thumb6 Listings.Thumb6.ViewValue = Listings.Thumb6.CurrentValue Listings.Thumb6.ViewCustomAttributes = "" ' Thumb7 Listings.Thumb7.ViewValue = Listings.Thumb7.CurrentValue Listings.Thumb7.ViewCustomAttributes = "" ' Thumb8 Listings.Thumb8.ViewValue = Listings.Thumb8.CurrentValue Listings.Thumb8.ViewCustomAttributes = "" ' Hit_Counter Listings.Hit_Counter.ViewValue = Listings.Hit_Counter.CurrentValue Listings.Hit_Counter.ViewCustomAttributes = "" ' Thumb9 Listings.Thumb9.ViewValue = Listings.Thumb9.CurrentValue Listings.Thumb9.ViewCustomAttributes = "" ' Thumb10 Listings.Thumb10.ViewValue = Listings.Thumb10.CurrentValue Listings.Thumb10.ViewCustomAttributes = "" ' Thumb11 Listings.Thumb11.ViewValue = Listings.Thumb11.CurrentValue Listings.Thumb11.ViewCustomAttributes = "" ' Thumb12 Listings.Thumb12.ViewValue = Listings.Thumb12.CurrentValue Listings.Thumb12.ViewCustomAttributes = "" ' Thumb13 Listings.Thumb13.ViewValue = Listings.Thumb13.CurrentValue Listings.Thumb13.ViewCustomAttributes = "" ' Thumb14 Listings.Thumb14.ViewValue = Listings.Thumb14.CurrentValue Listings.Thumb14.ViewCustomAttributes = "" ' Thumb15 Listings.Thumb15.ViewValue = Listings.Thumb15.CurrentValue Listings.Thumb15.ViewCustomAttributes = "" ' Thumb16 Listings.Thumb16.ViewValue = Listings.Thumb16.CurrentValue Listings.Thumb16.ViewCustomAttributes = "" ' Image9 Listings.Image9.ViewValue = Listings.Image9.CurrentValue Listings.Image9.ViewCustomAttributes = "" ' Image13 Listings.Image13.ViewValue = Listings.Image13.CurrentValue Listings.Image13.ViewCustomAttributes = "" ' Image14 Listings.Image14.ViewValue = Listings.Image14.CurrentValue Listings.Image14.ViewCustomAttributes = "" ' Image15 Listings.Image15.ViewValue = Listings.Image15.CurrentValue Listings.Image15.ViewCustomAttributes = "" ' Image16 Listings.Image16.ViewValue = Listings.Image16.CurrentValue Listings.Image16.ViewCustomAttributes = "" ' Activate If ew_ConvertToBool(Listings.Activate.CurrentValue) Then Listings.Activate.ViewValue = ew_IIf(Listings.Activate.FldTagCaption(1) <> "", Listings.Activate.FldTagCaption(1), "Yes") Else Listings.Activate.ViewValue = ew_IIf(Listings.Activate.FldTagCaption(2) <> "", Listings.Activate.FldTagCaption(2), "No") End If Listings.Activate.ViewCustomAttributes = "" ' View Listings.View.ViewValue = Listings.View.CurrentValue Listings.View.ViewCustomAttributes = "" ' BuildingSize Listings.BuildingSize.ViewValue = Listings.BuildingSize.CurrentValue Listings.BuildingSize.ViewCustomAttributes = "" ' Featured If ew_ConvertToBool(Listings.Featured.CurrentValue) Then Listings.Featured.ViewValue = ew_IIf(Listings.Featured.FldTagCaption(1) <> "", Listings.Featured.FldTagCaption(1), "Yes") Else Listings.Featured.ViewValue = ew_IIf(Listings.Featured.FldTagCaption(2) <> "", Listings.Featured.FldTagCaption(2), "No") End If Listings.Featured.ViewCustomAttributes = "" ' View refer script ' ID Listings.ID.LinkCustomAttributes = "" Listings.ID.HrefValue = "" Listings.ID.TooltipValue = "" ' ListNum Listings.ListNum.LinkCustomAttributes = "" Listings.ListNum.HrefValue = "" Listings.ListNum.TooltipValue = "" ' Price Listings.Price.LinkCustomAttributes = "" Listings.Price.HrefValue = "" Listings.Price.TooltipValue = "" ' Category Listings.Category.LinkCustomAttributes = "" Listings.Category.HrefValue = "" Listings.Category.TooltipValue = "" ' Address Listings.Address.LinkCustomAttributes = "" Listings.Address.HrefValue = "" Listings.Address.TooltipValue = "" ' City Listings.City.LinkCustomAttributes = "" Listings.City.HrefValue = "" Listings.City.TooltipValue = "" ' Style Listings.Style.LinkCustomAttributes = "" Listings.Style.HrefValue = "" Listings.Style.TooltipValue = "" ' Bedrooms Listings.Bedrooms.LinkCustomAttributes = "" Listings.Bedrooms.HrefValue = "" Listings.Bedrooms.TooltipValue = "" ' Baths Listings.Baths.LinkCustomAttributes = "" Listings.Baths.HrefValue = "" Listings.Baths.TooltipValue = "" ' LotSize Listings.LotSize.LinkCustomAttributes = "" Listings.LotSize.HrefValue = "" Listings.LotSize.TooltipValue = "" ' MainThumbnail Listings.MainThumbnail.LinkCustomAttributes = "" Listings.MainThumbnail.HrefValue = "" Listings.MainThumbnail.HrefValue2 = Listings.MainThumbnail.UploadPath & Listings.MainThumbnail.Upload.DbValue Listings.MainThumbnail.TooltipValue = "" End If ' Call Row Rendered event If Listings.RowType <> EW_ROWTYPE_AGGREGATEINIT Then Call Listings.Row_Rendered() End If End Sub ' ----------------------------------------------------------------- ' Validate search ' Function ValidateSearch() ' Initialize gsSearchError = "" ' Check if validation required If Not EW_SERVER_VALIDATE Then ValidateSearch = True Exit Function End If ' Return validate result ValidateSearch = (gsSearchError = "") ' Call Form Custom Validate event Dim sFormCustomError sFormCustomError = "" ValidateSearch = ValidateSearch And Form_CustomValidate(sFormCustomError) If sFormCustomError <> "" Then Call ew_AddMessage(gsSearchError, sFormCustomError) End If End Function ' ----------------------------------------------------------------- ' Load advanced search ' Function LoadAdvancedSearch() Call Listings.ListNum.AdvancedSearch.Load() Call Listings.Price.AdvancedSearch.Load() Call Listings.Category.AdvancedSearch.Load() Call Listings.City.AdvancedSearch.Load() Call Listings.Bedrooms.AdvancedSearch.Load() Call Listings.Baths.AdvancedSearch.Load() Call Listings.water_body.AdvancedSearch.Load() End Function ' Set up Breadcrumb Sub SetupBreadcrumb() Dim PageCaption, url Set Breadcrumb = New cBreadcrumb PageCaption = Listings.TableCaption url = ew_CurrentUrl url = ew_RegExReplace("\?cmd=reset(all){0,1}$", url, "") ' Remove cmd=reset / cmd=resetall Call Breadcrumb.Add("list", "" & PageCaption & "", url, Listings.TableVar) End Sub Sub ExportPdf(html) Response.Write html End Sub ' Page Load event Sub Page_Load() 'Response.Write "Page Load" Listings.ID.Visible=False Listings.ListNum.Visible=False Listings.Style.Visible=False Listings.LotSize.Visible=False Listings.Category.Visible=False Listings.Address.Visible=False Listings.City.Visible=False Listings.Bedrooms.Visible=False Listings.Baths.Visible=False Listings.Price.Visible=False Listings.MainThumbnail.Visible=False End Sub ' Page Unload event Sub Page_Unload() 'Response.Write "Page Unload" End Sub ' Page Redirecting event Sub Page_Redirecting(url) 'url = newurl End Sub ' Message Showing event ' typ = ""|"success"|"failure"|"warning" Sub Message_Showing(msg, typ) ' Example: 'If typ = "success" Then ' msg = "your success message" 'ElseIf typ = "failure" Then ' msg = "your failure message" 'ElseIf typ = "warning" Then ' msg = "your warning message" 'Else ' msg = "your message" 'End If End Sub ' Page Render event Sub Page_Render() 'Response.Write "Page Render" End Sub ' Page Data Rendering event Sub Page_DataRendering(header) ' Example: 'header = "your header" header = "" End Sub ' Page Data Rendered event Sub Page_DataRendered(footer) ' Example: 'footer = "your footer" End Sub ' Form Custom Validate event Function Form_CustomValidate(CustomError) 'Return error message in CustomError Form_CustomValidate = True End Function ' ListOptions Load event Sub ListOptions_Load() 'Example: ' Dim opt ' Set opt = ListOptions.Add("new") ' opt.OnLeft = True ' Link on left ' opt.MoveTo 0 ' Move to first column Dim opt Set opt = ListOptions.Add("listing") opt.OnLeft = False ' Link on left opt.MoveTo 0 ' Move to first column End Sub ' ListOptions Rendered event Sub ListOptions_Rendered() 'Example: 'ListOptions.GetItem("new").Body = "xxx" ListOptions.GetItem("listing").Body = "
" & Listings.ListNum.ViewValue & "
" End Sub ' Row Custom Action event Function Row_CustomAction(action, rs) ' Return False to abort Row_CustomAction = True End Function End Class %>