diff --git a/codepot/src/codepot/controllers/project.php b/codepot/src/codepot/controllers/project.php
index 0709fe72..9c1f2a46 100644
--- a/codepot/src/codepot/controllers/project.php
+++ b/codepot/src/codepot/controllers/project.php
@@ -154,17 +154,20 @@ class Project extends Controller
$project = $this->projects->get ($projectid);
if ($project === FALSE)
{
+ $data['loginid'] = $loginid;
$data['message'] = 'DATABASE ERROR';
$this->load->view ($this->VIEW_ERROR, $data);
}
else if ($project === NULL)
{
+ $data['loginid'] = $loginid;
$data['message'] = "NO SUCH PROJECT - $projectid";
$this->load->view ($this->VIEW_ERROR, $data);
}
else if (!$this->login->isSysadmin() &&
$this->projects->projectHasMember($project->id, $loginid) === FALSE)
{
+ $data['loginid'] = $loginid;
$data['message'] = "NO PERMISSION - $projectid";
$this->load->view ($this->VIEW_ERROR, $data);
}
@@ -243,17 +246,20 @@ class Project extends Controller
$project = $this->projects->get ($projectid);
if ($project === FALSE)
{
+ $data['loginid'] = $loginid;
$data['message'] = 'DATABASE ERROR';
$this->load->view ($this->VIEW_ERROR, $data);
}
else if ($project === NULL)
{
+ $data['loginid'] = $loginid;
$data['message'] = "NO SUCH PROJECT - $projectid";
$this->load->view ($this->VIEW_ERROR, $data);
}
else if (!$this->login->isSysadmin() &&
$this->projects->projectHasMember($project->id, $loginid) === FALSE)
{
+ $data['loginid'] = $loginid;
$data['message'] = "NO PERMISSION - $projectid";
$this->load->view ($this->VIEW_ERROR, $data);
}
diff --git a/codepot/src/codepot/controllers/source.php b/codepot/src/codepot/controllers/source.php
index 019a694f..f157574d 100644
--- a/codepot/src/codepot/controllers/source.php
+++ b/codepot/src/codepot/controllers/source.php
@@ -7,6 +7,7 @@ class Source extends Controller
var $VIEW_FILE = 'source_file';
var $VIEW_BLAME = 'source_blame';
var $VIEW_HISTORY = 'source_history';
+ var $VIEW_DIFF = 'source_diff';
function Source ()
{
@@ -36,6 +37,7 @@ class Source extends Controller
$data['loginid'] = $loginid;
$path = $this->converter->HexToAscii ($path);
+ if ($path == '.') $path = ''; /* treat a period specially */
$project = $this->projects->get ($projectid);
if ($project === FALSE)
@@ -58,10 +60,17 @@ class Source extends Controller
}
else
{
+
$data['project'] = $project;
$data['folder'] = $path;
$data['files'] = $files;
+
$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);
}
}
@@ -112,11 +121,26 @@ class Source extends Controller
}
else
{
- $data['project'] = $project;
- $data['folder'] = substr ($path, 0, strrpos($path, '/'));
- $data['file'] = $file;
- $data['revision'] = $rev;
- $this->load->view ($this->VIEW_FILE, $data);
+ $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['folder'] = substr ($path, 0, strrpos($path, '/'));
+ $data['file'] = $file;
+ $data['revision'] = $rev;
+ $this->load->view ($this->VIEW_FILE, $data);
+ }
}
}
}
@@ -154,11 +178,26 @@ class Source extends Controller
}
else
{
- $data['project'] = $project;
- $data['folder'] = substr ($path, 0, strrpos($path, '/'));
- $data['file'] = $file;
- $data['revision'] = $rev;
- $this->load->view ($this->VIEW_BLAME, $data);
+ $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['folder'] = substr ($path, 0, strrpos($path, '/'));
+ $data['file'] = $file;
+ $data['revision'] = $rev;
+ $this->load->view ($this->VIEW_BLAME, $data);
+ }
}
}
}
@@ -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);
+ }
+ }
+ }
}
diff --git a/codepot/src/codepot/language/english/common_lang.php b/codepot/src/codepot/language/english/common_lang.php
index cb4791ff..706ca19b 100644
--- a/codepot/src/codepot/language/english/common_lang.php
+++ b/codepot/src/codepot/language/english/common_lang.php
@@ -7,8 +7,10 @@ $lang['Created on'] = 'Created on';
$lang['Delete'] = 'Delete';
$lang['Description'] = 'Description';
$lang['Details'] = 'Details';
+$lang['Difference'] = 'Diff';
$lang['Download'] = 'Download';
$lang['Edit'] = 'Edit';
+$lang['Head revision'] = 'Head revision';
$lang['History'] = 'History';
$lang['Home'] = 'Home';
$lang['File'] = 'File';
@@ -45,6 +47,7 @@ $lang['Username'] = 'Username';
$lang['Wiki'] = 'Wiki';
$lang['Wikis'] = 'Wikis';
+$lang['MSG_NO_DIFF'] = 'No difference found';
$lang['MSG_NO_FILES_AVAIL'] = 'No files available';
$lang['MSG_NO_SOURCE_AVAIL'] = 'No source available';
$lang['MSG_NO_WIKIS_AVAIL'] = 'No wiki pages available';
diff --git a/codepot/src/codepot/language/indonesian/common_lang.php b/codepot/src/codepot/language/indonesian/common_lang.php
index c0ace5f7..9b8a89c5 100644
--- a/codepot/src/codepot/language/indonesian/common_lang.php
+++ b/codepot/src/codepot/language/indonesian/common_lang.php
@@ -7,8 +7,10 @@ $lang['Created on'] = 'Waktu dibuat';
$lang['Delete'] = 'Hapus';
$lang['Description'] = 'Penjelasan';
$lang['Details'] = 'Detail';
+$lang['Difference'] = 'Beda';
$lang['Download'] = 'Download';
$lang['Edit'] = 'Rubah';
+$lang['Head revision'] = 'Kepala Revisi';
$lang['History'] = 'Sejarah';
$lang['Home'] = 'Beranda';
$lang['File'] = 'File';
@@ -45,6 +47,7 @@ $lang['Username'] = 'Nama pemakai';
$lang['Wiki'] = 'Wiki';
$lang['Wikis'] = 'Wiki';
+$lang['MSG_NO_DIFF'] = 'Tidak ada bedanya';
$lang['MSG_NO_FILES_AVAIL'] = 'Tidak ada file tersedia';
$lang['MSG_NO_SOURCE_AVAIL'] = 'Tidak ada sumber tersedia';
$lang['MSG_NO_WIKIS_AVAIL'] = 'Tidak ada halaman wiki tersedia';
diff --git a/codepot/src/codepot/language/korean/common_lang.php b/codepot/src/codepot/language/korean/common_lang.php
index f8ebc6cb..cbe691f8 100644
--- a/codepot/src/codepot/language/korean/common_lang.php
+++ b/codepot/src/codepot/language/korean/common_lang.php
@@ -7,9 +7,11 @@ $lang['Created on'] = '최초생성시간';
$lang['Delete'] = '삭제';
$lang['Description'] = '설명';
$lang['Details'] = '상세내역';
+$lang['Difference'] = '차이점';
$lang['Download'] = '내려받기';
$lang['Edit'] = '수정';
-$lang['History'] = '변경내역';
+$lang['Head revision'] = '최신리비전';
+$lang['History'] = '변경기록';
$lang['Home'] = '홈';
$lang['File'] = '파일';
$lang['Files'] = '파일';
@@ -45,6 +47,7 @@ $lang['Username'] = '사용자명';
$lang['Wiki'] = '위키';
$lang['Wikis'] = '위키';
+$lang['MSG_NO_DIFF'] = '차이점이 없습니다';
$lang['MSG_NO_FILES_AVAIL'] = '사용가능한 파일이 없습니다';
$lang['MSG_NO_SOURCE_AVAIL'] = '사용가능한 소스가 없습니다';
$lang['MSG_NO_WIKIS_AVAIL'] = '사용가능한 위키페이지가 없습니다';
diff --git a/codepot/src/codepot/models/projectmodel.php b/codepot/src/codepot/models/projectmodel.php
index 5d058b0e..de550adc 100644
--- a/codepot/src/codepot/models/projectmodel.php
+++ b/codepot/src/codepot/models/projectmodel.php
@@ -241,9 +241,9 @@ class ProjectModel extends Model
function deleteDirectory($dir)
{
- if (is_link($dir)) return unlink($dir);
+ if (is_link($dir)) return @unlink($dir);
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)
{
diff --git a/codepot/src/codepot/models/subversionmodel.php b/codepot/src/codepot/models/subversionmodel.php
index 35c8a906..796d27f8 100644
--- a/codepot/src/codepot/models/subversionmodel.php
+++ b/codepot/src/codepot/models/subversionmodel.php
@@ -68,6 +68,337 @@ class SubversionModel extends Model
$fileinfo['history'] = $str;
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"] = " ";
+ $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"] = " ";
+ $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 = ' ';
+ //$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"] = " ";
+ $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"] = " ";
+ $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"] = " ";
+ $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"] = " ";
+ $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'];
+ }
+
}
?>
diff --git a/codepot/src/codepot/views/Makefile.am b/codepot/src/codepot/views/Makefile.am
index ee85d56b..d1a765eb 100644
--- a/codepot/src/codepot/views/Makefile.am
+++ b/codepot/src/codepot/views/Makefile.am
@@ -14,6 +14,7 @@ www_DATA = \
project_list.php \
projectbar.php \
source_blame.php \
+ source_diff.php \
source_file.php \
source_folder.php \
source_history.php \
diff --git a/codepot/src/codepot/views/Makefile.in b/codepot/src/codepot/views/Makefile.in
index 5865189f..7148cb6f 100644
--- a/codepot/src/codepot/views/Makefile.in
+++ b/codepot/src/codepot/views/Makefile.in
@@ -177,6 +177,7 @@ www_DATA = \
project_list.php \
projectbar.php \
source_blame.php \
+ source_diff.php \
source_file.php \
source_folder.php \
source_history.php \
diff --git a/codepot/src/codepot/views/file_home.php b/codepot/src/codepot/views/file_home.php
index 9a414f53..a254f15f 100644
--- a/codepot/src/codepot/views/file_home.php
+++ b/codepot/src/codepot/views/file_home.php
@@ -34,7 +34,7 @@ $this->load->view (
=$this->lang->line('Files')?>
-
+
';
- print '
';
+ print '';
+ print '';
print '' . $this->lang->line('Tag') . ' | ';
print '' . $this->lang->line('Name') . ' | ';
print '' . $this->lang->line('Summary') . ' | ';
@@ -65,10 +65,13 @@ else
print '
';
$oldtag = '';
+ $rownum = 0;
+ $rowclasses = array ('odd', 'even');
foreach ($files as $file)
{
$hexname = $this->converter->AsciiToHex ($file->name);
- print '';
+ $rowclass = $rowclasses[$rownum++ % 2];
+ print "
";
print '';
if ($file->tag != $oldtag)
{
@@ -82,9 +85,9 @@ else
print ' | ';
print htmlspecialchars($file->summary);
print ' | ';
- print '';
+ print ' | ';
print $file->md5sum;
- print ' | ';
+ print '';
print '';
print anchor ("file/get/{$project->id}/{$hexname}", $this->lang->line('Download'));
print ' | ';
diff --git a/codepot/src/codepot/views/source_blame.php b/codepot/src/codepot/views/source_blame.php
index 384ffc40..b9559784 100644
--- a/codepot/src/codepot/views/source_blame.php
+++ b/codepot/src/codepot/views/source_blame.php
@@ -33,31 +33,29 @@ $this->load->view (
);
?>
-
-
-
-
-
id;
-print anchor ($xpar, htmlspecialchars($project->name));
+if ($revision <= 0)
+{
+ $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 != '')
{
$exps = explode ('/', $folder);
@@ -65,39 +63,59 @@ if ($folder != '')
$par = '';
for ($i = 1; $i < $expsize; $i++)
{
+ print '/';
+
$par .= '/' . $exps[$i];
$hexpar = $this->converter->AsciiToHex ($par);
- print '/';
- $xpar = 'source/folder/' . $project->id . '/' . $hexpar;
- if ($revision != SVN_REVISION_HEAD) $xpar .= '/' . $revision;
- print anchor ($xpar, htmlspecialchars($exps[$i]));
+ print anchor (
+ "source/folder/{$project->id}/{$hexpar}{$revreq}",
+ htmlspecialchars($exps[$i]));
}
}
-$par = $folder . '/' . $file['name'];
-$par = $this->converter->AsciiTohex ($par);
+
print '/';
-$xpar = '/source/blame/' . $project->id . '/' . $par;
-if ($revision != SVN_REVISION_HEAD) $xpar .= '/' . $revision;
-print anchor ($xpar, htmlspecialchars($file['name']));
+
+$par = $this->converter->AsciiTohex ("{$folder}/{$file['name']}");
+print anchor (
+ "/source/blame/{$project->id}/{$par}{$revreq}",
+ htmlspecialchars($file['name']));
?>
converter->AsciiTohex ($par);
-$xpar = 'source/file/' . $project->id . '/' . $par;
-if ($revision != SVN_REVISION_HEAD) $xpar .= '/' . $revision;
-print anchor ($xpar, $this->lang->line('Details'));
+$par = $this->converter->AsciiToHex ("{$folder}/{$file['name']}");
+
+
+if ($file['created_rev'] != $file['head_rev'])
+{
+ 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 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'));
+
?>
+
+=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']?>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+=htmlspecialchars($project->name)?>
+
+
+
+
+
+
+
+
+load->view ('taskbar'); ?>
+
+
+
+load->view (
+ 'projectbar',
+ array (
+ 'pageid' => 'source',
+ 'ctxmenuitems' => array ()
+ )
+);
+?>
+
+
+
+
+
+
+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']));
+?>
+
+
+
+
+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'));
+?>
+
+
+
+=$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']?>
+
+
+
+
+
+
+
+';
+ print_r ($file['content']);
+ print '';
+ */
+
+ print '';
+ print '';
+
+ $currev = $file['created_rev'];
+ $prevrev = $file['against']['prev_rev'];
+ $prevanc = "source/diff/{$project->id}/{$par}/{$currev}/{$prevrev}";
+ print anchor ($prevanc, '<<');
+ print ' ';
+
+ 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 ' ';
+ print anchor ($nextanc, '>>');
+
+ print ' | ';
+
+ print '';
+
+ $currev = $file['against']['created_rev'];
+ $prevrev = $file['prev_rev'];
+ $prevanc = "source/diff/{$project->id}/{$par}/{$prevrev}/{$currev}";
+ print anchor ($prevanc, '<<');
+ print ' ';
+
+ 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 ' ';
+ print anchor ($nextanc, '>>');
+
+ print ' | ';
+ print '
';
+
+ if (empty($file['content']))
+ {
+ print '';
+ print '';
+ print htmlspecialchars ($this->lang->line('MSG_NO_DIFF'));
+ print ' | ';
+ print '
';
+ }
+ else
+ {
+ foreach ($file['content'] as $x)
+ {
+ print '';
+
+ if (array_key_exists('rev1line', $x))
+ {
+ $diffclass = array_key_exists('rev1diffclass', $x)? $x['rev1diffclass']: 'diff';
+ print "";
+ print "";
+ print htmlspecialchars($x['rev1line']);
+ print ' ';
+ print ' | ';
+ }
+ else
+ {
+ print '';
+ print $x['rev1lineno'];
+ print ' | ';
+ }
+
+ if (array_key_exists('rev2line', $x))
+ {
+ $diffclass = array_key_exists('rev2diffclass', $x)? $x['rev2diffclass']: 'diff';
+ print "";
+ print "";
+ print htmlspecialchars($x['rev2line']);
+ print ' ';
+ print ' | ';
+ }
+ else
+ {
+ print '';
+ print $x['rev2lineno'];
+ print ' | ';
+ }
+
+ print '
';
+ }
+ }
+?>
+
+
+
+
+
+
+
+
+
+load->view ('footer'); ?>
+
+
+
+
+
+
+
+