enhanced the commits-per-month graph
This commit is contained in:
parent
d12de4e0cf
commit
4fc812ef91
@ -2,7 +2,7 @@ Package: @PACKAGE@
|
||||
Version: @VERSION@
|
||||
Maintainer: @PACKAGE_BUGREPORT@
|
||||
Homepage: @PACKAGE_URL@
|
||||
Depends: subversion, apache2-mpm-prefork, libapache2-svn, php5, php5-ldap, wget
|
||||
Depends: subversion, apache2-mpm-prefork, libapache2-svn, php5, php5-ldap, php5-gd
|
||||
Recommends: php5-mysql, php5-svn (>= 0.5.1)
|
||||
Suggests: slapd, mysql-server
|
||||
Section: web
|
||||
|
@ -6,6 +6,7 @@
|
||||
[ -d "@DEPOTDIR@/svnrepo" ] || { mkdir -p "@DEPOTDIR@/svnrepo" && svnrepodir=1; }
|
||||
[ -d "@DEPOTDIR@/files" ] || { mkdir -p "@DEPOTDIR@/files" && filesdir=1; }
|
||||
[ -d "@DEPOTDIR@/attachments" ] || { mkdir -p "@DEPOTDIR@/attachments" && attachmentsdir=1; }
|
||||
[ -d "@DEPOTDIR@/usericons" ] || { mkdir -p "@DEPOTDIR@/usericons" && usericonsdir=1; }
|
||||
|
||||
[ -f "@SYSCONFDIR@/apache2/envvars" ] && {
|
||||
GROUP=$(. "@SYSCONFDIR@/apache2/envvars" && echo "${APACHE_RUN_GROUP}")
|
||||
@ -30,6 +31,10 @@
|
||||
chgrp -R "${GROUP}" "@DEPOTDIR@/attachments"
|
||||
chmod 0775 "@DEPOTDIR@/attachments"
|
||||
}
|
||||
[ "${usericonsdir}" = "1" ] && {
|
||||
chgrp -R "${GROUP}" "@DEPOTDIR@/usericons"
|
||||
chmod 0775 "@DEPOTDIR@/usericons"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -5,6 +5,7 @@
|
||||
[ -d "@DEPOTDIR@/svnrepo" ] && rmdir "@DEPOTDIR@/svnrepo" 2>/dev/null
|
||||
[ -d "@DEPOTDIR@/files" ] && rmdir "@DEPOTDIR@/files" 2>/dev/null
|
||||
[ -d "@DEPOTDIR@/attachments" ] && rmdir "@DEPOTDIR@/attachments" 2>/dev/null
|
||||
[ -d "@DEPOTDIR@/usericons" ] && rmdir "@DEPOTDIR@/usericons" 2>/dev/null
|
||||
[ -d "@DEPOTDIR@" ] && rmdir "@DEPOTDIR@" 2>/dev/null
|
||||
|
||||
exit 0
|
||||
|
@ -29,7 +29,6 @@ INSTALLATION
|
||||
Here is how to install Codepot into the standard locations under Ubuntu Linux.
|
||||
|
||||
* Install required packages.
|
||||
$ sudo apt-get install wget
|
||||
$ sudo apt-get install subversion
|
||||
$ sudo apt-get install apache2-mpm-prefork
|
||||
$ sudo apt-get install libapache2-svn
|
||||
|
@ -15,6 +15,9 @@
|
||||
/* Define to the one symbol short name of this package. */
|
||||
#undef PACKAGE_TARNAME
|
||||
|
||||
/* Define to the home page for this package. */
|
||||
#undef PACKAGE_URL
|
||||
|
||||
/* Define to the version of this package. */
|
||||
#undef PACKAGE_VERSION
|
||||
|
||||
|
3844
codepot/configure
vendored
3844
codepot/configure
vendored
File diff suppressed because it is too large
Load Diff
@ -788,6 +788,10 @@ class Code extends Controller
|
||||
}
|
||||
else if ($type == 'commits-per-month')
|
||||
{
|
||||
$total_commits = 0;
|
||||
$average_commits = 0;
|
||||
$total_months = 0;
|
||||
|
||||
$file = $this->subversion->getHistory ($projectid, $path, SVN_REVISION_HEAD);
|
||||
if ($file === FALSE)
|
||||
{
|
||||
@ -833,9 +837,12 @@ class Code extends Controller
|
||||
$max_month = substr($k, 5, 2);
|
||||
}
|
||||
|
||||
|
||||
$idx++;
|
||||
$total_commits += $v;
|
||||
}
|
||||
|
||||
$total_months = 0;
|
||||
for ($year = $min_year; $year <= $max_year; $year++)
|
||||
{
|
||||
$month = ($year == $min_year)? $min_month: 1;
|
||||
@ -852,23 +859,30 @@ class Code extends Controller
|
||||
}
|
||||
|
||||
$month++;
|
||||
$total_months++;
|
||||
}
|
||||
}
|
||||
|
||||
if ($total_months > 0) $average_commits = $total_commits / $total_months;
|
||||
}
|
||||
|
||||
ksort ($stats);
|
||||
$stats_count = count($stats);
|
||||
|
||||
$graph_width = $stats_count * 5;
|
||||
$graph_width = $stats_count * 8;
|
||||
if ($graph_width < 400) $graph_width = 400;
|
||||
$this->load->library ('PHPGraphLib', array ('width' => $graph_width, 'height' => 150), 'graph');
|
||||
$this->load->library ('PHPGraphLib', array ('width' => $graph_width, 'height' => 180), 'graph');
|
||||
$this->graph->addData($stats);
|
||||
$this->graph->setTitle('Commits per month');
|
||||
$this->graph->setTitle("Commits per month ({$total_commits}/{$total_months})");
|
||||
$this->graph->setDataPoints(FALSE);
|
||||
$this->graph->setDataValues(FALSE);
|
||||
$this->graph->setLine(TRUE);
|
||||
$this->graph->setLine(FALSE);
|
||||
$this->graph->setLineColor("red");
|
||||
$this->graph->setBars(FALSE);
|
||||
$this->graph->setBars(TRUE);
|
||||
$this->graph->setBarOutline (TRUE);
|
||||
$this->graph->setBarColor ("#EEEEEE");
|
||||
$this->graph->setBarOutlineColor ("#AAAAAA");
|
||||
$this->graph->setBarSpace(FALSE);
|
||||
$this->graph->setXValues(TRUE);
|
||||
$this->graph->setXValuesHorizontal(TRUE);
|
||||
if ($stats_count < 12)
|
||||
@ -883,7 +897,10 @@ class Code extends Controller
|
||||
{
|
||||
$this->graph->setXValuesInterval(11);
|
||||
}
|
||||
$this->graph->setGrid(FALSE);
|
||||
//$this->graph->setGrid(FALSE);
|
||||
$this->graph->setGridVertical(FALSE);
|
||||
$this->graph->setGridHorizontal(TRUE);
|
||||
if ($total_months > 0) $this->graph->setGoalLine ($average_commits, "red", "solid");
|
||||
$this->graph->createGraph();
|
||||
}
|
||||
else if ($type == 'commit-share-by-users')
|
||||
|
@ -84,7 +84,9 @@ class PHPGraphLib {
|
||||
protected $bool_y_axis = true;
|
||||
protected $bool_x_axis_values = true;
|
||||
protected $bool_y_axis_values = true;
|
||||
protected $bool_grid = true;
|
||||
//protected $bool_grid = true;
|
||||
protected $bool_grid_horizontal = true;
|
||||
protected $bool_grid_vertical = true;
|
||||
protected $bool_line = false;
|
||||
protected $bool_data_values = false;
|
||||
protected $bool_x_axis_values_vert = true;
|
||||
@ -145,6 +147,7 @@ class PHPGraphLib {
|
||||
protected $data_format_generic;
|
||||
|
||||
//bar vars / scale
|
||||
protected $bool_bar_space = TRUE;
|
||||
protected $bar_width;
|
||||
protected $space_width;
|
||||
protected $unit_scale;
|
||||
@ -293,17 +296,27 @@ class PHPGraphLib {
|
||||
}
|
||||
|
||||
protected function setupData()
|
||||
{
|
||||
if ($this->bool_bar_space)
|
||||
{
|
||||
$unit_width = ($this->width - $this->y_axis_margin - $this->right_margin) / (($this->data_count * 2) + $this->data_count);
|
||||
}
|
||||
else
|
||||
{
|
||||
$unit_width = ($this->width - $this->y_axis_margin - $this->right_margin) / (($this->data_count * 2));
|
||||
}
|
||||
|
||||
if ($unit_width < 1 && !$this->bool_ignore_data_fit_errors) {
|
||||
//error units too small, too many data points or not large enough graph
|
||||
$this->bool_bars_generate = false;
|
||||
$this->error[] = "Graph too small or too many data points.";
|
||||
} else {
|
||||
|
||||
//default space between bars is 1/2 the width of the bar
|
||||
//find bar and space widths. bar = 2 units, space = 1 unit
|
||||
$this->bar_width = 2 * $unit_width;
|
||||
$this->space_width = $unit_width;
|
||||
$this->space_width = ($this->bool_bar_space)? $unit_width: 0;
|
||||
|
||||
//now calculate height (scale) units
|
||||
$availVertSpace = $this->height - $this->x_axis_margin - $this->top_margin;
|
||||
if ($availVertSpace < 1) {
|
||||
@ -391,9 +404,14 @@ class PHPGraphLib {
|
||||
foreach ($this->data_array as $data_set_num => $data_set) {
|
||||
$lineX2 = null;
|
||||
$xStart = $this->y_axis_x1 + ($this->space_width / 2);
|
||||
|
||||
$y1 = 0;
|
||||
$y2 = 0;
|
||||
foreach ($data_set as $key => $item) {
|
||||
$hideBarOutline = false;
|
||||
|
||||
$old_y1 = $y1;
|
||||
$old_y2 = $y2;
|
||||
$x1 = round($xStart + ($dataset_offset * $data_set_num));
|
||||
$x2 = round(($xStart + $this->bar_width) + ($dataset_offset * $data_set_num));
|
||||
$y1 = round($this->x_axis_y1 - ($item * $this->unit_scale) + $adjustment);
|
||||
@ -420,8 +438,19 @@ class PHPGraphLib {
|
||||
}
|
||||
//draw bar outline
|
||||
if ($this->bool_bar_outline && !$hideBarOutline) {
|
||||
|
||||
|
||||
if ($this->bool_bar_space)
|
||||
{
|
||||
imagerectangle($this->image, $x1, $y2, $x2, $y1, $this->outline_color);
|
||||
}
|
||||
else
|
||||
{
|
||||
imageline ($this->image, $x1, $old_y1, $x1, $y1, $this->outline_color);
|
||||
imageline ($this->image, $x1, $y1, $x2, $y1, $this->outline_color);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
// draw line
|
||||
if ($this->bool_line) {
|
||||
@ -522,6 +551,13 @@ class PHPGraphLib {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if ($this->bool_bar_outline && !$hideBarOutline && !$this->bool_bar_space)
|
||||
{
|
||||
imageline ($this->image, $x2, $y1, $x2, $y2, $this->outline_color);
|
||||
}
|
||||
|
||||
$xStart += $this->bar_width + $this->space_width;
|
||||
}
|
||||
}
|
||||
@ -699,7 +735,8 @@ class PHPGraphLib {
|
||||
//loop through each horizontal line
|
||||
foreach ($horizGridArray as $value) {
|
||||
$yValue = round($this->x_axis_y1 - ($value * $this->unit_scale) + $adjustment);
|
||||
if ($this->bool_grid) {
|
||||
//if ($this->bool_grid) {
|
||||
if ($this->bool_grid_horizontal) {
|
||||
//imageline($this->image, $this->y_axis_x1, $yValue, $this->x_axis_x2 , $yValue, $this->grid_color);
|
||||
$this->horiz_grid_lines[] = array('x1' => $this->y_axis_x1, 'y1' => $yValue,
|
||||
'x2' => $this->x_axis_x2, 'y2' => $yValue, 'color' => $this->grid_color);
|
||||
@ -740,7 +777,8 @@ class PHPGraphLib {
|
||||
}
|
||||
|
||||
//loop through each vertical line
|
||||
if ($this->bool_grid) {
|
||||
//if ($this->bool_grid) {
|
||||
if ($this->bool_grid_vertical) {
|
||||
$xValue = $this->y_axis_y1;
|
||||
foreach ($vertGridArray as $value) {
|
||||
//imageline($this->image, $value, $this->y_axis_y2, $value, $xValue , $this->grid_color);
|
||||
@ -1101,10 +1139,39 @@ class PHPGraphLib {
|
||||
}
|
||||
}
|
||||
|
||||
public function setBarSpace ($bool)
|
||||
{
|
||||
if (is_bool($bool)) {
|
||||
$this->bool_bar_space = $bool;
|
||||
} else {
|
||||
$this->error[] = "Value arg for setBarSpace() not specified properly.";
|
||||
}
|
||||
}
|
||||
|
||||
public function setGrid($bool)
|
||||
{
|
||||
if (is_bool($bool)) {
|
||||
$this->bool_grid = $bool;
|
||||
//$this->bool_grid = $bool;
|
||||
$this->bool_grid_horizontal = $bool;
|
||||
$this->bool_grid_vertical = $bool;
|
||||
} else {
|
||||
$this->error[] = "Boolean arg for setGrid() not specified properly.";
|
||||
}
|
||||
}
|
||||
|
||||
public function setGridHorizontal($bool)
|
||||
{
|
||||
if (is_bool($bool)) {
|
||||
$this->bool_grid_horizontal = $bool;
|
||||
} else {
|
||||
$this->error[] = "Boolean arg for setGrid() not specified properly.";
|
||||
}
|
||||
}
|
||||
|
||||
public function setGridVertical($bool)
|
||||
{
|
||||
if (is_bool($bool)) {
|
||||
$this->bool_grid_vertical = $bool;
|
||||
} else {
|
||||
$this->error[] = "Boolean arg for setGrid() not specified properly.";
|
||||
}
|
||||
|
@ -270,6 +270,18 @@ class ProjectModel extends Model
|
||||
|
||||
if ($force)
|
||||
{
|
||||
$this->db->where ('projectid', $project->id);
|
||||
$query = $this->db->get ('wiki_attachment');
|
||||
if ($this->db->trans_status() === FALSE)
|
||||
{
|
||||
$this->db->trans_rollback ();
|
||||
return FALSE;
|
||||
}
|
||||
$wikiatts = $query->result ();
|
||||
|
||||
$this->db->where ('projectid', $project->id);
|
||||
$this->db->delete ('wiki_attachment');
|
||||
|
||||
$this->db->where ('projectid', $project->id);
|
||||
$this->db->delete ('wiki');
|
||||
|
||||
@ -279,6 +291,9 @@ class ProjectModel extends Model
|
||||
$this->db->where ('projectid', $project->id);
|
||||
$this->db->delete ('issue');
|
||||
|
||||
$this->db->where ('projectid', $project->id);
|
||||
$this->db->delete ('code_review');
|
||||
|
||||
$this->db->where ('projectid', $project->id);
|
||||
$query = $this->db->get ('file');
|
||||
if ($this->db->trans_status() === FALSE)
|
||||
@ -287,7 +302,7 @@ class ProjectModel extends Model
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
$result = $query->result ();
|
||||
$files = $query->result ();
|
||||
|
||||
$this->db->where ('projectid', $project->id);
|
||||
$this->db->delete ('file');
|
||||
@ -319,11 +334,21 @@ class ProjectModel extends Model
|
||||
}
|
||||
else
|
||||
{
|
||||
if ($force && count($result) > 0)
|
||||
if ($force)
|
||||
{
|
||||
if (count($files) > 0)
|
||||
{
|
||||
// no way to roll back file delete.
|
||||
// so deletion is done here.
|
||||
$this->_delete_files_uploaded ($result);
|
||||
$this->_delete_files (CODEPOT_FILE_DIR, $files);
|
||||
}
|
||||
|
||||
if (count($wikiatts) > 0)
|
||||
{
|
||||
// no way to roll back attachment delete.
|
||||
// so deletion is done here.
|
||||
$this->_delete_files (CODEPOT_ATTACHMENT_DIR, $wikiatts);
|
||||
}
|
||||
}
|
||||
|
||||
$this->db->trans_commit ();
|
||||
@ -455,10 +480,10 @@ class ProjectModel extends Model
|
||||
return ($count == 1)? TRUE: FALSE;
|
||||
}
|
||||
|
||||
function _delete_files_uploaded ($files)
|
||||
function _delete_files ($basedir, $files)
|
||||
{
|
||||
foreach ($files as $file)
|
||||
@unlink (CODEPOT_FILE_DIR . "/{$file->encname}");
|
||||
@unlink ($basedir . "/{$file->encname}");
|
||||
}
|
||||
|
||||
function getUserIcons ($users)
|
||||
|
@ -16,7 +16,7 @@
|
||||
|
||||
<?php $review_count = count($reviews); ?>
|
||||
<?php $is_loggedin = ($login['id'] != ''); ?>
|
||||
<?php $can_edit = ($login['id'] == $file['history']['author']); ?>
|
||||
<?php $can_edit = ($is_loggedin && $login['id'] == $file['history']['author']); ?>
|
||||
|
||||
<?php if ($can_edit): ?>
|
||||
$(function() {
|
||||
|
Loading…
Reference in New Issue
Block a user