'#Reference {A3B5C45B-F842-44fc-A5E5-50CED69BA86E}#2.0#0#C:\Program Files\Mindjet\MindManager 6\Mm5WebExport.dll#Mm5webexport 2.0 Type Library
'#Uses "ParameterNames.mmbas"
'#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 count As Long
    Dim i As Long
    Dim bodyString As String

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

    bodyString = ""

    If webex.GetParameter("Strings.Show.Footer") = True Then
        If Not webex.ParameterExists("Cached.Footer") Then ' not cached yet
            bodyString = webex.ReadFile("PageFooter.htm")
            ' Insert the export date in the HTML export
            bodyString = Replace(bodyString, "#TheExportDate#", CStr(Date))
            ' Process all commands and parameters
            ProcessString webex, bodyString
            webex.SetParameter("Cached.Footer", bodyString) ' save for next time
        Else
            bodyString = webex.GetParameter("Cached.Footer") ' else read cached info

        End If

		If webex.GetParameter(TsShowPageFooterHyperlink) = True Then
				bodyString = Replace(bodyString, "#UserHyperlinkText#", webex.GetParameter(TsUserHyperlinkText))
				bodyString = Replace(bodyString, "#UserHyperlinkUrl#", webex.GetParameter(TsUserHyperlinkUrl))
			Else
				bodyString = Replace(bodyString, "#UserHyperlinkText#", "")
		End If
    End If

    ' Write out the result
    webex.PushString( bodyString )

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

    Exit Sub

ReportError:
    ProcessError(webex)
    Exit Sub

End Sub
