diff --git a/codepot/etc/codepot.ini.in b/codepot/etc/codepot.ini.in index 61ff1f23..655fd234 100644 --- a/codepot/etc/codepot.ini.in +++ b/codepot/etc/codepot.ini.in @@ -91,6 +91,11 @@ max_upload_size = "10000" ;------------------------------------------------------------------------------ max_latest_projects = "10" +;------------------------------------------------------------------------------ +; Maximum number of site log entries to show per page +;------------------------------------------------------------------------------ +max_site_logs_per_page = "50" + ;------------------------------------------------------------------------------ ; Maximum number of svn commits to show in the front page ;------------------------------------------------------------------------------ diff --git a/codepot/src/codepot/controllers/project.php b/codepot/src/codepot/controllers/project.php index b0a7e411..cc72dd3d 100644 --- a/codepot/src/codepot/controllers/project.php +++ b/codepot/src/codepot/controllers/project.php @@ -45,7 +45,7 @@ class Project extends Controller else { $svn_commits = $this->logs->getSvnCommits ( - CODEPOT_MAX_SVN_COMMITS_IN_PROJECT, $projectid); + 0, CODEPOT_MAX_SVN_COMMITS_IN_PROJECT, $projectid); if ($svn_commits === FALSE) { $data['message'] = 'DATABASE ERROR'; diff --git a/codepot/src/codepot/controllers/user.php b/codepot/src/codepot/controllers/user.php index 898047b5..31376086 100644 --- a/codepot/src/codepot/controllers/user.php +++ b/codepot/src/codepot/controllers/user.php @@ -5,6 +5,7 @@ class User extends Controller var $VIEW_ERROR = 'error'; var $VIEW_HOME = 'user_home'; var $VIEW_PROJECT_LIST = 'project_list'; + var $VIEW_SITELOG = 'user_sitelog'; function User () { @@ -53,7 +54,7 @@ class User extends Controller return; } - $svn_commits = $this->logs->getSvnCommits (CODEPOT_MAX_SVN_COMMITS); + $svn_commits = $this->logs->getSvnCommits (0, CODEPOT_MAX_SVN_COMMITS); if ($svn_commits === FALSE) { $data['login'] = $login; @@ -71,6 +72,45 @@ class User extends Controller $this->load->view ($this->VIEW_HOME, $data); } + function sitelog ($offset = 0) + { + $login = $this->login->getUser (); + + $this->load->library ('pagination'); + $this->load->model ('LogModel', 'logs'); + + $num_svn_commits = $this->logs->getNumSvnCommits (); + if ($num_svn_commits === FALSE) + { + $data['login'] = $login; + $data['message'] = 'DATABASE ERROR'; + $this->load->view ($this->VIEW_ERROR, $data); + return; + } + + $pagecfg['base_url'] = site_url() . '/user/sitelog/'; + $pagecfg['total_rows'] = $num_svn_commits; + $pagecfg['per_page'] = CODEPOT_MAX_SITE_LOGS_PER_PAGE; + + $svn_commits = $this->logs->getSvnCommits ($offset, $pagecfg['per_page']); + if ($svn_commits === FALSE) + { + $data['login'] = $login; + $data['message'] = 'DATABASE ERROR'; + $this->load->view ($this->VIEW_ERROR, $data); + return; + } + + + $this->pagination->initialize ($pagecfg); + + $data['login'] = $login; + $data['sitelogs'] = $svn_commits; + $data['page_links'] = $this->pagination->create_links (); + + $this->load->view ($this->VIEW_SITELOG, $data); + } + function projectlist () { $login = $this->login->getUser (); diff --git a/codepot/src/codepot/language/english/common_lang.php b/codepot/src/codepot/language/english/common_lang.php index 7faada35..a8423a7d 100644 --- a/codepot/src/codepot/language/english/common_lang.php +++ b/codepot/src/codepot/language/english/common_lang.php @@ -1,6 +1,9 @@ load->database (); } - function getSvnCommits ($limit, $projectid = '') + function getNumSvnCommits ($projectid = '') + { + $this->db->trans_start (); + + $this->db->where ('type', 'svn-commit'); + if ($projectid != '') $this->db->where ('projectid', $projectid); + $num = $this->db->count_all ('log'); + + $this->db->trans_complete (); + if ($this->db->trans_status() === FALSE) return FALSE; + + return $num; + } + + function getSvnCommits ($offset, $limit, $projectid = '') { $this->db->trans_start (); $this->db->where ('type', 'svn-commit'); if ($projectid != '') $this->db->where ('projectid', $projectid); $this->db->order_by ('createdon', 'desc'); - $query = $this->db->get ('log', $limit); + $query = $this->db->get ('log', $limit, $offset); $result = $query->result (); $this->db->trans_complete (); @@ -28,23 +42,27 @@ class LogModel extends Model list($repo,$rev) = split('[,]', $row->message); /* $row->project must be equal to $repo */ - $commits[$count]['repo'] = $row->projectid; - $commits[$count]['rev'] = $rev; + $commits[$count]['time'] = $row->createdon; + $commits[$count]['type'] = $row->type; + $commits[$count]['projectid'] = $row->projectid; + + $commits[$count]['svn_repo'] = $repo; + $commits[$count]['svn_rev'] = $rev; $log = @svn_log ( 'file:///'.CODEPOT_SVNREPO_DIR."/{$repo}", $rev, $rev, 1,SVN_DISCOVER_CHANGED_PATHS); if ($log === FALSE || count($log) < 1) { - $commits[$count]['author'] = ''; - $commits[$count]['message'] = ''; - $commits[$count]['time'] = ''; + $commits[$count]['svn_author'] = ''; + $commits[$count]['svn_message'] = ''; + $commits[$count]['svn_time'] = ''; } else { - $commits[$count]['author'] = $log[0]['author']; - $commits[$count]['message'] = $log[0]['msg']; - $commits[$count]['time'] = $log[0]['date']; + $commits[$count]['svn_author'] = $log[0]['author']; + $commits[$count]['svn_message'] = $log[0]['msg']; + $commits[$count]['svn_time'] = $log[0]['date']; } $count++; diff --git a/codepot/src/codepot/views/Makefile.am b/codepot/src/codepot/views/Makefile.am index a2824961..329e21a8 100644 --- a/codepot/src/codepot/views/Makefile.am +++ b/codepot/src/codepot/views/Makefile.am @@ -23,6 +23,7 @@ www_DATA = \ source_revision.php \ taskbar.php \ user_home.php \ + user_sitelog.php \ wiki_delete.php \ wiki_edit.php \ wiki_home.php \ diff --git a/codepot/src/codepot/views/Makefile.in b/codepot/src/codepot/views/Makefile.in index d7ca1d05..604bb5e0 100644 --- a/codepot/src/codepot/views/Makefile.in +++ b/codepot/src/codepot/views/Makefile.in @@ -186,6 +186,7 @@ www_DATA = \ source_revision.php \ taskbar.php \ user_home.php \ + user_sitelog.php \ wiki_delete.php \ wiki_edit.php \ wiki_home.php \ diff --git a/codepot/src/codepot/views/project_home.php b/codepot/src/codepot/views/project_home.php index 2949823e..ab47f818 100644 --- a/codepot/src/codepot/views/project_home.php +++ b/codepot/src/codepot/views/project_home.php @@ -83,7 +83,9 @@ $this->load->view (
-
lang->line('SVN commits')?>
+
+id}", $this->lang->line('Code changes')) ?> +
converter->AsciiToHex ('.'); @@ -91,23 +93,23 @@ $this->load->view ( { print ''; print ''; print ''; print ''; print ''; print ''; - print ''; print ''; diff --git a/codepot/src/codepot/views/projectbar.php b/codepot/src/codepot/views/projectbar.php index d263b995..e0422a34 100644 --- a/codepot/src/codepot/views/projectbar.php +++ b/codepot/src/codepot/views/projectbar.php @@ -29,7 +29,7 @@ function show_projectbar ($con, $site, $project, $pageid, $ctxmenuitems) $menuitems = array ( array ("project/home/{$project->id}", $con->lang->line('Overview')), array ("wiki/home/{$project->id}", $con->lang->line('Wiki')), - array ("source/home/{$project->id}", $con->lang->line('Source')), + array ("source/home/{$project->id}", $con->lang->line('Code')), array ("file/home/{$project->id}", $con->lang->line('Files')) ); diff --git a/codepot/src/codepot/views/user_home.php b/codepot/src/codepot/views/user_home.php index 024cd97a..752dded1 100644 --- a/codepot/src/codepot/views/user_home.php +++ b/codepot/src/codepot/views/user_home.php @@ -80,7 +80,9 @@ foreach ($latest_projects as $project)
-
lang->line('SVN commits')?>
+
+lang->line('Code changes')) ?> +
'; - print substr($commit['time'], 0, 10); + print substr($commit['svn_time'], 0, 10); print ''; print anchor ( - "/source/revision/{$commit['repo']}/{$xdot}/{$commit['rev']}", - $commit['rev']); + "/source/revision/{$commit['svn_repo']}/{$xdot}/{$commit['svn_rev']}", + $commit['svn_rev']); print ''; - print htmlspecialchars ($commit['author']); + print htmlspecialchars ($commit['svn_author']); print '
'; - $sm = strtok (trim ($commit['message']), "\r\n"); + print ''; + $sm = strtok (trim ($commit['svn_message']), "\r\n"); print htmlspecialchars ($sm); print '
converter->AsciiToHex ('.'); @@ -88,26 +90,26 @@ foreach ($latest_projects as $project) { print ''; print ''; print ''; print ''; print ''; print ''; print ''; print ''; print ''; diff --git a/codepot/src/codepot/views/user_sitelog.php b/codepot/src/codepot/views/user_sitelog.php new file mode 100644 index 00000000..d844b447 --- /dev/null +++ b/codepot/src/codepot/views/user_sitelog.php @@ -0,0 +1,121 @@ + + + + + + + + +lang->line('Home'); + if ($login['id'] != '') $caption .= "({$login['id']})"; +?> +<?=htmlspecialchars($caption)?> + + + + +
+ + + +load->view ('taskbar'); ?> + + + +load->view ( + 'projectbar', + array ( + 'project' => NULL, + 'site' => NULL, + 'pageid' => 'sitelog', + 'ctxmenuitems' => array () + ) +); +?> + + + +
+ +
+lang->line ('Change log') ?> +
+ +
+ +
'; - print substr($commit['time'], 0, 10); + print substr($commit['svn_time'], 0, 10); print ''; print anchor ( - "/source/file/{$commit['repo']}/{$xdot}/{$commit['rev']}", - $commit['repo']); + "/source/file/{$commit['svn_repo']}/{$xdot}/{$commit['svn_rev']}", + $commit['svn_repo']); print ''; print anchor ( - "/source/revision/{$commit['repo']}/{$xdot}/{$commit['rev']}", - $commit['rev']); + "/source/revision/{$commit['svn_repo']}/{$xdot}/{$commit['svn_rev']}", + $commit['svn_rev']); print ''; - print htmlspecialchars ($commit['author']); + print htmlspecialchars ($commit['svn_author']); print '
'; - $sm = strtok (trim ($commit['message']), "\r\n"); + $sm = strtok (trim ($commit['svn_message']), "\r\n"); print htmlspecialchars ($sm); print '
+converter->AsciiToHex ('.'); + + $rowclasses = array ('odd', 'even'); + $rowcount = 0; + + foreach ($sitelogs as $sitelog) + { + // TODO: use time... and inspect type then may use svn_time. + $date = substr($sitelog['svn_time'], 0, 10); + $time = substr($sitelog['svn_time'], 11, 5); + if ($curdate != $date) + { + print ""; + print ""; + $curdate = $date; + $rowcount = 0; + } + + print ""; + $rowcount++; + print ''; + + print ''; + + print ''; + print ''; + } +?> + + +
 
$date
' . $time . ''; + print anchor ( + "/source/file/{$sitelog['projectid']}/{$xdot}/{$sitelog['svn_rev']}", + $sitelog['projectid']); + print ''; + + if ($sitelog['type'] == 'svn-commit') + { + print ''; + print anchor ( + "/source/revision/{$sitelog['projectid']}/{$xdot}/{$sitelog['svn_rev']}", + "r{$sitelog['svn_rev']}"); + print ' committed by '; + print htmlspecialchars ($sitelog['svn_author']); + print ''; + + print '
';
+			print htmlspecialchars ($sitelog['svn_message']);
+			print '
'; + /* + print '
'; + print ''; + $sm = htmlspecialchars ($sitelog['svn_message']); + print str_replace (array ("\r\n", "\n", "\r"), '
', $sm); + print '
'; + */ + } + + print '
+ +
+ + + +load->view ('footer'); ?> + + + + + diff --git a/codepot/src/config.php.in b/codepot/src/config.php.in index ddc45c3a..4ef55cb7 100644 --- a/codepot/src/config.php.in +++ b/codepot/src/config.php.in @@ -28,9 +28,11 @@ function load_ini ($file) array ('login_model', 'string', 'LdapLoginModel'), array ('sysadmin_userids', 'string', ''), array ('max_upload_size', 'string', '10000'), // kbytes + array ('max_latest_projects', 'integer', 10), + array ('max_site_logs_per_page', 'integer', 50), + array ('max_svn_commits', 'integer', 10), array ('max_svn_commits_in_project', 'integer', 5), - array ('max_latest_projects', 'integer', 10), array ('database_username', 'string', ''), array ('database_password', 'string', ''), diff --git a/codepot/src/css/common.css b/codepot/src/css/common.css index 4771bf64..7b154b3b 100644 --- a/codepot/src/css/common.css +++ b/codepot/src/css/common.css @@ -316,9 +316,7 @@ pre.prettyprint .nocode a:hover { .content .sidebar { font-size: 0.9em; float: right; - width: 20em; - //padding: 5px; - //margin-right: 2px; + width: 22em; } .content .sidebar .box { diff --git a/codepot/src/css/project.css b/codepot/src/css/project.css index 931109cc..330a224c 100644 --- a/codepot/src/css/project.css +++ b/codepot/src/css/project.css @@ -10,35 +10,100 @@ } #user_home_mainarea_sidebar_svn_commits_table { - margin: 0; - padding: 0; + border-collapse: collapse; } #user_home_mainarea_sidebar_svn_commits_table tr.odd { background-color: #bbccef; } +#user_home_mainarea_sidebar_svn_commits_table tr.odd td { + width: 1px; + white-space: nowrap; +} + #user_home_mainarea_sidebar_svn_commits_table tr.even { background-color: inherit; + font-size: 0.9em; + font-style: italic; +} + +/*----------------------------------------------- + * user sidelog view + *-----------------------------------------------*/ +#user_sitelog_mainarea_result { + overflow: auto; +} + +#user_sitelog_mainarea_result_table { + border-collapse: collapse; +} + +#user_sitelog_mainarea_result_table a { + text-decoration: none; +} + +#user_sitelog_mainarea_result_table td { + vertical-align: top; + white-space: nowrap; +} + +#user_sitelog_mainarea_result_table td.break { + font-size: 0.5em; +} + +#user_sitelog_mainarea_result_table td.date { + font-weight: bold; + background-color: #bbccef; +} + +#user_sitelog_mainarea_result_table td.time { + width: 1px; + color: #777777; +} + +#user_sitelog_mainarea_result_table td.details { + white-space: normal; +} + +#user_sitelog_mainarea_result_table td.details .description { + font-style: italic; +} + +#user_sitelog_mainarea_result_table td.details pre.message { + border: 0; + margin: 1px; + background-color: inherit; + white-space: pre-wrap; +} + +#user_sitelog_mainarea_result_table td.pages { + padding-top: 1em; + text-align: center; + font-weight: bold; } /*----------------------------------------------- * project home view *-----------------------------------------------*/ #project_home_mainarea_sidebar_svn_commits_table { - margin: 0; - padding: 0; + border-collapse: collapse; } #project_home_mainarea_sidebar_svn_commits_table tr.odd { background-color: #bbccef; } -#project_home_mainarea_sidebar_svn_commits_table tr.even { - background-color: inherit; +#project_home_mainarea_sidebar_svn_commits_table tr.odd td { + width: 1px; + white-space: nowrap; } - +#project_home_mainarea_sidebar_svn_commits_table tr.even { + background-color: inherit; + //font-size: 0.9em; + font-style: italic; +} /*----------------------------------------------- * project file home view