Some database improvements and associated changes in webgui
This commit is contained in:
+8
-3
@@ -7,6 +7,7 @@
|
||||
******************************************************************************/
|
||||
|
||||
require 'globals.inc';
|
||||
require 'lib/db.inc';
|
||||
require 'lib/gpc.inc';
|
||||
|
||||
$pagetitle = _('Note');
|
||||
@@ -30,6 +31,7 @@ switch ($submit = form_get_action()) {
|
||||
$p[':notetype'] = gpc_get_enum($_POST, 'notetype', $opt_notetype, 'task');
|
||||
$p[':refid'] = gpc_get_int($_POST, 'refid');
|
||||
$p[':annotation'] = gpc_get_string($_POST, 'annotation');
|
||||
$p[':created_by'] = $user->id;
|
||||
$id = db_exec_insert('note', $p);
|
||||
$caller = gpc_get_string($_POST, 'caller');
|
||||
$callid = $p[':refid'];
|
||||
@@ -171,7 +173,9 @@ elseif ($action == ACT_VIEW):
|
||||
|
||||
echo '<h2>', _('View Note'), "</h2>\n";
|
||||
|
||||
$sql = "SELECT refid, notetype, annotation FROM note WHERE noteid=?";
|
||||
$sql = "SELECT n.refid, n.notetype, n.annotation, n.created_at, u.displayname "
|
||||
. "FROM note AS n LEFT OUTER JOIN user AS u ON (n.created_by=u.userid) "
|
||||
. "WHERE noteid=?";
|
||||
$sth = $pdo->prepare($sql);
|
||||
$sth->execute([$id]);
|
||||
$note = $sth->fetch(PDO::FETCH_OBJ);
|
||||
@@ -184,9 +188,10 @@ echo '<table class="table">', "\n";
|
||||
echo '<tr><th>', _('Reference'),"</th><td>", $note->refid, "</td></tr>\n";
|
||||
echo '<tr><th>', _('Type'),"</th><td>", $note->notetype, "</td></tr>\n";
|
||||
echo '<tr><th>', _('Annotation'),"</th><td>", nl2br($note->annotation), "</td></tr>\n";
|
||||
echo '<tr><th>', _('Created at'),"</th><td>", format_datetime($note->created_at), "</td></tr>\n";
|
||||
echo '<tr><th>', _('Created by'),"</th><td>", h($note->displayname), "</td></tr>\n";
|
||||
echo "</table>\n";
|
||||
|
||||
|
||||
$link = $note->notetype == 'task' ? 'task.php' : 'maintenance.php';
|
||||
// echo '<p><a href="', $link, '?f=view&id=', $note->refid, '">', _('Parent'), "</a></p>\n";
|
||||
form_view_buttons($g_scriptname, $id, $link.'?f=view&id='.$note->refid);
|
||||
@@ -205,7 +210,7 @@ echo '<h2>', _('Edit Note'), "</h2>\n";
|
||||
<input type="hidden" name="id" value="<?=$id?>">
|
||||
<div class="mb-3">
|
||||
<label for="annotation" class="form-label"><?=_('Annotation')?></label>
|
||||
<textarea class="form-control" id="annotation" name="annotation" rows="5" autofocus><?=$note->annotation;?></textarea>
|
||||
<textarea class="form-control" id="annotation" name="annotation" rows="5" autofocus><?=h($note->annotation, br:true);?></textarea>
|
||||
</div>
|
||||
<?php
|
||||
form_edit_buttons($g_scriptname, $id);
|
||||
|
||||
Reference in New Issue
Block a user