<div class='page-header'>
	<h1><tmpl_var name="list_head_txt"></h1>
</div>
<p><tmpl_var name="list_desc_txt"></p>


        
            <tmpl_if name="is_admin">
                <div class="form-group">
                    <tmpl_if name="edit_disabled">
                        <label for="server_id_disabled" class="col-sm-3 control-label">{tmpl_var name='server_id_txt'}</label>
                        <div class="col-sm-9"><select name="server_id_disabled" id="server_id_disabled" class="form-control" disabled="disabled">
                            {tmpl_var name='server_id'}
                        </select>
                        </div><input type="hidden" name="server_id" value="{tmpl_var name='server_id_value'}" />
                        <tmpl_else>
                            <label for="server_id" class="col-sm-3 control-label">{tmpl_var name='server_id_txt'}</label>
                            <div class="col-sm-9"><select name="server_id" id="server_id" class="form-control">
                                {tmpl_var name='server_id'}
                            </select>
                    </div></tmpl_if>
                </div>
            <tmpl_else>
                <tmpl_if name="only_one_server">
                    <input type="hidden" id="server_id" name="server_id" value="{tmpl_var name='server_id_value'}" />
                <tmpl_else>
                    <div class="form-group">
                        <tmpl_if name="edit_disabled">
                            <label for="server_id_disabled" class="col-sm-3 control-label">{tmpl_var name='server_id_txt'}</label>
                            <div class="col-sm-9"><select name="server_id_disabled" id="server_id_disabled" class="form-control" disabled="disabled">
                                {tmpl_var name='server_id'}
                            </select>
                            </div><input type="hidden" name="server_id" value="{tmpl_var name='server_id_value'}" />
                            <tmpl_else>
                                <label for="server_id" class="col-sm-3 control-label">{tmpl_var name='server_id_txt'}</label>
                                <div class="col-sm-9"><select name="server_id" id="server_id" class="form-control">
                                    {tmpl_var name='server_id'}
                                </select>
                        </div></tmpl_if>
                    </div>
                </tmpl_if>
            </tmpl_if>
            <div class="form-group">
                <label for="parent_domain_id" class="col-sm-3 control-label">{tmpl_var name='parent_domain_id_txt'}</label>
                <div class="col-sm-9"><select name="parent_domain_id" id="parent_domain_id" class="form-control">
                    {tmpl_var name='parent_domain_id'}
                </select>
            </div></div>
            <div class="form-group">
                <label for="type" class="col-sm-3 control-label">{tmpl_var name='type_txt'}</label>
                <div class="col-sm-9"><select name="type" id="type" class="form-control">
                    {tmpl_var name='type'}
                </select>
            </div></div>
            <div class="form-group">
                <label for="database_name" class="col-sm-3 control-label">{tmpl_var name='database_name_txt'}</label>
                <p class="prefix">{tmpl_var name='database_name_prefix'}</p>
                <tmpl_if name="edit_disabled">
                    <div class="col-sm-9"><input type="text" name="database_name" id="database_name" value="{tmpl_var name='database_name'}" class="form-control" disabled="disabled" />
                    </div><input name="database_name" type="hidden" value="{tmpl_var name='database_name'}" />
                    <tmpl_else>
                        <div class="col-sm-9"><input type="text" name="database_name" id="database_name" value="{tmpl_var name='database_name'}" class="form-control" />
                </div></tmpl_if>
            </div>
			<div class="form-group">
				<label for="database_quota" class="col-sm-3 control-label">{tmpl_var name='limit_database_quota_txt'}</label>
				<div class="col-sm-9"><input type="text" name="database_quota" id="database_quota" value="{tmpl_var name='limit_database_quota'}" class="form-control" />&nbsp;MB
			</div></div>
            <div class="form-group">
                <label for="database_user_id" class="col-sm-3 control-label">{tmpl_var name='database_user_txt'}</label>
                <div class="col-sm-9"><select name="database_user_id" id="database_user_id" class="form-control">
                    {tmpl_var name='database_user_id'}
                </select>
            </div></div>
            <div class="form-group">
                <label for="database_ro_user_id" class="col-sm-3 control-label">{tmpl_var name='database_ro_user_txt'}</label>
                <div class="col-sm-9"><select name="database_ro_user_id" id="database_ro_user_id" class="form-control">
                    {tmpl_var name='database_ro_user_id'}
                </select>&nbsp;{tmpl_var name='optional_txt'}
            </div></div>
            <div class="form-group">
                <tmpl_if name="edit_disabled">
                    <label for="database_charset_disabled" class="col-sm-3 control-label">{tmpl_var name='database_charset_txt'}</label>
                    <div class="col-sm-9"><select name="database_charset_disabled" id="database_charset_disabled" class="form-control" disabled="disabled">
                        {tmpl_var name='database_charset'}
                    </select>
                    </div><input type="hidden" name="database_charset" value="{tmpl_var name='database_charset_value'}" />
                    <tmpl_else>
                        <label for="database_charset" class="col-sm-3 control-label">{tmpl_var name='database_charset_txt'}</label>
                        <div class="col-sm-9"><select name="database_charset" id="database_charset" class="form-control">
                            {tmpl_var name='database_charset'}
                        </select>
                </div></tmpl_if>
            </div>
            <div class="form-group">
                <label class="col-sm-3 control-label">{tmpl_var name='remote_access_txt'}</label>
                <div class="col-sm-9">
                    {tmpl_var name='remote_access'}
                </div>
            </div>
            <div class="form-group">
                <label for="remote_ips" class="col-sm-3 control-label">{tmpl_var name='remote_ips_txt'}</label>
                <div class="col-sm-9"><input type="text" name="remote_ips" id="remote_ips" value="{tmpl_var name='remote_ips'}" class="form-control" />
            </div></div>
            <div class="form-group">
                <label class="col-sm-3 control-label">{tmpl_var name='active_txt'}</label>
                <div class="col-sm-9">
                    {tmpl_var name='active'}
                </div>
            </div>
        

        <input type="hidden" name="id" value="{tmpl_var name='id'}">

        <div class="clear"><div class="right">
            <button class="btn btn-default formbutton-success" type="button" value="{tmpl_var name='btn_save_txt'}" onclick="submitForm('pageForm','sites/database_edit.php');">{tmpl_var name='btn_save_txt'}</button>
            <button class="btn btn-default formbutton-default" type="button" value="{tmpl_var name='btn_cancel_txt'}" data-load-content="sites/database_list.php">{tmpl_var name='btn_cancel_txt'}</button>
        </div></div>
