<mt:if name="needs_upgrade">
    <mt:setvarblock name="page_title"><__trans phrase="Time to Upgrade!"></mt:setvarblock>
<mt:else>
    <mt:setvarblock name="page_title"><__trans phrase="Upgrade Check"></mt:setvarblock>
</mt:if>
<mt:setvar name="complete" value="1">
<mt:include name="include/chromeless_header.tmpl">

<style type="text/css">
div.warning#version-warning {
    position: absolute;
    padding: 1em;
    width: 700px;
}
</style>

<div class="upgrade">

<mt:if name="needs_upgrade">

    <mt:if name="version_warning">
    <div class="message" id="version-warning">
        <p><__trans phrase="The version of Perl installed on your server ([_1]) is lower than the minimum supported version ([_2])." params="<mt:var name="perl_version">%%<mt:var name="perl_minimum">"></p>
        <p><__trans phrase="While Movable Type may run, it is an <strong>untested and unsupported environment</strong>.  We strongly recommend upgrading to at least Perl [_1]." params="<mt:var name="perl_minimum">"></p>
        <p><__trans phrase="Do you want to proceed with the upgrade anyway?"></p>
        <div class="actions-bar">
            <input type="hidden" name="continue" value="1" />
            <button
                onclick="dismiss('version-warning'); show('warning_gone'); return false;"
                type="submit"
                accesskey="s"
                title="<__trans phrase="Yes (s)">"
                class="action primary-button"
                ><__trans phrase="Yes"></button>
            <button
                onclick="javascript:location.href='mt-check.cgi'"
                type="submit"
                accesskey="x"
                title="<__trans phrase="View MT-Check (x)">"
                class="action"
                ><__trans phrase="No"></button>
        </div>
    </div>
    </mt:if>

    <div id="warning_gone"<mt:if name="version_warning"> style="display:none;"</mt:if>>
    <mt:if name="mt_upgrade">
        <p><__trans phrase="A new version of Movable Type has been installed.  We'll need to complete a few tasks to update your database."></p>
        <p><__trans phrase="The Movable Type Upgrade Guide can be found <a href='[_1]' target='_blank'>here</a>." params="http://www.movabletype.org/documentation/upgrade/"></p>
    </mt:if>

    <mt:if name="plugin_upgrades">
        <mt:if name="mt_upgrade">
        <p><__trans phrase="In addition, the following Movable Type components require upgrading or installation:"></p>
        <mt:else>
        <p><__trans phrase="The following Movable Type components require upgrading or installation:"></p>
        </mt:if>

        <ul>
        <mt:loop name="plugin_upgrades">
            <li><p><mt:var name="name" escape="html"><mt:if name="version"> <__trans phrase="Version [_1]" params="<mt:var name="version">"></mt:if></p></li>
        </mt:loop>
        </ul>
    </mt:if>

        <form method="post" action="<mt:var name="script_url">">
        <input type="hidden" name="magic_token" value="<mt:var name="magic_token">" />
        <input type="hidden" name="__mode" value="upgrade" />
        <div class="actions-bar">
            <button
                type="submit"
                accesskey="s"
                title="<__trans phrase="Begin Upgrade"> (s)"
                class="upgrade action primary-button"
                ><__trans phrase="Begin Upgrade"></button>
        </div>
        </form>
    </div>

<mt:else><mt:if name="mt_version_incremented">
    <p><__trans phrase="Congratulations, you have successfully upgraded to Movable Type [_1]." params="<mt:var name="mt_version">"></p>

    <form method="get" action="<mt:var name="mt_url">">
        <div class="actions-bar">
            <button
                type="submit"
                accesskey="s"
                title="<__trans phrase="Return to Movable Type"> (s)"
                class="action primary-button"
                ><__trans phrase="Return to Movable Type"></button>
        </div>
    </form>

<mt:else>
    <p><__trans phrase="Your Movable Type installation is already up to date."></p>

    <form method="get" action="<mt:var name="mt_url">">
        <div class="actions-bar">
            <button
                type="submit"
                accesskey="s"
                title="<__trans phrase="Return to Movable Type"> (s)"
                class="action primary-button"
                ><__trans phrase="Return to Movable Type"></button>
        </div>
    </form>

</mt:if></mt:if>

</div>
<script type="text/javascript">
/* <![CDATA[ */
function dismiss(id) {
    jQuery('#'+id).hide();
}

function show(id) {
    jQuery('#'+id).show();
}
/* ]]> */
</script>
<mt:include name="include/chromeless_footer.tmpl">
