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

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


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

Modified:
   trunk/gforge/common/include/SCMPlugin.class.php
   trunk/gforge/plugins/scmbzr/common/BzrPlugin.class.php
   trunk/gforge/plugins/scmcvs/common/CVSPlugin.class.php
   trunk/gforge/plugins/scmsvn/common/SVNPlugin.class.php
Log:
Various fixes

Modified: trunk/gforge/common/include/SCMPlugin.class.php
===================================================================
--- trunk/gforge/common/include/SCMPlugin.class.php	2009-08-27 13:41:05 UTC (rev 7991)
+++ trunk/gforge/common/include/SCMPlugin.class.php	2009-08-27 13:41:16 UTC (rev 7992)
@@ -44,8 +44,7 @@
 		
 		switch ($hookname) {
 		case 'scm_page':
-			$group_id = $params['group_id'] ;
-			$this->getPage ($group_id) ;
+			$this->getPage ($params) ;
 			break ;
 		case 'scm_admin_update':
 			$this->AdminUpdate ($params) ;
@@ -110,16 +109,14 @@
 		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 getPage ($group_id) {
+	function getPage ($params) {
 		global $HTML, $sys_scm_snapshots_path;
 
-		$project =& group_get_object($group_id);
-		if (!$project || !is_object($project)) {
-			return false;
-		} elseif ($project->isError()) {
-			return false;
+		$project = $this->checkParams ($params) ;
+		if (!$project) {
+			return false ;
 		}
-
+		
 		if ($project->usesPlugin ($this->name)) {
 
 			// Table for summary info
@@ -139,7 +136,7 @@
 				$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=$group_id",
+					print util_make_link ("/snapshots.php?group_id=".$project->getID(),
 							      _('Download the nightly snapshot')
 						) ;
 					print ']</p>';
@@ -149,7 +146,7 @@
 
 			// Browsing
 			echo $HTML->boxTop(_('Repository History'));
-			echo $this->getDetailedStats(array('group_id'=>$group_id)).'<p>';
+			echo $this->getDetailedStats(array('group_id'=>$project->getID())).'<p>';
 			if ($this->browserDisplayable ($project)) {
 				print $this->getBrowserBlurb ($project) ;
 				echo '<p>[' ;

Modified: trunk/gforge/plugins/scmbzr/common/BzrPlugin.class.php
===================================================================
--- trunk/gforge/plugins/scmbzr/common/BzrPlugin.class.php	2009-08-27 13:41:05 UTC (rev 7991)
+++ trunk/gforge/plugins/scmbzr/common/BzrPlugin.class.php	2009-08-27 13:41:16 UTC (rev 7992)
@@ -56,7 +56,7 @@
 	function getInstructionsForRW ($project) {
 		$b = '' ;
 		$b .= _('<p><b>Developer Bazaar Access via SSH</b></p><p>Only project developers can access the Bazaar branches via this method. SSH must be installed on your client machine. Substitute <i>developername</i> with the proper values. Enter your site password when prompted.</p>');
-		$b .= '<p><tt>bzr checkout bzr+ssh://<i>'._('developername').'</i>@' . $project->getSCMBox() . '/'. $this->bzr_root .'/'. $project->getUnixName().'/'._('branchname').'</tt></p>' ;
+		$b .= '<p><tt>bzr checkout bzr+ssh://<i>'._('developername').'</i>@' . $project->getSCMBox() . $this->bzr_root .'/'. $project->getUnixName().'/'._('branchname').'</tt></p>' ;
 		
 		return $b ;
 	}

Modified: trunk/gforge/plugins/scmcvs/common/CVSPlugin.class.php
===================================================================
--- trunk/gforge/plugins/scmcvs/common/CVSPlugin.class.php	2009-08-27 13:41:05 UTC (rev 7991)
+++ trunk/gforge/plugins/scmcvs/common/CVSPlugin.class.php	2009-08-27 13:41:16 UTC (rev 7992)
@@ -61,7 +61,7 @@
 		}
 	}
 
-	function getPage ($group_id) {
+	function getPage ($params) {
 		global $HTML ;
 
 		$project = $this->checkParams ($params) ;
@@ -112,7 +112,7 @@
 			// CVS Snapshot
 			if ($this->browserDisplayable ($project)) {
 				print '<p>[' ;
-				print util_make_link ("/snapshots.php?group_id=$group_id",
+				print util_make_link ("/snapshots.php?group_id=".$project->getID(),
 						      _('Download The Nightly CVS Tree Snapshot')
 					) ;
 				print ']</p>';
@@ -121,7 +121,7 @@
 			
 			// CVS Browsing 
 			echo $HTML->boxTop(_('Repository History'));
-			echo $this->getDetailedStats(array('group_id'=>$group_id)).'<p>';
+			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>[' ;
@@ -182,11 +182,8 @@
 		}
 		
 		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($group_id));
+			$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) {
@@ -201,15 +198,14 @@
 	
 	function getDetailedStats ($params) {
 		global $HTML;
-		$group_id = $params['group_id'] ;
+
+		$project = $this->checkParams ($params) ;
+		if (!$project) {
+			return false ;
+		}
 		
-		$result = db_query('
-			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=\''.$group_id.'\' 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;
-		');
+		$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()));
 		
 		if (db_numrows($result) > 0) {
 			$tableHeaders = array(

Modified: trunk/gforge/plugins/scmsvn/common/SVNPlugin.class.php
===================================================================
--- trunk/gforge/plugins/scmsvn/common/SVNPlugin.class.php	2009-08-27 13:41:05 UTC (rev 7991)
+++ trunk/gforge/plugins/scmsvn/common/SVNPlugin.class.php	2009-08-27 13:41:16 UTC (rev 7992)
@@ -109,16 +109,15 @@
 	
 	function getDetailedStats ($params) {
 		global $HTML;
-		$group_id = $params['group_id'] ;
-		
-		$result = db_query('
-			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=\''.$group_id.'\' AND s.user_id=u.user_id AND (commits>0 OR adds >0)
-			GROUP BY group_id, realname, user_name, u.user_id
-			ORDER BY combined DESC, realname;
-		');
 
+		$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()));
+		
 		if (db_numrows($result) > 0) {
 			$tableHeaders = array(
 				_('Name'),




More information about the Fusionforge-commits mailing list