[evolvis-commits] r13638: Started preparing for gitweb

mirabilos at evolvis.org mirabilos at evolvis.org
Mon Feb 28 02:52:00 CET 2011


Author: mirabilos
Date: 2011-02-28 02:51:58 +0100 (Mon, 28 Feb 2011)
New Revision: 13638

Modified:
   trunk/gforge_base/evolvisforge-5.1/gforge/plugins/scmgit/common/GitPlugin.class.php
Log:
Started preparing for gitweb

Modified: trunk/gforge_base/evolvisforge-5.1/gforge/plugins/scmgit/common/GitPlugin.class.php
===================================================================
--- trunk/gforge_base/evolvisforge-5.1/gforge/plugins/scmgit/common/GitPlugin.class.php	2011-02-28 01:51:54 UTC (rev 13637)
+++ trunk/gforge_base/evolvisforge-5.1/gforge/plugins/scmgit/common/GitPlugin.class.php	2011-02-28 01:51:58 UTC (rev 13638)
@@ -27,6 +27,9 @@
 		$this->SCMPlugin () ;
 		$this->name = 'scmgit';
 		$this->text = 'Git';
+		# $this->hooks[] = 'scm_update_repolist' ;
+		$this->hooks[] = 'scm_browser_page' ;
+		# $this->hooks[] = 'scm_gather_stats' ;
 		$this->hooks[] = 'scm_generate_snapshots' ;
 		
 		require_once $gfconfig.'plugins/scmgit/config.php' ;
@@ -60,13 +63,87 @@
 	}
 
 	function getSnapshotPara ($project) {
-		return ;
+		global $sys_scm_snapshots_path ;
+		$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>';
+		}
+		return $b ;
 	}
 
+	function printBrowserPage ($params) {
+		global $HTML;
+
+		$project = $this->checkParams ($params) ;
+		if (!$project) {
+			return false ;
+		}
+		
+		if ($project->usesPlugin ($this->name)) {
+			if ($this->browserDisplayable ($project)) {
+				print '<iframe src="'.util_make_url ("/plugins/scmgit/cgi-bin/gitweb.cgi?r=".$project->getUnixName()).'" frameborder="no" width=100% height=700></iframe>' ;
+			}
+		}
+	}
+
 	function getBrowserLinkBlock ($project) {
-		return ;
+		global $HTML ;
+		$b = $HTML->boxMiddle(_('Git Repository Browser'));
+		$b .= _('<p>Browsing the Git 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/browser.php?group_id=".$project->getID(),
+				      _('Browse Git Repository')
+			) ;
+		$b .= ']</p>' ;
+		return $b ;
 	}
 
+// 	function getStatsBlock ($project) {
+// 		global $HTML ;
+// 		$b = '' ;
+
+// 		$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) {
+// 			$b .= $HTML->boxMiddle(_('Repository Statistics'));
+
+// 			$tableHeaders = array(
+// 				_('Name'),
+// 				_('Adds'),
+// 				_('Commits')
+// 				);
+// 			$b .= $HTML->listTableTop($tableHeaders);
+			
+// 			$i = 0;
+// 			$total = array('adds' => 0, 'commits' => 0);
+			
+// 			while($data = db_fetch_array($result)) {
+// 				$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++;
+// 			}
+// 			$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>';
+// 			$b .= '</tr>';
+// 			$b .= $HTML->listTableBottom();
+// 			$b .= '<hr size="1" />';
+// 		}
+
+// 		return $b ;
+// 	}
 	function getStatsBlock ($project) {
 		return ;
 	}
@@ -97,6 +174,36 @@
 		}
 	}
 
+	function updateRepositoryList ($params) {
+		$groups = $this->getGroups () ;
+		$list = array () ;
+		foreach ($groups as $project) {
+			if ($this->browserDisplayable ($project)) {
+				$list[] = $project ;
+			}
+		}
+
+/*		$fname = '/etc/gforge/plugins/scmdarcs/config.py' ;
+
+		$f = fopen ($fname.'.new', 'w') ;
+		foreach ($list as $project) {
+			$classname = str_replace ('-', '_',
+						  'repo_' . $project->getUnixName()) ;
+			
+			$repo = $this->git_root . '/' . $project->getUnixName() ;
+			fwrite ($f, "class: $classname\n"
+				."\treponame = $classname\n"
+			       ."\trepodir = $repo\n"
+				."\trepourl = " . util_make_url ('/anonscm/git/'.$project->getUnixName().'/') . "\n"
+				."\trepoprojurl = " . util_make_url ('/projects/'.$project->getUnixName().'/') . "\n"
+				. "\n") ;
+		}
+		fclose ($f) ;
+		chmod ($fname.'.new', 0644) ;
+		rename ($fname.'.new', $fname) ;
+*/
+	}
+
 	function generateSnapshots ($params) {
 		global $sys_scm_tarballs_path ;
 



More information about the evolvis-commits mailing list