Subversion Repositories DevTools

Rev

Go to most recent revision | Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
119 ghuddy 1
<%@LANGUAGE="VBSCRIPT"%>
2
<%
3
'=====================================================
129 ghuddy 4
'                   Update Label
119 ghuddy 5
'               --- PROCESS FORM ---
6
'=====================================================
7
%>
8
<%
9
Option explicit
10
' Good idea to set when using redirect
129 ghuddy 11
Response.Expires = 0   ' always load the page, dont store
119 ghuddy 12
%>
13
<!--#include file="../common/conf.asp"-->
14
<!--#include file="../common/globals.asp"-->
15
<!--#include file="../common/formating.asp"-->
16
<!--#include file="../common/qstr.asp"-->
17
<!--#include file="../common/common_subs.asp"-->
18
<!--#include file="../common/common_dbedit.asp"-->
19
<%
20
 
21
Dim pageName, noteContents
22
pageName = split(Request("redirectionDestination"), "?")(0)
23
noteContents = Request("description")
24
 
25
' Page Access Condition
26
If NOT objAccessControl.UserLogedIn Then
129 ghuddy 27
   Response.Redirect( "../message.asp?msg=401-1")
119 ghuddy 28
End If
29
%>
30
<%
31
'------------ Variable Definition -------------
32
DIM parFRrtag_id, parPv_id
33
'------------ Constants Declaration -----------
34
'------------ Variable Init -------------------
35
parFRrtag_id = Request("rtag_id")
36
parPv_id = Request("pv_id")
37
'----------------------------------------------
38
 
39
'------------------------------------------------------------------------------------------------------------------
40
Function Get_Package_Note ()
129 ghuddy 41
   Get_Package_Note = _
42
   "   SELECT description, last_user, last_date "&_
43
   "     FROM note_manager note"&_
44
   "    WHERE note.nid = :NOTE_ID"
119 ghuddy 45
End Function
46
'------------------------------------------------------------------------------------------------------------------
47
 
48
%>
49
<%
50
Sub Update_Note ( NNpv_id, NNrtag_id, description, last_user)
129 ghuddy 51
   Dim last_date, rsNote, action_type
119 ghuddy 52
 
129 ghuddy 53
   last_date = ORA_SYSDATETIME ()
119 ghuddy 54
 
129 ghuddy 55
   OraDatabase.Parameters.Add "NOTE_ID",      NNpv_id, ORAPARM_INPUT, ORATYPE_VARCHAR2
56
   OraDatabase.Parameters.Add "LAST_USER",    last_user, ORAPARM_INPUT, ORATYPE_VARCHAR2
57
   OraDatabase.Parameters.Add "DESCRIPTION",  description, ORAPARM_INPUT, ORATYPE_VARCHAR2
58
   OraDatabase.Parameters.Add "USER_ID",      objAccessControl.UserId, ORAPARM_INPUT, ORATYPE_VARCHAR2
59
   OraDatabase.Parameters.Add "PV_ID",        NNpv_id, ORAPARM_INPUT, ORATYPE_VARCHAR2
119 ghuddy 60
 
129 ghuddy 61
   Set rsNote = OraDatabase.DbCreateDynaset( Get_Package_Note (), cint(0))
62
   If rsNote.RecordCount = 1 Then
63
      OraDatabase.Parameters.Add "ACTION_TYPE_NAME",    "note_edit", ORAPARM_INPUT, ORATYPE_VARCHAR2
64
   Else
65
      OraDatabase.Parameters.Add "ACTION_TYPE_NAME",    "note_add", ORAPARM_INPUT, ORATYPE_VARCHAR2
66
   End If
67
   rsNote.close
68
   set   rsNote = nothing
119 ghuddy 69
 
129 ghuddy 70
   On Error Resume Next
119 ghuddy 71
 
129 ghuddy 72
   ' Delete the existing note
73
   objEH.TryORA ( OraSession )
74
   OraDatabase.ExecuteSQL _
75
   " DELETE FROM note_manager"&_
76
   " WHERE nid=:NOTE_ID "
77
   objEH.CatchORA ( OraSession )
119 ghuddy 78
 
129 ghuddy 79
   If objEH.LastOraFailed = FALSE Then
80
      If not (description = "") or not (description = null) Then
81
         ' Now add the updated note back in, and log the action
82
         objEH.TryORA ( OraSession )
83
         OraDatabase.ExecuteSQL _
84
         " INSERT INTO note_manager"&_
85
         " values (:NOTE_ID, :LAST_USER, "& last_date &", :DESCRIPTION)"
86
         objEH.CatchORA ( OraSession )
87
         If objEH.LastOraFailed = FALSE Then
88
            objEH.TryORA ( OraSession )
89
            OraDatabase.ExecuteSQL _
90
            "BEGIN  Log_Action ( :PV_ID, :ACTION_TYPE_NAME, :USER_ID, :DESCRIPTION );  END;"
91
            objEH.CatchORA ( OraSession )
92
         End If
93
      Else
94
         ' Just log the note removal action
95
         OraDatabase.Parameters.remove "ACTION_TYPE_NAME"
96
         OraDatabase.Parameters.Add "ACTION_TYPE_NAME",  "note_remove", ORAPARM_INPUT, ORATYPE_VARCHAR2
119 ghuddy 97
 
129 ghuddy 98
         objEH.TryORA ( OraSession )
99
         OraDatabase.ExecuteSQL _
100
         "BEGIN  Log_Action ( :PV_ID, :ACTION_TYPE_NAME, :USER_ID, :DESCRIPTION );  END;"
101
         objEH.CatchORA ( OraSession )
102
      End If
103
   End If
119 ghuddy 104
 
129 ghuddy 105
   OraDatabase.Parameters.remove "NOTE_ID"
106
   OraDatabase.Parameters.remove "LAST_USER"
107
   OraDatabase.Parameters.remove "DESCRIPTION"
108
   OraDatabase.Parameters.remove "USER_ID"
109
   OraDatabase.Parameters.remove "ACTION_TYPE_NAME"
110
   OraDatabase.Parameters.remove "PV_ID"
111
 
119 ghuddy 112
End Sub
113
 
114
%>
115
<%
116
'-----------------------  MAIN LINE  ---------------------------
117
'--- Process submition ---
118
call Update_Note ( parPv_id, parFRrtag_id, notecontents, Request("last_user") )
119
If Request("description") = "" Then
129 ghuddy 120
   Response.Redirect("../"& Request("redirectionDestination"))
119 ghuddy 121
Else
129 ghuddy 122
   Response.Redirect("../"& Request("redirectionDestination") &"&saved=true")
119 ghuddy 123
End If
124
 
129 ghuddy 125
%>