Webgui: More mobile friendly touch and much more improvements
This commit is contained in:
+30
-7
@@ -35,6 +35,11 @@ switch ($submit = form_get_action()) {
|
||||
$action = ACT_DEFAULT;
|
||||
break;
|
||||
|
||||
case 'freset':
|
||||
db_clear_filter(206);
|
||||
$action = ACT_DEFAULT;
|
||||
break;
|
||||
|
||||
case 'insert':
|
||||
$p[':vid'] = $user->vid;
|
||||
$p[':projid'] = gpc_get_int($_POST, 'projid');
|
||||
@@ -42,6 +47,7 @@ switch ($submit = form_get_action()) {
|
||||
$p[':projid'] = NULL;
|
||||
}
|
||||
$p[':taskname'] = gpc_get_string($_POST, 'taskname');
|
||||
$p[':responsible'] = $user->id;
|
||||
$id = db_exec_insert('task', $p);
|
||||
$action = ACT_VIEW;
|
||||
break;
|
||||
@@ -62,6 +68,7 @@ switch ($submit = form_get_action()) {
|
||||
$p[':started'] = gpc_get_datetime($_POST, 'started');
|
||||
$p[':finished'] = gpc_get_datetime($_POST, 'finished');
|
||||
$p[':taskstate'] = gpc_get_enum($_POST, 'taskstate', array_keys($opt_state));
|
||||
$p[':responsible'] = gpc_get_int($_POST, 'responsible');
|
||||
db_exec_update('task', $p, 'taskid');
|
||||
$action = ACT_VIEW;
|
||||
break;
|
||||
@@ -137,7 +144,7 @@ $where = join(' AND ', $w);
|
||||
$order = ' ORDER BY t.taskid';
|
||||
|
||||
// get total recond count for pagination and limit
|
||||
$sql = "SELECT COUNT(*) FROM task";
|
||||
$sql = "SELECT COUNT(*) FROM task AS t";
|
||||
if ($where) $sql .= " WHERE $where";
|
||||
|
||||
$sth = $pdo->prepare($sql);
|
||||
@@ -147,10 +154,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 t.taskid, t.vid, t.projid, t.taskname, t.priority, t.taskstate,"
|
||||
. " p.projname "
|
||||
@@ -167,13 +176,14 @@ try {
|
||||
$g_error->Add('SQL-Error: '. $e->getMessage());
|
||||
$g_error->Add($sql);
|
||||
$g_error->Add(print_r($p, true));
|
||||
$g_error->Printout();
|
||||
}
|
||||
$res = $sth->fetchAll();
|
||||
|
||||
?>
|
||||
<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">
|
||||
<?php
|
||||
filter_create_select('flt_prio', _('Priority'), $g_opt_all + $g_opt_none + $opt_priority, $flt->prio);
|
||||
@@ -200,16 +210,23 @@ echo "<th></th>";
|
||||
echo "<th></th>\n";
|
||||
echo "</tr>\n";
|
||||
echo "</thead>\n";
|
||||
$i = ($page - 1) * $rows_pp;
|
||||
$i0 = $i + 1;
|
||||
foreach ($res as $row) {
|
||||
$i++; // record number
|
||||
echo "<tr>\n";
|
||||
// mark generic tasks with braces
|
||||
echo "<td>", $row['vid'] ? $row['taskid'] : '('.$row['taskid'].')', "</td>\n";
|
||||
echo "<td>", $row['vid'] ? $i : "($i)";
|
||||
echo '<a class="text-nowrap" title="', _('View'), '" href="', $g_scriptname, '?f=view&id=', $row['taskid'], '"><i class="bi bi-eye ms-2"></i></a>';
|
||||
echo "</td>\n";
|
||||
echo "<td>", $row['taskname'], "</td>\n";
|
||||
echo "<td>", $row['projname'], "</td>\n";
|
||||
echo "<td>", ($opt_priority[$row['priority']] ?? ''), "</td>\n";
|
||||
echo "<td>", ($opt_state[$row['taskstate']]), "</td>\n";
|
||||
// Action buttons
|
||||
form_action_buttons($g_scriptname, $row['taskid']);
|
||||
// Edit current record button
|
||||
echo "<td>";
|
||||
echo '<a title="', _('Edit'), '" href="', $g_scriptname, '?f=edit&id=', $row['taskid'], '"><i class="bi-pencil"></i></a>', "\n";
|
||||
echo "</td>\n";
|
||||
echo "</tr>\n";
|
||||
}
|
||||
// Table summary
|
||||
@@ -247,8 +264,10 @@ elseif ($action == ACT_VIEW):
|
||||
// ========== VARIANT: view single record =====================================
|
||||
|
||||
$sql = "SELECT t.taskname, t.priority, t.plandate, t.duedate,"
|
||||
. " t.started, t.finished, t.taskstate, p.projname "
|
||||
. " t.started, t.finished, t.taskstate, t.responsible,"
|
||||
. " u.displayname, p.projname "
|
||||
. "FROM task AS t LEFT JOIN project AS p USING (projid) "
|
||||
. " LEFT JOIN user AS u ON (t.responsible=u.userid) "
|
||||
. "WHERE taskid=?";
|
||||
$sth = $pdo->prepare($sql);
|
||||
$sth->execute([$id]);
|
||||
@@ -264,6 +283,7 @@ echo '<tr><th>', _('Due date'),"</th><td>", $task->duedate, "</td></tr>\n";
|
||||
echo '<tr><th>', _('Started at'),"</th><td>", $task->started, "</td></tr>\n";
|
||||
echo '<tr><th>', _('Finished at'),"</th><td>", $task->finished, "</td></tr>\n";
|
||||
echo '<tr><th>', _('Status'),"</th><td>", $opt_state[$task->taskstate], "</td></tr>\n";
|
||||
echo '<tr><th>', _('Responsible'),"</th><td>", $task->displayname, "</td></tr>\n";
|
||||
echo "</table>\n";
|
||||
|
||||
form_view_buttons($g_scriptname, $id);
|
||||
@@ -297,6 +317,8 @@ echo '<p>', _('Not yet implemented'), "</p>";
|
||||
elseif ($action == ACT_EDIT):
|
||||
// ========== VARIANT: edit single record =====================================
|
||||
|
||||
$opt_user = db_get_opt_user($user->id); // only used here
|
||||
|
||||
$sql = "SELECT taskname, projid, priority, plandate, duedate, started, finished,"
|
||||
. " taskstate "
|
||||
. "FROM task "
|
||||
@@ -337,6 +359,7 @@ form_create_select('priority', _('Priority'), $opt_none + $opt_priority, $task->
|
||||
</div>
|
||||
<?php
|
||||
form_create_select('taskstate', _('Status'), $opt_state, $task->taskstate);
|
||||
form_create_select('responsible', _('Responsible'), $opt_user, $user->id);
|
||||
|
||||
form_edit_buttons($g_scriptname, $id);
|
||||
echo "</form>\n";
|
||||
|
||||
Reference in New Issue
Block a user