Subversion Repositories DevTools

Rev

Rev 5385 | Rev 5958 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
5355 dpurdie 1
<%@LANGUAGE="VBSCRIPT"%>
2
<%
3
'=====================================================
4
'|                                                   |
5
'|			          wAddProdNew				 	 |
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
<%
18
'------------ ACCESS CONTROL ------------------
19
%>
20
<!--#include file="_access_control_general.asp"-->
21
<%
22
'------------ VARIABLE DEFINITION -------------
23
Dim rsQry
24
Dim objFormCollector
25
Dim sMessage
26
'------------ CONSTANTS DECLARATION -----------
27
'------------ VARIABLE INIT -------------------
28
sMessage = NULL
29
parBom_id = Request("bom_id")
30
parOs_id = Request("os_id")
31
Set objFormCollector = CreateObject("Scripting.Dictionary")
32
'------------ CONDITIONS ----------------------
33
'----------------------------------------------
34
'--------------------------------------------------------------------------------------------------------------------------
35
Function HasSimilarNames ( sProdName )
36
	Dim rsQry
37
 
38
	HasSimilarNames = FALSE
39
 
40
	OraDatabase.Parameters.Add "PROD_NAME", sProdName, ORAPARM_INPUT, ORATYPE_VARCHAR2
41
 
42
	Set rsQry = OraDatabase.DbCreateDynaset( GetQuery("SimilarProductNames.sql"), ORADYN_DEFAULT )
43
	If rsQry.RecordCount > 0 Then
44
		HasSimilarNames = TRUE
45
	End If
46
 
47
	OraDatabase.Parameters.Remove "PROD_NAME"
48
 
49
	rsQry.Close
50
	Set rsQry = Nothing
51
End Function
52
'--------------------------------------------------------------------------------------------------------------------------
53
Sub AddProdToOs ()
54
	On Error Resume Next
55
 
56
	OraDatabase.Parameters.Add "PROD_NAME", 	Request("prod_name"), 		ORAPARM_INPUT, ORATYPE_VARCHAR2
57
	OraDatabase.Parameters.Add "PROD_VERSION", 	Request("prod_version"), 	ORAPARM_INPUT, ORATYPE_VARCHAR2
58
	OraDatabase.Parameters.Add "OS_ID", 		Request("os_id"), 			ORAPARM_INPUT, ORATYPE_NUMBER 
59
	OraDatabase.Parameters.Add "USER_ID", 		objAccessControl.UserId, 	ORAPARM_INPUT, ORATYPE_NUMBER 
60
 
61
	objEH.TryORA ( OraSession )
62
 
63
	OraDatabase.ExecuteSQL _
64
	"DECLARE "&_
65
	"   outProdId NUMBER;"&_
66
	"BEGIN   "&_
67
	"   pk_Product.New_Product ( :PROD_NAME, :PROD_VERSION, :USER_ID, outProdId );"&_
68
	"   pk_Product.Add_Product ( outProdId, :OS_ID, :USER_ID );"&_
69
	"END;"
70
 
71
	objEH.CatchORA ( OraSession )
72
 
73
 
74
	OraDatabase.Parameters.Remove "PROD_NAME"
75
	OraDatabase.Parameters.Remove "PROD_VERSION"
76
	OraDatabase.Parameters.Remove "OS_ID"
77
	OraDatabase.Parameters.Remove "USER_ID"
78
End Sub
79
'--------------------------------------------------------------------------------------------------------------------------
80
Sub AddProdToBaseEnv ()
81
	On Error Resume Next
82
 
83
	OraDatabase.Parameters.Add "PROD_NAME", 	Request("prod_name"), 		ORAPARM_INPUT, ORATYPE_VARCHAR2
84
	OraDatabase.Parameters.Add "PROD_VERSION", 	Request("prod_version"), 	ORAPARM_INPUT, ORATYPE_VARCHAR2
85
	OraDatabase.Parameters.Add "BASE_ENV_ID", 	Request("base_env_id"), 			ORAPARM_INPUT, ORATYPE_NUMBER 
86
	OraDatabase.Parameters.Add "OS_ID", 		Request("os_id"), 			ORAPARM_INPUT, ORATYPE_NUMBER 
87
	OraDatabase.Parameters.Add "USER_ID", 		objAccessControl.UserId, 	ORAPARM_INPUT, ORATYPE_NUMBER 
88
 
89
	objEH.TryORA ( OraSession )
90
 
91
	OraDatabase.ExecuteSQL _
92
	"DECLARE "&_
93
	"   outProdId NUMBER;"&_
94
	"BEGIN   "&_
95
	"   pk_Product.New_Product ( :PROD_NAME, :PROD_VERSION, :USER_ID, outProdId );"&_
96
	"   pk_Base_Env.Add_Product ( outProdId, :BASE_ENV_ID, :OS_ID, :USER_ID );"&_
97
	"END;"
98
 
99
	objEH.CatchORA ( OraSession )
100
 
101
 
102
	OraDatabase.Parameters.Remove "PROD_NAME"
103
	OraDatabase.Parameters.Remove "PROD_VERSION"
104
	OraDatabase.Parameters.Remove "BASE_ENV_ID"
105
	OraDatabase.Parameters.Remove "OS_ID"
106
	OraDatabase.Parameters.Remove "USER_ID"
107
End Sub
108
'--------------------------------------------------------------------------------------------------------------------------
109
Sub AddProdNew ()
110
 
111
	If Request("skip_similar_names") = "" Then
112
		If HasSimilarNames( Request("prod_name") ) Then
113
			Call OpenInWindow ( "wAddProdSimilarNames.asp?prod_name="& Request("prod_name") &"&prod_version="& Request("prod_version") &"&"& objPMod.ComposeURL() )