<script language="JavaScript" type="text/javascript">
    <tmpl_if name="is_admin">    
    function reloadDatabaseUsers() {
        var parentDomainId = jQuery('#parent_domain_id').val()
        jQuery.getJSON('sites/ajax_get_json.php'+ '?' + Math.round(new Date().getTime()), {web_id : parentDomainId, 'type': 'getdatabaseusers'}, function(data) {
            var options = '<option value=""></option>';
            $.each(data, function(key, val) {
                options += '<option value="'+key+'"'+ ($('#database_user_id').val() == key ? ' selected="selected"' : '') +'>'+val+'</option>';
            });
            $('#database_user_id').html(options).change();
            
            options = '<option value=""></option>';
            $.each(data, function(key, val) {
                options += '<option value="'+key+'"'+ ($('#database_ro_user_id').val() == key ? ' selected="selected"' : '') +'>'+val+'</option>';
            });
            $('#database_ro_user_id').html(options).change();
        });
    }
    jQuery('#parent_domain_id').change(function() { reloadDatabaseUsers(); });
    reloadDatabaseUsers();
    </tmpl_if>
    jQuery('#remote_ips').ispconfigSearch({
        dataSrc: '/sites/ajax_get_json.php?type=get_ipv4',
        resultsLimit: '$ <tmpl_var name="globalsearch_resultslimit_of_txt"> % <tmpl_var name="globalsearch_resultslimit_results_txt">',
        ResultsTextPrefix: '<tmpl_var name="globalsearch_suggestions_text_txt">',
        noResultsText: '<tmpl_var name="globalsearch_noresults_text_txt">',
        noResultsLimit: '<tmpl_var name="globalsearch_noresults_limit_txt">',
        minChars: 0,
        cssPrefix: 'df-',
        fillSearchField: true,
        fillSearchFieldWith: 'fill_text',
        searchFieldWatermark: '',
        resultBoxPosition: 'e'
    });
</script>
