<commit_before><html>
<meta charset="UTF-8">
<title></title>
<!-- these 4 files always have to be included -->
<link rel="stylesheet" type="text/css" href="../../lib/css/themes/jquery-ui/redmond/jquery-ui.min.css"/>
<script type="text/javascript" src="../../lib/js/jquery-1.11.1.min.js"></script>
<script type="text/javascript" src="../../socket.io/socket.io.js"></script>
<script type="text/javascript" src="../../lib/js/jquery-ui-1.10.3.full.min.js"></script>

<!-- these three files  have to be always included -->
<link rel="stylesheet" type="text/css" href="../../css/adapter.css"/>
<script type="text/javascript" src="../../js/translate.js"></script>
<script type="text/javascript" src="../../js/adapter-settings.js"></script>

<!-- you have to define 2 functions in the global scope: -->
<script type="text/javascript">
    systemDictionary = {
        "History adapter settings": {
            "de": "History-Adapter Einstellungen",
            "ru": "Настройки профайлера"},
        "note": {
            "en": "History settings must be done for every state individually on the tab \"States\" and only if adapter is active",
            "de": "History Einstellungen mussen für jeden State einzeln gemacht werden auf der Lasche \"States\" und nur wenn adapter aktiv ist",
            "ru": "Настройки профайлера делаются для каждого состояния отдельно в закладке \"Состояния\" и только, когда драйвер активирован"
        },
        "Default settings:": {
            "de": "Default Einstellungen für Zuständen:",
            "ru": "Настройки по умолчанию для состояний"
        },
        "Start or enable adapter first": {
            "de": "Adapter muss zuerst aktiviert werden",
            "ru": "Сначала надо активировать драйвер SQL"
        },
        "debounce":             {"en": "De-bounce interval(ms)", "de": "Entprellzeit(ms)",              "ru": "Минимальный интервал(ms)"},
        "retention":            {"en": "Storage retention",     "de": "Storage Vorhaltezeit",           "ru": "Время хранения в базе"},
        "keep forever":         {"en": "keep forever",          "de": "keine automatische Löschung",    "ru": "хранить вечно"},
        "2 years":              {"en": "2 years",               "de": "2 Jahre",                        "ru": "2 года"},
        "1 year":               {"en": "1 year",                "de": "1 Jahr",                         "ru": "1 год"},
        "6 months":             {"en": "6 months",              "de": "6 Monate",                       "ru": "6 месяцев"},
        "3 months":             {"en": "3 months",              "de": "3 Monate",                       "ru": "3 месяца"},
        "1 months":             {"en": "1 months",              "de": "1 Monat",                        "ru": "1 месяц"},
        "2 weeks":              {"en": "2 weeks",               "de": "2 Wochen",                       "ru": "2 недели"},
        "1 week":               {"en": "1 week",                "de": "1 Woche",                        "ru": "1 неделя"},
        "5 days":               {"en": "5 days",                "de": "5 Tage",                         "ru": "5 дней"},
        "3 days":               {"en": "3 days",                "de": "3 Tage",                         "ru": "3 дня"},
        "1 day":                {"en": "1 day",                 "de": "1 Tag",                          "ru": "1 день"},
        "SQL history adapter settings": {
            "en": "SQL history adapter settings",
            "de": "SQL history adapter Einstellungen",
            "ru": "Настройки профайлера в SQL базу данных"
        },
        "DB settings:":         {"en": "DB settings:",          "de": "DB Einstellungen:",              "ru": "DB settings:"},
        "DB Type":              {"en": "DB Type",               "de": "DB Typ",                         "ru": "DB Type"},
        "Host":                 {"en": "Host",                  "de": "Host",                           "ru": "Хост"},
        "DB Name":              {"en": "Database name",         "de": "Datenbankname",                  "ru": "Имя базы данных"},
        "Port":                 {"en": "Port",                  "de": "Port",                           "ru": "Порт"},
        "User":                 {"en": "User",                  "de": "Login",                          "ru": "Пользователь"},
        "Password":             {"en": "Password",              "de": "<PASSWORD>",                       "ru": "Пароль"},
        "Password confirm":     {"en": "Password confirm",      "de": "Kennwort-Wiederholung",          "ru": "Подтверждение пароля"},
        "File for sqlite:":     {"en": "File for sqlite:",      "de": "Datei für sqlite:",              "ru": "Файл для sqlite:"},
        "Encrypt:":             {"en": "Encrypt:",              "de": "Verschlüsseln:",                 "ru": "Шифрование:"},
        "Test connection":      {"en": "Test connection",       "de": "Verbindung testen",              "ru": "Проверить соединение"},
        "Round real to:":       {"en": "Round real to:",        "de": "Aufrunden auf: ",                "ru": "Округлять до"},
        "Are you sure? All data will be dropped.": {
            "en": "Are you sure? All data will be dropped.",
            "de": "Sind Sie sicher? ALLE Daten werden geöscht.",
            "ru": "Вы уверенны? Все данные в базе будут удалены."
        },
        "Reset DB":             {"en": "Reset DB",              "de": "Alle Daten in DB löschen",       "ru": "Сбросить DB"},
        "Ok":                   {"en": "Ok",                    "de": "Ok",                             "ru": "Ok"}
    };

    function setValue(id, value, onChange) {
        // example: select elements with id=key and class=value and insert value
        if ($('#' + id + '.value').attr('type') == 'checkbox') {
            $('#' + id + '.value').prop('checked', value).change(function() {
                onChange();
            });
        } else {
            $('#' + id + '.value').val(value).change(function() {
                onChange();
            }).keyup(function() {
                // Check that only numbers entered
                if ($(this).hasClass('number')) {
                    var val = $(this).val();
                    if (val) {
                        var newVal = '';
                        for (var i = 0; i < val.length; i++) {
                            if (val[i] >= '0' && val[i] <= '9') {
                                newVal += val[i];
                            }
                        }

                        if (val != newVal) $(this).val(newVal);
                    }
                }
                $(this).trigger('change');
           });
        }
    }

    function load(settings, onChange) {
        for (var key in settings) {
            setValue(key, settings[key], onChange);
        }
        $('#passwordConfirm').val(settings.password);

        $('#test').button().click(function () {
            getIsAdapterAlive(function (isAlive) {
                if (!isAlive) {
                    showMessage(_('Start or enable adapter first'));
                } else {
                    $('#test').button('option', 'disabled', true);
                    sendTo(null, 'test', {
                        config: {
                            dbtype:   $('#dbtype').val(),
                            port:     $('#port').val(),
                            host:     $('#host').val(),
                            user:     $('#user').val(),
                            fileName: $('#fileName').val(),
                            password: $('#password').val()
                        }
                    }, function (response) {
                        $('#test').button('option', 'disabled', false);
                        showMessage(response.error || 'OK');
                    });
                }
            });
        });

        $('#reset').button().click(function () {
            getIsAdapterAlive(function (isAlive) {
                if (!isAlive) {
                    showMessage(_('Start or enable adapter first'));
                } else {
                    if (confirm(_('Are you sure? All data will be dropped.'))) {
                        $('#reset').button('option', 'disabled', true);
                        sendTo(null, 'destroy', null, function (response) {
                            $('#reset').button('option', 'disabled', false);
                            showMessage(response.error || _('Adapter will be restarted'));
                        });
                    }
                }
            });
        });
        $('#dbtype').change(function () {
            if ($(this).val() === 'sqlite') {
                $('.baby-sql').show();
                $('.real-sql').hide();
            } else if ($(this).val() === 'mssql') {
                $('.baby-sql').hide();
                $('.real-sql').show();
            } else {
                $('.baby-sql').hide();
                $('.ms-sql').hide();
                $('.real-sql').show();
            }
        }).trigger('change');

        $('#demoStart, #demoEnd').datepicker().val(new Date().toDateString());
        $('#generateDemo').button().click(function () {
            $(".loader").show();
            sendTo('', 'generateDemo', {
                id:     $('#demoID').val(),
                start:  $('#demoStart').val(),
                end:    $('#demoEnd').val(),
                step:   $('#demoStep').val(),
                curve:  $('#demoCurve').val()
            }, function (e) {
                $('.loader').hide();
            })
        });
        onChange(false);
    }

    // ... and the function save has to exist.
    // you have to make sure the callback is called with the settings object as first param!
    function save(callback) {
        // example: select elements with class=value and build settings object
        var settings = {};
        $('.value').each(function () {
            var $this = $(this);
            var id = $this.attr('id');

            if ($this.attr('type') == 'checkbox') {
                settings[id] = $this.prop('checked');
            } else {
                settings[id] = $this.val();
           }
        });

        if ($('#passwordConfirm').val() != $('#password').val()) {
            showMessage(_('Password confirmation is not equal with password!'));
            return;
        }

        callback(settings);
    }
