[phpcvsview-cvs-updates] phpcvsview func_DirListing.php,1.7,1.8 phpcvs.php,1.17,1.18
Status: Pre-Alpha
Brought to you by:
bcheesem
From: Brian C. <bch...@us...> - 2004-12-19 04:51:48
|
Update of /cvsroot/phpcvsview/phpcvsview In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv21992 Modified Files: func_DirListing.php phpcvs.php Log Message: - Added basic support for CVS modules. This code exports the /CVSROOT/modules fiel, parses it and then displays them in the top most folder. Index: phpcvs.php =================================================================== RCS file: /cvsroot/phpcvsview/phpcvsview/phpcvs.php,v retrieving revision 1.17 retrieving revision 1.18 diff -C2 -d -r1.17 -r1.18 *** phpcvs.php 6 Oct 2004 08:32:49 -0000 1.17 --- phpcvs.php 19 Dec 2004 04:51:37 -0000 1.18 *************** *** 1045,1048 **** --- 1045,1084 ---- return true; } + + // *************************************************************************** + // Function: getModuleList() + // Author: Brian Cheeseman. + // Parameters: None. + // Return Value: Array - contains list of module names and paths + // *************************************************************************** + function getModuleList() + { + // Create our resultant Array. + $Results = array(); + + // Save the current FILECONTENTS just in case. + $TempFileContents = $this->FILECONTENTS; + + // Get a copy of the current modules definition file. + $this->ExportFile("/CVSROOT/modules", gmmktime()); + $Lines = explode("\n", $this->FILECONTENTS); + + // Process each line of the modules file looking for module definitions. + foreach ($Lines as $Line) { + if (strncmp($Line, '#', 1) != 0) { + // Process the line. + $Elements = explode(" ", $Line); + if (count($Elements) > 1) { + $Results[$Elements[0]] = $Elements[1]; + } + } + } + + // Restore the saved FILECONTENTS. + $this->FILECONTENTS = $TempFileContents; + + // Return our work. + return $Results; + } // *************************************************************************** Index: func_DirListing.php =================================================================== RCS file: /cvsroot/phpcvsview/phpcvsview/func_DirListing.php,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** func_DirListing.php 6 Oct 2004 08:40:29 -0000 1.7 --- func_DirListing.php 19 Dec 2004 04:51:37 -0000 1.8 *************** *** 33,36 **** --- 33,45 ---- // Get a RLOG of the module path specified in $config['mod_path']. $CVSServer->RLog($env['mod_path']); + + // If we are in the Root of the CVS Repository then lets get the Module list. + if (strlen($env['mod_path']) < 2) { + $Modules = $CVSServer->getModuleList(); + } + else + { + $Modules = false; + } // Add the quick link navigation bar. *************** *** 41,50 **** // Do we need the "Back" operation. ! if (strlen($env['mod_path']) > 1) { ! addParentDirectory($env['script_name'], $env['script_path'], $env['mod_path']); } // Display the folders within the table. addFolders($env['mod_path'], $CVSServer->FOLDERS); // Display the files within the table. --- 50,64 ---- // Do we need the "Back" operation. ! if (strlen($env['mod_path']) > 2) { ! addParentDirectory($env['mod_path']); } // Display the folders within the table. addFolders($env['mod_path'], $CVSServer->FOLDERS); + + // Display the Modules if we have them. + if ($Modules !== false) { + addModules($env['mod_path'], $Modules); + } // Display the files within the table. |