More work an webgui
This commit is contained in:
+16
-6
@@ -24,8 +24,8 @@ switch ($submit = form_get_action()) {
|
||||
|
||||
case 'insert':
|
||||
// WIP New standalone document
|
||||
$title = gpc_get_string($_POST, 'title');
|
||||
$remarks = gpc_get_string($_POST, 'remarks');
|
||||
$p[':title'] = gpc_get_string($_POST, 'title');
|
||||
$p[':remarks'] = gpc_get_string($_POST, 'remarks');
|
||||
$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.'));
|
||||
@@ -77,7 +77,16 @@ switch ($submit = form_get_action()) {
|
||||
$doctype = 'picture';
|
||||
break;
|
||||
}
|
||||
$sql = "INSERT INTO document"
|
||||
$p[':doctype'] = $doctype;
|
||||
$p[':mimetype'] = $file_mimetype;
|
||||
$p[':filename'] = $file_name;
|
||||
$p[':extension'] = $file_ext;
|
||||
$p[':hash'] = $file_hash;
|
||||
$p[':doctime'] = $file_timestamp;
|
||||
$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"
|
||||
. " (?, ?, ?, ?, ?, ?, ?)";
|
||||
@@ -87,7 +96,8 @@ switch ($submit = form_get_action()) {
|
||||
} catch (PDOException $e) {
|
||||
$g_error->Add('SQL-Error: '. $e->getMessage());
|
||||
}
|
||||
$id = $pdo->lastInsertId();
|
||||
$id = $pdo->lastInsertId(); */
|
||||
$id = db_exec_insert('document', $p);
|
||||
move_uploaded_file($file_tmp, $file_techname);
|
||||
$action = ACT_VIEW;
|
||||
break;
|
||||
@@ -366,7 +376,7 @@ $sth->execute([$id]);
|
||||
$document = $sth->fetch(PDO::FETCH_OBJ);
|
||||
|
||||
if ($document->doctype == 'picture') {
|
||||
echo '<img width="', $g_thumb_size, '" src="doc/pic-', $document->hash, '.', $document->extension, '">';
|
||||
echo '<img width="', $g_thumb_size, '" src="dl.php?id=', $document->docid, '">';
|
||||
}
|
||||
|
||||
?>
|
||||
@@ -382,7 +392,7 @@ if ($document->doctype == 'picture') {
|
||||
</div>
|
||||
<div class="mb-3">
|
||||
<label for="remarks" class="form-label"><?=_('Remarks')?></label>
|
||||
<textarea class="form-control" id="remarks" name="remarks" rows="3"><?=$storage->remarks ?></textarea>
|
||||
<textarea class="form-control" id="remarks" name="remarks" rows="3"><?=$document->remarks ?></textarea>
|
||||
</div>
|
||||
<button type="submit" name="submit[update]" class="btn btn-primary"><?=_('Save')?></button>
|
||||
<a href="<?=$g_scriptname?>?f=view&id=<?=$id?>" class="btn btn-secondary"><?=_('Back')?></a>
|
||||
|
||||
Reference in New Issue
Block a user