{* DO NOT EDIT THIS FILE! Use an override template instead. *}
{section show=$setting_name}
    <h1>Edit setting</h1>
{section-else}
    <h1>New setting</h1>
{/section}

{include uri="design:settings/settings_validation.tpl"}

<div class="objectheader">
    <h2>Setting information</h2>
</div>

<form method="post" action={"settings/edit"|ezurl}>

<div class="object">
    <h2>{'Ini setting'|i18n( 'design/admin/settings')}</h2>
    <p><strong>{'Ini File'|i18n( 'design/admin/settings' )}:</strong> {$ini_file}</p>
    <p><strong>{'Block'|i18n( 'design/admin/settings')}:</strong> {$block}</p>
    {section show=$setting_name}
        <p><strong>{'Setting'|i18n( 'design/admin/settings' )}:</strong> {$setting_name}</p>
        {section-else}
        <p><strong>{'Setting: <new setting>'|i18n( 'design/admin/settings' )|wash}</strong></p>
    {/section}
    <p><strong>{'Siteaccess'|i18n( 'design/admin/settings' )}:</strong> {$current_siteaccess}</p>
    <p>{'Values for each location setting are shown. The first values are lowest priority; the values toward the end have higher priority than the first ones.'|i18n( 'design/admin/settings' )|wash}</p>
    <p><strong>{'Tip'|i18n( 'design/admin/settings' )}:</strong>{'To create an empty array leave the first line empty'|i18n( 'design/admin/settings' )} </p>
    <div class="block">
        <div class="element">
            <label>Change setting type</label><div class="labelbreak"></div>
            <select name="SettingType" onchange="submit()">
            {section name=Files loop=$setting_type_array}
                {section show=eq( $:key, $setting_type )}
                    <option value="{$:key}" selected="selected">{$:item}</option>
                {section-else}
                    <option value="{$:key}">{$:item}</option>
                {/section}
            {/section}
            </select>
        </div>
    </div>

    <div class="break"></div>

</div>

<input type="hidden" name="INIFile" value="{$ini_file}" />
<input type="hidden" name="Block" value="{$block}" />

<input type="hidden" name="SiteAccess" value="{$current_siteaccess}" />

<div class="block">
<table class="list" width="100%" cellspacing="0" cellpadding="0" border="0">
<tr>
    <th width="50%">
        {'Location (prioritized list shown)'|i18n( 'design/admin/settings' )|wash}
    </th>
    <th >
	{'Value'|i18n( 'design/admin/settings' )|wash}
    </th>
</tr>
<tr>
    <td>
        <strong>{'Default (cannot change)'|i18n( 'design/admin/settings' )|wash}</strong>
    </td>
    <td>
        {if and( is_set( $values['default'] ), ne( $values['default'], false() ))}
	    {$values['default']}
	{else}
	    {'No value'|i18n( 'design/admin/settings' )|wash}
	{/if}
    </td>
</tr>
<tr>
    <td><label><input type="radio" name="SettingPlacement" {section show=eq( $placement, "siteaccess" )}checked="checked"{/section} value="siteaccess">{'Siteaccess setting'|i18n('design/admin/settings')}</label></td>
    <td>
	{if and( is_set( $values['siteaccess'] ), ne( $values['siteaccess'], false() ) )}
	    {$values['siteaccess']}
	{else}
	    {'No value'|i18n( 'design/admin/settings' )|wash}
	{/if}
    </td>
</tr>
{foreach $values['extensions'] as $extension_name=>$extension_value}
<tr>
    <td><label><input type="radio" name="SettingPlacement" value="{$extension_name}">{$extension_name}</label></td>
    <td>
        {if ne( $extension_value, false() )}
	    {$extension_value}
	{else}
	    {'No value'|i18n( 'design/admin/settings' )|wash}
	{/if}
    </td>
</tr>
{/foreach}
<tr>
    <td><label><input type="radio" name="SettingPlacement" value="override" {section show=ne( $placement, "siteaccess" )}checked="checked"{/section}>{'Override setting (global)'|i18n( 'design/admin/settings' )}</label></td>
    <td>
        {if and( is_set( $values['override'] ), ne( $values['override'], false() ) )}
	    {$values['override']}
	{else}
	    {'No value'|i18n( 'design/admin/settings' )|wash}
	{/if}
    </td>
</tr>
</table>
</div>


{*
<div>
    <label>Block</label><div class="labelbreak"></div>
    <input type="text" name="Block" readonly value="{$block}" />
</div>
*}

<input type="hidden" name="Block" value="{$block}" />

{section show=$setting_name}
    <input type="hidden" name="SettingName" value="{$setting_name}" />
{section-else}
    <div class="block">
        <label>Setting Name</label><div class="labelbreak"></div>
        <input type="text" size="20" name="SettingName" value="" />
    </div>
{/section}

<div class="block">
    <label>Setting value</label><div class="labelbreak"></div>

    {switch match=$setting_type}
    {case match='array'}
        <textarea size="70" rows="10" class="box" name="Value">{$value|wash}</textarea>
    {/case}
    {case match='enable/disable'}
        <select name="Value">
        {section show= eq( $value, 'enabled' )}
            <option value="enabled" selected="selected">Enabled</option>
            <option value="disabled">Disabled</option>
            {section-else}
            <option value="disabled" selected="selected">Disabled</option>
            <option value="enabled">Enabled</option>
        {/section}
        </select>
    {/case}
    {case match='true/false'}
        <select name="Value">
        {section show=eq( $value, 'true' )}
            <option value="true" selected="selected">True</option>
            <option value="false">False</option>
            {section-else}
            <option value="false" selected="selected">False</option>
            <option value="true">True</option>
        {/section}
        </select>
    {/case}
    {case}
        <input type="text" size="40" name="Value" value="{$value|wash}" />
    {/case}
    {/switch}
</div>

<div class="buttonblock">
    <input type="submit" name="WriteSetting" value="Save" />
    <input type="submit" name="Cancel" value="Cancel" />
</div>

</form>
