Modificare il file:
\Buoni-spesa-OLD\titolo_edit.asp
<!--#include file="include/dbcommon.asp"--> <!--#include file="include/titolo_variables.asp"--> <!--#include file="libs/smarty.asp"--> <% ' check if logged in if SESSION("UserID")="" or not CheckSecurity(SESSION("_" & strTableName & "_OwnerID"),"Edit") then SESSION("MyURL")=request.ServerVariables("SCRIPT_NAME")&"?"&request.ServerVariables("QUERY_STRING") response.Redirect "login.asp?message=expired" response.End end if Set myRequest = CreateObject("Scripting.Dictionary") Set myRequestFiles = CreateObject("Scripting.Dictionary") if ParseMultiPartForm()=true then parse=1 MaxSizeSet=false filename="" status="" message="" readevalues=false errorhappened=false set showKeys = Server.CreateObject("Scripting.Dictionary") inlineedit = false templatefile = "titolo_edit.htm" ' connect database dbConnection="" db_connect() DoEvent "BeforeProcessEdit dbConnection" Set rs = server.CreateObject("ADODB.Recordset") Set rsLookup = server.CreateObject("ADODB.Recordset") set keys = CreateObject("Scripting.Dictionary") keys("titolo")=postvalue("editid1") ' prepare data for saving if getRequestForm("a")="edited" then sstrWhere=KeyWhere(keys,"") strSQL = "select * from " & AddTableWrappers(strOriginalTableName) & " where " & sstrWhere set evalues = CreateObject("Scripting.Dictionary") set efilename_values = CreateObject("Scripting.Dictionary") set files_delete = CreateObject("Scripting.Dictionary") set files_move = CreateObject("Scripting.Dictionary") ' processing titolo - start value = postvalue("value_titolo") ttype=postvalue("type_titolo") toedit=true if myRequest.Exists("value_titolo") or myRequest.Exists("value_titolo[]") or myRequest.Exists("type_titolo") then value=prepare_for_db("titolo",value,ttype,"") if vartype(value)=11 then if value=false then _ toedit=false end if if toedit then evalues("titolo") = value end if end if ' update key value if value<>false then if keys.Exists("titolo") then keys.Remove("titolo") keys("titolo")=value end if ' processibng titolo - end for each ekey in efilename_values if evalues.Exists(ekey) then evalues.Remove(ekey) evalues(ekey) = efilename_values.Item(ekey) next ' do event retval=true DoEvent "retval=BeforeEdit(evalues,sstrWhere,rsold,keys,message,inlineedit)" if retval then on error resume next rs.Open strSQL, dbConnection, 1,2 call report_error if IsUpdatable(rs("titolo")) then ' update titolo field strValue=false if evalues.exists("titolo") then _ strValue = evalues.Item("titolo") if not errorhappened and not (vartype(strValue)=11 and strValue=False) then if isnull(strValue) then strValue="" ctype = GetRequestForm("type_titolo") rs("titolo") = strValue call report_error end if end if if not errorhappened then rs.Update call report_error end if rs.Close ' delete & move files on error goto 0 if not errorhappened then Set fso = CreateObject("Scripting.FileSystemObject") for each file in files_delete if fso.FileExists(file) then fso.DeleteFile(file) next for each file in files_move if fso.FileExists(file) then fso.MoveFile file(0),file(1) next Set fso=nothing message="<div class=message><<< " & "Recordo aggiornato" & " >>></div>" ' after edit event DoEvent "AfterEdit evalues,rsold,keys,inlineedit" end if else readevalues=true end if end if ' get current values and show edit controls strWhereClause=KeyWhere(keys,"") strSQL = gSQLWhereAdd(strWhereClause) strSQLbak = strSQL DoEvent "BeforeQueryEdit strSQL,strWhereClause" if strSQLbak = strSQL then strSQL = gSQLWhereAdd(strWhereClause) end if LogInfo(strSQL) Set rs = nothing Set rs = server.CreateObject("ADODB.Recordset") rs.Open strSQL,dbConnection,1,2 if rs.EOF then response.redirect "titolo_list.asp?a=return" response.end end if ' include files includes="" ' validation stuff bodyonload="" onsubmit="" if bodyonload<>"" then onsubmit="return validate();" bodyonload="onload="""& bodyonload & """" end if if useAJAX then includes=includes & "<script language=""JavaScript"" src=""include/jquery.js""></script>" includes=includes & "<script language=""JavaScript"" src=""include/ajaxsuggest.js""></script>" end if includes=includes & "<script language=""JavaScript"" src=""include/jsfunctions.js""></script>" includes=includes & "<script language=""JavaScript"">" & _ "var locale_dateformat = " & locale_info("LOCALE_IDATE") & ";" & _ "var locale_datedelimiter = """ & locale_info("LOCALE_SDATE") & """;" & _ "var bLoading=false;" & _ "var TEXT_PLEASE_SELECT='" & addslashes("Prego seleziona") & "';" if useAJAX then includes=includes & "var AUTOCOMPLETE_TABLE='titolo_autocomplete.asp';" & vbcrlf includes=includes & "var SUGGEST_TABLE='titolo_searchsuggest.asp';" & vbcrlf includes=includes & "var SUGGEST_LOOKUP_TABLE='titolo_lookupsuggest.asp';" & vbcrlf end if includes=includes & "</script>" & vbcrlf if useAJAX then includes=includes & "<div id=""search_suggest""></div>" & vbcrlf end if smarty.Add "includes",includes smarty.Add "bodyonload",bodyonload if len(onsubmit)>0 then onsubmit="onSubmit=""" & onsubmit & """" smarty.Add "onsubmit",onsubmit smarty.Add "key1",my_htmlspecialchars(keys("titolo")) showKeys.Add "show_key1",server.urlencode(keys("titolo")) smarty.Add "show_key1", my_htmlspecialchars(GetData(rs,"titolo", "")) smarty.Add "message",message set readonlyfields = CreateObject("Scripting.Dictionary") 'smarty.Add "value_titolo",dbvalue(rs("titolo")) if readevalues then smarty.Add "value_titolo",evalues("titolo") else smarty.Add "value_titolo",dbvalue(rs("titolo")) end if linkdata="" if useAJAX then record_id = postvalue("recordID") linkdata = "<script type=""text/javascript"">" & vbCrLf _ & "$(document).ready(function(){" & vbCrLf _ & linkdata & "});</script>" else end if smarty.Add "linkdata",linkdata where=sstrWhere DoEvent "BeforeShowEdit smarty,templatefile" smarty_display(templatefile) sub report_error if Err.number<>0 then message = "<div class=message><<< " & "Il record non è stato modificato" & " >>><br><br>" & Err.Description & "</div>" readevalues=true errorhappened=true err.clear end if end sub %>
[
Íàçàä
]