enhanced source browser by fixing minor bugs and adding a diff view

This commit is contained in:
hyung-hwan 2010-01-31 13:20:48 +00:00
parent 475cfd028e
commit 00e1d5f401
26 changed files with 1168 additions and 232 deletions

View File

@ -154,17 +154,20 @@ class Project extends Controller
$project = $this->projects->get ($projectid); $project = $this->projects->get ($projectid);
if ($project === FALSE) if ($project === FALSE)
{ {
$data['loginid'] = $loginid;
$data['message'] = 'DATABASE ERROR'; $data['message'] = 'DATABASE ERROR';
$this->load->view ($this->VIEW_ERROR, $data); $this->load->view ($this->VIEW_ERROR, $data);
} }
else if ($project === NULL) else if ($project === NULL)
{ {
$data['loginid'] = $loginid;
$data['message'] = "NO SUCH PROJECT - $projectid"; $data['message'] = "NO SUCH PROJECT - $projectid";
$this->load->view ($this->VIEW_ERROR, $data); $this->load->view ($this->VIEW_ERROR, $data);
} }
else if (!$this->login->isSysadmin() && else if (!$this->login->isSysadmin() &&
$this->projects->projectHasMember($project->id, $loginid) === FALSE) $this->projects->projectHasMember($project->id, $loginid) === FALSE)
{ {
$data['loginid'] = $loginid;
$data['message'] = "NO PERMISSION - $projectid"; $data['message'] = "NO PERMISSION - $projectid";
$this->load->view ($this->VIEW_ERROR, $data); $this->load->view ($this->VIEW_ERROR, $data);
} }
@ -243,17 +246,20 @@ class Project extends Controller
$project = $this->projects->get ($projectid); $project = $this->projects->get ($projectid);
if ($project === FALSE) if ($project === FALSE)
{ {
$data['loginid'] = $loginid;
$data['message'] = 'DATABASE ERROR'; $data['message'] = 'DATABASE ERROR';
$this->load->view ($this->VIEW_ERROR, $data); $this->load->view ($this->VIEW_ERROR, $data);
} }
else if ($project === NULL) else if ($project === NULL)
{ {
$data['loginid'] = $loginid;
$data['message'] = "NO SUCH PROJECT - $projectid"; $data['message'] = "NO SUCH PROJECT - $projectid";
$this->load->view ($this->VIEW_ERROR, $data); $this->load->view ($this->VIEW_ERROR, $data);
} }
else if (!$this->login->isSysadmin() && else if (!$this->login->isSysadmin() &&
$this->projects->projectHasMember($project->id, $loginid) === FALSE) $this->projects->projectHasMember($project->id, $loginid) === FALSE)
{ {
$data['loginid'] = $loginid;
$data['message'] = "NO PERMISSION - $projectid"; $data['message'] = "NO PERMISSION - $projectid";
$this->load->view ($this->VIEW_ERROR, $data); $this->load->view ($this->VIEW_ERROR, $data);
} }

View File

@ -7,6 +7,7 @@ class Source extends Controller
var $VIEW_FILE = 'source_file'; var $VIEW_FILE = 'source_file';
var $VIEW_BLAME = 'source_blame'; var $VIEW_BLAME = 'source_blame';
var $VIEW_HISTORY = 'source_history'; var $VIEW_HISTORY = 'source_history';
var $VIEW_DIFF = 'source_diff';
function Source () function Source ()
{ {
@ -36,6 +37,7 @@ class Source extends Controller
$data['loginid'] = $loginid; $data['loginid'] = $loginid;
$path = $this->converter->HexToAscii ($path); $path = $this->converter->HexToAscii ($path);
if ($path == '.') $path = ''; /* treat a period specially */
$project = $this->projects->get ($projectid); $project = $this->projects->get ($projectid);
if ($project === FALSE) if ($project === FALSE)
@ -58,10 +60,17 @@ class Source extends Controller
} }
else else
{ {
$data['project'] = $project; $data['project'] = $project;
$data['folder'] = $path; $data['folder'] = $path;
$data['files'] = $files; $data['files'] = $files;
$data['revision'] = $rev; $data['revision'] = $rev;
$data['prev_revision'] =
$this->subversion->getPrevRev ($projectid, $path, $rev);
$data['next_revision'] =
$this->subversion->getNextRev ($projectid, $path, $rev);
$this->load->view ($this->VIEW_FOLDER, $data); $this->load->view ($this->VIEW_FOLDER, $data);
} }
} }
@ -112,6 +121,20 @@ class Source extends Controller
} }
else else
{ {
$head_rev = $this->subversion->getHeadRev ($projectid, $path);
if ($head_rev === FALSE)
{
$data['message'] = 'Failed to get head revision';
$this->load->view ($this->VIEW_ERROR, $data);
}
else
{
$file['head_rev'] = $head_rev;
$file['prev_rev'] = $this->subversion->getPrevRev (
$projectid, $path, $file['created_rev']);
$file['next_rev'] = $this->subversion->getNextRev (
$projectid, $path, $file['created_rev']);
$data['project'] = $project; $data['project'] = $project;
$data['folder'] = substr ($path, 0, strrpos($path, '/')); $data['folder'] = substr ($path, 0, strrpos($path, '/'));
$data['file'] = $file; $data['file'] = $file;
@ -120,6 +143,7 @@ class Source extends Controller
} }
} }
} }
}
function blame ($projectid, $path, $rev = SVN_REVISION_HEAD) function blame ($projectid, $path, $rev = SVN_REVISION_HEAD)
{ {
@ -154,6 +178,20 @@ class Source extends Controller
} }
else else
{ {
$head_rev = $this->subversion->getHeadRev ($projectid, $path);
if ($head_rev === FALSE)
{
$data['message'] = 'Failed to get head revision';
$this->load->view ($this->VIEW_ERROR, $data);
}
else
{
$file['head_rev'] = $head_rev;
$file['prev_rev'] = $this->subversion->getPrevRev (
$projectid, $path, $file['created_rev']);
$file['next_rev'] = $this->subversion->getNextRev (
$projectid, $path, $file['created_rev']);
$data['project'] = $project; $data['project'] = $project;
$data['folder'] = substr ($path, 0, strrpos($path, '/')); $data['folder'] = substr ($path, 0, strrpos($path, '/'));
$data['file'] = $file; $data['file'] = $file;
@ -162,6 +200,7 @@ class Source extends Controller
} }
} }
} }
}
function history ($type, $projectid, $path = '', $rev = SVN_REVISION_HEAD) function history ($type, $projectid, $path = '', $rev = SVN_REVISION_HEAD)
{ {
@ -207,4 +246,55 @@ class Source extends Controller
} }
} }
function diff ($projectid, $path, $rev1 = SVN_REVISION_HEAD, $rev2 = SVN_REVISION_PREV)
{
$this->load->model ('ProjectModel', 'projects');
$this->load->model ('SubversionModel', 'subversion');
$loginid = $this->login->getUserid ();
if (CODEPOT_ALWAYS_REQUIRE_SIGNIN && $loginid == '')
redirect ('main/signin');
$data['loginid'] = $loginid;
$path = $this->converter->HexToAscii ($path);
$project = $this->projects->get ($projectid);
if ($project === FALSE)
{
$data['message'] = 'DATABASE ERROR';
$this->load->view ($this->VIEW_ERROR, $data);
}
else if ($project === NULL)
{
$data['message'] = "NO SUCH PROJECT - $projectid";
$this->load->view ($this->VIEW_ERROR, $data);
}
else
{
$file = $this->subversion->getDiff ($projectid, $path, $rev1, $rev2);
if ($file === FALSE)
{
$data['message'] = 'Failed to get diff';
$this->load->view ($this->VIEW_ERROR, $data);
}
else
{
$file['prev_rev'] =
$this->subversion->getPrevRev ($projectid, $path, $file['created_rev']);
$file['next_rev'] =
$this->subversion->getNextRev ($projectid, $path, $file['created_rev']);
$file['against']['prev_rev'] =
$this->subversion->getPrevRev ($projectid, $path, $file['against']['created_rev']);
$file['against']['next_rev'] =
$this->subversion->getNextRev ($projectid, $path, $file['against']['created_rev']);
$data['project'] = $project;
$data['folder'] = substr ($path, 0, strrpos($path, '/'));
$data['file'] = $file;
$data['revision1'] = $rev1;
$data['revision2'] = $rev2;
$this->load->view ($this->VIEW_DIFF, $data);
}
}
}
} }

View File

