$this->SCMPlugin () ;
$this->name = 'scmcvs';
$this->text = 'CVS';
+ $this->hooks[] = 'scm_browser_page';
$this->hooks[] = 'scm_generate_snapshots' ;
$this->hooks[] = 'scm_gather_stats' ;
$this->default_cvs_server = $default_cvs_server ;
if ($cvs_root) {
$this->cvs_root = $cvs_root;
- elseif ($cvsdir_prefix) {
+ } elseif ($cvsdir_prefix) {
$this->cvs_root = $cvsdir_prefix;
} else {
- $this->cvs_root = "/cvsroot";
+ $this->cvs_root = $GLOBALS['sys_chroot'].'/scmrepos/cvs' ;
}
- $this->enabled_by_default = $enabled_by_default ;
$this->register () ;
}
return $this->default_cvs_server;
}
+ function printShortStats ($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 getBlurb () {
return _('<p>CVS documentation is available <a href="http://cvsbook.red-bean.com/">here</a>.</p>');
}
}
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>');
+ $cvsrootend = $project->getSCMBox().':'.$this->cvs_root.'/'.$project->getUnixName();
+ if (session_loggedin()) {
+ $u =& user_get_object(user_getid()) ;
+ $d = $u->getUnixName() ;
+ $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> with the proper value. Enter your site password when prompted.</p>');
+ $b .= '<p>
+ <tt>export CVS_RSH=ssh</tt><br/>
+ <tt>cvs -d :ext:'.$d.'@'.$cvsrootend.' checkout <em>'._('modulename').'</em></tt>
+ </p>';
+ } else {
+ $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>';
-
+ }
return $b ;
}
return $b ;
}
- function getBrowserBlock ($project) {
+ function getBrowserLinkBlock ($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(),
+ $b .= util_make_link ("/scm/browser.php?group_id=".$project->getID(),
_('Browse CVS Repository')
) ;
$b .= ']</p>' ;
'<td width="25%" align="right"><strong>'.$total['commits'].'</strong></td>';
$b .= '</tr>';
$b .= $HTML->listTableBottom();
- $b .= '<hr size="1" />';
}
return $b ;
}
- function echoShortStats ($params) {
+ function printBrowserPage ($params) {
+ global $HTML;
+
$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;
+ if ($project->usesPlugin ($this->name)) {
+ if ($this->browserDisplayable ($project)) {
+ print '<iframe src="'.util_make_url ("/scm/viewvc.php/?root=".$project->getUnixName()).'" frameborder="no" width=100% height=700></iframe>' ;
}
- 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) {
$snapshot = $sys_scm_snapshots_path.'/'.$group_name.'-scm-latest.tar.gz';
$tarball = $sys_scm_tarballs_path.'/'.$group_name.'-scmroot.tar.gz';
- if (! $project->usesPlugin ($this->name)
- || ! $project->enableAnonSCM()) {
+ if (! $project->usesPlugin ($this->name)) {
+ return false;
+ }
+
+ if (! $project->enableAnonSCM()) {
unlink ($snapshot) ;
unlink ($tarball) ;
return false;