</script>

<style>
    .loader {
        display: none;
        position: absolute;
        left: calc(50% - 0.5em);
        top: calc(50% - 0.5em - 72px);
        font-size: 90px;
        text-indent: -9999em;
        overflow: hidden;
        width: 1em;
        height: 1em;
        border-radius: 50%;
        margin: 72px auto;
        -webkit-transform: translateZ(0);
        -ms-transform: translateZ(0);
        transform: translateZ(0);
        -webkit-animation: load6 1.7s infinite ease;
        animation: load6 1.7s infinite ease;
    }

    @-webkit-keyframes load6 {
        0% {
            -webkit-transform: rotate(0deg);
            transform: rotate(0deg);
            box-shadow: 0 -0.83em 0 -0.4em #00ffff, 0 -0.83em 0 -0.42em #00ffff, 0 -0.83em 0 -0.44em #00ffff, 0 -0.83em 0 -0.46em #00ffff, 0 -0.83em 0 -0.477em #00ffff;
        }
        5%,
        95% {
            box-shadow: 0 -0.83em 0 -0.4em #00ffff, 0 -0.83em 0 -0.42em #00ffff, 0 -0.83em 0 -0.44em #00ffff, 0 -0.83em 0 -0.46em #00ffff, 0 -0.83em 0 -0.477em #00ffff;
        }
        10%,
        59% {
            box-shadow: 0 -0.83em 0 -0.4em #00ffff, -0.087em -0.825em 0 -0.42em #00ffff, -0.173em -0.812em 0 -0.44em #00ffff, -0.256em -0.789em 0 -0.46em #00ffff, -0.297em -0.775em 0 -0.477em #00ffff;
        }
        20% {
            box-shadow: 0 -0.83em 0 -0.4em #00ffff, -0.338em -0.758em 0 -0.42em #00ffff, -0.555em -0.617em 0 -0.44em #00ffff, -0.671em -0.488em 0 -0.46em #00ffff, -0.749em -0.34em 0 -0.477em #00ffff;
        }
        38% {
            box-shadow: 0 -0.83em 0 -0.4em #00ffff, -0.377em -0.74em 0 -0.42em #00ffff, -0.645em -0.522em 0 -0.44em #00ffff, -0.775em -0.297em 0 -0.46em #00ffff, -0.82em -0.09em 0 -0.477em #00ffff;
        }
        100% {
            -webkit-transform: rotate(360deg);
            transform: rotate(360deg);
            box-shadow: 0 -0.83em 0 -0.4em #00ffff, 0 -0.83em 0 -0.42em #00ffff, 0 -0.83em 0 -0.44em #00ffff, 0 -0.83em 0 -0.46em #00ffff, 0 -0.83em 0 -0.477em #00ffff;
        }
    }

    @keyframes load6 {
        0% {
            -webkit-transform: rotate(0deg);
            transform: rotate(0deg);
            box-shadow: 0 -0.83em 0 -0.4em #00ffff, 0 -0.83em 0 -0.42em #00ffff, 0 -0.83em 0 -0.44em #00ffff, 0 -0.83em 0 -0.46em #00ffff, 0 -0.83em 0 -0.477em #00ffff;
        }
        5%,
        95% {
            box-shadow: 0 -0.83em 0 -0.4em #00ffff, 0 -0.83em 0 -0.42em #00ffff, 0 -0.83em 0 -0.44em #00ffff, 0 -0.83em 0 -0.46em #00ffff, 0 -0.83em 0 -0.477em #00ffff;
        }
        10%,
        59% {
            box-shadow: 0 -0.83em 0 -0.4em #00ffff, -0.087em -0.825em 0 -0.42em #00ffff, -0.173em -0.812em 0 -0.44em #00ffff, -0.256em -0.789em 0 -0.46em #00ffff, -0.297em -0.775em 0 -0.477em #00ffff;
        }
        20% {
            box-shadow: 0 -0.83em 0 -0.4em #00ffff, -0.338em -0.758em 0 -0.42em #00ffff, -0.555em -0.617em 0 -0.44em #00ffff, -0.671em -0.488em 0 -0.46em #00ffff, -0.749em -0.34em 0 -0.477em #00ffff;
        }
        38% {
            box-shadow: 0 -0.83em 0 -0.4em #00ffff, -0.377em -0.74em 0 -0.42em #00ffff, -0.645em -0.522em 0 -0.44em #00ffff, -0.775em -0.297em 0 -0.46em #00ffff, -0.82em -0.09em 0 -0.477em #00ffff;
        }
        100% {
            -webkit-transform: rotate(360deg);
            transform: rotate(360deg);
            box-shadow: 0 -0.83em 0 -0.4em #00ffff, 0 -0.83em 0 -0.42em #00ffff, 0 -0.83em 0 -0.44em #00ffff, 0 -0.83em 0 -0.46em #00ffff, 0 -0.83em 0 -0.477em #00ffff;
        }
    }
