Subversion Repositories DevTools

Rev

Rev 6579 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
6289 dpurdie 1
<%@LANGUAGE="VBSCRIPT"%>
2
<%
3
'=====================================================
4
'   _delete_package_name.asp
5
'   Intended to be invoked within an Iframe
6
'=====================================================
7
%>
8
<%
9
Option explicit
10
Response.Expires = 0
11
%>
12
<!--#include file="common/conf.asp"-->
13
<!--#include file="common/globals.asp"-->
14
<!--#include file="common/formating.asp"-->
15
<!--#include file="common/qstr.asp"-->
16
<!--#include file="common/common_subs.asp"-->
7286 dpurdie 17
<!--#include file="common/_popup_window_common.asp"-->
6289 dpurdie 18
<!--#include file="common/_form_window_common.asp"-->
19
<%
20
'------------ ACCESS CONTROL ------------------
21
%>
22
<!--#include file="_access_control_login_optional.asp"-->
23
<!--#include file="_access_control_general.asp"-->
24
<%
25
'------------ VARIABLE DEFINITION -------------
26
Dim sMessage, sMessageType
27
Dim parPkgId
28
Dim rsQry
29
Dim Qstring
30
Dim pName
31
Dim canDoBad
32
'------------ CONSTANTS DECLARATION -----------
33
'------------ VARIABLE INIT -------------------
34
sMessage = NULL
35
sMessageType = 3
36
parPkgId = Request("pkgId")
37
canDoBad = canShowControlInProject ("CreateNewVersion")
38
Set objFormCollector = CreateObject("Scripting.Dictionary")
39
'------------ CONDITIONS ----------------------
40
'----------------------------------------------
41
%>
42
<%
43
'------------------------------------------------------------------------------------------------------------------------------------------
44
'
45
' Add a line of text to the System Message
46
'   eLevel - 1 == Critical, 2==Warning, 3==Note
47
Sub sMessageAdd(eLevel, text)
48
    If NOT isNull(sMessage) Then
49
        sMessage = sMessage & "<br>"
50
    End If
51
    sMessage = sMessage & text
52
 
53
    If eLevel < sMessageType  Then
54
        sMessageType = eLevel
55
    End If
56
End Sub
57
 
58
'
59
'   Check that the package is not in use
60
'
61
Function GetPackageVersionCount (nPkgId)
62
    Dim SqlQry
63
    Dim rsQry
64
    GetPackageVersionCount = 0
65
 
66
    OraDatabase.Parameters.Add "PKGID",             nPkgId,             ORAPARM_INPUT,  ORATYPE_NUMBER
67
 
68
    objEH.ErrorRedirect = FALSE
69
    objEH.TryORA ( OraSession )
70
    On Error Resume Next
71
 
72
    SqlQry = "select count(*) as count from PACKAGES pkg, PACKAGE_VERSIONS pv " &_
73
           " where pv.PKG_ID = pkg.PKG_ID AND pkg.PKG_ID = :PKGID"
74
 
75
    Set rsQry = OraDatabase.DbCreateDynaset( SqlQry, ORADYN_DEFAULT )
76
    objEH.CatchORA ( OraSession )
77
 
78
    If objEH.Finally Then
79
        If ((NOT rsQry.BOF) AND (NOT rsQry.EOF)) Then
80
            GetPackageVersionCount = rsQry("count")
81
        End If
82
    End If
83
 
84
    rsQry.Close
85
    Set rsQry = Nothing
86
    OraDatabase.Parameters.Remove "PKGID"
87
 
88
End Function
89
 
90
'
91
'   Delete the package name
92
Sub DestroyPackage ( nPkgId )
93
    OraDatabase.Parameters.Add "PKGID",             nPkgId,             ORAPARM_INPUT,  ORATYPE_NUMBER
94
 
95
    objEH.ErrorRedirect = FALSE
96
    objEH.TryORA ( OraSession )
97
    On Error Resume Next
98
 
99
    OraDatabase.ExecuteSQL "delete from packages where pkg_id = :PKGID"
100
    objEH.CatchORA ( OraSession )
101
 
102
    OraDatabase.Parameters.Remove "PKGID"
103
End Sub
104
 
105
'------------ RUN BEFORE PAGE RENDER ----------
106
' Setup persistance object
107
Call objPMod.StoreParameter ( "bfile", Request("bfile") )
108
Call objPMod.StoreParameter ( "pkgid", Request("pkgid") )
109
'   Basic sanity checks
110
'
111
If objAccessControl.UserId = "" Then
112
    sMessageAdd 1, "No longer logged in"