@ -7,8 +7,10 @@ $lang['Created on'] = 'Created on';
$lang['Delete'] = 'Delete'; $lang['Delete'] = 'Delete';
$lang['Description'] = 'Description'; $lang['Description'] = 'Description';
$lang['Details'] = 'Details'; $lang['Details'] = 'Details';
$lang['Difference'] = 'Diff';
$lang['Download'] = 'Download'; $lang['Download'] = 'Download';
$lang['Edit'] = 'Edit'; $lang['Edit'] = 'Edit';
$lang['Head revision'] = 'Head revision';
$lang['History'] = 'History'; $lang['History'] = 'History';
$lang['Home'] = 'Home'; $lang['Home'] = 'Home';
$lang['File'] = 'File'; $lang['File'] = 'File';
@ -45,6 +47,7 @@ $lang['Username'] = 'Username';
$lang['Wiki'] = 'Wiki'; $lang['Wiki'] = 'Wiki';
$lang['Wikis'] = 'Wikis'; $lang['Wikis'] = 'Wikis';
$lang['MSG_NO_DIFF'] = 'No difference found';
$lang['MSG_NO_FILES_AVAIL'] = 'No files available'; $lang['MSG_NO_FILES_AVAIL'] = 'No files available';
$lang['MSG_NO_SOURCE_AVAIL'] = 'No source available'; $lang['MSG_NO_SOURCE_AVAIL'] = 'No source available';
$lang['MSG_NO_WIKIS_AVAIL'] = 'No wiki pages available'; $lang['MSG_NO_WIKIS_AVAIL'] = 'No wiki pages available';

View File

@ -7,8 +7,10 @@ $lang['Created on'] = 'Waktu dibuat';
$lang['Delete'] = 'Hapus'; $lang['Delete'] = 'Hapus';
$lang['Description'] = 'Penjelasan'; $lang['Description'] = 'Penjelasan';
$lang['Details'] = 'Detail'; $lang['Details'] = 'Detail';
$lang['Difference'] = 'Beda';
$lang['Download'] = 'Download'; $lang['Download'] = 'Download';
$lang['Edit'] = 'Rubah'; $lang['Edit'] = 'Rubah';
$lang['Head revision'] = 'Kepala Revisi';
$lang['History'] = 'Sejarah'; $lang['History'] = 'Sejarah';
$lang['Home'] = 'Beranda'; $lang['Home'] = 'Beranda';
$lang['File'] = 'File'; $lang['File'] = 'File';
@ -45,6 +47,7 @@ $lang['Username'] = 'Nama pemakai';
$lang['Wiki'] = 'Wiki'; $lang['Wiki'] = 'Wiki';
$lang['Wikis'] = 'Wiki'; $lang['Wikis'] = 'Wiki';
$lang['MSG_NO_DIFF'] = 'Tidak ada bedanya';
$lang['MSG_NO_FILES_AVAIL'] = 'Tidak ada file tersedia'; $lang['MSG_NO_FILES_AVAIL'] = 'Tidak ada file tersedia';
$lang['MSG_NO_SOURCE_AVAIL'] = 'Tidak ada sumber tersedia'; $lang['MSG_NO_SOURCE_AVAIL'] = 'Tidak ada sumber tersedia';
$lang['MSG_NO_WIKIS_AVAIL'] = 'Tidak ada halaman wiki tersedia'; $lang['MSG_NO_WIKIS_AVAIL'] = 'Tidak ada halaman wiki tersedia';

View File

@ -7,9 +7,11 @@ $lang['Created on'] = '최초생성시간';
$lang['Delete'] = '삭제'; $lang['Delete'] = '삭제';
$lang['Description'] = '설명'; $lang['Description'] = '설명';
$lang['Details'] = '상세내역'; $lang['Details'] = '상세내역';
$lang['Difference'] = '차이점';
$lang['Download'] = '내려받기'; $lang['Download'] = '내려받기';
$lang['Edit'] = '수정'; $lang['Edit'] = '수정';
$lang['History'] = '변경내역'; $lang['Head revision'] = '최신리비전';
$lang['History'] = '변경기록';
$lang['Home'] = '홈'; $lang['Home'] = '홈';
$lang['File'] = '파일'; $lang['File'] = '파일';
$lang['Files'] = '파일'; $lang['Files'] = '파일';
@ -45,6 +47,7 @@ $lang['Username'] = '사용자명';
$lang['Wiki'] = '위키'; $lang['Wiki'] = '위키';
$lang['Wikis'] = '위키'; $lang['Wikis'] = '위키';
$lang['MSG_NO_DIFF'] = '차이점이 없습니다';
$lang['MSG_NO_FILES_AVAIL'] = '사용가능한 파일이 없습니다'; $lang['MSG_NO_FILES_AVAIL'] = '사용가능한 파일이 없습니다';
$lang['MSG_NO_SOURCE_AVAIL'] = '사용가능한 소스가 없습니다'; $lang['MSG_NO_SOURCE_AVAIL'] = '사용가능한 소스가 없습니다';
$lang['MSG_NO_WIKIS_AVAIL'] = '사용가능한 위키페이지가 없습니다'; $lang['MSG_NO_WIKIS_AVAIL'] = '사용가능한 위키페이지가 없습니다';

View File

