Rev 119 | Rev 5506 | Go to most recent revision | Blame | Compare with Previous | Last modification | View Log | RSS feed
<%@LANGUAGE="VBSCRIPT"%><%'=====================================================' Update Label' --- PROCESS FORM ---'=====================================================%><%Option explicit' Good idea to set when using redirectResponse.Expires = 0 ' always load the page, dont store%><!--#include file="../common/conf.asp"--><!--#include file="../common/globals.asp"--><!--#include file="../common/formating.asp"--><!--#include file="../common/qstr.asp"--><!--#include file="../common/common_subs.asp"--><!--#include file="../common/common_dbedit.asp"--><%Dim pageName, noteContentspageName = split(Request("redirectionDestination"), "?")(0)noteContents = Request("description")' Page Access ConditionIf NOT objAccessControl.UserLogedIn ThenResponse.Redirect( "../message.asp?msg=401-1")End If%><%'------------ Variable Definition -------------DIM parFRrtag_id, parPv_id'------------ Constants Declaration -----------'------------ Variable Init -------------------parFRrtag_id = Request("rtag_id")parPv_id = Request("pv_id")'----------------------------------------------'------------------------------------------------------------------------------------------------------------------Function Get_Package_Note ()Get_Package_Note = _" SELECT description, last_user, last_date "&_" FROM note_manager note"&_" WHERE note.nid = :NOTE_ID"End Function'------------------------------------------------------------------------------------------------------------------%><%Sub Update_Note ( NNpv_id, NNrtag_id, description, last_user)Dim last_date, rsNote, action_typelast_date = ORA_SYSDATETIME ()OraDatabase.Parameters.Add "NOTE_ID", NNpv_id, ORAPARM_INPUT, ORATYPE_VARCHAR2OraDatabase.Parameters.Add "LAST_USER", last_user, ORAPARM_INPUT, ORATYPE_VARCHAR2OraDatabase.Parameters.Add "DESCRIPTION", description, ORAPARM_INPUT, ORATYPE_VARCHAR2OraDatabase.Parameters.Add "USER_ID", objAccessControl.UserId, ORAPARM_INPUT, ORATYPE_VARCHAR2OraDatabase.Parameters.Add "PV_ID", NNpv_id, ORAPARM_INPUT, ORATYPE_VARCHAR2Set rsNote = OraDatabase.DbCreateDynaset( Get_Package_Note (), cint(0))If rsNote.RecordCount = 1 ThenOraDatabase.Parameters.Add "ACTION_TYPE_NAME", "note_edit", ORAPARM_INPUT, ORATYPE_VARCHAR2ElseOraDatabase.Parameters.Add "ACTION_TYPE_NAME", "note_add", ORAPARM_INPUT, ORATYPE_VARCHAR2End IfrsNote.closeset rsNote = nothingOn Error Resume Next' Delete the existing noteobjEH.TryORA ( OraSession )OraDatabase.ExecuteSQL _" DELETE FROM note_manager"&_" WHERE nid=:NOTE_ID "objEH.CatchORA ( OraSession )If objEH.LastOraFailed = FALSE ThenIf not (description = "") or not (description = null) Then' Now add the updated note back in, and log the actionobjEH.TryORA ( OraSession )OraDatabase.ExecuteSQL _" INSERT INTO note_manager"&_" values (:NOTE_ID, :LAST_USER, "& last_date &", :DESCRIPTION)"objEH.CatchORA ( OraSession )If objEH.LastOraFailed = FALSE ThenobjEH.TryORA ( OraSession )OraDatabase.ExecuteSQL _"BEGIN Log_Action ( :PV_ID, :ACTION_TYPE_NAME, :USER_ID, :DESCRIPTION ); END;"objEH.CatchORA ( OraSession )End IfElse' Just log the note removal actionOraDatabase.Parameters.remove "ACTION_TYPE_NAME"OraDatabase.Parameters.Add "ACTION_TYPE_NAME", "note_remove", ORAPARM_INPUT, ORATYPE_VARCHAR2objEH.TryORA ( OraSession )OraDatabase.ExecuteSQL _"BEGIN Log_Action ( :PV_ID, :ACTION_TYPE_NAME, :USER_ID, :DESCRIPTION ); END;"objEH.CatchORA ( OraSession )End IfEnd IfOraDatabase.Parameters.remove "NOTE_ID"OraDatabase.Parameters.remove "LAST_USER"OraDatabase.Parameters.remove "DESCRIPTION"OraDatabase.Parameters.remove "USER_ID"OraDatabase.Parameters.remove "ACTION_TYPE_NAME"OraDatabase.Parameters.remove "PV_ID"End Sub%><%'----------------------- MAIN LINE ---------------------------'--- Process submition ---call Update_Note ( parPv_id, parFRrtag_id, notecontents, Request("last_user") )If Request("description") = "" ThenResponse.Redirect("../"& Request("redirectionDestination"))ElseResponse.Redirect("../"& Request("redirectionDestination") &"&saved=true")End If%>