From 0c71b79afac25b8477bdc96f932a1f1922df5e03 Mon Sep 17 00:00:00 2001 From: Robert Sesek Date: Sat, 23 Jul 2005 22:18:39 +0000 Subject: [PATCH] r324: Comment adding is now done on showreport.php --- editreport.php | 75 ++++++++++++++++++---------------------- newcomment.php | 24 ------------- showreport.php | 4 +-- templates/newcomment.tpl | 27 --------------- templates/showreport.tpl | 23 ++++++++++-- 5 files changed, 54 insertions(+), 99 deletions(-) delete mode 100644 templates/newcomment.tpl diff --git a/editreport.php b/editreport.php index cf65488..97ceafc 100644 --- a/editreport.php +++ b/editreport.php @@ -48,13 +48,6 @@ $log->bugid = $bug['bugid']; // ################################################################### -if (empty($_REQUEST['do'])) -{ - $_REQUEST['do'] = 'edit'; -} - -// ################################################################### - if ($_POST['do'] == 'update') { $pcv = parse_pcv_select($bugsys->in['pcv_select'], true); @@ -207,60 +200,58 @@ if ($_POST['do'] == 'update') // ------------------------------------------------------------------- // process comment stuff - /* - if (!$bugsys->in['firstcomment']) - { - $message->error('you need to enter some text in the first comment'); - } - $bugsys->in['comment_parsed'] = $bugsys->in['firstcomment']; - - if (!$bugsys->options['allowhtml']) - { - $bugsys->in['comment_parsed'] = $bugsys->sanitize($bugsys->in['comment_parsed']); - } - - // we could pass this as a GET param, but that's unsafe - $firstcomment = $db->query_first("SELECT * FROM " . TABLE_PREFIX . "comment WHERE bugid = $bug[bugid] ORDER BY dateline ASC LIMIT 1"); - - $db->query(" - UPDATE " . TABLE_PREFIX . "comment - SET comment = '" . $bugsys->in['firstcomment'] . "', - comment_parsed = '" . nl2br($bugsys->in['comment_parsed']) . "' - WHERE commentid = $firstcomment[commentid]" - ); - */ - // ------------------------------------------------------------------- - // auto action comment + $hascomment = (!empty($bugsys->in['comment'])) ? true : false; - if ($autoaction['comment']) + if ($hascomment OR $autoaction['comment']) { - $comment = $autoaction['comment']; + if ($hascomment AND $autoaction['comment']) + { + $bugsys->in['comment'] .= "\n\n--------------- AUTOMATIC RESPONSE ---------------\n" . $autoaction['comment']; + } + else if (!$hascomment AND $autoaction['comment']) + { + $bugsys->in['comment'] = $autoaction['comment']; + } + + $bugsys->in['comment_parsed'] = $bugsys->in['comment']; + if (!$bugsys->options['allowhtml']) { - $comment_parsed = $bugsys->sanitize($comment); + $bugsys->in['comment_parsed'] = $bugsys->sanitize($bugsys->in['comment_parsed']); } + $time = TIMENOW; + $db->query(" - INSERT INTO comment + INSERT INTO " . TABLE_PREFIX . "comment (bugid, userid, dateline, comment, comment_parsed) VALUES - ($bug[bugid], " . $bugsys->userinfo['userid'] . ", " . LOG_TIME . ", - '" . $bugsys->escape($comment) . "', - '" . $bugsys->escape($comment_parsed) . "' + (" . intval($bugsys->in['bugid']) . ", " . $bugsys->userinfo['userid'] . ", + $time, '" . $bugsys->in['comment'] . "', + '" . nl2br($bugsys->in['comment_parsed']) . "' )" ); + $commentid = $db->insert_id(); + $db->query(" UPDATE " . TABLE_PREFIX . "bug - SET lastposttime = " . LOG_TIME . ", + SET lastposttime = $time, lastpostby = " . $bugsys->userinfo['userid'] . ", - hiddenlastposttime = " . LOG_TIME . ", + hiddenlastposttime = $time, hiddenlastpostby = " . $bugsys->userinfo['userid'] . " - WHERE bugid = $bug[bugid]" + WHERE bugid = " . intval($bugsys->in['bugid']) ); + + if ($hascomment) + { + $log->language = 'log_new_comment'; + $log->arguments = array($commentid); + $log->log(); + } } - + $message->redirect('done with update bug', "showreport.php?bugid=$bug[bugid]"); } diff --git a/newcomment.php b/newcomment.php index 52d033e..9449801 100644 --- a/newcomment.php +++ b/newcomment.php @@ -10,10 +10,6 @@ || ################################################################### || \*=====================================================================*/ -$fetchtemplates = array( - 'newcomment' -); - define('SVN', '$Id$'); require_once('./global.php'); @@ -25,13 +21,6 @@ if (!can_perform('canpostcomments')) // ################################################################### -if (empty($_REQUEST['do'])) -{ - $_REQUEST['do'] = 'add'; -} - -// ################################################################### - if ($_POST['do'] == 'insert') { $bugsys->in['comment_parsed'] = $bugsys->in['comment']; @@ -75,19 +64,6 @@ if ($_POST['do'] == 'insert') $message->redirect('comment inesrted', "showreport.php?bugid=" . intval($bugsys->in['bugid'])); } -// ################################################################### - -if ($_REQUEST['do'] == 'add') -{ - $bug = $db->query_first("SELECT bug.*, comment.comment FROM " . TABLE_PREFIX . "bug AS bug LEFT JOIN " . TABLE_PREFIX . "comment AS comment ON (bug.bugid = comment.bugid) WHERE bug.bugid = " . intval($bugsys->in['bugid'])); - if (!$bug) - { - $message->error('alert: bad bug'); - } - - eval('$template->flush("' . $template->fetch('newcomment') . '");'); -} - /*=====================================================================*\ || ################################################################### || # $HeadURL$ diff --git a/showreport.php b/showreport.php index 33adcb2..5fb7f4e 100644 --- a/showreport.php +++ b/showreport.php @@ -169,9 +169,7 @@ else $assigninfo = $bugsys->datastore['assignto']["$bug[assignedto]"]; $bug['assigninfo'] = ((is_array($assigninfo)) ? construct_user_display($assigninfo) : ''); - - $show['editreport'] = ((((can_perform('caneditown') AND $bugsys->userinfo['userid'] == $comment['userid']) OR can_perform('caneditothers')) AND can_perform('caneditinfo')) ? true : false); - + $duplicateof = $db->query_first("SELECT bugid, summary FROM " . TABLE_PREFIX . "bug WHERE bugid = $bug[duplicateof]"); $duplicates = $db->query("SELECT bugid, summary FROM " . TABLE_PREFIX . "bug WHERE duplicateof = $bug[bugid]"); diff --git a/templates/newcomment.tpl b/templates/newcomment.tpl deleted file mode 100644 index 7b743a5..0000000 --- a/templates/newcomment.tpl +++ /dev/null @@ -1,27 +0,0 @@ -$doctype -$headinclude -$header - -
New comment for: $bug[summary]
- -
- - -
Comment:
- -
-
- -
-
- - - - - - - - -
Summary Report:$bug[summary]
$bug[comment]
- -$footer \ No newline at end of file diff --git a/templates/showreport.tpl b/templates/showreport.tpl index c269a58..d3c8c2e 100644 --- a/templates/showreport.tpl +++ b/templates/showreport.tpl @@ -2,9 +2,11 @@ $doctype $headinclude $header -
- - + + + + +
style="color: red">Hidden: checked="checked" />
@@ -42,6 +44,11 @@ $header $customfields + + +
Comment:
+ +
Product: $bug[product] / Component: $bug[component] / Version: $bug[version]
Title / summary: $bug[summary]
@@ -53,6 +60,16 @@ $header
Bugs marked as duplicates of this: $dupelist
Dependencies: $dependencies
$customfields + + + + + +
Comment:
+ +
+ +
-- 2.43.5