@ -241,9 +241,9 @@ class ProjectModel extends Model
function deleteDirectory($dir) function deleteDirectory($dir)
{ {
if (is_link($dir)) return unlink($dir); if (is_link($dir)) return @unlink($dir);
if (!file_exists($dir)) return TRUE; if (!file_exists($dir)) return TRUE;
if (!is_dir($dir)) return unlink($dir); if (!is_dir($dir)) return @unlink($dir);
foreach ($this->_scandir($dir) as $item) foreach ($this->_scandir($dir) as $item)
{ {

View File

@ -68,6 +68,337 @@ class SubversionModel extends Model
$fileinfo['history'] = $str; $fileinfo['history'] = $str;
return $fileinfo; return $fileinfo;
} }
function _get_diff ($diff, $all, $ent)
{
/* copied from websvn */
if ($all)
{
$ofile = fopen ($oldtname, "r");
$nfile = fopen ($newtname, "r");
}
// Ignore the 4 header lines
$line = fgets($diff);
$line = fgets($diff);
$line = fgets($diff);
$line = fgets($diff);
// Get the first real line
$line = fgets($diff);
$index = 0;
$listing = array();
$curoline = 1;
$curnline = 1;
while (!feof($diff))
{
// Get the first line of this range
sscanf($line, "@@ -%d", $oline);
$line = substr($line, strpos($line, "+"));
sscanf($line, "+%d", $nline);
if ($all)
{
while ($curoline < $oline || $curnline < $nline)
{
$listing[$index]["rev1diffclass"] = "diff";
$listing[$index]["rev2diffclass"] = "diff";
if ($curoline < $oline)
{
$nl = fgets($ofile);
$line = rtrim($nl);
if ($ent) $line = replaceEntities($line, $rep);
//$listing[$index]["rev1line"] = hardspace($line);
$listing[$index]["rev1line"] = $line;
$curoline++;
}
else
{
//$listing[$index]["rev1line"] = "&nbsp;";
$listing[$index]["rev1line"] = "";
}
if ($curnline < $nline)
{
$nl = fgets($nfile);
$line = rtrim($nl);
if ($ent) $line = replaceEntities($line, $rep);
//$listing[$index]["rev2line"] = hardspace($line);
$listing[$index]["rev2line"] = $line;
$curnline++;
}
else
{
//$listing[$index]["rev2line"] = "&nbsp;";
$listing[$index]["rev2line"] = "";
}
$listing[$index]["rev1lineno"] = 0;
$listing[$index]["rev2lineno"] = 0;
$index++;
}
}
else
{
// Output the line numbers
$listing[$index]["rev1lineno"] = $oline;
$listing[$index]["rev2lineno"] = $nline;
$index++;
}
$fin = false;
while (!feof($diff) && !$fin)
{
$line = fgets($diff);
if ($line === false || strncmp($line, "@@", 2) == 0)
{
$fin = true;
}
else
{
$listing[$index]["rev1lineno"] = 0;
$listing[$index]["rev2lineno"] = 0;
$mod = $line{0};
$line = rtrim(substr($line, 1));
if ($ent) $line = replaceEntities($line, $rep);
//if (strip_tags($line) == '') $line = '&nbsp;';
//$listing[$index]["rev1line"] = hardspace($line);
$listing[$index]["rev1line"] = $line;
//$text = hardspace($line);
$text = $line;
switch ($mod)
{
case "-":
$listing[$index]["rev1diffclass"] = "diffdeleted";
$listing[$index]["rev2diffclass"] = "diff";
$listing[$index]["rev1line"] = $text;
//$listing[$index]["rev2line"] = "&nbsp;";
$listing[$index]["rev2line"] = '';
if ($all) {
fgets($ofile);
$curoline++;
}
break;
case "+":
// Try to mark "changed" line sensibly
if (!empty($listing[$index-1]) &&
empty($listing[$index-1]["rev1lineno"]) &&
@$listing[$index-1]["rev1diffclass"] == "diffdeleted" &&
@$listing[$index-1]["rev2diffclass"] == "diff")
{
$i = $index - 1;
while (!empty($listing[$i-1]) &&
empty($listing[$i-1]["rev1lineno"]) &&
$listing[$i-1]["rev1diffclass"] == "diffdeleted" &&
$listing[$i-1]["rev2diffclass"] == "diff")
{
$i--;
}
$listing[$i]["rev1diffclass"] = "diffchanged";
$listing[$i]["rev2diffclass"] = "diffchanged";
$listing[$i]["rev2line"] = $text;
if ($all) {
fgets($nfile);
$curnline++;
}
// Don't increment the current index count
$index--;
} else {
$listing[$index]["rev1diffclass"] = "diff";
$listing[$index]["rev2diffclass"] = "diffadded";
//$listing[$index]["rev1line"] = "&nbsp;";
$listing[$index]["rev1line"] = '';
$listing[$index]["rev2line"] = $text;
if ($all) {
fgets($nfile);
$curnline++;
}
}
break;
default:
$listing[$index]["rev1diffclass"] = "diff";
$listing[$index]["rev2diffclass"] = "diff";
$listing[$index]["rev1line"] = $text;
$listing[$index]["rev2line"] = $text;
if ($all) {
fgets($ofile);
fgets($nfile);
$curoline++;
$curnline++;
}
break;
}
}
if (!$fin) {
$index++;
}
}
}
// Output the rest of the files
if ($all)
{
while (!feof($ofile) || !feof($nfile))
{
$listing[$index]["rev1diffclass"] = "diff";
$listing[$index]["rev2diffclass"] = "diff";
$line = rtrim(fgets($ofile));
if ($ent) $line = replaceEntities($line, $rep);
if (!feof($ofile)) {
//$listing[$index]["rev1line"] = hardspace($line);
$listing[$index]["rev1line"] = $line;
}
else {
//$listing[$index]["rev1line"] = "&nbsp;";
$listing[$index]["rev1line"] = '';
}
$line = rtrim(fgets($nfile));
if ($ent) $line = replaceEntities(rtrim(fgets($nfile)), $rep);
if (!feof($nfile)) {
//$listing[$index]["rev2line"] = hardspace($line);
$listing[$index]["rev2line"] = $line;
}
else {
//$listing[$index]["rev2line"] = "&nbsp;";
$listing[$index]["rev2line"] = '';
}
$listing[$index]["rev1lineno"] = 0;
$listing[$index]["rev2lineno"] = 0;
$index++;
}
}
return $listing;
}
function getDiff ($projectid, $file, $rev1, $rev2)
{
$path = 'file:///' . CODEPOT_SVNREPO_DIR . '/' . $projectid . '/' . $file;
$info = @svn_ls ($path, $rev1, FALSE);
if ($info === FALSE) return FALSE;
$last = substr(strrchr($path, '/'), 1);
if (array_key_exists ($last, $info) === FALSE) return FALSE;
$fileinfo = $info[$last];
$rev1 = $info[$last]['created_rev'];
if ($rev2 <= 0)
{
/*
$log = @svn_log ($path, $rev1, SVN_REVISION_INITIAL, 2);
if ($log === FALSE) return FALSE;
if (count($log) < 2) return FALSE;
$rev2 = $log[1]['rev'];
*/
$rev2 = $rev1 - 1;
if ($rev2 <= 0) $rev2 = $rev1;
}
$info2 = @svn_ls ($path, $rev2, FALSE);
if ($info2 === FALSE)
{
$rev2 = $rev1;
$info2 = @svn_ls ($path, $rev2, FALSE);
if ($info2 === FALSE) return FALSE;
}
if (array_key_exists ($last, $info2) === FALSE) return FALSE;
$rev2 = $info2[$last]['created_rev'];
list($diff, $errors) = @svn_diff ($path, $rev2, $path, $rev1);
if (!$diff) return FALSE;
fclose($errors);
$fileinfo['content'] = $this->_get_diff ($diff, FALSE, FALSE);
fclose ($diff);
/*
print_r ($info[$last]);
print_r ($info2[$last]);
*/
$fileinfo['against'] = $info2[$last];
return $fileinfo;
}
function getPrevRev ($projectid, $file, $rev)
{
$path = 'file:///' . CODEPOT_SVNREPO_DIR . '/' . $projectid . '/' . $file;
$info = @svn_log ($path, $rev, SVN_REVISION_INITIAL, 2, SVN_OMIT_MESSAGES);
if ($info === FALSE) return $rev;
$count = count($info);
if ($count <= 0) return $rev;
if ($count == 1) return $info[0]['rev'];
return $info[1]['rev'];
}
function getNextRev ($projectid, $file, $rev)
{
$path = 'file:///' . CODEPOT_SVNREPO_DIR . '/' . $projectid . '/' . $file;
$info = @svn_log ($path, SVN_REVISION_HEAD, $rev, 0, SVN_OMIT_MESSAGES);
if ($info === FALSE) return $rev;
$count = count($info);
if ($count <= 0) return $rev;
if ($count == 1) return $info[0]['rev'];
return $info[$count-2]['rev'];
}
function getHeadRev ($projectid, $file)
{
$path = 'file:///' . CODEPOT_SVNREPO_DIR . '/' . $projectid . '/' . $file;
$info = @svn_log ($path, SVN_REVISION_HEAD, SVN_REVISION_INITIAL, 1, SVN_OMIT_MESSAGES);
if ($info === FALSE) return FALSE;
if (count($info) != 1) return FALSE;
return $info[0]['rev'];
}
} }
?> ?>

View File

@ -14,6 +14,7 @@ www_DATA = \
project_list.php \ project_list.php \
projectbar.php \ projectbar.php \
source_blame.php \ source_blame.php \
source_diff.php \
source_file.php \ source_file.php \
source_folder.php \ source_folder.php \
source_history.php \ source_history.php \

View File

@ -177,6 +177,7 @@ www_DATA = \
project_list.php \ project_list.php \
projectbar.php \ projectbar.php \
source_blame.php \ source_blame.php \
source_diff.php \
source_file.php \ source_file.php \
source_folder.php \ source_folder.php \
source_history.php \ source_history.php \

View File

