Webgui: filters and pagination

This commit is contained in:
2024-04-15 07:34:31 +02:00
parent 806cc407eb
commit 851f7e13a2
13 changed files with 248 additions and 246 deletions
+7 -32
View File
@@ -24,9 +24,7 @@ switch ($submit = form_get_action()) {
case 'insert':
// WIP New standalone document
$p[':title'] = gpc_get_string($_POST, 'title');
$p[':remarks'] = gpc_get_string($_POST, 'remarks');
$g_message->Add(print_r($_FILES, true));
// debug $g_message->Add(print_r($_FILES, true));
if (empty($_FILES['files']['tmp_name']) ) {
$g_warning->Add(_('No file for upload submitted. Try again by selecting a file first.'));
$action = ACT_ADD;
@@ -66,6 +64,7 @@ switch ($submit = form_get_action()) {
case 'application/pdf':
$file_techname = $g_doc_basepath . '/doc-'.$file_hash.'.'.$file_ext;
$doctype = 'generic';
// $p['pages'] = pdf_get_pagecount($file_tmp);
break;
case 'image/svg+xml':
$file_techname = $g_doc_basepath . '/drw-'.$file_hash.'.'.$file_ext;
@@ -86,41 +85,17 @@ switch ($submit = form_get_action()) {
$p[':docsize'] = $file_size;
$p[':title'] = gpc_get_string($_POST, 'title');
$p[':remarks'] = gpc_get_string($_POST, 'remarks');
/* $sql = "INSERT INTO document"
. " (doctype, filename, extension, hash, doctime, docsize, mimetype) "
. "VALUES"
. " (?, ?, ?, ?, ?, ?, ?)";
$sth = $pdo->prepare($sql);
try {
$sth->execute([$doctype, $file_name, $file_ext, $file_hash, $file_timestamp, $file_size, $file_mimetype]);
} catch (PDOException $e) {
$g_error->Add('SQL-Error: '. $e->getMessage());
}
$id = $pdo->lastInsertId(); */
$id = db_exec_insert('document', $p);
move_uploaded_file($file_tmp, $file_techname);
$action = ACT_VIEW;
break;
case 'update':
$filename = gpc_get_string($_POST, 'filename');
$title = gpc_get_string($_POST, 'title', 40);
$remarks = gpc_get_string($_POST, 'remarks', 150);
$sql = "UPDATE document "
. "SET filename=:filename,"
. " title=:title,"
. " remarks=:remarks "
. "WHERE docid=:docid";
$sth = $pdo->prepare($sql);
$sth->bindValue(':docid', $id, PDO::PARAM_INT);
$sth->bindValue(':filename', $filename, PDO::PARAM_STR);
$sth->bindValue(':title', $title, PDO::PARAM_STR);
$sth->bindValue(':remarks', $remarks, PDO::PARAM_STR);
try {
$sth->execute();
} catch (PDOException $e) {
$g_error->Add('SQL-Error: '. $e->getMessage());
}
$p[':docid'] = $id;
$p['filename'] = gpc_get_string($_POST, 'filename');
$p['title'] = gpc_get_string($_POST, 'title', 40);
$p['remarks'] = gpc_get_string($_POST, 'remarks', 150);
db_exec_update('document', $p, 'docid');
$action = ACT_VIEW;
break;