{section show=eq( $error, 'permission_denied' )}
<div class="message-error">
<h2>{'Could not create template, permission denied.'|i18n( 'design/admin/visual/templatecreate' )}</h2>
</div>
{/section}

{section show=eq( $error, 'invalid_name' )}
<div class="message-error">
<h2>{'Invalid name. You can only use the characters a-z, numbers and _.'|i18n( 'design/admin/visual/templatecreate' )}</h2>
</div>
{/section}

<form method="post" action={concat( '/visual/templatecreate', $template )|ezurl}>

<div class="context-block">
{* DESIGN: Header START *}<div class="box-header"><div class="box-tc"><div class="box-ml"><div class="box-mr"><div class="box-tl"><div class="box-tr">
<h1 class="context-title">{'Create new template override for <%template_name>'|i18n( 'design/admin/visual/templatecreate',, hash( '%template_name', $template ) )|wash}</h1>

{* DESIGN: Mainline *}<div class="header-mainline"></div>

{* DESIGN: Header END *}</div></div></div></div></div></div>

{* DESIGN: Content START *}<div class="box-ml"><div class="box-mr"><div class="box-content">

<div class="context-attributes">

<p>{'The newly created template file will be placed in'|i18n( 'design/admin/visual/templatecreate' )} design/{$site_design}/override/templates/.</p>

<div class="block">
    <label>{'Filename'|i18n( 'design/admin/visual/templatecreate' )}:</label>
    <input class="halfbox" type="text" name="TemplateName" value="{$template_name}" />.tpl
</div>

{switch match=$template_type}
{case match='node_view'}
<div class="block">
<label>{'Override keys'|i18n( 'design/admin/visual/templatecreate' )}:</label>

<table>
<tr>
    <td>{'Class'|i18n( 'design/admin/visual/templatecreate' )}:</td>
    <td>
    <select name="Match[class_identifier]">
        <option value="-1">{'All classes'|i18n( 'design/admin/visual/templatecreate' )}</option>
        {section name=Class loop=fetch('content', 'can_instantiate_class_list')}
            {let contentClass = fetch( content, class, hash( class_id, $Class:item.id ) )}
                <option value="{$Class:contentClass.identifier}" {section show=eq($Class:contentClass.id, $override_keys['classID'])}selected{/section}>{$Class:item.name|wash}</option>
            {/let}
        {/section}
    </select>
    </td>
</tr>
<tr>
    <td>{'Section'|i18n( 'design/admin/visual/templatecreate' )}:</td>
    <td>
    <select name="Match[section]">
        <option value="-1">{'All sections'|i18n( 'design/admin/visual/templatecreate' )}</option>
        {section name=Section loop=fetch( 'content', 'section_list' )}
            <option value="{$:item.id}">{$:item.name|wash}</option>
        {/section}
    </select>
    </td>
</tr>
<tr>
    <td>{'Node ID'|i18n( 'design/admin/visual/templatecreate' )}:</td>
    <td><input type="text" size="5" value="{$override_keys['nodeID']}" name="Match[node]" /></td>
</tr>
</table>
</div>


<div class="block">
<label>{'Base template on'|i18n( 'design/admin/visual/templatecreate' )}:</label>
<input type="radio" name="TemplateContent" value="EmptyFile" checked="checked"/>{'Empty file'|i18n( 'design/admin/visual/templatecreate' )}<br />
<input type="radio" name="TemplateContent" value="DefaultCopy" />{'Copy of default template'|i18n( 'design/admin/visual/templatecreate' )}<br />
<input type="radio" name="TemplateContent" value="ContainerTemplate" />{'Container (with children)'|i18n( 'design/admin/visual/templatecreate' )}<br />
<input type="radio" name="TemplateContent" value="ViewTemplate" />{'View (without children)'|i18n( 'design/admin/visual/templatecreate' )}<br />
</div>

{/case}
{case match='object_view'}
<div class="objectheader">
<h2>{'Override keys'|i18n( 'design/admin/visual/templatecreate' )}</h2>
</div>

