Subversion Repositories DevTools

Rev

Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
5150 dpurdie 1
<%@LANGUAGE="VBSCRIPT"%>
2
<%
3
'=====================================================
4
'|                                                   |
5
'|			          wEditRole					 	 |
6
'|                                                   |
7
'=====================================================
8
%>
9
<%
10
Option explicit
11
Response.Expires = 0
12
%>
13
<!--#include file="common/globals.asp"-->
14
<!--#include file="common/config.asp"-->
15
<!--#include file="common/common_subs.asp"-->
16
<!--#include file="common/_popup_window_common.asp"-->
17
<!--#include file="common/_user_common.asp"-->
18
<%
19
'------------ ACCESS CONTROL ------------------
20
%>
21
<!--#include file="_access_control_general.asp"-->
22
<%
23
'------------ VARIABLE DEFINITION -------------
24
Dim objFormCollector
25
'------------ CONSTANTS DECLARATION -----------
26
'------------ VARIABLE INIT -------------------
27
Set objFormCollector = CreateObject("Scripting.Dictionary")
28
'------------ CONDITIONS ----------------------
29
'----------------------------------------------
30
%>
31
<%
32
'-----------------------------------------------------------------------------------------------------------------
33
Sub GetRoleDetails ( nRole_id, ByRef outobjDetails )
34
	Dim rsQry, query
35
	query = "SELECT *  FROM   ROLES  WHERE role_id = "& nRole_id
36
 
37
	Set rsQry = OraDatabase.DbCreateDynaset( query , ORADYN_DEFAULT )
38
 
39
	If ((NOT rsQry.BOF) AND (NOT rsQry.EOF)) Then
40
		outobjDetails.Item ("role_id")   = rsQry("role_id")
41
		outobjDetails.Item ("role_name") = rsQry("role_name")
42
		outobjDetails.Item ("role_comments") = rsQry("comments")
43
	Else
44
		Err.Raise 8, "Sub GetRoleDetails", "Empty record set returned. nRole_id="& nRole_id
45
 
46
	End If
47
 
48
	rsQry.Close
49
	Set rsQry = Nothing
50
End Sub
51
 
52
'--------------------------------------------------------------------------------------------------------------------------
53
Sub UpdateRole ()
54
	On Error Resume Next
55
 
56
	OraDatabase.Parameters.Add "ROLE_NAME", 	Request("role_name"), 		ORAPARM_INPUT, ORATYPE_STRING 
57
	OraDatabase.Parameters.Add "ROLE_COMMENTS", Request("role_comments"), 	ORAPARM_INPUT, ORATYPE_STRING 
58
	OraDatabase.Parameters.Add "ROLE_ID", 		Request("role_id"),         ORAPARM_INPUT, ORATYPE_NUMBER 
59
 
60
 
61
	objEH.TryORA ( OraSession )
62
 
63
	OraDatabase.ExecuteSQL _
64
	"BEGIN pk_Role.Update_Role ( :ROLE_ID, :ROLE_NAME, :ROLE_COMMENTS ); END;"	
65
 
66
	objEH.CatchORA ( OraSession )
67
 
68
 
69
	OraDatabase.Parameters.Remove "ROLE_NAME"
70
	OraDatabase.Parameters.Remove "ROLE_COMMENTS"
71
	OraDatabase.Parameters.Remove "ROLE_ID"
72
 
73
End Sub
74
'--------------------------------------------------------------------------------------------------------------------------
75
%>
76
<%
77
'------------ RUN BEFORE PAGE RENDER ----------
78
' --- Get Form details from DB (for edit forms only) ---
79
'-------------------------------------------------------
80
Call GetRoleDetails ( Request("role_id"), objUserCollector )
81
 
82
' --- Load Validation Rules ---
83
Call objForm.LoadValidationRules ( Array("role_name", "role_comments"), OraDatabase )		' Load Validation Rules
84
 
85
 
86
' --- Enter Form Validation Rule Changes here... ----
87
'----------------------------------------------------
88
 
89
If CBool(Request("action")) Then
90
	If objForm.IsValidOnPostBack Then