@ -34,7 +34,7 @@ $this->load->view (
<div class="mainarea" id="project_file_home_mainarea"> <div class="mainarea" id="project_file_home_mainarea">
<div class="title"><?=$this->lang->line('Files')?></div> <div class="title"><?=$this->lang->line('Files')?></div>
<div id="project_file_home_textarea"> <div id="project_file_home_mainarea_result">
<?php <?php
if (empty($files)) if (empty($files))
{ {
@ -55,8 +55,8 @@ else
usort ($files, 'comp_files'); usort ($files, 'comp_files');
print '<table>'; print '<table id="project_file_home_mainarea_result_table">';
print '<tr>'; print '<tr class="heading">';
print '<th>' . $this->lang->line('Tag') . '</th>'; print '<th>' . $this->lang->line('Tag') . '</th>';
print '<th>' . $this->lang->line('Name') . '</th>'; print '<th>' . $this->lang->line('Name') . '</th>';
print '<th>' . $this->lang->line('Summary') . '</th>'; print '<th>' . $this->lang->line('Summary') . '</th>';
@ -65,10 +65,13 @@ else
print '</tr>'; print '</tr>';
$oldtag = ''; $oldtag = '';
$rownum = 0;
$rowclasses = array ('odd', 'even');
foreach ($files as $file) foreach ($files as $file)
{ {
$hexname = $this->converter->AsciiToHex ($file->name); $hexname = $this->converter->AsciiToHex ($file->name);
print '<tr>'; $rowclass = $rowclasses[$rownum++ % 2];
print "<tr class='{$rowclass}'>";
print '<td>'; print '<td>';
if ($file->tag != $oldtag) if ($file->tag != $oldtag)
{ {
@ -82,9 +85,9 @@ else
print '<td>'; print '<td>';
print htmlspecialchars($file->summary); print htmlspecialchars($file->summary);
print '</td>'; print '</td>';
print '<td>'; print '<td><tt>';
print $file->md5sum; print $file->md5sum;
print '</td>'; print '</tt></td>';
print '<td>'; print '<td>';
print anchor ("file/get/{$project->id}/{$hexname}", $this->lang->line('Download')); print anchor ("file/get/{$project->id}/{$hexname}", $this->lang->line('Download'));
print '</td>'; print '</td>';

View File

@ -33,31 +33,29 @@ $this->load->view (
); );
?> ?>
<!---------------------------------------------------------------------------->
<div class="sidebar" id="project_source_blame_sidebar">
<div class="box">
<div class="boxtitle"><?=$this->lang->line('File')?></div>
<ul>
<li><?=$this->lang->line('Revision')?>: <?=$file['created_rev']?></li>
<li><?=$this->lang->line('Author')?>: <?=htmlspecialchars($file['last_author'])?></li>
<li><?=$this->lang->line('Size')?>: <?=$file['size']?></li>
<li><?=$this->lang->line('Last updated on')?>: <?=$file['time']?></li>
</ul>
</div>
</div> <!-- project_source_blame_sidebar -->
<!----------------------------------------------------------------------------> <!---------------------------------------------------------------------------->
<div class="mainarea" id="project_source_blame_mainarea"> <div class="mainarea" id="project_source_blame_mainarea">
<div class="title" id="project_source_blame_mainarea_title"> <div class="title" id="project_source_blame_mainarea_title">
<?php <?php
$xpar = '/source/folder/' . $project->id; if ($revision <= 0)
print anchor ($xpar, htmlspecialchars($project->name)); {
$revreq = '';
$revreqroot = '';
}
else
{
//$revreq = ($file['created_rev'] == $file['head_rev'])? '': "/{$file['created_rev']}";
//$revreqroot = ($revreq == '')? '': ('/' . $this->converter->AsciiToHex ('.') . $revreq);
$revreq = "/{$revision}";
$revreqroot = '/' . $this->converter->AsciiToHex ('.') . $revreq;
}
print anchor (
"/source/folder/{$project->id}{$revreqroot}",
htmlspecialchars($project->name));
if ($folder != '') if ($folder != '')
{ {
$exps = explode ('/', $folder); $exps = explode ('/', $folder);
@ -65,39 +63,59 @@ if ($folder != '')
$par = ''; $par = '';
for ($i = 1; $i < $expsize; $i++) for ($i = 1; $i < $expsize; $i++)
{ {
print '/';
$par .= '/' . $exps[$i]; $par .= '/' . $exps[$i];
$hexpar = $this->converter->AsciiToHex ($par); $hexpar = $this->converter->AsciiToHex ($par);
print '/'; print anchor (
$xpar = 'source/folder/' . $project->id . '/' . $hexpar; "source/folder/{$project->id}/{$hexpar}{$revreq}",
if ($revision != SVN_REVISION_HEAD) $xpar .= '/' . $revision; htmlspecialchars($exps[$i]));
print anchor ($xpar, htmlspecialchars($exps[$i]));
} }
} }
$par = $folder . '/' . $file['name'];
$par = $this->converter->AsciiTohex ($par);
print '/'; print '/';
$xpar = '/source/blame/' . $project->id . '/' . $par;
if ($revision != SVN_REVISION_HEAD) $xpar .= '/' . $revision; $par = $this->converter->AsciiTohex ("{$folder}/{$file['name']}");
print anchor ($xpar, htmlspecialchars($file['name'])); print anchor (
"/source/blame/{$project->id}/{$par}{$revreq}",
htmlspecialchars($file['name']));
?> ?>
</div> <!-- project_source_blame_mainarea_title --> </div> <!-- project_source_blame_mainarea_title -->
<div class="menu" id="project_source_blame_mainarea_menu"> <div class="menu" id="project_source_blame_mainarea_menu">
<?php <?php
$par = $folder . '/' . $file['name']; $par = $this->converter->AsciiToHex ("{$folder}/{$file['name']}");
$par = $this->converter->AsciiTohex ($par);
$xpar = 'source/file/' . $project->id . '/' . $par;
if ($revision != SVN_REVISION_HEAD) $xpar .= '/' . $revision; if ($file['created_rev'] != $file['head_rev'])
print anchor ($xpar, $this->lang->line('Details')); {
print anchor ("source/file/{$project->id}/${par}", $this->lang->line('Head revision'));
print ' | ';
}
print anchor ("source/file/{$project->id}/${par}{$revreq}", $this->lang->line('Details'));
print ' | '; print ' | ';
print anchor ('source/history/file/' . $project->id . '/' . $par, $this->lang->line('History')); print anchor ("source/diff/{$project->id}/{$par}{$revreq}", $this->lang->line('Difference'));
print ' | ';
print anchor ("source/history/file/{$project->id}/{$par}", $this->lang->line('History'));
?> ?>
</div> <!-- project_source_blame_mainarea_menu --> </div> <!-- project_source_blame_mainarea_menu -->
<div class="infostrip">
<?=anchor ("source/file/{$project->id}/${par}/{$file['prev_rev']}", '<<')?>
<?=$this->lang->line('Revision')?>: <?=$file['created_rev']?>
<?=anchor ("source/file/{$project->id}/${par}/{$file['next_rev']}", '>>')?> |
<?=$this->lang->line('Author')?>: <?=htmlspecialchars($file['last_author'])?> |
<?=$this->lang->line('Size')?>: <?=$file['size']?> |
<?=$this->lang->line('Last updated on')?>: <?=$file['time']?>
</div>
<?php <?php
$fileext = substr(strrchr($file['name'], '.'), 1); $fileext = substr(strrchr($file['name'], '.'), 1);
if ($fileext == "") $fileext = "html" if ($fileext == "") $fileext = "html"
?> ?>
<pre class="prettyprint lang-<?=$fileext?>"> <pre class="prettyprint lang-<?=$fileext?>">
<?php <?php

View File

@ -0,0 +1,223 @@
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<link type="text/css" rel="stylesheet" href="<?=base_url()?>/css/common.css" />
<link type="text/css" rel="stylesheet" href="<?=base_url()?>/css/project.css" />
<script type="text/javascript" src="<?=base_url()?>/js/prettify/prettify.js"></script>
<script type="text/javascript" src="<?=base_url()?>/js/prettify/lang-css.js"></script>
<script type="text/javascript" src="<?=base_url()?>/js/prettify/lang-lisp.js"></script>
<script type="text/javascript" src="<?=base_url()?>/js/prettify/lang-lua.js"></script>
<script type="text/javascript" src="<?=base_url()?>/js/prettify/lang-sql.js"></script>
<script type="text/javascript" src="<?=base_url()?>/js/prettify/lang-vb.js"></script>
<title><?=htmlspecialchars($project->name)?></title>
</head>
<body onload="prettyPrint()">
<div class="content" id="project_source_diff_content">
<!---------------------------------------------------------------------------->
<?php $this->load->view ('taskbar'); ?>
<!---------------------------------------------------------------------------->
<?php
$this->load->view (
'projectbar',
array (
'pageid' => 'source',
'ctxmenuitems' => array ()
)
);
?>
<!---------------------------------------------------------------------------->
<div class="mainarea" id="project_source_diff_mainarea">
<div class="title" id="project_source_diff_mainarea_title">
<?php
$xpar = '/source/folder/' . $project->id;
print anchor ($xpar, htmlspecialchars($project->name));
if ($folder != '')
{
$exps = explode ('/', $folder);
$expsize = count($exps);
$par = '';
for ($i = 1; $i < $expsize; $i++)
{
$par .= '/' . $exps[$i];
$hexpar = $this->converter->AsciiToHex ($par);
print '/';
$xpar = 'source/folder/' . $project->id . '/' . $hexpar;
if ($revision1 != SVN_REVISION_HEAD) $xpar .= '/' . $revision1;
print anchor ($xpar, htmlspecialchars($exps[$i]));
}
}
$par = $folder . '/' . $file['name'];
$par = $this->converter->AsciiTohex ($par);
print '/';
$xpar = '/source/file/' . $project->id . '/' . $par;
if ($revision1 != SVN_REVISION_HEAD) $xpar .= '/' . $revision1;
print anchor ($xpar, htmlspecialchars($file['name']));
?>
</div> <!-- project_source_diff_mainarea_title -->
<div class="menu" id="project_source_diff_mainarea_menu">
<?php
$par = $folder . '/' . $file['name'];
$par = $this->converter->AsciiTohex ($par);
$xdetails = "source/file/{$project->id}/{$par}";
$xblame = "source/blame/{$project->id}/{$par}";
if ($revision1 != SVN_REVISION_HEAD)
{
$xdetails .= "/{$revision1}";
$xblame .= "/{$revision1}";
}
print anchor ($xdetails, $this->lang->line('Details'));
print ' | ';
print anchor ($xblame, $this->lang->line('Blame'));
print ' | ';
print anchor ("source/history/file/{$project->id}/{$par}", $this->lang->line('History'));
?>
</div> <!-- project_source_diff_mainarea_menu -->
<div class="infostrip" id="project_source_diff_mainarea_infostrip">
<?=$this->lang->line('Revision')?>: <?=$file['created_rev']?> |
<?=$this->lang->line('Author')?>: <?=htmlspecialchars($file['last_author'])?> |
<?=$this->lang->line('Size')?>: <?=$file['size']?> |
<?=$this->lang->line('Last updated on')?>: <?=$file['time']?>
</div>
<?php
$fileext = substr(strrchr($file['name'], '.'), 1);
if ($fileext == "") $fileext = "html"
?>
<div id="project_source_diff_mainarea_result">
<table id="project_source_diff_mainarea_result_table">
<?php
/*
print '<pre>';
print_r ($file['content']);
print '</pre>';
*/
print '<tr class="heading">';
print '<th>';
$currev = $file['created_rev'];
$prevrev = $file['against']['prev_rev'];
$prevanc = "source/diff/{$project->id}/{$par}/{$currev}/{$prevrev}";
print anchor ($prevanc, '<<');
print '&nbsp;&nbsp;&nbsp;';
print $this->lang->line('Revision');
print ' ';
print $file['against']['created_rev'];
$currev = $file['created_rev'];
$nextrev = $file['against']['next_rev'];
$nextanc = "source/diff/{$project->id}/{$par}/{$currev}/{$nextrev}";
print '&nbsp;&nbsp;&nbsp;';
print anchor ($nextanc, '>>');
print '</th>';
print '<th>';
$currev = $file['against']['created_rev'];
$prevrev = $file['prev_rev'];
$prevanc = "source/diff/{$project->id}/{$par}/{$prevrev}/{$currev}";
print anchor ($prevanc, '<<');
print '&nbsp;&nbsp;&nbsp;';
print $this->lang->line('Revision');
print ' ';
print $file['created_rev'];
$currev = $file['against']['created_rev'];
$nextrev = $file['next_rev'];
$nextanc = "source/diff/{$project->id}/{$par}/{$nextrev}/{$currev}";
print '&nbsp;&nbsp;&nbsp;';
print anchor ($nextanc, '>>');
print '</th>';
print '</tr>';
if (empty($file['content']))
{
print '<tr>';
print '<td colspan=2>';
print htmlspecialchars ($this->lang->line('MSG_NO_DIFF'));
print '</td>';
print '</tr>';
}
else
{
foreach ($file['content'] as $x)
{
print '<tr class="diff">';
if (array_key_exists('rev1line', $x))
{
$diffclass = array_key_exists('rev1diffclass', $x)? $x['rev1diffclass']: 'diff';
print "<td class='{$diffclass}'>";
print "<pre class='prettyprint lang-{$fileext}'>";
print htmlspecialchars($x['rev1line']);
print '</pre>';
print '</td>';
}
else
{
print '<td class="diffrow">';
print $x['rev1lineno'];
print '</td>';
}
if (array_key_exists('rev2line', $x))
{
$diffclass = array_key_exists('rev2diffclass', $x)? $x['rev2diffclass']: 'diff';
print "<td class='{$diffclass}'>";
print "<pre class='prettyprint lang-{$fileext}'>";
print htmlspecialchars($x['rev2line']);
print '</pre>';
print '</td>';
}
else
{
print '<td class="diffrow">';
print $x['rev2lineno'];
print '</td>';
}
print '</tr>';
}
}
?>
</table>
</div>
</div> <!-- project_source_diff_mainarea -->
<!---------------------------------------------------------------------------->
<?php $this->load->view ('footer'); ?>
<!---------------------------------------------------------------------------->
</div> <!-- project_source_diff_content -->
</body>
</html>

View File

@ -32,30 +32,30 @@ $this->load->view (
) )
); );
?> ?>
<!---------------------------------------------------------------------------->
<div class="sidebar" id="project_source_file_sidebar">
<div class="box">
<div class="boxtitle"><?=$this->lang->line('File')?></div>
<ul>
<li><?=$this->lang->line('Revision')?>: <?=$file['created_rev']?></li>
<li><?=$this->lang->line('Author')?>: <?=htmlspecialchars($file['last_author'])?></li>
<li><?=$this->lang->line('Size')?>: <?=$file['size']?></li>
<li><?=$this->lang->line('Last updated on')?>: <?=$file['time']?></li>
</ul>
</div>
</div> <!-- project_source_file_sidebar -->
<!----------------------------------------------------------------------------> <!---------------------------------------------------------------------------->
<div class="mainarea" id="project_source_file_mainarea"> <div class="mainarea" id="project_source_file_mainarea">
<div class="title" id="project_source_file_title"> <div class="title" id="project_source_file_mainarea_title">
<?php <?php
$xpar = '/source/folder/' . $project->id; if ($revision <= 0)
print anchor ($xpar, htmlspecialchars($project->name)); {
$revreq = '';
$revreqroot = '';
}
else
{
//$revreq = ($file['created_rev'] == $file['head_rev'])? '': "/{$file['created_rev']}";
//$revreqroot = ($revreq == '')? '': ('/' . $this->converter->AsciiToHex ('.') . $revreq);
$revreq = "/{$revision}";
$revreqroot = '/' . $this->converter->AsciiToHex ('.') . $revreq;
}
print anchor (
"/source/folder/{$project->id}{$revreqroot}",
htmlspecialchars($project->name));
if ($folder != '') if ($folder != '')
{ {
$exps = explode ('/', $folder); $exps = explode ('/', $folder);
@ -63,36 +63,52 @@ if ($folder != '')
$par = ''; $par = '';
for ($i = 1; $i < $expsize; $i++) for ($i = 1; $i < $expsize; $i++)
{ {
print '/';
$par .= '/' . $exps[$i]; $par .= '/' . $exps[$i];
$hexpar = $this->converter->AsciiToHex ($par); $hexpar = $this->converter->AsciiToHex ($par);
print '/'; print anchor (
$xpar = 'source/folder/' . $project->id . '/' . $hexpar; "source/folder/{$project->id}/{$hexpar}{$revreq}",
if ($revision != SVN_REVISION_HEAD) $xpar .= '/' . $revision; htmlspecialchars($exps[$i]));
print anchor ($xpar, htmlspecialchars($exps[$i]));
} }
} }
$par = $folder . '/' . $file['name'];
$par = $this->converter->AsciiTohex ($par);
print '/'; print '/';
$xpar = '/source/file/' . $project->id . '/' . $par;
if ($revision != SVN_REVISION_HEAD) $xpar .= '/' . $revision; $par = $this->converter->AsciiTohex ("{$folder}/{$file['name']}");
print anchor ($xpar, htmlspecialchars($file['name'])); print anchor (
"/source/file/{$project->id}/{$par}{$revreq}",
htmlspecialchars($file['name']));
?> ?>
</div> <!-- project_source_file_mainarea_title --> </div> <!-- project_source_file_mainarea_title -->
<div class="menu" id="project_source_file_mainarea_menu"> <div class="menu" id="project_source_file_mainarea_menu">
<?php <?php
$par = $folder . '/' . $file['name']; $par = $this->converter->AsciiToHex ("{$folder}/{$file['name']}");
$par = $this->converter->AsciiTohex ($par);
$xpar = 'source/blame/' . $project->id . '/' . $par; if ($file['created_rev'] != $file['head_rev'])
if ($revision != SVN_REVISION_HEAD) $xpar .= '/' . $revision; {
print anchor ($xpar, $this->lang->line('Blame')); print anchor ("source/file/{$project->id}/${par}", $this->lang->line('Head revision'));
print ' | ';
}
print anchor ("source/blame/{$project->id}/${par}{$revreq}", $this->lang->line('Blame'));
print ' | '; print ' | ';
print anchor ('source/history/file/' . $project->id . '/' . $par, $this->lang->line('History')); print anchor ("source/diff/{$project->id}/{$par}{$revreq}", $this->lang->line('Difference'));
print ' | ';
print anchor ("source/history/file/{$project->id}/{$par}", $this->lang->line('History'));
?> ?>
</div> <!-- project_source_file_mainarea_menu --> </div> <!-- project_source_file_mainarea_menu -->
<div class="infostrip">
<?=anchor ("source/file/{$project->id}/${par}/{$file['prev_rev']}", '<<')?>
<?=$this->lang->line('Revision')?>: <?=$file['created_rev']?>
<?=anchor ("source/file/{$project->id}/${par}/{$file['next_rev']}", '>>')?> |
<?=$this->lang->line('Author')?>: <?=htmlspecialchars($file['last_author'])?> |
<?=$this->lang->line('Size')?>: <?=$file['size']?> |
<?=$this->lang->line('Last updated on')?>: <?=$file['time']?>
</div>
<?php <?php
$fileext = substr(strrchr($file['name'], '.'), 1); $fileext = substr(strrchr($file['name'], '.'), 1);
if ($fileext == "") $fileext = "html" if ($fileext == "") $fileext = "html"

View File

@ -29,14 +29,15 @@ $this->load->view (
<!----------------------------------------------------------------------------> <!---------------------------------------------------------------------------->
<div class="sidebar" id="project_source_folder_sidebar"> <?php if ($revision >= 0): ?>
<div class="box"> <div class="sidebar" id="project_source_folder_sidebar">
<div class="boxtitle"><?=$this->lang->line('Folder')?></div> <div class="box">
<ul> <ul>
<li><?=$this->lang->line('Revision')?>: <?=$revision?></li> <li><?=$this->lang->line('Revision')?>: <?=$revision?></li>
</ul> </ul>
</div> </div>
</div> <!-- project_source_folder_sidebar --> </div> <!-- project_source_folder_sidebar -->
<?php endif; ?>
<!----------------------------------------------------------------------------> <!---------------------------------------------------------------------------->
@ -46,7 +47,18 @@ $this->load->view (
<div class="title"> <div class="title">
<?php <?php
print anchor ('/source/folder/' . $project->id, htmlspecialchars($project->name)); if ($revision <= 0)
{
$revreq = '';
$revreqroot = '';
}
else
{
$revreq = "/{$revision}";
$revreqroot = '/' . $this->converter->AsciiToHex ('.') . $revreq;
}
print anchor ("/source/folder/{$project->id}{$revreqroot}", htmlspecialchars($project->name));
if ($folder != '') if ($folder != '')
{ {
$exps = explode ('/', $folder); $exps = explode ('/', $folder);
@ -54,10 +66,11 @@ if ($folder != '')
$par = ''; $par = '';
for ($i = 1; $i < $expsize; $i++) for ($i = 1; $i < $expsize; $i++)
{ {
print '/';
$par .= '/' . $exps[$i]; $par .= '/' . $exps[$i];
$hexpar = $this->converter->AsciiToHex ($par); $hexpar = $this->converter->AsciiToHex ($par);
print '/'; print anchor ("source/folder/{$project->id}/{$hexpar}{$revreq}", htmlspecialchars($exps[$i]));
print anchor ('source/folder/' . $project->id . '/' . $hexpar, htmlspecialchars($exps[$i]));
} }
} }
?> ?>
@ -82,32 +95,45 @@ if ($folder != '')
else else
{ {
print '<div class="menu" id="project_source_folder_mainarea_menu">'; print '<div class="menu" id="project_source_folder_mainarea_menu">';
$par = $this->converter->AsciiTohex ($folder); $hexpar = $this->converter->AsciiTohex ($folder);
print anchor ('source/history/folder/' . $project->id . '/' . $par, $this->lang->line('History')); if ($revision > 0 && $revision < $next_revision)
{
print anchor ("source/folder/{$project->id}", $this->lang->line('Head revision'));
print ' | ';
}
print anchor ("source/history/folder/{$project->id}/{$hexpar}", $this->lang->line('History'));
print '</div>'; print '</div>';
usort ($files, 'comp_files'); usort ($files, 'comp_files');
print '<table>'; print '<div id="project_source_folder_mainarea_result">';
print '<tr>'; print '<table id="project_source_folder_mainarea_result_table">';
print '<tr class="heading">';
print '<th>' . $this->lang->line('Name') . '</th>'; print '<th>' . $this->lang->line('Name') . '</th>';
print '<th>' . $this->lang->line('Revision') . '</th>'; print '<th>' . $this->lang->line('Revision') . '</th>';
print '<th>' . $this->lang->line('Size') . '</th>'; print '<th>' . $this->lang->line('Size') . '</th>';
print '<th>' . $this->lang->line('Author') . '</th>'; print '<th>' . $this->lang->line('Author') . '</th>';
print '<th>' . $this->lang->line('Time') . '</th>'; print '<th>' . $this->lang->line('Time') . '</th>';
print '<th>' . '</th>';
print '<th>' . '</th>';
print '</tr>'; print '</tr>';
$rowclasses = array ('even', 'odd');
$rownum = 0;
foreach ($files as $f) foreach ($files as $f)
{ {
$fullpath = $folder . '/' . $f['name']; $fullpath = $folder . '/' . $f['name'];
$rowclass = $rowclasses[++$rownum % 2];
if ($f['type'] === 'dir') if ($f['type'] === 'dir')
{ {
// directory // directory
print '<tr>'; $hexpath = $this->converter->AsciiToHex($fullpath);
print "<tr class='{$rowclass}'>";
print '<td>'; print '<td>';
$url = 'source/folder/' . $project->id . '/' . print anchor (
$this->converter->AsciiToHex ($fullpath); "source/folder/{$project->id}/{$hexpath}{$revreq}",
print anchor ($url, htmlspecialchars($f['name'])); htmlspecialchars($f['name']));
print '</td>'; print '</td>';
print '<td>'; print '<td>';
print $f['created_rev']; print $f['created_rev'];
@ -116,19 +142,22 @@ if ($folder != '')
print '<td>'; print '<td>';
print htmlspecialchars($f['last_author']); print htmlspecialchars($f['last_author']);
print '</td>'; print '</td>';
print '<td>'; print '<td><code>';
print date('r', $f['time_t']); print date('r', $f['time_t']);
print '</td>'; print '</code></td>';
print '<td></td>';
print '<td></td>';
print '</tr>'; print '</tr>';
} }
else else
{ {
// file // file
print '<tr>'; $hexpath = $this->converter->AsciiToHex($fullpath);
print "<tr class='{$rowclass}'>";
print '<td>'; print '<td>';
$url = 'source/file/' . $project->id . '/' . print anchor (
$this->converter->AsciiToHex($fullpath); "source/file/{$project->id}/{$hexpath}{$revreq}",
print anchor ($url, htmlspecialchars($f['name'])); htmlspecialchars($f['name']));
print '</td>'; print '</td>';
print '<td>'; print '<td>';
print $f['created_rev']; print $f['created_rev'];
@ -139,13 +168,25 @@ if ($folder != '')
print '<td>'; print '<td>';
print htmlspecialchars($f['last_author']); print htmlspecialchars($f['last_author']);
print '</td>'; print '</td>';
print '<td>'; print '<td><code>';
print date('r', $f['time_t']); print date('r', $f['time_t']);
print '</code></td>';
print '<td>';
print anchor (
"source/blame/{$project->id}/{$hexpath}{$revreq}",
$this->lang->line('Blame'));
print '</td>';
print '<td>';
print anchor (
"source/diff/{$project->id}/{$hexpath}{$revreq}",
$this->lang->line('Difference'));
print '</td>'; print '</td>';
print '</tr>'; print '</tr>';
} }
} }
print '</table>'; print '</table>';
print '</div>';
} }
?> ?>

View File

@ -66,19 +66,22 @@ if ($type == 'file')
{ {
$par = $folder; $par = $folder;
$par = $this->converter->AsciiTohex ($par); $par = $this->converter->AsciiTohex ($par);
$xpar = 'source/file/' . $project->id . '/' . $par; $xpar = "source/file/{$project->id}/{$par}";
print anchor ($xpar, $this->lang->line('Details')); print anchor ($xpar, $this->lang->line('Details'));
print ' | '; print ' | ';
$xpar = 'source/blame/' . $project->id . '/' . $par; $xpar = "source/blame/{$project->id}/{$par}";
print anchor ($xpar, $this->lang->line('Blame')); print anchor ($xpar, $this->lang->line('Blame'));
print ' | ';
$xpar = "source/diff/{$project->id}/{$par}";
print anchor ($xpar, $this->lang->line('Difference'));
} }
?> ?>
</div> <!-- project_source_history_mainarea_menu --> </div> <!-- project_source_history_mainarea_menu -->
<div id="project_source_history_mainarea_body"> <div id="project_source_history_mainarea_result">
<table> <table id="project_source_history_mainarea_result_table">
<tr> <tr class='heading'>
<th><?=$this->lang->line('Revision')?></th> <th><?=$this->lang->line('Revision')?></th>
<th><?=$this->lang->line('Author')?></th> <th><?=$this->lang->line('Author')?></th>
<th><?=$this->lang->line('Time')?></th> <th><?=$this->lang->line('Time')?></th>
@ -86,26 +89,28 @@ if ($type == 'file')
<th><?=$this->lang->line('Files')?></th> <th><?=$this->lang->line('Files')?></th>
</tr> </tr>
<?php <?php
$rowclasses = array ('even', 'odd');
$history = $file['history']; $history = $file['history'];
$history_count = count($history); $history_count = count($history);
for ($i = $history_count; $i > 0; ) for ($i = $history_count; $i > 0; )
{ {
$h = $history[--$i]; $h = $history[--$i];
print '<tr>'; $rowclass = $rowclasses[($history_count - $i) % 2];
print "<tr class='{$rowclass}'>";
print '<td>'; print '<td>';
$hexfolder = $this->converter->AsciiToHex(($folder == '')? '.': $folder); $hexfolder = $this->converter->AsciiToHex(($folder == '')? '.': $folder);
print anchor ("/source/$type/" . $project->id . '/' . $hexfolder . '/' . $h['rev'], $h['rev']); print anchor ("/source/$type/{$project->id}/{$hexfolder}/{$h['rev']}", $h['rev']);
print '</td>'; print '</td>';
print '<td>'; print '<td>';
print htmlspecialchars($h['author']); print htmlspecialchars($h['author']);
print '</td>'; print '</td>';
print '<td>'; print '<td><code>';
print date('r', strtotime($h['date'])); print date('r', strtotime($h['date']));
print '</td>'; print '</code></td>';
print '<td>'; print '<td>';
print htmlspecialchars($h['msg']); print htmlspecialchars($h['msg']);
@ -115,15 +120,19 @@ if ($type == 'file')
if (count($paths) > 0) if (count($paths) > 0)
{ {
print '<td>'; print '<td>';
print '<ul id="project_source_history_mainarea_result_table_path_list">';
foreach ($paths as $p) foreach ($paths as $p)
{ {
print '<li>'; print '<li>';
print '<code>';
print '['; print '[';
print $p['action']; print $p['action'];
print '] '; print '] ';
print_path ($project, $p['path'], 'file', $this->converter, $h['rev']); print_path ($project, $p['path'], 'file', $this->converter, $h['rev']);
print '</code>';
print '</li>'; print '</li>';
} }
print '</ul>';
print '</td>'; print '</td>';
} }

View File

@ -50,10 +50,28 @@ function load_ini ($file)
if (array_key_exists ($idx, $cfg)) if (array_key_exists ($idx, $cfg))
{ {
$rawval = $cfg[$idx]; $rawval = $cfg[$idx];
if ($x[1] == 'string') define ($const, $rawval); if ($x[1] == 'string')
else if ($x[1] == 'boolean') define ($const, strcasecmp ($rawval, 'yes') == 0); {
else if ($x[1] == 'integer') define ($const, intval ($rawval)); define ($const, $rawval);
else define ($const, $x[2]); }
else if ($x[1] == 'boolean')
{
if (is_bool($rawval))
define ($const, $rawval);
else if (is_numeric($rawval) === TRUE)
define ($const, $rawval != 0);
else
define ($const, strcasecmp ($rawval, 'yes') == 0);
}
else if ($x[1] == 'integer')
{
define ($const, intval ($rawval));
}
else
{
// set the default value
define ($const, $x[2]);
}
} }
else define ($const, $x[2]); else define ($const, $x[2]);
} }

View File

@ -3,7 +3,8 @@ SUBDIRS = images
wwwdir=$(WWWDIR)/css wwwdir=$(WWWDIR)/css
www_DATA = \ www_DATA = \
common.css \ common.css \
project.css project.css \
websvn.css
EXTRA_DIST = $(www_DATA) EXTRA_DIST = $(www_DATA)

View File

@ -205,7 +205,8 @@ wwwdir = $(WWWDIR)/css
SUBDIRS = images SUBDIRS = images
www_DATA = \ www_DATA = \
common.css \ common.css \
project.css project.css \
websvn.css
EXTRA_DIST = $(www_DATA) EXTRA_DIST = $(www_DATA)
all: all-recursive all: all-recursive

View File

@ -1,12 +1,10 @@
ody { body {
//margin: 0;
padding: 0; padding: 0;
margin: 5px 5px 5px 5px; margin: 5px 5px 5px 5px;
} }
.content .content
{ {
//margin: 2px 2px 2px 2px;
font-size: 90%; font-size: 90%;
font-family: sans-serif; font-family: sans-serif;
} }
@ -178,109 +176,76 @@ ody {
border: 1px solid #BBCCDD; border: 1px solid #BBCCDD;
} }
.content .mainarea table {
border-collapse:collapse;
border-bottom: 2px solid #BBCCDD;
margin-top: 0.5em;
margin-bottom: 0.5em;
}
.content .mainarea .icon { .content .mainarea .icon {
border: 0; border: 0;
} }
.content .mainarea table th { .content .mainarea pre {
color:#FFFFFF; padding: .3em .3em .3em .3em;
border: 1px dashed #BBCCDD;
background-color: #F1F1FF;
overflow: auto;
width: inherit;
}
.content .mainarea tt {
padding: .1em .1em .1em .1em;
background-color: #F1F1FF;
}
.content .mainarea tt:hover {
background-color: inherit;
}
.content .mainarea table {
font-size: inherit;
background-color: inherit;
}
.content .mainarea table tr.heading {
color: #FFFFFF;
background-color: #7777FF; background-color: #7777FF;
font-weight: normal; }
.content .mainarea table tr.heading a {
color: inherit;
background-color: inherit;
text-decoration: none;
}
.content .mainarea table tr.odd {
background-color: inherit;
}
.content .mainarea table tr.even {
background-color: #EEEEFF;
}
.content .mainarea table tr th {
white-space: nowrap; white-space: nowrap;
} }
.content .mainarea table tr:hover { .content .mainarea table tr td {
background-color: #BBCCFF;
}
.content .mainarea table td {
padding-left: 0.2em; padding-left: 0.2em;
padding-right: 0.2em; padding-right: 0.2em;
} }
.content .mainarea table td img { .content .mainarea table tr td img {
vertical-align: middle; vertical-align: middle;
display:inline-block; display:inline-block;
} }
.content .mainarea pre, .content .mainarea table tr td.code {
.content .mainarea tt,
.content .mainarea .codebox {
padding: .3em .3em .3em .3em;
border: 1px dashed #BBCCDD;
background-color: #F1F1FF;
}
.content .mainarea .codebox pre,
.content .mainarea .codebox tt {
padding: 0;
border: 0;
}
.content .mainarea table td.code {
white-space: nowarp; white-space: nowarp;
} }
.content .mainarea table td.code pre { .content .mainarea table tr td.code pre {
padding: 0; padding: 0;
margin: 0; margin: 0;
}
.content .mainarea table td.code pre {
padding: 0;
border: 0 none; border: 0 none;
background-color: inherit; background-color: inherit;
} }
.content .mainarea table tbody tr.diffcode td.diff pre {
display:block;
height:100%;
margin: 0;
padding: 0;
padding-left:22px;
border: 0 none;
background-color: inherit;
}
.content .mainarea table tbody td.diffdeleted pre {
border:1px solid #e8d4bc;
background-color:#f8e4cc;
background-image:url(images/bullet_delete.png);
background-position:2px 50%;
background-repeat:no-repeat;
padding: 0;
padding-left:22px;
margin: 0;
}
.content .mainarea table tbody tr.diffcode td.diffadded pre {
border:1px solid #cdf0cd;
background-color:#ddffdd;
background-image:url(images/bullet_add.png);
background-repeat:no-repeat;
background-position:2px 50%;
padding: 0;
padding-left:22px;
margin: 0;
}
.content .mainarea table tbody tr.diffcode td.diffchanged pre {
border:1px solid #f0f0bc;
background-color:#ffffcc;
background-image:url(images/bullet_yellow.png);
background-repeat:no-repeat;
background-position:2px 50%;
padding: 0;
padding-left:22px;
margin: 0;
}
.content .mainarea pre.prettyprint { .content .mainarea pre.prettyprint {
/* anything that make prettyprint area different from other pres? */ /* anything that make prettyprint area different from other pres? */
background-color: #FFFFFF; background-color: #FFFFFF;
@ -336,8 +301,19 @@ pre.prettyprint .nocode a:hover {
} }
} }
.content .infostrip {
font-size: 0.9em;
background: #E5ECF9 none repeat scroll 0 0;
margin: 0.3em 0em 0em 0em;
padding: 0.3em 0.3em 0.3em 0.3em;
text-align: right;
}
.content .infostrip a {
text-decoration: none;
}
.content .sidebar { .content .sidebar {
/* sidebar to show extra information holding one or more infoboxes */
font-size: 0.9em; font-size: 0.9em;
float: right; float: right;
width: 20em; width: 20em;
@ -398,10 +374,6 @@ pre.prettyprint .nocode a:hover {
padding: 0.2em 0 0.2em 1em; padding: 0.2em 0 0.2em 1em;
} }
.content .sidebar a:hover {
}
.content .footer { .content .footer {
padding: 0.3em 0em 0.3em 0em; padding: 0.3em 0em 0.3em 0em;
font-size: .9em; font-size: .9em;

View File

@ -1,5 +1,110 @@
/* specific IDs */ /*
* This file contains specific IDs for furthur customization.
*/
#project_list_mainarea { /*-----------------------------------------------
* project source folder view
*-----------------------------------------------*/
#project_source_folder_mainarea_result {
overflow: auto;
}
#project_source_folder_mainarea_result_table tr {
vertical-align: top;
white-space: nowrap;
}
/*-----------------------------------------------
* project source folder view
*-----------------------------------------------*/
#project_file_home_mainarea_result {
overflow: auto;
}
#project_file_home_mainarea_result_table tr {
vertical-align: top;
white-space: nowrap;
}
/*-----------------------------------------------
* project source history view
*-----------------------------------------------*/
#project_source_history_mainarea_result {
overflow: auto;
}
#project_source_history_mainarea_result_table tr {
vertical-align: top;
white-space: nowrap;
}
#project_source_history_mainarea_result_table_path_list {
/* the list in the 'paths' column */
margin: 0;
padding: 0;
list-style: none;
white-space: nowrap;
}
/*-----------------------------------------------
* project source diff view
*-----------------------------------------------*/
#project_source_diff_mainarea_result {
overflow: auto;
}
#project_source_diff_mainarea_result_table {
border: 0;
}
#project_source_diff_mainarea_result_table tr.diff td pre {
background-color: inherit;
border: 0;
margin: 0;
padding: 0;
}
#project_source_diff_mainarea_result_table tr.diff td.diff {
padding: 0;
padding-left:22px;
margin: 0;
}
#project_source_diff_mainarea_result_table tr.diff td.diffrow {
font-style: italic;
font-weight: bold;
}
#project_source_diff_mainarea_result_table tr.diff td.diffadded {
border:1px solid #cdf0cd;
background-color:#ddffdd;
background-image:url(images/bullet_add.png);
background-repeat:no-repeat;
background-position:2px 50%;
padding: 0;
padding-left:22px;
margin: 0;
}
#project_source_diff_mainarea_result_table tr.diff td.diffdeleted {
border:1px solid #e8d4bc;
background-color:#f8e4cc;
background-image:url(images/bullet_delete.png);
background-position:2px 50%;
background-repeat:no-repeat;
padding: 0;
padding-left:22px;
margin: 0;
}
#project_source_diff_mainarea_result_table tr.diff td.diffchanged {
border:1px solid #f0f0bc;
background-color:#ffffcc;
background-image:url(images/bullet_yellow.png);
background-repeat:no-repeat;
background-position:2px 50%;
padding: 0;
padding-left:22px;
margin: 0;
} }

