Rev 1281 | Blame | Compare with Previous | Last modification | View Log | RSS feed
<%@LANGUAGE="VBSCRIPT"%><%'=====================================================' REMOVE Unit Test' --- PROCESS FORM ---'=====================================================%><%Option explicit' Good idea to set when using redirectResponse.Expires = 0 ' always load the page, dont store%><!--#include file="common/conf.asp"--><!--#include file="common/globals.asp"--><!--#include file="common/formating.asp"--><!--#include file="common/qstr.asp"--><!--#include file="common/common_subs.asp"--><!--#include file="common/common_dbedit.asp"--><%' Set rfile parameter. This is a return page after LoginCall objPMod.StoreParameter ( "rfile", "fixed_issues.asp" )'------------ ACCESS CONTROL ------------------%><!--#include file="_access_control_login.asp"--><!--#include file="_access_control_general.asp"--><!--#include file="_access_control_project.asp"--><%'------------ Variable Definition -------------'------------ Constants Declaration -----------'------------ Variable Init -------------------Set pkgInfoHash = CreateObject("Scripting.Dictionary")'----------------------------------------------%><%Sub Attachment_Name ( nTest_id, nPv_id, outPkg_name, outPkg_version, outFullAttachmentName )Dim sqlstr, rsTempsqlstr = _" SELECT pkg.pkg_name, pv.pkg_version, ( pkg.pkg_name || '\' || pv.pkg_version || '\' || ut.results_attachment_name ) AS filename_path"&_" FROM UNIT_TESTS ut, PACKAGE_VERSIONS pv, PACKAGES pkg"&_" WHERE ut.pv_id = pv.pv_id"&_" AND pv.pkg_id = pkg.pkg_id"&_" AND ut.test_id = "& nTest_id &_" AND ut.pv_id = "& nPv_id &_" AND ut.TEST_TYPES_FK <> "& enumTEST_TYPE_AUTOMATICSet rsTemp = OraDatabase.DbCreateDynaset( sqlstr, cint(0))If ((NOT rsTemp.BOF) AND (NOT rsTemp.EOF)) ThenoutPkg_name = rsTemp("pkg_name")outPkg_version = rsTemp("pkg_version")outFullAttachmentName = rsTemp("filename_path")ElseoutFullAttachmentName = NULLCall Get_Pkg_Short_Info( nPv_id, NULL, outPkg_name, outPkg_version, NULL, NULL, NULL )End IfrsTemp.CloseSet rsTemp = nothingEnd SubSub CleanUp_Folders ( sPath, sPkg_name, sPkg_version )Dim currentFolder' Attempt to remove PKG_NAME/PKG_VERSION/DOC folders' Attempting to remove DOC/currentFolder = sPath &"\"& sPkg_name &"\"& sPkg_version &"\"& DOC_FOLDERIf Folder_Is_Empty ( currentFolder ) Then Call DeleteFolder( currentFolder )' Attempting to remove PKG_VERSION/currentFolder = sPath &"\"& sPkg_name &"\"& sPkg_versionIf Folder_Is_Empty ( currentFolder ) Then Call DeleteFolder( currentFolder )' Attempting to remove PKG_NAME/currentFolder = sPath &"\"& sPkg_nameIf Folder_Is_Empty ( currentFolder ) Then Call DeleteFolder( currentFolder )End SubSub Remove_Unit_Test ( nTest_id, nPv_Id )Dim sPath, Pkg_name, Pkg_version, FullAttachmentNameobjEH.TryORA ( OraSession )On Error Resume NextCall Attachment_Name ( nTest_id, nPv_id, Pkg_name, Pkg_version, FullAttachmentName )sPath = Server.MapPath( TEMP_FOLDER )If Not IsNull( FullAttachmentName ) Then Call DeleteFile( sPath &"\"& FullAttachmentName ) ' Delete the file if existsCall CleanUp_Folders ( sPath, Pkg_name, Pkg_version )OraDatabase.ExecuteSQL "DELETE FROM unit_tests WHERE test_id = "& nTest_id &" AND pv_id = "& nPv_idobjEH.CatchORA ( OraSession )End Sub%><%'----------------------- MAIN LINE ---------------------------'--- Process submition ---If (Request("pv_id") <> "") AND (Request("test_id") <> "") Then' All mandatory parameters FOUNDCall Get_Pkg_Info ( Request("pv_id"), Request("rtag_id") )Call Remove_Unit_Test ( Request("test_id"), Request("pv_id") )Response.Redirect("fixed_issues.asp?pv_id="& Request("pv_id") &"&rtag_id="& Request("rtag_id") )ElseResponse.write "Some mandatory parameters are missing!" & "<br>" 'TODOResponse.write QSTR_AllEnd If%><!-- DESTRUCTOR -------><!--#include file="common/destructor.asp"-->