</style>

<div id="adapter-container">
    <div id="loader" class="loader"></div>
    <table><tr>
        <td><img src="sql.png"></td>
        <td style="padding-top: 20px;padding-left: 10px"><h3 class="translate">SQL history adapter settings</h3></td>
    </tr></table>
    <table>
        <tr><td colspan="3"><h4 class="translate">DB settings:</h4></td></tr>
        <tr>
            <td class="translate">DB Type</td>
            <td><select id="dbtype" class="value">
                <option value="mysql">MySQL</option>
                <option value="postgresql">PostgreSQL</option>
                <option value="sqlite">SQLite3</option>
                <option value="mssql">MS-SQL</option>
            </select></td>
            <td class="translate"></td>
        </tr>
        <tr class="real-sql">
            <td class="translate">Host</td>
            <td><input id="host" type="text" class="value"/></td>
            <td></td>
        </tr>
        <tr class="real-sql">
            <td class="translate">Port</td>
            <td><input id="port" type="text" class="value"/></td>
            <td></td>
        </tr>
        <tr class="ms-sql real-sql">
            <td class="translate">DB Name</td>
            <td><input id="dbname" type="text" class="value"/></td>
            <td></td>
        </tr>
        <tr class="real-sql">
            <td class="translate">User</td>
            <td><input id="user" type="text" class="value"/></td>
            <td></td>
        </tr>
        <tr class="real-sql">
            <td class="translate">Password</td>
            <td><input id="password" type="password" class="value"/></td>
            <td></td>
        </tr>
        <tr class="real-sql">
            <td class="translate">Password confirm</td>
            <td><input id="passwordConfirm" type="password"/></td>
            <td></td>
        </tr>
        <tr class="baby-sql">
            <td class="translate">File for sqlite:</td>
            <td><input id="fileName" type="text" class="value"/></td>
            <td></td>
        </tr>
        <tr class="ms-sql real-sql">
            <td class="translate">Encrypt:</td>
            <td><input id="encrypt" type="checkbox" class="value"/></td>
            <td></td>
        </tr>
        <tr class="ms-sql real-sql">
            <td class="translate">Round real to:</td>
            <td><input id="round" type="text" class="value"/></td>
            <td></td>
        </tr>
        <tr class="ms-sql real-sql">
            <td class="translate">Allow parallel requests:</td>
            <td><input id="multiRequests" type="checkbox" class="value"/></td>
            <td></td>
        </tr>
        <tr><td colspan="3"><h4 class="translate">Default settings:</h4></td></tr>
        <tr>
            <td class="translate">debounce</td>
            <td><input id="debounce" type="text" size="5" class="value number"/></td>
            <td></td>
        </tr>
        <tr>
            <td class="translate">retention</td>
            <td><select id="retention" class="value">
                <option value="0"           class="translate">keep forever</option>
                <option value="63072000"    class="translate">2 years</option>
                <option value="31536000"    class="translate">1 year</option>
                <option value="15811200"    class="translate">6 months</option>
                <option value="7948800"     class="translate">3 months</option>
                <option value="2678400"     class="translate">1 months</option>
                <option value="1209600"     class="translate">2 weeks</option>
                <option value="604800"      class="translate">1 week</option>
                <option value="432000"      class="translate">5 days</option>
                <option value="259200"      class="translate">3 days</option>
                <option value="86400"       class="translate">1 day</option>
            </select></td>
            <td></td>
        </tr>

    </table>
    <br><button id="test" class="translate">Test connection</button>
    <button id="reset" class="translate">Reset DB</button>
    <!--h4  class="translate">Demo Data:</h4>
    <table>
        <tr>
            <td class="translate">ID</td>
            <td class="translate">Start</td>
            <td class="translate">End</td>
            <td class="translate">Steps</td>
            <td class="translate">Curve</td>
            <td></td>
        </tr>
        <tr>
            <td class="translate"><input id="demoID" type="text" /></td>
            <td class="translate"><input id="demoStart" /></td>
            <td class="translate"><input id="demoEnd"  /></td>
            <td class="translate"><input id="demoStep" type="number" min="1" step="1" value="60"/></td>
            <td class="translate"><select id="demoCurve">
                <option value="sin"  class="translate">Sinus</option>
                <option value="dec"  class="translate">DEC</option>
                <option value="inc"  class="translate">INC</option>
                <option value="dec/int"  class="translate">DEC/INC</option>
            </select></td>
            <td class="translate"><button id="generateDemo">Generate</button></td>
        </tr>
    </table-->

