From 165ab195d3530b8ca3632c24316d80328c0c63e1 Mon Sep 17 00:00:00 2001 From: Robert Sesek Date: Wed, 18 May 2005 07:10:53 +0000 Subject: [PATCH] r157: Checking in sudo-working logging code --- attachment.php | 11 ++++++----- editreport.php | 4 +++- showhistory.php | 20 +++++++++++++++++--- templates/default/history_group.tpl | 17 ++++++++++++----- 4 files changed, 38 insertions(+), 14 deletions(-) diff --git a/attachment.php b/attachment.php index 21db4de..16b260e 100755 --- a/attachment.php +++ b/attachment.php @@ -46,7 +46,7 @@ if ($_REQUEST['do'] == 'kill') $db->query("DELETE FROM " . TABLE_PREFIX . "attachment WHERE attachmentid = $attachment[attachmentid]"); - log_action($bug['bugid'], 'log_kill_attachment', array($attachment['attachmentid'])); + log_action($bug['bugid'], 'log_kill_attachment', array($attachment['attachmentid']), true); echo "attachment removed"; } @@ -120,7 +120,7 @@ if ($_POST['do'] == 'insert') ); $attachmentid = $db->insert_id(); - log_action($bug['bugid'], 'log_new_attachment', array($FILE['name'], $attachmentid)); + log_action($bug['bugid'], 'log_new_attachment', array($FILE['name'], $attachmentid), true); // mark obsoletes $obsoletes = $_POST['obsoletes']; @@ -128,7 +128,7 @@ if ($_POST['do'] == 'insert') { array_walk($obsoletes, 'intval'); $db->query("UPDATE " . TABLE_PREFIX . "attachment SET obsolete = 1 WHERE attachmentid IN (" . implode(',', $obsoletes) . ") AND !obsolete AND bugid = $bug[bugid]"); - log_action($bug['bugid'], 'log_mark_obsoletes', array($attachmentid, $FILE['name'], implode(', ', $obsoletes))); + log_action($bug['bugid'], 'log_mark_obsoletes', array($attachmentid, $FILE['name'], implode(', ', $obsoletes)), false, 'obsoleted attachments', '', implode(', ', $obsoletes)); } // handle comment stuff @@ -153,7 +153,7 @@ if ($_POST['do'] == 'insert') $commentid = $db->insert_id(); - log_action($bug['bugid'], 'log_new_attachment_comment', array($attachmentid, $commentid)); + log_action($bug['bugid'], 'log_new_attachment_comment', array($attachmentid, $commentid), true); } // update the last post data @@ -210,7 +210,8 @@ if ($_POST['do'] == 'update') $diff[0] = array_diff_assoc($attachment, $hist[1]); $diff[1] = array_diff_assoc($hist[1], $attachment); - log_action($bug['bugid'], 'log_update_attachment', array($attachment['attachmentid'], intval($bugsys->in['obsolete']))); + log_action($bug['bugid'], 'log_update_attachment', array($attachment['attachmentid']), false, 'description', $diff[0]['description'], $diff[1]['description']); + log_action($bug['bugid'], 'log_update_attachment', array($attachment['attachmentid']), false, 'obsolete', $diff[0]['obsolete'], $diff[1]['obsolete']); echo "attachment updated"; } diff --git a/editreport.php b/editreport.php index a94d430..c2e2f5e 100644 --- a/editreport.php +++ b/editreport.php @@ -129,10 +129,12 @@ if ($_POST['do'] == 'update') } $diff["$num"]["$key"] = (($thevalue) ? $thevalue . $idbit : ''); + + log_action($bug['bugid'], 'log_update_bug', array(), false, $key, $diff["$num"]["$key"], $diff["$num"]["$key"]); } } - log_action($bug['bugid'], 'log_update_bug', array(), $diff[0], $diff[1]); + //log_action($bug['bugid'], 'log_update_bug', array(), $diff[0], $diff[1]); if (!$bugsys->in['firstcomment']) { diff --git a/showhistory.php b/showhistory.php index 5fbebdb..432021e 100644 --- a/showhistory.php +++ b/showhistory.php @@ -51,12 +51,26 @@ foreach ($logs AS $dateline => $logitems) $rowspan = 1; $changes = ''; $show['changes'] = false; + $messages = array(); foreach ($logitems AS $log) { - $rowspan++; - $show['changes'] = ((empty($log['original']) AND empty($log['changed'])) ? $show['changes'] : true); - eval('$changes .= "' . $template->fetch('history_bit') . '";'); + $hasvalues = ((empty($log['original']) AND empty($log['changed'])) ? false : true); + $show['changes'] = (($hasvalues) ? true : $show['changes']); + + if ($hasvalues) + { + $rowspan++; + eval('$changes .= "' . $template->fetch('history_bit') . '";'); + } + + if (!in_array($log['formatted'], $messages)) + { + $messages[] = $log['formatted']; + } } + + $log['messages'] = implode("\n
", $messages); + eval('$history .= "' . $template->fetch('history_group') . '";'); } diff --git a/templates/default/history_group.tpl b/templates/default/history_group.tpl index 638f79c..4db4e6c 100644 --- a/templates/default/history_group.tpl +++ b/templates/default/history_group.tpl @@ -1,18 +1,25 @@ - + + + + + - $changes + $changes
+ $log[date] History Entry (entryid: $log[historyid]) -
$log[user]
+
+ $log[user] + Bug #$log[bugid] +
Changes
FieldInitialFinal
-
Bug #$log[bugid]
-
$log[formatted]
+
$log[messages]
No logged changesNo logged changes

-- 2.43.5