Subversion Repositories DevTools

Rev

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

Rev Author Line No. Line
119 ghuddy 1
<%@LANGUAGE="VBSCRIPT"%>
2
<%
3
'=====================================================
129 ghuddy 4
'                 REMOVE Unit Test
119 ghuddy 5
'               --- PROCESS FORM ---
6
'=====================================================
7
%>
8
<%
9
Option explicit
10
' Good idea to set when using redirect
129 ghuddy 11
Response.Expires = 0   ' always load the page, dont store
119 ghuddy 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 )
129 ghuddy 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
119 ghuddy 60
End Sub
61
 
62
 
63
Sub CleanUp_Folders ( sPath, sPkg_name, sPkg_version )
129 ghuddy 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
 
119 ghuddy 79
End Sub
80
 
81
 
82
Sub Remove_Unit_Test ( nTest_id, nPv_Id )
129 ghuddy 83
   Dim sPath, Pkg_name, Pkg_version, FullAttachmentName
119 ghuddy 84
 
129 ghuddy 85
   objEH.TryORA ( OraSession )
86
   On Error Resume Next
119 ghuddy 87
 
129 ghuddy 88
   Call Attachment_Name ( nTest_id, nPv_id, Pkg_name, Pkg_version, FullAttachmentName )
89
 
90
   sPath = Server.MapPath( TEMP_FOLDER )
91
   If Not IsNull( FullAttachmentName ) Then Call DeleteFile( sPath &"\"& FullAttachmentName )      ' Delete the file if exists
92
 
93
   Call CleanUp_Folders ( sPath, Pkg_name, Pkg_version )
94
 
95
   OraDatabase.ExecuteSQL "DELETE FROM unit_tests WHERE test_id = "& nTest_id &" AND pv_id = "& nPv_id
96
 
97
   objEH.CatchORA ( OraSession )
119 ghuddy 98
End Sub
99
%>
100
<%
101
'-----------------------  MAIN LINE  ---------------------------
102
 
103
'--- Process submition ---
104
If (Request("pv_id") <> "") AND (Request("test_id") <> "")  Then
1337 dpurdie 105
   ' All mandatory parameters FOUND
129 ghuddy 106
   Call Get_Pkg_Info ( Request("pv_id"), Request("rtag_id") )
107
   Call Remove_Unit_Test ( Request("test_id"), Request("pv_id") )
108
   Response.Redirect("fixed_issues.asp?pv_id="& Request("pv_id") &"&rtag_id="& Request("rtag_id") )
119 ghuddy 109
Else
1337 dpurdie 110
   Response.write "Some mandatory parameters are missing!" & "<br>" 'TODO
129 ghuddy 111
   Response.write QSTR_All
112
 
119 ghuddy 113
End If
114
%>
115
 
116
<!-- DESTRUCTOR ------->
129 ghuddy 117
<!--#include file="common/destructor.asp"-->