</div>
</html><commit_msg>(bluefox) translate<commit_after><html>
<meta charset="UTF-8">
<title></title>
<!-- these 4 files always have to be included -->
<link rel="stylesheet" type="text/css" href="../../lib/css/themes/jquery-ui/redmond/jquery-ui.min.css"/>
<script type="text/javascript" src="../../lib/js/jquery-1.11.1.min.js"></script>
<script type="text/javascript" src="../../socket.io/socket.io.js"></script>
<script type="text/javascript" src="../../lib/js/jquery-ui-1.10.3.full.min.js"></script>

<!-- these three files  have to be always included -->
<link rel="stylesheet" type="text/css" href="../../css/adapter.css"/>
<script type="text/javascript" src="../../js/translate.js"></script>
<script type="text/javascript" src="../../js/adapter-settings.js"></script>

<!-- you have to define 2 functions in the global scope: -->
<script type="text/javascript">
    systemDictionary = {
        "History adapter settings": {
            "de": "History-Adapter Einstellungen",
            "ru": "Настройки профайлера"},
        "note": {
            "en": "History settings must be done for every state individually on the tab \"States\" and only if adapter is active",
            "de": "History Einstellungen mussen für jeden State einzeln gemacht werden auf der Lasche \"States\" und nur wenn adapter aktiv ist",
            "ru": "Настройки профайлера делаются для каждого состояния отдельно в закладке \"Состояния\" и только, когда драйвер активирован"
        },
        "Default settings:": {
            "de": "Default Einstellungen für Zuständen:",
            "ru": "Настройки по умолчанию для состояний"
        },
        "Start or enable adapter first": {
            "de": "Adapter muss zuerst aktiviert werden",
            "ru": "Сначала надо активировать драйвер SQL"
        },
        "debounce":             {"en": "De-bounce interval(ms)", "de": "Entprellzeit(ms)",              "ru": "Минимальный интервал(ms)"},
        "retention":            {"en": "Storage retention",     "de": "Storage Vorhaltezeit",           "ru": "Время хранения в базе"},
        "keep forever":         {"en": "keep forever",          "de": "keine automatische Löschung",    "ru": "хранить вечно"},
        "2 years":              {"en": "2 years",               "de": "2 Jahre",                        "ru": "2 года"},
        "1 year":               {"en": "1 year",                "de": "1 Jahr",                         "ru": "1 год"},
        "6 months":             {"en": "6 months",              "de": "6 Monate",                       "ru": "6 месяцев"},
        "3 months":             {"en": "3 months",              "de": "3 Monate",                       "ru": "3 месяца"},
        "1 months":             {"en": "1 months",              "de": "1 Monat",                        "ru": "1 месяц"},
        "2 weeks":              {"en": "2 weeks",               "de": "2 Wochen",                       "ru": "2 недели"},
        "1 week":               {"en": "1 week",                "de": "1 Woche",                        "ru": "1 неделя"},
        "5 days":               {"en": "5 days",                "de": "5 Tage",                         "ru": "5 дней"},
        "3 days":               {"en": "3 days",                "de": "3 Tage",                         "ru": "3 дня"},
        "1 day":                {"en": "1 day",                 "de": "1 Tag",                          "ru": "1 день"},
        "SQL history adapter settings": {
            "en": "SQL history adapter settings",
            "de": "SQL history adapter Einstellungen",
            "ru": "Настройки профайлера в SQL базу данных"
        },
        "DB settings:":         {"en": "DB settings:",          "de": "DB Einstellungen:",              "ru": "DB settings:"},
        "DB Type":              {"en": "DB Type",               "de": "DB Typ",                         "ru": "DB Type"},
        "Host":                 {"en": "Host",                  "de": "Host",                           "ru": "Хост"},
        "DB Name":              {"en": "Database name",         "de": "Datenbankname",                  "ru": "Имя базы данных"},
        "Port":                 {"en": "Port",                  "de": "Port",                           "ru": "Порт"},
        "User":                 {"en": "User",                  "de": "Login",                          "ru": "Пользователь"},
        "Password":             {"en": "Password",              "de": "<PASSWORD>",                       "ru": "Пароль"},
        "Password confirm":     {"en": "Password confirm",      "de": "Kennwort-Wiederholung",          "ru": "Подтверждение пароля"},
        "File for sqlite:":     {"en": "File for sqlite:",      "de": "Datei für sqlite:",              "ru": "Файл для sqlite:"},
        "Encrypt:":             {"en": "Encrypt:",              "de": "Verschlüsseln:",                 "ru": "Шифрование:"},
        "Test connection":      {"en": "Test connection",       "de": "Verbindung testen",              "ru": "Проверить соединение"},
        "Round real to:":       {"en": "Round real to:",        "de": "Aufrunden auf: ",                "ru": "Округлять до"},
        "Are you sure? All data will be dropped.": {
            "en": "Are you sure? All data will be dropped.",
            "de": "Sind Sie sicher? ALLE Daten werden geöscht.",
            "ru": "Вы уверенны? Все данные в базе будут удалены."
        },
        "Reset DB":             {"en": "Reset DB",              "de": "Alle Daten in DB löschen",       "ru": "Сбросить DB"},
        "Ok":                   {"en": "Ok",                    "de": "Ok",                             "ru": "Ok"},
        "Allow parallel requests:": {"en": "Allow parallel requests:", "de": "Parallelanfragen erlauben:", "ru": "Разрешить параллельные запросы к базе:"}
    };

    function setValue(id, value, onChange) {
        // example: select elements with id=key and class=value and insert value
        if ($('#' + id + '.value').attr('type') == 'checkbox') {
            $('#' + id + '.value').prop('checked', value).change(function() {
                onChange();
            });
        } else {
            $('#' + id + '.value').val(value).change(function() {
                onChange();
            }).keyup(function() {
                // Check that only numbers entered
                if ($(this).hasClass('number')) {
                    var val = $(this).val();
                    if (val) {
                        var newVal = '';
                        for (var i = 0; i < val.length; i++) {
                            if (val[i] >= '0' && val[i] <= '9') {
                                newVal += val[i];
                            }
                        }

                        if (val != newVal) $(this).val(newVal);
                    }
                }
                $(this).trigger('change');
           });
        }
    }

    function load(settings, onChange) {
        for (var key in settings) {
            setValue(key, settings[key], onChange);
        }
        $('#passwordConfirm').val(settings.password);

        $('#test').button().click(function () {
            getIsAdapterAlive(function (isAlive) {
                if (!isAlive) {
                    showMessage(_('Start or enable adapter first'));
                } else {
                    $('#test').button('option', 'disabled', true);
                    sendTo(null, 'test', {
                        config: {
                            dbtype:   $('#dbtype').val(),
                            port:     $('#port').val(),
                            host:     $('#host').val(),
                            user:     $('#user').val(),
                            fileName: $('#fileName').val(),
                            password: <PASSWORD>').<PASSWORD>()
                        }
                    }, function (response) {
                        $('#test').button('option', 'disabled', false);
                        showMessage(response.error || 'OK');
                    });
                }
            });
        });

        $('#reset').button().click(function () {
            getIsAdapterAlive(function (isAlive) {
                if (!isAlive) {
                    showMessage(_('Start or enable adapter first'));
                } else {
                    if (confirm(_('Are you sure? All data will be dropped.'))) {
                        $('#reset').button('option', 'disabled', true);
                        sendTo(null, 'destroy', null, function (response) {
                            $('#reset').button('option', 'disabled', false);
                            showMessage(response.error || _('Adapter will be restarted'));
                        });
                    }
                }
            });
        });
        $('#dbtype').change(function () {
            if ($(this).val() === 'sqlite') {
                $('.baby-sql').show();
                $('.real-sql').hide();
            } else if ($(this).val() === 'mssql') {
                $('.baby-sql').hide();
                $('.real-sql').show();
            } else {
                $('.baby-sql').hide();
                $('.ms-sql').hide();
                $('.real-sql').show();
            }
        }).trigger('change');

        $('#demoStart, #demoEnd').datepicker().val(new Date().toDateString());
        $('#generateDemo').button().click(function () {
            $(".loader").show();
            sendTo('', 'generateDemo', {
                id:     $('#demoID').val(),
                start:  $('#demoStart').val(),
                end:    $('#demoEnd').val(),
                step:   $('#demoStep').val(),
                curve:  $('#demoCurve').val()
            }, function (e) {
                $('.loader').hide();
            })
        });
        onChange(false);
    }

    // ... and the function save has to exist.
    // you have to make sure the callback is called with the settings object as first param!
    function save(callback) {
        // example: select elements with class=value and build settings object
        var settings = {};
        $('.value').each(function () {
            var $this = $(this);
            var id = $this.attr('id');

            if ($this.attr('type') == 'checkbox') {
                settings[id] = $this.prop('checked');
            } else {
                settings[id] = $this.val();
           }
        });

        if ($('#passwordConfirm').val() != $('#password').val()) {
            showMessage(_('Password confirmation is not equal with password!'));
            return;
        }

        callback(settings);
    }
