Subversion Repositories DevTools

Rev

Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
119 ghuddy 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/conf.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
<!--#include file="_access_control_login.asp"-->
26
<!--#include file="_access_control_general.asp"-->
27
<!--#include file="_access_control_project.asp"-->
28
<%
29
'------------ Variable Definition -------------
30
'------------ Constants Declaration -----------
31
'------------ Variable Init -------------------
32
Set pkgInfoHash = CreateObject("Scripting.Dictionary")
33
'----------------------------------------------
34
%>
35
<%
36
Sub Attachment_Name ( nTest_id, nPv_id, outPkg_name, outPkg_version, outFullAttachmentName )
37
	Dim sqlstr, rsTemp
38
	sqlstr = _
39
	" SELECT pkg.pkg_name, pv.pkg_version, ( pkg.pkg_name || '\' || pv.pkg_version || '\' || ut.results_attachment_name ) AS filename_path"&_
40
	"   FROM UNIT_TESTS ut, PACKAGE_VERSIONS pv, PACKAGES pkg"&_
41
	"  WHERE ut.pv_id = pv.pv_id"&_
42
	"    AND pv.pkg_id = pkg.pkg_id"&_
43
	"    AND ut.test_id = "& nTest_id &_
44
	"    AND ut.pv_id = "& nPv_id &_
45
	"    AND ut.TEST_TYPES_FK <> "& enumTEST_TYPE_AUTOMATIC
46
 
47
	Set rsTemp = OraDatabase.DbCreateDynaset( sqlstr, cint(0))
48
 
49
	If ((NOT rsTemp.BOF) AND (NOT rsTemp.EOF)) Then
50
		outPkg_name = rsTemp("pkg_name")
51
		outPkg_version = rsTemp("pkg_version")
52
		outFullAttachmentName = rsTemp("filename_path")
53
	Else
54
		outFullAttachmentName = NULL
55
		Call Get_Pkg_Short_Info( nPv_id, NULL, outPkg_name, outPkg_version, NULL, NULL, NULL )
56
	End If
57
 
58
	rsTemp.Close
59
	Set rsTemp = nothing
60
End Sub
61
 
62
 
63
Sub CleanUp_Folders ( sPath, sPkg_name, sPkg_version )
64
	Dim currentFolder
65
	' Attempt to remove PKG_NAME/PKG_VERSION/DOC folders
66
 
67
	' Attempting to remove DOC/
68
	currentFolder = sPath &"\"& sPkg_name &"\"& sPkg_version &"\"& DOC_FOLDER
69
	If Folder_Is_Empty ( currentFolder  ) Then Call DeleteFolder( currentFolder )
70
 
71
	' Attempting to remove PKG_VERSION/
72
	currentFolder = sPath &"\"& sPkg_name &"\"& sPkg_version
73
	If Folder_Is_Empty ( currentFolder  ) Then Call DeleteFolder( currentFolder )
74
 
75
	' Attempting to remove PKG_NAME/
76
	currentFolder = sPath &"\"& sPkg_name
77
	If Folder_Is_Empty ( currentFolder  ) Then Call DeleteFolder( currentFolder )
78
 
79
End Sub
80
 
81
 
82
Sub Remove_Unit_Test ( nTest_id, nPv_Id )
83
	Dim sPath, Pkg_name, Pkg_version, FullAttachmentName
84
	OraSession.BeginTrans
85
 
86
	Call Attachment_Name ( nTest_id, nPv_id, Pkg_name, Pkg_version, FullAttachmentName )
87
 
88
	sPath = Server.MapPath( TEMP_FOLDER )
89
	If Not IsNull( FullAttachmentName ) Then Call DeleteFile( sPath &"\"& FullAttachmentName )		' Delete the file if exists
90
 
91
	Call CleanUp_Folders ( sPath, Pkg_name, Pkg_version )
92
 
93
 
94
	OraDatabase.ExecuteSQL "DELETE FROM unit_tests WHERE test_id = "& nTest_id &" AND pv_id = "& nPv_id
95
  	OraSession.CommitTrans
96
End Sub
97
%>
98
<%
99
'-----------------------  MAIN LINE  ---------------------------
100
 
101
'--- Process submition ---
102
If (Request("pv_id") <> "") AND (Request("test_id") <> "")  Then
103
	' All mendatory parameters FOUND
104
	Call Get_Pkg_Info ( Request("pv_id"), Request("rtag_id") )
105
	Call Remove_Unit_Test ( Request("test_id"), Request("pv_id") )
106
	Response.Redirect("fixed_issues.asp?pv_id="& Request("pv_id") &"&rtag_id="& Request("rtag_id") )
107
Else
108
	Response.write "Some mendatory parameters are missing!" & "<br>" 'TODO
109
	Response.write QSTR_All 
110
 
111
End If
112
%>
113
 
114
<!-- DESTRUCTOR ------->
115
<!--#include file="common/destructor.asp"-->