diff --git a/codepot/src/codepot/controllers/project.php b/codepot/src/codepot/controllers/project.php index c24cc195..3c5d5d4f 100644 --- a/codepot/src/codepot/controllers/project.php +++ b/codepot/src/codepot/controllers/project.php @@ -179,7 +179,7 @@ class Project extends Controller } } - function _edit_project ($project, $mode, $login) + private function _edit_project ($project, $mode, $login) { $this->load->helper ('form'); $this->load->library ('form_validation'); @@ -327,7 +327,7 @@ class Project extends Controller } } - function _delete_project ($project, $login) + private function _delete_project ($project, $login) { $this->load->helper ('form'); $this->load->library ('form_validation'); @@ -426,11 +426,19 @@ class Project extends Controller } } - function log ($projectid = '', $offset = 0) + function log ($projectid = '', $userid = '!', $offset = 0) { $this->load->model ('ProjectModel', 'projects'); $login = $this->login->getUser (); + if (CODEPOT_SIGNIN_COMPULSORY && $login['id'] == '') + { + redirect ('main/signin'); + return; + } + + if ($userid == '') $userid = $login['id']; + else $userid = $this->converter->HexToAscii ($userid); $project = $this->projects->get ($projectid); if ($project === FALSE) @@ -451,8 +459,8 @@ class Project extends Controller { $this->load->library ('pagination'); $this->load->model ('LogModel', 'logs'); - - $num_log_entries = $this->logs->getNumEntries ($projectid); + + $num_log_entries = $this->logs->getNumEntries ($projectid, $userid); if ($num_log_entries === FALSE) { $data['login'] = $login; @@ -462,14 +470,15 @@ class Project extends Controller return; } - $pagecfg['base_url'] = site_url() . "/project/log/{$projectid}/"; + $xuserid = $this->converter->AsciiToHex($userid); + $pagecfg['base_url'] = site_url() . "/project/log/{$projectid}/{$xuserid}/"; $pagecfg['total_rows'] = $num_log_entries; $pagecfg['per_page'] = CODEPOT_MAX_LOGS_PER_PAGE; - $pagecfg['uri_segment'] = 4; + $pagecfg['uri_segment'] = 5; $pagecfg['first_link'] = $this->lang->line('First'); $pagecfg['last_link'] = $this->lang->line('Last'); - - $log_entries = $this->logs->getEntries ($offset, $pagecfg['per_page'], $projectid); + + $log_entries = $this->logs->getEntries ($offset, $pagecfg['per_page'], $projectid, $userid); if ($log_entries === FALSE) { $data['login'] = $login; @@ -493,7 +502,7 @@ class Project extends Controller function enjson_catalog ($filter = '', $offset = '') { $this->load->model ('ProjectModel', 'projects'); - + $login = $this->login->getUser (); if (CODEPOT_SIGNIN_COMPULSORY && $login['id'] == '') { diff --git a/codepot/src/codepot/views/log.php b/codepot/src/codepot/views/log.php index b1bdc533..ae95453e 100644 --- a/codepot/src/codepot/views/log.php +++ b/codepot/src/codepot/views/log.php @@ -217,22 +217,40 @@ $this->load->view ( if ($log['action'] == 'revpropchange') { $fmt = $this->lang->line ('MSG_LOG_REVPROP_CHANGE_BY'); - //print htmlspecialchars (sprintf($fmt, $code['propname'], $code['author'])); - printf ( - htmlspecialchars ($fmt), - htmlspecialchars ($code['propname']), - anchor ("/user/log/{$xauthor}", htmlspecialchars ($code['author']))); - //$code['action'] + + if ($pagetype == 'project') + { + printf ( + htmlspecialchars ($fmt), + htmlspecialchars ($code['propname']), + anchor ("/project/log/{$log['projectid']}/{$xauthor}", htmlspecialchars ($code['author']))); + } + else + { + printf ( + htmlspecialchars ($fmt), + htmlspecialchars ($code['propname']), + anchor ("/user/log/{$xauthor}", htmlspecialchars ($code['author']))); + } + } else { $fmt = $this->lang->line ( 'MSG_LOG_'.strtoupper($log['action']).'_BY'); - //print htmlspecialchars (sprintf($fmt, $code['author'])); - printf ( - htmlspecialchars ($fmt), - anchor ("/user/log/{$xauthor}", htmlspecialchars ($code['author']))); + if ($pagetype == 'project') + { + printf ( + htmlspecialchars ($fmt), + anchor ("/project/log/{$log['projectid']}/{$xauthor}", htmlspecialchars ($code['author']))); + } + else + { + printf ( + htmlspecialchars ($fmt), + anchor ("/user/log/{$xauthor}", htmlspecialchars ($code['author']))); + } } print ''; @@ -288,7 +306,10 @@ $this->load->view ( 'MSG_LOG_'.strtoupper($log['action']).'_BY'); $xuserid = $this->converter->AsciiToHex($log['userid']); - printf ($fmt, anchor ("/user/log/{$xuserid}", htmlspecialchars($log['userid']))); + if ($pagetype == 'project') + printf ($fmt, anchor ("/project/log/{$log['projectid']}/{$xuserid}", htmlspecialchars($log['userid']))); + else + printf ($fmt, anchor ("/user/log/{$xuserid}", htmlspecialchars($log['userid']))); print ''; } diff --git a/codepot/src/codepot/views/project_home.php b/codepot/src/codepot/views/project_home.php index 951a06de..922f9ab6 100644 --- a/codepot/src/codepot/views/project_home.php +++ b/codepot/src/codepot/views/project_home.php @@ -66,7 +66,7 @@ function render_wiki() }); $("#project_home_sidebar_log_all_button").button ().click (function () { - $(location).attr ('href', codepot_merge_path("", "/project/log/" + "id; ?>")); + $(location).attr ('href', codepot_merge_path("", "/project/log/" + "id; ?>" + "/" + "converter->AsciiToHex(''); ?>" + "/")); return false; }); }