<% ' Initialize common variables x_CarID = Null: ox_CarID = Null: z_CarID = Null x_CarShortTXT = Null: ox_CarShortTXT = Null: z_CarShortTXT = Null x_CarPreviewImageSmall = Null: ox_CarPreviewImageSmall = Null: z_CarPreviewImageSmall = Null fs_x_CarPreviewImageSmall = 0: fn_x_CarPreviewImageSmall = "": ct_x_CarPreviewImageSmall = "" wd_x_CarPreviewImageSmall = 0: ht_x_CarPreviewImageSmall = 0: a_x_CarPreviewImageSmall = "" x_CarPreviewImageBig = Null: ox_CarPreviewImageBig = Null: z_CarPreviewImageBig = Null fs_x_CarPreviewImageBig = 0: fn_x_CarPreviewImageBig = "": ct_x_CarPreviewImageBig = "" wd_x_CarPreviewImageBig = 0: ht_x_CarPreviewImageBig = 0: a_x_CarPreviewImageBig = "" x_CarPrice = Null: ox_CarPrice = Null: z_CarPrice = Null x_CarOrderNo = Null: ox_CarOrderNo = Null: z_CarOrderNo = Null x_CarModel = Null: ox_CarModel = Null: z_CarModel = Null x_CarDetails = Null: ox_CarDetails = Null: z_CarDetails = Null x_CarExtra = Null: ox_CarExtra = Null: z_CarExtra = Null x_CarImage1S = Null: ox_CarImage1S = Null: z_CarImage1S = Null fs_x_CarImage1S = 0: fn_x_CarImage1S = "": ct_x_CarImage1S = "" wd_x_CarImage1S = 0: ht_x_CarImage1S = 0: a_x_CarImage1S = "" x_CarImage1B = Null: ox_CarImage1B = Null: z_CarImage1B = Null fs_x_CarImage1B = 0: fn_x_CarImage1B = "": ct_x_CarImage1B = "" wd_x_CarImage1B = 0: ht_x_CarImage1B = 0: a_x_CarImage1B = "" x_CarImage2S = Null: ox_CarImage2S = Null: z_CarImage2S = Null fs_x_CarImage2S = 0: fn_x_CarImage2S = "": ct_x_CarImage2S = "" wd_x_CarImage2S = 0: ht_x_CarImage2S = 0: a_x_CarImage2S = "" x_CarImage2B = Null: ox_CarImage2B = Null: z_CarImage2B = Null fs_x_CarImage2B = 0: fn_x_CarImage2B = "": ct_x_CarImage2B = "" wd_x_CarImage2B = 0: ht_x_CarImage2B = 0: a_x_CarImage2B = "" x_CarImage3S = Null: ox_CarImage3S = Null: z_CarImage3S = Null fs_x_CarImage3S = 0: fn_x_CarImage3S = "": ct_x_CarImage3S = "" wd_x_CarImage3S = 0: ht_x_CarImage3S = 0: a_x_CarImage3S = "" x_CarImage3B = Null: ox_CarImage3B = Null: z_CarImage3B = Null fs_x_CarImage3B = 0: fn_x_CarImage3B = "": ct_x_CarImage3B = "" wd_x_CarImage3B = 0: ht_x_CarImage3B = 0: a_x_CarImage3B = "" x_CarImage4S = Null: ox_CarImage4S = Null: z_CarImage4S = Null fs_x_CarImage4S = 0: fn_x_CarImage4S = "": ct_x_CarImage4S = "" wd_x_CarImage4S = 0: ht_x_CarImage4S = 0: a_x_CarImage4S = "" x_CarImage4B = Null: ox_CarImage4B = Null: z_CarImage4B = Null fs_x_CarImage4B = 0: fn_x_CarImage4B = "": ct_x_CarImage4B = "" wd_x_CarImage4B = 0: ht_x_CarImage4B = 0: a_x_CarImage4B = "" x_CarImage5S = Null: ox_CarImage5S = Null: z_CarImage5S = Null fs_x_CarImage5S = 0: fn_x_CarImage5S = "": ct_x_CarImage5S = "" wd_x_CarImage5S = 0: ht_x_CarImage5S = 0: a_x_CarImage5S = "" x_CarImage5B = Null: ox_CarImage5B = Null: z_CarImage5B = Null fs_x_CarImage5B = 0: fn_x_CarImage5B = "": ct_x_CarImage5B = "" wd_x_CarImage5B = 0: ht_x_CarImage5B = 0: a_x_CarImage5B = "" %> <% sExport = Request.QueryString("export") ' Load Export Request If sExport = "word" Then Response.ContentType = "application/vnd.ms-word" Response.AddHeader "Content-Disposition:", "attachment; filename=" & ewTblVar & ".doc" End If %> <% nStartRec = 0 nStopRec = 0 nTotalRecs = 0 nRecCount = 0 nRecActual = 0 sDbWhereMaster = "" sDbWhereDetail = "" sSrchAdvanced = "" psearch = "" psearchtype = "" sSrchBasic = "" sSrchWhere = "" sDbWhere = "" sOrderBy = "CarOrderNo" sSqlMaster = "" nDisplayRecs = 20 nRecRange = 10 ' Multi Column nRecPerRow = 3 ' Open connection to the database Set conn = Server.CreateObject("ADODB.Connection") conn.Open xDb_Conn_Str ' Handle Reset Command ResetCmd() ' Get Search Criteria for Basic Search SetUpBasicSearch() ' Build Search Criteria If sSrchAdvanced <> "" Then If sSrchWhere <> "" Then sSrchWhere = sSrchWhere & " AND " sSrchWhere = sSrchWhere & "(" & sSrchAdvanced & ")" End If If sSrchBasic <> "" Then If sSrchWhere <> "" Then sSrchWhere = sSrchWhere & " AND " sSrchWhere = sSrchWhere & "(" & sSrchBasic & ")" End If ' Save Search Criteria If sSrchWhere <> "" Then Session(ewSessionTblSearchWhere) = sSrchWhere nStartRec = 1 ' reset start record counter Session(ewSessionTblStartRec) = nStartRec Else sSrchWhere = Session(ewSessionTblSearchWhere) Call RestoreSearch() End If ' Build Filter condition sDbWhere = "" If sDbWhereDetail <> "" Then If sDbWhere <> "" Then sDbWhere = sDbWhere & " AND " sDbWhere = sDbWhere & "(" & sDbWhereDetail & ")" End If If sSrchWhere <> "" Then If sDbWhere <> "" Then sDbWhere = sDbWhere & " AND " sDbWhere = sDbWhere & "(" & sSrchWhere & ")" End If ' Set Up Sorting Order SetUpSortOrder() sOrderBy = "CarOrderNo" ' Set up SQL sSql = ewBuildSql(ewSqlSelect, ewSqlWhere, ewSqlGroupBy, ewSqlHaving, ewSqlOrderBy, sDbWhere, sOrderBy) 'Response.Write sSql ' Uncomment to show SQL for debugging %> <% If sExport <> "word" And sExport <> "excel" Then %> <% End If %> <% ' Set up Record Set Set rs = Server.CreateObject("ADODB.Recordset") rs.CursorLocation = 2 rs.Open sSql, conn, 1, 2 nTotalRecs = rs.RecordCount If nDisplayRecs <= 0 Then ' Display All Records nDisplayRecs = nTotalRecs End If nStartRec = 1 SetUpStartRec() ' Set Up Start Record Position %> <% If sExport = "" Then %>
ΑΝΑΖΗΤΗΣΗ  
    Show all  checked<% End If %>> Exact phrase   checked<% End If %>> All words   checked<% End If %>> Any word
 
