From ee01b4d92c76e7f331205f8ab63eaa76da634927 Mon Sep 17 00:00:00 2001 From: hyung-hwan Date: Fri, 8 Jan 2016 20:26:01 +0000 Subject: [PATCH] renewed the code file view and the code blame view --- codepot/src/codepot/views/code_blame.php | 315 ++++++++++++--------- codepot/src/codepot/views/code_diff.php | 62 ++-- codepot/src/codepot/views/code_file.php | 234 ++++++++------- codepot/src/codepot/views/code_folder.php | 56 ++-- codepot/src/codepot/views/code_history.php | 66 +++-- codepot/src/css/code.css | 57 ++++ 6 files changed, 462 insertions(+), 328 deletions(-) diff --git a/codepot/src/codepot/views/code_blame.php b/codepot/src/codepot/views/code_blame.php index 86807bf3..a68b8501 100644 --- a/codepot/src/codepot/views/code_blame.php +++ b/codepot/src/codepot/views/code_blame.php @@ -23,35 +23,78 @@ +converter->AsciiToHex ($headpath); +if ($revision <= 0) +{ + $revreq = ''; + $revreqroot = ''; + + $history_path = "/code/history/{$project->id}/{$hex_headpath}"; +} +else +{ + $revreq = "/{$file['created_rev']}"; + $revreqroot = '/' . $this->converter->AsciiToHex ('.') . $revreq; + + if ($hex_headpath == '') $revtrailer = $revreqroot; + else $revtrailer = "/{$hex_headpath}{$revreq}"; + $history_path = "/code/history/{$project->id}{$revtrailer}"; +} +?> + @@ -95,95 +138,48 @@ $this->load->view (
-
-converter->AsciiToHex ('.') . $revreq; - } +
- print anchor ( - "code/file/{$project->id}{$revreqroot}", - htmlspecialchars($project->name)); +
+ id}{$revreqroot}", + htmlspecialchars($project->name)); - $exps = explode ('/', $headpath); - $expsize = count($exps); - $par = ''; - for ($i = 1; $i < $expsize; $i++) - { - $par .= '/' . $exps[$i]; - $xpar = $this->converter->AsciiToHex ($par); - - print '/'; - if ($i == $expsize - 1) + $exps = explode ('/', $headpath); + $expsize = count($exps); + $par = ''; + for ($i = 1; $i < $expsize; $i++) { - print anchor ( - "code/blame/{$project->id}/{$xpar}{$revreq}", - htmlspecialchars($exps[$i])); + $par .= '/' . $exps[$i]; + $xpar = $this->converter->AsciiToHex ($par); + + print '/'; + if ($i == $expsize - 1) + { + print anchor ( + "code/blame/{$project->id}/{$xpar}{$revreq}", + htmlspecialchars($exps[$i])); + } + else + { + print anchor ( + "code/file/{$project->id}/{$xpar}{$revreq}", + htmlspecialchars($exps[$i])); + } } - else + + if ($headpath != $file['fullpath']) { - print anchor ( - "code/file/{$project->id}/{$xpar}{$revreq}", - htmlspecialchars($exps[$i])); + print ' - '; + print htmlspecialchars($file['fullpath']); } - } + ?> +
- if ($headpath != $file['fullpath']) - { - print ' - '; - print htmlspecialchars($file['fullpath']); - } -?> -
- - - -
- id}/${xpar}/{$file['prev_rev']}", ''); +
+ id}/{$hex_headpath}/{$file['prev_rev']}", ''); print ' '; // anchor to the revision history at the root directory @@ -200,7 +196,7 @@ print anchor ("code/fetch/{$project->id}/${xpar}{$revreq}", $download_anchor_tex print (''); } print ' '; - print anchor ("code/blame/{$project->id}/${xpar}/{$file['next_rev']}", ''); + print anchor ("code/blame/{$project->id}/{$hex_headpath}/{$file['next_rev']}", ''); print ' | '; printf ('%s: %s', $this->lang->line('Size'), $file['size']); @@ -208,10 +204,77 @@ print anchor ("code/fetch/{$project->id}/${xpar}{$revreq}", $download_anchor_tex if ((isset($login['id']) && $login['id'] != '')) { print ' '; - print anchor ("code/bledit/{$project->id}/{$xpar}{$revreq}", $this->lang->line('Edit'), 'id="code_blame_mainarea_edit_button"'); + print anchor ("code/bledit/{$project->id}/{$hex_headpath}{$revreq}", $this->lang->line('Edit'), 'id="code_blame_mainarea_edit_button"'); } + + print anchor ("#", "LOC", "id=code_blame_mainarea_loc_button"); + ?> + +
+
+
+ +
+
+ '; + $user_icon_url = codepot_merge_path (site_url(), '/user/icon/' . $this->converter->AsciiToHex($file['last_author'])); + print ""; + print htmlspecialchars ($file['last_author']); + print '
'; + + print ''; + + print ''; ?> - lang->line('Metadata')?> +
+
+ +
+
+ + 0) + { + print '
    '; + foreach ($file['properties'] as $pn => $pv) + { + print '
  • '; + print htmlspecialchars($pn); + if ($pv != '') + { + print ' - '; + print htmlspecialchars($pv); + } + print '
  • '; + } + print '
'; + } + ?> +
@@ -259,7 +322,7 @@ if ($login['settings'] != NULL && $rev_to_show = $rev; $xpar = $this->converter->AsciiTohex ($headpath); - $rev_to_show = anchor ("code/blame/{$project->id}/{$xpar}/{$rev}", $rev_to_show); + $rev_to_show = anchor ("code/blame/{$project->id}/{$hex_headpath}/{$rev}", $rev_to_show); } else { @@ -340,41 +403,15 @@ if ($login['settings'] != NULL && ?> -
-
lang->line('CODE_COMMIT') ?>
-
    -
  • lang->line('CODE_MSG_COMMITTED_BY_ON'), $file['last_author'], $file['time']); ?>
  • -
- - -
lang->line('Message') ?>
-
-
-
- - 0) -{ - print '
'; - print $this->lang->line('CODE_PROPERTIES'); - print '
'; - - print '
    '; - foreach ($file['properties'] as $pn => $pv) - { - print '
  • '; - print htmlspecialchars($pn); - print ' - '; - print htmlspecialchars($pv); - print '
  • '; - } - print '
'; -} -?> - -
- - +
+
LOC
+ id}/{$hex_headpath}{$revreq}"); + print ""; + ?> +
+
diff --git a/codepot/src/codepot/views/code_diff.php b/codepot/src/codepot/views/code_diff.php index d20d4c56..f632feee 100644 --- a/codepot/src/codepot/views/code_diff.php +++ b/codepot/src/codepot/views/code_diff.php @@ -64,38 +64,44 @@ $this->load->view (
-
-converter->AsciiToHex ('.') . $revreq; - } +
- print anchor ( - "code/file/{$project->id}{$revreqroot}", - htmlspecialchars($project->name)); +
+ converter->AsciiToHex ('.') . $revreq; + } - $exps = explode ('/', $headpath); - $expsize = count($exps); - $par = ''; - for ($i = 1; $i < $expsize; $i++) - { - $par .= "/{$exps[$i]}"; + print anchor ( + "code/file/{$project->id}{$revreqroot}", + htmlspecialchars($project->name)); - $xpar = $this->converter->AsciiToHex ($par); - $xpar = "code/file/{$project->id}/{$xpar}{$revreq}"; + $exps = explode ('/', $headpath); + $expsize = count($exps); + $par = ''; + for ($i = 1; $i < $expsize; $i++) + { + $par .= "/{$exps[$i]}"; - print '/'; - print anchor ($xpar, htmlspecialchars($exps[$i])); - } -?> -
+ $xpar = $this->converter->AsciiToHex ($par); + $xpar = "code/file/{$project->id}/{$xpar}{$revreq}"; + + print '/'; + print anchor ($xpar, htmlspecialchars($exps[$i])); + } + ?> +
+ +
+
+