'#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 oneHyperlink As Hyperlink

    Dim IsValidReviewComment As Boolean
    Dim IsValidReviewCommentCollection As Boolean
    Dim DoProcessTemplate As Boolean
    Dim count As Long
    Dim i As Long
    Dim getParameterResult As Variant
    Dim LocalCounter As Variant
    Dim template As String
    Dim topicString As String
    Dim bodyString As String
    Dim a As String
    Dim CalloutCount As Long

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

    ' Assume we want to process the review comments item template
    DoProcessTemplate = True

    ' Store currently active topic
    Set oneTopic = webex.ActiveTopic

    Set oneReviewCommentCollection = oneTopic.ReviewComments
    IsValidReviewCommentCollection = oneReviewCommentCollection.IsValid

    For Each oneReviewComment In oneReviewCommentCollection

        webex.SetParameter( "CustomParameter.ReviewCommentUserName", oneReviewComment.AuthorName )
        webex.SetParameter( "CustomParameter.ReviewCommentDate", oneReviewComment.Date )
        webex.SetParameter( "CustomParameter.ReviewCommentText", oneReviewComment.Text )

        ' Read template file
        template = webex.ReadFile( "BoxComItem.htm" )
        'webex.SetParameter( "CustomParameter.CalloutHyperlink", oneReviewComment.Hyperlink.Address )
 
        topicString = template

        ' Process all commands and parameters
        ProcessString webex, topicString

        ' Store our processed review comments
        bodyString = bodyString + topicString

    Next

    ' Write out the result
    webex.PushString(bodyString)

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

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