Subversion Repositories DevTools

Rev

Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
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_db
30
Dim parFRiss_id
31
Dim parFRiss_num
171 brianf 32
Dim parFRpkey
119 ghuddy 33
Dim rsCQ
129 ghuddy 34
Dim rspPage      ' current page number for multiple page results
35
Dim rspTotal   ' total number of records
36
Dim rspCount   ' Record counter
37
Dim rspTotalPages   ' Total number of pages required to display results
119 ghuddy 38
Dim imported
39
Dim retVal
40
Dim rsCQTemp
41
Dim SQLstr
42
Dim parPackage
43
Dim parProject
44
Dim parProduct
45
Dim parSkipOpen
46
Dim disabled
47
Dim parCategMain
48
Dim parCategMinor
49
Dim parIStates
50
Dim parTitle
51
Dim oIStates
52
Dim checked
53
'------------ Constants Declaration -----------
1332 dpurdie 54
Const rspMax = 15   ' maximum number of records displayed
119 ghuddy 55
Const LENUM_ALL = "ALL"
56
Const LCONST_STAR = "*"
57
'------------ Variable Init -------------------
58
parPv_id = Request("pv_id")
59
parRtag_id = Request("rtag_id")
60
rspPage = Request("rpg")
61
parFRiss_db = Request("FRiss_db")
62
parFRiss_id = Request("FRiss_id")
63
parFRiss_num = Request("FRiss_num")
64
parPackage = Request("package")
65
parProject = Request("project")
66
parProduct = Request("product")
67
parCategMain = Request("categmain")
68
parCategMinor = Request("categminor")
69
parSkipOpen = Request("skip_open")
70
parIStates = Request("istates")
71
parTitle = Request("title")
171 brianf 72
parFRpkey = Request("FRpkey")
119 ghuddy 73
 
74
Set rsCQ = Server.CreateObject("ADODB.Recordset")
75
 
76
imported = FALSE
77
'-- CONDITIONS --------------------------------
78
If rspPage = "" Then rspPage = 1
4183 dpurdie 79
if InStr(1, Request("btn"), "Find",1) Then rspPage = 1
119 ghuddy 80
If (parFRiss_num = "") Then parFRiss_num = LENUM_ALL
171 brianf 81
 
82
If (parFRpkey = "") Then
83
  parFRpkey = GetDefaultProjectKey(Request("rtag_id"))
84
  if parFRpkey="" OR IsNull(parFRpkey) Then parFRpkey = LENUM_ALL
85
End If
86
 
119 ghuddy 87
If (parTitle = "") Then parTitle = LCONST_STAR  ' Default
88
 
89
' Get DEVI issue states checked
90
Set oIStates = GetIStates()
91
 
92
 
93
'----------------------------------------------
4183 dpurdie 94
'Response.write "btn="& Request("btn") & "rspPage=" &rspPage&"<br>"
119 ghuddy 95
'Response.write "parPackage="& parPackage &", parProject="& parProject &", parProduct="& parProduct &", parSkipOpen="& parSkipOpen &"<br>"
96
'Response.write "parPv_id="& parPv_id &", parRtag_id="& parRtag_id &", rspPage="& rspPage &", parFRiss_db="& parFRiss_db &", parFRiss_id="& parFRiss_id &", parFRiss_num="& parFRiss_num
97
'Response.write "parIStates="& parIStates &", parSkipOpen="& parSkipOpen
98
%>
99
<%
100
'------------------------------------------------------------------------------------------------------------------------------------
101
Function GetIStates()
129 ghuddy 102
   Dim IStates, aStates, stateId
103
   Set IStates = CreateObject("Scripting.Dictionary")
104
 
105
   If parIStates = "" Then
106
      IStates.Item ("ALL") = "checked"
107
   Else
108
 
109
      aStates = Split( Replace( parIStates, " ", "" ), ",")
110
 
111
      For Each stateId In aStates
112
         IStates.Item (CStr(stateId)) = "checked"
113
      Next
114
 
115
 
116
   End If
117
 
118
   Set GetIStates = IStates
119
 
119 ghuddy 120
End Function
171 brianf 121
 
119 ghuddy 122
'------------------------------------------------------------------------------------------------------------------------------------
171 brianf 123
Function Get_Issues ( NNiss_db, NNiss_num, NNrecordCount, OOrsCQ, apkey)
129 ghuddy 124
   Dim SQLstr, issARR, iss_num, col_name, Title
119 ghuddy 125
 
129 ghuddy 126
      SQLstr = _
4169 dpurdie 127
      "SELECT project.pkey as project, I.issuenum AS iss_num, I.summary as summary, ISS.pname AS state "&_
129 ghuddy 128
      "FROM jiraissue I, project, issuestatus ISS "&_
