changed the code history view to show the review comment count in the message column
This commit is contained in:
parent
986afffd9f
commit
64baf91b37
@ -920,6 +920,7 @@ class Code extends Controller
|
|||||||
{
|
{
|
||||||
$this->load->model ('ProjectModel', 'projects');
|
$this->load->model ('ProjectModel', 'projects');
|
||||||
$this->load->model ('SubversionModel', 'subversion');
|
$this->load->model ('SubversionModel', 'subversion');
|
||||||
|
$this->load->model ('CodeModel', 'code');
|
||||||
|
|
||||||
$login = $this->login->getUser ();
|
$login = $this->login->getUser ();
|
||||||
if (CODEPOT_SIGNIN_COMPULSORY && $login['id'] == '')
|
if (CODEPOT_SIGNIN_COMPULSORY && $login['id'] == '')
|
||||||
@ -960,17 +961,25 @@ class Code extends Controller
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|
||||||
if (array_key_exists('history', $file))
|
if (array_key_exists('history', $file))
|
||||||
{
|
{
|
||||||
// Inject the codepot defined tag.
|
// Inject the codepot defined tag and review count
|
||||||
foreach ($file['history'] as &$h)
|
foreach ($file['history'] as &$h)
|
||||||
{
|
{
|
||||||
if (array_key_exists('rev', $h))
|
if (array_key_exists('rev', $h))
|
||||||
{
|
{
|
||||||
$h['tag'] = $this->subversion->getRevProp ($projectid, $h['rev'], CODEPOT_SVN_TAG_PROPERTY);
|
$h['tag'] = $this->subversion->getRevProp ($projectid, $h['rev'], CODEPOT_SVN_TAG_PROPERTY);
|
||||||
if ($h['tag'] === FALSE) $h['tag'] = '';
|
if ($h['tag'] === FALSE) $h['tag'] = '';
|
||||||
|
|
||||||
|
$h['review_count'] = $this->code->countReviews ($projectid, $h['rev']);
|
||||||
|
if ($h['review_count'] === FALSE) $h['review_count'] = 0;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$h['tag'] = '';
|
||||||
|
$h['review_count'] = 0;
|
||||||
}
|
}
|
||||||
else $h['tag'] = '';
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -984,6 +993,8 @@ class Code extends Controller
|
|||||||
$data['next_revision'] =
|
$data['next_revision'] =
|
||||||
$this->subversion->getNextRev ($projectid, $path, $rev);
|
$this->subversion->getNextRev ($projectid, $path, $rev);
|
||||||
|
|
||||||
|
$data['review_count'] =
|
||||||
|
|
||||||
$this->load->view ($this->VIEW_HISTORY, $data);
|
$this->load->view ($this->VIEW_HISTORY, $data);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -81,6 +81,30 @@ class CodeModel extends Model
|
|||||||
return $result;
|
return $result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function countReviews ($projectid, $revision)
|
||||||
|
{
|
||||||
|
$this->db->trans_begin ();
|
||||||
|
|
||||||
|
$this->db->where ('projectid', (string)$projectid);
|
||||||
|
$this->db->where ('rev', $revision);
|
||||||
|
$this->db->select ('count(*) as count');
|
||||||
|
$query = $this->db->get ('code_review');
|
||||||
|
if ($this->db->trans_status() === FALSE)
|
||||||
|
{
|
||||||
|
$this->errmsg = $this->db->_error_message();
|
||||||
|
$this->db->trans_rollback ();
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
|
$result = $query->result();
|
||||||
|
$num = empty($result)? 0:
|
||||||
|
isset($result[0]->COUNT)? $result[0]->COUNT: $result[0]->count;
|
||||||
|
|
||||||
|
$this->db->trans_commit();
|
||||||
|
return $num;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
function insertReview ($projectid, $revision, $userid, $comment)
|
function insertReview ($projectid, $revision, $userid, $comment)
|
||||||
{
|
{
|
||||||
// TODO: check if userid can do this..
|
// TODO: check if userid can do this..
|
||||||
|
@ -158,6 +158,12 @@ $this->load->view (
|
|||||||
print '</tt></td>';
|
print '</tt></td>';
|
||||||
|
|
||||||
print '<td class="commit-message-td">';
|
print '<td class="commit-message-td">';
|
||||||
|
if ($h['review_count'] > 0)
|
||||||
|
{
|
||||||
|
$tmp = sprintf ('<span class="codepot-history-review-count">%d</span>', $h['review_count']);
|
||||||
|
print anchor("code/revision/{$project->id}/{$xfullpath}/{$h['rev']}#code_revision_result_comments", $tmp);
|
||||||
|
print ' ';
|
||||||
|
}
|
||||||
print anchor ("code/revision/{$project->id}/{$xfullpath}/{$h['rev']}", htmlspecialchars($h['msg']), "class='commit-message'");
|
print anchor ("code/revision/{$project->id}/{$xfullpath}/{$h['rev']}", htmlspecialchars($h['msg']), "class='commit-message'");
|
||||||
//print '<pre>';
|
//print '<pre>';
|
||||||
//print htmlspecialchars($h['msg']);
|
//print htmlspecialchars($h['msg']);
|
||||||
|
@ -606,7 +606,8 @@ pre, code, tt {
|
|||||||
margin: 0px !important;
|
margin: 0px !important;
|
||||||
}
|
}
|
||||||
|
|
||||||
span.codepot-open-issue-count {
|
span.codepot-open-issue-count,
|
||||||
|
span.codepot-history-review-count {
|
||||||
-moz-border-radius: 45%;
|
-moz-border-radius: 45%;
|
||||||
-webkit-border-radius: 45%;
|
-webkit-border-radius: 45%;
|
||||||
border-radius: 30%;
|
border-radius: 30%;
|
||||||
|
Loading…
Reference in New Issue
Block a user