| Line 1... |
Line 1... |
| 1 |
<%@LANGUAGE="VBSCRIPT"%>
|
1 |
<%@LANGUAGE="VBSCRIPT"%>
|
| 2 |
<%
|
2 |
<%
|
| 3 |
'=====================================================
|
3 |
'=====================================================
|
| 4 |
' REMOVE Unit Test
|
4 |
' REMOVE Unit Test
|
| 5 |
' --- PROCESS FORM ---
|
5 |
' --- PROCESS FORM ---
|
| 6 |
'=====================================================
|
6 |
'=====================================================
|
| 7 |
%>
|
7 |
%>
|
| 8 |
<%
|
8 |
<%
|
| 9 |
Option explicit
|
9 |
Option explicit
|
| 10 |
' Good idea to set when using redirect
|
10 |
' Good idea to set when using redirect
|
| 11 |
Response.Expires = 0 ' always load the page, dont store
|
11 |
Response.Expires = 0 ' always load the page, dont store
|
| 12 |
%>
|
12 |
%>
|
| 13 |
|
13 |
|
| 14 |
<!--#include file="common/conf.asp"-->
|
14 |
<!--#include file="common/conf.asp"-->
|
| 15 |
<!--#include file="common/globals.asp"-->
|
15 |
<!--#include file="common/globals.asp"-->
|
| 16 |
<!--#include file="common/formating.asp"-->
|
16 |
<!--#include file="common/formating.asp"-->
|
| Line 32... |
Line 32... |
| 32 |
Set pkgInfoHash = CreateObject("Scripting.Dictionary")
|
32 |
Set pkgInfoHash = CreateObject("Scripting.Dictionary")
|
| 33 |
'----------------------------------------------
|
33 |
'----------------------------------------------
|
| 34 |
%>
|
34 |
%>
|
| 35 |
<%
|
35 |
<%
|
| 36 |
Sub Attachment_Name ( nTest_id, nPv_id, outPkg_name, outPkg_version, outFullAttachmentName )
|
36 |
Sub Attachment_Name ( nTest_id, nPv_id, outPkg_name, outPkg_version, outFullAttachmentName )
|
| 37 |
Dim sqlstr, rsTemp
|
37 |
Dim sqlstr, rsTemp
|
| 38 |
sqlstr = _
|
38 |
sqlstr = _
|
| 39 |
" SELECT pkg.pkg_name, pv.pkg_version, ( pkg.pkg_name || '\' || pv.pkg_version || '\' || ut.results_attachment_name ) AS filename_path"&_
|
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"&_
|
40 |
" FROM UNIT_TESTS ut, PACKAGE_VERSIONS pv, PACKAGES pkg"&_
|
| 41 |
" WHERE ut.pv_id = pv.pv_id"&_
|
41 |
" WHERE ut.pv_id = pv.pv_id"&_
|
| 42 |
" AND pv.pkg_id = pkg.pkg_id"&_
|
42 |
" AND pv.pkg_id = pkg.pkg_id"&_
|
| 43 |
" AND ut.test_id = "& nTest_id &_
|
43 |
" AND ut.test_id = "& nTest_id &_
|
| 44 |
" AND ut.pv_id = "& nPv_id &_
|
44 |
" AND ut.pv_id = "& nPv_id &_
|
| 45 |
" AND ut.TEST_TYPES_FK <> "& enumTEST_TYPE_AUTOMATIC
|
45 |
" AND ut.TEST_TYPES_FK <> "& enumTEST_TYPE_AUTOMATIC
|
| 46 |
|
46 |
|
| 47 |
Set rsTemp = OraDatabase.DbCreateDynaset( sqlstr, cint(0))
|
47 |
Set rsTemp = OraDatabase.DbCreateDynaset( sqlstr, cint(0))
|
| 48 |
|
48 |
|
| 49 |
If ((NOT rsTemp.BOF) AND (NOT rsTemp.EOF)) Then
|
49 |
If ((NOT rsTemp.BOF) AND (NOT rsTemp.EOF)) Then
|
| 50 |
outPkg_name = rsTemp("pkg_name")
|
50 |
outPkg_name = rsTemp("pkg_name")
|
| 51 |
outPkg_version = rsTemp("pkg_version")
|
51 |
outPkg_version = rsTemp("pkg_version")
|
| 52 |
outFullAttachmentName = rsTemp("filename_path")
|
52 |
outFullAttachmentName = rsTemp("filename_path")
|
| 53 |
Else
|
53 |
Else
|
| 54 |
outFullAttachmentName = NULL
|
54 |
outFullAttachmentName = NULL
|
| 55 |
Call Get_Pkg_Short_Info( nPv_id, NULL, outPkg_name, outPkg_version, NULL, NULL, NULL )
|
55 |
Call Get_Pkg_Short_Info( nPv_id, NULL, outPkg_name, outPkg_version, NULL, NULL, NULL )
|
| 56 |
End If
|
56 |
End If
|
| 57 |
|
57 |
|
| 58 |
rsTemp.Close
|
58 |
rsTemp.Close
|
| 59 |
Set rsTemp = nothing
|
59 |
Set rsTemp = nothing
|
| 60 |
End Sub
|
60 |
End Sub
|
| 61 |
|
61 |
|
| 62 |
|
62 |
|
| 63 |
Sub CleanUp_Folders ( sPath, sPkg_name, sPkg_version )
|
63 |
Sub CleanUp_Folders ( sPath, sPkg_name, sPkg_version )
|
| 64 |
Dim currentFolder
|
64 |
Dim currentFolder
|
| 65 |
' Attempt to remove PKG_NAME/PKG_VERSION/DOC folders
|
65 |
' Attempt to remove PKG_NAME/PKG_VERSION/DOC folders
|
| 66 |
|
66 |
|
| 67 |
' Attempting to remove DOC/
|
67 |
' Attempting to remove DOC/
|
| 68 |
currentFolder = sPath &"\"& sPkg_name &"\"& sPkg_version &"\"& DOC_FOLDER
|
68 |
currentFolder = sPath &"\"& sPkg_name &"\"& sPkg_version &"\"& DOC_FOLDER
|
| 69 |
If Folder_Is_Empty ( currentFolder ) Then Call DeleteFolder( currentFolder )
|
69 |
If Folder_Is_Empty ( currentFolder ) Then Call DeleteFolder( currentFolder )
|
| 70 |
|
70 |
|
| 71 |
' Attempting to remove PKG_VERSION/
|
71 |
' Attempting to remove PKG_VERSION/
|
| 72 |
currentFolder = sPath &"\"& sPkg_name &"\"& sPkg_version
|
72 |
currentFolder = sPath &"\"& sPkg_name &"\"& sPkg_version
|
| 73 |
If Folder_Is_Empty ( currentFolder ) Then Call DeleteFolder( currentFolder )
|
73 |
If Folder_Is_Empty ( currentFolder ) Then Call DeleteFolder( currentFolder )
|
| 74 |
|
74 |
|
| 75 |
' Attempting to remove PKG_NAME/
|
75 |
' Attempting to remove PKG_NAME/
|
| 76 |
currentFolder = sPath &"\"& sPkg_name
|
76 |
currentFolder = sPath &"\"& sPkg_name
|
| 77 |
If Folder_Is_Empty ( currentFolder ) Then Call DeleteFolder( currentFolder )
|
77 |
If Folder_Is_Empty ( currentFolder ) Then Call DeleteFolder( currentFolder )
|
| 78 |
|
78 |
|
| 79 |
End Sub
|
79 |
End Sub
|
| 80 |
|
80 |
|
| 81 |
|
81 |
|
| 82 |
Sub Remove_Unit_Test ( nTest_id, nPv_Id )
|
82 |
Sub Remove_Unit_Test ( nTest_id, nPv_Id )
|
| 83 |
Dim sPath, Pkg_name, Pkg_version, FullAttachmentName
|
83 |
Dim sPath, Pkg_name, Pkg_version, FullAttachmentName
|
| - |
|
84 |
|
| - |
|
85 |
objEH.TryORA ( OraSession )
|
| 84 |
OraSession.BeginTrans
|
86 |
On Error Resume Next
|
| 85 |
|
87 |
|
| 86 |
Call Attachment_Name ( nTest_id, nPv_id, Pkg_name, Pkg_version, FullAttachmentName )
|
88 |
Call Attachment_Name ( nTest_id, nPv_id, Pkg_name, Pkg_version, FullAttachmentName )
|
| 87 |
|
89 |
|
| 88 |
sPath = Server.MapPath( TEMP_FOLDER )
|
90 |
sPath = Server.MapPath( TEMP_FOLDER )
|
| 89 |
If Not IsNull( FullAttachmentName ) Then Call DeleteFile( sPath &"\"& FullAttachmentName ) ' Delete the file if exists
|
91 |
If Not IsNull( FullAttachmentName ) Then Call DeleteFile( sPath &"\"& FullAttachmentName ) ' Delete the file if exists
|
| 90 |
|
92 |
|
| 91 |
Call CleanUp_Folders ( sPath, Pkg_name, Pkg_version )
|
93 |
Call CleanUp_Folders ( sPath, Pkg_name, Pkg_version )
|
| 92 |
|
94 |
|
| 93 |
|
- |
|
| 94 |
OraDatabase.ExecuteSQL "DELETE FROM unit_tests WHERE test_id = "& nTest_id &" AND pv_id = "& nPv_id
|
95 |
OraDatabase.ExecuteSQL "DELETE FROM unit_tests WHERE test_id = "& nTest_id &" AND pv_id = "& nPv_id
|
| - |
|
96 |
|
| 95 |
OraSession.CommitTrans
|
97 |
objEH.CatchORA ( OraSession )
|
| 96 |
End Sub
|
98 |
End Sub
|
| 97 |
%>
|
99 |
%>
|
| 98 |
<%
|
100 |
<%
|
| 99 |
'----------------------- MAIN LINE ---------------------------
|
101 |
'----------------------- MAIN LINE ---------------------------
|
| 100 |
|
102 |
|
| 101 |
'--- Process submition ---
|
103 |
'--- Process submition ---
|
| 102 |
If (Request("pv_id") <> "") AND (Request("test_id") <> "") Then
|
104 |
If (Request("pv_id") <> "") AND (Request("test_id") <> "") Then
|
| 103 |
' All mendatory parameters FOUND
|
105 |
' All mendatory parameters FOUND
|
| 104 |
Call Get_Pkg_Info ( Request("pv_id"), Request("rtag_id") )
|
106 |
Call Get_Pkg_Info ( Request("pv_id"), Request("rtag_id") )
|
| 105 |
Call Remove_Unit_Test ( Request("test_id"), Request("pv_id") )
|
107 |
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") )
|
108 |
Response.Redirect("fixed_issues.asp?pv_id="& Request("pv_id") &"&rtag_id="& Request("rtag_id") )
|
| 107 |
Else
|
109 |
Else
|
| 108 |
Response.write "Some mendatory parameters are missing!" & "<br>" 'TODO
|
110 |
Response.write "Some mendatory parameters are missing!" & "<br>" 'TODO
|
| 109 |
Response.write QSTR_All
|
111 |
Response.write QSTR_All
|
| 110 |
|
112 |
|
| 111 |
End If
|
113 |
End If
|
| 112 |
%>
|
114 |
%>
|
| 113 |
|
115 |
|
| 114 |
<!-- DESTRUCTOR ------->
|
116 |
<!-- DESTRUCTOR ------->
|
| 115 |
<!--#include file="common/destructor.asp"-->
|
- |
|
| 116 |
|
117 |
<!--#include file="common/destructor.asp"-->
|
| - |
|
118 |
|