Sign in to follow this  
Followers 0
gcue

array to changelog

1 post in this topic

#1 ·  Posted (edited)

im trying to do this the easiest and most efficient way i can think of.. here's what i have.

i will be constantly adding to this.. so i guess the pain is doing the html for all the items and subitems.

any brighter ideas?

$fixes_header_written = False
$changes_header_written = False
$added_header_written = False
$removed_header_written = False

$file = @ScriptDir & "\ChangeLog.html"

If FileExists($file) Then
    FileDelete($file)
EndIf

Local $changelog_versions[1], $changelog_entries[6][3]

;~ $changelog_versions[0] = "1.0"
$changelog_versions[0] = "0.3.3.0"
;~ $changelog_versions[2] = "3.0"

$changelog_entries[0][0] = "Account Info: capturing multiple BES accounts when available."
$changelog_entries[0][1] = "Fixed"
$changelog_entries[0][2] = "0.3.3.0"

$changelog_entries[1][0] = "16 color mode was not working with 10x client."
$changelog_entries[1][1] = "Fixed"
$changelog_entries[1][2] = "0.3.3.0"

$changelog_entries[2][0] = "Bug introduced when added version column to installed software."
$changelog_entries[2][1] = "Fixed"
$changelog_entries[2][2] = "0.3.3.0"

$changelog_entries[3][0] = "Contexts were missing in Account Info."
$changelog_entries[3][1] = "Fixed"
$changelog_entries[3][2] = "0.3.3.0"

$changelog_entries[4][0] = "Highlighted table column titles for easier read."
$changelog_entries[4][1] = "Changed"
$changelog_entries[4][2] = "0.3.3.0"

$changelog_entries[5][0] = "Updated ITP Web Link."
$changelog_entries[5][1] = "Changed"
$changelog_entries[5][2] = "0.3.3.0"

$text = '<html>' & @CRLF
$text &= '<title>Changelog</title>' & @CRLF
$text &= '<body>' & @CRLF
$text &= '<table width="80%" align="center">' & @CRLF
$text &= '<tr><td><h1><font color="#1240AB">Changelog</font></h1></td></tr>' & @CRLF
$text &= '<body>' & @CRLF

For $x = 0 To UBound($changelog_versions) - 1
    $text &= '<tr><td><h2>' & $changelog_versions[$x] & '</h2></td></tr>' & @CRLF

    For $y = 0 To UBound($changelog_entries) - 1
        If $changelog_versions[$x] = $changelog_entries[$y][2] Then
            If $changelog_entries[$y][1] = "Fixed" Then
                If $fixes_header_written = False Then
                    $text &= '<tr><td><h4><font color="#ff0000">Fixed</font></h4></td></tr>' & @CRLF
                    $text &= '<tr><td><ol>' & @CRLF
                    $fixes_header_written = True
                EndIf
                $text &= '<li>' & $changelog_entries[$y][0] & '</li>'
            EndIf
        EndIf
    Next

    If $fixes_header_written = True Then
        $text &= '</ol></td></tr>' & @CRLF
    EndIf

    For $y = 0 To UBound($changelog_entries) - 1
        If $changelog_versions[$x] = $changelog_entries[$y][2] Then
            If $changelog_entries[$y][1] = "Changed" Then
                If $changes_header_written = False Then
                    $text &= '<tr><td><h4><font color="#ff0000">Changed</font></h4></td></tr>' & @CRLF
                    $text &= '<tr><td><ol>' & @CRLF
                    $changes_header_written = True
                EndIf
                $text &= '<li>' & $changelog_entries[$y][0] & '</li>'
            EndIf
        EndIf
    Next

    If $changes_header_written = True Then
        $text &= '</ol></td></tr>' & @CRLF
    EndIf

    For $y = 0 To UBound($changelog_entries) - 1
        If $changelog_versions[$x] = $changelog_entries[$y][2] Then
            If $changelog_entries[$y][1] = "Added" Then
                If $added_header_written = False Then
                    $text &= '<tr><td><h4><font color="#ff0000">Added</font></h4></td></tr>' & @CRLF
                    $text &= '<tr><td><ol>' & @CRLF
                    $added_header_written = True
                EndIf
                $text &= '<li>' & $changelog_entries[$y][0] & '</li>'
            EndIf
        EndIf
    Next

    If $added_header_written = True Then
        $text &= '</ol></td></tr>' & @CRLF
    EndIf

    For $y = 0 To UBound($changelog_entries) - 1
        If $changelog_versions[$x] = $changelog_entries[$y][2] Then
            If $changelog_entries[$y][1] = "Removed" Then
                If $removed_header_written = False Then
                    $text &= '<tr><td><h4><font color="#ff0000">Removed</font></h4></td></tr>' & @CRLF
                    $text &= '<tr><td><ol>' & @CRLF
                    $removed_header_written = True
                EndIf
                $text &= '<li>' & $changelog_entries[$y][0] & '</li>'
            EndIf
        EndIf
    Next

    If $removed_header_written = True Then
        $text &= '</ol></td></tr>' & @CRLF
    EndIf
Next

$text &= '</table>' & @CRLF
$text &= '</body>' & @CRLF
$text &= '</html>' & @CRLF

FileWrite($file, $text)

ShellExecute($file)
Edited by gcue

Share this post


Link to post
Share on other sites



Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0