<div class="object">
<table>
<tr>
    <td>
    <p>
    {'Class'|i18n( 'design/admin/visual/templatecreate' )}
    </p>
    </td>
    <td>
    <select name="Match[class_identifier]">
        <option value="-1">{'Any'|i18n( 'design/admin/visual/templatecreate' )}</option>
        {section name=Class loop=fetch('content', 'can_instantiate_class_list')}
        <option value="{fetch( content, class, hash( class_id, $Class:item.id ) ).identifier}">{$Class:item.name|wash}</option>
        {/section}
    </select>
    </td>
</tr>
<tr>
    <td>
    <p>
    {'Section'|i18n( 'design/admin/visual/templatecreate' )}
    </p>
    </td>
    <td>
    <select name="Match[section]">
        <option value="-1">{'Any'|i18n( 'design/admin/visual/templatecreate' )}</option>
        {section name=Section loop=fetch( 'content', 'section_list' )}
            <option value="{$:item.id}">{$:item.name|wash}</option>
        {/section}
    </select>
    </td>
</tr>
<tr>
    <td>
    <p>
    {'Object'|i18n( 'design/admin/visual/templatecreate' )}
    </p>
    </td>
    <td>
    <input type="text" size="5" value="" name="Match[object]" />
    </td>
</tr>
</table>
</div>


<div class="objectheader">
<h2>{'Base template on'|i18n( 'design/admin/visual/templatecreate' )}</h2>
</div>
<div class="object">

<input type="radio" name="TemplateContent" value="EmptyFile" checked="checked"/>{'Empty file'|i18n( 'design/admin/visual/templatecreate' )}<br />
<input type="radio" name="TemplateContent" value="DefaultCopy" />{'Copy of default template'|i18n( 'design/admin/visual/templatecreate' )}<br />
<input type="radio" name="TemplateContent" value="ContainerTemplate" />{'Container (with children)'|i18n( 'design/admin/visual/templatecreate' )}<br />
<input type="radio" name="TemplateContent" value="ViewTemplate" />{'View (without children)'|i18n( 'design/admin/visual/templatecreate' )}<br />
</div>

{/case}
{case match='pagelayout'}
    <div class="objectheader">
    <h2>{'Base template on'|i18n( 'design/admin/visual/templatecreate' )}</h2>
    </div>
    <div class="object">
    <input type="radio" name="TemplateContent" value="EmptyFile" checked="checked"/>{'Empty file'|i18n( 'design/admin/visual/templatecreate' )}<br />
    <input type="radio" name="TemplateContent" value="DefaultCopy" />{'Copy of default template'|i18n( 'design/admin/visual/templatecreate' )}<br />
    </div>
{/case}
{case}
    <div class="objectheader">
    <h2>{'Base template on'|i18n( 'design/admin/visual/templatecreate' )}</h2>
    </div>
    <div class="object">
    <input type="radio" name="TemplateContent" value="EmptyFile" checked="checked"/>{'Empty file'|i18n( 'design/admin/visual/templatecreate' )}<br />
    <input type="radio" name="TemplateContent" value="DefaultCopy" />{'Copy of default template'|i18n( 'design/admin/visual/templatecreate' )}<br />
    </div>
{/case}
{/switch}

</div>

{* DESIGN: Content END *}</div></div></div>

<div class="controlbar">
{* DESIGN: Control bar START *}<div class="box-bc"><div class="box-ml"><div class="box-mr"><div class="box-tc"><div class="box-bl"><div class="box-br">
    <div class="block">
        <input class="button" type="submit" name="CreateOverrideButton" value="{'OK'|i18n( 'design/admin/visual/templatecreate' )}" />
        <input class="button" type="submit" name="CancelOverrideButton" value="{'Cancel'|i18n( 'design/admin/visual/templatecreate' )}" />
    </div>
{* DESIGN: Control bar END *}</div></div></div></div></div></div>
</div>

</div>

</form>