4169 dpurdie 129
      "WHERE I.project=project.id "
1334 dpurdie 130
 
171 brianf 131
      If ( apkey <> LENUM_ALL ) Then
132
         SQLstr = SQLstr & "AND project.pkey='"& apkey &"' "
133
      End If
134
      SQLstr = SQLstr & "AND I.issuestatus = ISS.ID "
129 ghuddy 135
 
136
   '-- Keyword search --
137
   If ( NNiss_num <> LENUM_ALL ) Then
138
      issARR = Split( Replace( NNiss_num, " ", ""), "," )
139
 
4169 dpurdie 140
      col_name = "I.issuenum"
129 ghuddy 141
      SQLstr = SQLstr & " AND ( "
4183 dpurdie 142
      for Each iss_num IN issARR
129 ghuddy 143
         SQLstr = SQLstr &" ("& col_name &" LIKE '%"& iss_num &"%') OR"
144
      Next
145
 
146
      SQLstr = Left( SQLstr, Len(SQLstr) - 2 )   ' Remove last 'OR'
147
 
148
      SQLstr = SQLstr & "     ) "
149
 
150
   End If
151
 
1334 dpurdie 152
   '-- Get record count ---  MAYBE MORE SPEED HERE?!??!
129 ghuddy 153
   NNrecordCount = Get_Record_Count( SQLstr )
154
 
1334 dpurdie 155
	DIM objConnection
156
 
157
	'ADDED BY RICHO 6th August 2012 - Increase Speed
158
	Set objConnection = Server.CreateObject ("ADODB.Connection")
159
	objConnection.Open JIRA_conn
160
 
161
	On Error Resume Next
3975 dpurdie 162
'Response.Write(SQLstr)
163
 
1334 dpurdie 164
	OOrsCQ.Open SQLstr, objConnection
129 ghuddy 165
 
4169 dpurdie 166
    Get_Issues = Err.Number
129 ghuddy 167
 
168
End Function
119 ghuddy 169
'------------------------------------------------------------------------------------------------------------------------------------
170
Function Get_Record_Count ( SSsql )
129 ghuddy 171
   Dim rsTemp
172
   Set rsTemp = Server.CreateObject("ADODB.Recordset")
173
   rsTemp.ActiveConnection = JIRA_conn
174
   'Response.Write(rsTemp.ActiveConnection)
119 ghuddy 175
 
129 ghuddy 176
   rsTemp.Source = _
177
   " SELECT COUNT(*) as record_count "&_
178
   "   FROM ("& SSsql &") ct"
179
 
180
   rsTemp.CursorType = 0
181
   rsTemp.CursorLocation = 2
182
   rsTemp.LockType = 3
183
   rsTemp.Open()
184
 
185
   If (NOT rsTemp.BOF) AND (NOT rsTemp.EOF) Then
186
      Get_Record_Count = rsTemp("record_count")
187
   Else
188
      Get_Record_Count = 0
189
   End If
190
 
191
   rsTemp.Close
192
   Set rsTemp = nothing
119 ghuddy 193
End Function
194
'------------------------------------------------------------------------------------------------------------------------------------
195
Sub Import_Issues ( NNpv_id, NNiss_db, NNiss_id_list )
4169 dpurdie 196
   Dim issArr , iss_id
129 ghuddy 197
   If NNiss_id_list = "" Then Exit Sub
119 ghuddy 198
 
129 ghuddy 199
   issArr = Split ( NNiss_id_list, ",")
4169 dpurdie 200
   'Response.Write("Import_Issues" & NNiss_id_list)
129 ghuddy 201
 
202
   objEH.TryORA ( OraSession )
203
   On Error Resume Next
204
 
205
   For Each iss_id In issArr
206
 
207
      If Err.Number = 0 Then
208
         OraDatabase.ExecuteSQL _
209
            " INSERT INTO JIRA_ISSUES ( pv_id, iss_key, date_time_stamp )"&_
210
            " VALUES ( "& NNpv_id &", '"& LTrim(iss_id) &"', "& ORA_SYSDATETIME &")"
211
 
212
         If Err.Number = 0 Then
213
            OraDatabase.ExecuteSQL _
214
               "BEGIN  Log_Action ( "& NNpv_id &", 'jira_issue_added', "& objAccessControl.UserId &", 'Issue number: "& LTrim(iss_id) &"' );  END;"
215
         End If
216
 
217
      End If
218
   Next
219
 
220
   objEH.CatchORA ( OraSession )
119 ghuddy 221
End Sub
222
'------------------------------------------------------------------------------------------------------------------------------------
171 brianf 223
Function GetDefaultProjectKey(artag_id)
224
   Dim rsProjId
225
   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))