</script>

<style>
    .loader {
        display: none;
        position: absolute;
        left: calc(50% - 0.5em);
        top: calc(50% - 0.5em - 72px);
        font-size: 90px;
        text-indent: -9999em;
        overflow: hidden;
        width: 1em;
        height: 1em;
        border-radius: 50%;
        margin: 72px auto;
        -webkit-transform: translateZ(0);
        -ms-transform: translateZ(0);
        transform: translateZ(0);
        -webkit-animation: load6 1.7s infinite ease;
        animation: load6 1.7s infinite ease;
    }

    @-webkit-keyframes load6 {
        0% {
            -webkit-transform: rotate(0deg);
            transform: rotate(0deg);
            box-shadow: 0 -0.83em 0 -0.4em #00ffff, 0 -0.83em 0 -0.42em #00ffff, 0 -0.83em 0 -0.44em #00ffff, 0 -0.83em 0 -0.46em #00ffff, 0 -0.83em 0 -0.477em #00ffff;
        }
        5%,
        95% {
            box-shadow: 0 -0.83em 0 -0.4em #00ffff, 0 -0.83em 0 -0.42em #00ffff, 0 -0.83em 0 -0.44em #00ffff, 0 -0.83em 0 -0.46em #00ffff, 0 -0.83em 0 -0.477em #00ffff;
        }
        10%,
        59% {
            box-shadow: 0 -0.83em 0 -0.4em #00ffff, -0.087em -0.825em 0 -0.42em #00ffff, -0.173em -0.812em 0 -0.44em #00ffff, -0.256em -0.789em 0 -0.46em #00ffff, -0.297em -0.775em 0 -0.477em #00ffff;
        }
        20% {
            box-shadow: 0 -0.83em 0 -0.4em #00ffff, -0.338em -0.758em 0 -0.42em #00ffff, -0.555em -0.617em 0 -0.44em #00ffff, -0.671em -0.488em 0 -0.46em #00ffff, -0.749em -0.34em 0 -0.477em #00ffff;
        }
        38% {
            box-shadow: 0 -0.83em 0 -0.4em #00ffff, -0.377em -0.74em 0 -0.42em #00ffff, -0.645em -0.522em 0 -0.44em #00ffff, -0.775em -0.297em 0 -0.46em #00ffff, -0.82em -0.09em 0 -0.477em #00ffff;
        }
        100% {
            -webkit-transform: rotate(360deg);
            transform: rotate(360deg);
            box-shadow: 0 -0.83em 0 -0.4em #00ffff, 0 -0.83em 0 -0.42em #00ffff, 0 -0.83em 0 -0.44em #00ffff, 0 -0.83em 0 -0.46em #00ffff, 0 -0.83em 0 -0.477em #00ffff;
        }
    }

    @keyframes load6 {
        0% {
            -webkit-transform: rotate(0deg);
            transform: rotate(0deg);
            box-shadow: 0 -0.83em 0 -0.4em #00ffff, 0 -0.83em 0 -0.42em #00ffff, 0 -0.83em 0 -0.44em #00ffff, 0 -0.83em 0 -0.46em #00ffff, 0 -0.83em 0 -0.477em #00ffff;
        }
        5%,
        95% {
            box-shadow: 0 -0.83em 0 -0.4em #00ffff, 0 -0.83em 0 -0.42em #00ffff, 0 -0.83em 0 -0.44em #00ffff, 0 -0.83em 0 -0.46em #00ffff, 0 -0.83em 0 -0.477em #00ffff;
        }
        10%,
        59% {
            box-shadow: 0 -0.83em 0 -0.4em #00ffff, -0.087em -0.825em 0 -0.42em #00ffff, -0.173em -0.812em 0 -0.44em #00ffff, -0.256em -0.789em 0 -0.46em #00ffff, -0.297em -0.775em 0 -0.477em #00ffff;
        }
        20% {
            box-shadow: 0 -0.83em 0 -0.4em #00ffff, -0.338em -0.758em 0 -0.42em #00ffff, -0.555em -0.617em 0 -0.44em #00ffff, -0.671em -0.488em 0 -0.46em #00ffff, -0.749em -0.34em 0 -0.477em #00ffff;
        }
        38% {
            box-shadow: 0 -0.83em 0 -0.4em #00ffff, -0.377em -0.74em 0 -0.42em #00ffff, -0.645em -0.522em 0 -0.44em #00ffff, -0.775em -0.297em 0 -0.46em #00ffff, -0.82em -0.09em 0 -0.477em #00ffff;
        }
        100% {
            -webkit-transform: rotate(360deg);
            transform: rotate(360deg);
            box-shadow: 0 -0.83em 0 -0.4em #00ffff, 0 -0.83em 0 -0.42em #00ffff, 0 -0.83em 0 -0.44em #00ffff, 0 -0.83em 0 -0.46em #00ffff, 0 -0.83em 0 -0.477em #00ffff;
        }
    }
