added top committers and top projects to the side home page
This commit is contained in:
parent
f09fde59c7
commit
1b5773b15f
@ -104,8 +104,15 @@ class Site extends Controller
|
||||
$login['id'], $this->issuehelper->_get_open_status_array($this->lang), 0);
|
||||
}
|
||||
|
||||
// TODO: make count_limit configurable instead of using 20
|
||||
$commit_counts_per_project = $this->logs->countCodeCommitsPerProject ('', 0, 20);
|
||||
$commit_counts_per_user = $this->logs->countCodeCommitsPerUser ('', 0, 20);
|
||||
|
||||
if (/*$issues === FALSE || $recently_resolved_issues === FALSE ||*/
|
||||
$open_issue_counts_per_project === FALSE || $your_open_issue_counts_per_project === FALSE)
|
||||
$open_issue_counts_per_project === FALSE ||
|
||||
$your_open_issue_counts_per_project === FALSE ||
|
||||
$commit_counts_per_project === FALSE ||
|
||||
$commit_counts_per_user === FALSE)
|
||||
{
|
||||
$data['login'] = $login;
|
||||
$data['message'] = 'DATABASE ERROR';
|
||||
@ -121,6 +128,8 @@ class Site extends Controller
|
||||
$data['recently_resolved_issues'] = $recently_resolved_issues;*/
|
||||
$data['open_issue_counts_per_project'] = $open_issue_counts_per_project;
|
||||
$data['your_open_issue_counts_per_project'] = $your_open_issue_counts_per_project;
|
||||
$data['commit_counts_per_project'] = $commit_counts_per_project;
|
||||
$data['commit_counts_per_user'] = $commit_counts_per_user;
|
||||
$data['issue_type_array'] = $this->issuehelper->_get_type_array($this->lang);
|
||||
$data['issue_status_array'] = $this->issuehelper->_get_status_array($this->lang);
|
||||
$data['issue_priority_array'] = $this->issuehelper->_get_priority_array($this->lang);
|
||||
|
@ -109,6 +109,8 @@ $lang['System'] = 'System';
|
||||
$lang['Tag'] = 'Tag';
|
||||
$lang['Text'] = 'Text';
|
||||
$lang['Time'] = 'Time';
|
||||
$lang['Top committers'] = 'Top committers';
|
||||
$lang['Top projects'] = 'Top projects';
|
||||
$lang['Type'] = 'Type';
|
||||
$lang['Undo'] = 'Undo';
|
||||
$lang['Unzip a zip file'] = 'Unzip a zip file';
|
||||
|
@ -108,6 +108,8 @@ $lang['System'] = 'Sistem';
|
||||
$lang['Tag'] = 'Label';
|
||||
$lang['Text'] = 'Teks';
|
||||
$lang['Time'] = 'Waktu';
|
||||
$lang['Top committers'] = 'Top committers';
|
||||
$lang['Top projects'] = 'Top projects';
|
||||
$lang['Type'] = 'Type';
|
||||
$lang['Undo'] = 'Undo';
|
||||
$lang['Unzip a zip file'] = 'Unzip a zip file';
|
||||
|
@ -109,6 +109,8 @@ $lang['System'] = '시스템';
|
||||
$lang['Tag'] = '태그';
|
||||
$lang['Text'] = '본문';
|
||||
$lang['Time'] = '시간';
|
||||
$lang['Top committers'] = '톱 커미터';
|
||||
$lang['Top projects'] = '톱 프로젝트';
|
||||
$lang['Type'] = '종류';
|
||||
$lang['Undo'] = '되돌림';
|
||||
$lang['Unzip a zip file'] = 'zip파일 풀기';
|
||||
|
@ -214,6 +214,70 @@ class LogModel extends Model
|
||||
return TRUE;
|
||||
}
|
||||
}
|
||||
|
||||
function countCodeCommitsPerProject ($userid, $hour_limit = 0, $count_limit = 0)
|
||||
{
|
||||
$this->db->trans_begin ();
|
||||
if (strlen($userid) > 0) $this->db->where ('userid', $userid);
|
||||
|
||||
if ($hour_limit > 0)
|
||||
{
|
||||
//$this->db->where ("updatedon >= SYSDATE() - INTERVAL {$hour_limit} HOUR");
|
||||
$this->db->where ("createdon >= CURRENT_TIMESTAMP - INTERVAL '{$hour_limit}' HOUR");
|
||||
}
|
||||
|
||||
$this->db->where ('type', 'code');
|
||||
$this->db->where ('action', 'commit');
|
||||
|
||||
if ($count_limit > 0) $this->db->limit ($count_limit);
|
||||
|
||||
$this->db->select ('projectid, COUNT(id) AS commit_count');
|
||||
$this->db->group_by ('projectid');
|
||||
if ($count_limit > 0) $this->db->order_by ('commit_count', 'desc');
|
||||
$query = $this->db->get ('log');
|
||||
if ($this->db->trans_status() === FALSE)
|
||||
{
|
||||
$this->errmsg = $this->db->_error_message();
|
||||
$this->db->trans_rollback ();
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
$this->db->trans_commit();
|
||||
|
||||
return $query->result ();
|
||||
}
|
||||
|
||||
function countCodeCommitsPerUser ($projectid, $hour_limit = 0, $count_limit = 0)
|
||||
{
|
||||
$this->db->trans_begin ();
|
||||
if (strlen($projectid) > 0) $this->db->where ('projectid', $projectid);
|
||||
|
||||
if ($hour_limit > 0)
|
||||
{
|
||||
//$this->db->where ("updatedon >= SYSDATE() - INTERVAL {$hour_limit} HOUR");
|
||||
$this->db->where ("createdon >= CURRENT_TIMESTAMP - INTERVAL '{$hour_limit}' HOUR");
|
||||
}
|
||||
|
||||
$this->db->where ('type', 'code');
|
||||
$this->db->where ('action', 'commit');
|
||||
|
||||
if ($count_limit > 0) $this->db->limit ($count_limit);
|
||||
|
||||
$this->db->select ('userid, COUNT(id) AS commit_count');
|
||||
$this->db->group_by ('userid');
|
||||
if ($count_limit > 0) $this->db->order_by ('commit_count', 'desc');
|
||||
$query = $this->db->get ('log');
|
||||
if ($this->db->trans_status() === FALSE)
|
||||
{
|
||||
$this->errmsg = $this->db->_error_message();
|
||||
$this->db->trans_rollback ();
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
$this->db->trans_commit();
|
||||
|
||||
return $query->result ();
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
||||
|
@ -333,10 +333,12 @@ $(function () {
|
||||
$(document).keydown (function(event) {
|
||||
if (event.keyCode == 37)
|
||||
{
|
||||
// left-arrow
|
||||
on_prev_pdf_page();
|
||||
}
|
||||
else if (event.keyCode == 39)
|
||||
{
|
||||
// right-arrow
|
||||
on_next_pdf_page();
|
||||
}
|
||||
});
|
||||
|
@ -228,7 +228,7 @@ foreach ($urls as $url)
|
||||
print '<td class="object">';
|
||||
print anchor (
|
||||
"code/revision/{$x['repo']}/{$xdot}/{$x['rev']}",
|
||||
"r{$x['rev']}");
|
||||
"#R{$x['rev']}");
|
||||
print '</td>';
|
||||
|
||||
print '</tr>';
|
||||
@ -293,7 +293,8 @@ foreach ($urls as $url)
|
||||
{
|
||||
$hex = $this->converter->AsciiToHex ($log['message']);
|
||||
$uri = "/issue/show/{$log['projectid']}/{$hex}";
|
||||
$trimmed = $this->lang->line('Issue') . " {$log['message']}";
|
||||
//$trimmed = $this->lang->line('Issue') . " {$log['message']}";
|
||||
$trimmed = "#I{$log['message']}";
|
||||
}
|
||||
|
||||
if ($uri != '')
|
||||
|
@ -28,8 +28,10 @@
|
||||
<script type="text/javascript" src="<?php print base_url_make('/js/jquery.flot.min.js')?>"></script>
|
||||
<script type="text/javascript" src="<?php print base_url_make('/js/jquery.flot.time.min.js')?>"></script>
|
||||
<script type="text/javascript" src="<?php print base_url_make('/js/jquery.flot.categories.min.js')?>"></script>
|
||||
<script type="text/javascript" src="<?php print base_url_make('/js/jquery.flot.pie.min.js')?>"></script>
|
||||
<script type="text/javascript" src="<?php print base_url_make('/js/jquery.flot.tickrotor.js')?>"></script>
|
||||
|
||||
|
||||
<script type="text/javascript">
|
||||
function render_wiki()
|
||||
{
|
||||
@ -44,6 +46,10 @@ function render_wiki()
|
||||
prettyPrint ();
|
||||
}
|
||||
|
||||
function labelFormatter(label, series)
|
||||
{
|
||||
return "<div style='font-size:8pt; text-align:center; padding:2px; color:white;'>" + label + "<br/>" + series.data[0][1] + "(" + Math.round(series.percent) + "%)</div>";
|
||||
}
|
||||
|
||||
<?php if (count($open_issue_counts_per_project) > 0): ?>
|
||||
function show_open_issues_per_project()
|
||||
@ -126,6 +132,90 @@ function show_open_issues_per_project()
|
||||
}
|
||||
<?php endif; ?>
|
||||
|
||||
<?php if (count($commit_counts_per_project) > 0): ?>
|
||||
function show_commits_per_project()
|
||||
{
|
||||
var commits_per_project_data = [
|
||||
<?php
|
||||
$first = TRUE;
|
||||
foreach ($commit_counts_per_project as $commit)
|
||||
{
|
||||
if ($commit->commit_count > 0)
|
||||
{
|
||||
if ($first) $first = FALSE;
|
||||
else print "\n,";
|
||||
printf ("{ label: '%s', data: %d}", $commit->projectid, $commit->commit_count);
|
||||
}
|
||||
}
|
||||
?>
|
||||
];
|
||||
|
||||
var options =
|
||||
{
|
||||
series: {
|
||||
shadowSize: 0,
|
||||
pie: {
|
||||
show: true,
|
||||
innerRadius: 0.1,
|
||||
label: {
|
||||
show: true,
|
||||
radius: 7/10,
|
||||
formatter: labelFormatter,
|
||||
background: { opacity: 0.8 }
|
||||
}
|
||||
}
|
||||
},
|
||||
legend: {
|
||||
show: false
|
||||
}
|
||||
};
|
||||
|
||||
var commit_graph_plot = $.plot($("#site_home_commits_per_project"), commits_per_project_data, options);
|
||||
}
|
||||
<?php endif; ?>
|
||||
|
||||
<?php if (count($commit_counts_per_user) > 0): ?>
|
||||
function show_commits_per_user()
|
||||
{
|
||||
var commits_per_user_data = [
|
||||
<?php
|
||||
$first = TRUE;
|
||||
foreach ($commit_counts_per_user as $commit)
|
||||
{
|
||||
if ($commit->commit_count > 0)
|
||||
{
|
||||
if ($first) $first = FALSE;
|
||||
else print "\n,";
|
||||
printf ("{ label: '%s', data: %d}", $commit->userid, $commit->commit_count);
|
||||
}
|
||||
}
|
||||
?>
|
||||
];
|
||||
|
||||
var options =
|
||||
{
|
||||
series: {
|
||||
shadowSize: 0,
|
||||
pie: {
|
||||
show: true,
|
||||
innerRadius: 0.1,
|
||||
label: {
|
||||
show: true,
|
||||
radius: 7/10,
|
||||
formatter: labelFormatter,
|
||||
background: { opacity: 0.8 }
|
||||
}
|
||||
}
|
||||
},
|
||||
legend: {
|
||||
show: false
|
||||
}
|
||||
};
|
||||
|
||||
var commit_graph_plot = $.plot($("#site_home_commits_per_user"), commits_per_user_data, options);
|
||||
}
|
||||
<?php endif; ?>
|
||||
|
||||
$(function () {
|
||||
render_wiki ();
|
||||
|
||||
@ -145,6 +235,21 @@ $(function () {
|
||||
<?php if (count($open_issue_counts_per_project) > 0): ?>
|
||||
show_open_issues_per_project();
|
||||
<?php endif; ?>
|
||||
|
||||
<?php if (count($commit_counts_per_project) > 0): ?>
|
||||
$("#site_home_sidebar_top_projects_box").accordion ({
|
||||
collapsible: true
|
||||
});
|
||||
show_commits_per_project();
|
||||
<?php endif; ?>
|
||||
|
||||
<?php if (count($commit_counts_per_user) > 0): ?>
|
||||
$("#site_home_sidebar_top_committers_box").accordion ({
|
||||
collapsible: true
|
||||
});
|
||||
show_commits_per_user();
|
||||
<?php endif; ?>
|
||||
|
||||
});
|
||||
</script>
|
||||
|
||||
@ -191,14 +296,14 @@ $this->load->view (
|
||||
<div class="codepot-sidebar" id="site_home_sidebar">
|
||||
|
||||
<div id="site_home_sidebar_latest_projects_box" class="collapsible-box">
|
||||
<div id="site_home_sidebar_latest_projects_header" class="collapsible-box-header">
|
||||
<div id="site_home_sidebar_latest_projects_header" class="collapsible-box-header">
|
||||
<?php print $this->lang->line('Latest projects'); ?>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<ul id="site_home_sidebar_latest_projects_list" class="collapsible-box-list">
|
||||
<?php
|
||||
foreach ($latest_projects as $project)
|
||||
{
|
||||
<ul id="site_home_sidebar_latest_projects_list" class="collapsible-box-list">
|
||||
<?php
|
||||
foreach ($latest_projects as $project)
|
||||
{
|
||||
if (strcasecmp ($project->name, $project->id) != 0)
|
||||
$cap = "{$project->name} ($project->id)";
|
||||
else $cap = $project->name;
|
||||
@ -210,21 +315,45 @@ foreach ($latest_projects as $project)
|
||||
$anc = anchor ("project/home/{$project->id}",
|
||||
htmlspecialchars($cap), "title='$sum'");
|
||||
print "<li>{$anc}</li>";
|
||||
}
|
||||
?>
|
||||
</ul>
|
||||
}
|
||||
?>
|
||||
</ul>
|
||||
|
||||
</div>
|
||||
|
||||
<?php if (count($commit_counts_per_project) > 0): ?>
|
||||
<div id="site_home_sidebar_top_projects_box" class="collapsible-box">
|
||||
<div id="site_home_sidebar_top_projects_header" class="collapsible-box-header">
|
||||
<?php print $this->lang->line('Top projects'); ?>
|
||||
</div>
|
||||
|
||||
<div id="site_home_result_commits_per_project_graph" style="overflow:auto;">
|
||||
<div id="site_home_commits_per_project" style="width:100%;height:200px;"></div>
|
||||
</div>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
|
||||
<?php if (count($commit_counts_per_user) > 0): ?>
|
||||
<div id="site_home_sidebar_top_committers_box" class="collapsible-box">
|
||||
<div id="site_home_sidebar_top_committers_header" class="collapsible-box-header">
|
||||
<?php print $this->lang->line('Top committers'); ?>
|
||||
</div>
|
||||
|
||||
<div id="site_home_result_commits_per_user_graph" style="overflow:auto;">
|
||||
<div id="site_home_commits_per_user" style="width:100%;height:200px;"></div>
|
||||
</div>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
|
||||
<div id="site_home_sidebar_log_box" class="collapsible-box">
|
||||
<div id="site_home_sidebar_log_header" class="collapsible-box-header">
|
||||
<span><?php print $this->lang->line('Change log'); ?></span>
|
||||
<span id="site_home_sidebar_log_all_span"><a href='#' id="site_home_sidebar_log_all_button"><?php print $this->lang->line('All'); ?></a></span>
|
||||
</div>
|
||||
<div id="site_home_sidebar_log_header" class="collapsible-box-header">
|
||||
<span><?php print $this->lang->line('Change log'); ?></span>
|
||||
<span id="site_home_sidebar_log_all_span"><a href='#' id="site_home_sidebar_log_all_button"><?php print $this->lang->line('All'); ?></a></span>
|
||||
</div>
|
||||
|
||||
<div id="site_home_sidebar_log_table_container" class="collapsible-box-panel">
|
||||
<table id="site_home_sidebar_log_table" class="collapsible-box-table">
|
||||
<?php
|
||||
<div id="site_home_sidebar_log_table_container" class="collapsible-box-panel">
|
||||
<table id="site_home_sidebar_log_table" class="collapsible-box-table">
|
||||
<?php
|
||||
$xdot = $this->converter->AsciiToHex ('.');
|
||||
foreach ($log_entries as $log)
|
||||
{
|
||||
@ -252,7 +381,7 @@ foreach ($latest_projects as $project)
|
||||
print '<td class="object">';
|
||||
print anchor (
|
||||
"code/revision/{$x['repo']}/{$xdot}/{$x['rev']}",
|
||||
"r{$x['rev']}");
|
||||
"#R{$x['rev']}");
|
||||
print '</td>';
|
||||
|
||||
print '</tr>';
|
||||
@ -327,7 +456,8 @@ foreach ($latest_projects as $project)
|
||||
{
|
||||
$hex = $this->converter->AsciiToHex ($log['message']);
|
||||
$uri = "/issue/show/{$log['projectid']}/{$hex}";
|
||||
$trimmed = $this->lang->line('Issue') . " {$log['message']}";
|
||||
//$trimmed = $this->lang->line('Issue') . " {$log['message']}";
|
||||
$trimmed = "#I{$log['message']}";
|
||||
}
|
||||
|
||||
if ($uri != '' && $trimmed != '')
|
||||
@ -354,9 +484,9 @@ foreach ($latest_projects as $project)
|
||||
print '</tr>';
|
||||
}
|
||||
}
|
||||
?>
|
||||
</table>
|
||||
</div>
|
||||
?>
|
||||
</table>
|
||||
</div>
|
||||
</div> <!-- box -->
|
||||
|
||||
</div> <!-- site_home_sidebar -->
|
||||
|
Loading…
Reference in New Issue
Block a user