<h2><img src="{if $config->get("ui/morphEnabled") == '1'}{$rootUrl}/skins/kts_{$config->get("ui/morphTo")}/title_bullet.png{else}{$rootUrl}/resources/graphics/title_bullet.png{/if}"/>{i18n}Document Version History{/i18n}:<br />{$document->getName()|sanitize}</h2>

<p class="descriptiveText">{i18n}This page lists versions of document metadata and allows you to compare a metadata version with the current metadata content.{/i18n}</p>


    <table class="document_history" summary="{i18n arg_appname="$appname"}Document History for #appname# New UI Presentation{/i18n}" cellspacing="0">

        <thead>
            <tr>
                <th class="username">{i18n}User{/i18n}</th>
                <th class="date">{i18n}Metadata Version{/i18n}</th>
                <th class="date">{i18n}Content Version{/i18n}</th>
                <th class="compare">{i18n}Compare with Current{/i18n}</th>
                <th class="compare">{i18n}Compare with Other Version{/i18n}</th>
				<th class="versiondate">{i18n}Date Created{/i18n}</th>
				{if $showdelete}
				    <th class="deleteversion">{i18n}Delete Version{/i18n}</th>
				{/if}
            </tr>
        </thead>
        <tbody>
          {foreach item=oVersion from=$versions}
            <tr class="{cycle values=even,odd}">
                <td class="username">{$context->getUserForId($oVersion->getVersionCreatorId())}</td>
                <td class="date">{$oVersion->getMetadataVersion()}</td>
{capture assign=version}{$oVersion->getMajorVersionNumber()}.{$oVersion->getMinorVersionNumber()}{/capture}
{capture assign=versionid}{$oVersion->getContentVersionId()}{/capture}
                <td class="date">
                    {if ($oVersion->getMetadataStatusID() != VERSION_DELETED)}
                        <a href="{$downloadaction->getURL()}&version={$versionid}">{$version}</a>
                    {else}
                        {$version}
                    {/if}
                </td>
                <td class="compare">
                {if ($document->getMetadataVersion() == $oVersion->getMetadataVersion())}
                   <strong>{i18n}current version{/i18n}</strong>
                {else}
                    {if ($oVersion->getMetadataStatusID() != VERSION_DELETED)}
                        <a href="{addQS}action=viewComparison&fDocumentId={$document->getId()}&fBaseVersion={$document->getCurrentMetadataVersionId()}&fComparisonVersion={$oVersion->getCurrentMetadataVersionId()}{/addQS}">{i18n}Metadata{/i18n}</a>
                        {if ($bShowCompare)}
                            &nbsp;|&nbsp;
                            {if ($document->getMimeTypeID() != $oVersion->getMimeTypeID())}
                                <span class='descriptiveText'>{i18n}mime types do not match{/i18n}</span>
                            {else}
                                <a style="cursor:hand;" onclick='window.open("{$sUrl}&action=downloadComparison&fDocumentId={$document->getId()}&fBaseVersion={$document->getCurrentMetadataVersionId()}&fComparisonVersion={$oVersion->getCurrentMetadataVersionId()}", "Document_Diffs");'>{i18n}Content{/i18n}</a>
                            {/if}
                        {/if}
                    {else}
                        &mdash;
                    {/if}
                {/if}
                </td>
                <td>
                {if (count($versions) == 1)}
                &mdash;
                {else}
                    {if ($oVersion->getMetadataStatusID() != VERSION_DELETED)}
                        <a href="{addQS}action=startComparison&fDocumentId={$document->getId()}&fComparisonVersion={$oVersion->getCurrentMetadataVersionId()}{/addQS}">{i18n}Metadata{/i18n}</a>
                        {if ($bShowVersionCompare)}
                            &nbsp;|&nbsp;
                            <a href="{$sUrl}&action=showContentCompare&fDocumentId={$document->getId()}&fComparisonVersion={$oVersion->getCurrentMetadataVersionId()}">{i18n}Content{/i18n}</a>
                        {/if}
                    {else}
                        &mdash;
                    {/if}
                {/if}
                </td>
                <td class="versiondate">{$oVersion->getVersionCreated()}</td>
                {if $showdelete}
                    <td class="deleteversion">
                        {if ($document->getMetadataVersion() != $oVersion->getMetadataVersion() & $document->getStoragePath() != $oVersion->getStoragePath())}
                            {if ($oVersion->getMetadataStatusID() == VERSION_DELETED)}
                                <strong>{i18n}Version deleted{/i18n}</strong>
                            {else}
                                <a href="{addQS}action=confirmdeleteVersion&fDocumentId={$document->getId()}&version={$oVersion->getCurrentMetadataVersionId()}{/addQS}">{i18n}delete version{/i18n}</a>
                            {/if}
                        {else}
                            &mdash;
                        {/if}
                    </td>
                {/if}
            </tr>
            {/foreach}
        </tbody>

    </table>

{if ($showdelete && !$showall)}
    <p>
    <a href="{addQS}fDocumentId={$document->getId()}&show=all{/addQS}">{i18n}Show deleted versions{/i18n}</a>
    </p>
{/if}