Subversion Repositories DevTools

Rev

Rev 5514 | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
62 rsolanki 1
<%@LANGUAGE="VBSCRIPT"%>
2
<%
3
'=====================================================
4
' 			 	   REMOVE Unit Test
5
'               --- PROCESS FORM ---
6
'=====================================================
7
%>
8
<%
9
Option explicit
10
' Good idea to set when using redirect
11
Response.Expires = 0	' always load the page, dont store
12
%>
13
 
14
<!--#include file="common/config.asp"-->
15
<!--#include file="common/globals.asp"-->
16
<!--#include file="common/formating.asp"-->
17
<!--#include file="common/qstr.asp"-->
18
<!--#include file="common/common_subs.asp"-->
19
<!--#include file="common/common_dbedit.asp"-->
20
<%
21
' Set rfile parameter. This is a return page after Login
22
'Call objPMod.StoreParameter ( "rfile", "fixed_issues.asp" )
23
'------------ ACCESS CONTROL ------------------
24
%>
25
 
26
<!--#include file="_access_control_general.asp"-->
27
 
28
<%
29
'------------ Variable Definition -------------
30
Dim pkgInfoHash
31
'------------ Constants Declaration -----------
32
'------------ Variable Init -------------------
33
Set pkgInfoHash = CreateObject("Scripting.Dictionary")
34
'----------------------------------------------
35
%>
36
<%
37
Sub Attachment_Name ( nTest_id, nPv_id, outPkg_name, outPkg_version, outFullAttachmentName )
38
	Dim sqlstr, rsTemp
39
	sqlstr = _
40
	" SELECT pkg.pkg_name, pv.pkg_version, ( pkg.pkg_name || '\' || pv.pkg_version || '\' || ut.results_attachment_name ) AS filename_path"&_
41
	"   FROM UNIT_TESTS ut, PACKAGE_VERSIONS pv, PACKAGES pkg"&_
42
	"  WHERE ut.pv_id = pv.pv_id"&_
43
	"    AND pv.pkg_id = pkg.pkg_id"&_
44
	"    AND ut.test_id = "& nTest_id &_
45
	"    AND ut.pv_id = "& nPv_id &_
46
	"    AND ut.TEST_TYPES_FK <> "& enumTEST_TYPE_SANITY
47
 
48
	Set rsTemp = OraDatabase.DbCreateDynaset( sqlstr, cint(0))
49
 
50
	If ((NOT rsTemp.BOF) AND (NOT rsTemp.EOF)) Then
51
		outPkg_name = rsTemp("pkg_name")
52
		outPkg_version = rsTemp("pkg_version")
53
		outFullAttachmentName = rsTemp("filename_path")
54
	Else
55
		outFullAttachmentName = NULL
56
		Call Get_Pkg_Short_Info( nPv_id, NULL, outPkg_name, outPkg_version, NULL, NULL, NULL )
57
	End If
58
 
59
	rsTemp.Close
60
	Set rsTemp = nothing
61
End Sub
62
 
63
 
64
Sub CleanUp_Folders ( sPath, sPkg_name, sPkg_version )
65
	Dim currentFolder
66
	' Attempt to remove PKG_NAME/PKG_VERSION/DOC folders
67
 
68
	' Attempting to remove DOC/
69
	currentFolder = sPath &"\"& sPkg_name &"\"& sPkg_version &"\"& DOC_FOLDER
70
	If Folder_Is_Empty ( currentFolder  ) Then Call DeleteFolder( currentFolder )
71
 
72
	' Attempting to remove PKG_VERSION/
73
	currentFolder = sPath &"\"& sPkg_name &"\"& sPkg_version
74
	If Folder_Is_Empty ( currentFolder  ) Then Call DeleteFolder( currentFolder )
75
 
76
	' Attempting to remove PKG_NAME/
77
	currentFolder = sPath &"\"& sPkg_name
78
	If Folder_Is_Empty ( currentFolder  ) Then Call DeleteFolder( currentFolder )
79
 
80
End Sub
81
 
82
 
83
Sub Remove_Unit_Test ( nTest_id, nPv_Id )
84
	Dim sPath, Pkg_name, Pkg_version, FullAttachmentName
85
	OraSession.BeginTrans
86
 
87
	Call Attachment_Name ( nTest_id, nPv_id, Pkg_name, Pkg_version, FullAttachmentName )
88
 
89
	sPath = Server.MapPath( TEMP_FOLDER )
90
	If Not IsNull( FullAttachmentName ) Then Call DeleteFile( sPath &"\"& FullAttachmentName )		' Delete the file if exists
91
 
92
	Call CleanUp_Folders ( sPath, Pkg_name, Pkg_version )
93
 
94
 
95
	OraDatabase.ExecuteSQL "DELETE FROM unit_tests WHERE test_id = "& nTest_id &" AND pv_id = "& nPv_id
96
  	OraSession.CommitTrans
97
End Sub
98
%>
99
<%
100
'-----------------------  MAIN LINE  ---------------------------
101
 
102
'--- Process submition ---
103
If (Request("pv_id") <> "") AND (Request("test_id") <> "")  Then
104
	' All mandatory parameters FOUND
105
	Call Get_Pkg_Info ( Request("pv_id"), Request("rtag_id") )
106
	Call Remove_Unit_Test ( Request("test_id"), Request("pv_id") )
107
	Call OpenInWindow ("_wform_test_documents.asp?bom_id="&Request("bom_id")&"&os_id="&Request("os_id")&"&prod_id="&Request("pv_id"))
108
Else
109
	Response.write "Some mandatory parameters are missing!" & "<br>" 'TODO
110
	Response.write QSTR_All 
111
 
112
End If
5962 dpurdie 113
Call Destroy_All_Objects
62 rsolanki 114
%>