Ongoing webgui work
This commit is contained in:
+21
-10
@@ -73,6 +73,9 @@ switch ($submit = form_get_action()) {
|
||||
$p[':beltpos_aft'] = gpc_get_float($_POST, 'beltpos_aft');
|
||||
$p[':beltpos_bow'] = gpc_get_float($_POST, 'beltpos_bow');
|
||||
$p[':shapefile'] = gpc_get_string($_POST, 'shapefile');
|
||||
if ($p[':shapefile'] == '-1') {
|
||||
$p[':shapefile'] = NULL;
|
||||
}
|
||||
$p[':remarks'] = gpc_get_string($_POST, 'remarks', 150);
|
||||
db_exec_update('vessel', $p, 'vid');
|
||||
$action = ACT_DEFAULT;
|
||||
@@ -93,8 +96,7 @@ require 'header.php';
|
||||
if ($action == ACT_DEFAULT):
|
||||
// ========== VARIANT: default behavior =======================================
|
||||
|
||||
|
||||
echo '<h1>', _('Yacht data'), "</h1>\n";
|
||||
page_caption_search(_('Yacht data'));
|
||||
|
||||
echo '<p>', _('User'), ': ', $user->displayname, ' (', $user->role, ')', "</p>\n";
|
||||
|
||||
@@ -108,7 +110,7 @@ $vid = ($res[0]);
|
||||
// Switch between vessels
|
||||
$sth = $pdo->query("SELECT vid, vesselname, model FROM vessel ORDER BY vid");
|
||||
$res = $sth->fetchAll();
|
||||
echo '<form class="row" method="post">', "\n";
|
||||
echo '<form class="row align-items-center" method="post">', "\n";
|
||||
echo '<div class="col-1">', "\n";
|
||||
echo '<label class="form-label" for="vid">Yacht:</label>';
|
||||
echo "</div>\n";
|
||||
@@ -157,25 +159,29 @@ EOT;
|
||||
$shape = new SimpleXMLElement($baseshape);
|
||||
// $shape['width'], $shape['height']
|
||||
|
||||
// offset for coordinate origin
|
||||
$ox = 0;
|
||||
$oy = 0;
|
||||
|
||||
$g = $shape->addChild('g');
|
||||
$g->addAttribute('id', 'boxlayout');
|
||||
|
||||
// line for belt
|
||||
if (isset($vessel->beltpos_aft) and isset($vessel->loa) and ($vessel->beltpos_aft < $vessel->loa)) {
|
||||
$x = round($vessel->beltpos_aft / $vessel->loa * 1024);
|
||||
$x = $ox + round($vessel->beltpos_aft / $vessel->loa * 1024);
|
||||
$line = $g->addChild('line');
|
||||
$line->addAttribute('x1', $x);
|
||||
$line->addAttribute('y1', '0');
|
||||
$line->addAttribute('y1', $oy);
|
||||
$line->addAttribute('x2', $x);
|
||||
$line->addAttribute('y2', $shape['height']);
|
||||
$line->addAttribute('style', 'stroke:#ff0000;stroke-width:1px');
|
||||
}
|
||||
|
||||
if (isset($vessel->beltpos_bow) and isset($vessel->loa) and ($vessel->beltpos_bow < $vessel->loa)) {
|
||||
$x = round($vessel->beltpos_bow / $vessel->loa * 1024);
|
||||
$x = $ox + round($vessel->beltpos_bow / $vessel->loa * 1024);
|
||||
$line = $g->addChild('line');
|
||||
$line->addAttribute('x1', $x);
|
||||
$line->addAttribute('y1', '0');
|
||||
$line->addAttribute('y1', $oy);
|
||||
$line->addAttribute('x2', $x);
|
||||
$line->addAttribute('y2', $shape['height']);
|
||||
$line->addAttribute('style', 'stroke:#ff0000;stroke-width:1px');
|
||||
@@ -240,7 +246,11 @@ $text->addAttribute('y', '95'); */
|
||||
|
||||
?>
|
||||
<div class="container-fluid my-4">
|
||||
<?=$shape->asXML()?>
|
||||
<?php
|
||||
$xml = $shape->asXML();
|
||||
// strip first line: xml version ...
|
||||
echo substr($xml, strpos($xml, "\n") + 1);
|
||||
?>
|
||||
</div>
|
||||
|
||||
<div class="container-fluid">
|
||||
@@ -336,6 +346,7 @@ echo "</table>\n";
|
||||
<h5 class="card-title"><?=_('Base data')?></h5>
|
||||
<ul class="list-group list-group-flush">
|
||||
<li class="list-group-item"><a href="dropdown.php"><?=_('Selection lists')?></a></li>
|
||||
<li class="list-group-item"><a href="tag.php"><?=_('Tags')?></a></li>
|
||||
<li class="list-group-item"><a href="storage.php"><?=_('Storage')?></a></li>
|
||||
<li class="list-group-item"><a href="company.php"><?=_('Companies')?></a></li>
|
||||
</ul>
|
||||
@@ -345,7 +356,6 @@ echo "</table>\n";
|
||||
<li class="list-group-item"><a href="task.php"><?=_('Tasks')?></a></li>
|
||||
<li class="list-group-item"><a href="measurement.php"><?=_('Measurements')?></a></li>
|
||||
<li class="list-group-item"><a href="checklist.php"><?=_('Checklists')?></a></li>
|
||||
<li class="list-group-item"><a href="search.php"><?=_('Search')?></a></li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
@@ -387,7 +397,8 @@ elseif ($action == ACT_EDIT):
|
||||
// ========== VARIANT: edit single record =====================================
|
||||
|
||||
// get list of shapefiles
|
||||
$opt_shapefiles = array('' => _('--- none ---'));
|
||||
//$opt_shapefiles = array('' => _('--- none ---'));
|
||||
$opt_shapefiles = $g_opt_none;
|
||||
foreach (glob($g_shapedir.'/*.svg') as $f) {
|
||||
$f = basename($f);
|
||||
$opt_shapefiles[$f] = $f;
|
||||
|
||||
Reference in New Issue
Block a user