From 0a15131296d6f271b541ee9082161306f65b5956 Mon Sep 17 00:00:00 2001 From: hyung-hwan Date: Fri, 12 Feb 2010 14:53:34 +0000 Subject: [PATCH] enhanced the history view to display changed paths. yet more to improve --- .../codepot/language/english/common_lang.php | 1 + .../language/indonesian/common_lang.php | 1 + .../codepot/language/korean/common_lang.php | 1 + .../src/codepot/models/subversionmodel.php | 22 ++-- codepot/src/codepot/views/source_file.php | 22 +++- codepot/src/codepot/views/source_folder.php | 50 +++---- codepot/src/codepot/views/source_history.php | 124 +++++++++++------- codepot/src/codepot/views/source_revision.php | 42 ++---- codepot/src/css/project.css | 72 ++++++++-- 9 files changed, 211 insertions(+), 124 deletions(-) diff --git a/codepot/src/codepot/language/english/common_lang.php b/codepot/src/codepot/language/english/common_lang.php index 18a33c8e..cca41579 100644 --- a/codepot/src/codepot/language/english/common_lang.php +++ b/codepot/src/codepot/language/english/common_lang.php @@ -4,6 +4,7 @@ $lang['Blame'] = 'Blame'; $lang['Create'] = 'Create'; $lang['Created by'] = 'Created by'; $lang['Created on'] = 'Created on'; +$lang['Date'] = 'Date'; $lang['Delete'] = 'Delete'; $lang['Description'] = 'Description'; $lang['Details'] = 'Details'; diff --git a/codepot/src/codepot/language/indonesian/common_lang.php b/codepot/src/codepot/language/indonesian/common_lang.php index 0dcc4bcf..9821f711 100644 --- a/codepot/src/codepot/language/indonesian/common_lang.php +++ b/codepot/src/codepot/language/indonesian/common_lang.php @@ -4,6 +4,7 @@ $lang['Blame'] = 'Menyalahkan'; $lang['Create'] = 'Dibuat'; $lang['Created by'] = 'Dibuat oleh'; $lang['Created on'] = 'Waktu dibuat'; +$lang['Date'] = 'Date'; $lang['Delete'] = 'Hapus'; $lang['Description'] = 'Penjelasan'; $lang['Details'] = 'Detail'; diff --git a/codepot/src/codepot/language/korean/common_lang.php b/codepot/src/codepot/language/korean/common_lang.php index 7f423f9f..f484ba5a 100644 --- a/codepot/src/codepot/language/korean/common_lang.php +++ b/codepot/src/codepot/language/korean/common_lang.php @@ -4,6 +4,7 @@ $lang['Blame'] = '책임전가'; $lang['Create'] = '생성'; $lang['Created by'] = '최초생성인'; $lang['Created on'] = '최초생성시간'; +$lang['Date'] = '날짜'; $lang['Delete'] = '삭제'; $lang['Description'] = '설명'; $lang['Details'] = '상세내역'; diff --git a/codepot/src/codepot/models/subversionmodel.php b/codepot/src/codepot/models/subversionmodel.php index 33c3ea25..42d09d25 100644 --- a/codepot/src/codepot/models/subversionmodel.php +++ b/codepot/src/codepot/models/subversionmodel.php @@ -65,13 +65,13 @@ class SubversionModel extends Model $last = substr(strrchr($path, '/'), 1); if ($last === FALSE) $last = ''; - $info['name'] = $last; - $fileinfo = $info; + /* set the file name to the information array */ + $fileinfo['name'] = $last; - $str = @svn_log ($path, 1, $rev); - if ($str === FALSE) return FALSE; + $log = @svn_log ($path, 1, $rev, 0, SVN_DISCOVER_CHANGED_PATHS); + if ($log === FALSE) return FALSE; - $fileinfo['history'] = $str; + $fileinfo['history'] = $log; return $fileinfo; } @@ -82,15 +82,15 @@ class SubversionModel extends Model $last = substr(strrchr($path, '/'), 1); if ($last === FALSE) $last = ''; - $info['name'] = $last; - $fileinfo = $info; + /* set the file name to the information array */ + $fileinfo['name'] = $last; - $str = @svn_log ($path, $rev, $rev); - if ($str === FALSE) return FALSE; + $log = @svn_log ($path, $rev, $rev, 1, SVN_DISCOVER_CHANGED_PATHS); + if ($log === FALSE) return FALSE; - if (count($str) != 1) return FALSE; + if (count($log) != 1) return FALSE; - $fileinfo['history'] = $str[0]; + $fileinfo['history'] = $log[0]; return $fileinfo; } diff --git a/codepot/src/codepot/views/source_file.php b/codepot/src/codepot/views/source_file.php index 3d536a67..54593f0b 100644 --- a/codepot/src/codepot/views/source_file.php +++ b/codepot/src/codepot/views/source_file.php @@ -100,7 +100,7 @@ print anchor ("source/history/file/{$project->id}/{$par}", $this->lang->line('Hi ?> -
+
id}/${par}/{$file['prev_rev']}", '<<')?> lang->line('Revision')?>: id}/${par}/{$file['next_rev']}", '>>')?> | @@ -109,12 +109,14 @@ print anchor ("source/history/file/{$project->id}/{$par}", $this->lang->line('Hi lang->line('Last updated on')?>:
+
+ -
+
 
 
+
+
+akdjflosjfkdsajflkdsj
+aslkfdjdsalkjfs
+alkjfdlkajf
+
+
+sadkfjsalfjskjdslkfsaj
+
+
+ +
+
- load->view ('footer'); ?> diff --git a/codepot/src/codepot/views/source_folder.php b/codepot/src/codepot/views/source_folder.php index 9ba0f75e..d3bc1e13 100644 --- a/codepot/src/codepot/views/source_folder.php +++ b/codepot/src/codepot/views/source_folder.php @@ -47,32 +47,36 @@ $this->load->view (
converter->AsciiToHex ('.') . $revreq; -} + 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 != '') -{ + // print the main anchor for the root folder. + // let the anchor text be the project name. + print anchor ( + "/source/folder/{$project->id}{$revreqroot}", + htmlspecialchars($project->name)); + + // explode non-root folder parts to anchors $exps = explode ('/', $folder); $expsize = count($exps); $par = ''; for ($i = 1; $i < $expsize; $i++) { print '/'; - $par .= '/' . $exps[$i]; - $hexpar = $this->converter->AsciiToHex ($par); - print anchor ("source/folder/{$project->id}/{$hexpar}{$revreq}", htmlspecialchars($exps[$i])); + $xpar = $this->converter->AsciiToHex ($par); + print anchor ( + "source/folder/{$project->id}/{$xpar}{$revreq}", + htmlspecialchars($exps[$i])); } -} ?>
@@ -95,13 +99,13 @@ if ($folder != '') else { print ''; usort ($files, 'comp_files'); @@ -113,7 +117,7 @@ if ($folder != '') print '' . $this->lang->line('Revision') . ''; print '' . $this->lang->line('Size') . ''; print '' . $this->lang->line('Author') . ''; - print '' . $this->lang->line('Time') . ''; + print '' . $this->lang->line('Date') . ''; print '' . $this->lang->line('Blame') . ''; print '' . $this->lang->line('Difference') . ''; print ''; @@ -143,7 +147,8 @@ if ($folder != '') print htmlspecialchars($f['last_author']); print ''; print ''; - print date('r', $f['time_t']); + //print date('r', $f['time_t']); + print date('Y-m-d', $f['time_t']); print ''; print ''; print ''; @@ -169,7 +174,8 @@ if ($folder != '') print htmlspecialchars($f['last_author']); print ''; print ''; - print date('r', $f['time_t']); + //print date('r', $f['time_t']); + print date('Y-m-d', $f['time_t']); print ''; print ''; diff --git a/codepot/src/codepot/views/source_history.php b/codepot/src/codepot/views/source_history.php index 08805a41..f1e1868c 100644 --- a/codepot/src/codepot/views/source_history.php +++ b/codepot/src/codepot/views/source_history.php @@ -39,58 +39,69 @@ $this->load->view (
converter->AsciiToHex('.') . $revreq; + } + + // print the anchor for the root folder with a project name + print anchor ( + "/source/history/folder/{$project->id}{$revreqroot}", + htmlspecialchars($project->name)); + + // explodes part of the folder name into an array + $exps = explode ('/', $folder); $expsize = count($exps); $par = ''; + // print anchors pointing to each part for ($i = 1; $i < $expsize; $i++) { - $par .= '/' . $exps[$i]; - $hexpar = $converter->AsciiToHex ($par); print '/'; - $xpar = "source/history/$type/{$project->id}/{$hexpar}"; - if ($rev != '') $xpar .= "/{$rev}"; - print anchor ($xpar, htmlspecialchars($exps[$i])); + $par .= '/' . $exps[$i]; + $xpar = $this->converter->AsciiToHex ($par); + print anchor ( + "source/history/folder/{$project->id}/{$xpar}{$revreq}", + htmlspecialchars($exps[$i])); } -} - -print anchor ("/source/history/folder/{$project->id}", htmlspecialchars($project->name)); -if ($folder != '') print_path ($project, $folder, 'folder', $this->converter); ?>
-
- + @@ -98,6 +109,7 @@ else $rowclasses = array ('even', 'odd'); $history = $file['history']; $history_count = count($history); + $curfolder = $folder; for ($i = $history_count; $i > 0; ) { $h = $history[--$i]; @@ -106,14 +118,14 @@ else print ""; print ''; print ''; print ''; print ''; print ''; + + // + // let's track the copy path. + // + $paths = $h['paths']; + foreach ($paths as $p) + { + if (array_key_exists ('copyfrom', $p) && + $p['path'] == $curfolder && $p['action'] == 'A') + { + $curfolder = $p['copyfrom']; + print ""; + } + } + } ?>
lang->line('Revision')?> lang->line('Author')?>lang->line('Time')?>lang->line('Date')?> lang->line('Message')?>
'; - $hexfolder = $this->converter->AsciiToHex(($folder == '')? '.': $folder); - /* + // + // it seems the history can be retrieved only from the latest name */ + // + $xfolder = $this->converter->AsciiToHex(($folder == '')? '.': $folder); if ($type == 'folder') - print anchor ("/source/revision/{$type}/{$project->id}/{$hexfolder}/{$h['rev']}", $h['rev']); + print anchor ("/source/revision/{$type}/{$project->id}/{$xfolder}/{$h['rev']}", $h['rev']); else - print anchor ("/source/{$type}/{$project->id}/{$hexfolder}/{$h['rev']}", $h['rev']); - */ - print $h['rev']; + print anchor ("/source/{$type}/{$project->id}/{$xfolder}/{$h['rev']}", $h['rev']); print ''; @@ -126,32 +138,48 @@ else print ''; + print '
';
 		print htmlspecialchars($h['msg']);
+		print '
'; print '
'; + // + // the actual folder or file contents must be accessed with the name + // at a particular revision. + // + $xfolder = $this->converter->AsciiToHex(($curfolder == '')? '.': $curfolder); if ($type == 'folder') { - print anchor ("/source/revision/{$type}/{$project->id}/{$hexfolder}/{$h['rev']}", - $this->lang->line('Details')); - print ' '; - print anchor ("/source/folder/{$project->id}/{$hexfolder}/{$h['rev']}", + print anchor ("/source/folder/{$project->id}/{$xfolder}/{$h['rev']}", $this->lang->line('Folder')); } else { - print anchor ("/source/{$type}/{$project->id}/{$hexfolder}/{$h['rev']}", - $this->lang->line('Details')); - print ' '; - print anchor ("/source/blame/{$project->id}/{$hexfolder}/{$h['rev']}", + print anchor ("/source/blame/{$project->id}/{$xfolder}/{$h['rev']}", $this->lang->line('Blame')); print ' '; - print anchor ("/source/diff/{$project->id}/{$hexfolder}/{$h['rev']}", + print anchor ("/source/diff/{$project->id}/{$xfolder}/{$h['rev']}", $this->lang->line('Difference')); } print '
{$curfolder}
diff --git a/codepot/src/codepot/views/source_revision.php b/codepot/src/codepot/views/source_revision.php index 6c7a574d..e3243943 100644 --- a/codepot/src/codepot/views/source_revision.php +++ b/codepot/src/codepot/views/source_revision.php @@ -35,19 +35,6 @@ $this->load->view ( $history = $file['history']; ?> - -
id}/{$hexfolder}", $this->lang-
+ +
Message
+
+
+
+ +
Files updated
'; @@ -111,27 +105,15 @@ print anchor ("source/history/{$type}/{$project->id}/{$hexfolder}", $this->lang- $hexpar = $this->converter->AsciiToHex ($p['path']); print "'; print ''; + print ''; } ?> diff --git a/codepot/src/css/project.css b/codepot/src/css/project.css index 38af67d5..6b8c6d42 100644 --- a/codepot/src/css/project.css +++ b/codepot/src/css/project.css @@ -2,6 +2,18 @@ * This file contains specific IDs for furthur customization. */ +/*----------------------------------------------- + * project file home view + *-----------------------------------------------*/ +#project_file_home_mainarea_result { + overflow: auto; +} + +#project_file_home_mainarea_result_table tr { + vertical-align: top; + white-space: nowrap; +} + /*----------------------------------------------- * project source folder view *-----------------------------------------------*/ @@ -15,15 +27,23 @@ } /*----------------------------------------------- - * project source folder view + * project source file view *-----------------------------------------------*/ -#project_file_home_mainarea_result { - overflow: auto; +#project_source_file_mainarea_result { + position: relative; } -#project_file_home_mainarea_result_table tr { - vertical-align: top; - white-space: nowrap; +#project_source_file_mainarea_result_info { + position: absolute; + top: 0; + right: 0; + width: 20em; + background-color: red; +} + +#project_source_file_mainarea_result_info pre { + border: 0; + margin: 0; } /*----------------------------------------------- @@ -46,13 +66,37 @@ white-space: nowrap; } +#project_source_history_mainarea_result_table pre { + border: 0; + background-color: inherit; + padding: 0; + margin: 0; +} + +#project_source_history_mainarea_result_table .title { + font-size: inherit; + font-weight: inherit; + font-style: italic; + text-align: center; + background-color: #AABBFF; +} + /*----------------------------------------------- * project source revision view *-----------------------------------------------*/ + #project_source_revision_mainarea_result { overflow: auto; } +#project_source_revision_mainarea_result_msg { + border: 0; + padding: 0; + background-color: inherit; + margin: 0; + margin-bottom: 1em; +} + #project_source_revision_mainarea_result_table td.M { white-space: nowrap; background-image:url(images/page_white_edit.png); @@ -85,6 +129,16 @@ padding-left: 22px; } +#project_source_revision_mainarea_result_sidebar { + /*overflow: auto;*/ +} + +#project_source_revision_mainarea_result_sidebar pre { + overflow: auto; + border: 0; + padding: 0; +} + /*----------------------------------------------- * project source diff view *-----------------------------------------------*/ @@ -119,7 +173,7 @@ background-color:#ddffdd; background-image:url(images/bullet_add.png); background-repeat:no-repeat; - background-position:2px 50%; + background-position: 2px 50%; padding: 0; padding-left:22px; margin: 0; @@ -129,7 +183,7 @@ border:1px solid #e8d4bc; background-color:#f8e4cc; background-image:url(images/bullet_delete.png); - background-position:2px 50%; + background-position: 2px 50%; background-repeat:no-repeat; padding: 0; padding-left:22px; @@ -141,7 +195,7 @@ background-color:#ffffcc; background-image:url(images/bullet_yellow.png); background-repeat:no-repeat; - background-position:2px 50%; + background-position: 2px 50%; padding: 0; padding-left:22px; margin: 0;
"; - print htmlspecialchars($p['path']); + print anchor ("source/file/{$project->id}/{$hexpar}/{$history['rev']}", htmlspecialchars($p['path'])); print ''; -/* - if ($type == 'folder') - { - print anchor ("source/folder/{$project->id}/{$hexpar}/{$history['rev']}", $this->lang->line('Folder')); - } - else - { -*/ - print anchor ("source/file/{$project->id}/{$hexpar}/{$history['rev']}", $this->lang->line('Details')); - print ' '; - print anchor ("source/blame/{$project->id}/{$hexpar}/{$history['rev']}", $this->lang->line('Blame')); - print ' '; - print anchor ("source/diff/{$project->id}/{$hexpar}/{$history['rev']}", $this->lang->line('Difference')); -/* - } -*/ + print anchor ("source/blame/{$project->id}/{$hexpar}/{$history['rev']}", $this->lang->line('Blame')); + print ' '; + print anchor ("source/diff/{$project->id}/{$hexpar}/{$history['rev']}", $this->lang->line('Difference')); print '