View File

@ -0,0 +1,90 @@
/*-----------------------------------------------
* websvn source folder view
*-----------------------------------------------*/
#websvn_folder_mainarea_result {
overflow: auto;
}
#websvn_folder_mainarea_result_table {
border: 0;
border-collapse: collapse;
vertical-align: top;
}
#websvn_folder_mainarea_result_table tr {
border: 0;
margin: 0;
padding: 0;
white-space: nowrap;
}
#websvn_folder_mainarea_result_table tr td {
margin: 0;
padding: 0;
padding-left: 0.2em;
padding-right: 0.2em;
}
/*-----------------------------------------------
* websvn source diff view
*-----------------------------------------------*/
#websvn_diff_mainarea_result {
overflow: auto;
}
#websvn_diff_mainarea_result_table {
border: 0;
}
#websvn_diff_mainarea_result_table tr.diff pre {
background-color: inherit;
border: 0;
margin: 0;
padding: 0;
}
#websvn_diff_mainarea_result_table tr.diff td.diff {
padding: 0;
padding-left:22px;
margin: 0;
}
#websvn_diff_mainarea_result_table tr.diff td.diffrow {
font-style: italic;
font-weight: bold;
}
#websvn_diff_mainarea_result_table tr.diff td.diffadded {
border:1px solid #cdf0cd;
background-color:#ddffdd;
background-image:url(images/bullet_add.png);
background-repeat:no-repeat;
background-position:2px 50%;
padding: 0;
padding-left:22px;
margin: 0;
}
#websvn_diff_mainarea_result_table tr.diff td.diffdeleted {
border:1px solid #e8d4bc;
background-color:#f8e4cc;
background-image:url(images/bullet_delete.png);
background-position:2px 50%;
background-repeat:no-repeat;
padding: 0;
padding-left:22px;
margin: 0;
}
#websvn_diff_mainarea_result_table tr.diff td.diffchanged {
border:1px solid #f0f0bc;
background-color:#ffffcc;
background-image:url(images/bullet_yellow.png);
background-repeat:no-repeat;
background-position:2px 50%;
padding: 0;
padding-left:22px;
margin: 0;
}

