Subversion Repositories DevTools

Rev

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