From 889803afea09222cacf072807592cfc12a85b1dc Mon Sep 17 00:00:00 2001 From: hyung-hwan Date: Fri, 19 Feb 2010 02:46:23 +0000 Subject: [PATCH] enhanced the file and blame view to display a log message --- .../src/codepot/models/subversionmodel.php | 22 +++- codepot/src/codepot/views/source_blame.php | 115 +++++++++++------- codepot/src/codepot/views/source_diff.php | 2 +- codepot/src/codepot/views/source_file.php | 22 ++-- codepot/src/codepot/views/source_history.php | 32 +---- codepot/src/css/project.css | 60 ++++++++- 6 files changed, 166 insertions(+), 87 deletions(-) diff --git a/codepot/src/codepot/models/subversionmodel.php b/codepot/src/codepot/models/subversionmodel.php index 1210ca63..2c562dbf 100644 --- a/codepot/src/codepot/models/subversionmodel.php +++ b/codepot/src/codepot/models/subversionmodel.php @@ -25,9 +25,16 @@ class SubversionModel extends Model $str = @svn_cat ($url, $rev); if ($str === FALSE) return FALSE; + $log = @svn_log ($url, + $fileinfo['created_rev'], + $fileinfo['created_rev'], + 1, SVN_DISCOVER_CHANGED_PATHS); + if ($log === FALSE) return FALSE; + $fileinfo['fullpath'] = substr ( $info[0]['url'], strlen($info[0]['repos'])); $fileinfo['content'] = $str; + $fileinfo['logmsg'] = (count($log) > 0)? $log[0]['msg']: ''; return $fileinfo; } else if ($info[0]['kind'] == SVN_NODE_DIR) @@ -35,6 +42,12 @@ class SubversionModel extends Model $list = @svn_ls ($url, $rev, FALSE, TRUE); if ($list === FALSE) return FALSE; + $log = @svn_log ($url, + $fileinfo['created_rev'], + $fileinfo['created_rev'], + 1, SVN_DISCOVER_CHANGED_PATHS); + if ($log === FALSE) return FALSE; + $fileinfo['fullpath'] = substr ( $info[0]['url'], strlen($info[0]['repos'])); $fileinfo['name'] = $info[0]['path']; @@ -43,7 +56,7 @@ class SubversionModel extends Model $fileinfo['created_rev'] = $info[0]['revision']; $fileinfo['last_author'] = $info[0]['last_changed_rev']; $fileinfo['content'] = $list; - + $fileinfo['logmsg'] = (count($log) > 0)? $log[0]['msg']: ''; return $fileinfo; } @@ -68,9 +81,16 @@ class SubversionModel extends Model $str = @svn_blame ($url, $rev); if ($str === FALSE) return FALSE; + $log = @svn_log ($url, + $fileinfo['created_rev'], + $fileinfo['created_rev'], + 1, SVN_DISCOVER_CHANGED_PATHS); + if ($log === FALSE) return FALSE; + $fileinfo['fullpath'] = substr ( $info[0]['url'], strlen($info[0]['repos'])); $fileinfo['content'] = $str; + $fileinfo['logmsg'] = (count($log) > 0)? $log[0]['msg']: ''; return $fileinfo; } diff --git a/codepot/src/codepot/views/source_blame.php b/codepot/src/codepot/views/source_blame.php index 16c5b83e..d874181b 100644 --- a/codepot/src/codepot/views/source_blame.php +++ b/codepot/src/codepot/views/source_blame.php @@ -104,68 +104,89 @@ print anchor ("source/history/{$project->id}/{$xpar}", $this->lang->line('Histor ?> -
-id}/${xpar}/{$file['prev_rev']}", '<<')?> -lang->line('Revision')?>: -id}/${xpar}/{$file['next_rev']}", '>>')?> | -lang->line('Author')?>: | -lang->line('Size')?>: | -lang->line('Last updated on')?>: +
+ id}/${xpar}/{$file['prev_rev']}", '<<')?> + lang->line('Revision')?>: + id}/${xpar}/{$file['next_rev']}", '>>')?> | + lang->line('Author')?>: | + lang->line('Size')?>: | + lang->line('Last updated on')?>:
+
+
 converter->AsciiTohex ($headpath);
-		$rev_padded = anchor ("/source/blame/{$project->id}/{$xpar}/{$rev}", $rev_padded);
+		$line = $content[$i];
+		$lineno_padded = str_pad ($line['line_no'], 6, ' ', STR_PAD_LEFT);
+	
+		if ($line['rev'] != $rev) 
+		{
+			$rev = $line['rev'];
+			$rev_padded = str_pad ($rev, 6, ' ', STR_PAD_LEFT);
+	
+			$xpar = $this->converter->AsciiTohex ($headpath);
+			$rev_padded = anchor ("/source/blame/{$project->id}/{$xpar}/{$rev}", $rev_padded);
+		}
+		else
+		{
+			$rev_padded = str_pad (' ', 6, ' ', STR_PAD_LEFT);
+		}
+	
+		if ($line['author'] != $author) 
+		{
+			$author = $line['author'];
+			$author_padded = str_pad ($author, 8, ' ', STR_PAD_RIGHT);
+			$author_padded = substr($author_padded, 0, 8);
+		}
+		else
+		{
+			$author_padded = str_pad (' ', 8, ' ', STR_PAD_RIGHT);
+		}
+	
+		print "{$rev_padded}";
+		print "{$author_padded}";
+		print "{$lineno_padded}";
+		print htmlspecialchars ($line['line']);
+		print "\n";
 	}
