]>
src.bluestatic.org Git - bugdar.git/blob - showhistory.php
2 /*=====================================================================*\
3 || ###################################################################
4 || # Bugdar [#]version[#]
5 || # Copyright ©2002-[#]year[#] Iris Studios, Inc.
7 || # This program is free software; you can redistribute it and/or modify
8 || # it under the terms of the GNU General Public License as published by
9 || # the Free Software Foundation; version [#]gpl[#] of the License.
11 || # This program is distributed in the hope that it will be useful, but
12 || # WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
13 || # or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
16 || # You should have received a copy of the GNU General Public License along
17 || # with this program; if not, write to the Free Software Foundation, Inc.,
18 || # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
19 || ###################################################################
20 \*=====================================================================*/
22 $fetchtemplates = array(
27 define('SVN', '$Id$');
29 $focus['showreport
'] = 'focus
';
31 require_once('./global.php
');
32 require_once('./includes
/api_user
.php
');
34 $bug = $db->query_first("SELECT * FROM " . TABLE_PREFIX . "bug WHERE bugid = " . intval($bugsys->in['bugid
']));
37 $message->error($lang->getlex('error_invalid_id
'));
40 if (($bug['hidden
'] AND !can_perform('canviewhidden
', $bug['productid
'])) OR !can_perform('canviewbugs
', $bug['productid
']))
42 $message->error_permission();
45 $lookupfields = array(
47 'priority
' => 'priority
',
48 'secerity
' => 'severity
',
49 'resolution
' => 'resolution
',
50 'versionid
' => 'version
',
51 'version
' => 'version
',
52 'productid
' => 'product
',
53 'componentid
' => 'product
'
55 $lookupkeys = array_keys($lookupfields);
57 // ###################################################################
59 $customfields = $db->query("
61 FROM " . TABLE_PREFIX . "bugfield AS bugfield
62 LEFT JOIN " . TABLE_PREFIX . "bugfieldpermission AS permission
63 ON (bugfield.fieldid = permission.fieldid)
64 WHERE permission.mask <> 0
65 AND permission.usergroupid = {$bugsys->userinfo['usergroupid']}"
68 while ($field = $db->fetch_array($customfields))
70 $fieldlist["custom.field$field[fieldid]"] = sprintf($lang->string('Custom Field %
1$s (%
2$s)'), $field['fieldid
'], $field['name
']);
73 // ###################################################################
76 $logs_fetch = $db->query("
77 SELECT history.*, user.userid, user.email, user.displayname, user.showemail
78 FROM " . TABLE_PREFIX . "history AS history
79 LEFT JOIN " . TABLE_PREFIX . "user AS user
80 ON (user.userid = history.userid)
81 WHERE bugid = $bug[bugid]"
83 while ($log = $db->fetch_array($logs_fetch))
85 $log['date
'] = $datef->format($bugsys->options['dateformat
'], $log['dateline
']);
86 $log['user
'] = construct_user_display($log);
88 $logs["$log[dateline]"]["$log[historyid]"] = $log;
89 ksort($logs["$log[dateline]"]);
94 foreach ($logs AS $dateline => $logitems)
96 $show['group
'] = true;
98 foreach ($logitems AS $log)
100 if ($log['field
'] == '.' OR ($log['original
'] == '' AND $log['changed
'] == ''))
105 $funct->exec_swap_bg('', $stylevar['alt_colour
']);
106 $bgcolour = $funct->bgcolour;
108 if (preg_match('#^(comment|attachment)\.(.*)#', $log['field'], $matches))
110 if ($matches[1] == 'comment')
112 $log['field'] = sprintf($lang->string('Comment #%1$s %2$s'), $log['commentid
'], ucwords($matches[2]));
114 else if ($matches[1] == 'attachment
')
116 $log['field
'] = sprintf($lang->string('Attachment
#2%1$s %2$s'), $log['attachmentid'], ucwords($matches[2]));
119 else if (preg_match('#^custom.field([0-9]+?)#', $log['field'], $matches))
121 if ($fieldlist["$log[field]"])
123 $log['field'] = $fieldlist["$log[field]"];
126 else if (preg_match('#^\.(.*)#', $log['field'], $matches))
128 $log['field'] = ucwords($matches[1]);
130 if (in_array($matches[1], $lookupkeys))
132 $lookup = $lookupfields["$matches[1]"];
133 $log['original'] = $bugsys->datastore
[ $lookupfields["$lookup"] ]["$log[original
]"]["$lookup"];
134 $log['changed'] = $bugsys->datastore
[ $lookupfields["$lookup"] ]["$log[changed
]"]["$lookup"];
136 else if ($matches[1] == 'assignto' OR $matches[1] == 'assignedto')
138 if ($log['original'])
140 $user = new UserAPI($bugsys);
141 $user->set('userid', $log['original']);
142 $user->set_condition();
144 $log['original'] = construct_user_display($user->objdata
);
149 $user = new UserAPI($bugsys);
150 $user->set('userid', $log['changed']);
151 $user->set_condition();
153 $log['changed'] = construct_user_display($user->objdata
);
158 eval('$history .= "' . $template->fetch('history_bit') . '";');
159 $show['group'] = false;
163 eval('$template->flush("' . $template->fetch('history') . '");');
165 /*=====================================================================*\
166 || ###################################################################
169 || ###################################################################
170 \*=====================================================================*/