226
   GetDefaultProjectKey = rsProjId("jira_key")
227
   Set rsProjId = Nothing
228
End Function
229
'------------------------------------------------------------------------------------------------------------------------------------
119 ghuddy 230
%>
231
<%
232
'Process submition
233
If CBool(Request("action")) AND (Request("btn") = "Import")  AND objAccessControl.UserLogedIn Then
129 ghuddy 234
   Call Import_Issues ( parPv_id, parFRiss_db, parFRiss_id )
235
   imported = TRUE
236
   Call OpenInParentWindow ("fixed_issues.asp?pv_id="& parPv_id &"&rtag_id="& parRtag_id)
237
 
119 ghuddy 238
End If
239
%>
240
<%
241
'-------------- Main Line ---------------
242
 
171 brianf 243
retVal = Get_Issues ( parFRiss_db, parFRiss_num, rspTotal, rsCQ, parFRpkey)
119 ghuddy 244
 
245
' total number of pages required
246
rspTotalPages = rspTotal \ rspMax
247
If (rspTotal Mod rspMax) > 0 Then rspTotalPages = rspTotalPages + 1
248
%>
249
<html>
250
<head>
251
<title>Release Manager</title>
252
<meta HTTP-EQUIV="Pragma" CONTENT="no-cache">
253
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
254
<link rel="stylesheet" href="images/release_manager_style.css" type="text/css">
255
<link rel="stylesheet" href="images/navigation.css" type="text/css">
256
<script language="JavaScript" src="images/common.js"></script>
257
</head>
258
<body bgcolor="#FFFFFF" text="#000000" leftmargin="0" topmargin="0" onload="self.focus();">
259
<%If retVal = 0 Then%>
260
<form name="importform" method="post" action="<%=scriptName%>">
261
  <table width="100%" border="0" cellspacing="0" cellpadding="2" height="100%">
262
    <tr>
263
      <td height="1%" background="images/bg_admin_dark.gif"><img src="images/spacer.gif" width="10" height="40"></td>
264
      <td nowrap colspan="3" class="wform_ttl" background="images/bg_admin_dark.gif"><table width="100" border="0" cellspacing="5" cellpadding="0">
265
        <tr>
266
          <td align="left" class="wform_ttl">Issue&nbsp;Number</td>
4183 dpurdie 267
          <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>
119 ghuddy 268
        </tr>
269
        <tr>
171 brianf 270
          <td align="left" class="wform_ttl">Project&nbsp;Key</td>
271
          <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>
272
        </tr>
273
        <tr>
119 ghuddy 274
          <td align="left" class="wform_ttl">Database</td>
1332 dpurdie 275
          <td><span class="form_item"><%=JIRA_DATABASE%>: <%=JIRA_URL%></span></td>
119 ghuddy 276
        </tr>
277
 
129 ghuddy 278
      </table>
279
 
119 ghuddy 280
        <table width="400" border="0" cellspacing="5" cellpadding="0">
281
          <tr background="images/lbox_bg_blue.gif">
282
            <td colspan="2"><img src="images/spacer.gif" width="1" height="1"></td>
283
          </tr>
284
          <tr>
285
            <td width="1">&nbsp;</td>
286
            <td width="100%"><input type="submit" name="btn" value="Find &raquo;" class="form_btn_comp"></td>
287
          </tr>
288
        </table></td>
289
    </tr>
129 ghuddy 290
 
291
    <tr>
119 ghuddy 292
      <td background="images/lbox_bg_blue.gif" width="1%" height="1%">&nbsp;</td>
293
      <td background="images/lbox_bg_blue.gif" nowrap width="50%" class="wform_ttl">&nbsp;</td>
294
      <td background="images/lbox_bg_blue.gif" align="right" width="50%">
129 ghuddy 295
       <input type="submit" name="btn" value="Import" class="form_btn_comp">
296
        <input type="reset" name="btn" value="Close" class="form_btn_comp" onclick="self.close()">
119 ghuddy 297
      </td>
129 ghuddy 298
      <td background="images/lbox_bg_blue.gif" align="right" width="1%" nowrap>
119 ghuddy 299
        <img src="images/h_trsp_dot.gif" width="5" height="22"> </td>
300
    </tr>
129 ghuddy 301
    <tr>
119 ghuddy 302
      <td height="100%" width="1%">&nbsp;</td>
303
      <td valign="top" nowrap colspan="3" class="wform_ttl" background="images/bg_form_lightgray.gif">
129 ghuddy 304
       <%If imported Then%>
305
         <%Call DisplayInfo ( "ISSUES_IMPORTED", "300" )%>
306
      <%End If%>
119 ghuddy 307
        <table width="100%" border="0" cellspacing="1" cellpadding="2">
129 ghuddy 308
          <tr>
