More webgui work. Filters e.g.

This commit is contained in:
2024-04-19 13:25:56 +02:00
parent 851f7e13a2
commit c3b5ef95a9
20 changed files with 853 additions and 585 deletions
+11 -10
View File
@@ -38,7 +38,7 @@ function create_ddval_form($script, $ddid, $formtype, $row=NULL) {
echo '<div class="col"><div class="form-floating">';
echo '<input type="color" name="color" id="color" class="form-control"';
if ($update) echo ' value="', $row['color'],'"';
if ($update) echo ' value="#', $row['color'],'"';
echo '><label for="color">Color</label></div></div>', "\n";
echo '<div class="col"><div class="form-floating">';
@@ -76,15 +76,7 @@ switch ($submit = form_get_action()) {
$p[':ddshort'] = gpc_get_string($_POST, 'ddshort');
$p[':color'] = gpc_get_color($_POST, 'color');
$p[':sort'] = gpc_get_string($_POST, 'sort');
$keys = array_keys($p);
$fields = join(',', array_map(function($s) { return ltrim($s, ':'); }, $keys));
$pnames = join(',', $keys);
$sth = $pdo->prepare("INSERT INTO dropdown ($fields) VALUES ($pnames)");
try {
$sth->execute($p);
} catch (PDOexception $e) {
$g_error->Add('SQL-Error: '. $e->getMessage());
}
db_exec_insert('dropdown', $p);
$action = ACT_EDIT;
break;
@@ -106,6 +98,15 @@ switch ($submit = form_get_action()) {
$action = ACT_EDIT;
break;
case 'delete':
// only deletable if not used anywhere!
// equipment.?
if ($v <= 0) {
$g_warning->Add(_('Selection lists are not deletable!'));
}
$g_message->Add(_('Delete not yet implemented'));
break;
default:
$g_error->Add(sprintf(_('Unknown function!'), $submit));
$valid = FALSE;