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 \*=====================================================================*/
13 require_once('./global.php');
15 if (!($env->userinfo
['permissions'] & CANSUBMITBUGS
))
21 // ###################################################################
23 if (empty($_REQUEST['do']))
25 $_REQUEST['do'] = 'add';
28 // ###################################################################
30 if ($_POST['do'] == 'insert')
45 // check permissions on various input values
46 if (!$env->userinfo
['permissions'] & CANCHANGESTATUS
)
48 unset($vars['priority'], $vars['status'], $vars['resolution']);
50 if (!$env->userinfo
['permissions'] & CANASSIGN
)
52 unset($vars['assignedto']);
56 // assigned person is not a dev or a valid user
57 if (!$env->datastore
['assignto']["$vars[assignedto]"]['userid'])
59 unset($vars['assignedto']);
64 // ###################################################################
66 if ($_REQUEST['do'] == 'add')
74 // the user can hit the back button without reposting data...
75 if (!$vars['product'] OR !$vars['component'] OR !$vars['version'])
84 echo '<form name="newbug" action="newreport.php" method="' . $method . '">';
88 if (!$vars['product'])
90 echo '<strong>Product:</strong> <select name="product">';
91 $products = $DB_sql->query("SELECT * FROM " . TABLE_PREFIX
. "product WHERE !componentmother ORDER BY displayorder ASC");
92 while ($product = $DB_sql->fetch_array($products))
94 echo "<option value=\"$product[productid]\">$product[title]</option>";
98 else if (!$vars['component'])
100 echo '<strong>Component:</strong> <select name="component"><option value="-1">No Component</option>';
101 $components = $DB_sql->query("SELECT * FROM " . TABLE_PREFIX
. "product WHERE componentmother IN ($vars[product]) ORDER BY displayorder ASC");
102 while ($component = $DB_sql->fetch_array($components))
104 echo "<option value=\"$component[productid]\">$component[title]</option>";
107 echo '<input type="hidden" name="product" value="' . $vars['product'] . '" />';
109 else if (!$vars['version'])
111 echo '<strong>Version:</strong> <select name="version">';
112 $versions = $DB_sql->query("
113 SELECT version.*, product.componentmother, product.title AS productname
114 FROM " . TABLE_PREFIX
. "version AS version
115 LEFT JOIN " . TABLE_PREFIX
. "product ON (product.productid = version.productid)
116 WHERE version.productid IN (0, $vars[product]" . iff($vars['component'] != -1, ", $vars[component]", '') . ")
117 ORDER BY version.productid, version.displayorder ASC"
120 while ($version = $DB_sql->fetch_array($versions))
122 $versionlist["$version[productid]"][] = $version;
123 $lookup["$version[productid]"] = array('componentmother' => $version['componentmother'], 'productname' => $version['productname']);
126 foreach ($versionlist AS $productid => $versions)
132 echo '<optgroup label="Global Versions">';
135 else if ($lookup["$productid"]['componentmother'])
137 echo '<optgroup label="' . $lookup["$productid"]['productname'] . '">';
141 echo '<optgroup label="' . $lookup["$productid"]['productname'] . '">';
144 foreach ($versions AS $version)
146 echo '<option value="' . $version['versionid'] . '">' . $prepend . $version['version'] . '</option>';
153 echo '<input type="hidden" name="product" value="' . $vars['product'] . '" />';
154 echo '<input type="hidden" name="component" value="' . $vars['component'] . '" />';
159 echo '<div><strong>Summary/Title:</strong> <input type="text" name="summary" size="25" /></div>';
161 echo '<div><strong>Severity:</strong> <select name="severity">';
162 foreach ($env->datastore
['severity'] AS $severity)
164 echo '<option value="' . $severity['severityid'] . '">' . $severity['severity'] . '</option>';
166 echo '</select></div>';
168 if ($env->userinfo
['permissions'] & CANCHANGESTATUS
)
170 echo '<div><strong>Priority:</strong> <select name="priority">';
171 foreach ($env->datastore
['priority'] AS $priority)
173 echo '<option value="' . $priority['priorityid'] . '">' . $priority['priority'] . '</option>';
175 echo '</select></div>';
177 echo '<div><strong>Status:</strong> <select name="status">';
178 foreach ($env->datastore
['status'] AS $status)
180 echo '<option value="' . $status['statusid'] . '">' . $status['status'] . '</option>';
182 echo '</select></div>';
184 echo '<div><strong>Resolution:</strong> <select name="resolution">';
185 foreach ($env->datastore
['resolution'] AS $resolution)
187 echo '<option value="' . $resolution['resolutionid'] . '">' . $resolution['resolution'] . '</option>';
189 echo '</select></div>';
192 if ($env->userinfo
['permissions'] & CANASSIGN
)
194 echo '<div><strong>Assigned to:</strong> <select name="assignedto"><option value="0">No Assignment</option>';
195 foreach ($env->datastore
['assignto'] AS $dev)
197 fetch_user_display_name($dev);
198 echo '<option value="' . $dev['userid'] . '">' . $dev['displayname'] . iff($dev['showemail'], ' <' . $dev['email'] . '>', '') . '</option>';
200 echo '</select></div>';
203 echo '<div><strong>Detailed description:</strong><div><textarea name="comment" rows="15" cols="75"></textarea></div></div>';
206 echo '<div><input type="hidden" name="do" value="' . $do . '" /><input type="submit" name="submit" value=" Proceed " /></div>';
211 /*=====================================================================*\
212 || ###################################################################
215 || ###################################################################
216 \*=====================================================================*/