Subversion Repositories DevTools

Rev

Rev 5952 | Details | Compare with Previous | 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
5957 dpurdie 27
   Call Destroy_All_Objects
129 ghuddy 28
   Response.Redirect( "../message.asp?msg=401-1")
119 ghuddy 29
End If
30
%>
31
<%
32
'------------ Variable Definition -------------
33
DIM parFRrtag_id, parPv_id
34
'------------ Constants Declaration -----------
35
'------------ Variable Init -------------------
36
parFRrtag_id = Request("rtag_id")
37
parPv_id = Request("pv_id")
38
'----------------------------------------------
39
 
40
'------------------------------------------------------------------------------------------------------------------
41
Function Get_Package_Note ()
129 ghuddy 42
   Get_Package_Note = _
43
   "   SELECT description, last_user, last_date "&_
44
   "     FROM note_manager note"&_
45
   "    WHERE note.nid = :NOTE_ID"
119 ghuddy 46
End Function
47
'------------------------------------------------------------------------------------------------------------------
48
 
49
%>
50
<%
51
Sub Update_Note ( NNpv_id, NNrtag_id, description, last_user)
129 ghuddy 52
   Dim last_date, rsNote, action_type
119 ghuddy 53
 
129 ghuddy 54
   last_date = ORA_SYSDATETIME ()
119 ghuddy 55
 
129 ghuddy 56
   OraDatabase.Parameters.Add "NOTE_ID",      NNpv_id, ORAPARM_INPUT, ORATYPE_VARCHAR2
57
   OraDatabase.Parameters.Add "LAST_USER",    last_user, ORAPARM_INPUT, ORATYPE_VARCHAR2
58
   OraDatabase.Parameters.Add "DESCRIPTION",  description, ORAPARM_INPUT, ORATYPE_VARCHAR2
59
   OraDatabase.Parameters.Add "USER_ID",      objAccessControl.UserId, ORAPARM_INPUT, ORATYPE_VARCHAR2
60
   OraDatabase.Parameters.Add "PV_ID",        NNpv_id, ORAPARM_INPUT, ORATYPE_VARCHAR2
119 ghuddy 61
 
129 ghuddy 62
   Set rsNote = OraDatabase.DbCreateDynaset( Get_Package_Note (), cint(0))
63
   If rsNote.RecordCount = 1 Then
64
      OraDatabase.Parameters.Add "ACTION_TYPE_NAME",    "note_edit", ORAPARM_INPUT, ORATYPE_VARCHAR2
65
   Else
66
      OraDatabase.Parameters.Add "ACTION_TYPE_NAME",    "note_add", ORAPARM_INPUT, ORATYPE_VARCHAR2
67
   End If
68
   rsNote.close
69
   set   rsNote = nothing
119 ghuddy 70
 
129 ghuddy 71
   On Error Resume Next
119 ghuddy 72
 
129 ghuddy 73
   ' Delete the existing note
74
   objEH.TryORA ( OraSession )
75
   OraDatabase.ExecuteSQL _
76
   " DELETE FROM note_manager"&_
77
   " WHERE nid=:NOTE_ID "
78
   objEH.CatchORA ( OraSession )
119 ghuddy 79
 
129 ghuddy 80
   If objEH.LastOraFailed = FALSE Then
81
      If not (description = "") or not (description = null) Then
82
         ' Now add the updated note back in, and log the action
83
         objEH.TryORA ( OraSession )
84
         OraDatabase.ExecuteSQL _
85
         " INSERT INTO note_manager"&_
86
         " values (:NOTE_ID, :LAST_USER, "& last_date &", :DESCRIPTION)"
87
         objEH.CatchORA ( OraSession )
88
         If objEH.LastOraFailed = FALSE Then
89
            objEH.TryORA ( OraSession )
90
            OraDatabase.ExecuteSQL _
91
            "BEGIN  Log_Action ( :PV_ID, :ACTION_TYPE_NAME, :USER_ID, :DESCRIPTION );  END;"
92
            objEH.CatchORA ( OraSession )
93
         End If
94
      Else
95
         ' Just log the note removal action
96
         OraDatabase.Parameters.remove "ACTION_TYPE_NAME"
97
         OraDatabase.Parameters.Add "ACTION_TYPE_NAME",  "note_remove", ORAPARM_INPUT, ORATYPE_VARCHAR2
119 ghuddy 98
 
129 ghuddy 99
         objEH.TryORA ( OraSession )
100
         OraDatabase.ExecuteSQL _
101
         "BEGIN  Log_Action ( :PV_ID, :ACTION_TYPE_NAME, :USER_ID, :DESCRIPTION );  END;"
102
         objEH.CatchORA ( OraSession )
103
      End If
104
   End If
119 ghuddy 105
 
129 ghuddy 106
   OraDatabase.Parameters.remove "NOTE_ID"
107
   OraDatabase.Parameters.remove "LAST_USER"
108
   OraDatabase.Parameters.remove "DESCRIPTION"
109
   OraDatabase.Parameters.remove "USER_ID"
5952 dpurdie 110
   OraDatabase.Parameters.remove "PV_ID"
129 ghuddy 111
   OraDatabase.Parameters.remove "ACTION_TYPE_NAME"
112
 
119 ghuddy 113
End Sub
114
 
115
%>
116
<%
117
'-----------------------  MAIN LINE  ---------------------------
118
'--- Process submition ---
119
call Update_Note ( parPv_id, parFRrtag_id, notecontents, Request("last_user") )
5957 dpurdie 120
Call Destroy_All_Objects
119 ghuddy 121
If Request("description") = "" Then
129 ghuddy 122
   Response.Redirect("../"& Request("redirectionDestination"))
119 ghuddy 123
Else
129 ghuddy 124
   Response.Redirect("../"& Request("redirectionDestination") &"&saved=true")
119 ghuddy 125
End If
129 ghuddy 126
%>