113
End If
114
 
115
If parPkgId = "" Then
116
    sMessageAdd 1, "Internal: PKGID not provided"
117
End If
118
 
119
If CBool(Request("action")) AND isNULL(sMessage) Then
120
    '
121
    '   Attempt to destroy the package name
122
    DestroyPackage parPkgId
123
    If GetPackageVersionCount(parPkgId) = 0 Then
124
        If Request("bfile") <> "" Then
125
            OpenInParentWindow(objPMod.GetParamValue("bfile") &"?DESTROYED=OK"& objPMod.ComposeURLWithout("bfile,pkgId"))
126
        Else
127
            ReloadParentWindow()
128
        End If
129
        Call Destroy_All_Objects
130
        Response.End
131
    End If
132
End If
133
 
134
'   Need to generate a display
135
'   Get the Package Version information
136
'
137
Qstring = "SELECT p.pkg_name" &_
138
          " FROM packages p" &_
139
          " WHERE p.pkg_id = " & parPkgId
140
 
141
Set rsQry = OraDatabase.DbCreateDynaset( Qstring, cint(0))
142
If rsQry.RecordCount = 0 Then
143
    sMessageAdd 1, "Package Name no longer exists"
144
End If
145
If NOT canDoBad Then
146
    sMessageAdd 1, "You do not have permission to delete a unused package name"
147
End If
148
 
149
If GetPackageVersionCount(parPkgId) <> 0  Then
150
    sMessageAdd 1, "Package name is used. Cannot delete a name that is in use"
151
End If
152
pName = rsQry("pkg_name")
153
rsQry.Close
154
Set rsQry = nothing
155
 
156
'----------------------------------------------
157
%>
158
<html>
159
<head>
160
<title>Release Manager</title>
161
<link rel="shortcut icon" href="<%=FavIcon%>"/>
162
<meta HTTP-EQUIV="Pragma" CONTENT="no-cache">
163
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
6579 dpurdie 164
<link href="images/release_manager_style.css?ver=<%=VixVerNum%>" rel="stylesheet" type="text/css">
165
<script language="JavaScript" src="images/common.js?ver=<%=VixVerNum%>"></script>
6289 dpurdie 166
</head>
167
<body background="images/bg_bage_0.gif" leftmargin="0" topmargin="0" >
168
<table class="full_table body_txt" border="0" cellspacing="0" cellpadding="10">
169
   <tr>
170
      <td bgcolor="#FFFFFF" class="body_txt nowrap">
171
        <%=enum_IMG_Critical%><span>You are about to delete the unused package name: <%=pName%>.</span>
172
      </td>
173
   </tr>
174
   <%
175
   '-- FROM START --------------------------------------------------------------------------------------------------------------
176
   objFormComponent.FormName = "FormName"
177
   objFormComponent.FormClass = "form_tight"
178
   objFormComponent.Action = ScriptName
179
   Call objFormComponent.FormStart()
180
   %>
181
   <tr>
182
      <td>
183
         <!-- NEW PRODUCT +++++++++++++++++++++++++++++++++++++++++++++++ -->
184
         <%Call Messenger ( sMessage , sMessageType, "100%" )%>
185
         <!-- MESSAGE +++++++++++++++++++++++++++++++++++++++++++++++++++ -->
186
         <!--#include file="messages/_msg_inline.asp"-->
187
 
188
      </td>
189
   </tr>
190
   <tr>
191
      <td bgcolor="#FFFFFF">
192
         <table class=full_table >
193
            <tr>
194
               <td><%=ProgressBar()%></td>
195
               <td align="right">
196
                  <%If isNULL(sMessage) Then%>
197
                  <input name="btn" type="submit" class="form_btn" value="Delete">
198
                  <%End If%>
199
                  <input name="btn" type="reset" class="form_btn" value="Cancel" onclick="parent.closeIFrame();">
200
               </td>
201
            </tr>
202
         </table>
203
      </td>
204
   </tr>
205
   <%=objPMod.ComposeHiddenTags()%>
206
   <input type="hidden" name="action" value="true">
207
   <%
208
   Call objFormComponent.FormEnd()
209
   '-- FROM END ----------------------------------------------------------------------------------------------------------------
210
   %>
211
</table>
212
</body>
213
</html>
214
<%
215
'------------ RUN AFTER PAGE RENDER -----------
216
Set objFormCollector = Nothing
217
'----------------------------------------------
218
On Error Resume Next
219
Call Destroy_All_Objects
220
%>
221
 
222