Modificare il file:
\Nozze\Prodotti_list.asp
<%@ Language=VBScript %> <% Dim N_Lista_noz N_Lista_noz = request.cookies("Lista") %> <link REL="stylesheet" href="include/style.css" type="text/css"> <!--#include file="include/Prodotti_dbconnection.asp"--> <!--#include file="include/Prodotti_variables.asp"--> <!--#include file="include/Prodotti_aspfunctions.asp"--> <% Session.LCID = 1040 On Error Resume Next Dim rs, dbConnection strOrderBy="" strOrderImage="" Call CalculateOrderBy if request.Form("action")="" then Session(strTableName & "SQL")="" Session(strTableName & "MasterKey")="" end if strMasterKey = Request.Form("masterkey") if strMasterKey="" then strMasterKey = Session(strTableName & "MasterKey") end if Session(strTableName & "MasterKey") = strMasterKey TargetPageNumber=Request.Form("TargetPageNumber") if TargetPageNumber="" or Request.Form("action")="search" then _ TargetPageNumber=1 if Request.Form("PageSize")<>"" then Session("PageSize") = Request.Form("PageSize") end if if Session("PageSize")<>"" then PageSize = Session("PageSize") ' delete record if (Request.Form("mdelete")<>"") then set dbConnection = server.CreateObject ("ADODB.Connection") dbConnection.ConnectionString = strConnection dbConnection.Open Call ReportError for i=1 to request.form("mdelete").count ind = CInt(request.form("mdelete")(i)) strSQL="delete from " & strTableName & _ " where " & AddWrappers(strKeyField) & "=" & gstrQuote & Replace(request.form("mdelete1")(ind), "'", "''") & gstrQuote if strKeyField2<>"" then _ strSQL = strSQL & " and " & AddWrappers(strKeyField2) & "=" & gstrQuote2 & Replace(request.form("mdelete2")(ind), "'", "''") & gstrQuote2 if strKeyField3<>"" then _ strSQL = strSQL & " and " & AddWrappers(strKeyField3) & "=" & gstrQuote3 & Replace(request.form("mdelete3")(ind), "'", "''") & gstrQuote3 LogInfo(strSQL) dbConnection.Execute strSQL Call ReportError next dbConnection.close set dbConnection = nothing end if if Request.Form("action")<>"Search" and Request.Form("action")<>"AdvancedSearch" and Len(Session(strTableName & "SQL"))>3 then strSQL=Session(strTableName & "SQL") if strOrderBy<>"" then if InStr(1, strSQL, "order by")>0 then strSQL = Left(strSQL,InStr(1, strSQL, "order by")-1) & strOrderBy else strSQL = strSQL & strOrderBy end if end if else if gstrSQL="" then strSQL="select * from " & strTableName else strSQL = gstrSQL if LCase(Left(strSQL,7)) = "select " then if not InSQL(strKeyField, gstrSQL) then strSQL = "select " & AddWrappers(strKeyField) & ", " & Mid(strSQL, 8) if not InSQL(strKeyField2, gstrSQL) then strSQL = "select " & AddWrappers(strKeyField2) & ", " & Mid(strSQL, 8) if not InSQL(strKeyField3, gstrSQL) then strSQL = "select " & AddWrappers(strKeyField3) & ", " & Mid(strSQL, 8) if RemoveWrappers("")<>"" and not InSQL("", gstrSQL) then strSQL = "select " & AddWrappers("") & ", " & Mid(strSQL, 8) end if end if ' see if we have some search parameters ' regular search if Request.Form("action")="Search" and ( Request.Form("SearchFor")<>"" or Request.Form("SearchOption")="IsNull") then strSearchFor=Trim(Request.Form("SearchFor")) strSearchOption=Trim(Request.Form("SearchOption")) if Request.Form("SearchField")<>"AnyField" then if IsNumeric(strSearchFor) or IfNeedQuotes(GetFieldType(Request.Form("SearchField")))="True" or _ strSearchOption="Contains" or strSearchOption="Starts with ..." then strAdd = " where " & AddWrappers(Request.Form("SearchField")) & StrWhere(Request.Form("SearchField"), strSearchFor, strSearchOption, "") end if else strAdd = " where 1=0" end if if InStr(strSQL, " where ") > 0 then strAdd = " and (" & Mid(strAdd, 8) & " ) " strSQL = strSQL & strAdd end if ' advanced search if Request.Form("action")="AdvancedSearch" then sWhere="" For i = 1 To Request.Form("SearchFor").Count strSearchFor=Trim(Request.Form("SearchFor")(i)) strSearchFor2=Trim(Request.Form("SearchFor2")(i)) if strSearchFor<>"" or Request.Form("SearchOption")(i)="IsNull" then if sWhere="" then sWhere=" where 1=1" strSearchOption=Trim(Request.Form("SearchOption")(i)) if (IsNumeric(strSearchFor) and (strSearchFor2="" or IsNumeric(strSearchFor2))) or IfNeedQuotes(GetFieldType(Request.Form("FieldName")(i)))="True" or _ strSearchOption="Contains" or strSearchOption="Starts with ..." then sWhere = sWhere & " and " & AddWrappers(Request.Form("FieldName")(i)) & StrWhere(Request.Form("FieldName")(i), strSearchFor, strSearchOption, strSearchFor2) end if end if next if InStr(strSQL, " where ") > 0 then sWhere = " and (" & Mid(sWhere, 8) & " ) " strSQL = strSQL & sWhere end if strSQL = strSQL & " " & Trim(strOrderBy) end if if strMasterKey <> "" then n1 = InStr(strSQL, " where ") n2 = InStr(strSQL, " order by ") n3 = InStr(strSQL, "[Marca] = " & strMasterKey) if n3 = 0 then if n1>0 then if n2>0 then strSQL = Left(strSQL,n1) & " where (" + Mid(strSQL, n1 + len(" where "), n2-n1-len(" where ")) + ") and [Marca] = " & strMasterKey & Mid(strSQL, n2 ) else strSQL = Left(strSQL,n1) & " where (" + Mid(strSQL, n1 + len(" where ")) & ") and [Marca] = " & strMasterKey end if else if n2>0 then strSQL = Left(strSQL,n2) & " where [Marca] = " & strMasterKey & Mid(strSQL, n2 ) else strSQL = strSQL & " where [Marca] = " & strMasterKey end if end if end if end if Session(strTableName & "SQL") = strSQL Response.Write("<html>") Response.Write("<head>") Response.Write("<title>...::: LISTA DI NOZZE :::...</title>") Response.Write("</head>") Response.Write("<body topmargin=5 bgcolor=white") if Request.Form<>"" then Response.Write(" onLoad=""if (document.frmAdmin.SearchFor != null) document.frmAdmin.SearchFor.focus();""") Response.Write(">") %> <% ' Pagination: Control Variables dim iNumberOfRows dim maxRecords dim maxpages dim mypage iNumberOfRows =0 maxRecords = 0 maxpages = 0 mypage = TargetPageNumber if mypage = "" then mypage =1 if CDBL(mypage)<=0 then mypage =1 %> <table align='center' border='0'> <tr> <td width=10 align="center"> </td> <% if strMasterKey<>"" then 'Session(strTableName & "SQL") = Session(strTableName & "MasterSQL") %> <form method="POST" action="Marca_list.asp" name="master" id="master"> <input type=hidden id="TargetPageNumber" name="TargetPageNumber" value="<%=Request.Form("masterTargetPageNumber")%>" > <input type=hidden id="cmdGotoPage" name="cmdGotoPage" value="GotoPage"> <input type=hidden id="action" name="action" value="backtomaster"> </form> <td align=center> </td><td width=20 align="center"> <td width=30> </td></td> <%end if%> <% If Session("UserID")<>"" Then %> <td align=center> </td><td width=20 align="center"> </td> <% End If %> <% if CheckSecurity("", "Export")=True then %> <td align=center> <font size="2"><img border="0" src="images/SHUTDOWN.png" width="32" height="32"></font><b><font size="2"> <a title="Ritorna alla Home page" href="../mainmenu.html"> ESCI </a> </font> </b> </td> <td align=center> </td> <td align=center> <font size="2"> <img border="0" src="images/esporta.png" width="32" height="32"> </font> <a href="Prodotti_export.asp" onClick="document.exportto.submit();return false;"> <font size="2">Esporta la Lista</font></a><font size="2"> </font> </td><td width=20 align="center"> </td> <td align=center> </td> <td align=center> <font size="2"> <img border="0" src="images/iCandy_Junior023.png" width="32" height="32"></font><a href="Prodotti_print.asp" onClick="document.printerfriendly.submit();return false;"><font size="2"> Stampa la pagina</font></a><font size="2"> </font> </td> <td width=4 align="center"> </td> <% end if %> </tr> <tr> <td colspan="12"> <p align="center"> <br> <b><font size="3" color="#000080">Lista di Nozze : </font><font size="3" color="#33CC33"><%=N_Lista_noz%></font></b></td> </tr></table> <%' Control Functions %> <form method="POST" action="" name="frmAdmin"> <input type="hidden" id="TargetPageNumber" name="TargetPageNumber" value="1" > <input type="hidden" id="cmdGotoPage" name="cmdGotoPage"> <input type="hidden" id="action" name="action" value="Search"> <input type="hidden" id="orderby" name="orderby" value="<%=strOrderBy%>"> <input type="hidden" id="PageSize" name="PageSize" value="<%=Session("PageSize")%>"> <input type=hidden id=masterkey name=masterkey value="<%=strMasterKey%>"> <script language="JavaScript" src="include/jsfunctions.js"> </script> <script> var bSelected=false; function GotoPage(nPageNumber) { document.forms.frmAdmin.cmdGotoPage.value = 'GotoPage'; document.forms.frmAdmin.action.value = 'goto'; document.forms.frmAdmin.TargetPageNumber.value = nPageNumber; document.forms.frmAdmin.submit(); } </script> <% set rs = setupRs(strConnection,strSQL,PageSize) Call ReportError %> <% if not rs.eof then %> <% end if ' quotes for search and edit fields for i=0 to rs.Fields.Count-1 strNeedQuotes=IfNeedQuotes(rs.Fields(i).Type) Response.Write "<input type=hidden name=NeedQuotes" & BuildFieldName(rs.Fields(i).Name) & " value=" & strNeedQuotes & ">" & vbCRLF if rs.Fields(i).Name=strKeyField or rs.Fields(i).Name=strKeyField2 or rs.Fields(i).Name=strKeyField3 then %> <script language="JavaScript"> document.forms.editform.NeedQuotes<%=BuildFieldName(rs.Fields(i).Name)%>.value = "<%=strNeedQuotes%>"; </script> <% if rs.Fields(i).Name=strKeyField then if strNeedQuotes="True" then gstrQuote=GetQuote(rs.Fields(i).Name) else gstrQuote="" end if end if if rs.Fields(i).Name=strKeyField2 then if strNeedQuotes="True" then gstrQuote2=GetQuote(rs.Fields(i).Name) else gstrQuote2="" end if end if if rs.Fields(i).Name=strKeyField3 then if strNeedQuotes="True" then gstrQuote3=GetQuote(rs.Fields(i).Name) else gstrQuote3="" end if end if end if next Session("gstrQuote")=gstrQuote Session("gstrQuote2")=gstrQuote2 Session("gstrQuote3")=gstrQuote3 %> </form> <!-- export to form --> <form target=_blank name=exportto method=post action="Prodotti_export.asp"> <input type=hidden id=mypage name=mypage value=<%=CStr(TargetPageNumber)%>> <input type=hidden id=pagesize name=pagesize value=<%=CStr(PageSize)%>> </form> <!-- printer-friendly form --> <form target=_blank name=printerfriendly method=post action="Prodotti_print.asp"> <input type=hidden id=mypage name=mypage value=<%=CStr(TargetPageNumber)%>> <input type=hidden id=pagesize name=pagesize value=<%=CStr(PageSize)%>> </form> <table align='center' width='95%' border='0' cellpadding=3 cellspacing=2> <% if CheckSecurity("", "Search")=True then if rs.eof then Response.Write "<p> </p><p align=center><b>No records found</b></p>" else call WriteTableHeader call loopRs(rs, CLng(PageSize)) end if end if %> <% rs.Close Set rs = Nothing %> </table> </form> <% if CheckSecurity("", "Search")=True then %> <script language="JavaScript">WritePagination(<%=mypage%>,<%=maxpages%>);</script> <% end if %> <% Response.Write("</body>") Response.Write("</html>") function setupRs(strConnection,strSQL,nPageSize) Err.Clear Set setupRs = server.CreateObject ("ADODB.Recordset") set dbConnection = server.CreateObject ("ADODB.Connection") dbConnection.ConnectionString = strConnection dbConnection.Open Call ReportError LogInfo(strSQL) setupRs.open strSQL,dbConnection Call ReportError ' Pagination: if NOT setupRs.EOF then setupRs.PageSize =nPageSize maxRecords = cdbl(setupRs.RecordCount) maxpages=cdbl(setupRs.PageCount) if cdbl(mypage) > cdbl(maxpages) then mypage = maxpages End IF setupRs.AbsolutePage = mypage maxrecs=cdbl(setupRs.pagesize) End IF end function sub WriteTableHeader %> <tr CLASS="blackshade" valign=top> <TD> <table><tr><td class=blackshade> <% if (rs.Fields("Cod").Attributes and 128) and ( rs.Fields("Cod").Type = 204 or rs.Fields("Cod").Type=205 ) then Response.Write Label("Cod") & "</td>" else %> <a class=blackshade href="Prodotti_list.asp" onClick="javascript: document.forms.frmAdmin.action.value = 'OrderBy'; document.forms.frmAdmin.orderby.value = '<%=Replace("Cod","'","\'")%>'; document.forms.frmAdmin.submit(); return false; "><%=Label("Cod")%> </td> <% if Request.Form("orderby")="Cod" and strOrderImage<>"" then Response.Write "<td><img src=images/" & strOrderImage & " border=0></td>" end if end if %> </tr></table> </TD> <TD> <table><tr><td class=blackshade> <% if (rs.Fields("Nome").Attributes and 128) and ( rs.Fields("Nome").Type = 204 or rs.Fields("Nome").Type=205 ) then Response.Write Label("Nome") & "</td>" else %> <a class=blackshade href="Prodotti_list.asp" onClick="javascript: document.forms.frmAdmin.action.value = 'OrderBy'; document.forms.frmAdmin.orderby.value = '<%=Replace("Nome","'","\'")%>'; document.forms.frmAdmin.submit(); return false; "><%=Label("Nome")%> </td> <% if Request.Form("orderby")="Nome" and strOrderImage<>"" then Response.Write "<td><img src=images/" & strOrderImage & " border=0></td>" end if end if %> </tr></table> </TD> <TD> <table><tr><td class=blackshade> <% if (rs.Fields("Descrizione").Attributes and 128) and ( rs.Fields("Descrizione").Type = 204 or rs.Fields("Descrizione").Type=205 ) then Response.Write Label("Descrizione") & "</td>" else %> <a class=blackshade href="Prodotti_list.asp" onClick="javascript: document.forms.frmAdmin.action.value = 'OrderBy'; document.forms.frmAdmin.orderby.value = '<%=Replace("Descrizione","'","\'")%>'; document.forms.frmAdmin.submit(); return false; "><%=Label("Descrizione")%> </td> <% if Request.Form("orderby")="Descrizione" and strOrderImage<>"" then Response.Write "<td><img src=images/" & strOrderImage & " border=0></td>" end if end if %> </tr></table> </TD> <TD> <table><tr><td class=blackshade> <% if (rs.Fields("Prezzo").Attributes and 128) and ( rs.Fields("Prezzo").Type = 204 or rs.Fields("Prezzo").Type=205 ) then Response.Write Label("Prezzo") & "</td>" else %> <a class=blackshade href="Prodotti_list.asp" onClick="javascript: document.forms.frmAdmin.action.value = 'OrderBy'; document.forms.frmAdmin.orderby.value = '<%=Replace("Prezzo","'","\'")%>'; document.forms.frmAdmin.submit(); return false; "><%=Label("Prezzo €")%> </td> <% if Request.Form("orderby")="Prezzo" and strOrderImage<>"" then Response.Write "<td><img src=images/" & strOrderImage & " border=0></td>" end if end if %> </tr></table> </TD> <TD> <table><tr><td class=blackshade> <% if (rs.Fields("prenotato").Attributes and 128) and ( rs.Fields("prenotato").Type = 204 or rs.Fields("prenotato").Type=205 ) then Response.Write Label("prenotato") & "</td>" else %> <a class=blackshade href="Prodotti_list.asp" onClick="javascript: document.forms.frmAdmin.action.value = 'OrderBy'; document.forms.frmAdmin.orderby.value = '<%=Replace("prenotato","'","\'")%>'; document.forms.frmAdmin.submit(); return false; "><%=Label("prenotato")%> </td> <% if Request.Form("orderby")="prenotato" and strOrderImage<>"" then Response.Write "<td><img src=images/" & strOrderImage & " border=0></td>" end if end if %> </tr></table> </TD> </tr> <% end sub ' display table with results sub loopRs(rs,nPageSize) tPrezzo=0 ' Pagination: dim iShadeTheDetail, iNumberOfRows, nColumns iNumberOfRows = 0 nDelete=1 nColumns=0 if isObject(rs) then ' Pagination: UNTIL iNumberOfRows>=maxrecs DO UNTIL rs.eof OR iNumberOfRows>=nPageSize if IsNumeric(rs("Prezzo")) then tPrezzo = tPrezzo + rs("Prezzo") ' To insure that every other one is shaded If iShadeTheDetail = 0 then sShadeClass = "class=shade" iShadeTheDetail = 1 Else sShadeClass = "" iShadeTheDetail = 0 End If %> <tr valign=top <%=sShadeClass%> onmouseover="rowRollover(<%=iNumberOfRows%>, 1);" onmouseout="rowRollover(<%=iNumberOfRows%>, 0);" id="tr_<%=iNumberOfRows%>" > <TD align=right> <% if IsBinaryField(rs.Fields("Cod")) or Format("Cod")=FORMAT_DATABASE_FILE then Response.Write CreateImageControl(rs, "Cod", "") else strData = GetData(rs.Fields("Cod"), "") Response.Write ProcessLargeText(strData) end if %> </td> <TD> <% if IsBinaryField(rs.Fields("Nome")) or Format("Nome")=FORMAT_DATABASE_FILE then Response.Write CreateImageControl(rs, "Nome", "") else strData = GetData(rs.Fields("Nome"), "") Response.Write ProcessLargeText(strData) end if %> </td> <TD> <% if IsBinaryField(rs.Fields("Descrizione")) or Format("Descrizione")=FORMAT_DATABASE_FILE then Response.Write CreateImageControl(rs, "Descrizione", "") else strData = GetData(rs.Fields("Descrizione"), "") Response.Write ProcessLargeText(strData) end if %> </td> <TD align=right> <b> <% if IsBinaryField(rs.Fields("Prezzo")) or Format("Prezzo")=FORMAT_DATABASE_FILE then Response.Write CreateImageControl(rs, "Prezzo", "") else strData = GetData(rs.Fields("Prezzo"), "") Response.Write ProcessLargeText(strData) end if %> </b> </td> <TD> <% if IsBinaryField(rs.Fields("prenotato")) or Format("prenotato")=FORMAT_DATABASE_FILE then Response.Write CreateImageControl(rs, "prenotato", "") else strData = GetData(rs.Fields("prenotato"), "") Response.Write ProcessLargeText(strData) end if %> </td> </tr> <% iNumberOfRows = iNumberOfRows + 1 rs.movenext Loop response.write "<tr class=blackshade>" for x=1 to nColumns/iNumberOfRows response.write "<td class=blackshade></td>" next response.write "<td class=blackshade>" response.write "</td>" response.write "<td class=blackshade>" response.write "</td>" response.write "<td class=blackshade>" response.write "</td>" response.write "<td class=blackshade>" 'response.write GetTotal(tPrezzo, "TOTAL", iNumberOfRows, Format("Prezzo")) response.write ". . . " response.write "</td>" response.write "<td class=blackshade>" response.write "</td>" response.write "</tr>" end if end sub Sub CalculateOrderBy if Request.Form("action")="OrderBy" then strOrderBy = " order by " & AddWrappers(Request.Form("orderby")) if Len(Session(strTableName & "SQL"))>3 then nInd = InStr(1, Session(strTableName & "SQL"),"order by ") if nInd>0 then if Left(Mid(Session(strTableName & "SQL"),nInd+Len("order by ")),Len(AddWrappers(Request.Form("orderby")))) = AddWrappers(Request.Form("orderby")) _ and Right(Session(strTableName & "SQL"),3) = "asc" then strOrderBy = strOrderBy & " desc" else strOrderBy = strOrderBy & " asc" end if else strOrderBy = strOrderBy & " asc" end if else strOrderBy = strOrderBy & " asc" end if if right(strOrderBy,3)="asc" then strOrderImage="up.gif" else strOrderImage="down.gif" end if else strOrderBy = Request.Form("orderby") if strOrderBy="" and Len(Session(strTableName & "SQL"))<3 then strOrderBy=gstrOrderBy end if End Sub Function GetTotal(value, stype, iNumberOfRows, sFormat) if sFormat = FORMAT_CURRENCY and value<>"" then value = FormatCurrency(value) elseif sFormat = FORMAT_NUMBER and value<>"" then' value = FormatNumber(CDbl(value), 2) end if if stype="COUNT" then GetTotal= "Count: " & CStr(iNumberOfRows) if stype="TOTAL" then GetTotal = "Totale: € "& CStr(value) if stype="AVERAGE" then GetTotal="Average: " & CStr(CDbl(value)/iNumberOfRows) End Function %>
[
Íàçàä
]