114
		End If
115
	End If
116
 
117
	'-- Now add product
118
	If Request("base_env_id") = "" Then
119
		'-- Add to OS
120
		Call AddProdToOs()
121
 
122
	Else
123
		'-- Add to Base Env
124
		Call AddProdToBaseEnv()
125
 
126
	End If
127
 
128
 
129
 
130
End Sub
131
 
132
'--------------------------------------------------------------------------------------------------------------------------
133
%>
134
<%
135
'------------ RUN BEFORE PAGE RENDER ----------
136
objPMod.PersistInQryString ( Array("base_env_id") )
137
 
138
' --- Get Form details from DB ---
139
 
140
' --- Load Validation Rules ---
141
Call objForm.LoadValidationRules ( Array("prod_name","prod_version"), OraDatabase )		' Load Validation Rules
142
 
143
' --- Enter Form Validation Rule Changes here... ----
144
'If Request("base_env_id") <> "" Then
145
	' /* There is a problem if you want to add 3rd party product in OS and the Product Name is not to ERG standards.
146
	'    I will allow entry of any kind of names and versions for now. */
147
	objForm.UpdateRules ("id='prod_name' RegExp=''")
148
	objForm.UpdateRules ("id='prod_version' RegExp=''")
149
'End If
150
'----------------------------------------------------
151
 
152
If CBool(Request("action")) Then
153
	If objForm.IsValidOnPostBack Then
154
		'-- Add Product
155
		Call AddProdNew()
156
 
157
		If objEH.Finally Then
158
			Call OpenInParentWindow ( Request("rfile") &"?ADDED=OK"& objPMod.ComposeURLWithout("rfile") )
159
			Call CloseWindow()
160
		End If
161
	End If
162
End If
163
 
164
'----------------------------------------------
165
%>
166
<html>
167
<head>
168
<title>Deployment Manager</title>
169
<link rel="shortcut icon" href="<%=FavIcon%>"/>
170
<meta HTTP-EQUIV="Pragma" CONTENT="no-cache">
171
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
172
<link href="scripts/deployment_manager.css" rel="stylesheet" type="text/css">
173
<script language="JavaScript" src="scripts/common.js"></script>
174
</head>
175
 
176
<body background="images/bg_bage_0.gif" leftmargin="0" topmargin="0" onLoad="self.focus();FormName.prod_name.focus();">
177
<table width="100%"  border="0" cellspacing="0" cellpadding="10">
178
  <tr>
179
    <td bgcolor="#FFFFFF" class="body_txt"><span class="body_h1"><img src="icons/i_linkarrow_black.gif" width="11" height="11" align="absmiddle">&nbsp;Add Product </span> <br>
180
    Enter Product Name and Version.
181
      </td>
182
  </tr>
183
<%
184
'-- FROM START --------------------------------------------------------------------------------------------------------------
185
objFormComponent.FormName = "FormName"
186
objFormComponent.Action = SCRIPT_NAME
187
objFormComponent.OnSubmit = "ShowProgress();"
188
Call objFormComponent.FormStart()
189
%>  
190
  <tr>
191
    <td background="images/bg_login.gif"><table width="100%"  border="0" cellspacing="0" cellpadding="0">
192
      <tr>
193
        <td><%=ProgressBar()%></td>
194
        <td align="right"><input name="btn" type="reset" class="form_btn" value="&laquo; Back" onClick="history.back();">
195
        &nbsp;&nbsp;
196
        <input name="btn" type="submit" class="form_btn" value="Add">
197
          <input name="btn" type="reset" class="form_btn" value="Cancel" onClick="self.close();"></td>
198
      </tr>
199
    </table></td>
200
  </tr>
201
  <tr>
202
    <td>
203
<!-- NEW PRODUCT ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -->		
204
	<!-- MESSAGE +++++++++++++++++++++++++++++++++++++++++++++++++++ -->	
205
	<!--#include file="messages/_msg_inline.asp"-->
206
    <!-- +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -->
207
	<table width="100%"  border="0" cellspacing="2" cellpadding="0">
208
      <tr>
209
        <td nowrap class="form_iname" valign="top">Product Name </td>
210
        <td valign="top"><%=objFormComponent.TextBox ( "prod_name", objForm.GetValue( "prod_name", objFormCollector.Item("prod_name") ), "size='60' class='form_ivalue'" )%></td>
211
		<td valign="top"><%=objForm.Validate ("prod_name")%></td>
212
      </tr>
213
      <tr>
214
        <td nowrap class="form_iname" valign="top">Product Version</td>
215
        <td valign="top"><%=objFormComponent.TextBox ( "prod_version", objForm.GetValue( "prod_version", objFormCollector.Item("prod_version") ), "size='60' class='form_ivalue'" )%></td>
216
		<td valign="top"><%=objForm.Validate ("prod_version")%></td>
217
      </tr>
218
      <tr>
219
        <td width="10%" class="form_iname">&nbsp;</td>
220
        <td width="1%">&nbsp;</td>
221
		<td width="90%" class="val_err"></td>
222
      </tr>
223
    </table>
224
	<!-- ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -->
225
    </td>
226
  </tr>
227
  <%=objPMod.ComposeHiddenTags()%>
228
  <input type="hidden" name="action" value="true">
229
<%
230
Call objFormComponent.FormEnd()
231
'-- FROM END ----------------------------------------------------------------------------------------------------------------
232
%>
233
</table>
234
</body>
235
</html>
236
<%
237
'------------ RUN AFTER PAGE RENDER -----------
238
Set objFormCollector = Nothing
239
'----------------------------------------------
240
%><!--#include file="common/globals_destructor.asp"-->