r765: Say hello to the GPL
[bugdar.git] / explain.php
1 <?php
2 /*=====================================================================*\
3 || ###################################################################
4 || # Bugdar [#]version[#]
5 || # Copyright ©2002-[#]year[#] Iris Studios, Inc.
6 || #
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.
10 || #
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
14 || # more details.
15 || #
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 \*=====================================================================*/
21
22 $fetchtemplates = array(
23 'explain_product',
24 'explain_autoaction',
25 'explain_row'
26 );
27
28 define('SVN', '$Id$');
29
30 $focus['showreport'] = 'focus';
31
32 require_once('./global.php');
33
34 // ###################################################################
35
36 if (empty($_REQUEST['do']))
37 {
38 $_REQUEST['do'] = 'products';
39 }
40
41 // ###################################################################
42
43 if ($_REQUEST['do'] == 'products')
44 {
45 foreach ($bugsys->datastore['product'] AS $product)
46 {
47 if ($product['componentmother'])
48 {
49 $components["$product[componentmother]"]["$product[productid]"] = $product;
50 }
51 else
52 {
53 $products["$product[productid]"] = $product;
54 }
55 }
56
57 foreach ($bugsys->datastore['version'] AS $version)
58 {
59 $versions["$version[productid]"]["$version[versionid]"] = $version;
60 }
61
62 // global versions
63 foreach ($versions['0'] AS $version)
64 {
65 $left = $version['version'];
66 $right = null;
67 eval('$globalversions .= "' . $template->fetch('explain_row') . '";');
68 }
69
70 foreach ($products AS $product)
71 {
72 $left = $product['title'];
73 $right = $product['description'];
74 $trextra = ' style="background-color: ' . $stylevar['alt_colour'] . '"';
75 eval('$productlist .= "' . $template->fetch('explain_row') . '";');
76
77 foreach ($components["$product[productid]"] AS $component)
78 {
79 $left = '&nbsp; &rsaquo; &nbsp; ' . $component['title'];
80 $right = $component['description'];
81 $trextra = '';
82 eval('$productlist .= "' . $template->fetch('explain_row') . '";');
83 }
84 }
85
86 eval('$template->flush("' . $template->fetch('explain_product') . '");');
87 }
88
89 // ###################################################################
90
91 if ($_REQUEST['do'] == 'autoactions')
92 {
93 $fields_fetch = $bugsys->db->query("
94 SELECT bugfield.*, permission.mask
95 FROM " . TABLE_PREFIX . "bugfield AS bugfield
96 LEFT JOIN " . TABLE_PREFIX . "bugfieldpermission AS permission
97 ON (bugfield.fieldid = permission.fieldid)
98 WHERE (permission.mask = 2 OR permission.mask = 1)
99 AND permission.usergroupid = {$bugsys->userinfo['usergroupid']}"
100 );
101 while ($field = $bugsys->db->fetch_array($fields_fetch))
102 {
103 $fields["$field[fieldid]"] = $field;
104 }
105
106 foreach ($bugsys->datastore['autoaction'] AS $autoaction)
107 {
108 $autoaction['fieldchanges'] = unserialize($autoaction['fieldchanges']);
109
110 $left = $autoaction['name'];
111 $right = $autoaction['description'];
112 $trextra = ' class="listinghead"';
113
114 eval('$autoactions .= "' . $template->fetch('explain_row') . '";');
115
116 if ($autoaction['comment'])
117 {
118 $left = $lang->string('Add Comment');
119 $right = $autoaction['comment'];
120 $trextra = ' style="background-color: ' . $stylevar['alt_colour'] . '"';
121
122 eval('$autoactions .= "' . $template->fetch('explain_row') . '";');
123 }
124
125 $trextra = '';
126
127 foreach ($autoaction['fieldchanges']['builtin'] AS $name => $value)
128 {
129 $left = $name;
130 $right = $bugsys->datastore["$left"]["$value"]["$left"];
131 eval('$autoactions .= "' . $template->fetch('explain_row') . '";');
132 }
133
134 foreach ($autoaction['fieldchanges']['custom'] AS $id => $value)
135 {
136 if (!$fields["$id"])
137 {
138 continue;
139 }
140
141 $left = $fields["$id"]['name'] . ' ' . sprintf($lang->string('(Custom #%1$d, type: %2$s)'), $id, $fields["$id"]['type']);
142 $right = $value;
143 eval('$autoactions .= "' . $template->fetch('explain_row') . '";');
144 }
145 }
146
147 eval('$template->flush("' . $template->fetch('explain_autoaction') . '");');
148 }
149
150 /*=====================================================================*\
151 || ###################################################################
152 || # $HeadURL$
153 || # $Id$
154 || ###################################################################
155 \*=====================================================================*/
156 ?>