Webgui code improvements for dropdown handling

This commit is contained in:
2026-10-01 18:10:57 +02:00
parent 131af7d9e7
commit 72571ede53
15 changed files with 63 additions and 25 deletions
+8 -2
View File
@@ -84,6 +84,8 @@ switch ($submit = form_get_action()) {
break;
case 'update':
# changing ddval would need to update all dependent data
# so this is not intended here!
$p[':ddtext'] = gpc_get_string($_POST, 'ddtext');
$p[':ddshort'] = gpc_get_string($_POST, 'ddshort');
$p[':color'] = gpc_get_color($_POST, 'color');
@@ -132,7 +134,7 @@ $sth = $pdo->query($sql);
foreach ($sth->fetchAll(PDO::FETCH_NUM) as $row) {
$num[$row[0]] = $row[1];
}
$sql = "SELECT ddval, ddtext FROM dropdown WHERE ddid=0 AND ddval>0";
$sql = "SELECT ddval, ddtext, flags FROM dropdown WHERE ddid=0 AND ddval>0";
$sth = $pdo->query($sql);
echo "<h1>$pagetitle</h1>\n";
@@ -160,7 +162,11 @@ foreach ($sth->fetchAll() as $row) {
echo '<td>', $num[$row['ddval']] ?? 0, '</td>';
// form_action_buttons($g_scriptname, $row['ddval']);
echo "<td>";
echo '<a class="text-nowrap" title="', _('Edit'), '" href="', $g_scriptname, '?f=edit&id=', $row['ddval'], '"><i class="bi bi-pencil ms-2"></i></a>';
if ($row['flags'] == 'locked') {
echo _('Locked');
} else {
echo '<a class="text-nowrap" title="', _('Edit'), '" href="', $g_scriptname, '?f=edit&id=', $row['ddval'], '"><i class="bi bi-pencil ms-2"></i></a>';
}
echo "</td>\n";
echo "</tr>\n";
}