Subversion Repositories DevTools

Rev

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

Option Explicit
'=====================================================
'        Name: style_a_generator.vbs
' Description: Creates a release notes in TEMPLATE A format.
'=====================================================

Sub Generate_Notes_Style_A ( NNpv_id, outNotes, SSrtag_name, NNproj_id )
        Dim snippetSTR, insertFrom, insterSTR, tempSTR, snippetDEVI, snippetTDSE, snippetJIRA
        Dim Query_String, rsQry, CQSQL, rsCQ, rsJIRA, JIRASQL, releaseInfo, newReleaseInfo
        Const SYD_PROJID = 142'This is a temp for the BETA release of the functionality
        '-----------------------------------------------------------
        Set rsCQ = CreateObject("ADODB.Recordset")
        Set rsJIRA = CreateObject("ADODB.Recordset")
        '-----------------------------------------------------------
        WScript.Echo "Generating notes using Template Style A."
        
        outNotes = ReadFile( AppPath & RELEASE_NOTES_TEMPLATE_A )
        
        
        ' --- Title ---
        Query_String = ReadFile( AppPath & QUERIES_FOLDER & "\package_official_details.sql" )
        OraDatabase.Parameters.Add "PV_ID", NNpv_id, ORAPARM_INPUT, ORATYPE_NUMBER
        Set rsQry = OraDatabase.CreateDynaset( Query_String, cint(0))
        
        Call Get_Snippet ( "Title", outNotes, snippetSTR, insertFrom )
        If ((NOT rsQry.BOF) AND (NOT rsQry.EOF)) Then
                insterSTR = Replace( snippetSTR, "$PKG_TITLE$", rsQry("pkg_name") &" "& rsQry("pkg_version"))
        End If
        Call Insert_To_Page ( outNotes, insertFrom, insterSTR )
        

        '--- DEVI-037294 Requirement: Insert <ReleaseName>: <PkgName> <PkgVersion> --------------
        newReleaseInfo = SSrtag_name + ": " + rsQry("pkg_name") + " " + rsQry("pkg_version")
        
        
        ' --- Identification ---
        Call Get_Snippet ( "Identification", outNotes, snippetSTR, insertFrom )
        If ((NOT rsQry.BOF) AND (NOT rsQry.EOF)) Then
                insterSTR = Replace( snippetSTR, "$PKG_NAME$", rsQry("pkg_name") )
                insterSTR = Replace( insterSTR, "$PKG_VERSION$", rsQry("pkg_version") )
                insterSTR = Replace( insterSTR, "$LABEL$", NVL( rsQry("pkg_label") ) )
                insterSTR = Replace( insterSTR, "$SOURCE_PATH$", NVL( rsQry("src_path") ) )
                insterSTR = Replace( insterSTR, "$RELEASE_DATE$", ( EuroDate ( rsQry("modified_stamp") ) ) )
                insterSTR = Replace( insterSTR, "$RELEASOR_EMAIL$", rsQry("modifier_email") )
                insterSTR = Replace( insterSTR, "$RELEASOR$", rsQry("modifier") )
                insterSTR = Replace( insterSTR, "$OWNER_EMAIL$", rsQry("owner_email") )
                insterSTR = Replace( insterSTR, "$OWNER$", rsQry("owner") )
        End If
        Call Insert_To_Page ( outNotes, insertFrom, insterSTR )
        
        
        
        
        ' --- Package Information ---
        Call Get_Snippet ( "Package_Information", outNotes, snippetSTR, insertFrom )
        If ((NOT rsQry.BOF) AND (NOT rsQry.EOF)) Then
                If IsNull(rsQry("short_desc")) Then
                        insterSTR = Replace( snippetSTR, "$SHORT_DESCRIPTION$", "Not supplied!" )
                Else
                        insterSTR = Replace( snippetSTR, "$SHORT_DESCRIPTION$", FormatTextBox( HTML_Encode ( rsQry("short_desc") ) ) )
                End If
                
                If IsNull(rsQry("long_desc")) Then
                        insterSTR = Replace( insterSTR, "$LONG_DESCRIPTION$", "Not supplied!" )
                Else
                        insterSTR = Replace( insterSTR, "$LONG_DESCRIPTION$", FormatTextBox( HTML_Encode ( rsQry("long_desc") ) ) )
                End If
                
        End If
        Call Insert_To_Page ( outNotes, insertFrom, insterSTR )
        
        
        
        
        ' --- Reason for This Version ---
        Call Get_Snippet ( "Reason_For_This_Version", outNotes, snippetSTR, insertFrom )
        If ((NOT rsQry.BOF) AND (NOT rsQry.EOF)) Then
                If rsQry("reason") <> "" Then
                        insterSTR = Replace( snippetSTR, "$REASON$", FormatTextBox( HTML_Encode ( rsQry("reason") ) ) )
                Else
                        insterSTR = Replace( snippetSTR, "$REASON$", "See ""Issues"" section below." )
                End If
        End If
        Call Insert_To_Page ( outNotes, insertFrom, insterSTR )
        
        
        
        
        ' --- Build Dependencies ---
        Query_String = ReadFile( AppPath & QUERIES_FOLDER & "\package_build_dependencies.sql" )
        Set rsQry = OraDatabase.CreateDynaset( Query_String, cint(0))
        Call Get_Snippet ( "Build_Dependencies", outNotes, snippetSTR, insertFrom )
        If rsQry.RecordCount < 1 Then
                tempSTR = Replace( snippetSTR, "$PKG_NAME$", "&nbsp;" )
                tempSTR = Replace( tempSTR, "$RELEASE_NOTE_PATH$", "&nbsp;" )
                insterSTR = insterSTR & Replace( tempSTR, "$PKG_VERSION$", "&nbsp;" )
        End If
        While ((NOT rsQry.BOF) AND (NOT rsQry.EOF)) 
                tempSTR = Replace( snippetSTR, "$PKG_NAME$", rsQry("pkg_name") )
                tempSTR = Replace( tempSTR, "$RELEASE_NOTE_PATH$", rsQry("pkg_name") &"/"& rsQry("pkg_version") &"/"& DOC_FOLDER &"/"& Format_FileName( rsQry("pkg_name"), rsQry("pkg_version"), rsQry("dpv_id") ) )
                insterSTR = insterSTR & Replace( tempSTR, "$PKG_VERSION$", rsQry("pkg_version") )
                rsQry.MoveNext
        WEnd
        Call Insert_To_Page ( outNotes, insertFrom, insterSTR )

        
        
        
        ' --- Runtime Dependencies ---
        Query_String = ReadFile( AppPath & QUERIES_FOLDER & "\package_runtime_dependencies.sql" )
        Set rsQry = OraDatabase.CreateDynaset( Query_String, cint(0))
        Call Get_Snippet ( "Runtime_Dependencies", outNotes, snippetSTR, insertFrom )
        If rsQry.RecordCount < 1 Then
                tempSTR = Replace( snippetSTR, "$PKG_NAME$", "&nbsp;" )
                tempSTR = Replace( tempSTR, "$PKG_VERSION$", "&nbsp;" )
                insterSTR = insterSTR & Replace( tempSTR, "$COMMENTS$", "&nbsp;")
        End If
        While ((NOT rsQry.BOF) AND (NOT rsQry.EOF)) 
                tempSTR = Replace( snippetSTR, "$PKG_NAME$", rsQry("pkg_name") )
                tempSTR = Replace( tempSTR, "$PKG_VERSION$", rsQry("pkg_version") )
                insterSTR = insterSTR & Replace( tempSTR, "$COMMENTS$", NVL( FormatTextBox ( HTML_Encode ( rsQry("rtd_comments") ) &"<br>"& HTML_Encode ( rsQry("rtd_url") ) ) ) )
                rsQry.MoveNext
        WEnd
        Call Insert_To_Page ( outNotes, insertFrom, insterSTR )
        
        
        
        
        ' --- Files ---
        Query_String = ReadFile( AppPath & QUERIES_FOLDER & "\package_components.sql" )
        Set rsQry = OraDatabase.CreateDynaset( Query_String, cint(0))
        Call Get_Snippet ( "Files", outNotes, snippetSTR, insertFrom )
        If rsQry.RecordCount < 1 Then
                tempSTR = Replace( snippetSTR, "$FILE_NAME$", "&nbsp;" )
                tempSTR = Replace( tempSTR, "$FILE_PATH$", "&nbsp;" )
                tempSTR = Replace( tempSTR, "$BYTE_SIZE$", "&nbsp;" )
                tempSTR = Replace( tempSTR, "$CRC_CKSUM$", "&nbsp;" )
                insterSTR = insterSTR & Replace( tempSTR, "$CRC_MODCRC$", "&nbsp;" )
        End If
        While ((NOT rsQry.BOF) AND (NOT rsQry.EOF)) 
                tempSTR = Replace( snippetSTR, "$FILE_NAME$", NVL( rsQry("file_name") ) )
                tempSTR = Replace( tempSTR, "$FILE_PATH$", NVL( rsQry("file_path") ) )
                tempSTR = Replace( tempSTR, "$BYTE_SIZE$", NVL( rsQry("byte_size") ) )
                tempSTR = Replace( tempSTR, "$CRC_CKSUM$", NVL( rsQry("crc_cksum") ) )
                insterSTR = insterSTR & Replace( tempSTR, "$CRC_MODCRC$", NVL( rsQry("crc_modcrc") ) )
                rsQry.MoveNext
        WEnd
        Call Insert_To_Page ( outNotes, insertFrom, insterSTR )
        
        
        ' --- JIRA Issues ---
        Call Get_JIRA_Package_Issues ( JIRASQL )
        Call Get_JIRA_Issues ( JIRASQL, rsJIRA )
        Call Get_Snippet ( "Issues:List:JIRA", outNotes, snippetJIRA, insertFrom )

        Call Get_Snippet ( "JIRA_Issues:List", outNotes, snippetSTR, insertFrom )

        While ((NOT rsJIRA.BOF) AND (NOT rsJIRA.EOF)) 

                        tempSTR = Replace( snippetJIRA, "$ISSUE_DATABASE$", "JIRA" )

                        tempSTR = Replace( tempSTR, "$ISSUE_NUMBER$",           rsJIRA("iss_num") )
                        tempSTR = Replace( tempSTR, "$SUMMARY$",                NVL( HTML_Encode ( rsJIRA("summary") ) ) )


                        tempSTR = Replace( tempSTR, "$ISSUE_TYPE$",             NVL( rsJIRA("issuetype") ) ) 
                        insterSTR = insterSTR & Replace( tempSTR, "$PRIORITY$", NVL( rsJIRA("priority") ) )

                rsJIRA.MoveNext
        Wend    
        rsJIRA.Close()
        Call Insert_To_Page ( outNotes, insertFrom, insterSTR )
        
        
        ' --- Issues ---
        ' Fixed:
        Call Get_ORA_Package_Issues ( "Fixed_Issues", CQSQL )
        Call Get_CQ_Issues ( CQSQL, rsCQ )
        Call Get_Snippet ( "Issues:List:DEVI", outNotes, snippetDEVI, insertFrom )
        Call Get_Snippet ( "Issues:List:TDSE", outNotes, snippetTDSE, insertFrom )
        Call Get_Snippet ( "Fixed_Issues:List", outNotes, snippetSTR, insertFrom )
        While ((NOT rsCQ.BOF) AND (NOT rsCQ.EOF)) 
                'If CInt(NNproj_id) = CInt(SYD_PROJID) Then
                        'Extract Release Info If Exists
                releaseInfo = rsCQ("releaseinfo")
                Call EditReleaseInfoDetails ( rsCQ("iss_db"), rsCQ("iss_id"), newReleaseInfo, releaseInfo )
                'End If
            ' Add Row
                If rsCQ("iss_db") = enumCLEARQUEST_DEVI_ID Then
                        tempSTR = Replace( snippetDEVI, "$ISSUE_DATABASE$", "DEVI" )
                ElseIf rsCQ("iss_db") = enumCLEARQUEST_TDSE_ID Then
                        tempSTR = Replace( snippetTDSE, "$ISSUE_DATABASE$", "TDSE" )
                End If
                tempSTR = Replace( tempSTR, "$TAG_ID$",                 rsCQ("iss_db") &"_"& rsCQ("iss_id") )
        tempSTR = Replace( tempSTR, "$BOX_WIDTH$",              String(20, "_") ) 
        tempSTR = Replace( tempSTR, "$ISSUE_NUMBER$",           rsCQ("iss_num") )
        tempSTR = Replace( tempSTR, "$SUMMARY$",                NVL( HTML_Encode ( rsCQ("summary") ) ) )
        ' --- CQ Issues body ---
        tempSTR = Replace( tempSTR, "$CQ_ISSUE_TYPE$",          NVL( rsCQ("issue_type") ) )
        tempSTR = Replace( tempSTR, "$CQ_SUBMITTER$",           NVL( rsCQ("submitter") ) )
        tempSTR = Replace( tempSTR, "$CQ_DETECTED_IN_VERSION$", NVL( rsCQ("release_part1") &"."& rsCQ("release_part2") &"."& rsCQ("release_part3") ) )
        tempSTR = Replace( tempSTR, "$CQ_SUBMIT_DATE$",         NVL( EuroDate ( rsCQ("submit_date") ) ) )
        tempSTR = Replace( tempSTR, "$CQ_PROJECT$",             NVL( rsCQ("project") ) )
        tempSTR = Replace( tempSTR, "$CQ_OWNER$",               NVL( rsCQ("owner") ) )
        tempSTR = Replace( tempSTR, "$CQ_PRODUCT$",             NVL( rsCQ("product") ) )
        tempSTR = Replace( tempSTR, "$CQ_APPROVER$",            NVL( rsCQ("approver") ) )
        tempSTR = Replace( tempSTR, "$CQ_PACKAGE$",             NVL( rsCQ("package_ref") ) )
        tempSTR = Replace( tempSTR, "$CQ_PRIORITY$",            NVL( rsCQ("priority") ) )
        tempSTR = Replace( tempSTR, "$CQ_STATUS$",              NVL( rsCQ("status") ) )
        tempSTR = Replace( tempSTR, "$CQ_DESCRIPTION$",         FormatTextBox ( NVL( HTML_Encode( rsCQ("description") ) ) ) )
        tempSTR = Replace( tempSTR, "$CQ_NOTES_LOG$",           FormatTextBox ( NVL( HTML_Encode( rsCQ("notes_log") ) ) ) )
        tempSTR = Replace( tempSTR, "$CQ_RELEASE_ID$",          NVL( rsCQ("release_id") ) )
        tempSTR = Replace( tempSTR, "$CQ_CLIENT_REFERENCE$",    NVL( rsCQ("client_ref") ) )
        tempSTR = Replace( tempSTR, "$CQ_SEVERITY$",            NVL( rsCQ("severity") ) )
        tempSTR = Replace( tempSTR, "$CQ_CHANGE_REQUEST$",      Format_CQ_CHANGE_REQUEST ( rsCQ("cr_internal"), rsCQ("cr_external") ) )
        '-----------------------
        tempSTR = Replace( tempSTR, "$ISSUE_TYPE$",             NVL( rsCQ("issue_type") ) ) 
                insterSTR = insterSTR & Replace( tempSTR, "$PRIORITY$", NVL( rsCQ("priority") ) )
                
                rsCQ.MoveNext
        WEnd
        rsCQ.Close()
        Call Insert_To_Page ( outNotes, insertFrom, insterSTR )
        
        ' Outstanding:
        Call Get_ORA_Package_Issues ( "Outstanding_Issues", CQSQL )
        Call Get_CQ_Issues ( CQSQL, rsCQ )
        Call Get_Snippet ( "Outstanding_Issues:List", outNotes, snippetSTR, insertFrom )
        While ((NOT rsCQ.BOF) AND (NOT rsCQ.EOF)) 
            ' Add Row
                If rsCQ("iss_db") = enumCLEARQUEST_DEVI_ID Then
                        tempSTR = Replace( snippetDEVI, "$ISSUE_DATABASE$", "DEVI" )
                ElseIf rsCQ("iss_db") = enumCLEARQUEST_TDSE_ID Then
                        tempSTR = Replace( snippetTDSE, "$ISSUE_DATABASE$", "TDSE" )
                End If
                tempSTR = Replace( tempSTR, "$TAG_ID$",                 rsCQ("iss_db") &"_"& rsCQ("iss_id") )
        tempSTR = Replace( tempSTR, "$BOX_WIDTH$",              String(20, "_") ) 
        tempSTR = Replace( tempSTR, "$ISSUE_NUMBER$",           rsCQ("iss_num") )
        tempSTR = Replace( tempSTR, "$SUMMARY$",                NVL( HTML_Encode ( rsCQ("summary") ) ) )
        ' --- CQ Issues body ---
        tempSTR = Replace( tempSTR, "$CQ_ISSUE_TYPE$",          NVL( rsCQ("issue_type") ) )
        tempSTR = Replace( tempSTR, "$CQ_SUBMITTER$",           NVL( rsCQ("submitter") ) )
        tempSTR = Replace( tempSTR, "$CQ_DETECTED_IN_VERSION$", NVL( rsCQ("release_part1") &"."& rsCQ("release_part2") &"."& rsCQ("release_part3") ) )
        tempSTR = Replace( tempSTR, "$CQ_SUBMIT_DATE$",         NVL( EuroDate( rsCQ("submit_date") ) ) )
        tempSTR = Replace( tempSTR, "$CQ_PROJECT$",             NVL( rsCQ("project") ) )
        tempSTR = Replace( tempSTR, "$CQ_OWNER$",               NVL( rsCQ("owner") ) )
        tempSTR = Replace( tempSTR, "$CQ_PRODUCT$",             NVL( rsCQ("product") ) )
        tempSTR = Replace( tempSTR, "$CQ_APPROVER$",            NVL( rsCQ("approver") ) )
        tempSTR = Replace( tempSTR, "$CQ_PACKAGE$",             NVL( rsCQ("package_ref") ) )
        tempSTR = Replace( tempSTR, "$CQ_PRIORITY$",            NVL( rsCQ("priority") ) )
        tempSTR = Replace( tempSTR, "$CQ_STATUS$",              NVL( rsCQ("status") ) )
        tempSTR = Replace( tempSTR, "$CQ_DESCRIPTION$",         FormatTextBox ( NVL( HTML_Encode( rsCQ("description") ) ) ) )
        tempSTR = Replace( tempSTR, "$CQ_NOTES_LOG$",           FormatTextBox ( NVL( HTML_Encode( rsCQ("notes_log") ) ) ) )
        tempSTR = Replace( tempSTR, "$CQ_RELEASE_ID$",          NVL( rsCQ("release_id") ) )
        tempSTR = Replace( tempSTR, "$CQ_CLIENT_REFERENCE$",    NVL( rsCQ("client_ref") ) )
        tempSTR = Replace( tempSTR, "$CQ_SEVERITY$",            NVL( rsCQ("severity") ) )
        tempSTR = Replace( tempSTR, "$CQ_CHANGE_REQUEST$",      Format_CQ_CHANGE_REQUEST ( rsCQ("cr_internal"), rsCQ("cr_external") ) )
        '-----------------------
        tempSTR = Replace( tempSTR, "$ISSUE_TYPE$",             NVL( rsCQ("issue_type") ) )
                insterSTR = insterSTR & Replace( tempSTR, "$PRIORITY$", NVL( rsCQ("priority") ) )
                
                rsCQ.MoveNext
        WEnd
        rsCQ.Close()
        Call Insert_To_Page ( outNotes, insertFrom, insterSTR )
        
        
        
        
        ' --- Unit Tests ---
        Query_String = ReadFile( AppPath & QUERIES_FOLDER & "\unit_tests.sql" )
        Set rsQry = OraDatabase.CreateDynaset( Query_String, cint(0))
        Call Get_Snippet ( "Unit_Tests", outNotes, snippetSTR, insertFrom )
        If rsQry.RecordCount < 1 Then
                tempSTR = Replace( snippetSTR, "$TEST_NAME$", "&nbsp;" )
                tempSTR = Replace( tempSTR, "$TEST_SUMMARY$", "&nbsp;" )
                tempSTR = Replace( tempSTR, "$TEST_PASSED$", "&nbsp;" )
                insterSTR = insterSTR & Replace( tempSTR, "$TEST_COMPLETED$", "&nbsp;" )
        End If
        While ((NOT rsQry.BOF) AND (NOT rsQry.EOF)) 
                tempSTR = Replace( snippetSTR, "$TEST_NAME$", rsQry("test_type_name") )
                tempSTR = Replace( tempSTR, "$TEST_SUMMARY$", NVL( FormatTextBox ( HTML_Encode ( rsQry("test_summary") ) ) ) )
                tempSTR = Replace( tempSTR, "$TEST_PASSED$", NVL( FormatTextBox ( HTML_Encode ( rsQry("numof_test") ) ) ) )
                If NOT IsNull( rsQry("tester") ) Then
                        tempSTR = Replace( tempSTR, "$TEST_COMPLETED$", EuroDate ( rsQry("completion_date") ) &" by "& rsQry("tester") )
                Else
                        tempSTR = Replace( tempSTR, "$TEST_COMPLETED$", "&nbsp;")
                End If
                insterSTR = insterSTR & tempSTR
                rsQry.MoveNext
        WEnd
        Call Insert_To_Page ( outNotes, insertFrom, insterSTR )



        
        ' --- Additional_Notes ---
        Query_String = ReadFile( AppPath & QUERIES_FOLDER & "\additional_notes.sql" )
        Set rsQry = OraDatabase.CreateDynaset( Query_String, cint(0))
        Call Get_Snippet ( "Additional_Notes:Blank", outNotes, tempSTR, insertFrom )
        Call Get_Snippet ( "Additional_Notes", outNotes, snippetSTR, insertFrom )
        If rsQry.RecordCount < 1 Then
                insterSTR = tempSTR
        End If
        While ((NOT rsQry.BOF) AND (NOT rsQry.EOF)) 
                tempSTR = Replace( snippetSTR, "$NOTE_TITLE$", rsQry("note_title") )
                tempSTR = Replace( tempSTR, "$NOTE_BODY$", NVL( FormatTextBox ( HTML_Encode ( rsQry("note_body") ) ) ) )
                tempSTR = Replace( tempSTR, "$MOD_DATE$", EuroDate ( rsQry("mod_date") ) )
                insterSTR = insterSTR & Replace( tempSTR, "$MOD_USER$", NVL( rsQry("full_name") ) )
                rsQry.MoveNext
        WEnd
        Call Insert_To_Page ( outNotes, insertFrom, insterSTR )
        
        
        
        
        rsQry.Close()
        Set rsQry = Nothing
        OraDatabase.Parameters.Remove "PV_ID"
End Sub