<% End If %> <% If sExport = "" Then %>

<% End If %> <% If Session(ewSessionMessage) <> "" Then %>

<%= Session(ewSessionMessage) %>

<% Session(ewSessionMessage) = "" ' Clear message End If %> <% If nTotalRecs > 0 Then %>
<% ' Set the last record to display nStopRec = nStartRec + nDisplayRecs - 1 ' Move to first record directly for performance reason nRecCount = nStartRec - 1 If Not rs.Eof Then rs.MoveFirst rs.Move nStartRec - 1 End If nRecActual = 0 Do While (Not rs.Eof) And (nRecCount < nStopRec) nRecCount = nRecCount + 1 If CLng(nRecCount) >= CLng(nStartRec) Then nRecActual = nRecActual + 1 ' Set row color sItemRowClass = " class=""ewTableRow""" sListTrJs = "" ' Display alternate color for rows If nRecCount Mod 2 <> 1 Then sItemRowClass = " class=""ewTableRow""" End If x_CarID = rs("CarID") x_CarShortTXT = rs("CarShortTXT") x_CarPreviewImageSmall = rs("CarPreviewImageSmall") x_CarPreviewImageBig = rs("CarPreviewImageBig") x_CarPrice = rs("CarPrice") x_CarOrderNo = rs("CarOrderNo") x_CarModel = rs("CarModel") x_CarDetails = rs("CarDetails") x_CarExtra = rs("CarExtra") x_CarImage1S = rs("CarImage1S") x_CarImage1B = rs("CarImage1B") x_CarImage2S = rs("CarImage2S") x_CarImage2B = rs("CarImage2B") x_CarImage3S = rs("CarImage3S") x_CarImage3B = rs("CarImage3B") x_CarImage4S = rs("CarImage4S") x_CarImage4B = rs("CarImage4B") x_CarImage5S = rs("CarImage5S") x_CarImage5B = rs("CarImage5B") %> <% If (nRecActual Mod nRecPerRow = 1) OR (nRecPerRow < 2) Then %> <% End If %> <% If (nRecActual Mod nRecPerRow = 0) Or (nRecPerRow < 2) Then %> <% End If %> <% End If rs.MoveNext Loop %> <% If (nRecActual Mod nRecPerRow) <> 0 Then For i = 1 to (nRecPerRow - nRecActual Mod nRecPerRow) %> <% Next %> <% End If %>
>
<% Response.Write x_CarShortTXT %>
<% If Not IsNull(x_CarPreviewImageSmall) Then %> <% If Not IsNull(x_CarPreviewImageBig) Then %> <% End If %> <% End If %>
Τιμή: <% Response.Write x_CarPrice %> €

