Fixes for webgui and more native gui development

This commit is contained in:
2026-09-16 19:07:10 +02:00
parent 9b45fd3700
commit 2fc74c0677
31 changed files with 2143 additions and 417 deletions
+2 -3
View File
@@ -29,13 +29,13 @@ $g_mailto_webmaster = 'webmaster@example.com';
// localization
$g_textdomain = 'yms';
$g_timezone = 'Europe/Berlin';
$g_locale = 'de_DE.UTF-8';
$g_locale = 'en_GB.UTF-8';
// vessel base shapes directory
$g_shapedir = '/usr/local/share/yms/shapes';
// documents and images
$g_doc_basepath = '/var/local/yms';
$g_doc_basepath = '/var/local/lib/yms';
$g_doc_maxsize = 1024*1024*16; // 16 MB, please adjust php.ini accordingly!
$g_doc_typemap = array(
'generic' => 'doc',
@@ -50,4 +50,3 @@ $g_storage_limit = 1024; // MB
$g_thumb_size = 120;
$g_rows_pp = 10; // pagination limit
+8 -5
View File
@@ -136,11 +136,14 @@ $g_currsym = $sth->fetchColumn();
// allowed date formats
$g_opt_datefmt = array(
'Y-m-d' => _('YYYY-MM-DD'),
'Y/m/d' => _('YYYY/MM/DD'),
'd.m.Y' => _('DD.MM.YYYY'),
'd/m/Y' => _('DD/MM/YYYY'),
'm-d-Y' => _('MM-DD-YYYY')
'Y-m-d' => _('YYYY-MM-DD'), // ISO / international /technical
'd.m.Y' => _('DD.MM.YYYY'), // Germany / Central & Northern Europe
'd/m/Y' => _('DD/MM/YYYY'), // UK / France / Spain / Italy / Australia / NZ
'd-m-Y' => _('DD-MM-YYYY'), // Netherlands / Denmark / Belgium
'd M Y' => _('DD Mon YYYY'), // nautical documents / logbooks / unambiguous
'm.d.Y' => _('MM.DD.YYYY'), // USA
'm/d/Y' => _('MM/DD/YYYY'), // USA
'Y/m/d' => _('YYYY/MM/DD') // Japan / China
);
$user = User::GetInstance(); // There can be only one
+9 -2
View File
@@ -18,6 +18,7 @@ $opt_storage = db_get_opt_storage($user->vid);
$opt_box = db_get_opt_box($user->vid);
$opt_invcond = db_load_enum('inventory', 'invcond', true, true);
$opt_equipment = db_get_opt_equip($user->vid, [-1 => _('― none ―')]);
$opt_icat = db_get_options(13);
// ========== ACTIONS START ===================================================
@@ -95,6 +96,8 @@ switch ($submit = form_get_action()) {
$p[':price'] = gpc_get_currency($_POST, 'price');
$p[':purchdate'] = gpc_get_date($_POST, 'purchdate');
$p[':invcond'] = gpc_get_string($_POST, 'invcond');
$p[':icat'] = gpc_get_int($_POST, 'icat');
if ($p[':icat'] <= 0) $p[':icat'] = NULL;
$p[':remarks'] = gpc_get_string($_POST, 'remarks', 150);
$p[':eid'] = gpc_get_int($_POST, 'eid');
if ($p[':eid'] <= 0) $p[':eid'] = NULL;
@@ -343,7 +346,7 @@ elseif ($action == ACT_VIEW):
// ========== VARIANT: view single record =====================================
$sql = "SELECT invname, conttype, sid, boxid, number, weight, price, purchdate,"
. " invcond, remarks "
. " invcond, icat, remarks "
. "FROM inventory "
. "WHERE invid=?";
$sth = $pdo->prepare($sql);
@@ -397,6 +400,7 @@ echo "<tr><th>", _('Weight'), "</th><td>", format_float($inventory->weight, 2, '
echo "<tr><th>", _('Price'), "</th><td>", format_currency($inventory->price), "</td></tr>\n";
echo "<tr><th>", _('Purchase date'), "</th><td>", format_date($inventory->purchdate), "</td></tr>\n";
echo "<tr><th>", _('Condition'), "</th><td>", $opt_invcond[$inventory->invcond], "</td></tr>\n";
echo "<tr><th>", _('Category'), "</th><td>", $opt_icat[$inventory->icat], "</td></tr>\n";
echo "<tr><th>", _('Remarks'), "</th><td>", h($inventory->remarks, br:true), "</td></tr>\n";
$tags = db_load_taglist('inv', $id);
@@ -462,7 +466,10 @@ foreach ($cond as $k => $v) {
?>
</select>
</div>
<?php form_create_select('eid', _('Equipment'), $opt_equipment, $inventory->eid); ?>
<?php
form_create_select('icat', _('Category'), $g_opt_none + $opt_icat, $inventory->icat);
form_create_select('eid', _('Equipment'), $opt_equipment, $inventory->eid);
?>
<div class="mb-3">
<label for="remarks" class="form-label"><?=_('Remarks')?></label>
<textarea class="form-control" id="remarks" name="remarks" rows="3"><?=h($inventory->remarks, br:true)?></textarea>
+31
View File
@@ -0,0 +1,31 @@
<?php
/******************************************************************************
* YMS - Yacht Management Software
* Copyright (C) 2024-2026 Thomas Hooge
*
* SPDX-License-Identifier: WTFPL
******************************************************************************
*/
function signalk_get($server, $skpath) {
$url = "$server/signalk/v1/api/" . str_replace('.', '/', $skpath);
var_dump($url);
$ch = curl_init($url);
curl_setopt_array($ch, [
CURLOPT_RETURNTRANSFER => true,
CURLOPT_CONNECTTIMEOUT => 3,
CURLOPT_TIMEOUT => 5,
]);
$json = curl_exec($ch);
if ($json === false) {
throw new RuntimeException('Signal K error: ' . curl_error($ch));
}
$httpCode = curl_getinfo($ch, CURLINFO_HTTP_CODE);
curl_close($ch);
if ($httpCode !== 200) {
throw new RuntimeException('Signal K HTTP-error: ' . $httpCode);
}
return json_decode($json, true, 512, JSON_THROW_ON_ERROR);
}
+1
View File
@@ -291,6 +291,7 @@ if (count($res) > 0) {
echo "<td>", $row['provname'], "</td>";
echo "<td>", $row['number'], ' ', $opt_unit[$row['unit']], "</td>";
echo "<td>", $row['storedate'], ' - ', $row['shelflife'], "</td>";
echo '<td><a title="', _('View'), '" href="provisions.php?f=view&id=', $row['provid'], '"><i class="bi-eye"></i></a></td>';
echo "</tr>\n";
}
echo "</table>\n";