| 119 |
ghuddy |
1 |
<%@LANGUAGE="VBSCRIPT"%>
|
|
|
2 |
<%
|
|
|
3 |
Option explicit
|
| 129 |
ghuddy |
4 |
Response.Expires = 0 ' always load the page, dont store
|
| 119 |
ghuddy |
5 |
%>
|
|
|
6 |
<%
|
|
|
7 |
'=====================================================
|
| 129 |
ghuddy |
8 |
' Import Issues
|
| 119 |
ghuddy |
9 |
'=====================================================
|
|
|
10 |
%>
|
|
|
11 |
<!--#include file="common/conf.asp"-->
|
|
|
12 |
<!--#include file="common/globals.asp"-->
|
|
|
13 |
<!--#include file="common/qstr.asp"-->
|
|
|
14 |
<!--#include file="common/common_subs.asp"-->
|
|
|
15 |
<!--#include file="common/common_dbedit.asp"-->
|
|
|
16 |
<!--#include file="common/formating.asp"-->
|
|
|
17 |
<!--#include file="common/_popup_window_common.asp"-->
|
|
|
18 |
<%
|
|
|
19 |
' Set rfile parameter. This is a return page after Login
|
|
|
20 |
Call objPMod.StoreParameter ( "rfile", "fixed_issues.asp" )
|
|
|
21 |
'------------ ACCESS CONTROL ------------------
|
|
|
22 |
%>
|
|
|
23 |
<!--#include file="_access_control_login.asp"-->
|
|
|
24 |
<!--#include file="_access_control_general.asp"-->
|
|
|
25 |
<!--#include file="_access_control_project.asp"-->
|
|
|
26 |
<%
|
|
|
27 |
'------------ Variable Definition -------------
|
|
|
28 |
Dim parPv_id
|
|
|
29 |
Dim parFRiss_id
|
|
|
30 |
Dim parFRiss_num
|
| 171 |
brianf |
31 |
Dim parFRpkey
|
| 119 |
ghuddy |
32 |
Dim rsCQ
|
| 4235 |
dpurdie |
33 |
Dim rspPage ' current page number for multiple page results
|
|
|
34 |
Dim rspTotal ' total number of records
|
|
|
35 |
Dim rspCount ' Record counter
|
| 129 |
ghuddy |
36 |
Dim rspTotalPages ' Total number of pages required to display results
|
| 119 |
ghuddy |
37 |
Dim imported
|
|
|
38 |
Dim retVal
|
|
|
39 |
Dim SQLstr
|
|
|
40 |
Dim parIStates
|
|
|
41 |
'------------ Constants Declaration -----------
|
| 1332 |
dpurdie |
42 |
Const rspMax = 15 ' maximum number of records displayed
|
| 119 |
ghuddy |
43 |
Const LENUM_ALL = "ALL"
|
|
|
44 |
'------------ Variable Init -------------------
|
|
|
45 |
parPv_id = Request("pv_id")
|
|
|
46 |
parRtag_id = Request("rtag_id")
|
|
|
47 |
rspPage = Request("rpg")
|
|
|
48 |
parFRiss_id = Request("FRiss_id")
|
|
|
49 |
parFRiss_num = Request("FRiss_num")
|
|
|
50 |
parIStates = Request("istates")
|
| 171 |
brianf |
51 |
parFRpkey = Request("FRpkey")
|
| 119 |
ghuddy |
52 |
|
|
|
53 |
Set rsCQ = Server.CreateObject("ADODB.Recordset")
|
|
|
54 |
|
|
|
55 |
imported = FALSE
|
|
|
56 |
'-- CONDITIONS --------------------------------
|
|
|
57 |
If rspPage = "" Then rspPage = 1
|
| 4183 |
dpurdie |
58 |
if InStr(1, Request("btn"), "Find",1) Then rspPage = 1
|
| 119 |
ghuddy |
59 |
If (parFRiss_num = "") Then parFRiss_num = LENUM_ALL
|
| 171 |
brianf |
60 |
|
|
|
61 |
If (parFRpkey = "") Then
|
|
|
62 |
parFRpkey = GetDefaultProjectKey(Request("rtag_id"))
|
|
|
63 |
if parFRpkey="" OR IsNull(parFRpkey) Then parFRpkey = LENUM_ALL
|
|
|
64 |
End If
|
|
|
65 |
|
| 119 |
ghuddy |
66 |
'----------------------------------------------
|
| 4183 |
dpurdie |
67 |
'Response.write "btn="& Request("btn") & "rspPage=" &rspPage&"<br>"
|
| 119 |
ghuddy |
68 |
'Response.write "parPackage="& parPackage &", parProject="& parProject &", parProduct="& parProduct &", parSkipOpen="& parSkipOpen &"<br>"
|
| 4235 |
dpurdie |
69 |
'Response.write "parPv_id="& parPv_id &", parRtag_id="& parRtag_id &", rspPage="& rspPage &", parFRiss_id="& parFRiss_id &", parFRiss_num="& parFRiss_num
|
| 119 |
ghuddy |
70 |
'Response.write "parIStates="& parIStates &", parSkipOpen="& parSkipOpen
|
|
|
71 |
%>
|
|
|
72 |
<%
|
|
|
73 |
'------------------------------------------------------------------------------------------------------------------------------------
|
| 4235 |
dpurdie |
74 |
Function Get_Issues ( NNiss_num, NNrecordCount, OOrsCQ, apkey)
|
| 129 |
ghuddy |
75 |
Dim SQLstr, issARR, iss_num, col_name, Title
|
| 119 |
ghuddy |
76 |
|
| 129 |
ghuddy |
77 |
SQLstr = _
|
| 4169 |
dpurdie |
78 |
"SELECT project.pkey as project, I.issuenum AS iss_num, I.summary as summary, ISS.pname AS state "&_
|
| 129 |
ghuddy |
79 |
"FROM jiraissue I, project, issuestatus ISS "&_
|
| 4169 |
dpurdie |
80 |
"WHERE I.project=project.id "
|
| 1334 |
dpurdie |
81 |
|
| 171 |
brianf |
82 |
If ( apkey <> LENUM_ALL ) Then
|
|
|
83 |
SQLstr = SQLstr & "AND project.pkey='"& apkey &"' "
|
|
|
84 |
End If
|
|
|
85 |
SQLstr = SQLstr & "AND I.issuestatus = ISS.ID "
|
| 129 |
ghuddy |
86 |
|
|
|
87 |
'-- Keyword search --
|
|
|
88 |
If ( NNiss_num <> LENUM_ALL ) Then
|
|
|
89 |
issARR = Split( Replace( NNiss_num, " ", ""), "," )
|
|
|
90 |
|
| 4169 |
dpurdie |
91 |
col_name = "I.issuenum"
|
| 129 |
ghuddy |
92 |
SQLstr = SQLstr & " AND ( "
|
| 4183 |
dpurdie |
93 |
for Each iss_num IN issARR
|
| 129 |
ghuddy |
94 |
SQLstr = SQLstr &" ("& col_name &" LIKE '%"& iss_num &"%') OR"
|
|
|
95 |
Next
|
|
|
96 |
|
|
|
97 |
SQLstr = Left( SQLstr, Len(SQLstr) - 2 ) ' Remove last 'OR'
|
|
|
98 |
|
|
|
99 |
SQLstr = SQLstr & " ) "
|
|
|
100 |
|
|
|
101 |
End If
|
|
|
102 |
|
| 1334 |
dpurdie |
103 |
'-- Get record count --- MAYBE MORE SPEED HERE?!??!
|
| 129 |
ghuddy |
104 |
NNrecordCount = Get_Record_Count( SQLstr )
|
|
|
105 |
|
| 1334 |
dpurdie |
106 |
DIM objConnection
|
|
|
107 |
|
|
|
108 |
'ADDED BY RICHO 6th August 2012 - Increase Speed
|
|
|
109 |
Set objConnection = Server.CreateObject ("ADODB.Connection")
|
|
|
110 |
objConnection.Open JIRA_conn
|
|
|
111 |
|
|
|
112 |
On Error Resume Next
|
| 3975 |
dpurdie |
113 |
'Response.Write(SQLstr)
|
|
|
114 |
|
| 1334 |
dpurdie |
115 |
OOrsCQ.Open SQLstr, objConnection
|
| 129 |
ghuddy |
116 |
|
| 4169 |
dpurdie |
117 |
Get_Issues = Err.Number
|
| 129 |
ghuddy |
118 |
|
|
|
119 |
End Function
|
| 119 |
ghuddy |
120 |
'------------------------------------------------------------------------------------------------------------------------------------
|
|
|
121 |
Function Get_Record_Count ( SSsql )
|
| 129 |
ghuddy |
122 |
Dim rsTemp
|
|
|
123 |
Set rsTemp = Server.CreateObject("ADODB.Recordset")
|
|
|
124 |
rsTemp.ActiveConnection = JIRA_conn
|
|
|
125 |
'Response.Write(rsTemp.ActiveConnection)
|
| 119 |
ghuddy |
126 |
|
| 129 |
ghuddy |
127 |
rsTemp.Source = _
|
|
|
128 |
" SELECT COUNT(*) as record_count "&_
|
|
|
129 |
" FROM ("& SSsql &") ct"
|
|
|
130 |
|
|
|
131 |
rsTemp.CursorType = 0
|
|
|
132 |
rsTemp.CursorLocation = 2
|
|
|
133 |
rsTemp.LockType = 3
|
|
|
134 |
rsTemp.Open()
|
|
|
135 |
|
|
|
136 |
If (NOT rsTemp.BOF) AND (NOT rsTemp.EOF) Then
|
|
|
137 |
Get_Record_Count = rsTemp("record_count")
|
|
|
138 |
Else
|
|
|
139 |
Get_Record_Count = 0
|
|
|
140 |
End If
|
|
|
141 |
|
|
|
142 |
rsTemp.Close
|
|
|
143 |
Set rsTemp = nothing
|
| 119 |
ghuddy |
144 |
End Function
|
|
|
145 |
'------------------------------------------------------------------------------------------------------------------------------------
|
| 4235 |
dpurdie |
146 |
Sub Import_Issues ( NNpv_id, NNiss_id_list )
|
| 4169 |
dpurdie |
147 |
Dim issArr , iss_id
|
| 129 |
ghuddy |
148 |
If NNiss_id_list = "" Then Exit Sub
|
| 119 |
ghuddy |
149 |
|
| 129 |
ghuddy |
150 |
issArr = Split ( NNiss_id_list, ",")
|
| 4169 |
dpurdie |
151 |
'Response.Write("Import_Issues" & NNiss_id_list)
|
| 129 |
ghuddy |
152 |
|
|
|
153 |
objEH.TryORA ( OraSession )
|
|
|
154 |
On Error Resume Next
|
|
|
155 |
|
|
|
156 |
For Each iss_id In issArr
|
|
|
157 |
|
|
|
158 |
If Err.Number = 0 Then
|
|
|
159 |
OraDatabase.ExecuteSQL _
|
|
|
160 |
" INSERT INTO JIRA_ISSUES ( pv_id, iss_key, date_time_stamp )"&_
|
|
|
161 |
" VALUES ( "& NNpv_id &", '"& LTrim(iss_id) &"', "& ORA_SYSDATETIME &")"
|
|
|
162 |
|
|
|
163 |
If Err.Number = 0 Then
|
|
|
164 |
OraDatabase.ExecuteSQL _
|
|
|
165 |
"BEGIN Log_Action ( "& NNpv_id &", 'jira_issue_added', "& objAccessControl.UserId &", 'Issue number: "& LTrim(iss_id) &"' ); END;"
|
|
|
166 |
End If
|
|
|
167 |
|
|
|
168 |
End If
|
|
|
169 |
Next
|
|
|
170 |
|
|
|
171 |
objEH.CatchORA ( OraSession )
|
| 119 |
ghuddy |
172 |
End Sub
|
|
|
173 |
'------------------------------------------------------------------------------------------------------------------------------------
|
| 171 |
brianf |
174 |
Function GetDefaultProjectKey(artag_id)
|
|
|
175 |
Dim rsProjId
|
|
|
176 |
Set rsProjId = OraDatabase.DbCreateDynaset("SELECT PRJ.JIRA_KEY FROM RELEASE_TAGS RLT, PROJECTS PRJ WHERE RLT.RTAG_ID ="& artag_id &" AND RLT.PROJ_ID = PRJ.PROJ_ID", cint(0))
|
|
|
177 |
GetDefaultProjectKey = rsProjId("jira_key")
|
|
|
178 |
Set rsProjId = Nothing
|
|
|
179 |
End Function
|
|
|
180 |
'------------------------------------------------------------------------------------------------------------------------------------
|
| 119 |
ghuddy |
181 |
%>
|
|
|
182 |
<%
|
|
|
183 |
'Process submition
|
|
|
184 |
If CBool(Request("action")) AND (Request("btn") = "Import") AND objAccessControl.UserLogedIn Then
|
| 4235 |
dpurdie |
185 |
Call Import_Issues ( parPv_id, parFRiss_id )
|
| 129 |
ghuddy |
186 |
imported = TRUE
|
|
|
187 |
Call OpenInParentWindow ("fixed_issues.asp?pv_id="& parPv_id &"&rtag_id="& parRtag_id)
|
| 119 |
ghuddy |
188 |
End If
|
|
|
189 |
%>
|
|
|
190 |
<%
|
|
|
191 |
'-------------- Main Line ---------------
|
|
|
192 |
|
| 4235 |
dpurdie |
193 |
retVal = Get_Issues ( parFRiss_num, rspTotal, rsCQ, parFRpkey)
|
| 119 |
ghuddy |
194 |
|
|
|
195 |
' total number of pages required
|
|
|
196 |
rspTotalPages = rspTotal \ rspMax
|
|
|
197 |
If (rspTotal Mod rspMax) > 0 Then rspTotalPages = rspTotalPages + 1
|
|
|
198 |
%>
|
|
|
199 |
<html>
|
|
|
200 |
<head>
|
|
|
201 |
<title>Release Manager</title>
|
|
|
202 |
<meta HTTP-EQUIV="Pragma" CONTENT="no-cache">
|
|
|
203 |
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
|
|
|
204 |
<link rel="stylesheet" href="images/release_manager_style.css" type="text/css">
|
|
|
205 |
<link rel="stylesheet" href="images/navigation.css" type="text/css">
|
|
|
206 |
<script language="JavaScript" src="images/common.js"></script>
|
|
|
207 |
</head>
|
|
|
208 |
<body bgcolor="#FFFFFF" text="#000000" leftmargin="0" topmargin="0" onload="self.focus();">
|
|
|
209 |
<%If retVal = 0 Then%>
|
|
|
210 |
<form name="importform" method="post" action="<%=scriptName%>">
|
| 4235 |
dpurdie |
211 |
<table width="100%" height="100%" border="0" cellspacing="0" cellpadding="2">
|
|
|
212 |
<!-- Form Body -->
|
|
|
213 |
<tr height="1%">
|
|
|
214 |
<td nowrap class="wform_ttl" background="images/bg_admin_dark.gif">
|
|
|
215 |
<table border="0" cellspacing="5" cellpadding="0">
|
|
|
216 |
<tr>
|
|
|
217 |
<td align="left" class="wform_ttl">Issue Number</td>
|
|
|
218 |
<td nowrap><input name="FRiss_num" type="text" class="form_item" id="FRiss_num" value="<%=parFRiss_num%>" size="30" > <span class="form_wtxt_link">Example: ALL, 123, or a list</span></td>
|
|
|
219 |
</tr>
|
|
|
220 |
<tr>
|
|
|
221 |
<td align="left" class="wform_ttl">Project Key</td>
|
|
|
222 |
<td nowrap><input name="FRpkey" type="text" class="form_item" id="FRpkey" value="<%=parFRpkey%>" size="30" > <span class="form_wtxt_link">Example: ALL, SLSCM </span></td>
|
|
|
223 |
</tr>
|
|
|
224 |
<tr>
|
|
|
225 |
<td align="left" class="wform_ttl">Database</td>
|
|
|
226 |
<td><span class="form_item"><%=JIRA_DATABASE%>: <%=JIRA_URL%></span></td>
|
|
|
227 |
</tr>
|
|
|
228 |
</table>
|
|
|
229 |
</tr>
|
| 4236 |
dpurdie |
230 |
<!-- Find, Import and Close Buttons -->
|
| 4235 |
dpurdie |
231 |
<tr height="1%">
|
|
|
232 |
<td background="images/lbox_bg_blue.gif" >
|
|
|
233 |
<table width="100%" border="0" cellspacing="0" cellpadding="0">
|
|
|
234 |
<tr>
|
| 4236 |
dpurdie |
235 |
<td width="1">
|
|
|
236 |
<td>
|
|
|
237 |
<input type="submit" name="btn" value="Find »" class="form_btn_comp"></td>
|
| 4235 |
dpurdie |
238 |
<td align="right">
|
| 4236 |
dpurdie |
239 |
<input type="submit" name="btn" value="Import" class="form_btn_comp">
|
|
|
240 |
<input type="reset" name="btn" value="Close" class="form_btn_comp" onclick="self.close()">
|
| 129 |
ghuddy |
241 |
</td>
|
| 119 |
ghuddy |
242 |
</table>
|
| 4235 |
dpurdie |
243 |
</tr>
|
|
|
244 |
<!-- Post Import Message Area -->
|
| 4236 |
dpurdie |
245 |
<%If imported Then%>
|
| 4235 |
dpurdie |
246 |
<tr height="1%">
|
|
|
247 |
<td>
|
|
|
248 |
<%Call DisplayInfo ( "ISSUES_IMPORTED", "300" )%>
|
|
|
249 |
</td>
|
|
|
250 |
</tr>
|
| 4236 |
dpurdie |
251 |
<%End If%>
|
| 4235 |
dpurdie |
252 |
<!-- Table of issues wrapper -->
|
| 4236 |
dpurdie |
253 |
<tr height="100%" valign="top">
|
| 4235 |
dpurdie |
254 |
<td>
|
|
|
255 |
<table width="100%" border="0" cellspacing="1" cellpadding="2">
|
|
|
256 |
<tr>
|
|
|
257 |
<td width="1%" background="images/bg_form_lightbluedark.gif"> </td>
|
|
|
258 |
<td width="1%" nowrap background="images/bg_form_lightbluedark.gif" class="form_field">Issue Key</td>
|
|
|
259 |
<td width="1%" nowrap background="images/bg_form_lightbluedark.gif" class="form_field">State</td>
|
|
|
260 |
<td width="100%" nowrap background="images/bg_form_lightbluedark.gif" class="form_field">Summary</td>
|
|
|
261 |
</tr>
|
|
|
262 |
<%rspCount = 0
|
|
|
263 |
If (NOT rsCQ.BOF) AND (NOT rsCQ.EOF) Then
|
|
|
264 |
rsCQ.Move( rspMax * (rspPage - 1))
|
|
|
265 |
while ((NOT rsCQ.BOF) AND (NOT rsCQ.EOF) AND (rspCount < rspMax))
|
|
|
266 |
dim jiraIssue, jiraText
|
|
|
267 |
jiraIssue = rsCQ("project") & "-" & rsCQ("iss_num")
|
|
|
268 |
jiraText = jiraIssue
|
|
|
269 |
%>
|
|
|
270 |
<tr>
|
|
|
271 |
<td><input type="checkbox" name="FRiss_id" value='<%=jiraIssue%>'></td>
|
|
|
272 |
<td nowrap class="form_item">
|
|
|
273 |
<%If parFRiss_num <> LENUM_ALL and parFRpkey = LENUM_ALL Then
|
|
|
274 |
jiraText = Highlight_Substring( jiraIssue, parFRiss_num )
|
|
|
275 |
End If%>
|
|
|
276 |
<a href="<%=JIRA_URL%>/browse/<%=jiraIssue%>" target="_blank"><%=jiraText%></a>
|
|
|
277 |
</td>
|
|
|
278 |
<td class="form_item"><%=rsCQ("state")%></td>
|
|
|
279 |
<td class="form_item"><%=rsCQ("summary")%></td>
|
|
|
280 |
</tr>
|
|
|
281 |
<%rspCount = rspCount + 1
|
|
|
282 |
rsCQ.MoveNext
|
|
|
283 |
WEnd
|
|
|
284 |
rsCQ.Close
|
|
|
285 |
Set rsCQ = nothing%>
|
|
|
286 |
<%End If%>
|
|
|
287 |
<tr>
|
|
|
288 |
<!-- Number of issues found -->
|
|
|
289 |
<td background="images/bg_form_lightbluedark.gif"> </td>
|
|
|
290 |
<td colspan="3" nowrap background="images/bg_form_lightbluedark.gif" class="form_step">
|
|
|
291 |
<%If rspTotal > rspMax Then
|
|
|
292 |
If CInt(rspPage) = CInt(rspTotalPages) Then
|
|
|
293 |
Response.write "Found "& rspTotal &" records, showing "& (rspMax * rspPage) - rspMax + 1 &" - "& rspTotal
|
|
|
294 |
Else
|
|
|
295 |
Response.write "Found "& rspTotal &" records, showing "& (rspMax * rspPage) - rspMax + 1 &" - "& (rspCount * rspPage)
|
|
|
296 |
End If
|
|
|
297 |
Else
|
|
|
298 |
Response.write "Found "& rspTotal &" records"
|
|
|
299 |
End If
|
|
|
300 |
%>
|
|
|
301 |
</td>
|
|
|
302 |
</table>
|
|
|
303 |
<!-- Next and Previous Buttons -->
|
| 4236 |
dpurdie |
304 |
<tr height="1%">
|
| 4235 |
dpurdie |
305 |
<td>
|
|
|
306 |
<table width="100%" border="0" cellspacing="1" cellpadding="2">
|
|
|
307 |
<tr>
|
|
|
308 |
<td align="center">
|
|
|
309 |
<%If CInt(rspPage) > 1 Then%><a href="javascript:;" onClick="importform.rpg.value = parseInt(importform.rpg.value) - 1; importform.submit();" class="txt_linked"><previous</a><%End If%>
|
|
|
310 |
<%If CInt(rspPage) < CInt(rspTotalPages) Then%><a href="javascript:void(document.importform.submit())" onClick="importform.rpg.value = parseInt(importform.rpg.value) + 1; importform.btn.value='next';" class="txt_linked">next ></a><%End If%></td>
|
|
|
311 |
</tr>
|
|
|
312 |
</table>
|
|
|
313 |
</td>
|
|
|
314 |
</tr>
|
|
|
315 |
<!-- Bottom Line -->
|
| 4236 |
dpurdie |
316 |
<tr height="1%">
|
| 4235 |
dpurdie |
317 |
<tr>
|
|
|
318 |
<td>
|
|
|
319 |
<img src="images/lbox_bg_blue.gif" width="100%" height="5">
|
|
|
320 |
</td>
|
|
|
321 |
</tr>
|
|
|
322 |
</table>
|
|
|
323 |
<input name="rpg" type="hidden" value="<%=rspPage%>">
|
|
|
324 |
<input name="pv_id" type="hidden" value="<%=parPv_id%>">
|
|
|
325 |
<input name="rtag_id" type="hidden" value="<%=parRtag_id%>">
|
|
|
326 |
<input name="action" type="hidden" value="true">
|
| 119 |
ghuddy |
327 |
</form>
|
|
|
328 |
<%Else%>
|
|
|
329 |
<%=enumMSSQL_ERROR%>
|
|
|
330 |
<%End If%>
|
|
|
331 |
</body>
|
|
|
332 |
</html>
|
|
|
333 |
<!-- DESTRUCTOR ------->
|
| 129 |
ghuddy |
334 |
<!--#include file="common/destructor.asp"-->
|