<% If sExport = "" Then %> ">Εμφάνιση  <% End If %>
 
<% If sExport = "" Then %> <% If nRecActual > 0 Then %> <% End If %> <% End If %>
<% End If %> <% ' Close recordset and connection rs.Close Set rs = Nothing conn.Close Set conn = Nothing %> <% If sExport = "" Then %>
<% If nTotalRecs > 0 Then rsEof = (nTotalRecs < (nStartRec + nDisplayRecs)) PrevStart = nStartRec - nDisplayRecs If PrevStart < 1 Then PrevStart = 1 NextStart = nStartRec + nDisplayRecs If NextStart > nTotalRecs Then NextStart = nStartRec LastStart = ((nTotalRecs-1)\nDisplayRecs)*nDisplayRecs+1 %> <% If CLng(nStartRec)=1 Then %> <% Else %> <% End If %> <% If CLng(PrevStart) = CLng(nStartRec) Then %> <% Else %> <% End If %> <% If CLng(NextStart) = CLng(nStartRec) Then %> <% Else %> <% End If %> <% If CLng(LastStart) = CLng(nStartRec) Then %> <% Else %> <% End If %>
Σελίδα  FirstFirstPreviousPrevious NextNextLastLast από <%=(nTotalRecs-1)\nDisplayRecs+1%>
<% If CLng(nStartRec) > CLng(nTotalRecs) Then nStartRec = nTotalRecs nStopRec = nStartRec + nDisplayRecs - 1 nRecCount = nTotalRecs - 1 If rsEOF Then nRecCount = nTotalRecs If nStopRec > nRecCount Then nStopRec = nRecCount %> Εγγραφές<%= nStartRec %>σε<%= nStopRec %>από<%= nTotalRecs %> <% Else %> <% If sSrchWhere = "0=101" Then %> <% Else %> δεν βρέθηκαν εγγραφές! <% End If %> <% End If %>
<% End If %> <% If sExport = "" Then %> <% End If %> <% If sExport <> "word" And sExport <> "excel" Then %> <% End If %> <% '------------------------------------------------------------------------------- ' Function BasicSearchSQL ' - Build WHERE clause for a keyword Function BasicSearchSQL(Keyword) Dim sKeyword sKeyword = AdjustSql(Keyword) BasicSearchSQL = "" BasicSearchSQL = BasicSearchSQL & "[CarShortTXT] LIKE '%" & sKeyword & "%' OR " BasicSearchSQL = BasicSearchSQL & "[CarPreviewImageSmall] LIKE '%" & sKeyword & "%' OR " BasicSearchSQL = BasicSearchSQL & "[CarPreviewImageBig] LIKE '%" & sKeyword & "%' OR " BasicSearchSQL = BasicSearchSQL & "[CarDetails] LIKE '%" & sKeyword & "%' OR " BasicSearchSQL = BasicSearchSQL & "[CarExtra] LIKE '%" & sKeyword & "%' OR " BasicSearchSQL = BasicSearchSQL & "[CarImage1S] LIKE '%" & sKeyword & "%' OR " BasicSearchSQL = BasicSearchSQL & "[CarImage1B] LIKE '%" & sKeyword & "%' OR " BasicSearchSQL = BasicSearchSQL & "[CarImage2S] LIKE '%" & sKeyword & "%' OR " BasicSearchSQL = BasicSearchSQL & "[CarImage2B] LIKE '%" & sKeyword & "%' OR " BasicSearchSQL = BasicSearchSQL & "[CarImage3S] LIKE '%" & sKeyword & "%' OR " BasicSearchSQL = BasicSearchSQL & "[CarImage3B] LIKE '%" & sKeyword & "%' OR " BasicSearchSQL = BasicSearchSQL & "[CarImage4S] LIKE '%" & sKeyword & "%' OR " BasicSearchSQL = BasicSearchSQL & "[CarImage4B] LIKE '%" & sKeyword & "%' OR " BasicSearchSQL = BasicSearchSQL & "[CarImage5S] LIKE '%" & sKeyword & "%' OR " BasicSearchSQL = BasicSearchSQL & "[CarImage5B] LIKE '%" & sKeyword & "%' OR " If Right(BasicSearchSQL, 4) = " OR " Then BasicSearchSQL = Left(BasicSearchSQL, Len(BasicSearchSQL)-4) End Function '------------------------------------------------------------------------------- ' Function SetUpBasicSearch ' - Set up Basic Search parameter based on form elements pSearch & pSearchType ' - Variables setup: sSrchBasic Sub SetUpBasicSearch() Dim arKeyword, sKeyword psearch = Request.QueryString(ewTblBasicSrch) psearchtype = Request.QueryString(ewTblBasicSrchType) If psearch <> "" Then If psearchtype <> "" Then While InStr(psearch, " ") > 0 sSearch = Replace(psearch, " ", " ") Wend arKeyword = Split(Trim(psearch), " ") For Each sKeyword In arKeyword sSrchBasic = sSrchBasic & "(" & BasicSearchSQL(sKeyword) & ") " & psearchtype & " " Next Else sSrchBasic = BasicSearchSQL(psearch) End If End If If Right(sSrchBasic, 4) = " OR " Then sSrchBasic = Left(sSrchBasic, Len(sSrchBasic)-4) If Right(sSrchBasic, 5) = " AND " Then sSrchBasic = Left(sSrchBasic, Len(sSrchBasic)-5) If psearch <> "" then Session(ewSessionTblBasicSrch) = psearch Session(ewSessionTblBasicSrchType) = psearchtype End If End Sub '------------------------------------------------------------------------------- ' Function ResetSearch ' - Clear all search parameters ' Sub ResetSearch() ' Clear search where sSrchWhere = "" Session(ewSessionTblSearchWhere) = sSrchWhere ' Clear advanced search parameters Session(ewSessionTblAdvSrch & "_x_CarID") = "" Session(ewSessionTblAdvSrch & "_x_CarShortTXT") = "" Session(ewSessionTblAdvSrch & "_x_CarPrice") = "" Session(ewSessionTblAdvSrch & "_x_CarOrderNo") = "" Session(ewSessionTblAdvSrch & "_x_CarModel") = "" Session(ewSessionTblAdvSrch & "_x_CarDetails") = "" Session(ewSessionTblAdvSrch & "_x_CarExtra") = "" Session(ewSessionTblBasicSrch) = "" Session(ewSessionTblBasicSrchType) = "" End Sub '------------------------------------------------------------------------------- ' Function RestoreSearch ' - Restore all search parameters ' Sub RestoreSearch() ' Restore advanced search settings x_CarID = Session(ewSessionTblAdvSrch & "_x_CarID") x_CarShortTXT = Session(ewSessionTblAdvSrch & "_x_CarShortTXT") x_CarPrice = Session(ewSessionTblAdvSrch & "_x_CarPrice") x_CarOrderNo = Session(ewSessionTblAdvSrch & "_x_CarOrderNo") x_CarModel = Session(ewSessionTblAdvSrch & "_x_CarModel") x_CarDetails = Session(ewSessionTblAdvSrch & "_x_CarDetails") x_CarExtra = Session(ewSessionTblAdvSrch & "_x_CarExtra") psearch = Session(ewSessionTblBasicSrch) psearchtype = Session(ewSessionTblBasicSrchType) End Sub '------------------------------------------------------------------------------- ' Function SetUpSortOrder ' - Set up Sort parameters based on Sort Links clicked ' - Variables setup: sOrderBy, Session(TblOrderBy), Session(Tbl_Field_Sort) Sub SetUpSortOrder() Dim sOrder, sSortField, sLastSort, sThisSort Dim bCtrl ' Check for an Order parameter If Request.QueryString("order").Count > 0 Then sOrder = Request.QueryString("order") ' Field [CarShortTXT] If sOrder = "CarShortTXT" Then sSortField = "[CarShortTXT]" sLastSort = Session(ewSessionTblSort & "_x_CarShortTXT") If sLastSort = "ASC" Then sThisSort = "DESC" Else sThisSort = "ASC" Session(ewSessionTblSort & "_x_CarShortTXT") = sThisSort Else If Session(ewSessionTblSort & "_x_CarShortTXT") <> "" Then Session(ewSessionTblSort & "_x_CarShortTXT") = "" End If ' Field [CarPreviewImageSmall] If sOrder = "CarPreviewImageSmall" Then sSortField = "[CarPreviewImageSmall]" sLastSort = Session(ewSessionTblSort & "_x_CarPreviewImageSmall") If sLastSort = "ASC" Then sThisSort = "DESC" Else sThisSort = "ASC" Session(ewSessionTblSort & "_x_CarPreviewImageSmall") = sThisSort Else If Session(ewSessionTblSort & "_x_CarPreviewImageSmall") <> "" Then Session(ewSessionTblSort & "_x_CarPreviewImageSmall") = "" End If ' Field [CarPreviewImageBig] If sOrder = "CarPreviewImageBig" Then sSortField = "[CarPreviewImageBig]" sLastSort = Session(ewSessionTblSort & "_x_CarPreviewImageBig") If sLastSort = "ASC" Then sThisSort = "DESC" Else sThisSort = "ASC" Session(ewSessionTblSort & "_x_CarPreviewImageBig") = sThisSort Else If Session(ewSessionTblSort & "_x_CarPreviewImageBig") <> "" Then Session(ewSessionTblSort & "_x_CarPreviewImageBig") = "" End If ' Field [CarPrice] If sOrder = "CarPrice" Then sSortField = "[CarPrice]" sLastSort = Session(ewSessionTblSort & "_x_CarPrice") If sLastSort = "ASC" Then sThisSort = "DESC" Else sThisSort = "ASC" Session(ewSessionTblSort & "_x_CarPrice") = sThisSort Else If Session(ewSessionTblSort & "_x_CarPrice") <> "" Then Session(ewSessionTblSort & "_x_CarPrice") = "" End If ' Field [CarOrderNo] If sOrder = "CarOrderNo" Then sSortField = "[CarOrderNo]" sLastSort = Session(ewSessionTblSort & "_x_CarOrderNo") If sLastSort = "ASC" Then sThisSort = "DESC" Else sThisSort = "ASC" Session(ewSessionTblSort & "_x_CarOrderNo") = sThisSort Else If Session(ewSessionTblSort & "_x_CarOrderNo") <> "" Then Session(ewSessionTblSort & "_x_CarOrderNo") = "" End If ' Field [CarModel] If sOrder = "CarModel" Then sSortField = "[CarModel]" sLastSort = Session(ewSessionTblSort & "_x_CarModel") If sLastSort = "ASC" Then sThisSort = "DESC" Else sThisSort = "ASC" Session(ewSessionTblSort & "_x_CarModel") = sThisSort Else If Session(ewSessionTblSort & "_x_CarModel") <> "" Then Session(ewSessionTblSort & "_x_CarModel") = "" End If Session(ewSessionTblOrderBy) = sSortField & " " & sThisSort Session(ewSessionTblStartRec) = 1 End If sOrderBy = Session(ewSessionTblOrderBy) If sOrderBy = "" Then If ewSqlOrderBy <> "" And ewSqlOrderBySessions <> "" Then sOrderBy = ewSqlOrderBy Session(ewSessionTblOrderBy) = sOrderBy Dim arOrderBy, i arOrderBy = Split(ewSqlOrderBySessions, ",") For i = 0 to UBound(arOrderBy)\2 Session(ewSessionTblSort & "_" & arOrderBy(i*2)) = arOrderBy(i*2+1) Next End If End If End Sub '------------------------------------------------------------------------------- ' Function SetUpStartRec ' - Set up Starting Record parameters based on Pager Navigation ' - Variables setup: nStartRec Sub SetUpStartRec() Dim nPageNo ' Check for a START parameter If Request.QueryString(ewTblStartRec).Count > 0 Then nStartRec = Request.QueryString(ewTblStartRec) Session(ewSessionTblStartRec) = nStartRec ElseIf Request.QueryString("pageno").Count > 0 Then nPageNo = Request.QueryString("pageno") If IsNumeric(nPageNo) Then nStartRec = (nPageNo-1)*nDisplayRecs+1 If nStartRec <= 0 Then nStartRec = 1 ElseIf nStartRec >= ((nTotalRecs-1)\nDisplayRecs)*nDisplayRecs+1 Then nStartRec = ((nTotalRecs-1)\nDisplayRecs)*nDisplayRecs+1 End If Session(ewSessionTblStartRec) = nStartRec Else nStartRec = Session(ewSessionTblStartRec) End If Else nStartRec = Session(ewSessionTblStartRec) End If ' Check if correct start record counter If Not IsNumeric(nStartRec) Or nStartRec = "" Then ' Avoid invalid start record counter nStartRec = 1 ' Reset start record counter Session(ewSessionTblStartRec) = nStartRec ElseIf CLng(nStartRec) > CLng(nTotalRecs) Then ' Avoid starting record > total records nStartRec = ((nTotalRecs-1)\nDisplayRecs)*nDisplayRecs+1 ' point to last page first record Session(ewSessionTblStartRec) = nStartRec End If End Sub '------------------------------------------------------------------------------- ' Function ResetCmd ' - Clear list page parameters ' - RESET: reset search parameters ' - RESETALL: reset search & master/detail parameters ' - RESETSORT: reset sort parameters Sub ResetCmd() Dim sCmd ' Get Reset Cmd If Request.QueryString("cmd").Count > 0 Then sCmd = Request.QueryString("cmd") ' Reset Search Criteria If LCase(sCmd) = "reset" Then Call ResetSearch() ' Reset Search Criteria & Session Keys ElseIf LCase(sCmd) = "resetall" Then Call ResetSearch() ' Reset Sort Criteria ElseIf LCase(sCmd) = "resetsort" Then sOrderBy = "" Session(ewSessionTblOrderBy) = sOrderBy If Session(ewSessionTblSort & "_x_CarShortTXT") <> "" Then Session(ewSessionTblSort & "_x_CarShortTXT") = "" If Session(ewSessionTblSort & "_x_CarPreviewImageSmall") <> "" Then Session(ewSessionTblSort & "_x_CarPreviewImageSmall") = "" If Session(ewSessionTblSort & "_x_CarPreviewImageBig") <> "" Then Session(ewSessionTblSort & "_x_CarPreviewImageBig") = "" If Session(ewSessionTblSort & "_x_CarPrice") <> "" Then Session(ewSessionTblSort & "_x_CarPrice") = "" If Session(ewSessionTblSort & "_x_CarOrderNo") <> "" Then Session(ewSessionTblSort & "_x_CarOrderNo") = "" If Session(ewSessionTblSort & "_x_CarModel") <> "" Then Session(ewSessionTblSort & "_x_CarModel") = "" End If ' Reset Start Position (Reset Command) nStartRec = 1 Session(ewSessionTblStartRec) = nStartRec End If End Sub %>