Subversion Repositories DevTools

Rev

Details | Last modification | View Log | RSS feed

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