<%@ CodePage = 65001 LCID = 1040 %> <% Response.expires = 0 Response.expiresabsolute = Now() - 1 Response.addHeader "pragma", "no-cache" Response.addHeader "cache-control", "private" Response.addHeader "cache-control", "no-cache" Response.addHeader "cache-control", "no-store" Response.CacheControl = "no-cache" %> <% ewCurSec = 0 ' Initialise ' User levels Const ewAllowAdd = 1 Const ewAllowDelete = 2 Const ewAllowEdit = 4 Const ewAllowView = 8 Const ewAllowList = 8 Const ewAllowReport = 8 Const ewAllowSearch = 8 Const ewAllowAdmin = 16 %> <% If Session("lapinsitter_status") <> "login" Then ewCurSec = 8 Else ' Restore Security Table - created in Login arrSecurity = Session("ewSecurity") ' Get Current Table Security sTmp1 = -1 For sTmp = 1 to UBound(arrSecurity, 2) If arrSecurity(0, sTmp) = "cerco" Then sTmp1 = sTmp Exit For End If Next ewCurLvl = Session("lapinsitter_status_UserLevel") If IsNumeric(ewCurLvl) And sTmp1 <> -1 Then If ewCurLvl = -1 Then ' System Administrator ewCurSec = 31 ElseIf ewCurLvl > 0 and ewCurLvl <= 1 Then ewCurSec = arrSecurity(ewCurLvl, sTmp1) End If End If If Session("lapinsitter_status_UserID") = "" And Session("lapinsitter_status_UserID") <> -1 Then Response.Redirect "login.asp" End If %> <% ' Initialize common variables x_id = Null: ox_id = Null x_nome = Null: ox_nome = Null x_provincia = Null: ox_provincia = Null x_nome_niglio = Null: ox_nome_niglio = Null x_periodo = Null: ox_periodo = Null x_contatto = Null: ox_contatto = Null x_note = Null: ox_note = Null x_userid = Null: ox_userid = Null %> <% sExport = Request.QueryString("export") ' Load Export Request If sExport = "excel" Then Response.ContentType = "application/vnd.ms-excel" Response.AddHeader "Content-Disposition", "attachment; filename=cerco.xls" End If If sExport = "word" Then Response.ContentType = "application/vnd.ms-word" Response.AddHeader "Content-Disposition:", "attachment; filename=cerco.doc" End If %> <% nStartRec = 0 nStopRec = 0 nTotalRecs = 0 nRecCount = 0 nRecActual = 0 sDbWhereMaster = "" sDbWhereDetail = "" sSrchAdvanced = "" sSrchBasic = "" sSrchWhere = "" sDbWhere = "" sDefaultOrderBy = "" sDefaultFilter = "" sWhere = "" sGroupBy = "" sHaving = "" sOrderBy = "" sSqlMasterBase = "" sSqlMaster = "" nDisplayRecs = 20 nRecRange = 10 ' 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 sSrchWhere = sSrchAdvanced ' Advanced Search ElseIf sSrchBasic <> "" Then sSrchWhere = sSrchBasic ' Basic Search End If ' Save Search Criteria If sSrchWhere <> "" Then Session("cerco_searchwhere") = sSrchWhere ' Reset start record counter (new search) nStartRec = 1 Session("cerco_REC") = nStartRec Else sSrchWhere = Session("cerco_searchwhere") End If ' Build SQL sSql = "SELECT * FROM [cerco]" ' Load Default Filter sDefaultFilter = "" sGroupBy = "" sHaving = "" ' Load Default Order sDefaultOrderBy = "" ' Build WHERE condition sDbWhere = "" If Session("lapinsitter_status_UserID") <> -1 And Session("lapinsitter_status_UserID") <> "" Then ' Non system admin sDbWhere = sDbWhere & "([userid] = " & Session("lapinsitter_status_UserID") & ") AND " End If If sDbWhereDetail <> "" Then sDbWhere = sDbWhere & "(" & sDbWhereDetail & ") AND " End If If sSrchWhere <> "" Then sDbWhere = sDbWhere & "(" & sSrchWhere & ") AND " End If If Len(sDbWhere) > 5 Then sDbWhere = Mid(sDbWhere, 1, Len(sDbWhere)-5) ' Trim rightmost AND End If sWhere = "" If sDefaultFilter <> "" Then sWhere = sWhere & "(" & sDefaultFilter & ") AND " End If If sDbWhere <> "" Then sWhere = sWhere & "(" & sDbWhere & ") AND " End If If Right(sWhere, 5) = " AND " Then sWhere = Left(sWhere, Len(sWhere)-5) If sWhere <> "" Then sSql = sSql & " WHERE " & sWhere End If If sGroupBy <> "" Then sSql = sSql & " GROUP BY " & sGroupBy End If If sHaving <> "" Then sSql = sSql & " HAVING " & sHaving End If ' Set Up Sorting Order sOrderBy = "" SetUpSortOrder() If sOrderBy <> "" Then sSql = sSql & " ORDER BY " & sOrderBy End If '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 = 3 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 %>

