'#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

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

    Dim template As String
    Dim bodyString As String
    Dim boxCounterDataContainer As Integer

    Dim oneTopic As Topic
    Dim topicData As DataContainer

    On Error GoTo ReportError
    
    webex.Trace("Entering BoxDataContainer.mmbas",2)

    Set oneTopic = webex.ActiveTopic
    Set topicData = oneTopic.DataContainer

    template = webex.ReadFile("BoxDataContainer.htm")

    If    webex.GetParameter("Strings.Show.DataContainer") = False _
       Or DoExportDataContainer(topicData) = False Then

       ' Don't export task info section
       bodyString = ""

    Else

       ' Process all commands and parameters
       ProcessString webex, template

       ' Our merged string to write back
       bodyString = template

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

    End If

    ' Write out the result
    webex.PushString(bodyString)

    webex.Trace("Exiting BoxDataContainer.mmbas",2)

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

Function DoExportDataContainer (topicData As DataContainer)

    DoExportDataContainer  = False

    If topicData.DataContainerType <> mmDataContainerTypeNone Then
    	DoExportDataContainer = True
    End If

End Function