View File

@ -549,7 +549,7 @@ class SVNRepository {
@exec($cmd); @exec($cmd);
// Get the file as a string (memory hogging, but we have no other options) // Get the file as a string (memory hogging, but we have no other options)
$content = highlight_file($filename, true); $content = '<PRE>' . highlight_file($filename, true) . '</PRE>';
// Destroy the previous version, and replace it with the highlighted version // Destroy the previous version, and replace it with the highlighted version
$f = fopen($filename, "w"); $f = fopen($filename, "w");
@ -664,7 +664,9 @@ class SVNRepository {
@exec($cmd); @exec($cmd);
$tmpStr = file_get_contents($tmp); $tmpStr = file_get_contents($tmp);
$tmpStr = str_replace(array("\r\n"), array("\n"), $tmpStr); $tmpStr = str_replace(array("\r\n"), array("\n"), $tmpStr);
print '<PRE>';
highlight_string($tmpStr); highlight_string($tmpStr);
print '</PRE>';
@unlink($tmp); @unlink($tmp);
} else if ($l !== null && $config->useGeshi) { } else if ($l !== null && $config->useGeshi) {
$tmp = tempnam("temp", "wsvn"); $tmp = tempnam("temp", "wsvn");

View File

@ -26,7 +26,7 @@
</div> </div>
</div> </div>
<div class="mainarea"> <div class="mainarea" id="websvn_diff_mainarea">
[websvn-test:noaccess] [websvn-test:noaccess]
[lang:NOACCESS] [lang:NOACCESS]
@ -49,26 +49,26 @@
[websvn:fileviewloglink] [websvn:fileviewloglink]
</div> <!-- menu --> </div> <!-- menu -->
<div id="result"> <div id="websvn_diff_mainarea_result">
[websvn-test:noprev] [websvn-test:noprev]
[lang:NOPREVREV] [lang:NOPREVREV]
[websvn-else] [websvn-else]
<table> <table id="websvn_diff_mainarea_result_table">
<tr> <tr class="heading">
<th>[lang:REV] [websvn:rev2]</th> <th>[lang:REV] [websvn:rev2]</th>
<th>[lang:REV] [websvn:rev1]</th> <th>[lang:REV] [websvn:rev1]</th>
</tr> </tr>
[websvn-startlisting] [websvn-startlisting]
[websvn-test:rev1lineno] [websvn-test:rev1lineno]
<tr class="diffcode"> <tr class="diff">
<td class="row1"><strong>[lang:LINE] [websvn:rev1lineno]...</strong></td> <td class="diffrow"><strong>[lang:LINE] [websvn:rev1lineno]...</strong></td>
<td class="row1"><strong>[lang:LINE] [websvn:rev2lineno]...</strong></td> <td class="diffrow"><strong>[lang:LINE] [websvn:rev2lineno]...</strong></td>
</tr> </tr>
[websvn-else] [websvn-else]
<tr class="diffcode"> <tr class="diff">
<td class="[websvn:rev1diffclass]"><pre>[websvn:rev1line]</pre></td> <td class="[websvn:rev1diffclass]"><pre>[websvn:rev1line]</pre></td>
<td class="[websvn:rev2diffclass]"><pre>[websvn:rev2line]</pre></td> <td class="[websvn:rev2diffclass]"><pre>[websvn:rev2line]</pre></td>
</tr> </tr>

View File

@ -62,7 +62,7 @@
[websvn-endtest] [websvn-endtest]
</div> <!-- menu --> </div> <!-- menu -->
<div id="body"> <div id="websvn_folder_mainarea_result">
[websvn-defineicons] [websvn-defineicons]
dir=<img src="[websvn:locwebsvnhttp]/templates/calm/images/folder.png" alt="[FOLDER]" class="icon" /> dir=<img src="[websvn:locwebsvnhttp]/templates/calm/images/folder.png" alt="[FOLDER]" class="icon" />
@ -92,9 +92,9 @@ e-node=<img src="[websvn:locwebsvnhttp]/templates/calm/images/e-node.png" alt="[
[websvn-enddefineicons] [websvn-enddefineicons]
[websvn:compare_form] [websvn:compare_form]
<table> <table id="websvn_folder_mainarea_result_table">
<thead> <thead>
<tr> <tr class='heading'>
<th>&nbsp;</th> <th>&nbsp;</th>
<th>&nbsp;</th> <th>&nbsp;</th>
<th>[lang:PATH]</th> <th>[lang:PATH]</th>

View File

@ -41,9 +41,7 @@
[websvn:fileviewloglink] [websvn:fileviewloglink]
</div> </div>
<div class="codebox">
[websvn-getlisting] [websvn-getlisting]
</div>
[websvn-endtest] [websvn-endtest]

View File

@ -6,6 +6,7 @@
<link rel="shortcut icon" type="image/x-icon" href="[websvn:locwebsvnhttp]/templates/calm/images/favicon.ico" /> <link rel="shortcut icon" type="image/x-icon" href="[websvn:locwebsvnhttp]/templates/calm/images/favicon.ico" />
<link type="text/css" href="[websvn:loccodepothttp]/css/common.css" rel="stylesheet" /> <link type="text/css" href="[websvn:loccodepothttp]/css/common.css" rel="stylesheet" />
<link type="text/css" href="[websvn:loccodepothttp]/css/websvn.css" rel="stylesheet" />
[websvn-test:rssurl] [websvn-test:rssurl]
<link rel='alternate' type='application/rss+xml' title='WebSVN RSS' href='[websvn:rssurl]' /> <link rel='alternate' type='application/rss+xml' title='WebSVN RSS' href='[websvn:rssurl]' />