'#Reference {A3B5C45B-F842-44fc-A5E5-50CED69BA86E}#2.0#0#C:\Program Files\Mindjet\MindManager 6\Mm5WebExport.dll#Mm5webexport 2.0 Type Library
'#Uses "GlobalUtilities.mmbas"

Option Explicit

Sub Main

    Dim addin As Mm5WebExportAddIn
    Dim webex As WebExport
    Dim aPage As Mm5WebExportLib.Page

    Set addin = WebExportHelper.WebExportAddIn
    Set webex = addin.ActiveWebExport

    Dim oneTopic As Topic
    Dim oneReviewComment As ReviewComment
    Dim oneReviewCommentCollection As ReviewComments

    Dim getParameterResult As Variant
    Dim IsValidReviewComment As Boolean
    Dim IsValidReviewCommentCollection As Boolean
    Dim DoProcessTemplate As Boolean
    Dim count As Long
    Dim i As Long
    Dim boxCounterComments As Integer

    Dim template As String
    Dim topicString As String
    Dim bodyString As String
    Dim CalloutCount As Long

    On Error GoTo ReportError
    webex.Trace("Entering BoxCom.htm",2)

    ' Assume we want to process the callout template
    DoProcessTemplate = True

    ' Read template file
    template = webex.ReadFile( "BoxCom.htm" )

    If webex.GetParameter("Strings.Show.ReviewComments") = True Then

        ' Store currently active topic
        Set oneTopic = webex.ActiveTopic

        ' Assume no callouts are present
        bodyString = ""

        ' Don't do anything if the callout collection for the topic is empty
        Set oneReviewCommentCollection = oneTopic.ReviewComments
        If oneReviewCommentCollection.Count > 0 Then
            topicString = template
            ' Process all commands and parameters
            ProcessString webex, topicString
            ' Store our processed review comments
            bodyString = bodyString + topicString

            ' Increment box counter number
            boxCounterComments = webex.GetParameter("CustomParameter.BoxCounterComments")
            boxCounterComments = boxCounterComments + 1
            webex.SetParameter("CustomParameter.BoxCounterComments", boxCounterComments)

        Else
            ' No callouts to export, set table row height to zero to hide the whole row
            bodyString = ""
        End If

        ' Write out the result
        webex.PushString(bodyString)

    Else

        ' User has chosen to not export the review comments section
        ' (in MindManager HTML customize dialog)
        webex.PushString("")

    End If

    webex.Trace("BoxCom.htm", 2)

    Exit Sub
 
ReportError:
    ProcessError(webex)
    Exit Sub
 
End Sub
