From db114f4aa49c9a8fbc59d9c7494ff267c2e0f777 Mon Sep 17 00:00:00 2001 From: hyung-hwan Date: Fri, 30 Jan 2015 05:54:18 +0000 Subject: [PATCH] fixed some bugs in the fulldiff view --- codepot/src/codepot/controllers/code.php | 6 +++--- codepot/src/codepot/models/subversionmodel.php | 13 +++++++++---- codepot/src/codepot/views/code_diff.php | 8 ++++---- codepot/src/codepot/views/taskbar.php | 2 +- codepot/src/css/common.css | 17 +++++++++++++---- 5 files changed, 30 insertions(+), 16 deletions(-) diff --git a/codepot/src/codepot/controllers/code.php b/codepot/src/codepot/controllers/code.php index 99eb0288..19410f0d 100644 --- a/codepot/src/codepot/controllers/code.php +++ b/codepot/src/codepot/controllers/code.php @@ -399,7 +399,7 @@ class Code extends Controller { $data['message'] = 'DATABASE ERROR'; $this->load->view ($this->VIEW_ERROR, $data); - } + } else if ($project === NULL) { $data['message'] = @@ -425,9 +425,9 @@ class Code extends Controller else { $file['prev_rev'] = - $this->subversion->getPrevRev ($projectid, $path, $file['created_rev']); + $this->subversion->getPrevRev ($projectid, $path, $file['created_rev']); $file['next_rev'] = - $this->subversion->getNextRev ($projectid, $path, $file['created_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'] = diff --git a/codepot/src/codepot/models/subversionmodel.php b/codepot/src/codepot/models/subversionmodel.php index b366ba31..5edd499a 100644 --- a/codepot/src/codepot/models/subversionmodel.php +++ b/codepot/src/codepot/models/subversionmodel.php @@ -540,7 +540,6 @@ class SubversionModel extends Model return $listing; } - // // Given a path name at the HEAD revision, it compares the file // between two revisions given. The actual path name at a given @@ -645,9 +644,15 @@ class SubversionModel extends Model if ($full) { - $src1 = @svn_cat ($info2[0]['url'], $info2[0]['revision']); - $src2 = @svn_cat ($info1[0]['url'], $info1[0]['revision']); - $fileinfo['content'] = $this->_get_diff ($diff, $src1, $src2, TRUE, FALSE); + $old_text = @svn_cat ($info2[0]['url'], $info2[0]['revision']); + if ($old_text === FALSE) + { + // if the old URL can't give the contents, + // try it with the latest url and the old revision number + $old_text = @svn_cat ($info1[0]['url'], $info2[0]['revision']); + } + $new_text = @svn_cat ($info1[0]['url'], $info1[0]['revision']); + $fileinfo['content'] = $this->_get_diff ($diff, $old_text, $new_text, TRUE, FALSE); } else { diff --git a/codepot/src/codepot/views/code_diff.php b/codepot/src/codepot/views/code_diff.php index 237d859f..83097190 100644 --- a/codepot/src/codepot/views/code_diff.php +++ b/codepot/src/codepot/views/code_diff.php @@ -114,8 +114,8 @@ $this->load->view ( print anchor ( "code/history/{$project->id}{$revtrailer}", $this->lang->line('History')); - } - else + } + else { print anchor ( "code/history/{$project->id}/{$xpar}", @@ -157,7 +157,7 @@ function format_diff ($a, $b, $css_class) } else { - if ($diffstart < 0) $diffstart = $i; + if ($diffstart < 0) $diffstart = $i; } } @@ -171,7 +171,7 @@ function format_diff ($a, $b, $css_class) { if ($alen > $blen) { - $cc .= htmlspecialchars(substr ($a, $alen, $alen - $blen)); + $cc .= htmlspecialchars(substr ($a, $blen, $alen - $blen)); } } diff --git a/codepot/src/codepot/views/taskbar.php b/codepot/src/codepot/views/taskbar.php index 42fdd446..4527f5d7 100644 --- a/codepot/src/codepot/views/taskbar.php +++ b/codepot/src/codepot/views/taskbar.php @@ -20,7 +20,7 @@ function show_taskbar ($con, $login) if ($icon_image) { $icon_src = sprintf ( - '', + '', mime_content_type($icon_path), base64_encode($icon_image) ); diff --git a/codepot/src/css/common.css b/codepot/src/css/common.css index c254a21c..55f4ff03 100644 --- a/codepot/src/css/common.css +++ b/codepot/src/css/common.css @@ -46,22 +46,31 @@ body { } .content .taskbar { - font-size: 0.9em; - font-weight: bold; + font-size: 1em; + /*font-weight: bold;*/ text-transform: uppercase; - padding: 0.6em 0.2em 0.6em 0.2em; + padding: 0.5em 0.2em 0.5em 0.2em; color: #ffffff; background-color: #203150; + + line-height: 2em; + vertical-align: middle; } .content .taskbar .boxa { /*vertical-align: bottom;*/ + float: none; } .content .taskbar .boxb { float: right; } +.content .taskbar .boxb .user_icon_img { + height: 2em; /* as large as line-height of taskbar */ + vertical-align: middle; +} + .content .taskbar a { text-decoration: none; color: #ffffff; @@ -105,7 +114,7 @@ body { .content .projectbar { /*margin: 0.1em 0em 0em 0em;*/ - padding: 0.2em 0.2em 0.2em 0.2em; + padding: 0.5em 0.5em 0.5em 0.5em; color: #FFFFFF; background-color: #4665A2; }