<mt:setvarblock name="page_title"><mt:if name="blog_id"><__trans phrase="Manage [_1] Templates" params="<mt:if name="is_blog"><__trans phrase="Blog"><mt:else><__trans phrase="Website"></mt:if>"><mt:else><__trans phrase="Manage Global Templates"></mt:if></mt:setvarblock>
<mt:setvarblock name="related_content">
    <mtapp:widget
        id="quickfilters"
        label="<__trans phrase="Quickfilters">">
        <mt:if name="filter_key" eq="backup_templates">
            <mt:setvarblock name="script_url_plus"><mt:var name="script_url">?__mode=list_template&amp;blog_id=<mt:var name="blog_id"></mt:setvarblock>
        </mt:if>
        <ul>
        <mt:if name="blog_id">
            <li id="all-tab"><a href="<$mt:var name="script_url_plus"$>#all" onclick="showTable('all-listing');"><__trans phrase="Show All Templates"></a></li>
            <li id="index-tab"><a href="<$mt:var name="script_url_plus"$>#index" onclick="showTable('index-listing');"><__trans phrase="Index Templates"></a></li>
            <li id="system-tab"><a href="<$mt:var name="script_url_plus"$>#system" onclick="showTable('system-listing');"><__trans phrase="System Templates"></a></li>
            <li id="archive-tab"><a href="<$mt:var name="script_url_plus"$>#archive" onclick="showTable('archive-listing');"><__trans phrase="Archive Templates"></a></li>
            <li id="module-tab"><a href="<$mt:var name="script_url_plus"$>#module" onclick="showTable('module-listing');"><__trans phrase="Template Modules"></a></li>
        <mt:else>
            <li id="all-tab"><a href="<mt:var name="script_url">?__mode=list_template#all" onclick="showTable('all-listing');"><__trans phrase="Show All Templates"></a></li>
            <li id="module-tab"><a href="<mt:var name="script_url">?__mode=list_template#module" onclick="showTable('module-listing');"><__trans phrase="Template Modules"></a></li>
            <li id="email-tab"><a href="<mt:var name="script_url">?__mode=list_template#email" onclick="showTable('email-listing');"><__trans phrase="Email Templates"></a></li>
            <li id="system-tab"><a href="<mt:var name="script_url">?__mode=list_template#system" onclick="showTable('system-listing');"><__trans phrase="System Templates"></a></li>
        </mt:if>
        </ul>
        <$mtapp:ListFilters$>
    </mtapp:widget>
    <mtapp:widget
        id="useful-links"
        label="<__trans phrase="Useful links">">
        <ul>
            <li><a href="<mt:var name="script_url">?__mode=list_template&amp;filter_key=backup_templates&amp;blog_id=<mt:var name="blog_id">" class="icon-left icon-related"><__trans phrase="Template Backups"></a></li>
        <mt:if name="can_edit_config">
            <li><a href="<mt:var name="script_url">?__mode=cfg_prefs&amp;blog_id=<mt:var name="blog_id">" class="icon-left icon-related"><__trans phrase="Publishing Settings"></a></li>
        </mt:if>
        </ul>
    </mtapp:widget>
    <$MTApp:PageActions from="list_template"$>
</mt:setvarblock>
<mt:setvarblock name="html_head" append="1">
<script type="text/javascript">
/* <![CDATA[ */
    <mt:unless name="filter_key" eq="backup_templates">
        <mt:if name="blog_id">
var tableList = ["index", "archive", "module", "system"];
        <mt:else>
var tableList = ["module", "email", "system"];
        </mt:if>
    <mt:else>
var tableList = ["backup"];
    </mt:unless>
function showTable(name) {
    for (var i=0, len=tableList.length; i<len; i++) {
        var el = tableList[i] + "-listing"
        var elTab = tableList[i] + "-tab"
        if (name == "all-listing") {
            DOM.removeClassName ( el, "hidden");
            DOM.removeClassName ( elTab, "current-filter");
            DOM.addClassName( "all-tab", "current-filter" );
        }
        else if (name == el) {
            DOM.removeClassName ( el, "hidden");
            DOM.addClassName( elTab, "current-filter" );
            DOM.removeClassName( "all-tab", "current-filter" );
        }
        else {
            DOM.addClassName( el, "hidden" );
            DOM.removeClassName( elTab, "current-filter" );
            DOM.removeClassName( "all-tab", "current-filter" );
        }
    }
}
var tableSelect = [];
function init() {
<mt:loop name="template_type_loop">
    tableSelect.push(new TC.TableSelect( '<mt:var name="template_type" escape="js">-listing-table' ));
    tableSelect[tableSelect.length-1].rowSelect = true;
</mt:loop>
    var name = (window.location.hash && window.location.hash.match( /^#/ ) ) ? window.location.hash.substr(1) : "all";
    showTable(name + "-listing");
}
/* ]]> */
</script>
</mt:setvarblock>
<mt:setvarblock name="system_msg">
    <mt:if name="saved_deleted">
        <mtapp:statusmsg
            id="saved-deleted"
            class="success">
            <__trans phrase="You have successfully deleted the checked template(s).">
        </mtapp:statusmsg>
    </mt:if>
    <mt:if name="refreshed">
        <mtapp:statusmsg
            id="refreshed"
            class="success">
            <__trans phrase="You have successfully refreshed your templates.">
        </mtapp:statusmsg>
    </mt:if>
    <mt:if name="saved">
        <mtapp:statusmsg
            id="saved-settings"
            class="success">
            <__trans phrase="Your settings have been saved.">
        </mtapp:statusmsg>
    </mt:if>
    <mt:if name="published">
        <mtapp:statusmsg
            id="published"
            class="success">
            <__trans phrase="Your templates have been published.">
        </mtapp:statusmsg>
    </mt:if>
    <mt:if name="saved_copied">
        <mtapp:statusmsg
            id="saved-copied"
            class="success">
            <__trans phrase="Selected template(s) has been copied.">
        </mtapp:statusmsg>
    </mt:if>
</mt:setvarblock>

<mt:include name="include/header.tmpl">

<mt:loop name="template_type_loop">
<mt:if name="__first__">
<$mt:var name="list_filter_form"$>
</mt:if>
<$mt:include name="include/template_table.tmpl"$>
</mt:loop>

<mt:setvarblock name="jq_js_include" append="1">
    init();
    jQuery.mtCheckbox();
</mt:setvarblock>
<mt:include name="include/footer.tmpl">
