Subversion Repositories DevTools

Rev

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

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