cvs: bugtracker /template/generic/bug index.php

From: Date: Thu, 10 Jul 2008 00:12:20 +0000
Subject: cvs: bugtracker /template/generic/bug index.php
Groups: php.webmaster 
Request: Send a blank email to php-webmaster+get-2067@lists.php.net to get a copy of this message
bcarlyon Thu Jul 10 00:12:20 2008 UTC Modified files: /bugtracker/template/generic/bug index.php Log: bug display page displaying a bug and intial download reporduce code work Modified Files: template/generic/bug/index.php http://cvs.php.net/viewvc.cgi/bugtracker/template/generic/bug/index.php?r1=1.1&r2=1.2&diff_format=u Index: bugtracker/template/generic/bug/index.php diff -u bugtracker/template/generic/bug/index.php:1.1 bugtracker/template/generic/bug/index.php:1.2 --- bugtracker/template/generic/bug/index.php:1.1 Wed Jul 9 13:07:22 2008 +++ bugtracker/template/generic/bug/index.php Thu Jul 10 00:12:20 2008 @@ -1,6 +1,33 @@ <?php $bug_id = $_REQUEST['bug_id']; +$bug_id = str_replace('/','',$bug_id); +/* +if (substr($bug_id,-1) == '/') +{ + $bug_id = +} +*/ + +if (substr($bug_id,0,8) == 'download') +{ + //code download! + $bug_id = str_replace('download/', '', $bug_id); + $bug_id = str_replace('download', '', $bug_id); + $query = 'SELECT * FROM bug_comment WHERE bug_id = ' . "'{$bug_id}' AND comment_type= " . REPRODUCE; + $db->get_data($query); + if ($db->total_rows) + { + //lets shunt out a text file + echo 'here be a forced download of a text file, well sorta...'; + exit; + } + else + { + $content .= '<h2>Invalid Bug Id or no Reproduce Code to download</h2>'; + } +} + if (is_numeric($bug_id)) { @@ -13,9 +40,9 @@ $query = "SELECT * FROM bug_comment WHERE bug_id = '{$bug_id}' AND ( comment_type = " . DESCRIPTION . ' OR comment_type = ' . REPRODUCE . ' OR comment_type = ' . EXPECTED . ' OR comment_type = ' . ACTUAL . ')'; $db->get_data($query); $comments = array(); -while ($comment = $db->fetch_row()) +while ($entry = $db->fetch_row()) { - $comments[$comment_type[$comment['comment_type']]] = $comment['comment']; + $comments[$comment_type[$entry['comment_type']]] = $entry['comment']; } $bug = array_merge($bug, $comments); @@ -24,7 +51,7 @@ $content .= '<h2>Bug Display</h2>'; $content .= '<table id="bug">'; -$content .= '<tr><td style="width: 100px;">BugId: ' . $bug['bug_id'] . '</td><td>' . $bug['summary'] . '</td><td>Reported By: <strong>' . $bug['reported_by'] . '</strong></td></tr>'; +$content .= '<tr><td style="width: 100px;">BugId: ' . $bug['bug_id'] . '</td><td style="width: 200px;">' . $bug['summary'] . '</td><td>Reported By: <strong>' . $bug['reported_by'] . '</strong></td></tr>'; $content .= '<tr><td>'; // $content .= '<img src="/images/bug_status/' . $status[$bug['status']] . '.png" alt="' . $status[$bug['status']] . '" />'; @@ -35,22 +62,61 @@ $content .= 'Opened: ' . data('d/m/Y h:i',$bug['UNIX_TIMESTAMP(reported_in)']); } -$content .= '</td><td colspan="2">'; -$content .= $bug['description']; +$content .= '</td><td></td><td>'; +//$content .= '<table>'; +$content .= '<tr><td></td><td style="text-align: right;">Type:</td><td>' . $bug_type[$bug['bug_type']] . '</td></tr>'; +$content .= '<tr><td></td><td style="text-align: right;">OS:</td><td>' . $os_version[$bug['os_version']] . '</td></tr>'; +//$content .= '</table>'; $content .= '</td></tr>'; -if (isset($bug['repro'])) +$content .= '<tr><td></td><td colspan="2">'; +$content .= $bug['description']; +$content .= '<br />&nbsp;</td></tr>'; +if (isset($bug['reproduce'])) { + $content .= "\n"; //render a fancy line number box - $jsscripts[] = '/js/lineno.js'; - $content .= '<tr><td></td><td colspan="2">Show Reproduce Code</td></tr>'; - $content .= '<tr><td></td><td colspan="2" style="display: none;" id="reproduce_code">'; - $content .= '<textarea disabled="disabled">' . $bug['repro'] . '</textarea>'; - $content .= 'Download Code'; + $jsscripts[] = '/elements/js/lineno.js'; + $content .= '<tr><td></td><td colspan="2" style="display: none;" id="reproduce_link"><a href="javascript:handleClick(\'reproduce_code\');handleClick(\'reproduce_link\');">Show Reproduce Code and Results</a></td></tr>'; +// $content .= '<tr><td></td><td colspan="2" style="display: block;" id="reproduce_code">'; + $content .= '<tr><td></td><td colspan="2" id="reproduce_code">'; + $content .= '<h5>Reproduce Code</h5>'; + $content .= '<a href="javascript:selectText(\'reproduce\');" title="Select Code" class="textselect">Select Code</a>'; + $content .= '<a href="/bug/download/' . $bug['bug_id'] . '/" title="Download Code" class="textselect">Download</a>'; + $content .= '<textarea id="reproduce" rows="7" cols="55">' . $bug['reproduce'] . '</textarea>'; + //given reporduce assume other, expected and actual + //need a swtich in the db for line numbers or dyn generate? + $content .= '<hr />'; + $content .= '<h5>Expected Result</h5>'; + $content .= '<textarea id="expected" rows="7" cols="55">' . $bug['expected'] . '</textarea>'; + $content .= '<hr />'; + $content .= '<a href="javascript:createTextAreaWithLines(\'expected\');" class="lineno">Add Line Numbers</a>'; + $content .= '<hr />'; + $content .= '<h5>Actual Result</h5>'; + $content .= '<textarea id="actual" rows="7" cols="55">' . $bug['actual'] . '</textarea>'; + $content .= '<hr />'; + $content .= '<a href="javascript:createTextAreaWithLines(\'actual\');" class="lineno">Add Line Numbers</a>'; $content .= '</td></tr>'; + $content .= "\n"; } -$content .= '</table><hr /><hr />'; +//here be the comment controller +$comment->spawn_form(); +$content .= '</table><br /><hr /><hr />'; + +if (isset($bug['reproduce'])) +{ + $content .= ' +<script type="text/javascript"> + createTextAreaWithLines(\'reproduce\'); +</script>'; +/* + document.getElementById(\'reproduce_code\').style.display = \'none\'; + document.getElementById(\'reproduce_link\').style.display = \'block\'; +</script> +'; +*/ +} $content .= 'tempory hack'; $content .= '<table>'; @@ -113,6 +179,7 @@ { $content .= '<td>' . date('r',$row['UNIX_TIMESTAMP(reported_on)']) . '</td>'; } + $content .= '<td><a href="' . $row['bug_id'] . '" title="View Bug">View Bug</a></td>'; $content .= '</tr>'; } $content .= '</table>';

« previous php.webmaster (#2067) next »