119 ghuddy 309
            <td width="1%" background="images/bg_form_lightbluedark.gif">&nbsp;</td>
310
            <td width="1%" nowrap background="images/bg_form_lightbluedark.gif" class="form_field">Issue Key</td>
129 ghuddy 311
         <td width="1%" nowrap background="images/bg_form_lightbluedark.gif" class="form_field">State</td>
119 ghuddy 312
            <td width="100%" nowrap background="images/bg_form_lightbluedark.gif" class="form_field">Summary</td>
313
          </tr>
129 ghuddy 314
        <%
315
        rspCount = 0
316
         If (NOT rsCQ.BOF) AND (NOT rsCQ.EOF) Then
317
           rsCQ.Move( rspMax * (rspPage - 1))
318
 
319
           %>
320
           <%
4169 dpurdie 321
           while ((NOT rsCQ.BOF) AND (NOT rsCQ.EOF) AND (rspCount < rspMax))
4183 dpurdie 322
               dim jiraIssue, jiraText
4169 dpurdie 323
               jiraIssue = rsCQ("project") & "-" & rsCQ("iss_num")
4183 dpurdie 324
               jiraText = jiraIssue
129 ghuddy 325
           %>
326
             <tr>
4169 dpurdie 327
               <td><input type="checkbox" name="FRiss_id" value='<%=jiraIssue%>'></td>
129 ghuddy 328
               <td nowrap class="form_item">
329
 
4183 dpurdie 330
               <%
331
               If parFRiss_num <> LENUM_ALL and parFRpkey = LENUM_ALL Then
332
                    jiraText = Highlight_Substring( jiraIssue, parFRiss_num )
333
               End If
334
               %>
335
               <a href="<%=JIRA_URL%>/browse/<%=jiraIssue%>" target="_blank"><%=jiraText%></a>
129 ghuddy 336
            </td>
337
            <td class="form_item"><%=rsCQ("state")%></td>
338
               <td class="form_item"><%=rsCQ("summary")%></td>
339
             </tr>
340
           <%rspCount = rspCount + 1
341
              rsCQ.MoveNext
342
           WEnd
343
           rsCQ.Close
344
           Set rsCQ = nothing%>
345
        <%End If%>
346
          <tr>
119 ghuddy 347
            <td background="images/bg_form_lightbluedark.gif">&nbsp;</td>
348
            <td colspan="3" nowrap background="images/bg_form_lightbluedark.gif" class="form_step">
129 ghuddy 349
            <%
350
            If rspTotal > rspMax Then
351
               If CInt(rspPage) = CInt(rspTotalPages) Then
352
                  Response.write "Found "& rspTotal &" records, showing "& (rspMax * rspPage) - rspMax + 1 &" - "& rspTotal
353
               Else
354
                  Response.write "Found "& rspTotal &" records, showing "& (rspMax * rspPage) - rspMax + 1 &" - "& (rspCount * rspPage)
355
               End If
356
            Else
357
               Response.write "Found "& rspTotal &" records"
358
            End If
359
            %>
360
         </td>
119 ghuddy 361
          </tr>
362
        </table>
363
        <table width="100%" border="0" cellspacing="1" cellpadding="2">
364
          <tr>
365
            <td align="center">
171 brianf 366
           <%If CInt(rspPage) > 1 Then%><a href="javascript:;" onClick="importform.rpg.value = parseInt(importform.rpg.value) - 1; importform.submit();" class="txt_linked">&lt;previous</a><%End If%>&nbsp;
367
              <%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 &gt;</a><%End If%></td>
119 ghuddy 368
          </tr>
369
        </table>
370
        <br>
371
      </td>
372
    </tr>
129 ghuddy 373
    <tr>
119 ghuddy 374
      <td width="1%" height="1%" background="images/lbox_bg_blue.gif"><img src="images/h_trsp_dot.gif" width="5" height="5"></td>
375
      <td valign="top" nowrap colspan="3" class="wform_ttl" background="images/lbox_bg_blue.gif"></td>
376
    </tr>
377
  </table>
129 ghuddy 378
<input name="rpg" type="hidden" value="<%=rspPage%>">
119 ghuddy 379
<input name="skip_open" type="hidden" value="<%=parSkipOpen%>">
380
<input name="pv_id" type="hidden" value="<%=parPv_id%>">
381
<input name="rtag_id" type="hidden" value="<%=parRtag_id%>">
382
<input name="action" type="hidden" value="true">
383
</form>
384
<%Else%>
385
<%=enumMSSQL_ERROR%>
386
<%End If%>
387
</body>
388
</html>
389
 
390
 
391
<!-- DESTRUCTOR ------->
129 ghuddy 392
<!--#include file="common/destructor.asp"-->