diff --git a/codepot/src/codepot/controllers/code.php b/codepot/src/codepot/controllers/code.php index f245f672..9bb62274 100644 --- a/codepot/src/codepot/controllers/code.php +++ b/codepot/src/codepot/controllers/code.php @@ -221,7 +221,7 @@ class Code extends Controller } } - function edit ($projectid = '', $path = '', $rev = SVN_REVISION_HEAD) + protected function _edit ($projectid = '', $path = '', $rev = SVN_REVISION_HEAD, $caller = 'file') { $this->load->model ('ProjectModel', 'projects'); $this->load->model ('SubversionModel', 'subversion'); @@ -291,6 +291,7 @@ class Code extends Controller $data['headpath'] = $path; $data['file'] = $file; $data['revision'] = $rev; + $data['caller'] = $caller; $this->load->view ($this->VIEW_EDIT, $data); } @@ -305,6 +306,16 @@ class Code extends Controller } } + function edit ($projectid = '', $path = '', $rev = SVN_REVISION_HEAD) + { + return $this->_edit ($projectid, $path, $rev, 'file'); + } + + function bledit ($projectid = '', $path = '', $rev = SVN_REVISION_HEAD) + { + return $this->_edit ($projectid, $path, $rev, 'blame'); + } + function enjson_save ($projectid = '', $path = '') { $this->load->model ('ProjectModel', 'projects'); diff --git a/codepot/src/codepot/views/code_blame.php b/codepot/src/codepot/views/code_blame.php index 543f23bd..40fc17a5 100644 --- a/codepot/src/codepot/views/code_blame.php +++ b/codepot/src/codepot/views/code_blame.php @@ -51,6 +51,7 @@ $(function () { } }); + $("#code_blame_mainarea_edit_button").button(); prettyPrint (); }); @@ -153,7 +154,8 @@ $xpar = $this->converter->AsciiToHex ($headpath); if ($file['created_rev'] != $file['head_rev']) { - print anchor ("code/blame/{$project->id}/${xpar}", $this->lang->line('Head revision')); + $head_revision_text = ' ' . $this->lang->line('Head revision'); + print anchor ("code/blame/{$project->id}/${xpar}", $head_revision_text); print ' | '; } @@ -190,18 +192,24 @@ print anchor ("code/fetch/{$project->id}/${xpar}{$revreq}", $download_anchor_tex sprintf("%s %s", $this->lang->line('Revision'), $file['created_rev']) ); - if (!empty($file['created_tag'])) - { + if (!empty($file['created_tag'])) + { print ' '; print (''); print htmlspecialchars($file['created_tag']); print (''); - } + } print ' '; print anchor ("code/blame/{$project->id}/${xpar}/{$file['next_rev']}", ''); print ' | '; printf ('%s: %s', $this->lang->line('Size'), $file['size']); + + 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"'); + } ?> lang->line('Metadata')?> diff --git a/codepot/src/codepot/views/code_edit.php b/codepot/src/codepot/views/code_edit.php index 47b02699..61a13bad 100644 --- a/codepot/src/codepot/views/code_edit.php +++ b/codepot/src/codepot/views/code_edit.php @@ -33,7 +33,7 @@ $hex_headpath = $this->converter->AsciiToHex($headpath); ?>