-	else
-	{
-		$rev_padded = str_pad (' ', 6, ' ', STR_PAD_LEFT);
-	}
-
-	if ($line['author'] != $author) 
-	{
-		$author = $line['author'];
-		$author_padded = str_pad ($author, 8, ' ', STR_PAD_RIGHT);
-		$author_padded = substr($author_padded, 0, 8);
-	}
-	else
-	{
-		$author_padded = str_pad (' ', 8, ' ', STR_PAD_RIGHT);
-	}
-
-	print "{$rev_padded}";
-	print "{$author_padded}";
-	print "{$lineno_padded}";
-	print htmlspecialchars ($line['line']);
-	print "\n";
-}
 ?>
 
-
+
+ + +
+
+
+
+ +
+ + diff --git a/codepot/src/codepot/views/source_diff.php b/codepot/src/codepot/views/source_diff.php index 0b48f154..17203f26 100644 --- a/codepot/src/codepot/views/source_diff.php +++ b/codepot/src/codepot/views/source_diff.php @@ -82,7 +82,7 @@ $this->load->view ( $this->lang->line('Blame')); print ' | '; print anchor ( - "source/history/file/{$project->id}/{$xpar}", + "source/history/{$project->id}/{$xpar}", $this->lang->line('History')); ?> diff --git a/codepot/src/codepot/views/source_file.php b/codepot/src/codepot/views/source_file.php index d9c71707..e1048e4c 100644 --- a/codepot/src/codepot/views/source_file.php +++ b/codepot/src/codepot/views/source_file.php @@ -144,16 +144,24 @@ if ($fileext == '') $fileext = "html" ?> +
-
-akdjflosjfkdsajflkdsj
-aslkfdjdsalkjfs
-alkjfdlkajf
+
 
-
-sadkfjsalfjskjdslkfsaj
-
+ +
+
+
+
diff --git a/codepot/src/codepot/views/source_history.php b/codepot/src/codepot/views/source_history.php index 0ad1c06a..47f18e2a 100644 --- a/codepot/src/codepot/views/source_history.php +++ b/codepot/src/codepot/views/source_history.php @@ -67,26 +67,6 @@ $this->load->view (
@@ -96,7 +76,7 @@ $this->load->view ( lang->line('Author')?> lang->line('Date')?> lang->line('Message')?> - '; ?> + '; ?> load->view ( // let's track the copy path. // $paths = $h['paths']; - $colspan = ($file['type'] == 'file')? 5: 4; + $colspan = ($file['type'] == 'file' || $file['type'] == 'dir')? 5: 4; foreach ($paths as $p) { - /* - if (array_key_exists ('copyfrom', $p) && - $p['path'] == $curfullpath && $p['action'] == 'A') - { - $curfullpath = $p['copyfrom']; - print "{$curfullpath}"; - } - */ if (array_key_exists ('copyfrom', $p) && $p['action'] == 'A') { diff --git a/codepot/src/css/project.css b/codepot/src/css/project.css index 6b8c6d42..3b657e03 100644 --- a/codepot/src/css/project.css +++ b/codepot/src/css/project.css @@ -38,12 +38,70 @@ top: 0; right: 0; width: 20em; - background-color: red; } #project_source_file_mainarea_result_info pre { + overflow: auto; border: 0; margin: 0; + padding: 0; +} + +#project_source_file_mainarea_result_info .title { + background-color: #7777FF; + border: 0; + margin: 0; + font-size: 0.8em; + text-align: right; +} + +#project_source_file_mainarea_result_info .title a { + color: white; + font-size: inherit; + background-color: inherit; +} + +#project_source_file_mainarea_result_info .title a:hover { + background-color: inherit; +} + +/*----------------------------------------------- + * project source blame view + *-----------------------------------------------*/ +#project_source_blame_mainarea_result { + position: relative; +} + +#project_source_blame_mainarea_result_info { + position: absolute; + top: 0; + right: 0; + width: 20em; +} + +#project_source_blame_mainarea_result_info pre { + overflow: auto; + border: 0; + margin: 0; + padding: 0; +} + +#project_source_blame_mainarea_result_info .title { + background-color: #7777FF; + border: 0; + margin: 0; + font-size: 0.8em; + text-align: right; +} + +#project_source_blame_mainarea_result_info .title a { + color: white; + font-size: inherit; + background-color: inherit; +} + +#project_source_blame_mainarea_result_info .title a:hover { + background-color: inherit; } /*-----------------------------------------------