<H1>Templates Manager</H1>
{if:eq(mode,#edit#)}
    <h2>Edit template {tpl_fname}:</h2>

    <form action="{zoner}" method=POST>
    <flexy:component name="ff" class="fill_hidden" exclude="mode">
    <input type=hidden name="action" value="save">
    <input type=hidden name="fname" value="{tpl_fname}">

    <table width="100%">
    <tr>
        <td colspan=2>
        <textarea style="width: 100%; height: 300px;" name="tpl_content"></textarea>
        </td>
    </tr>

    <tr>
        <td>
        <input type=submit value=" Save ">
        </form>    
        </td>

        <td align="right">
        <form action="{zoner}" method=POST>
        <input type=submit value=" Cancel ">
        <input type=hidden name="target" value="templates">
        </form>    
        </td>
    </tr>
    </table>

{else:}
    <h2>Select teplate to edit:</h2>
    {foreach:tpl_list,tpl}
    <a href="{zoner}?target=templates&mode=edit&fname={tpl}">{tpl}</a><br>
    {end:}
{end:}