Subversion Repositories DevTools

Rev

Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
119 ghuddy 1
<%
2
'=====================================================
3
'					 COMMON SUBs Part 1
4
'=====================================================
5
%>
6
<%
7
'-----------------------------------------------------------------------------------------------------------------------------
8
Sub CloseWindow
9
%>
10
<SCRIPT language="JavaScript" type="text/javascript">
11
<!--
12
self.close();
13
//-->
14
</SCRIPT>
15
<%
16
End Sub
17
'-----------------------------------------------------------------------------------------------------------------------------
18
Sub OpenChildWindow ( SStitle, SSurl, SSH, SSW, BBscroll )
19
	Dim scrlBar
20
	If BBscroll Then
21
		scrlBar = "yes"
22
	Else
23
		scrlBar = "no"
24
	End If
25
%>
26
	<script language="JavaScript" type="text/javascript">
27
	<!--
28
	window.open('<%=SSurl%>','<%=SStitle%>','scrollbars=<%=scrlBar%>,resizable=yes,width=<%=SSW%>,height=<%=SSH%>')
29
	//-->
30
	</script>
31
<%
32
End Sub
33
'-----------------------------------------------------------------------------------------------------------------------------
34
Sub OpenInParentWindow ( SSurl )
35
%>
36
	<script language="JavaScript" type="text/javascript">
37
	<!--
38
	window.opener.document.location='<%=SSurl%>';
39
	//-->
40
	</script>
41
<%
42
End Sub
43
'-----------------------------------------------------------------------------------------------------------------------------
44
Sub OpenInWindow ( SSurl )
45
	Response.Redirect ( SSurl )
