
{if $oxInstalled}
<form id='settingsform' name='settingsform' ENCTYPE='multipart/form-data' method='post' action='{$formUrl|escape}' onSubmit='return max_formValidate(this);'>
    {if $adminUser && $optionType == 'account-settings' && !$formIsDisabled}
    <br />
    <div class='errormessage'><img class='errormessage' src='{$assetPath|escape}/images/padlock-{$image}.gif' width='16' height='16' border='0' align='absmiddle'>
        {if $configLocked}{t str=EditConfigNotPossible}{else}{t str=EditConfigPossible}{/if}
    </div>
    {/if}
{/if}

{foreach from=$aOption key=key item=aValue}
	{foreach from=$aValue key=filename item=aItem}
        {include file=options/$filename aItem=$aItem}
    {/foreach}
{/foreach}

{if $oxInstalled}
    {if $disableSubmit}
        <br /><br /><input type="submit" name="submitsettings" value="{t str=SaveChanges}" tabindex="{$tabindex++}" disabled></form>
    {else}
        <br /><br /><input type="submit" name="submitsettings" value="{t str=SaveChanges}" tabindex="{$tabindex++}"></form>
    {/if}
{/if}

{literal}
<script language='JavaScript' type="text/javascript">
<!--
    function setUploadConversionValues() {
        document.settingsform.start_upload.value = 1;
        document.settingsform.submit();
    }

    function toggleSocketInput() {
        var dbTypeObj      = new getObj('aConfig[database][type]');
        if (dbTypeObj.obj) {
            var localSocketObj = new getObj('aConfig[database][localsocket]');
            var socketObj      = new getObj('aConfig[database][socket]');
            var portObj        = new getObj('aConfig[database][port]');
            var hostObj        = new getObj('aConfig[database][host]');
        } else {
            var dbTypeObj      = new getObj('database_type');
            var localSocketObj = new getObj('database_localsocket');
            var socketObj      = new getObj('database_socket');
            var portObj        = new getObj('database_port');
            var hostObj        = new getObj('database_host');
        }

        if (localSocketObj.obj.disabled) return;

        var portEnabled = dbTypeObj.obj.options[dbTypeObj.obj.selectedIndex].value == 'pgsql';

        if (localSocketObj.obj.checked == true) {
            setInputDisabled(hostObj.obj, true);
            setInputDisabled(portObj.obj, !portEnabled);
            setInputDisabled(socketObj.obj, false);
        } else {
            setInputDisabled(hostObj.obj, false);
            setInputDisabled(portObj.obj, false);
            setInputDisabled(socketObj.obj, true);
        }
    }

    function setInputDisabled(input, disabled)
    {
      input.disabled = disabled;

      if (disabled) {
        $(input).parent().prev().find(".required").hide();
      } else {
        $(input).parent().prev().find(".required").show();
      }
    }
//-->
</script>
<script language='JavaScript' type="text/javascript">
<!--
{/literal}
{$dependbuffer}
{literal}
}

phpAds_refreshEnabled();
{/literal}

{if $section == 'database'}
toggleSocketInput();
{/if}

{$checkbuffer}
{$usertypebuffer}
{literal}
//--></script>
{/literal}
