# HG changeset patch # User Michiel Broek # Date 1657092358 -7200 # Node ID f7d0da7677ed3f48ba88881770592cdf541aa734 # Parent 36d51473aa81fbbc8c5091d2e66593bae5e6b22a Removed global setup, use bmsapp instead. diff -r 36d51473aa81 -r f7d0da7677ed www/includes/db_setup.php --- a/www/includes/db_setup.php Fri Jun 24 16:48:56 2022 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,80 +0,0 @@ - false, - 'msg' => 'Ok', -); - -$query = "SELECT * FROM profile_setup WHERE record='1'"; - -if (isset($_POST['update'])) { - /* Search water record */ - $result = mysqli_query($connect, "SELECT record FROM inventory_waters WHERE name='".$_POST['default_water']."';"); - if ($row = mysqli_fetch_array($result, MYSQLI_ASSOC)) - $default_water = $row['record']; - else - $default_water = 0; - $sql = "UPDATE `profile_setup` SET "; - $sql .= "brewery_name='" . mysqli_real_escape_string($connect, $_POST['brewery_name']); - $sql .= "', factor_mashhop='" . $_POST['factor_mashhop']; - $sql .= "', factor_fwh='" . $_POST['factor_fwh']; - $sql .= "', factor_pellet='" . $_POST['factor_pellet']; - $sql .= "', factor_plug='" . $_POST['factor_plug']; - $sql .= "', factor_wethop='" . $_POST['factor_wethop']; - $sql .= "', factor_cryohop='" . $_POST['factor_cryohop']; - $sql .= "', color_method='" . $_POST['color_method']; - $sql .= "', ibu_method='" . $_POST['ibu_method']; - $sql .= "', brix_correction='" . $_POST['brix_correction']; - $sql .= "', grain_absorbtion='" . $_POST['grain_absorbtion']; - $sql .= "', default_water='" . $default_water; - $sql .= "', my_yeastlab='" . $_POST['my_yeastlab']; - $sql .= "' WHERE record='1';"; - $result = mysqli_query($connect, $sql); - if (! $result) { - syslog(LOG_NOTICE, "db_profile_setup: ".$sql." result: ".mysqli_error($connect)); - $response['error'] = true; - $response['msg'] = "SQL fout: ".mysqli_error($connect); - } - exit(json_encode($response)); - -} else { - $result = mysqli_query($connect, $query) or die("SQL Error 1: " . mysqli_error($connect)); - if ($row = mysqli_fetch_array($result, MYSQLI_ASSOC)) { - /* search water name */ - $wresult = mysqli_query($connect, "SELECT name FROM inventory_waters WHERE record='".$row['default_water']."';"); - if ($wrow = mysqli_fetch_array($wresult, MYSQLI_ASSOC)) - $default_water = $wrow['name']; - else - $default_water = ''; - $data = '{"record":' . $row['record']; - $data .= ',"brewery_name":"' . str_replace($escapers, $replacements, $row['brewery_name']); - $data .= '","factor_mashhop":' . $row['factor_mashhop']; - $data .= ',"factor_fwh":' . $row['factor_fwh']; - $data .= ',"factor_pellet":' . $row['factor_pellet']; - $data .= ',"factor_plug":' . $row['factor_plug']; - $data .= ',"factor_wethop":' . $row['factor_wethop']; - $data .= ',"factor_cryohop":' . $row['factor_cryohop']; - $data .= ',"ibu_method":' . $row['ibu_method']; - $data .= ',"color_method":' . $row['color_method']; - $data .= ',"brix_correction":' . floatval($row['brix_correction']); - $data .= ',"grain_absorbtion":' . floatval($row['grain_absorbtion']); - $data .= ',"default_water":"' . str_replace($escapers, $replacements, $default_water); - $data .= '","my_yeastlab":"' . str_replace($escapers, $replacements, $row['my_yeastlab']); - $data .= '"}'; - } - header("Content-type: application/json"); - exit($data); -} -?> diff -r 36d51473aa81 -r f7d0da7677ed www/includes/global.inc.php --- a/www/includes/global.inc.php Fri Jun 24 16:48:56 2022 +0200 +++ b/www/includes/global.inc.php Wed Jul 06 09:25:58 2022 +0200 @@ -274,7 +274,6 @@
  • Maisch schemas
  • Bierstijlen
  • Vergisting profielen
  • -
  • Instellingen
  • Over diff -r 36d51473aa81 -r f7d0da7677ed www/js/profile_setup.js --- a/www/js/profile_setup.js Fri Jun 24 16:48:56 2022 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,182 +0,0 @@ -/***************************************************************************** - * Copyright (C) 2019-2020 - * - * Michiel Broek - * - * This file is part of BMS - * - * This is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License as published by the - * Free Software Foundation; either version 2, or (at your option) any - * later version. - * - * BrewCloud is distributed in the hope that it will be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with ThermFerm; see the file COPYING. If not, write to the Free - * Software Foundation, 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. - *****************************************************************************/ - - -$(document).ready(function() { - - var dataRecord = {}, - waterInvSource = { - datatype: 'json', - datafields: [{ name: 'name', type: 'string' }], - url: 'getwatersources.php', - async: false - }, - waterlist = new $.jqx.dataAdapter(waterInvSource); - url = 'includes/db_setup.php', - source = { - datatype: 'json', - cache: false, - datafields: [ - { name: 'brewery_name', type: 'string' }, - { name: 'factor_mashhop', type: 'number' }, - { name: 'factor_fwh', type: 'number' }, - { name: 'factor_pellet', type: 'number' }, - { name: 'factor_plug', type: 'number' }, - { name: 'factor_wethop', type: 'number' }, - { name: 'factor_cryohop', type: 'number' }, - { name: 'ibu_method', type: 'int' }, - { name: 'color_method', type: 'int' }, - { name: 'brix_correction', type: 'float' }, - { name: 'grain_absorbtion', type: 'float' }, - { name: 'default_water', type: 'string' }, - { name: 'my_yeastlab', type: 'string' } - ], - url: url - }, - dataAdapter = new $.jqx.dataAdapter(source, { - loadComplete: function() { - var records = dataAdapter.records; - dataRecord = records[0]; - $('#brewery_name').val(dataRecord.brewery_name); - $('#factor_mashhop').val(dataRecord.factor_mashhop); - $('#factor_fwh').val(dataRecord.factor_fwh); - $('#factor_pellet').val(dataRecord.factor_pellet); - $('#factor_plug').val(dataRecord.factor_plug); - $('#factor_wethop').val(dataRecord.factor_wethop); - $('#factor_cryohop').val(dataRecord.factor_cryohop); - $('#color_method').val(dataRecord.color_method); - $('#ibu_method').val(dataRecord.ibu_method); - $('#brix_correction').val(dataRecord.brix_correction); - $('#grain_absorbtion').val(dataRecord.grain_absorbtion); - $('#default_water').jqxDropDownList('selectItem', dataRecord.default_water); - $('#my_yeastlab').jqxDropDownList('selectItem', dataRecord.my_yeastlab); - }, - loadError: function(jqXHR, status, error) { - }, - }); - - // Tooltips - $('#brewery_name').jqxTooltip({ content: 'De naam voor deze brouwerij.' }); - $('#factor_mashhop').jqxTooltip({ content: 'Het efficientie percentage voor hop tijdens de maisch.' }); - $('#factor_fwh').jqxTooltip({ content: 'Het efficientie percentage voor First Wort Hop.' }); - $('#factor_pellet').jqxTooltip({ content: 'Het efficientie percentage bij gebruik van hop pellets.' }); - $('#factor_plug').jqxTooltip({ content: 'Het efficientie percentage bij gebruik van hop plugs.' }); - $('#factor_wethop').jqxTooltip({ content: 'Het efficientie percentage bij gebruik van nat geplukte hop.' }); - $('#factor_cryohop').jqxTooltip({ content: 'Het efficientie percentage bij gebruik van Cryo Hop®.' }); - $('#brix_correction').jqxTooltip({ content: 'Omzettingsfactor voor Plato naar Brix' }); - $('#grain_absorbtion').jqxTooltip({ content: 'Absorbtie van water door graan (L/Kg)' }); - - // Editers - $('#brewery_name').jqxInput({ theme: theme, width: 640, height: 23 }); - $('#factor_fwh').jqxNumberInput({ inputMode: 'simple', theme: theme, width: 110, height: 23, min: -50, max: 50, - decimalDigits: 0, spinButtons: true, symbol: '%', symbolPosition: 'right' }); - $('#factor_mashhop').jqxNumberInput({ inputMode: 'simple', theme: theme, width: 110, height: 23, min: -50, max: 50, - decimalDigits: 0, spinButtons: true, symbol: '%', symbolPosition: 'right' }); - $('#factor_pellet').jqxNumberInput({ inputMode: 'simple', theme: theme, width: 110, height: 23, min: 0, max: 20, - decimalDigits: 0, spinButtons: true, symbol: '%', symbolPosition: 'right' }); - $('#factor_plug').jqxNumberInput({ inputMode: 'simple', theme: theme, width: 110, height: 23, min: 0, max: 20, - decimalDigits: 0, spinButtons: true, symbol: '%', symbolPosition: 'right' }); - $('#factor_wethop').jqxNumberInput({ inputMode: 'simple', theme: theme, width: 110, height: 23, min: -98, max: -20, - decimalDigits: 0, spinButtons: true, symbol: '%', symbolPosition: 'right' }); - $('#factor_cryohop').jqxNumberInput({ inputMode: 'simple', theme: theme, width: 110, height: 23, min: -20, max: 150, - decimalDigits: 0, spinButtons: true, symbol: '%', symbolPosition: 'right' }); - $('#brix_correction').jqxNumberInput({ inputMode: 'simple', theme: theme, width: 110, height: 23, min: 1.00, max: 1.09, decimalDigits: 2, spinButtons: true }); - $('#grain_absorbtion').jqxNumberInput({ inputMode: 'simple', theme: theme, width: 110, height: 23, min: 0.5, max: 1.1, decimalDigits: 2, spinButtons: true }); - $('#color_method').jqxDropDownList({ - theme: theme, - source: ColorMethodAdapter, - valueMember: 'id', - displayMember: 'nl', - width: 180, - autoDropDownHeight: true - }); - $('#ibu_method').jqxDropDownList({ - theme: theme, - source: IBUmethodAdapter, - valueMember: 'id', - displayMember: 'nl', - width: 180, - autoDropDownHeight: true - }); - $('#default_water').jqxDropDownList({ - placeHolder: 'Kies water:', - theme: theme, - source: waterlist, - valueMember: 'name', - displayMember: 'name', - width: 250, - dropDownHorizontalAlignment: 'right', - dropDownWidth: 300, - autoDropDownHeight: true - }); - $('#my_yeastlab').jqxDropDownList({ - placeHolder: 'Mijn gist laboratorium:', - theme: theme, - source: yeastlablist, - valueMember: 'laboratory', - displayMember: 'laboratory', - width: 250, - dropDownHorizontalAlignment: 'right', - dropDownWidth: 300, - autoDropDownHeight: true - }); - dataAdapter.dataBind(); - - $('#Save').jqxButton({ template: 'success', width: '90px', theme: theme }); - $('#Save').click(function() { - var data, - row = { - record: 1, - brewery_name: $('#brewery_name').val(), - factor_mashhop: $('#factor_mashhop').val(), - factor_fwh: $('#factor_fwh').val(), - factor_pellet: $('#factor_pellet').val(), - factor_plug: $('#factor_plug').val(), - factor_wethop: $('#factor_wethop').val(), - factor_cryohop: $('#factor_cryohop').val(), - color_method: $('#color_method').val(), - ibu_method: $('#ibu_method').val(), - brix_correction: parseFloat($('#brix_correction').jqxNumberInput('decimal')), - grain_absorbtion: parseFloat($('#grain_absorbtion').jqxNumberInput('decimal')), - default_water: $('#default_water').val(), - my_yeastlab: $('#my_yeastlab').val() - }; - data = 'update=true&' + $.param(row); - $.ajax({ - dataType: 'json', - url: url, - cache: false, - data: data, - type: 'POST', - success: function(data) { - if (data.error) { - console.log('update: ' + data.msg); - alert('Fout: ' + data.msg); - } else { - console.log('update: success'); - } - }, - error: function(jqXHR, textStatus, errorThrown) { - } - }); - }); -}); diff -r 36d51473aa81 -r f7d0da7677ed www/profile_setup.php --- a/www/profile_setup.php Fri Jun 24 16:48:56 2022 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,66 +0,0 @@ - - -
    -
    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    Brouwerij naam:

    Brouw instellingen
    First Wort Hop factor:
    Graan absorbtie:
    Kleur methode:
    Maischhop factor:
    Brix correctie factor:
    Bitterheid methode:
    Pellet factor:
    Standaard water:
    Hop plug factor:
    Mijn gist laboratorium:
    Wet hop factor:
    Cryo Hop® factor:
    -
    - -
    -
    -
    - -