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
5299 dpurdie 95
            If Request("rmode") <> "" Then
96
			    Call OpenInParentWindow ( Request("rfile") &"?updated=ok2"& objPMod.ComposeURLWithout("rfile,rmode") )
97
            Else
98
			    Call OpenInParentWindow ( Request("rfile") &"?updated=ok"& objPMod.ComposeURLWithout("rfile,role_id,rmode") )
99
            End If
5150 dpurdie 100
			Call CloseWindow()
101
		End If
102
 
103
	End If
104
End If
105
'----------------------------------------------
106
%>
107
<html>
108
<head>
109
<title>Access Manager</title>
110
<meta HTTP-EQUIV="Pragma" CONTENT="no-cache">
111
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
112
<link href="scripts/access_manager.css" rel="stylesheet" type="text/css">
113
<script language="JavaScript" src="scripts/common.js"></script>
114
</head>
115
 
116
<body background="images/bg_bage_pane.gif" leftmargin="0" topmargin="0" onLoad="self.focus();FormName.role_name.focus();">
117
<table width="100%"  border="0" cellspacing="0" cellpadding="10">
118
  <tr>
119
    <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>
120
    Edit Role Name and Description. 
121
    </td>
122
  </tr>
123
  <form name="FormName" method="post" action="<%=SCRIPT_NAME%>">
124
  <tr>
125
    <td background="images/bg_drk_bage_pane.gif"><table width="100%"  border="0" cellspacing="0" cellpadding="0">
126
      <tr>
127
        <td>&nbsp;</td>
128
        <td align="right"><input name="btn" type="submit" class="form_btn" value="Update">
129
          <input name="btn" type="reset" class="form_btn" value="Cancel" onClick="self.close();"></td>
130
      </tr>
131
    </table></td>
132
  </tr>
133
  <tr>
134
    <td background="images/bg_form.gif"><table width="100%"  border="0" cellspacing="0" cellpadding="0">
135
      <tr>
136
        <td width="1%"><img src="images/spacer.gif" width="60" height="200"></td>
137
        <td width="100%"><table width="100%"  border="0" cellspacing="2" cellpadding="0">
138
          <!-- MESSAGE +++++++++++++++++++++++++++++++++++++++++++++++++++ -->
139
          <%If NOT objEH.Finally Then%>
140
          <tr>
141
            <td class="form_iname">&nbsp;</td>
142
            <td>
143
              <%objEH.DisplayMessage()%>
144
            </td>
145
            <td class="val_err"></td>
146
          </tr>
147
          <%End If%>
148
          <!-- +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -->
149
          <tr>
150
            <td nowrap class="form_iname" valign="top">Role Name </td>
151
            <td valign="top"><input name="role_name" type="text" class="form_ivalue" size="60" value="<%=objUserCollector("role_name")%>"></td>
152
            <td valign="top"> <%=objForm.Validate ("role_name")%> </td>
153
          </tr>
154
          <tr>
155
            <td valign="top" nowrap class="form_iname">Description</td>
156
            <td valign="top"><textarea name="role_comments" cols="60" rows="10" class="form_ivalue"><%=objUserCollector("role_comments")%></textarea></td>
157
            <td valign="top"> <%=objForm.Validate ("role_comments")%> </td>
158
          </tr>
159
          <tr>
160
            <td width="10%" class="form_iname">&nbsp;</td>
161
            <td width="1%">&nbsp;</td>
162
            <td width="90%" class="val_err"></td>
163
          </tr>
164
        </table></td>
165
      </tr>
166
    </table></td>
167
  </tr>
168
  <%=objPMod.ComposeHiddenTags()%>
169
  <input type="hidden" name="action" value="true">
5299 dpurdie 170
  <input type="hidden" name="rmode" value="<%=Request("rmode")%>">
5150 dpurdie 171
  </form>
172
</table>
173
</body>
174
</html>
175
<%
176
'------------ RUN AFTER PAGE RENDER -----------
177
Set objFormCollector = Nothing
178
'----------------------------------------------
179
%>
180
<!--#include file="common/globals_destructor.asp"-->