cvs: php-bugs-web / bug.php milestone.php style.css
| From: | Wez Furlong | Date: | Sun, 09 Oct 2005 23:03:00 +0000 |
| Subject: | cvs: php-bugs-web / bug.php milestone.php style.css | ||
| Groups: | php.mirrors | ||
| Request: | Send a blank email to php-mirrors+get-29548@lists.php.net to get a copy of this message | ||
wez Sun Oct 9 19:03:00 2005 EDT
Added files:
/php-bugs-web milestone.php
Modified files:
/php-bugs-web bug.php style.css
Log:
add support for tagging bugs with a milestone
http://cvs.php.net/diff.php/php-bugs-web/bug.php?r1=1.77&r2=1.78&ty=u
Index: php-bugs-web/bug.php
diff -u php-bugs-web/bug.php:1.77 php-bugs-web/bug.php:1.78
--- php-bugs-web/bug.php:1.77 Sun May 8 12:04:08 2005
+++ php-bugs-web/bug.php Sun Oct 9 19:02:58 2005
@@ -13,6 +13,22 @@
require_once 'cvs-auth.inc';
require_once 'trusted-devs.inc';
+function show_milestones($current, $default="")
+{
+ $q = mysql_query("select id, name from bugdb_milestones order by name");
+ if (!$current && !$default) {
+ echo "<option value=\"NULL\">--Please Select--</option>\n";
+ } elseif (!$current) {
+ $current = $default;
+ }
+ while (($row = mysql_fetch_assoc($q))) {
+ echo "<option value=\"$row[id]\"" .
+ ($current == $row['id'] ? " selected" : "") . ">"
+ . htmlspecialchars($row['name']) . "</option>";
+ }
+}
+
+
$mail_bugs_to = 'php-bugs@lists.php.net';
if (isset($save) && isset($pw)) { # non-developers don't have $user set
@@ -30,7 +46,7 @@
# fetch info about the bug into $bug
$query = "SELECT id,bug_type,email,passwd,sdesc,ldesc,"
- . "php_version,php_os,status,ts1,ts2,assign,"
+ . "php_version,php_os,status,ts1,ts2,assign,milestone_id,"
. "UNIX_TIMESTAMP(ts1) AS submitted, UNIX_TIMESTAMP(ts2) AS modified,"
. "COUNT(bug=id) AS votes,"
. "SUM(reproduced) AS reproduced,SUM(tried) AS tried,"
@@ -189,7 +205,7 @@
if (!$errors && !($errors = incoming_details_are_valid($in))) {
$query = 'UPDATE bugdb SET ';
$query.= ($bug['email'] != $in['email'] &&
!empty($in['email'])) ? "email='" . $in['email'] . "',
" : '';
- $query.= "sdesc='$in[sdesc]', status='$in[status]',
bug_type='$in[bug_type]', assign='$in[assign]',
php_version='$in[php_version]', php_os='$in[php_os]', ts2=NOW() WHERE
id=$id";
+ $query.= "sdesc='$in[sdesc]', status='$in[status]',
bug_type='$in[bug_type]', assign='$in[assign]',
php_version='$in[php_version]', php_os='$in[php_os]',
milestone_id=$in[milestone_id], ts2=NOW() WHERE id=$id";
$success = @mysql_query($query);
if ($success && !empty($ncomment)) {
$query = "INSERT INTO bugdb_comments (bug, email, ts, comment) VALUES
($id,'$user@php.net',NOW(),'$ncomment')";
@@ -402,6 +418,10 @@
<?php /* severity goes here. */ ?>
</tr>
<tr>
+ <th>Milestone:</th>
+ <td colspan="3"><select name="in[milestone_id]"><?php
show_milestones($in['milestone_id'],$bug['milestone_id'])?></select></td>
+ </tr>
+ <tr>
<th>Summary:</th>
<td colspan="5"><input type="text" size="60"
maxlength="80" name="in[sdesc]" value="<?php echo
field('sdesc')?>" /></td>
</tr>
http://cvs.php.net/diff.php/php-bugs-web/style.css?r1=1.21&r2=1.22&ty=u
Index: php-bugs-web/style.css
diff -u php-bugs-web/style.css:1.21 php-bugs-web/style.css:1.22
--- php-bugs-web/style.css:1.21 Mon Dec 15 16:54:54 2003
+++ php-bugs-web/style.css Sun Oct 9 19:02:58 2005
@@ -198,3 +198,11 @@
form#asearch table#primary {
background: #eee;
}
+
+table.milestone th {
+ text-align: center;
+}
+
+table.milestone td {
+ background: #ccc;
+}
http://cvs.php.net/co.php/php-bugs-web/milestone.php?r=1.1&p=1
Index: php-bugs-web/milestone.php
+++ php-bugs-web/milestone.php
<?php
require_once 'prepend.inc';
require_once 'cvs-auth.inc';
require_once 'trusted-devs.inc';
$is_dev = false;
if (isset($MAGIC_COOKIE) && !isset($user) && !isset($pw)) {
list($user,$pw) = explode(":", base64_decode($MAGIC_COOKIE));
$is_dev = verify_password($user, stripslashes($pw));
}
@mysql_connect("localhost","nobody","") or die("Unable to connect
to SQL server.");
@mysql_select_db("phpbugdb");
if ($is_dev && isset($_POST['new_milestone']) &&
strlen($_POST['name'])) {
$name = mysql_escape_string(stripslashes($_POST['name']));
mysql_query("insert into bugdb_milestones (name) values ('$name')");
}
commonHeader("Milestones");
$milestones = array();
static $closed_status = array('Closed', 'Bogus');
$res = mysql_query("SELECT id, name from bugdb_milestones order by name");
while (($row = mysql_fetch_assoc($res))) {
$bugs = array();
$closed = 0;
$milestone = $row['name'];
$id = (int)$row['id'];
$q = mysql_query("SELECT id, bug_type, sdesc, status, assign from bugdb where
milestone_id=$id");
while (($row = mysql_fetch_assoc($q))) {
$bugs[] = $row;
$closed += in_array($row['status'], $closed_status);
}
if (count($bugs))
$pct = $closed / count($bugs) * 100;
else
$pct = 100;
echo "<h1>Milestone: " . htmlspecialchars($milestone) . " [$pct
%]</h1>";
if (count($bugs)) {
echo "<table class=\"milestone\">";
echo
"<tr><th>ID#</th><th>Type</th><th>Status</th><th>Summary</th><th>Assigned</th></tr>";
foreach ($bugs as $row) {
echo "<tr>";
echo "<td><a
href=\"bug.php?id=$row[id]\">$row[id]</a></td>";
echo "<td>" . htmlspecialchars($row['bug_type']) .
"</td>";
echo "<td>" . htmlspecialchars($row['status']) .
"</td>";
echo "<td>" . htmlspecialchars($row['sdesc']) .
"</td>";
echo "<td>" . htmlspecialchars($row['assign']) .
"</td>";
echo "</tr>";
}
echo "</table>";
}
echo "<br/>";
}
if ($is_dev) {
?>
<br/>
<br/>
<br/>
<form method="POST" action="milestone.php">
Add new milestone: <input type="text" name="name"> <input
type="submit" name="new_milestone" value="Add">
</form>
<?php
}
commonFooter();