CERCO LAPINSITTER

<% If sExport = "" Then %>   Esporta in Excel   Esporta in Word <% End If %>

<% If sExport = "" Then %>
   Tutti i Record  
Frase esatta  Tutte le parole  Ogni parola
<% End If %> <% If (ewCurSec And ewAllowAdd) = ewAllowAdd Then %> <% If sExport = "" Then %>
PUBBLICA UN ANNUNCIO

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

<%= Session("ewmsg") %>

<% Session("ewmsg") = "" ' Clear message End If %> <% If sExport = "" Then %>
<% ' Display page numbers If nTotalRecs > 0 Then rsEof = (nTotalRecs < (nStartRec + nDisplayRecs)) If CLng(nTotalRecs) > CLng(nDisplayRecs) Then ' Find out if there should be Backward or Forward Buttons on the TABLE. If nStartRec = 1 Then isPrev = False Else isPrev = True PrevStart = nStartRec - nDisplayRecs If PrevStart < 1 Then PrevStart = 1 %> Prev <% End If If (isPrev Or (Not rsEof)) Then x = 1 y = 1 dx1 = ((nStartRec-1)\(nDisplayRecs*nRecRange))*nDisplayRecs*nRecRange+1 dy1 = ((nStartRec-1)\(nDisplayRecs*nRecRange))*nRecRange+1 If (dx1+nDisplayRecs*nRecRange-1) > nTotalRecs Then dx2 = (nTotalRecs\nDisplayRecs)*nDisplayRecs+1 dy2 = (nTotalRecs\nDisplayRecs)+1 Else dx2 = dx1+nDisplayRecs*nRecRange-1 dy2 = dy1+nRecRange-1 End If While x <= nTotalRecs If x >= dx1 And x <= dx2 Then If CLng(nStartRec) = CLng(x) Then %> <%=y%> <% Else %> <%=y%> <% End If x = x + nDisplayRecs y = y + 1 ElseIf x >= (dx1-nDisplayRecs*nRecRange) And x <= (dx2+nDisplayRecs*nRecRange) Then If x+nRecRange*nDisplayRecs < nTotalRecs Then %> <%=y%>-<%=y+nRecRange-1%> <% Else ny=(nTotalRecs-1)\nDisplayRecs+1 If ny = y Then %> <%=y%> <% Else %> <%=y%>-<%=ny%> <% End If End If x=x+nRecRange*nDisplayRecs y=y+nRecRange Else x=x+nRecRange*nDisplayRecs y=y+nRecRange End If Wend End If ' Next link If NOT rsEof Then NextStart = nStartRec + nDisplayRecs isMore = True %> Avanti <% Else isMore = False End If %>
<% End If 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 %> Records <%= nStartRec %> a <%= nStopRec %> di <%= nTotalRecs %> <% Else %> Nessun Record trovato.
Quando accedi per pubblicare un annuncio puoi vedere solo gli annunci pubblicati da te.
Dopo averne pubblicati ti sara' anche possibile modificarli o cancellarli.
Questo ti consentira' di aggiornare gli annunci e di eliminarli quando saranno superati :-)
<% End If %>
<% End If %> <% If nTotalRecs > 0 Then %>
<% If sExport = "" Then %> <% If (ewCurSec And ewAllowView) = ewAllowView Then %> <% End If %> <% If (ewCurSec And ewAllowEdit) = ewAllowEdit Then %> <% End If %> <% If (ewCurSec And ewAllowDelete) = ewAllowDelete Then %> <% End If %> <% End If %> <% ' Avoid starting record > total records If CLng(nStartRec) > CLng(nTotalRecs) Then nStartRec = nTotalRecs End If ' 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 = " bgcolor=""#FFFFFF""" sListTrJs = " onmouseover='ew_mouseover(this);' onmouseout='ew_mouseout(this);' onclick='ew_click(this);'" ' Display alternate color for rows If nRecCount Mod 2 <> 1 Then sItemRowClass = " bgcolor=""#F5F5F5""" End If x_id = rs("id") x_nome = rs("nome") x_provincia = rs("provincia") x_nome_niglio = rs("nome_niglio") x_periodo = rs("periodo") x_contatto = rs("contatto") x_note = rs("note") x_userid = rs("userid") %> <%=sListTrJs%>> <% If sExport = "" Then %> <% If (ewCurSec And ewAllowView) = ewAllowView Then %> <% End If %> <% If (ewCurSec And ewAllowEdit) = ewAllowEdit Then %> <% End If %> <% If (ewCurSec And ewAllowDelete) = ewAllowDelete Then %> <% End If %> <% End If %> <% End If rs.MoveNext Loop %>
<% If sExport <> "" Then %> il tuo nome <% Else %> " class="lapinsitter" style="color: #FFFFFF;" onMouseDown="ewsort(event, this.href);">il tuo nome (*)<% If Session("cerco_x_nome_Sort") = "ASC" Then %><% ElseIf Session("cerco_x_nome_Sort") = "DESC" Then %><% End If %> <% End If %> <% If sExport <> "" Then %> localita' o zona <% Else %> " class="lapinsitter" style="color: #FFFFFF;" onMouseDown="ewsort(event, this.href);">localita' o zona (*)<% If Session("cerco_x_provincia_Sort") = "ASC" Then %><% ElseIf Session("cerco_x_provincia_Sort") = "DESC" Then %><% End If %> <% End If %> <% If sExport <> "" Then %> nome del tuo coniglio <% Else %> " class="lapinsitter" style="color: #FFFFFF;" onMouseDown="ewsort(event, this.href);">nome del tuo coniglio (*)<% If Session("cerco_x_nome_niglio_Sort") = "ASC" Then %><% ElseIf Session("cerco_x_nome_niglio_Sort") = "DESC" Then %><% End If %> <% End If %> <% If sExport <> "" Then %> periodo lapinsitter <% Else %> " class="lapinsitter" style="color: #FFFFFF;" onMouseDown="ewsort(event, this.href);">periodo lapinsitter (*)<% If Session("cerco_x_periodo_Sort") = "ASC" Then %><% ElseIf Session("cerco_x_periodo_Sort") = "DESC" Then %><% End If %> <% End If %> <% If sExport <> "" Then %> come contattarti <% Else %> " class="lapinsitter" style="color: #FFFFFF;" onMouseDown="ewsort(event, this.href);">come contattarti (*)<% If Session("cerco_x_contatto_Sort") = "ASC" Then %><% ElseIf Session("cerco_x_contatto_Sort") = "DESC" Then %><% End If %> <% End If %> <% If sExport <> "" Then %> note (esigenze, richieste specifiche, requisiti, altro) <% Else %> " class="lapinsitter" style="color: #FFFFFF;" onMouseDown="ewsort(event, this.href);">note (esigenze, richieste specifiche, requisiti, altro) (*)<% If Session("cerco_x_note_Sort") = "ASC" Then %><% ElseIf Session("cerco_x_note_Sort") = "DESC" Then %><% End If %> <% End If %>    
<% Response.Write x_nome %> <% Response.Write x_provincia %> <% Response.Write x_nome_niglio %> <%= Replace(x_periodo&"", vbLf, "
") %>
<%= Replace(x_contatto&"", vbLf, "
") %>
<%= Replace(x_note&"", vbLf, "
") %>
">Vedi">Modifica">Cancella
<% End If %> <% ' Close recordset and connection rs.Close Set rs = Nothing conn.Close Set conn = Nothing %> <% 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 & "[nome] LIKE '%" & sKeyword & "%' OR " BasicSearchSQL = BasicSearchSQL & "[provincia] LIKE '%" & sKeyword & "%' OR " BasicSearchSQL = BasicSearchSQL & "[nome_niglio] LIKE '%" & sKeyword & "%' OR " BasicSearchSQL = BasicSearchSQL & "[periodo] LIKE '%" & sKeyword & "%' OR " BasicSearchSQL = BasicSearchSQL & "[contatto] LIKE '%" & sKeyword & "%' OR " BasicSearchSQL = BasicSearchSQL & "[note] 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 sSearch, sSearchType, arKeyword, sKeyword sSearch = Request.QueryString("psearch") sSearchType = Request.QueryString("psearchType") If sSearch <> "" Then If sSearchType <> "" Then While InStr(sSearch, " ") > 0 sSearch = Replace(sSearch, " ", " ") Wend arKeyword = Split(Trim(sSearch), " ") For Each sKeyword In arKeyword sSrchBasic = sSrchBasic & "(" & BasicSearchSQL(sKeyword) & ") " & sSearchType & " " Next Else sSrchBasic = BasicSearchSQL(sSearch) 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) End Sub '------------------------------------------------------------------------------- ' Function SetUpSortOrder ' - Set up Sort parameters based on Sort Links clicked ' - Variables setup: sOrderBy, Session("Table_OrderBy"), Session("Table_Field_Sort") Sub SetUpSortOrder() Dim sOrder, sSortField, sLastSort, sThisSort Dim bCtrl ' Check for Ctrl pressed If Request.QueryString("ctrl").Count > 0 Then bCtrl = True Else bCtrl = False End If ' Check for an Order parameter If Request.QueryString("order").Count > 0 Then sOrder = Request.QueryString("order") ' Field nome If sOrder = "nome" Then sSortField = "[nome]" sLastSort = Session("cerco_x_nome_Sort") If sLastSort = "ASC" Then sThisSort = "DESC" Else sThisSort = "ASC" Session("cerco_x_nome_Sort") = sThisSort Else If Not bCtrl And Session("cerco_x_nome_Sort") <> "" Then Session("cerco_x_nome_Sort") = "" End If ' Field provincia If sOrder = "provincia" Then sSortField = "[provincia]" sLastSort = Session("cerco_x_provincia_Sort") If sLastSort = "ASC" Then sThisSort = "DESC" Else sThisSort = "ASC" Session("cerco_x_provincia_Sort") = sThisSort Else If Not bCtrl And Session("cerco_x_provincia_Sort") <> "" Then Session("cerco_x_provincia_Sort") = "" End If ' Field nome_niglio If sOrder = "nome_niglio" Then sSortField = "[nome_niglio]" sLastSort = Session("cerco_x_nome_niglio_Sort") If sLastSort = "ASC" Then sThisSort = "DESC" Else sThisSort = "ASC" Session("cerco_x_nome_niglio_Sort") = sThisSort Else If Not bCtrl And Session("cerco_x_nome_niglio_Sort") <> "" Then Session("cerco_x_nome_niglio_Sort") = "" End If ' Field periodo If sOrder = "periodo" Then sSortField = "[periodo]" sLastSort = Session("cerco_x_periodo_Sort") If sLastSort = "ASC" Then sThisSort = "DESC" Else sThisSort = "ASC" Session("cerco_x_periodo_Sort") = sThisSort Else If Not bCtrl And Session("cerco_x_periodo_Sort") <> "" Then Session("cerco_x_periodo_Sort") = "" End If ' Field contatto If sOrder = "contatto" Then sSortField = "[contatto]" sLastSort = Session("cerco_x_contatto_Sort") If sLastSort = "ASC" Then sThisSort = "DESC" Else sThisSort = "ASC" Session("cerco_x_contatto_Sort") = sThisSort Else If Not bCtrl And Session("cerco_x_contatto_Sort") <> "" Then Session("cerco_x_contatto_Sort") = "" End If ' Field note If sOrder = "note" Then sSortField = "[note]" sLastSort = Session("cerco_x_note_Sort") If sLastSort = "ASC" Then sThisSort = "DESC" Else sThisSort = "ASC" Session("cerco_x_note_Sort") = sThisSort Else If Not bCtrl And Session("cerco_x_note_Sort") <> "" Then Session("cerco_x_note_Sort") = "" End If If bCtrl Then sOrderBy = Session("cerco_OrderBy") If InStr(sOrderBy, sSortField & " " & sLastSort) > 0 Then sOrderBy = Replace(sOrderBy, sSortField & " " & sLastSort, sSortField & " " & sThisSort) Else If sOrderBy <> "" Then sOrderBy = sOrderBy & ", " sOrderBy = sOrderBy & sSortField & " " & sThisSort End If Session("cerco_OrderBy") = sOrderBy Else Session("cerco_OrderBy") = sSortField & " " & sThisSort End If Session("cerco_REC") = 1 End If sOrderBy = Session("cerco_OrderBy") If sOrderBy = "" Then sOrderBy = sDefaultOrderBy Session("cerco_OrderBy") = sOrderBy 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("start").Count > 0 Then nStartRec = Request.QueryString("start") Session("cerco_REC") = 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("cerco_REC") = nStartRec Else nStartRec = Session("cerco_REC") If Not IsNumeric(nStartRec) Or nStartRec = "" Then nStartRec = 1 ' Reset start record counter Session("cerco_REC") = nStartRec End If End If Else nStartRec = Session("cerco_REC") If Not IsNumeric(nStartRec) Or nStartRec = "" Then nStartRec = 1 'Reset start record counter Session("cerco_REC") = nStartRec End If 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 UCase(sCmd) = "RESET" Then sSrchWhere = "" Session("cerco_searchwhere") = sSrchWhere ' Reset Search Criteria & Session Keys ElseIf UCase(sCmd) = "RESETALL" Then sSrchWhere = "" Session("cerco_searchwhere") = sSrchWhere ' Reset Sort Criteria ElseIf UCase(sCmd) = "RESETSORT" Then sOrderBy = "" Session("cerco_OrderBy") = sOrderBy If Session("cerco_x_nome_Sort") <> "" Then Session("cerco_x_nome_Sort") = "" If Session("cerco_x_provincia_Sort") <> "" Then Session("cerco_x_provincia_Sort") = "" If Session("cerco_x_nome_niglio_Sort") <> "" Then Session("cerco_x_nome_niglio_Sort") = "" If Session("cerco_x_periodo_Sort") <> "" Then Session("cerco_x_periodo_Sort") = "" If Session("cerco_x_contatto_Sort") <> "" Then Session("cerco_x_contatto_Sort") = "" If Session("cerco_x_note_Sort") <> "" Then Session("cerco_x_note_Sort") = "" End If ' Reset Start Position (Reset Command) nStartRec = 1 Session("cerco_REC") = nStartRec End If End Sub %>