%@LANGUAGE="VBSCRIPT"%>
<%
'=====================================================
'| |
'| BOM DIFF |
'| |
'=====================================================
%>
<%
Option explicit
' Good idea to set when using redirect
Response.Expires = 0 ' always load the page, dont store
%>
<%
'To enable the script timeout to 10 mins
Server.ScriptTimeout=1200
%>
<%
' Set rfile parameter. This is a return page after Login
'Call objPMod.StoreParameter ( "rfile", "rtree.asp" )
'objPMod.PersistInQryString("proj_id")
'------------ ACCESS CONTROL ------------------
%>
<%
'------------ Variable Definition -------------
Dim rsQry
Dim objRelCollectorA
Dim objRelCollectorB
Dim parRtagA
Dim parRtagB
Dim parSBOMA
Dim parSBOMB
Dim dDiffFilter
Dim colorA, colorB, ChangeTypeIcon
Dim btnMerge, btnRemove
Dim rowId
Dim email
Dim genReport
Dim genSummary
Dim summaryText
Dim FSO
Dim NewTextFile
Dim NewTextFilePath
Dim pkgA, pkgB, pkgname, delimiter, rsQryA, rsQryB, rsQryCommentsA, rsQryCommentsB, sqlstrA, counterA, sqlstrB, sqlstrC, counterB
Dim SSsql, retVal, rsCQ, DEVIiss
Dim a, b, c, d, pkgversion, errormsg
Dim VersionList
'------------ Constants Declaration -----------
Const LIMG_UPDATED = "
"
Const LIMG_RIPPLED = "
"
Const LIMG_ADDED = "
"
Const LIMG_REMOVED = "
"
Const LIMG_FILTER_ON = "
"
Const LIMG_FILTER_OFF = "
"
Const LIMG_DROP_DOWN_ARROW = "
"
Const LCOLOR_NOT_CHANGED = "#F5F5F5"
Const LCOLOR_CHANGED = "#d2f7c9"
Const LCOLOR_RIPPLED = "#D8F8F8"
Const LCOLOR_BLANK = "#FFFFFF"
Const LIMG_MERGE = "
"
Const LIMG_MERGE_WARN = "
"
Const LIMG_REMOVE = "
"
Const LIMG_UNDO = "
"
'------------ Variable Init -------------------
parRtagA = Request("rtagA")
parRtagB = Request("rtagB")
parSBOMA = Request("sbomA")
parSBOMB = Request("sbomB")
Set objRelCollectorA = CreateObject("Scripting.Dictionary")
Set objRelCollectorB = CreateObject("Scripting.Dictionary")
Set dDiffFilter = CreateObject("Scripting.Dictionary")
'----------------------------------------------
If Request("btn") = "btn_report" Then
email = true
genReport = true
End If
If Request("btn") = "btn_summary" Then
email = true
genSummary = true
End If
If Request("btn") = "btn_showRep" Then
genReport = true
End If
%>
<%
'--------------------------------------------------------------------------
' Add text to summary email
' Attempt to prevent gmail from creating hyperlinks out of some text
' - Put '.' inside a 'span'
Sub Summary(txt)
If genSummary Then
summaryText = summaryText & Replace(txt,".", ".")
End If
End Sub
'--------------------------------------------------------------------------------------------------------------------------
Sub GetDiffFilterValues ( outDepFilter )
Dim FilterVal, aFilterValues
If Request.Cookies(enum_RELMGR_COOKIE_DOMAIN)(COOKIE_HIDE_DIFF_FILTER) <> "" Then
aFilterValues = Split( Replace( Request.Cookies(enum_RELMGR_COOKIE_DOMAIN)(COOKIE_HIDE_DIFF_FILTER), " ", ""), ",")
For Each FilterVal In aFilterValues
outDepFilter.Item (CStr( FilterVal )) = ""
Next
End If
End Sub
'--------------------------------------------------------------------------------------------------------------------------
Sub DisplayFilterSelector
%>
<% End Sub '-------------------------------------------------------------------------------------------------------------------------- Sub Javascript() If genReport Then NewTextFile.WriteLine("") End If End Sub '-------------------------------------------------------------------------------------------------------------------------- Sub GetFixedIssues(pv_id, issues) If issues <> "Filter Issues" Then Set sqlstrC = OraDatabase.DbCreateDynaset( _ "SELECT iss_db, iss_id, iss_state, notes FROM CQ_ISSUES" &_ " WHERE pv_id="& pv_id &" AND iss_state = "& enumISSUES_STATE_FIXED _ , cint(0)) If sqlstrC.RecordCount <> 0 Then NewTextFile.WriteLine() NewTextFile.WriteLine("
") NewTextFile.WriteLine("Fixed Issues:
") End If ' ' Must also handle Jira Issues Dim issueInfo, el, key Set issueInfo = CreateObject( "Scripting.Dictionary" ) Call getJiraIssueDetails(pv_id, issueInfo, 1) If issueInfo.Count > 0 Then ' Table Header NewTextFile.WriteLine() NewTextFile.WriteLine("") NewTextFile.WriteLine("
") NewTextFile.WriteLine(" ") While ((NOT sqlstrC.BOF) AND (NOT sqlstrC.EOF)) DEVIiss = "-1" If CInt(sqlstrC("iss_db")) = CInt(enumCLEARQUEST_DEVI_ID) Then DEVIiss = DEVIiss &","& sqlstrC("iss_id") End If SSsql = ReadFile( QUERIES_PATH & "\cq_issues.sql" ) SSsql = Replace( SSsql, "/*enumCLEARQUEST_DEVI_ID*/", enumCLEARQUEST_DEVI_ID) SSsql = Replace( SSsql, "/*DEVIiss*/", DEVIiss) retVal = Get_CQ_Issues ( SSsql, rsCQ ) NewTextFile.WriteLine("Issue Id ") NewTextFile.WriteLine("Summary ") NewTextFile.WriteLine("Issue Type ") NewTextFile.WriteLine("Priority ") NewTextFile.WriteLine("Status ") NewTextFile.WriteLine("") NewTextFile.WriteLine(" ") sqlstrC.MoveNext Wend NewTextFile.WriteLine( ""&rsCQ("iss_num")&" ") NewTextFile.WriteLine(""&NewLine_To_BR ( To_HTML ( rsCQ("summary") ) )&" ") NewTextFile.WriteLine(""&rsCQ("issue_type")&" ") NewTextFile.WriteLine(""&rsCQ("priority")&" ") NewTextFile.WriteLine(""&rsCQ("Status")&" ") NewTextFile.WriteLine("
") NewTextFile.WriteLine("Jira Issues:
") Set issueInfo = nothing End If End If End Sub '-------------------------------------------------------------------------------------------------------------------------- Function LastPvId(pvId) Dim qryA Set qryA = OraDatabase.DbCreateDynaset("SELECT LAST_PV_ID FROM PACKAGE_VERSIONS WHERE PV_ID="&pvId, cint(0)) LastPvId = pvId If pvId <> qryA("last_pv_id") Then LastPvId = qryA("last_pv_id") Else errormsg = true End If qryA.Close() Set qryA = Nothing End Function '-------------------------------------------------------------------------------------------------------------------------- Sub PreviousVersions(a, b, versionA, versionB, data, issues) NewTextFile.WriteLine() NewTextFile.WriteLine("Versions Between: "&versionA&" and "&versionB&"") If CLng(a) < CLng(b) Then While CLng(a) < CLng(b) b = LastPvId(b) If CLng(a) < CLng(b) Then VersionList = VersionList + ","& b &"" Call Comments(b, data) Call GetFixedIssues(b, issues) End If Wend End If If CLng(b) < CLng(a) Then While CLng(b) < CLng(a) a = LastPvId(a) If CLng(b) < CLng(a) Then VersionList = VersionList + ","& a &"" Call Comments(a, data) Call GetFixedIssues(a, issues) End If Wend End If End Sub '-------------------------------------------------------------------------------------------------------------------------- Sub GetDependencies(pv_id_a, pv_id_b, versionA, versionB, comments, issues) On Error Resume Next Set sqlstrA = OraDatabase.DbCreateDynaset( _ "select distinct dpv_id " &_ " from package_dependencies" &_ " where pv_id IN ("& pv_id_b &")" &_ " and dpv_id NOT IN (SELECT dpv_id from package_dependencies where pv_id = "& pv_id_a &")" &_ " order by dpv_id desc", cint(0)) If sqlstrA.RecordCount <> 0 Then NewTextFile.WriteLine() NewTextFile.WriteLine("Dependencies Changed Between "&versionA&" and "&versionB&":") While ((NOT sqlstrA.BOF) AND (NOT sqlstrA.EOF)) Call dependencyComments(sqlstrA("dpv_id"), comments) Call GetFixedIssues(sqlstrA("dpv_id"), issues) sqlstrA.MoveNext Wend End If sqlstrA.Close() Set sqlstrA = Nothing End Sub '-------------------------------------------------------------------------------------------------------------------------- Sub dependencyComments(pv_id, comments) Set sqlstrB = OraDatabase.DbCreateDynaset("SELECT * FROM PACKAGE_VERSIONS pv, PACKAGES pkg WHERE pkg.pkg_id = pv.pkg_id AND PV_ID ="&pv_id, cint(0)) NewTextFile.WriteLine("") NewTextFile.WriteLine("
") NewTextFile.WriteLine(" ") ' Table Body For Each key In issueInfo Set el = issueInfo.item(key) NewTextFile.WriteLine("Issue Id ") NewTextFile.WriteLine("Summary ") NewTextFile.WriteLine("Issue Type ") NewTextFile.WriteLine("Priority ") NewTextFile.WriteLine("Status ") NewTextFile.WriteLine("Resolution ") NewTextFile.WriteLine("") NewTextFile.WriteLine(" ") Next NewTextFile.WriteLine( ""&key&" ") NewTextFile.WriteLine(""&NewLine_To_BR ( To_HTML ( el.item("summary") ) )&" ") NewTextFile.WriteLine(""&el.item("issuetype")&" ") NewTextFile.WriteLine(""&el.item("priority")&" ") NewTextFile.WriteLine(""&el.item("status")&" ") NewTextFile.WriteLine(""&el.item("resolution")&" ") NewTextFile.WriteLine("
") If comments <> "Filter Comments" Then NewTextFile.WriteLine(""& sqlstrB("pkg_name") &" "& sqlstrB("pkg_version") &"
") NewTextFile.Write("Comments:
") End If sqlstrB.Close() Set sqlstrB = nothing End Sub '-------------------------------------------------------------------------------------------------------------------------- Sub pkg_Version(pv) Dim qry Set qry = OraDatabase.DbCreateDynaset("SELECT PKG_VERSION FROM PACKAGE_VERSIONS WHERE PV_ID="&pv, cint(0)) pkgversion = qry("pkg_version") qry.Close() Set qry = Nothing End Sub '-------------------------------------------------------------------------------------------------------------------------- Sub Comments(Pv_Id, data) Dim comments Set comments = OraDatabase.DbCreateDynaset("SELECT COMMENTS, PKG_VERSION FROM PACKAGE_VERSIONS WHERE PV_ID="&Pv_id, cint(0)) 'If comments("comments") <> "Rippled Build." Then NewTextFile.WriteLine(""& TextToHTML(sqlstrB("comments")) &"
") If data <> "Filter Comments" Then If comments("comments") <> "" Then NewTextFile.WriteLine("Version: "& comments("pkg_version")&"
") NewTextFile.WriteLine("Comments:
") End If End If 'End If End Sub '-------------------------------------------------------------------------------------------------------------------------- Sub Release(pvId) Dim release Set release = OraDatabase.DbCreateDynaset("SELECT INSERT_STAMP FROM RELEASE_CONTENT WHERE PV_ID="&pvId, cint(0)) If release("insert_stamp") <> "" Then NewTextFile.Write(release("insert_stamp")) Else NewTextFile.Write("Version Not Used.") End If End Sub '-------------------------------------------------------------------------------------------------------------------------- Sub Header() NewTextFile.WriteLine("") NewTextFile.WriteLine("") End Sub '-------------------------------------------------------------------------------------------------------------------------- Sub Footer() NewTextFile.WriteLine("") NewTextFile.WriteLine("") End Sub '-------------------------------------------------------------------------------------------------------------------------- Sub Styles() NewTextFile.WriteLine("") End Sub '-------------------------------------------------------------------------------------------------------------------------- Function GetIsDiffFilterInUseIcon() GetIsDiffFilterInUseIcon = LIMG_FILTER_OFF If dDiffFilter.Count > 0 Then GetIsDiffFilterInUseIcon = LIMG_FILTER_ON End If End Function '-------------------------------------------------------------------------------------------------------------------------- Function GetIsDiffFilterChecked( nFilterId ) If dDiffFilter.Exists ( CStr(nFilterId) ) Then GetIsDiffFilterChecked = "checked" End If End Function '--------------------------------------------------------------------------------------------------------------------------- Function Get_CQ_Issues ( SSsql, OOrsCQ ) On Error Resume Next Set OOrsCQ = OraDatabase.DbCreateDynaset( SSsql, cint(0)) Get_CQ_Issues = Err.Number End Function '-------------------------------------------------------------------------------------------------------------------------- Public Function TextToHTML ( sString ) Dim mString If (sString = "") OR IsNull(sString) Then Exit Function mString = Server.HTMLEncode( sString ) mString = Replace(mString, VBNewLine, ""& TextToHTML(comments("comments")) &"