#*
  NEWS SPECIFIC DECORATOR
Here the context is a blogpost item (news).
Modes are 'view', 'edit', 'edit-preview', and 'remove'.
*#

#set ($helper = $params.get("helper"))
#set ($mode = $params.get("mode"))
#set ($context = $params.get("context"))
#set ($blog = $helper.page)
#set ($infoPanelWidth = $params.get("infopanel-width"))
#set ($calendarWidth = $params.get("calendar-width"))

#infoPanelInitFromParams()
## GENERAL PAGE DECORATING BEGINS

#requireResourcesForContext("blogpost")

#if ($mode != "edit" && $mode != "edit-preview")
    #parse ("/decorators/includes/content-navigation.vm")
#end

#if ($infoPanelRequired)
<content tag="sidebar">
    #infoPanel(true true true true)
</content>
#end

#if ($calendarWidth)                ##TODO: Bring this out somewhere
<content tag="sidebar">
    #if ($helper.action.calendarForThisMonth)
        #blogPostsCalendarWithDateLinks($helper.action false)
    #end
</content>
#end

<div id="content" class="blogpost $!mode">
    #parse ( "/template/includes/actionerrors.vm" )

    ## MODE SPECIFIC DECORATING BEGINS
        #*
            Display page based on mode: currently 'view', 'edit', 'preview-edit', 'info' and 'attachments.
            See the individual page templates (viewpage.vm, editpage.vm, etc.) for the setting of the mode parameter.
        *#
        ## VIEW
        #if ($mode == "view")
            #if ($space.personal)
                #set ($usernameFromSpaceKey = $spaceUtils.getUsernameFromPersonalSpaceKey($spaceKey))
                #if ($permissionHelper.canView($action.remoteUser, $action.getUser($usernameFromSpaceKey)))
                    <content tag="show-personal-sidebar">true</content>
                #end
            #end

            #requireResourcesForContext("viewcontent")
            #permitSearchEngines()

            #parse ("/decorators/includes/page-metadata.vm")
            #if ($helper.isHistoricalVersion())
                #versionInfo()
            #end

            <div class="wiki-content">
                $body
            </div>

            #parse ("/labels/labels-editor.vm")

            #applyDecorator("root")
                #decoratorParam("sitemeshPage" $sitemeshPage)
                #decoratorParam("page" $blog)
                #decoratorParam("context" "comments")
            #end

            #trackbackRdf ($trackbackUtils.getContentIdentifier($page) $page.title $trackbackUtils.getPingUrl($page))
            <content tag="surtitle">
                <div class="blogSurtitle">
                    <img src="$staticResourceUrlPrefix/images/icons/blogentry_16.gif" height="16" width="16" border="0" align="absmiddle">&nbsp;
                    <span class="blogDate">$helper.action.getDateString($blog.creationDate)</span> at $helper.action.dateFormatter.formatTime($blog.creationDate) by #usernameLink($blog.creatorName)
                </div>
            </content>

        ## EDIT || PREVIEW-EDIT
    #elseif ($mode == "edit" || $mode == "edit-preview")
        $body

    ## INFO
    #elseif ($mode == "view-information")
        $body

    ## ATTACHMENTS
    #elseif ($mode == "view-attachments" || $mode == "move-attachments")
        $body
    #end
    ## MODE SPECIFIC DECORATING ENDS

</div>
## GENERAL PAGE DECORATING ENDS

<content tag="suppressPdfLink">true</content>
#parse ("/pages/page-breadcrumbs.vm")
#menuMacros_renderBrowseMenu()