</style>

<div id="adapter-container">
    <div id="loader" class="loader"></div>
    <table><tr>
        <td><img src="sql.png"></td>
        <td style="padding-top: 20px;padding-left: 10px"><h3 class="translate">SQL history adapter settings</h3></td>
    </tr></table>
    <table>
        <tr><td colspan="3"><h4 class="translate">DB settings:</h4></td></tr>
        <tr>
            <td class="translate">DB Type</td>
            <td><select id="dbtype" class="value">
                <option value="mysql">MySQL</option>
                <option value="postgresql">PostgreSQL</option>
                <option value="sqlite">SQLite3</option>
                <option value="mssql">MS-SQL</option>
            </select></td>
            <td class="translate"></td>
        </tr>
        <tr class="real-sql">
            <td class="translate">Host</td>
            <td><input id="host" type="text" class="value"/></td>
            <td></td>
        </tr>
        <tr class="real-sql">
            <td class="translate">Port</td>
            <td><input id="port" type="text" class="value"/></td>
            <td></td>
        </tr>
        <tr class="ms-sql real-sql">
            <td class="translate">DB Name</td>
            <td><input id="dbname" type="text" class="value"/></td>
            <td></td>
        </tr>
        <tr class="real-sql">
            <td class="translate">User</td>
            <td><input id="user" type="text" class="value"/></td>
            <td></td>
        </tr>
        <tr class="real-sql">
            <td class="translate">Password</td>
            <td><input id="password" type="password" class="value"/></td>
            <td></td>
        </tr>
        <tr class="real-sql">
            <td class="translate">Password confirm</td>
            <td><input id="passwordConfirm" type="password"/></td>
            <td></td>
        </tr>
        <tr class="baby-sql">
            <td class="translate">File for sqlite:</td>
            <td><input id="fileName" type="text" class="value"/></td>
            <td></td>
        </tr>
        <tr class="ms-sql real-sql">
            <td class="translate">Encrypt:</td>
            <td><input id="encrypt" type="checkbox" class="value"/></td>
            <td></td>
        </tr>
        <tr class="ms-sql real-sql">
            <td class="translate">Round real to:</td>
            <td><input id="round" type="text" class="value"/></td>
            <td></td>
        </tr>
        <tr class="ms-sql real-sql">
            <td class="translate">Allow parallel requests:</td>
            <td><input id="multiRequests" type="checkbox" class="value"/></td>
            <td></td>
        </tr>
        <tr><td colspan="3"><h4 class="translate">Default settings:</h4></td></tr>
        <tr>
            <td class="translate">debounce</td>
            <td><input id="debounce" type="text" size="5" class="value number"/></td>
            <td></td>
        </tr>
        <tr>
            <td class="translate">retention</td>
            <td><select id="retention" class="value">
                <option value="0"           class="translate">keep forever</option>
                <option value="63072000"    class="translate">2 years</option>
                <option value="31536000"    class="translate">1 year</option>
                <option value="15811200"    class="translate">6 months</option>
                <option value="7948800"     class="translate">3 months</option>
                <option value="2678400"     class="translate">1 months</option>
                <option value="1209600"     class="translate">2 weeks</option>
                <option value="604800"      class="translate">1 week</option>
                <option value="432000"      class="translate">5 days</option>
                <option value="259200"      class="translate">3 days</option>
                <option value="86400"       class="translate">1 day</option>
            </select></td>
            <td></td>
        </tr>

    </table>
    <br><button id="test" class="translate">Test connection</button>
    <button id="reset" class="translate">Reset DB</button>
    <!--h4  class="translate">Demo Data:</h4>
    <table>
        <tr>
            <td class="translate">ID</td>
            <td class="translate">Start</td>
            <td class="translate">End</td>
            <td class="translate">Steps</td>
            <td class="translate">Curve</td>
            <td></td>
        </tr>
        <tr>
            <td class="translate"><input id="demoID" type="text" /></td>
            <td class="translate"><input id="demoStart" /></td>
            <td class="translate"><input id="demoEnd"  /></td>
            <td class="translate"><input id="demoStep" type="number" min="1" step="1" value="60"/></td>
            <td class="translate"><select id="demoCurve">
                <option value="sin"  class="translate">Sinus</option>
                <option value="dec"  class="translate">DEC</option>
                <option value="inc"  class="translate">INC</option>
                <option value="dec/int"  class="translate">DEC/INC</option>
            </select></td>
            <td class="translate"><button id="generateDemo">Generate</button></td>
        </tr>
    </table-->

</div>
</html>
{'fraction_non_alphanumeric': 0.17648103063501724, 'fraction_numerical': 0.04666260904848854, 'mean_word_length': 1.4463676406724983, 'pattern_counts': {'":': 262, '<': 521, '<?xml version=': 0, '>': 519, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '866522', 'n_tokens_mistral': 12920, 'n_tokens_neox': 11830, 'n_words': 2850}