Webgui: More mobile friendly touch and much more improvements
This commit is contained in:
+42
-12
@@ -1,7 +1,7 @@
|
||||
<?php
|
||||
/******************************************************************************
|
||||
* YMS - Yacht Management Software
|
||||
* Copyright (C) 2024-2025 Thomas Hooge
|
||||
* Copyright (C) 2024-2026 Thomas Hooge
|
||||
*
|
||||
* SPDX-License-Identifier: WTFPL
|
||||
******************************************************************************/
|
||||
@@ -222,6 +222,8 @@ page_caption_search($pagetitle);
|
||||
|
||||
$flt = db_get_filter($user->id, 209);
|
||||
|
||||
// $w = array('(vid=:vid OR vid IS NULL)');
|
||||
// $p = array(':vid' => $user->vid);
|
||||
$w = array();
|
||||
$p = array();
|
||||
if (isset($flt->doctype) and $flt->doctype != 'all') {
|
||||
@@ -244,8 +246,28 @@ if (strlen($flt->txt) > 1) {
|
||||
$where = join(' AND ', $w);
|
||||
$order = ' ORDER BY docid';
|
||||
|
||||
/*
|
||||
|
||||
WIP
|
||||
|
||||
Attention: Do not count duplicate, so first select docid from different sources
|
||||
an as laststep get a distinct list of docids to count.
|
||||
|
||||
Documents with no reference at all
|
||||
SELECT docid FROM document LEFT OUTER JOIN docref USING (docid) WHERE docref.drid IS NULL;
|
||||
|
||||
Documents for current vessel
|
||||
SELECT docid FROM document LEFT OUTER JOIN docref USING (docid) WHERE docref.reftype='vessel' AND docref.refid=:vid
|
||||
|
||||
Documents for equipment in current vessel
|
||||
SELECT DISTINCT d.docid AS docid FROM document AS d
|
||||
LEFT OUTER JOIN docref AS r USING (docid) LEFT OUTER JOIN equipment AS e ON (r.refid=e.eid)
|
||||
WHERE r.reftype='equipment' AND e.vid=:vid
|
||||
|
||||
*/
|
||||
|
||||
// get total recond count for pagination and limit
|
||||
$sql = "SELECT COUNT(*) FROM document LEFT OUTER JOIN docref USING (docid)";
|
||||
$sql = "SELECT COUNT(DISTINCT docid) FROM document LEFT OUTER JOIN docref USING (docid)";
|
||||
if ($where) $sql .= ' WHERE ' . $where;
|
||||
$sth = $pdo->prepare($sql);
|
||||
try {
|
||||
@@ -254,10 +276,12 @@ try {
|
||||
$g_error->Add($e->getMessage());
|
||||
$g_error->Add($sql);
|
||||
$g_error->Add(print_r($p, true));
|
||||
$g_error->PrintOut();
|
||||
}
|
||||
$numrows = $sth->fetchColumn();
|
||||
$lastpage = ceil($numrows/$g_rows_pp);
|
||||
$page = gpc_get_int($_REQUEST, 'p', 1);
|
||||
$rows_pp = gpc_get_int($_REQUEST, 'n', $g_rows_pp);
|
||||
$lastpage = ceil($numrows/$rows_pp);
|
||||
|
||||
$sql = "SELECT d.docid, d.doctype, d.filename, d.title, COUNT(r.drid) AS refcount "
|
||||
. "FROM document AS d LEFT OUTER JOIN docref AS r USING (docid)";
|
||||
@@ -279,7 +303,7 @@ $opt_special = array(
|
||||
?>
|
||||
<form method="post" action="<?=$g_scriptname?>">
|
||||
<div id="filter" class="card">
|
||||
<div class="card-header">Filter</div>
|
||||
<div class="card-header"><i class="bi bi-funnel me-2"></i>Filter</div>
|
||||
<div class="card-body">
|
||||
<label for="flt_doctype">Type</label>
|
||||
<select id="flt_doctype" name="flt_doctype">
|
||||
@@ -323,7 +347,7 @@ echo $pagination;
|
||||
echo '<table class="table table-striped">', "\n";
|
||||
echo "<thead>\n";
|
||||
echo "<tr>";
|
||||
echo "<th>", _('ID'), "</th>";
|
||||
echo '<th>#</th>';
|
||||
echo "<th>", _('Type'), "</th>";
|
||||
echo "<th>", _('Filename'), "</th>";
|
||||
echo "<th>", _('Title'), "</th>";
|
||||
@@ -331,23 +355,28 @@ echo "<th>", _('Links'), "</th>";
|
||||
echo "<th> </th>";
|
||||
echo "</tr>\n";
|
||||
echo "</thead>\n";
|
||||
|
||||
$i = ($page - 1) * $rows_pp;
|
||||
$i0 = $i + 1;
|
||||
foreach ($res as $row) {
|
||||
$i++; // record number
|
||||
echo "<tr>\n";
|
||||
echo "<td>", $row['docid'], "</td>\n";
|
||||
echo "<td>", $i;
|
||||
echo '<a title="', _('View'), '" href="', $g_scriptname, '?f=view&id=', $row['docid'], '"><i class="bi-eye ms-2"></i></a>', "\n";
|
||||
echo "</td>\n";
|
||||
echo "<td>", $opt_doctype[$row['doctype']], "</td>\n";
|
||||
echo "<td>", $row['filename'], "</td>\n";
|
||||
echo "<td>", $row['title'], "</td>\n";
|
||||
echo "<td>", $row['refcount'], "</td>\n";
|
||||
// Action buttons
|
||||
// Edit current record button
|
||||
echo "<td>";
|
||||
echo '<a title="', _('View'), '" href="', $g_scriptname, '?f=view&id=', $row['docid'], '"><i class="bi-eye"></i></a>', "\n";
|
||||
echo '<a title="', _('Edit'), '" href="', $g_scriptname, '?f=edit&id=', $row['docid'], '"><i class="bi-pencil"></i></a>', "\n";
|
||||
echo "</td>\n";
|
||||
echo "</tr>\n";
|
||||
}
|
||||
// Table summary
|
||||
echo "<tfoot>\n";
|
||||
echo '<tr><td colspan="6">', sprintf(_('%d records'), count($res)), '</td></tr>', "\n";
|
||||
echo '<tr><td colspan="6">', sprintf(_('Records %d to %d of %d'), $i0, $i, $numrows), '</td></tr>', "\n";
|
||||
echo "</tfoot>\n";
|
||||
echo "</table>\n";
|
||||
|
||||
@@ -402,7 +431,7 @@ elseif ($action == ACT_VIEW):
|
||||
/* mutool: preview of page thumbs */
|
||||
|
||||
$sql = "SELECT docid, doctype, mimetype, filename, extension, hash,"
|
||||
. " docsize, doctime, title, pages, remarks "
|
||||
. " docsize, doctime, title, pages, remarks, roleaccess "
|
||||
. "FROM document "
|
||||
. "WHERE docid=?";
|
||||
$sth = $pdo->prepare($sql);
|
||||
@@ -428,13 +457,14 @@ if ($document->doctype == 'picture') {
|
||||
echo '</div>'; // gallery
|
||||
?>
|
||||
<div class="modal fade" id="imageModal" tabindex="-1" aria-labelledby="imageModalLabel" aria-hidden="true">
|
||||
<div class="modal-dialog modal-dialog-centered">
|
||||
<div class="modal-dialog modal-dialog-centered custom-image-modal">
|
||||
<div class="modal-content">
|
||||
<div class="modal-header">
|
||||
<?=$document->title;?>
|
||||
<button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
|
||||
</div>
|
||||
<div class="modal-body">
|
||||
<img src="dl.php?id=<?=$document->docid ?>">
|
||||
<img src="dl.php?id=<?=$document->docid ?>" class="preview-image">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
Reference in New Issue
Block a user