[Fusionforge-commits] r7993 - in trunk/gforge: common/include plugins/scmbzr/common plugins/scmcpold/common plugins/scmcvs/common plugins/scmsvn/common

Roland Mas lolando at libremir.placard.fr.eu.org
Thu Aug 27 15:41:26 CEST 2009


Author: lolando
Date: 2009-08-27 15:41:26 +0200 (Thu, 27 Aug 2009)
New Revision: 7993

Modified:
   trunk/gforge/common/include/SCMPlugin.class.php
   trunk/gforge/plugins/scmbzr/common/BzrPlugin.class.php
   trunk/gforge/plugins/scmcpold/common/CpoldPlugin.class.php
   trunk/gforge/plugins/scmcvs/common/CVSPlugin.class.php
   trunk/gforge/plugins/scmsvn/common/SVNPlugin.class.php
Log:
Continued streamlining in scm*

Modified: trunk/gforge/common/include/SCMPlugin.class.php
===================================================================
--- trunk/gforge/common/include/SCMPlugin.class.php	2009-08-27 13:41:16 UTC (rev 7992)
+++ trunk/gforge/common/include/SCMPlugin.class.php	2009-08-27 13:41:26 UTC (rev 7993)
@@ -53,7 +53,7 @@
 			$this->getAdminPage ($params) ;
 			break ;
 		case 'scm_stats':
-			$this->getStats ($params) ;
+			$this->echoShortStats ($params) ;
 			break;
 		case 'scm_createrepo':
 			$this->createOrUpdateRepo ($params) ;
@@ -82,17 +82,19 @@
 		}
 	}
 
