More webgui development
This commit is contained in:
+35
-10
@@ -14,6 +14,7 @@ $id = gpc_get_int($_REQUEST, 'id', 0);
|
||||
$opt_supplier = db_get_opt_supp(array(-1 => _('--- unknown ---')));
|
||||
$opt_manufacturer = db_get_opt_manuf(array(-1 => _('--- unknown ---')));
|
||||
$opt_ecat = db_get_options(4); // Equipment categories
|
||||
$opt_unit = db_get_options(8);
|
||||
|
||||
// ========== ACTIONS START ===================================================
|
||||
|
||||
@@ -102,7 +103,6 @@ switch ($submit = form_get_action()) {
|
||||
break;
|
||||
}
|
||||
$extensions = ['jpg', 'png'];
|
||||
$mimetypes = ['image/png', 'image/jpeg', 'image/svg+xml', 'application/pdf'];
|
||||
$all_files = count($_FILES ["files"]["tmp_name"]);
|
||||
$nerr = 0;
|
||||
for ($i = 0; $i < $all_files; $i++) {
|
||||
@@ -113,7 +113,7 @@ switch ($submit = form_get_action()) {
|
||||
$file_ext = strtolower(end(explode('.', $_FILES['files']['name'][$i])));
|
||||
// $file = $g_doc_basepath . '/' . $file_name;
|
||||
$file_mimetype = mime_content_type($file_tmp);
|
||||
if (!in_array($file_mimetype, $mimetypes)) {
|
||||
if (!in_array($file_mimetype, $g_doc_mimetypes)) {
|
||||
$g_error->Add(sprintf(_("Mimetype '%s' not allowed for upload."), $file_mimetype));
|
||||
$nerr += 1;
|
||||
}
|
||||
@@ -121,7 +121,7 @@ switch ($submit = form_get_action()) {
|
||||
$g_error->Add(_('Filetype not allowed for upload:') . ' ' . $file_type);
|
||||
$nerr += 1;
|
||||
}
|
||||
if ($file_size > 2097152) {
|
||||
if ($file_size > $g_doc_maxsize) {
|
||||
$g_error->Add(sprintf(_('File to big: %s.%s'), $file_name, $file_type));
|
||||
$nerr += 1;
|
||||
}
|
||||
@@ -249,7 +249,7 @@ $opt_special = array(
|
||||
<div id="filter" class="card">
|
||||
<div class="card-header">Filter</div>
|
||||
<div class="card-body">
|
||||
<label for="flt_category">Category</label>
|
||||
<label for="flt_category"><?=_('Category')?></label>
|
||||
<select id="flt_category" name="flt_category">
|
||||
<?php
|
||||
foreach ($opt_special + $opt_ecat as $k => $v) {
|
||||
@@ -261,7 +261,7 @@ foreach ($opt_special + $opt_ecat as $k => $v) {
|
||||
}
|
||||
?>
|
||||
</select>
|
||||
<label for="flt_manuf">Manufacturer</label>
|
||||
<label for="flt_manuf"><?=_('Manufacturer')?></label>
|
||||
<select id="flt_manuf" name="flt_manuf">
|
||||
<?php
|
||||
foreach ($opt_special + $opt_manufacturer as $k => $v) {
|
||||
@@ -273,7 +273,7 @@ foreach ($opt_special + $opt_manufacturer as $k => $v) {
|
||||
}
|
||||
?>
|
||||
</select>
|
||||
<label for="flt_supp">Supplier</label>
|
||||
<label for="flt_supp"><?=_('Supplier')?></label>
|
||||
<select id="flt_supp" name="flt_supp">
|
||||
<?php
|
||||
foreach ($opt_special + $opt_supplier as $k => $v) {
|
||||
@@ -285,7 +285,7 @@ foreach ($opt_special + $opt_supplier as $k => $v) {
|
||||
}
|
||||
?>
|
||||
</select>
|
||||
<label for="flt_txt">Text</label>
|
||||
<label for="flt_txt"><?=_('Text')?></label>
|
||||
<input type="text" name="flt_txt" size="15" maxlength="30" value="<?=$flt->txt?>">
|
||||
<button name="submit[filter]" class="btn btn-sm btn-primary" title="<?=_('Apply')?>"><?=_('Go')?></button>
|
||||
</div>
|
||||
@@ -294,7 +294,7 @@ foreach ($opt_special + $opt_supplier as $k => $v) {
|
||||
|
||||
<?php
|
||||
// Pagination on top
|
||||
$pagination = get_pagination($g_scriptname, $page, $lastpage);
|
||||
$pagination = get_pagination($g_scriptname, '', $page, $lastpage);
|
||||
echo $pagination;
|
||||
|
||||
// Data
|
||||
@@ -442,9 +442,7 @@ echo '</div>'; // container
|
||||
// Buttons at bottom of data area
|
||||
form_view_buttons($g_scriptname, $id);
|
||||
|
||||
|
||||
// Maintenance records
|
||||
|
||||
echo '<h3>', _('Maintenances'), "</h3>";
|
||||
|
||||
$sql = "SELECT maintid, series, activities FROM maintenance WHERE eid=?";
|
||||
@@ -461,6 +459,33 @@ if ($sth->rowCount() > 0) {
|
||||
} else {
|
||||
echo '<p>', _('No maintenance records found.'), "<p>\n";
|
||||
}
|
||||
echo '<div class="container-fluid px-0 my-3">', "\n";
|
||||
echo '<a href="maintenance.php?f=add&id=', $id, '" class="btn btn-primary" role="button">';
|
||||
echo _('Add maintenance'), "</a>\n";
|
||||
echo "</div>\n";
|
||||
|
||||
// Measurement records
|
||||
echo '<h3>', _('Measurements'), "</h3>";
|
||||
|
||||
$sql = "SELECT mid, mname, nval, val1, val2, val3, unit, accuracy FROM measurement WHERE eid=?";
|
||||
$sth = $pdo->prepare($sql);
|
||||
$sth->execute([$id]);
|
||||
if ($sth->rowCount() > 0) {
|
||||
echo "<ul>\n";
|
||||
foreach ($sth->fetchAll() as $row) {
|
||||
echo "<li>", $row['mname'], ': ';
|
||||
echo format_measurement($row['nval'], $opt_unit[$row['unit']], $row['val1'], $row['val2'], $row['val3']);
|
||||
echo ' <a title="', _('View'), '" href="measurement.php?f=view&id=', $row['mid'], '"><i class="bi-eye"></i></a>';
|
||||
echo "</li>\n";
|
||||
}
|
||||
echo "</ul>\n";
|
||||
} else {
|
||||
echo '<p>', _('No measurement records found.'), "<p>\n";
|
||||
}
|
||||
echo '<div class="container-fluid px-0 my-3">', "\n";
|
||||
echo '<a href="measurement.php?f=add&id=', $id, '" class="btn btn-primary" role="button">';
|
||||
echo _('Add measurement'), "</a>\n";
|
||||
echo "</div>\n";
|
||||
|
||||
elseif ($action == ACT_EDIT):
|
||||
// ========== VARIANT: edit single record =====================================
|
||||
|
||||
Reference in New Issue
Block a user