46
End Sub
47
'-----------------------------------------------------------------------------------------------------------------------------
48
Function GetQuery ( sQryName )
49
	GetQuery = ReadFile( QUERIES_PATH &"\"& sQryName )
50
End Function
51
'-----------------------------------------------------------------------------------------------------------------------------
52
Sub RaiseMsg ( SSerrFile, SSerrDesc )
53
	' Usage: enumERROR, parval1 &"|"& parval2 &"|"& parval3 ...
54
	Session( enum_RELMGR_ERRDESCRIPTION ) = SSerrDesc
55
	Response.Redirect ("messages/"& SSerrFile )
56
End Sub
57
'-----------------------------------------------------------------------------------------------------------------------------
58
Sub RaiseMsgInParent ( SSerrFile, SSerrDesc )
59
	Session( enum_RELMGR_ERRDESCRIPTION ) = SSerrDesc
60
	Call OpenInParentWindow ("messages/"& SSerrFile )
61
End Sub
62
'-----------------------------------------------------------------------------------------------------------------------------
63
Function ReadFile( SSpath )
64
	Dim filesys, rfile
65
	Set filesys = CreateObject("Scripting.FileSystemObject")
66
	Set rfile = filesys.OpenTextFile( SSpath, 1, false)
67
	ReadFile = rfile.ReadAll
68
	rfile.close
69
	Set filesys = nothing
70
End Function
71
'-----------------------------------------------------------------------------------------------------------------------------
72
Function HighlightSubstring ( SSstr, SSsubstr )
73
	Dim leftSTR, startPos
74
	startPos = InStr( 1, SSstr, SSsubstr, 1 )
75
 
76
	If startPos > 0 Then
77
		leftSTR = Left ( SSstr, startPos - 1 )
78
		HighlightSubstring = leftSTR &"<SPAN style='background:#ffff99;'>"& Mid( SSstr, startPos, Len(SSsubstr) ) &"</SPAN>"&  Right ( SSstr, Len(SSstr) - Len(leftSTR) - Len(SSsubstr)  )
79
	Else
80
		' Subtring not found
81
		HighlightSubstring = SSstr
82
	End If
83
 
84
End Function
85
'-----------------------------------------------------------------------------------------------------------------------------
86
Sub DeleteFile( SSpath )
87
	Dim filesys
88
	Set filesys = CreateObject("Scripting.FileSystemObject")
89
	If filesys.FileExists(SSpath) Then
90
   		filesys.DeleteFile SSpath, TRUE
91
	End If
92
	Set filesys = nothing
93
End Sub
94
'-----------------------------------------------------------------------------------------------------------------------------
95
Sub DeleteFolder( SSpath )
96
	Dim  filesys
97
	Set filesys = CreateObject ("Scripting.FileSystemObject")
98
	If filesys.FolderExists( SSpath ) Then
99
		'Set oFolder = filesys.GetFolder( SSpath )
100
		filesys.DeleteFolder SSpath ,TRUE
101
	End If
102
End Sub
103
'-----------------------------------------------------------------------------------------------------------------------------
104
Sub Create_Folder ( sCreateIn, sFolderName )
105
	Dim filesys, currfolder, folcoll, subfol
106
	Set filesys = CreateObject("Scripting.FileSystemObject")
107
	If filesys.FolderExists( sCreateIn ) Then
108
		Set currfolder = filesys.GetFolder( sCreateIn )
109
		Set folcoll = currfolder.SubFolders
110
		If NOT filesys.FolderExists( sCreateIn &"\"& sFolderName ) Then
111
			folcoll.Add( sFolderName )
112
		End If
113
	End If
114
End Sub
115
'-----------------------------------------------------------------------------------------------------------------------------
116
Function Folder_Is_Empty ( sPath )
117
	Dim filesys, oFolder
118
	Set filesys = CreateObject("Scripting.FileSystemObject")
119
 
120
	If filesys.FolderExists( sPath ) Then
121
		Set oFolder = filesys.GetFolder( sPath )
122
		If ( oFolder.Files.Count + oFolder.SubFolders.Count ) > 0 Then
123
			Folder_Is_Empty = FALSE
124
		Else
125
			Folder_Is_Empty = TRUE
126
		End If
127
	Else
128
		Folder_Is_Empty = TRUE
129
	End If
130
 
131
End Function
132
'-----------------------------------------------------------------------------------------------------------------------------
133
Sub Destroy_All_Objects
134
	On Error Resume Next
135
	set brokenReadyHash = nothing
136
	set brokenHash = nothing
137
	set pkgInfoHash = nothing
138
	set OraDatabase = nothing
139
	set OraSession = nothing
140
	set userdetailsHash = nothing
141
End Sub
142
'-----------------------------------------------------------------------------------------------------------------------------
143
Function InStrPipes ( SSstr, SSsubstr )
144
	If InStr( SSstr, "|"& SSsubstr &"|") > 0 Then
145
		InStrPipes = true
146
	Else
147
		InStrPipes = false
148
	End If
149
End Function
150
'-----------------------------------------------------------------------------------------------------------------------------
151
Function RemoveFromStrPipes ( SSstr, SSsubstr )
152
	RemoveFromStrPipes = Replace( SSstr, "|"& SSsubstr &"|", "" )
153
End Function
154
'-----------------------------------------------------------------------------------------------------------------------------
155
Function View_Name_Exists ( SSviewname, NNused_id )
156
	Dim rsTemp, Query_String
157
	Query_String = _
158
	" SELECT view_name"&_
159
	"  FROM views"&_
160
	" WHERE UPPER(view_name) = UPPER('"& UCase(SSviewname) &"') AND owner_id = "& NNused_id
161
	Set rsTemp = OraDatabase.DbCreateDynaset( Query_String, cint(0))
162
	If rsTemp.RecordCount > 0 Then
163
		View_Name_Exists = TRUE
164
	Else
165
		View_Name_Exists = FALSE
166
	End If
167
	rsTemp.Close
168
	Set rsTemp = nothing
169
End Function
170
'-----------------------------------------------------------------------------------------------------------------------------
171
Function User_Name_Exists ( SSusername )
172
	Dim rsTemp, Query_String
173
	Query_String = _
174
	" SELECT user_name"&_
175
	"  FROM users"&_
176
	" WHERE user_name = '"& SSusername &"'"
177
	Set rsTemp = OraDatabase.DbCreateDynaset( Query_String, cint(0))
178
	If rsTemp.RecordCount > 0 Then
179
		User_Name_Exists = TRUE
180
	Else
181
		User_Name_Exists = FALSE
182
	End If
183
	rsTemp.Close
184
	Set rsTemp = nothing
185
End Function
186
'-----------------------------------------------------------------------------------------------------------------------------
187
Function This_View_Owner( NNview_id, NNuser_id )
188
	Dim rsTemp, Query_String
189
	Query_String = _
190
	" SELECT owner_id"&_
191
	"  FROM views"&_
192
	" WHERE view_id = "& NNview_id
193
	Set rsTemp = OraDatabase.DbCreateDynaset( Query_String, cint(0))
194
	If rsTemp.RecordCount > 0 Then
195
		If CInt(rsTemp.Fields("owner_id")) = CInt(NNuser_id) Then
196
			This_View_Owner = TRUE
197
		Else
198
			This_View_Owner = FALSE
199
		End If
200
	Else
201
		' view not found
202
		Session("AdditionalParams") = "$ADMINEMAIL$,"& adminEmail
203
		Response.Redirect("message.asp?msg=400-2")
204
	End If
205
	rsTemp.Close
206
	Set rsTemp = nothing
207
End Function
208
'-----------------------------------------------------------------------------------------------------------------------------
209
Function GetReleaseMode ( NNrtag_id )
210
	Dim rsTemp, Query_String
211
	If NNrtag_id = "" Then NNrtag_id = "-1"
212
 
213
	Query_String = _
214
	" SELECT official FROM release_tags WHERE rtag_id = "& NNrtag_id
215
 
216
	Set rsTemp = OraDatabase.DbCreateDynaset( Query_String, cint(0))
217
	'Response.write "DB"& NNrtag_id
218
	If ((NOT rsTemp.BOF) AND (NOT rsTemp.EOF)) Then
219
		GetReleaseMode = rsTemp.Fields("official")
220
 
221
	End If
222
 
223
	rsTemp.Close
224
	Set rsTemp = nothing
225
End Function
226
'-----------------------------------------------------------------------------------------------------------------------------
227
Function Get_Devl_Envorinment
228
	If Request.Cookies("RELEASEMANAGER_MEMORY")("devl_environment") <> "" Then
229
		If Request.Cookies("RELEASEMANAGER_MEMORY")("devl_environment") = "clearcase" Then
230
			Get_Devl_Envorinment = "jats"		'clear case does not have import
231
		Else
232
			Get_Devl_Envorinment = Request.Cookies("RELEASEMANAGER_MEMORY")("devl_environment")
233
		End If
234
	Else
235
		Get_Devl_Envorinment = "jats"		'JATS devl environment is set by default
236
	End If
237
End Function
238
'-----------------------------------------------------------------------------------------------------------------------------
239
Function Get_From_DUAL ( SSclm )
240
	Dim rsTemp, Query_String, OraSession2, OraDatabase2
241
	Set OraSession2 = CreateObject("OracleInProcServer.XOraSession")
242
	Set OraDatabase2 = OraSession2.OpenDatabase( TNS_NAME, DB_AUTHENTICATION, Cint(0))
243
 
244
	Query_String = _
245
	" SELECT "& SSclm &" AS result FROM DUAL"
246
	Set rsTemp = OraDatabase2.DbCreateDynaset( Query_String, cint(0))
247
 
248
	If ((NOT rsTemp.BOF) AND (NOT rsTemp.EOF)) Then
249
		Get_From_DUAL = (rsTemp.Fields("result"))
250
	End If
251
 
252
	rsTemp.Close
253
	Set rsTemp = nothing
254
	Set OraDatabase2 = nothing
255
	Set OraSession2 = nothing
256
End Function
257
'-----------------------------------------------------------------------------------------------------------------------------
258
Function Get_Pkg_Base_View ( NNpv_id, NNrtag_id )
259
	Dim rsTemp, Query_String
260
 
261
	If NNrtag_id = "" Then
262
		Get_Pkg_Base_View = "N/A"
263
		Exit Function
264
	End If
265
 
266
	Query_String = _
267
	" SELECT vi.view_name"&_
268
	"  FROM release_content rc,"&_
269
	"       views vi"&_
270
	" WHERE vi.view_id = rc.base_view_id"&_
271
	"   AND rc.rtag_id = "& NNrtag_id &_
272
	"   AND rc.pv_id = "& NNpv_id
273
 
274
	Set rsTemp = OraDatabase.DbCreateDynaset( Query_String, cint(0))
275
 
276
	If ((NOT rsTemp.BOF) AND (NOT rsTemp.EOF)) Then
277
		Get_Pkg_Base_View = UCase(rsTemp.Fields("view_name"))
278
	Else
279
		Get_Pkg_Base_View = "N/A"
280
	End If
281
 
282
	rsTemp.Close
283
	Set rsTemp = nothing
284
End Function
285
'-----------------------------------------------------------------------------------------------------------------------------
286
Function Get_Proj_ID ( SSrtag_id )
287
	Dim rsTemp, Query_String
288
 
289
	Query_String = _
290
	" SELECT projects.proj_id"&_
291
	"   FROM projects projects, release_tags rel"&_
292
	"  WHERE projects.proj_id = rel.proj_id"&_
293
	"    AND rel.rtag_id = "& SSrtag_id
294
 
295
	Set rsTemp = OraDatabase.DbCreateDynaset( Query_String, cint(0))
296
 
297
	If ((NOT rsTemp.BOF) AND (NOT rsTemp.EOF)) Then
298
		Get_Proj_ID = (rsTemp.Fields("proj_id"))
299
	End If
300
 
301
	rsTemp.Close
302
	Set rsTemp = nothing
303
End Function
304
'-----------------------------------------------------------------------------------------------------------------------------
305
Function Get_Proj_Name ( NNproj_id )
306
	Dim rsTemp, Query_String
307
 
308
	Query_String = _
309
	" SELECT proj_name "&_
310
	"   FROM projects pr "&_
311
  "  WHERE pr.proj_id = "& NNproj_id
312
 
313
	Set rsTemp = OraDatabase.DbCreateDynaset( Query_String, cint(0))
314
 
315
	If ((NOT rsTemp.BOF) AND (NOT rsTemp.EOF)) Then
316
		Get_Proj_Name = (rsTemp.Fields("proj_name"))
317
	End If
318
 
319
	rsTemp.Close
320
	Set rsTemp = nothing
321
End Function
322
'-----------------------------------------------------------------------------------------------------------------------------
323
Function Get_Base_URL ( NNproj_id )
324
	Dim rsTemp, Query_String
325
 
326
	Query_String = _
327
	" SELECT base_url "&_
328
	"   FROM projects pr "&_
329
  "  WHERE pr.proj_id = "& NNproj_id
330
 
331
	Set rsTemp = OraDatabase.DbCreateDynaset( Query_String, cint(0))
332
 
333
	Get_Base_URL = rsTemp("base_url")
334
 
335
	rsTemp.Close()
336
	Set rsTemp = nothing
337
End Function
338
'-----------------------------------------------------------------------------------------------------------------------------
339
Function Get_Categories ( NNrtag_id )
340
	Get_Categories = _
341
	" SELECT vi.view_id, vi.view_name"&_
342
	"  FROM release_content rel,"&_
343
	"       views vi"&_
344
	" WHERE rel.base_view_id = vi.view_id"&_
345
	"   AND rtag_id = "& NNrtag_id &_
346
	" GROUP BY vi.view_id, vi.view_name   "&_
347
	" ORDER BY vi.view_name ASC "
348
End Function
349
'-----------------------------------------------------------------------------------------------------------------------------
350
Function Get_PV_IDs_In_Release ( NNrtag_id )
351
    Dim rsTemp, Query_String, tempSTR
352
	tempSTR = "-1"
353
	Query_String = _
354
	"SELECT pv_id FROM release_content WHERE rtag_id = "& NNrtag_id
355
 
356
	Set rsTemp = OraDatabase.DbCreateDynaset( Query_String, cint(0))
357
 
358
	While ((NOT rsTemp.BOF) AND (NOT rsTemp.EOF))
359
		tempSTR = tempSTR &","& rsTemp.Fields("pv_id")
360
		rsTemp.MoveNext
361
	WEnd
362
	Get_PV_IDs_In_Release = tempSTR
363
	rsTemp.Close
364
	Set rsTemp = nothing
365
End Function
366
'-----------------------------------------------------------------------------------------------------------------------------
367
Sub Get_Pkg_Info ( SSpv_id, NNrtag )
368
	Dim rsTemp, Query_String
369
	OraDatabase.Parameters.Add "PV_ID", 		SSpv_id,	ORAPARM_INPUT, ORATYPE_NUMBER
370
	OraDatabase.Parameters.Add "RTAG_ID", 		NNrtag,		ORAPARM_INPUT, ORATYPE_NUMBER
371
	OraDatabase.Parameters.Add "RETURN_NUMBER", NULL,		ORAPARM_OUTPUT, ORATYPE_NUMBER
372
 
373
 
374
	pkgInfoHash.Item ("can_unofficial") = "false"
375
 
376
	'/* Get Package Details */
377
	Set rsTemp = OraDatabase.DbCreateDynaset( GetQuery("PackageDetails.sql"), cint(0))
378
 
379
	If ((NOT rsTemp.BOF) AND (NOT rsTemp.EOF)) Then
380
		pkgInfoHash.Add "pv_id", (rsTemp.Fields("pv_id"))
381
		pkgInfoHash.Add "pkg_id", (rsTemp.Fields("pkg_id"))
382
		pkgInfoHash.Add "pkg_name", (rsTemp.Fields("pkg_name"))
383
		pkgInfoHash.Add "pkg_version", (rsTemp.Fields("pkg_version"))
384
		pkgInfoHash.Add "v_ext", (rsTemp.Fields("v_ext"))
385
		pkgInfoHash.Add "comments", (rsTemp.Fields("comments"))
386
 
387
		pkgInfoHash.Add "modified_stamp", (rsTemp.Fields("modified_stamp"))
388
		pkgInfoHash.Add "modifier", (rsTemp.Fields("modifier"))
389
		pkgInfoHash.Add "modifier_id", (rsTemp.Fields("modifier_id"))
390
		pkgInfoHash.Add "modifier_email", (rsTemp.Fields("modifier_email"))
391
 
392
		pkgInfoHash.Add "created_stamp", (rsTemp.Fields("created_stamp"))
393
		pkgInfoHash.Add "creator", (rsTemp.Fields("creator"))
394
		pkgInfoHash.Add "creator_email", (rsTemp.Fields("creator_email"))
395
 
396
		pkgInfoHash.Add "owner", (rsTemp.Fields("owner"))
397
		pkgInfoHash.Add "owner_email", (rsTemp.Fields("owner_email"))
398
 
399
		pkgInfoHash.Add "dlocked", (rsTemp.Fields("dlocked"))
400
		pkgInfoHash.Add "proj_id", (rsTemp.Fields("proj_id"))
401
		pkgInfoHash.Add "rtag_id", (rsTemp.Fields("rtag_id"))
402
		pkgInfoHash.Add "rtag_name", (rsTemp.Fields("rtag_name"))
403
		pkgInfoHash.Add "pkg_label", (rsTemp.Fields("pkg_label"))
404
		pkgInfoHash.Add "src_path", (rsTemp.Fields("src_path"))
405
		pkgInfoHash.Add "pv_description", (rsTemp.Fields("pv_description"))
406
		pkgInfoHash.Add "last_pv_id", (rsTemp.Fields("last_pv_id"))
407
		pkgInfoHash.Add "previous_version", (rsTemp.Fields("previous_version"))
408
		pkgInfoHash.Add "release_notes_info", (rsTemp.Fields("release_notes_info"))
409
 
410
		pkgInfoHash.Add "is_patch", (rsTemp.Fields("is_patch"))
411
		pkgInfoHash.Add "is_obsolete", (rsTemp.Fields("is_obsolete"))
412
		pkgInfoHash.Add "obsolete_comments", (rsTemp.Fields("obsolete_comments"))
413
 
414
		pkgInfoHash.Add "build_type", (rsTemp.Fields("build_type"))
415
		pkgInfoHash.Add "change_type", (rsTemp.Fields("change_type"))
416
		pkgInfoHash.Add "bs_id", (rsTemp.Fields("bs_id"))
417
		pkgInfoHash.Add "is_deployable", (rsTemp.Fields("is_deployable"))
418
		pkgInfoHash.Add "sbom_priority", (rsTemp.Fields("sbom_priority"))
419
		pkgInfoHash.Add "ripple_field", (rsTemp.Fields("ripple_field"))
420
 
421
	End If
422
 
423
 
424
	'-- Find if package is editable in this project
425
	OraDatabase.ExecuteSQL "BEGIN  :RETURN_NUMBER := CAN_EDIT_PKG_IN_PROJECT( :PV_ID, :RTAG_ID );  END;"
426
	pkgInfoHash.Add "can_edit_in_project", CStr( OraDatabase.Parameters("RETURN_NUMBER").Value )
427
 
428
 
429
	'/* Get Package Release Details */
430
	Set rsTemp = OraDatabase.DbCreateDynaset( GetQuery("PackageReleaseDetails.sql"), cint(0))
431
 
432
 
433
 
434
	If ((NOT rsTemp.BOF) AND (NOT rsTemp.EOF)) Then
435
		pkgInfoHash.Item ("base_view_id") = (rsTemp.Fields("base_view_id"))
436
		pkgInfoHash.Add "insert_stamp", (rsTemp.Fields("insert_stamp"))
437
		pkgInfoHash.Add "insertor", (rsTemp.Fields("insertor"))
438
		pkgInfoHash.Add "insertor_email", (rsTemp.Fields("insertor_email"))
439
		pkgInfoHash.Item ("pkg_state") = (rsTemp.Fields("pkg_state"))
440
		pkgInfoHash.Item ("deprecated_state") = (rsTemp.Fields("deprecated_state"))
441
		pkgInfoHash.Item ("product_state") = (rsTemp.Fields("product_state"))
442
 
443
		'AND  (rsTemp("used_count") = 0)  _
444
 
445
		If      (pkgInfoHash.Item ("dlocked") = "Y") _
446
		   AND  (pkgInfoHash.Item ("build_type") = "M") _
447
		   AND  (CDate( FormatDateTime(pkgInfoHash.Item ("modified_stamp"), 2) ) = Date) _
448
		   AND  (pkgInfoHash.Item("can_edit_in_project") = "1" ) _
449
		Then
450
 
451
		   pkgInfoHash.Item ("can_unofficial") = "true"
452
		End If
453
 
454
	Else
455
 
456
		If (CDate( FormatDateTime(pkgInfoHash.Item ("modified_stamp"), 2) ) = Date) Then
457
			' Must be not older then a day
458
			If (pkgInfoHash.Item ("dlocked") = "A")  OR   NOT IsNull(pkgInfoHash.Item("is_patch")) Then
459
				pkgInfoHash.Item ("can_unofficial") = "true"
460
 
461
			End If
462
 
463
		End If
464
 
465
	End If
466
 
467
 
468
	'/* Get Patch Parent */
469
	If pkgInfoHash.Item ("is_patch") = "Y" Then
470
		Set rsTemp = OraDatabase.DbCreateDynaset( GetQuery("PatchParent.sql"), cint(0))
471
 
472
		If ((NOT rsTemp.BOF) AND (NOT rsTemp.EOF)) Then
473
			pkgInfoHash.Add "patch_parent_id", (rsTemp.Fields("pv_id"))
474
		End If
475
	End If
476
 
477
	' DEVI-45275 - Check if version is in the planned table and if so get its planned operation type
478
	' which denotes whether it is an existing version being added to a release, an existing version
479
	' being removed from a release, or a new version being prepared for a release.
480
	Set rsTemp = OraDatabase.DbCreateDynaset( GetQuery("PlannedPackageVersionDetails.sql"), cint(0))
481
 
482
	If ((NOT rsTemp.BOF) AND (NOT rsTemp.EOF)) Then
483
		pkgInfoHash.Add "planned_operation", (rsTemp.Fields("operation"))
484
	Else
485
		pkgInfoHash.Add "planned_operation", " "
486
	End If
487
 
488
	OraDatabase.Parameters.Remove "PV_ID"
489
	OraDatabase.Parameters.Remove "RTAG_ID"
490
	OraDatabase.Parameters.Remove "RETURN_NUMBER"
491
 
492
 
493
	rsTemp.Close
494
	Set rsTemp = nothing
495
End Sub
496
'-----------------------------------------------------------------------------------------------------------------------------
497
Sub Get_Pkg_Short_Info( SSparPv_id, SSpkgID, SSpkgName, SSpkgVersion, SSsrc_path, SSpkgDesc, BBdlocked )
498
	Dim rsTemp, Query_String
499
	If IsEmpty(SSparPv_id) Then Exit Sub
500
 
501
	Query_String = _
502
	" SELECT pkg.pkg_id, pkg.pkg_name, pv.pkg_version, pv.src_path, pv.pv_description, pv.dlocked"&_
503
	"  FROM packages pkg, package_versions pv"&_
504
	" WHERE pkg.pkg_id = pv.pkg_id  AND pv.pv_id ="& SSparPv_id
505
 
506
	Set rsTemp = OraDatabase.DbCreateDynaset( Query_String, cint(0))
507
 
508
	If ((NOT rsTemp.BOF) AND (NOT rsTemp.EOF)) Then
509
		SSpkgID = rsTemp.Fields("pkg_id")
510
		SSpkgName = rsTemp.Fields("pkg_name")
511
		SSpkgVersion = rsTemp.Fields("pkg_version")
512
		SSsrc_path = rsTemp.Fields("src_path")
513
		SSpkgDesc = rsTemp.Fields("pv_description")
514
		BBdlocked = rsTemp.Fields("dlocked")
515
	End If
516
 
517
	rsTemp.Close
518
	Set rsTemp = nothing
519
End Sub
520
'-----------------------------------------------------------------------------------------------------------------------------
521
Private Function IsDomainAuthOK( SSusername, SSpassword, SSdomainName )
522
	Dim objLoginAuth, return, tempSTR
523
	'Set objWSH = Server.CreateObject("WScript.Shell")
524
	'On Error Resume Next
525
	'return = -1
526
	'return = objWSH.Run("cmd.exe /c perl "& rootPath &"\common\domainauth.pl """&_
527
	'					SSdomainName &""" """& SSusername &""" """& SSpassword &""" "&_
528
	'					"> "& rootPath &"\temp\"& SSusername &".txt", 0, true)
529
 
530
	Set objLoginAuth = Server.CreateObject("LoginAdmin.ImpersonateUser")
531
 
532
	return = -1
533
	return = objLoginAuth.AuthenticateUser ( SSusername, SSpassword, SSdomainName )
534
 
535
	'Response.write "LOGIN"& SSusername &"-"& SSpassword &"-"& SSdomainName &"-"& return
536
 
537
	If (return = 0) OR (return = 1385) Then
538
		' From MSDN System Error Codes
539
		' 0 - The operation completed successfully.
540
		' 1326 - Logon failure: unknown user name or bad password.
541
		' 1385 - Logon failure: the user has not been granted the requested logon type at this computer.
542
		' 1909 - The referenced account is currently locked out and may not be used to log on.
543
 
544
		'Login ok
545
		IsDomainAuthOK = True
546
	Else
547
		IsDomainAuthOK = False
548
	End If
549
 
550
	Set objLoginAuth = Nothing
551
End Function
552
'-----------------------------------------------------------------------------------------------------------------------------
553
Function ReadUserPreferences ( SSitem )
554
	'ReadUserPreferences = Request.Cookies("RELEASEMANAGER_USER_PREFERENCES")( SSitem )
555
	ReadUserPreferences = "0"
556
End Function
557
'-----------------------------------------------------------------------------------------------------------------------------
558
Function Requred_Parameters_String ( SScurrent, SSstr )
559
	'returns "&par1=val1&&parn=valn&"				must use & as it will not be used on parameter name or value
560
	Dim tempARR, parameter, tempSTR
561
	tempARR = Split( SSstr, "," )
562
	tempSTR = SScurrent
563
 
564
	For Each parameter In tempARR
565
		tempSTR = tempSTR &"&"& parameter &"="& QStrPar( parameter ) &"&"
566
	Next
567
 
568
	Requred_Parameters_String = tempSTR
569
End Function
570
'-----------------------------------------------------------------------------------------------------------------------------
571
Function Quick_Help ( SStipname )
572
	Quick_Help = "<a href='javascript:;' onMouseOver=""formTips.show('"& SStipname &"')"" onMouseOut=""formTips.hide()""><img src='images/i_help.gif' width='12' height='12' hspace='2' align='absmiddle' border='0' ></a>"
573
End Function
574
'-----------------------------------------------------------------------------------------------------------------------------
575
Function LogError ( SSlog, SSstr )
576
	'|errstr1||errstr2||errstr3|...
577
	LogError = SSlog &"|"& SSstr &"|"
578
End Function
579
'-----------------------------------------------------------------------------------------------------------------------------
580
Sub Send_Email ( SSfromName, SSfrom, SSto, SSsubject, SSbody, oAttachments )
581
	Dim Mail, Keys, Key, canSend
582
 
583
	canSend = FALSE
584
	Set Mail = Server.CreateObject("Persits.MailSender")
585
	Mail.Host = SMTP_HOST
586
 
587
	Mail.From = SSfrom
588
	Mail.FromName = SSfromName
589
 
590
	' Send TO:
591
	If IsObject( SSto ) Then
592
		Keys = SSto.Keys
593
		For Each Key In Keys
594
			Mail.AddAddress Key, SSto.Item( Key )
595
		Next
596
 
597
		If SSto.Count > 0 Then canSend = TRUE
598
	Else
599
 
600
		Mail.AddAddress SSto
601
		If SSto <> "" Then canSend = TRUE
602
	End If
603
 
604
	Mail.Subject = SSsubject
605
	Mail.IsHTML = True
606
	Mail.Body = SSbody
607
 
608
	' Add Attachments     DDDDDDD  Sash, It appears as if AddEmbededImage is premium functionality that costs money, can we just do a normal add attachment?
609
	'If IsObject( oAttachments ) Then
610
	'	Keys = oAttachments.Keys
611
	'	For Each Key In Keys
612
	'		Mail.AddEmbeddedImage rootPath & Key, oAttachments.Item( Key )
613
	'	Next
614
	'
615
	'End If
616
 
617
	On Error Resume Next
618
	If canSend Then	Mail.Send	' send message
619
 
620
End Sub
621
'-----------------------------------------------------------------------------------------------------------------------------
622
Sub Iterate_UP_the_tree ( NNrtag_id, HHstart_with, HHresult )
623
	Dim rsTemp, Query_String
624
	Dim seekPKGs, seekNOTpkgs
625
 
626
	seekPKGs = Join(HHstart_with.Keys, ",")
627
	If seekPKGs = "" Then seekPKGs = "-1"
628
	seekNOTpkgs = "-1"
629
 
630
	Do While seekPKGs <> "-1"
631
		Query_String = _
632
		" SELECT DISTINCT dep.pkg_id"&_
633
		"    FROM package_dependencies dep, release_content rel"&_
634
		"   WHERE rel.pv_id = dep.pv_id"&_
635
		"     AND rel.rtag_id = "& NNrtag_id &_
636
		"     AND dpkg_id IN ( "& seekPKGs &" ) "&_
637
		"     AND pkg_id NOT IN ( "& seekNOTpkgs &" )"
638
		'"     AND dep.dpv_id NOT IN ( SELECT iw.iw_id FROM ignore_warnings iw WHERE iw.rtag_id = "& NNrtag_id &" )"
639
		Set rsTemp = OraDatabase.DbCreateDynaset( Query_String, cint(0))
640
 
641
		If rsTemp.RecordCount < 1 Then Exit Do
642
 
643
		seekPKGs = "-1"
644
		While ((NOT rsTemp.BOF) AND (NOT rsTemp.EOF))
645
			If NOT HHresult.Exists(Cstr(rsTemp.Fields("pkg_id"))) Then HHresult.Add Cstr(rsTemp.Fields("pkg_id")), ""
646
			seekPKGs = seekPKGs &","& rsTemp.Fields("pkg_id")
647
			rsTemp.MoveNext
648
		WEnd
649
 
650
		seekNOTpkgs = seekNOTpkgs &","& seekPKGs
651
	Loop
652
 
653
End Sub
654
'-----------------------------------------------------------------------------------------------------------------------------
655
Sub Iterate_DOWN_the_tree (	NNrtag_id, HHstart_with, HHresult )
656
	Dim rsTemp, Query_String
657
	Dim seekPKGs, seekNOTpkgs
658
 
659
	seekPKGs = Join(HHstart_with.Keys, ",")
660
	If seekPKGs = "" Then seekPKGs = "-1"
661
	seekNOTpkgs = "-1"
662
 
663
	Do While seekPKGs <> "-1"
664
		Query_String = _
665
		" SELECT DISTINCT dep.dpkg_id"&_
666
		"    FROM package_dependencies dep, release_content rel"&_
667
		"   WHERE rel.pv_id = dep.pv_id"&_
668
		"     AND rel.rtag_id = "& NNrtag_id &_
669
		"     AND pkg_id IN ( "& seekPKGs &" ) "&_
670
		"     AND dpkg_id NOT IN ( "& seekNOTpkgs &" )"
671
		Set rsTemp = OraDatabase.DbCreateDynaset( Query_String, cint(0))
672
 
673
		If rsTemp.RecordCount < 1 Then Exit Do
674
 
675
		seekPKGs = "-1"
676
		While ((NOT rsTemp.BOF) AND (NOT rsTemp.EOF))
677
			If NOT HHresult.Exists(Cstr(rsTemp.Fields("dpkg_id"))) Then HHresult.Add Cstr(rsTemp.Fields("dpkg_id")), ""
678
			seekPKGs = seekPKGs &","& rsTemp.Fields("dpkg_id")
679
			rsTemp.MoveNext
680
		WEnd
681
 
682
		seekNOTpkgs = seekNOTpkgs &","& seekPKGs
683
	Loop
684
 
685
End Sub
686
'-----------------------------------------------------------------------------------------------------------------------------
687
Class TempSession
688
	Function Value ()
689
		Value = Session("RELEASEMANAGER_temp")
690
	End Function
691
 
692
	Sub Add ( SSstr )
693
		Session("RELEASEMANAGER_temp") = Session("RELEASEMANAGER_temp") & SSstr
694
	End Sub
695
 
696
	Sub Clean ()
697
		Session("RELEASEMANAGER_temp") = NULL
698
	End Sub
699
End Class
700
'-----------------------------------------------------------------------------------------------------------------------------
701
Sub DisplayInfo ( SSmsg, SSwidth )
702
	Dim msg
703
	If SSmsg = "" Then Exit Sub
704
 
705
	Select Case UCase( SSmsg )
706
	Case "ISSUES_IMPORTED"
707
		msg = "Import is complete. <br>Click on Close button if you are finished."
708
	Case "MAKE_OFFICIAL_WARNING"
709
		msg = "Note that making a package official will prevent any further change to it."
710
	Case "APPLY_LABEL_TO_ALL_WARNING"
711
		msg = "This will overwrite any existing labels on selected packages."
712
	Case "BLANK_LABEL_WARNING"
713
		msg = "Some dependencies in the export list above, do not have a label!"
714
	Case "PERSONAL_VIEW_NOT_SETUP"
715
		msg = "<span class='err_alert'><b>Your View is not setup!</b></span><span class='sublbox_txt'><br><br>Either set your view using My&nbsp;Account&nbsp;&gt;&nbsp;Views menu<br><br>OR<br><br>switch to Base view (Full view) by clicking on <img src='images/abtn_personal_view.gif' width='25' height='25' border='0'> icon above.</span>"
716
	Case "EMPTY_RELEASE_CONTENTS"
717
		msg = "<span class='err_alert'><b>Release content is empty!</b></span><span class='sublbox_txt'><br><br>Use + button to add packages to a release.</span>"
718
	Case "PKG_NAME_REQUIRED"
719
		msg = "<span class='err_alert'><b>Package Name required!</b></span><span class='sublbox_txt'><br>You are required to select at least one package name.</span>"
720
	Case "ADD_PATCH_WARNING"
721
		msg = "Note that patches cannot be used in your build dependencies."
722
	Case "NEW_PATCH_AVAILABLE"
723
		msg = "<b>New Patch is Required</b><br>One or more Build Dependencies have been patched.<br>Please click Add button to create patch for this package."
724
 
725
	Case "GENERATE_RELEASE_NOTES"
726
		msg = "<a href='_generate_release_notes.asp?pv_id="& Request("pv_id") &"&rtag_id="& Request("rtag_id") &"' class='txt_linked'>Click here</a> to generate full release notes."
727
	Case "NOT_FOUND_IN_PKG_ARCHIVE_RELEASE_NOTES"
728
		msg = "<b>This package is not found in dpkg_archive or deploy_archive!</b><br>Release notes are not generated.<br><a href='_generate_release_notes.asp?rfile="& scriptName &"&pv_id="& Request("pv_id") &"&rtag_id="& Request("rtag_id") &"' class='txt_linked'>Click here</a> to try again."
729
	Case "FAILED_GENERATING_RELEASE_NOTES"
730
		msg = "<span class='err_alert'><b>Failed generating release notes!</b></span><br>Please contact the <a href='mailto:"& adminEmail&"' class='txt_linked'>Administrator</a>"
731
	Case "GENERATING_RELEASE_NOTES"
732
		msg = "<b>Generating release notes...</b><br>It may take a minute. Please try refreshing this page a bit later."
733
	Case "NO_PREVIOUS_VERSION_RELEASE_NOTES"
734
	    msg = "<b>Previous Version is Unknown</b>!<br>Please specify previous version by clicking on 'Show Details...' above.<br>Release notes are not generated."
735
 
736
	Case "PACKAGE_FOUND_IN_OTHER_LOCATIONS"
737
		msg = "This package is also found in other locations."
738
	Case "DOC_NUMBER_NOTFOUND"
739
		msg = "<span class='err_alert'>Document number "& Request("doc_num") &" does not correspond to any document!</span>"
740
	Case "DOC_NUMBER_FOUND"
741
		msg = "Document found. Click &quot;Import&quot; to link the document."
742
	Case "UNIT_TEST_NOT_DONE"
743
		msg = "<b>Unit test is Not Done!</b><br><a href='javascript:;' onClick=""MM_openBrWindow('_wform_reason_for_unit_test_not_done.asp?pv_id="& Request("pv_id") &"&rtag_id="& Request("rtag_id") &"','ReasonForNotDone','resizable=yes,width=400,height=250')"" class='txt_linked'>Click here</a> to supply/edit reason."
744
	Case "PACKAGE_NOT_PART_OF_RELEASE"
745
		msg = "<b>Package is Not Part of This Release Anymore!</b><br>This package cannot be found in the list on the left-hand side.<br>You can use 'lookup:' on the left-hand side to find the package inside this release. "
746
 
747
	Case "NOT_FOUND_IN_PKG_ARCHIVE_FILE_GENERATE"
748
		msg = "<b>This package is not found in dpkg_archive or deploy_archive!</b><br>Files and folders are not captured.<br><a href='_generate_files_and_folders.asp?rfile="& scriptName &"&pv_id="& Request("pv_id") &"&rtag_id="& Request("rtag_id") &"' class='txt_linked' onClick=""ProgressBar.style.visibility='visible';"">Click here</a> to try again."
749
	Case "GENERATE_FILES_AND_FOLDERS"
750
		msg = "<b>Files and folders not found.</b><br><a href='_generate_files_and_folders.asp?pv_id="& Request("pv_id") &"&rtag_id="& Request("rtag_id") &"' class='txt_linked' onClick=""ProgressBar.style.visibility='visible';"">Click here</a> to try capture them."
751
	Case "NO_PRODUCT_FILES_CAPTURED"
752
		msg = "<b>Files and Folders not found for this product!</b><br>Capture of product components can only be done during the build time."
753
 
754
	Case "MASS REF REFERENCE"
755
		msg = "<span class='err_alert'><b>New Version can only be created in the Release's associated MASS REF: <a href=""dependencies.asp?pv_id="& pkgInfoHash.Item("pv_id") &"&rtag_id="& AssocMASSREFValue &""">"& pkgInfoHash.Item("pkg_name") &" "& pkgInfoHash.Item("pkg_version") &"</a></b></span>"
756
 
757
	Case "REPEAT_SCHEDULE_NOT_SELECTED"
758
		msg = "<span class='err_alert'><b>YOU MUST SELECT A VALUE FOR REPEAT SCHEDULED DOWNTIME</b></span>"
759
 
760
	Case "PKG_NAME_INVALID"
761
		msg = "<span class='err_alert'><b>Package Name Invalid!</b></span><span class='sublbox_txt'><br>This package name is invalid. Package names must only consist of alpha-numeric characters, underscores and dashes (A-Z 0-9 _ -), and cannot include spaces or any other symbols.</span>"
762
 
763
	Case "PKG_NAME_EXISTS"
764
		msg = "<span class='err_alert'><b>Package Name Already Exists!</b></span><span class='sublbox_txt'><br>This package name already exists, please try again.</span>"
765
 
766
	End Select
767
%>
768
<table width="<%=SSwidth%>" border="0" cellspacing="0" cellpadding="1">
769
  <tr>
770
    <td background="images/bg_bage_dark.gif">
771
	  <table width="100%" border="0" cellspacing="0" cellpadding="3">
772
        <tr>
773
          <td width="1%" valign="top" background="images/bg_help.gif"><img src="images/i_qhelp.gif" width="16" height="16"></td>
774
          <td width="100%" background="images/bg_help.gif" class="form_txt"><%=msg%></td>
775
        </tr>
776
      </table></td>
777
  </tr>
778
</table>
779
<br>
780
<%
781
 
782
End Sub
783
'-----------------------------------------------------------------------------------------------------------------------------
784
Sub Messenger ( sMessage, nMessageType, sWidth )
785
	Dim msgTemplate, Img
786
 
787
	If (sMessage = "") OR IsNull(sMessage) Then Exit Sub
788
 
789
	Select Case CStr(nMessageType)
790
		Case "1"
791
			Img = "s_critical.gif"
792
		Case "2"
793
			Img = "s_warning.gif"
794
		Case "3"
795
			Img = "s_note.gif"
796
		Case Else
797
			Img = nMessageType
798
	End Select
799
 
800
 
801
	msgTemplate = ReadFile( APP_ROOT &"\scripts\message_style.html" )
802
	msgTemplate = Replace( msgTemplate, "%WIDTH%", sWidth )
803
	msgTemplate = Replace( msgTemplate, "%IMAGE%", Img )
804
	msgTemplate = Replace( msgTemplate, "%MESSAGE%", sMessage )
805
 
806
	Response.write msgTemplate
807
End Sub
808
'-----------------------------------------------------------------------------------------------------------------------------
809
Function Default_Label ( SSpkg_name, SSpkg_version, SSv_ext )
810
	Dim rsTemp, Query_String
811
	' Do not do anything is label already exists
812
	'If Not IsNull(rsPkgInfo("pkg_label")) OR (rsPkgInfo("pkg_label")<>"")Then
813
	'	Default_Label = rsPkgInfo("pkg_label")
814
	'	Exit Function
815
	'End If
816
 
817
	If Request("rtag_id") <> "" Then
818
 
819
		Set rsTemp = OraDatabase.DbCreateDynaset( "SELECT PROJ_ID FROM RELEASE_TAGS WHERE RTAG_ID = "& Request("rtag_id") &"" , cint(0) )
820
 
821
		If InStr(1, SSpkg_name, "ERG") = 1 AND rsTemp("proj_id") <> 202 Then
822
			' For ERG products
823
			If IsNull(SSv_ext) OR (SSv_ext = "") Then
824
				' blank extention e.i. MAS
825
				Default_Label = "MAS_"& UCase(SSpkg_name) &"_R_"& Format_Version( SSpkg_version, NULL )
826
			Else
827
				Default_Label = UCase( Replace(SSv_ext, ".", "") ) &"_"& UCase(SSpkg_name) &"_R_"& Format_Version( SSpkg_version, SSv_ext )
828
			End If
829
		Else
830
			' For others
831
			Default_Label = SSpkg_name &"_"& SSpkg_version
832
 
833
		End If
834
 
835
		rsTemp.Close()
836
		Set rsTemp = nothing
837
	Else
838
		If InStr(1, SSpkg_name, "ERG") = 1 Then
839
			' For ERG products
840
			If IsNull(SSv_ext) OR (SSv_ext = "") Then
841
				' blank extention e.i. MAS
842
				Default_Label = "MAS_"& UCase(SSpkg_name) &"_R_"& Format_Version( SSpkg_version, NULL )
843
			Else
844
				Default_Label = UCase( Replace(SSv_ext, ".", "") ) &"_"& UCase(SSpkg_name) &"_R_"& Format_Version( SSpkg_version, SSv_ext )
845
			End If
846
		Else
847
			' For others
848
			Default_Label = SSpkg_name &"_"& SSpkg_version
849
		End If
850
	End If
851
End Function
852
'-----------------------------------------------------------------------------------------------------------------------------
853
Function Format_Version ( SSpkg_version, SSv_ext )
854
	Dim tempArr, tempVersion, patchArr, seg, myVersion
855
	myVersion = SSpkg_version
856
 
857
	If NOT IsNull(SSv_ext) Then
858
		myVersion = Left ( myVersion, Len(myVersion) - Len(SSv_ext) )
859
	End If
860
 
861
	tempArr = Split (myVersion, ".")
862
	For Each seg In tempArr
863
		If Len(seg) < 2 Then
864
			' single digit number
865
			tempVersion = tempVersion &"0"& seg
866
 
867
		Else
868
			seg = Replace(seg, "_", "-")	' make sure that there is no _ in segment
869
			If InStr( seg, "-" ) > 0 Then
870
				' patch version supplied
871
				patchArr = Split(seg, "-")
872
				If Len(patchArr(0)) < 2 Then
873
					' single digit number
874
					tempVersion = tempVersion &"0"& patchArr(0) &"_0"& patchArr(1)
875
				Else
876
					' double digit number
877
					tempVersion = tempVersion & patchArr(0) &"_0"& patchArr(1)
878
				End If
879
 
880
			Else
881
				' double digit no patch
882
				tempVersion = tempVersion & seg
883
			End If
884
 
885
		End If
886
 
887
	Next
888
 
889
	Format_Version = tempVersion
890
End Function
891
'-----------------------------------------------------------------------------------------------------------------------------
892
Function DefineStateIcon ( NNpkg_state, CCdlocked, sIgnoreWarnings, cIsPatchIgnore, cBuildType, bForEnvironment )
893
 
894
	If NOT IsNull(sIgnoreWarnings) Then
895
		'-- Ignore Warning is on
896
		If IsNull(cIsPatchIgnore) Then
897
			DefineStateIcon = enum_imgIgnoring
898
		Else
899
			DefineStateIcon = enum_imgPatchIgnoring
900
		End If
901
 
902
	Else
903
		Select Case CInt( NNpkg_state )
904
			Case enumPKG_STATE_OK
905
				If (CCdlocked = "N") OR (CCdlocked = "R") OR (CCdlocked = "P") Then
906
					DefineStateIcon = enum_imgBuilding
907
				Else
908
					DefineStateIcon = enum_imgBlank
909
				End If
910
 
911
			Case enumPKG_STATE_MAJOR
912
				DefineStateIcon = enum_imgCritical
913
 
914
			Case enumPKG_STATE_MINOR
915
				DefineStateIcon = enum_imgWarning
916
 
917
			Case enumPKG_STATE_MAJOR_READY
918
				DefineStateIcon = enum_imgCReady
919
 
920
			Case enumPKG_STATE_MINOR_READY
921
				DefineStateIcon = enum_imgWReady
922
 
923
			Case enumPKG_NOT_FOUND
924
				DefineStateIcon = enum_imgNotFound
925
 
926
			Case enumPKG_STATE_NEW_PATCH
927
				DefineStateIcon = enum_imgPatchAvailable
928
 
929
			Case enumPKG_STATE_DEPRECATED
930
				DefineStateIcon = enum_imgDeprecated
931
 
932
			Case enumPKG_STATE_DEPRECATED_DEPENDENT
933
				DefineStateIcon = enum_imgDeprecatedDependent
934
 
935
			Case enumPKG_ADVISORY_RIPPLE
936
				DefineStateIcon = enum_imgAR
937
 
938
			Case enumPKG_ADVISORY_RIPPLE_DEPENDENT
939
				DefineStateIcon = enum_imgARD
940
 
941
 
942
		End Select
943
 
944
		If (NOT bForEnvironment) AND _
945
		   (cBuildType = "A") AND _
946
		   (CCdlocked <> "Y") AND _
947
		   (DefineStateIcon <> enum_imgBlank) AND _
948
		   (DefineStateIcon <> enum_imgBuilding)  AND  _
949
		   (DefineStateIcon <> enum_imgNotFound) OR _
950
		   ( Request("rtag_id") = ""  AND  Request("FRrtag_id") = "")  _
951
		   Then
952
 
953
		   DefineStateIcon = ""
954
 
955
		 End If
956
 
957
 
958
	End If
959
 
960
 
961
End Function
962
'-----------------------------------------------------------------------------------------------------------------------------
963
Function DefineStateSmallIcon ( NNpkg_state, CCdlocked )
964
	Select Case CInt( NNpkg_state )
965
	Case enumPKG_STATE_OK
966
		If CCdlocked = "N" Then
967
			DefineStateSmallIcon = enum_SMALL_imgBuilding
968
		Else
969
			DefineStateSmallIcon = enum_SMALL_imgOK
970
		End If
971
 
972
	Case enumPKG_STATE_MAJOR
973
		DefineStateSmallIcon = enum_SMALL_imgCritical
974
 
975
	Case enumPKG_STATE_MINOR
976
		DefineStateSmallIcon = enum_SMALL_imgWarning
977
 
978
	Case enumPKG_STATE_MAJOR_READY
979
		DefineStateSmallIcon = enum_SMALL_imgCReady
980
 
981
	Case enumPKG_STATE_MINOR_READY
982
		DefineStateSmallIcon = enum_SMALL_imgWReady
983
 
984
	End Select
985
End Function
986
'-----------------------------------------------------------------------------------------------------------------------------
987
Function PatchIcon ( cIsPatch, cIsPatchObsolete )
988
	If IsNull(cIsPatch) Then
989
		PatchIcon = "<img src='images/rex_images/ext_blank.gif' width='16' height='16' border='0' align='absmiddle'>"
990
	Else
991
		If IsNull(cIsPatchObsolete) Then
992
			PatchIcon = "<img src='images/i_patch_small.gif' width='16' height='16' border='0' align='absmiddle' >"
993
		Else
994
			PatchIcon = "<img src='images/i_patch_small_obsolete.gif' width='16' height='16' border='0' align='absmiddle' title='Patch is obsolete'>"
995
		End If
996
	End If
997
End Function
998
'-----------------------------------------------------------------------------------------------------------------------------
999
' Function that returns true of false if the item exists in the array
1000
'-----------------------------------------------------------------------------------------------------------------------------
1001
Function inArray(item, aItems)
1002
	Dim element
1003
	inArray = false
1004
	for each element in aItems
1005
		If element = item Then
1006
			inArray=true
1007
		End If
1008
	next
1009
End Function
1010
'-----------------------------------------------------------------------------------------------------------------------------
1011
Function ProgressBar ()
1012
	ProgressBar = "<DIV name='divProgressBar' id='divProgressBar' style='visibility:hidden;'><img src='icons/i_processing.gif' width='79' height='14'></DIV>"
1013
End Function
1014
'-----------------------------------------------------------------------------------------------------------------------------
1015
Function GetCurrentParameters( nProjId, nRtagId, nPvId )
1016
	Dim rsQry,query
1017
 
1018
	' Set defaults
1019
	nProjId 	= -1
1020
	nRtagId 	= -1
1021
	nPvId 		= -1
1022
 
1023
 
1024
	' Get parameters from database
1025
	OraDatabase.Parameters.Add "ProjId", 		Request("proj_id"),	ORAPARM_INPUT, ORATYPE_VARCHAR2
1026
	OraDatabase.Parameters.Add "Rtag_id", 		Request("rtag_id"),	ORAPARM_INPUT, ORATYPE_VARCHAR2
1027
	OraDatabase.Parameters.Add "results", 		NULL, ORAPARM_OUTPUT, ORATYPE_CURSOR
1028
 
1029
	OraDatabase.ExecuteSQL " BEGIN  PK_APP_UTILS.GET_CURRENT_PARAMETERS ( :ProjId, :Rtag_id, :results ); END;"
1030
 
1031
	Set rsQry = OraDatabase.Parameters("results").Value
1032
 
1033
	OraDatabase.Parameters.Remove "ProjId"
1034
	OraDatabase.Parameters.Remove "Rtag_id"
1035
	OraDatabase.Parameters.Remove "results"
1036
 
1037
 
1038
	If rsQry.RecordCount > 0 Then
1039
 
1040
		nProjId 	= CDbl(rsQry("PROJ_ID"))
1041
		nRtagId 	= CDbl(rsQry("RTAG_ID"))
1042
 
1043
	End If
1044
 
1045
	rsQry.Close()
1046
	Set rsQry = nothing
1047
 
1048
 
1049
	' Set pv_id parameter
1050
	If Request("pv_id") <> "" Then nPvId = CDbl(Request("pv_id"))
1051
 
1052
 
1053
End Function
1054
'-----------------------------------------------------------------------------------------------------------------------------
1055
Function GetEnvName ( nEnvTab )
1056
	Select Case CInt( nEnvTab )
1057
		Case enumENVTAB_WORK_IN_PROGRESS
1058
			GetEnvName = "Work In Progress"
1059
 
1060
		Case enumENVTAB_PLANNED
1061
			GetEnvName = "Pending"
1062
 
1063
		Case enumENVTAB_RELEASED
1064
			GetEnvName = "Released"
1065
 
1066
	End Select
1067
 
1068
End Function
1069
'-----------------------------------------------------------------------------------------------------------------------------
1070
Function Title (rtagId)
1071
 
1072
	If rtagId = "" Then
1073
		Title = "Release Manager"
1074
	Else
1075
		Set rsQry = OraDatabase.DbCreateDynaset( "SELECT RT.RTAG_NAME, P.PROJ_NAME FROM PROJECTS P, RELEASE_TAGS RT WHERE RT.PROJ_ID = P.PROJ_ID AND RT.RTAG_ID="& rtagId, ORADYN_DEFAULT )
1076
		Title = rsQry("proj_name")&">"&rsQry("rtag_name")
1077
		rsQry.Close()
1078
		Set rsQry = Nothing
1079
	End If
1080
 
1081
End Function
1082
'-------------------------------------------------------------------------------------
1083
Function Check_Package_WIP_Already_Exists(NNrtag_id, NNpv_id)
1084
	Dim Query_String, rsQry
1085
 
1086
	Query_String = _
1087
	"	SELECT * "&_
1088
	"	FROM planned pl, package_versions pv "&_
1089
	"	WHERE pl.rtag_id = "& NNrtag_id &_
1090
	"	AND pv.pv_id = pl.pv_id "&_
1091
	"	AND pv.dlocked = 'A' "&_
1092
	"	AND pv.pkg_id = (SELECT pkg_id "&_
1093
    	"                  FROM package_versions "&_
1094
    	"                 WHERE pv_id = "& NNpv_id &") "&_
1095
	"	AND pv.v_ext = (SELECT v_ext "&_
1096
	"                  FROM package_versions "&_
1097
    	"                 WHERE pv_id = "& NNpv_id &")"
1098
 
1099
 
1100
	Set rsQry = OraDatabase.DbCreateDynaset( Query_String , cint(0) )
1101
 
1102
	Check_Package_WIP_Already_Exists = rsQry.RecordCount
1103
 
1104
	rsQry.Close()
1105
	Set rsQry = Nothing
1106
End Function
1107
'-----------------------------------------------------------------------------------------------------------------------------
1108
Function ValidateCodeReviewURL ( sCodeReviewURL )
1109
  Dim isValid
1110
  Dim sTempBaseURL
1111
  Dim httpRegEx
1112
	Set httpRegEx = new RegExp
1113
 
1114
	httpRegEx.Pattern = "^https?:\/\/"
1115
 
1116
	' Removes ending slash from project's base URL for ease of comparison.
1117
	sTempBaseURL = Left(baseURL, Len(baseURL)-1)
1118
	' Removes the project's base URL from the URL specified (if it's present).
1119
	codeReviewURL = Replace(sCodeReviewURL, sTempBaseURL, "")
1120
	' Removes the slash from the beginning of the resulting URL (if it's present).
1121
	If InStr(codeReviewURL, "/") = 1 Then
1122
	  codeReviewURL = Replace(codeReviewURL, "/", "", 1, 1)
1123
	End If
1124
 
1125
	' If the URL doesn't contain the http:// prefix, assume that it's correct.
1126
	If NOT httpRegEx.Test(codeReviewURL) AND Len(codeReviewURL) > 0 Then
1127
	  isValid = True
1128
	Else
1129
	  ' If the URL still contains the http:// prefix and is longer than the base
1130
	  ' URL, assume that it is an invalid URL because of a differing base URL.
1131
	  If Len(sCodeReviewURL) > Len(baseURL) Then
1132
	    Response.Write("<script type='text/javascript'>alert('Incorrect Base URL\n\nMust start with project\'s base url (" & baseURL &") if full URL specified.')</script>")
1133
	  Else
1134
	  ' If the URL still contains the http:// prefix and is shorter than the base
1135
	  ' URL, assume that it is incomplete.
1136
	    Response.Write("<script type='text/javascript'>alert('Incomplete Code Review URL')</script>")
1137
	  End If
1138
	  ' Otherwise, the URL matches the base URL exactly, which is also invalid.
1139
	  codeReviewURL = sCodeReviewURL
1140
	  isValid = False
1141
	End If
1142
	ValidateCodeReviewURL = isValid
1143
End Function
1144
'----------------------------------------------------------------------------------------------------------------------------------------
1145
Function Is_Page_Editable ( cDlocked )
1146
	' Editable if (   (unlocked OR rejected)
1147
	'              OR ( NOT released/locked AND EditReleaseNotesInPending allowed)
1148
	'              OR (released/locked AND EditNonCriticalInfoForLockedPackage allowed)
1149
	'             )
1150
	'             AND user logged in
1151
	If (((cDlocked = "N") OR (cDlocked = "R")) OR ((cDlocked <> "Y") AND (objAccessControl.IsActive("EditReleaseNotesInPending"))) OR ((cDlocked = "Y") AND (objAccessControl.IsActive("EditNonCriticalInfoForLockedPackage")))) AND objAccessControl.UserLogedIn Then
1152
		Is_Page_Editable = TRUE
1153
	Else
1154
		Is_Page_Editable = FALSE
1155
	End If
1156
End Function
1157
'----------------------------------------------------------------------------------------------------------------------------------------
1158
Function Is_Section_Editable ( )
1159
	If scriptName = "fixed_issues.asp" AND objAccessControl.UserLogedIn Then
1160
		Is_Section_Editable = TRUE
1161
	Else
1162
		Is_Section_Editable = FALSE
1163
	End If
1164
End Function
1165
'----------------------------------------------------------------------------------------------------------------------------------------
1166
Function Is_Critical_Section_Editable ( cDlocked )
1167
	' Editable if (   (unlocked OR rejected)
1168
	'              OR ( NOT released/locked AND EditReleaseNotesInPending allowed)
1169
	'              OR (released/locked AND EditCriticalInfoForLockedPackage allowed)
1170
	'             )
1171
	'             AND user logged in
1172
	If (((cDlocked = "N") OR (cDlocked = "R")) OR ((cDlocked <> "Y") AND (objAccessControl.IsActive("EditReleaseNotesInPending"))) OR ((cDlocked = "Y") AND (objAccessControl.IsActive("EditCriticalInfoForLockedPackage")))) AND objAccessControl.UserLogedIn Then
1173
		Is_Critical_Section_Editable = TRUE
1174
	Else
1175
		Is_Critical_Section_Editable = FALSE
1176
	End If
1177
End Function
1178
 
1179
'---------------------------------------------------------------
1180
' Function: Codestriker_Command
1181
'
1182
' Purpose:   Forms a codestriker differencing command for use when
1183
'            preparing codestriker reviews. This will be used mainly
1184
'            on release notes pages.
1185
'
1186
' Arguments: old_label   : The previous or older label
1187
'            new_label   : The current or newer label
1188
'
1189
Function Codestriker_Command (oldLabel, new_label)
1190
 
1191
	If ( IsNull(new_label) ) Then
1192
		Codestriker_Command = "Label not defined"
1193
	ElseIf (IsNull(oldLabel) OR oldLabel = "" ) Then
1194
		Codestriker_Command = "jats CCdiff -new=" & new_label
1195
	Else
1196
		Codestriker_Command = "jats CCdiff -old=" & oldLabel & " -new=" & new_label
1197
	End If
1198
End Function
1199
 
1200
'---------------------------------------------------------------
1201
' Function: BeyondCompare_Command
1202
'
1203
' Purpose:   Forms a beyond compare differencing command for use
1204
'            in visual inspection of code baseline differences.
1205
'            This will be used mainly on release notes pages.
1206
'
1207
' Arguments: old_label   : The previous or older label
1208
'            new_label   : The current or newer label
1209
'
1210
Function BeyondCompare_Command (oldLabel, new_label)
1211
 
1212
	If ( IsNull(new_label) ) Then
1213
		BeyondCompare_Command = "Label not defined"
1214
	ElseIf (IsNull(oldLabel) OR oldLabel = "" ) Then
1215
		BeyondCompare_Command = "No prior label to compare with"
1216
	Else
1217
		BeyondCompare_Command = "jats CCbc2 -old=" & oldLabel & " -new=" & new_label
1218
	End If
1219
End Function
1220
 
1221
'---------------------------------------------------------------
1222
' Function: getLastNonRippleVersionPVID
1223
'
1224
' Purpose: returns the last non-ripple version of the package
1225
'
1226
' Arguments: this_pv_id : string
1227
'
1228
' Notes: In the past, users used to manually perform ripple builds.
1229
'        This function does not detect those as ripples. It could be
1230
'        made to do so but it would not be reliable. For example, it
1231
'        could check to see if the word "ripple" appears in the
1232
'        comments field of the record set of the SWL query.  That
1233
'        might catch some of those records, but assumes the user
1234
'        wrote the wor ripple into the comments (reason for version).
1235
'
1236
Function getLastNonRippleVersionPVID( this_pv_id )
1237
	Dim queryResult
1238
	Dim queryString
1239
	Dim finalPVID
1240
	Dim lastPVID
1241
 
1242
	' default return value in case we never get into the loop
1243
	finalPVID = this_pv_id
1244
 
1245
	' Get record for this PVID
1246
	queryString = "SELECT * FROM package_versions WHERE pv_id = " & this_pv_id
1247
 
1248
	Set queryResult = OraDatabase.DbCreateDynaset( queryString, cint(0))
1249
 
1250
 	If ((NOT queryResult.BOF) AND (NOT queryResult.EOF)) Then
1251
 
1252
		' If this version is a ripple built version, begin the process of finding its ancestral non-ripple built version
1253
		If (queryResult("build_type") = "Y") Then
1254
 
1255
			lastPVID = queryResult("last_pv_id")
1256
 
1257
			' We know we have some ripple built versions now, so arm the finalPVID for loop control
1258
			finalPVID = ""
1259
 
1260
			' Work back through the version history until we hit a record that is not a ripple build version
1261
			Do While ((NOT queryResult.BOF) AND (NOT queryResult.EOF) AND (NOT IsNull(lastPVID)) AND (finalPVID = ""))
1262
 
1263
				queryString = "SELECT * FROM package_versions WHERE pv_id = " & lastPVID
1264
 
1265
				Set queryResult = OraDatabase.DbCreateDynaset( queryString, cint(0))
1266
 
1267
				' if the package version is a ripple built one, go round the loop again, else trigger a loop exit
1268
				If ((NOT queryResult.BOF) AND (NOT queryResult.EOF) AND ( queryResult("build_type") = "Y")) Then
1269
					lastPVID  = queryResult("last_pv_id")
1270
				Else
1271
					finalPVID = lastPVID
1272
				End If
1273
			Loop
1274
		End If
1275
	End If
1276
 
1277
	queryResult.Close()
1278
	Set queryResult = nothing
1279
 
1280
	getLastNonRippleVersionPVID = finalPVID
1281
End Function
1282
 
1283
'---------------------------------------------------------------
1284
' Function: getPreviousVersionPVID
1285
'
1286
' Purpose: returns the immediate predecssor version of the given
1287
'          package version
1288
'
1289
' Arguments: this_pv_id : string
1290
'
1291
' Notes:
1292
'
1293
Function getPreviousVersionPVID( this_pv_id )
1294
	Dim queryResult
1295
	Dim queryString
1296
 
1297
	getPreviousVersionPVID = ""
1298
 
1299
	queryString = "SELECT * FROM package_versions WHERE pv_id = " & this_pv_id
1300
 
1301
	Set queryResult = OraDatabase.DbCreateDynaset( queryString, cint(0))
1302
 
1303
 	If ((NOT queryResult.BOF) AND (NOT queryResult.EOF)) Then
1304
		getPreviousVersionPVID = queryResult("last_pv_id")
1305
	End If
1306
 
1307
	queryResult.Close()
1308
	Set queryResult = nothing
1309
 
1310
End Function
1311
 
1312
'---------------------------------------------------------------
1313
' Function: getOldLabel
1314
'
1315
' Purpose: Returns the previous label; if none then returns empty string
1316
'
1317
'          Since this operation is designed to fulfil the generation of
1318
'          diff commands, there is no point in considering ripple
1319
'          versions, since the only differences we find there are in
1320
'          the build.pl files (for example). So, this function uses
1321
'          some underlying methods that ignore ripple built versions
1322
'          therefore concentrating on versions that someone has manually
1323
'          gone and labelled, presumably because they changed some
1324
'          source file other than build.pl.
1325
'
1326
' Arguments: pv_id       : Uniquely identifies this package version
1327
'            last_pv_id  : Uniquely identifies the predecssor of this package version
1328
' Notes:
1329
'
1330
Function getOldLabel (pv_id, last_pv_id)
1331
	Dim queryResult
1332
	Dim queryString
1333
 
1334
	getOldLabel = ""
1335
 
1336
	If( (NOT IsNull(last_pv_id)) AND (last_pv_id <> pv_id) ) Then
1337
 
1338
		' Get the pv_id for the current version, and if necessary, work back through any ripple versions as necessary
1339
		' to get a non-ripple version ancestor
1340
  		pv_id = getLastNonRippleVersionPVID( pv_id )
1341
		If (pv_id <> "") Then
1342
			' get the pv_id of the previous version to the non-ripple version ancestor we just found.
1343
			' It does not matter if we get a ripple version here. It is good enough to serve the purpose of version diff'ing
1344
			pv_id = getPreviousVersionPVID( pv_id )
1345
			If (pv_id <> "") Then
1346
				' Get the complete row of data from the package versions table and extract the package label
1347
				queryString = "SELECT * FROM package_versions WHERE pv_id = " & pv_id
1348
				Set queryResult = OraDatabase.DbCreateDynaset( queryString, cint(0))
1349
				If ((NOT queryResult.BOF) AND (NOT queryResult.EOF)) Then
1350
					getOldLabel = queryResult("pkg_label")
1351
				End If
1352
				queryResult.Close()
1353
				Set queryResult = nothing
1354
			End If
1355
		End If
1356
 
1357
	End If
1358
 
1359
End Function
1360
 
1361
%>