-	function displayBrowser ($project) {
-		if ($this->browserDisplayable ($project)) {
-			// ...
-		} else {
-			return '' ;
+	abstract function createOrUpdateRepo ($params) ;
+
+	function echoShortStats ($params) {
+		$project = $this->checkParams ($params) ;
+		if (!$project) {
+			return false ;
 		}
+		
+		if ($project->usesPlugin ($this->name)) {
+			echo ' ('.$this->name.')' ;
+		}
 	}
 
-	abstract function createOrUpdateRepo ($params) ;
-	abstract function getStats ($params) ;
-
 	function getBlurb () {
 		return _('<p>Unimplemented SCM plugin.</p>');
 	}
@@ -105,10 +107,29 @@
 		return _('<p>Instructions for read-write access for unimplemented SCM plugin.</p>');
 	}
 
-	function getBrowserBlurb () {
-		return _('<b>Browse the SCM Tree</b><p>Browsing the SCM tree gives you a great view into the current status of this project\'s code. You may also view the complete histories of any file in the repository.</p>');
+	function getSnapshotPara ($project) {
+		return _('<p>Instructions for snapshot access for unimplemented SCM plugin.</p>');
 	}
 
+	function getBrowserBlock ($project) {
+		global $HTML ;
+		$b = $HTML->boxMiddle(_('Repository Browser'));
+		$b = _('<p>Browsing the SCM tree is not yet implemented for this SCM plugin.</p>');
+		$b .= '<p>[' ;
+		$b .= util_make_link ("/scm/?group_id=".$project->getID(),
+				      _('Not implemented yet')
+			) ;
+		$b .= ']</p>' ;
+		return $b ;
+	}
+
+	function getStatsBlock ($project) {
+		global $HTML ;
+		$b = $HTML->boxMiddle(_('Repository Statistics'));
+		$b .= _('<p>Not implemented for this SCM plugin yet.</p>') ;
+		return $b ;
+	}
+
 	function getPage ($params) {
 		global $HTML, $sys_scm_snapshots_path;
 
@@ -131,29 +152,18 @@
 			// Instructions for developer access
 			print $this->getInstructionsForRW ($project) ;
 
-			// SVN Snapshot
+			// Snapshot
 			if ($this->browserDisplayable ($project)) {
-				$filename=$project->getUnixName().'-scm-latest.tar.gz';
-				if (file_exists($sys_scm_snapshots_path.'/'.$filename)) {
-					print '<p>[' ;
-					print util_make_link ("/snapshots.php?group_id=".$project->getID(),
-							      _('Download the nightly snapshot')
-						) ;
-					print ']</p>';
-				}
+				print $this->getSnapshotPara ($project) ;
 			}
 			print '</td><td width="35%" valign="top">' ;
 
 			// Browsing
 			echo $HTML->boxTop(_('Repository History'));
-			echo $this->getDetailedStats(array('group_id'=>$project->getID())).'<p>';
+			echo _('Data about current and past states of the repository') ;
 			if ($this->browserDisplayable ($project)) {
-				print $this->getBrowserBlurb ($project) ;
-				echo '<p>[' ;
-				echo util_make_link ("/scm/viewvc.php/?root=".$project->getUnixName(),
-						     _('Browse Repository')
-					) ;
-				echo ']</p>' ;
+				echo $this->getStatsBlock($project) ;
+				echo $this->getBrowserBlock ($project) ;
 			}
 			
 			echo $HTML->boxBottom();

Modified: trunk/gforge/plugins/scmbzr/common/BzrPlugin.class.php
===================================================================
--- trunk/gforge/plugins/scmbzr/common/BzrPlugin.class.php	2009-08-27 13:41:16 UTC (rev 7992)
+++ trunk/gforge/plugins/scmbzr/common/BzrPlugin.class.php	2009-08-27 13:41:26 UTC (rev 7993)
@@ -61,21 +61,18 @@
 		return $b ;
 	}
 
-	function getStats ($params) {
-		$project = $this->checkParams ($params) ;
-		if (!$project) {
-			return false ;
-		}
-		
-		if ($project->usesPlugin ($this->name)) {
-			echo ' (Bazaar)';
-		}
+	function getSnapshotPara ($project) {
+		return ;
 	}
 
-	function getDetailedStats ($params) {
+	function getBrowserBlock ($project) {
 		return ;
 	}
 
+	function getStatsBlock ($project) {
+		return ;
+	}
+
 	function createOrUpdateRepo ($params) {
 		$project = $this->checkParams ($params) ;
 		if (!$project) {

Modified: trunk/gforge/plugins/scmcpold/common/CpoldPlugin.class.php
===================================================================
--- trunk/gforge/plugins/scmcpold/common/CpoldPlugin.class.php	2009-08-27 13:41:16 UTC (rev 7992)
+++ trunk/gforge/plugins/scmcpold/common/CpoldPlugin.class.php	2009-08-27 13:41:26 UTC (rev 7993)
@@ -56,21 +56,18 @@
 		return $b ;
 	}
 
-	function getStats ($params) {
-		$project = $this->checkParams ($params) ;
-		if (!$project) {
-			return false ;
-		}
-		
-		if ($project->usesPlugin ($this->name)) {
-			echo ' (CPOLD)';
-		}
+	function getSnapshotPara ($project) {
+		return ;
 	}
-	
-	function getDetailedStats ($params) {
+
+	function getBrowserBlock ($project) {
 		return ;
 	}
 
+	function getStatsBlock ($project) {
+		return ;
+	}
+
 	function createOrUpdateRepo ($params) {
 		$project = $this->checkParams ($params) ;
 		if (!$project) {

Modified: trunk/gforge/plugins/scmcvs/common/CVSPlugin.class.php
===================================================================
--- trunk/gforge/plugins/scmcvs/common/CVSPlugin.class.php	2009-08-27 13:41:16 UTC (rev 7992)
+++ trunk/gforge/plugins/scmcvs/common/CVSPlugin.class.php	2009-08-27 13:41:26 UTC (rev 7993)
@@ -49,161 +49,59 @@
 		return $this->default_cvs_server;
 	}
 
-	function CallHook ($hookname, $params) {
-		global $HTML;
-		
-		switch ($hookname) {
-		case 'scm_snapshots_and_tarballs':
-			$this->generateSnapshots ($params) ;
-			break;
-		default:
-			parent::CallHook ($hookname, $params) ;
-		}
+	function getBlurb () {
+		return _('<p>CVS documentation is available <a href="http://cvsbook.red-bean.com/">here</a>.</p>');
 	}
 
-	function getPage ($params) {
-		global $HTML ;
+	function getInstructionsForAnon ($project) {
+		$cvsrootend = $project->getSCMBox().':'.$this->cvs_root.'/'.$project->getUnixName();
+		$b = _('<p><b>Anonymous CVS Access</b></p><p>This project\'s CVS repository can be checked out through anonymous (pserver) CVS with the following instruction set. The module you wish to check out must be specified as the <i>modulename</i>. When prompted for a password for <i>anonymous</i>, simply press the Enter key.</p>');
+		$b .= '<p>
+		       <tt>cvs -d :pserver:anonymous@' . $cvsrootend.' login</tt><br/>
+		       <tt>cvs -d :pserver:anonymous@' . $cvsrootend.' checkout <em>'._('modulename').'</em></tt>
+		       </p>';
 
-		$project = $this->checkParams ($params) ;
-		if (!$project) {
-			return false ;
-		}
-		
-		if ($project->usesPlugin($this->name)) {
-		
-			print _('Some CVS documentation is available <a href="http://www.nongnu.org/cvs/">Here</a>');
+		return $b ;
+	}
 
-			$cvsrootend=$project->getSCMBox().':/cvsroot/'.$project->getUnixName();
-			$cvsrootend = $project->getSCMBox().':'.$this->cvs_root.'/'.$project->getUnixName();
+	function getInstructionsForRW ($project) {
+		$b = _('<p><b>Developer CVS Access via SSH</b></p><p>Only project developers can access the CVS tree via this method. SSH must be installed on your client machine. Substitute <i>modulename</i> and <i>developername</i> with the proper values. Enter your site password when prompted.</p>');
+			$b .= '<p>
+			       <tt>export CVS_RSH=ssh</tt><br/>
+			       <tt>cvs -d :ext:<em>'._('developername').'</em>@'.$cvsrootend.' checkout <em>'._('modulename').'</em></tt>
+			       </p>';
 
-			// Table for summary info
-			print '<table width="100%"><tr valign="top"><td width="65%">' ;
-
-			// Anonymous CVS Instructions
-			if ($project->enableAnonSCM()){
-				echo _('<p><b>Anonymous CVS Access</b></p><p>This project\'s CVS repository can be checked out through anonymous (pserver) CVS with the following instruction set. The module you wish to check out must be specified as the <i>modulename</i>. When prompted for a password for <i>anonymous</i>, simply press the Enter key.</p>');
-				print '
-						<p>
-						<tt>cvs -d :pserver:anonymous@' . $cvsrootend.' login</tt><br/>
-						<tt>cvs -d :pserver:anonymous@' . $cvsrootend.' checkout <em>'._('modulename').'</em></tt>
-						</p>';
-			}
-			
-			// Developer Access
-			if (session_loggedin ()) {
-				echo _('<p><b>Developer CVS Access via SSH</b></p><p>Only project developers can access the CVS tree via this method. SSH must be installed on your client machine. Substitute <i>modulename</i> with the proper value. Enter your site password when prompted.</p>');
-				print '
-					<p>
-					<tt>export CVS_RSH=ssh</tt><br/>
-					<tt>cvs -d :ext:' ;
-				$u = session_get_user();
-				print $u->getUnixName();
-				print '@'.$cvsrootend.' checkout <em>'._('modulename').'</em></tt>
-					</p>';
-			} else {
-				echo _('<p><b>Developer CVS Access via SSH</b></p><p>Only project developers can access the CVS tree via this method. SSH must be installed on your client machine. Substitute <i>modulename</i> and <i>developername</i> with the proper values. Enter your site password when prompted.</p>');
-				print '
-					<p>
-					<tt>export CVS_RSH=ssh</tt><br/>
-					<tt>cvs -d :ext:<em>'._('developername').'</em>@'.$cvsrootend.' checkout <em>'._('modulename').'</em></tt>
-					</p>';
-			}
-			
-			// CVS Snapshot
-			if ($this->browserDisplayable ($project)) {
-				print '<p>[' ;
-				print util_make_link ("/snapshots.php?group_id=".$project->getID(),
-						      _('Download The Nightly CVS Tree Snapshot')
-					) ;
-				print ']</p>';
-			}
-			print '</td><td width="35%" valign="top">' ;
-			
-			// CVS Browsing 
-			echo $HTML->boxTop(_('Repository History'));
-			echo $this->getDetailedStats(array('group_id'=>$project->getID())).'<p>';
-			if ($this->browserDisplayable ($project)) {
-				echo _('<b>Browse the CVS Tree</b><p>Browsing the CVS tree gives you a great view into the current status of this project\'s code. You may also view the complete histories of any file in the repository.</p>');
-				echo '<p>[' ;
-				echo util_make_link ("/scm/viewvc.php/?root=".$project->getUnixName(),
-						     _('Browse CVS Repository')
-					) ;
-				echo ']</p>' ;
-				$hook_params['project_name'] = $project->getUnixName();
-				plugin_hook ("cvs_stats", $hook_params) ;
-			}
-			echo $HTML->boxBottom();
-			print '</td></tr></table>' ;
-		}	
+		return $b ;
 	}
 
-	function adminUpdate ($params) {
-		$project = $this->checkParams ($params) ;
-		if (!$project) {
-			return false ;
+	function getSnapshotPara ($project) {
+		$b = $filename=$project->getUnixName().'-scm-latest.tar.gz';
+		if (file_exists($sys_scm_snapshots_path.'/'.$filename)) {
+			$b .= '<p>[' ;
+			$b .= util_make_link ("/snapshots.php?group_id=".$project->getID(),
+					      _('Download the nightly snapshot')
+				) ;
+			$b .= ']</p>';
 		}
-		
-		if ($project->usesPlugin($this->name)) {
-			if (array_key_exists('scmcvs_enable_anoncvs', $params)){
-				$project->SetUsesAnonSCM(true);
-			} else {
-				$project->SetUsesAnonSCM(false);
-			}
-			if (array_key_exists('scmcvs_enable_pserver', $params)){
-				$project->SetUsesPserver(true);
-			} else {
-				$project->SetUsesPserver(false);
-			}
-		}
+		return $b ;
 	}
-	
-	function getAdminPage ($params) {
-		$project = $this->checkParams ($params) ;
-		if (!$project) {
-			return false ;
-		}
-		
-		if ($project->usesPlugin($this->name)) {
-			print '<p>';
-			if ($project->isPublic()) {
-				print '<input type="checkbox" name="scmcvs_enable_anoncvs" value="1" '.$this->c($project->enableAnonSCM()).'/><strong>'._('Enable Anonymous Access').'</strong><br />';
-			} else {
-				print '<input type="checkbox" name="scmcvs_enable_anoncvs" value="1" '.$this->c($project->enableAnonSCM()).' DISABLED/>'._('Enable Anonymous Access').' <strong>'._("You project is private and so, you can't turn Anonymous Access on").'</strong><br />';
 
-			}
-			print '<input type="checkbox" name="scmcvs_enable_pserver" value="1" '.$this->c($project->enablePserver()).' /><strong>'._('Enable pserver').'</strong></p>' ;
-		}
+	function getBrowserBlock ($project) {
+		global $HTML ;
+		$b = $HTML->boxMiddle(_('CVS Repository Browser'));
+		$b = _('<p>Browsing the CVS tree gives you a view into the current status of this project\'s code. You may also view the complete histories of any file in the repository.</p>');
+		$b .= '<p>[' ;
+		$b .= util_make_link ("/scm/viewvc.php/?root=".$project->getUnixName(),
+				      _('Browse CVS Repository')
+			) ;
+		$b .= ']</p>' ;
+		return $b ;
 	}
 
-	function getStats ($params) {
-		$project = $this->checkParams ($params) ;
-		if (!$project) {
-			return false ;
-		}
-		
-		if ($project->usesPlugin($this->name)) {
-			$result = db_query_params('SELECT sum(commits) AS commits, sum(adds) AS adds FROM stats_cvs_group WHERE group_id=$1',
-						  array ($project->getID())) ;
-			$commit_num = db_result($result,0,'commits');
-			$add_num    = db_result($result,0,'adds');
-			if (!$commit_num) {
-				$commit_num=0;
-			}
-			if (!$add_num) {
-				$add_num=0;
-			}
-			echo ' (CVS: '.sprintf(_('<strong>%1$s</strong> commits, <strong>%2$s</strong> adds'), number_format($commit_num, 0), number_format($add_num, 0)).")";
-		}
-	}
-	
-	function getDetailedStats ($params) {
-		global $HTML;
+	function getStatsBlock ($project) {
+		global $HTML ;
+		$b = $HTML->boxMiddle(_('Repository Statistics'));
 
-		$project = $this->checkParams ($params) ;
-		if (!$project) {
-			return false ;
-		}
-		
 		$result = db_query_params('SELECT u.realname, u.user_name, u.user_id, sum(commits) as commits, sum(adds) as adds, sum(adds+commits) as combined FROM stats_cvs_user s, users u WHERE group_id=$1 AND s.user_id=u.user_id AND (commits>0 OR adds >0) GROUP BY u.user_id, realname, user_name, u.user_id ORDER BY combined DESC, realname',
 					  array ($project->getID()));
 		
@@ -213,31 +111,66 @@
 				_('Adds'),
 				_('Commits')
 				);
-			echo $HTML->listTableTop($tableHeaders);
+			$b .= $HTML->listTableTop($tableHeaders);
 			
 			$i = 0;
 			$total = array('adds' => 0, 'commits' => 0);
 			
 			while($data = db_fetch_array($result)) {
-				echo '<tr '. $HTML->boxGetAltRowStyle($i) .'>';
-				echo '<td width="50%">' ;
-				echo util_make_link_u ($data['user_name'], $data['user_id'], $data['realname']) ;
-				echo '</td><td width="25%" align="right">'.$data['adds']. '</td>'.
+				$b .= '<tr '. $HTML->boxGetAltRowStyle($i) .'>';
+				$b .= '<td width="50%">' ;
+				$b .= util_make_link_u ($data['user_name'], $data['user_id'], $data['realname']) ;
+				$b .= '</td><td width="25%" align="right">'.$data['adds']. '</td>'.
 					'<td width="25%" align="right">'.$data['commits'].'</td></tr>';
 				$total['adds'] += $data['adds'];
 				$total['commits'] += $data['commits'];
 				$i++;
 			}
-			echo '<tr '. $HTML->boxGetAltRowStyle($i) .'>';
-			echo '<td width="50%"><strong>'._('Total').':</strong></td>'.
+			$b .= '<tr '. $HTML->boxGetAltRowStyle($i) .'>';
+			$b .= '<td width="50%"><strong>'._('Total').':</strong></td>'.
 				'<td width="25%" align="right"><strong>'.$total['adds']. '</strong></td>'.
 				'<td width="25%" align="right"><strong>'.$total['commits'].'</strong></td>';
-			echo '</tr>';
-			echo $HTML->listTableBottom();
-			echo '<hr size="1" />';
+			$b .= '</tr>';
+			$b .= $HTML->listTableBottom();
+			$b .= '<hr size="1" />';
 		}
+
+		return $b ;
 	}
 
+	function CallHook ($hookname, $params) {
+		global $HTML;
+		
+		switch ($hookname) {
+		case 'scm_snapshots_and_tarballs':
+			$this->generateSnapshots ($params) ;
+			break;
+		default:
+			parent::CallHook ($hookname, $params) ;
+		}
+	}
+
+	function echoShortStats ($params) {
+		$project = $this->checkParams ($params) ;
+		if (!$project) {
+			return false ;
+		}
+		
+		if ($project->usesPlugin($this->name)) {
+			$result = db_query_params('SELECT sum(commits) AS commits, sum(adds) AS adds FROM stats_cvs_group WHERE group_id=$1',
+						  array ($project->getID())) ;
+			$commit_num = db_result($result,0,'commits');
+			$add_num    = db_result($result,0,'adds');
+			if (!$commit_num) {
+				$commit_num=0;
+			}
+			if (!$add_num) {
+				$add_num=0;
+			}
+			echo ' (CVS: '.sprintf(_('<strong>%1$s</strong> commits, <strong>%2$s</strong> adds'), number_format($commit_num, 0), number_format($add_num, 0)).")";
+		}
+	}
+	
 	function createOrUpdateRepo ($params) {
 		$project = $this->checkParams ($params) ;
 		if (!$project) {

Modified: trunk/gforge/plugins/scmsvn/common/SVNPlugin.class.php
===================================================================
--- trunk/gforge/plugins/scmsvn/common/SVNPlugin.class.php	2009-08-27 13:41:16 UTC (rev 7992)
+++ trunk/gforge/plugins/scmsvn/common/SVNPlugin.class.php	2009-08-27 13:41:26 UTC (rev 7993)
@@ -45,6 +45,18 @@
 		return $this->default_svn_server ;
 	}
 
+	function echoShortStats ($params) {
+		$project = $this->checkParams ($params) ;
+		if (!$project) {
+			return false ;
+		}
+		
+		if ($project->usesPlugin ($this->name)) {
+			list($commit_num, $add_num) = $this->getTotalStats($project->getID());
+			echo ' (SVN: '.sprintf(_('<strong>%1$s</strong> updates, <strong>%2$s</strong> adds'), number_format($commit_num, 0), number_format($add_num, 0)).')';
+		}
+	}
+	
 	function getBlurb () {
 		return _('<p>Documentation for Subversion (sometimes referred to as "SVN") is available <a href="http://svnbook.red-bean.com/">here</a>.</p>') ;
 	}
@@ -77,43 +89,25 @@
 		return $b ;
 	}
 
-	function getStats ($params) {
-		$project = $this->checkParams ($params) ;
-		if (!$project) {
-			return false ;
-		}
-		
-		if ($project->usesPlugin ($this->name)) {
-			list($commit_num, $add_num) = $this->getTotalStats($project->getID());
-			echo ' (SVN: '.sprintf(_('<strong>%1$s</strong> updates, <strong>%2$s</strong> adds'), number_format($commit_num, 0), number_format($add_num, 0)).')';
-		}
+	function getSnapshotPara ($project) {
+		return ;
 	}
-	
-	// Get the total stats for a group
-	function getTotalStats($group_id) {
-		$result = db_query_params ('
-			SELECT SUM(commits) AS commits, SUM(adds) AS adds
-			FROM stats_cvs_group
-			WHERE group_id=$1',
-			array($group_id));
-		$commit_num = db_result($result,0,0);
-		$add_num	= db_result($result,0,1);
-		if (!$commit_num) {
-			$commit_num=0;
-		}
-		if (!$add_num) {
-			$add_num=0;
-		}
-		return array($commit_num, $add_num);
+
+	function getBrowserBlock ($project) {
+		global $HTML ;
+		$b = $HTML->boxMiddle(_('Subversion Repository Browser'));
+		$b = _('<p>Browsing the Subversion tree gives you a view into the current status of this project\'s code. You may also view the complete histories of any file in the repository.</p>');
+		$b .= '<p>[' ;
+		$b .= util_make_link ("/scm/viewvc.php/?root=".$project->getUnixName(),
+				      _('Browse Subversion Repository')
+			) ;
+		$b .= ']</p>' ;
+		return $b ;
 	}
 	
-	function getDetailedStats ($params) {
-		global $HTML;
-
-		$project = $this->checkParams ($params) ;
-		if (!$project) {
-			return false ;
-		}
+	function getStatsBlock ($project) {
+		global $HTML ;
+		$b = $HTML->boxMiddle(_('Repository Statistics'));
 		
 		$result = db_query_params('SELECT u.realname, u.user_name, u.user_id, sum(commits) as commits, sum(adds) as adds, sum(adds+commits) as combined FROM stats_cvs_user s, users u WHERE group_id=$1 AND s.user_id=u.user_id AND (commits>0 OR adds >0) GROUP BY u.user_id, realname, user_name, u.user_id ORDER BY combined DESC, realname',
 					  array ($project->getID()));
@@ -124,26 +118,38 @@
 				_('Adds'),
 				_('Updates')
 				);
-			echo $HTML->listTableTop($tableHeaders);
+			$b .= $HTML->listTableTop($tableHeaders);
 			
 			$i = 0;
 			$total = array('adds' => 0, 'commits' => 0);
 			
 			while($data = db_fetch_array($result)) {
-				echo '<tr '. $HTML->boxGetAltRowStyle($i) .'>';
-				echo '<td width="50%">' ;
-				echo util_make_link_u ($data['user_name'], $data['user_id'], $data['realname']) ;
-				echo '</td><td width="25%" align="right">'.$data['adds']. '</td>'.
+				$b .= '<tr '. $HTML->boxGetAltRowStyle($i) .'>';
+				$b .= '<td width="50%">' ;
+				$b .= util_make_link_u ($data['user_name'], $data['user_id'], $data['realname']) ;
+				$b .= '</td><td width="25%" align="right">'.$data['adds']. '</td>'.
 					'<td width="25%" align="right">'.$data['commits'].'</td></tr>';
 				$total['adds'] += $data['adds'];
 				$total['commits'] += $data['commits'];
 				$i++;
 			}
-			list($commit_num, $add_num) = $this->getTotalStats($group_id);
+
+			$res2 = db_query("
+			SELECT SUM(commits) AS commits, SUM(adds) AS adds
+			FROM stats_cvs_group
+			WHERE group_id='$group_id'");
+			$commit_num = db_result($res2,0,0);
+			$add_num = db_result($res2,0,1);
+			if (!$commit_num) {
+				$commit_num=0;
+			}
+			if (!$add_num) {
+				$add_num=0;
+			}
 			if ($commit_num > $total['commits'] ||
 			    $add_num > $total['adds']) {
-				echo '<tr '. $HTML->boxGetAltRowStyle($i) .'>';
-				echo '<td width="50%">' .
+				$b .= '<tr '. $HTML->boxGetAltRowStyle($i) .'>';
+				$b .= '<td width="50%">' .
 					_('Unknown') .
 					'</td><td width="25%" align="right">'.
 					($add_num - $total['adds']) . '</td>'.
@@ -152,14 +158,16 @@
 					'</td></tr>';
 				$i++;
 			}
-			echo '<tr '. $HTML->boxGetAltRowStyle($i) .'>';
-			echo '<td width="50%"><strong>'._('Total').':</strong></td>'.
+			$b .= '<tr '. $HTML->boxGetAltRowStyle($i) .'>';
+			$b .= '<td width="50%"><strong>'._('Total').':</strong></td>'.
 				'<td width="25%" align="right"><strong>'.$add_num. '</strong></td>'.
 				'<td width="25%" align="right"><strong>'.$commit_num.'</strong></td>';
-			echo '</tr>';
-			echo $HTML->listTableBottom();
-			echo '<hr size="1" />';
+			$b .= '</tr>';
+			$b .= $HTML->listTableBottom();
+			$b .= '<hr size="1" />';
 		}
+
+		return $b ;
 	}
 
 	function createOrUpdateRepo ($params) {




More information about the Fusionforge-commits mailing list