91
		' --- Form is Valid ---
92
		Call UpdateRole()
93
 
94
		If objEH.Finally Then
95
			Call OpenInParentWindow ( Request("rfile") &"?updated=ok"& objPMod.ComposeURLWithout("rfile,role_id") )
96
			Call CloseWindow()
97
		End If
98
 
99
	End If
100
End If
101
'----------------------------------------------
102
%>
103
<html>
104
<head>
105
<title>Access Manager</title>
106
<meta HTTP-EQUIV="Pragma" CONTENT="no-cache">
107
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
108
<link href="scripts/access_manager.css" rel="stylesheet" type="text/css">
109
<script language="JavaScript" src="scripts/common.js"></script>
110
</head>
111
 
112
<body background="images/bg_bage_pane.gif" leftmargin="0" topmargin="0" onLoad="self.focus();FormName.role_name.focus();">
113
<table width="100%"  border="0" cellspacing="0" cellpadding="10">
114
  <tr>
115
    <td bgcolor="#FFFFFF" class="body_txt"><span class="body_h1"><img src="images/i_role_lrg.gif" width="13" height="18" hspace="0" align="absmiddle">&nbsp;Edit Role </span> <br>
116
    Edit Role Name and Description. 
117
    </td>
118
  </tr>
119
  <form name="FormName" method="post" action="<%=SCRIPT_NAME%>">
120
  <tr>
121
    <td background="images/bg_drk_bage_pane.gif"><table width="100%"  border="0" cellspacing="0" cellpadding="0">
122
      <tr>
123
        <td>&nbsp;</td>
124
        <td align="right"><input name="btn" type="submit" class="form_btn" value="Update">
125
          <input name="btn" type="reset" class="form_btn" value="Cancel" onClick="self.close();"></td>
126
      </tr>
127
    </table></td>
128
  </tr>
129
  <tr>
130
    <td background="images/bg_form.gif"><table width="100%"  border="0" cellspacing="0" cellpadding="0">
131
      <tr>
132
        <td width="1%"><img src="images/spacer.gif" width="60" height="200"></td>
133
        <td width="100%"><table width="100%"  border="0" cellspacing="2" cellpadding="0">
134
          <!-- MESSAGE +++++++++++++++++++++++++++++++++++++++++++++++++++ -->
135
          <%If NOT objEH.Finally Then%>
136
          <tr>
137
            <td class="form_iname">&nbsp;</td>
138
            <td>
139
              <%objEH.DisplayMessage()%>
140
            </td>
141
            <td class="val_err"></td>
142
          </tr>
143
          <%End If%>
144
          <!-- +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -->
145
          <tr>
146
            <td nowrap class="form_iname" valign="top">Role Name </td>
147
            <td valign="top"><input name="role_name" type="text" class="form_ivalue" size="60" value="<%=objUserCollector("role_name")%>"></td>
148
            <td valign="top"> <%=objForm.Validate ("role_name")%> </td>
149
          </tr>
150
          <tr>
151
            <td valign="top" nowrap class="form_iname">Description</td>
152
            <td valign="top"><textarea name="role_comments" cols="60" rows="10" class="form_ivalue"><%=objUserCollector("role_comments")%></textarea></td>
153
            <td valign="top"> <%=objForm.Validate ("role_comments")%> </td>
154
          </tr>
155
          <tr>
156
            <td width="10%" class="form_iname">&nbsp;</td>
157
            <td width="1%">&nbsp;</td>
158
            <td width="90%" class="val_err"></td>
159
          </tr>
160
        </table></td>
161
      </tr>
162
    </table></td>
163
  </tr>
164
  <%=objPMod.ComposeHiddenTags()%>
165
  <input type="hidden" name="action" value="true">
166
  </form>
167
</table>
168
</body>
169
</html>
170
<%
171
'------------ RUN AFTER PAGE RENDER -----------
172
Set objFormCollector = Nothing
173
'----------------------------------------------
174
%>
175
<!--#include file="common/globals_destructor.asp"-->