r15: Basic bug viewing.
[bugdar.git] / showreport.php
1 <?php
2 /*=====================================================================*\
3 || ################################################################### ||
4 || # [#]app[#] [#]version[#]
5 || # --------------------------------------------------------------- # ||
6 || # All parts of this file are ©2003-[#]year[#] Iris Studios, Inc. No # ||
7 || # part of this file may be reproduced in any way: part or whole. # ||
8 || # --------------------------------------------------------------- # ||
9 || # ©2003 - [#]year[#] Iris Studios, Inc. | http://www.iris-studios.com # ||
10 || ################################################################### ||
11 \*=====================================================================*/
12
13 require_once('./global.php');
14
15 if (!($bugsys->userinfo['permissions'] & CANVIEWBUGS))
16 {
17 echo 'no permission';
18 exit;
19 }
20
21 // ###################################################################
22
23 if (empty($_REQUEST['do']))
24 {
25 $_REQUEST['do'] = 'modify';
26 }
27
28 // ###################################################################
29
30 if ($_REQUEST['do'] == 'modify')
31 {
32 sanitize(array('bugid' => INT));
33
34 if (!$vars['bugid'])
35 {
36 echo 'alert: bad bug';
37 exit;
38 }
39
40 $bugfetch = $DB_sql->query("
41 SELECT bug.*, user1.displayname, user1.email, user1.showemail,
42 comment.userid AS posterid, user2.displayname AS postedby,
43 user2.email AS posteremail, user2.showemail AS postershowemail,
44 comment.comment, comment.dateline AS postedon
45 FROM " . TABLE_PREFIX . "bug AS bug
46 LEFT JOIN " . TABLE_PREFIX . "comment AS comment
47 ON (bug.bugid = comment.bugid)
48 LEFT JOIN " . TABLE_PREFIX . "user AS user1
49 ON (bug.userid = user1.userid)
50 LEFT JOIN " . TABLE_PREFIX . "user AS user2
51 ON (comment.userid = user1.userid)
52 WHERE bug.bugid = $vars[bugid]
53 ORDER BY comment.dateline ASC"
54 );
55 while ($buginfo = $DB_sql->fetch_array($bugfetch))
56 {
57 if (!is_array($bug))
58 {
59 $bug = array(
60 'bugid' => $buginfo['bugid'],
61 'userid' => $buginfo['userid'],
62 'displayname' => $buginfo['displayname'],
63 'email' => $buginfo['email'],
64 'showemail' => $buginfo['showemail'],
65 'productid' => $buginfo['productid'],
66 'componentid' => $buginfo['componentid'],
67 'versionid' => $buginfo['versionid'],
68 'summary' => $buginfo['summary'],
69 'priority' => $buginfo['priority'],
70 'severity' => $buginfo['severity'],
71 'status' => $buginfo['status'],
72 'resolution' => $buginfo['resolution'],
73 'assignedto' => $buginfo['assignedto']
74 );
75 }
76 $comments[] = array(
77 'userid' => $buginfo['posterid'],
78 'displayname' => $buginfo['displayname'],
79 'email' => $buginfo['posteremail'],
80 'showemail' => $buginfo['postershowemail'],
81 'dateline' => $buginfo['postedon'],
82 'comment' => $buginfo['comment']
83 );
84 }
85
86 echo "<div><strong>Bug ID:</strong> $bug[bugid]</div>";
87 echo "<div><strong>Reported by:</strong> $bug[displayname]" . iff($bug['showemail'], " &lt;$bug[email]&gt;") . " (userid: $bug[userid])</div>";
88 echo "<div><strong>Product:</strong> " . $bugsys->datastore['product']["$bug[productid]"]['title'] . iff($bug['componentid'], ' / <strong>Component:</strong>' . $bugsys->datastore['product']["$bug[componentid]"]['title'] . '</strong>') . ' / <strong>Version:</strong> ' . $bugsys->datastore['version']["$bug[versionid]"]['version'] . "</div>";
89 echo "<div><strong>Title / summary:</strong> $bug[summary]</div>";
90 echo "<div><strong>Status:</strong> " . $bugsys->datastore['status']["$bug[status]"]['status'] . " / <strong>Resolution:</strong> " . $bugsys->datastore['resolution']["$bug[resolution]"]['resolution'] . "</div>";
91 echo "<div><strong>Severity:</strong> " . $bugsys->datastore['severity']["$bug[severity]"]['severity'] . "</div>";
92 echo "<div><strong>Priority:</strong> " . $bugsys->datastore['priority']["$bug[priority]"]['priority'] . "</div>";
93 $assigninfo = $bugsys->datastore['assignto']["$bug[assignedto]"];
94 echo iff(is_array($assigninfo), "<div><strong>Assigned to:</strong> " . $assigninfo['displayname'] . iff($assigninfo['showemail'], " &lt;$assigninfo[email]&gt;") . " (userid: $assigninfo[userid])</div>");
95
96 echo '<br />';
97
98 foreach ($comments AS $comment)
99 {
100 echo '<table border="1" cellspacing="2" cellpadding="4" width="100%"><tr style="background-color:#EEEEEE"><td><span style="float:right">' . datelike('standard', $comment['dateline']) . '</span>' . $comment['displayname'] . iff($comment['showemail'], " &lt;$comment[email]&gt;") . " (userid: $comment[userid])</td></tr>";
101 echo "<tr><td>" . nl2br($comment['comment']) . "</td></tr></table>";
102 }
103
104 /*print_r($bug);
105 print_r($comments);*/
106 }
107
108 /*=====================================================================*\
109 || ###################################################################
110 || # $HeadURL$
111 || # $Id$
112 || ###################################################################
113 \*=====================================================================*/
114 ?>