diff --git a/codepot/src/codepot/controllers/file.php b/codepot/src/codepot/controllers/file.php index fa53121d..aff5b85c 100644 --- a/codepot/src/codepot/controllers/file.php +++ b/codepot/src/codepot/controllers/file.php @@ -38,7 +38,9 @@ class File extends Controller } else if ($project === NULL) { - $data['message'] = "NO SUCH PROJECT - $projectid"; + $data['message'] = + $this->lang->line('MSG_NO_SUCH_PROJECT') . + " - {$projectid}"; $this->load->view ($this->VIEW_ERROR, $data); } else @@ -78,7 +80,9 @@ class File extends Controller } else if ($project === NULL) { - $data['message'] = "NO SUCH PROJECT - $projectid"; + $data['message'] = + $this->lang->line('MSG_NO_SUCH_PROJECT') . + " - {$projectid}"; $this->load->view ($this->VIEW_ERROR, $data); } else @@ -123,7 +127,9 @@ class File extends Controller } else if ($project === NULL) { - $data['message'] = "NO SUCH PROJECT - $projectid"; + $data['message'] = + $this->lang->line('MSG_NO_SUCH_PROJECT') . + " - {$projectid}"; $this->load->view ($this->VIEW_ERROR, $data); } else @@ -178,7 +184,9 @@ class File extends Controller } else if ($project === NULL) { - $data['message'] = "NO SUCH PROJECT - $projectid"; + $data['message'] = + $this->lang->line('MSG_NO_SUCH_PROJECT') . + " - {$projectid}"; $this->load->view ($this->VIEW_ERROR, $data); } else if (!$login['sysadmin?'] && @@ -369,7 +377,9 @@ class File extends Controller } else if ($project === NULL) { - $data['message'] = "NO SUCH PROJECT - $projectid"; + $data['message'] = + $this->lang->line('MSG_NO_SUCH_PROJECT') . + " - {$projectid}"; $this->load->view ($this->VIEW_ERROR, $data); } else if (!$login['sysadmin?'] && diff --git a/codepot/src/codepot/controllers/project.php b/codepot/src/codepot/controllers/project.php index 465f6601..b40a11fc 100644 --- a/codepot/src/codepot/controllers/project.php +++ b/codepot/src/codepot/controllers/project.php @@ -39,7 +39,9 @@ class Project extends Controller } else if ($project === NULL) { - $data['message'] = "NO SUCH PROJECT - $projectid"; + $data['message'] = + $this->lang->line('MSG_NO_SUCH_PROJECT') . + " - {$projectid}"; $this->load->view ($this->VIEW_ERROR, $data); } else @@ -173,7 +175,9 @@ class Project extends Controller else if ($project === NULL) { $data['login'] = $login; - $data['message'] = "NO SUCH PROJECT - $projectid"; + $data['message'] = + $this->lang->line('MSG_NO_SUCH_PROJECT') . + " - {$projectid}"; $this->load->view ($this->VIEW_ERROR, $data); } else if (!$login['sysadmin?'] && @@ -265,7 +269,9 @@ class Project extends Controller else if ($project === NULL) { $data['login'] = $login; - $data['message'] = "NO SUCH PROJECT - $projectid"; + $data['message'] = + $this->lang->line('MSG_NO_SUCH_PROJECT') . + " - {$projectid}"; $this->load->view ($this->VIEW_ERROR, $data); } else if (!$login['sysadmin?'] && diff --git a/codepot/src/codepot/controllers/site.php b/codepot/src/codepot/controllers/site.php index c5700d6d..01597f64 100644 --- a/codepot/src/codepot/controllers/site.php +++ b/codepot/src/codepot/controllers/site.php @@ -132,7 +132,7 @@ class Site extends Controller else if ($site === NULL) { $data['login'] = $login; - $data['message'] = "NO SUCH PROJECT - $siteid"; + $data['message'] = "NO SUCH SITE - $siteid"; $this->load->view ($this->VIEW_ERROR, $data); } else if (!$login['sysadmin?']) @@ -224,7 +224,7 @@ class Site extends Controller else if ($site === NULL) { $data['login'] = $login; - $data['message'] = "NO SUCH PROJECT - $siteid"; + $data['message'] = "NO SUCH SITE - $siteid"; $this->load->view ($this->VIEW_ERROR, $data); } else if (!$login['sysadmin?']) diff --git a/codepot/src/codepot/controllers/source.php b/codepot/src/codepot/controllers/source.php index 386095ca..9f124495 100644 --- a/codepot/src/codepot/controllers/source.php +++ b/codepot/src/codepot/controllers/source.php @@ -48,7 +48,9 @@ class Source extends Controller } else if ($project === NULL) { - $data['message'] = "NO SUCH PROJECT - $projectid"; + $data['message'] = + $this->lang->line('MSG_NO_SUCH_PROJECT') . + " - {$projectid}"; $this->load->view ($this->VIEW_ERROR, $data); } else @@ -120,7 +122,9 @@ class Source extends Controller } else if ($project === NULL) { - $data['message'] = "NO SUCH PROJECT - $projectid"; + $data['message'] = + $this->lang->line('MSG_NO_SUCH_PROJECT') . + " - {$projectid}"; $this->load->view ($this->VIEW_ERROR, $data); } else @@ -179,7 +183,9 @@ class Source extends Controller } else if ($project === NULL) { - $data['message'] = "NO SUCH PROJECT - $projectid"; + $data['message'] = + $this->lang->line('MSG_NO_SUCH_PROJECT') . + " - {$projectid}"; $this->load->view ($this->VIEW_ERROR, $data); } else @@ -228,7 +234,9 @@ class Source extends Controller } else if ($project === NULL) { - $data['message'] = "NO SUCH PROJECT - $projectid"; + $data['message'] = + $this->lang->line('MSG_NO_SUCH_PROJECT') . + " - {$projectid}"; $this->load->view ($this->VIEW_ERROR, $data); } else @@ -276,7 +284,9 @@ class Source extends Controller } else if ($project === NULL) { - $data['message'] = "NO SUCH PROJECT - $projectid"; + $data['message'] = + $this->lang->line('MSG_NO_SUCH_PROJECT') . + " - {$projectid}"; $this->load->view ($this->VIEW_ERROR, $data); } else diff --git a/codepot/src/codepot/controllers/wiki.php b/codepot/src/codepot/controllers/wiki.php index 5672fe50..f90d2783 100644 --- a/codepot/src/codepot/controllers/wiki.php +++ b/codepot/src/codepot/controllers/wiki.php @@ -40,7 +40,9 @@ class Wiki extends Controller } else if ($project === NULL) { - $data['message'] = "NO SUCH PROJECT - $projectid"; + $data['message'] = + $this->lang->line('MSG_NO_SUCH_PROJECT') . + " - {$projectid}"; $this->load->view ($this->VIEW_ERROR, $data); } else @@ -80,21 +82,36 @@ class Wiki extends Controller } else if ($project === NULL) { - $data['message'] = "NO SUCH PROJECT - $projectid"; + $data['message'] = + $this->lang->line('MSG_NO_SUCH_PROJECT') . + " - {$projectid}"; $this->load->view ($this->VIEW_ERROR, $data); } else { if ($name == '__PROJECT_HOME__') { - redirect ('project/home/' . $projectid); + redirect ("project/home/{$projectid}"); } else if ($name == '__WIKI_HOME__') { - redirect ('wiki/home/' . $projectid . '/' . $name); + redirect ("wiki/home/{$projectid}"); } else { + $ex = explode (':', $name); + if (count($ex) == 2) + { + if ($ex[0] == '__PROJECT_HOME__') + { + redirect ("project/home/{$ex[1]}"); + } + else if ($ex[0] == '__WIKI_HOME__') + { + redirect ("wiki/home/{$ex[1]}"); + } + } + $wiki = $this->wikis->get ($login['id'], $project, $name); if ($wiki === FALSE) { @@ -103,7 +120,7 @@ class Wiki extends Controller } else if ($wiki === NULL) { - redirect ('wiki/create/'. $projectid . '/' . + redirect ("wiki/create/{$projectid}/" . $this->converter->AsciiToHex($name)); } else @@ -137,7 +154,9 @@ class Wiki extends Controller } else if ($project === NULL) { - $data['message'] = "NO SUCH PROJECT - $projectid"; + $data['message'] = + $this->lang->line('MSG_NO_SUCH_PROJECT') . + " - {$projectid}"; $this->load->view ($this->VIEW_ERROR, $data); } else if (!$login['sysadmin?'] && @@ -263,7 +282,9 @@ class Wiki extends Controller } else if ($project === NULL) { - $data['message'] = "NO SUCH PROJECT - $projectid"; + $data['message'] = + $this->lang->line('MSG_NO_SUCH_PROJECT') . + " - {$projectid}"; $this->load->view ($this->VIEW_ERROR, $data); } else if (!$login['sysadmin?'] && diff --git a/codepot/src/codepot/language/english/common_lang.php b/codepot/src/codepot/language/english/common_lang.php index a8423a7d..99125380 100644 --- a/codepot/src/codepot/language/english/common_lang.php +++ b/codepot/src/codepot/language/english/common_lang.php @@ -54,9 +54,16 @@ $lang['Username'] = 'Username'; $lang['Wiki'] = 'Wiki'; $lang['Wikis'] = 'Wikis'; + +$lang['MSG_LOG_COMMIT_BY'] = 'committed by %s'; +$lang['MSG_LOG_CREATE_BY'] = 'created by %s'; +$lang['MSG_LOG_DELETE_BY'] = 'deleted by %s'; +$lang['MSG_LOG_UPDATE_BY'] = 'updated by %s'; + $lang['MSG_NO_DIFF'] = 'No difference found'; $lang['MSG_NO_FILES_AVAIL'] = 'No files available'; -$lang['MSG_NO_SOURCE_AVAIL'] = 'No source available'; +$lang['MSG_NO_SOURCE_CODE_AVAIL'] = 'No source code available'; +$lang['MSG_NO_SUCH_PROJECT'] = 'No such project'; $lang['MSG_NO_WIKIS_AVAIL'] = 'No wiki pages available'; $lang['MSG_SURE_TO_DELETE_THIS'] = "I'm sure to delete this"; ?> diff --git a/codepot/src/codepot/language/indonesian/common_lang.php b/codepot/src/codepot/language/indonesian/common_lang.php index 88f9e39f..6e8020e9 100644 --- a/codepot/src/codepot/language/indonesian/common_lang.php +++ b/codepot/src/codepot/language/indonesian/common_lang.php @@ -54,9 +54,15 @@ $lang['Username'] = 'Nama pemakai'; $lang['Wiki'] = 'Wiki'; $lang['Wikis'] = 'Wiki'; +$lang['MSG_LOG_COMMIT_BY'] = 'committed by %s'; +$lang['MSG_LOG_CREATE_BY'] = 'created by %s'; +$lang['MSG_LOG_DELETE_BY'] = 'deleted by %s'; +$lang['MSG_LOG_UPDATE_BY'] = 'updated by %s'; + $lang['MSG_NO_DIFF'] = 'Tidak ada bedanya'; $lang['MSG_NO_FILES_AVAIL'] = 'Tidak ada file tersedia'; -$lang['MSG_NO_SOURCE_AVAIL'] = 'Tidak ada sumber tersedia'; +$lang['MSG_NO_SOURCE_CODE_AVAIL'] = 'Tidak ada kode sumber tersedia'; +$lang['MSG_NO_SUCH_PROJECT'] = 'No such project'; $lang['MSG_NO_WIKIS_AVAIL'] = 'Tidak ada halaman wiki tersedia'; $lang['MSG_SURE_TO_DELETE_THIS'] = "Saya yakin untuk menghapus"; ?> diff --git a/codepot/src/codepot/language/korean/common_lang.php b/codepot/src/codepot/language/korean/common_lang.php index 2dcc7cb6..07aa7f46 100644 --- a/codepot/src/codepot/language/korean/common_lang.php +++ b/codepot/src/codepot/language/korean/common_lang.php @@ -54,9 +54,15 @@ $lang['Username'] = '사용자명'; $lang['Wiki'] = '위키'; $lang['Wikis'] = '위키'; +$lang['MSG_LOG_COMMIT_BY'] = '%s에 의해 커밋되었습니다'; +$lang['MSG_LOG_CREATE_BY'] = '%s에 의해 생성되었습니다'; +$lang['MSG_LOG_DELETE_BY'] = '%s에 의해 삭제되었습니다'; +$lang['MSG_LOG_UPDATE_BY'] = '%s에 의해 갱신되었습니다'; + $lang['MSG_NO_DIFF'] = '차이점이 없습니다'; $lang['MSG_NO_FILES_AVAIL'] = '사용가능한 파일이 없습니다'; -$lang['MSG_NO_SOURCE_AVAIL'] = '사용가능한 소스가 없습니다'; +$lang['MSG_NO_SOURCE_CODE_AVAIL'] = '사용가능한 소스코드가 없습니다'; +$lang['MSG_NO_SUCH_PROJECT'] = '프로젝트가 없습니다'; $lang['MSG_NO_WIKIS_AVAIL'] = '사용가능한 위키페이지가 없습니다'; $lang['MSG_SURE_TO_DELETE_THIS'] = '반드시 이것을 삭제하고 싶어요'; ?> diff --git a/codepot/src/codepot/models/filemodel.php b/codepot/src/codepot/models/filemodel.php index 7a79e43b..f9864a18 100644 --- a/codepot/src/codepot/models/filemodel.php +++ b/codepot/src/codepot/models/filemodel.php @@ -47,8 +47,16 @@ class FileModel extends Model $this->db->set ('createdby', $userid); $this->db->set ('updatedon', date('Y-m-d H:i:s')); $this->db->set ('updatedby', $userid); - $this->db->insert ('file'); + + $this->db->set ('createdon', date('Y-m-d H:i:s')); + $this->db->set ('type', 'file'); + $this->db->set ('action', 'create'); + $this->db->set ('projectid', $file->projectid); + $this->db->set ('userid', $userid); + $this->db->set ('message', $file->name); + $this->db->insert ('log'); + $this->db->trans_complete (); return $this->db->trans_status(); } @@ -63,8 +71,16 @@ class FileModel extends Model $this->db->set ('description', $file->description); $this->db->set ('updatedon', date('Y-m-d H:i:s')); $this->db->set ('updatedby', $userid); - $this->db->update ('file'); + + $this->db->set ('createdon', date('Y-m-d H:i:s')); + $this->db->set ('type', 'file'); + $this->db->set ('action', 'update'); + $this->db->set ('projectid', $file->projectid); + $this->db->set ('userid', $userid); + $this->db->set ('message', $file->name); + $this->db->insert ('log'); + $this->db->trans_complete (); return $this->db->trans_status(); } @@ -94,6 +110,14 @@ class FileModel extends Model $this->db->where ('projectid', $file->projectid); $this->db->where ('name', $file->name); $this->db->delete ('file'); + + $this->db->set ('createdon', date('Y-m-d H:i:s')); + $this->db->set ('type', 'file'); + $this->db->set ('action', 'delete'); + $this->db->set ('projectid', $file->projectid); + $this->db->set ('userid', $userid); + $this->db->set ('message', $file->name); + $this->db->insert ('log'); if ($this->db->trans_status() === FALSE) { diff --git a/codepot/src/codepot/models/logmodel.php b/codepot/src/codepot/models/logmodel.php index 3f4e9021..0bd67532 100644 --- a/codepot/src/codepot/models/logmodel.php +++ b/codepot/src/codepot/models/logmodel.php @@ -41,7 +41,6 @@ class LogModel extends Model $commits = array (); foreach ($result as $row) { - list($type,$repo,$rev) = split('[,]', $row->message); /* $row->project must be equal to $repo */ $commits[$count]['createdon'] = $row->createdon; @@ -50,27 +49,36 @@ class LogModel extends Model $commits[$count]['projectid'] = $row->projectid; $commits[$count]['userid'] = $row->userid; - $tmp['type'] = $type; - $tmp['repo'] = $repo; - $tmp['rev'] = $rev; - - $log = @svn_log ( - 'file:///'.CODEPOT_SVNREPO_DIR."/{$repo}", - $rev, $rev, 1,SVN_DISCOVER_CHANGED_PATHS); - if ($log === FALSE || count($log) < 1) + if ($row->type == 'code') { - $tmp['time'] = ''; - $tmp['author'] = ''; - $tmp['message'] = ''; + list($type,$repo,$rev) = split('[,]', $row->message); + $tmp['type'] = $type; + $tmp['repo'] = $repo; + $tmp['rev'] = $rev; + + $log = @svn_log ( + 'file:///'.CODEPOT_SVNREPO_DIR."/{$repo}", + $rev, $rev, 1,SVN_DISCOVER_CHANGED_PATHS); + if ($log === FALSE || count($log) < 1) + { + $tmp['time'] = ''; + $tmp['author'] = ''; + $tmp['message'] = ''; + } + else + { + $tmp['time'] = $log[0]['date']; + $tmp['author'] = $log[0]['author']; + $tmp['message'] = $log[0]['msg']; + } + + $commits[$count]['message'] = $tmp; } else { - $tmp['time'] = $log[0]['date']; - $tmp['author'] = $log[0]['author']; - $tmp['message'] = $log[0]['msg']; + $commits[$count]['message'] = $row->message; } - - $commits[$count][$row->type.'-'.$row->action] = $tmp; + $count++; } diff --git a/codepot/src/codepot/models/projectmodel.php b/codepot/src/codepot/models/projectmodel.php index de550adc..e22ab9c6 100644 --- a/codepot/src/codepot/models/projectmodel.php +++ b/codepot/src/codepot/models/projectmodel.php @@ -78,6 +78,14 @@ class ProjectModel extends Model $this->db->insert ('project_membership'); } + $this->db->set ('createdon', date('Y-m-d H:i:s')); + $this->db->set ('type', 'project'); + $this->db->set ('action', 'create'); + $this->db->set ('projectid', $project->id); + $this->db->set ('userid', $userid); + $this->db->set ('message', $project->name); + $this->db->insert ('log'); + if ($priority <= 0 || $this->db->trans_status() === FALSE) { $this->db->trans_rollback (); @@ -140,6 +148,14 @@ class ProjectModel extends Model $this->db->insert ('project_membership'); } + $this->db->set ('createdon', date('Y-m-d H:i:s')); + $this->db->set ('type', 'project'); + $this->db->set ('action', 'update'); + $this->db->set ('projectid', $project->id); + $this->db->set ('userid', $userid); + $this->db->set ('message', $project->name); + $this->db->insert ('log'); + if ($priority <= 0 || $this->db->trans_status() === FALSE) { $this->db->trans_rollback (); @@ -160,6 +176,14 @@ class ProjectModel extends Model $this->db->where ('id', $project->id); $this->db->delete ('project'); + $this->db->set ('createdon', date('Y-m-d H:i:s')); + $this->db->set ('type', 'project'); + $this->db->set ('action', 'delete'); + $this->db->set ('projectid', $project->id); + $this->db->set ('userid', $userid); + $this->db->set ('message', $project->name); + $this->db->insert ('log'); + if ($this->db->trans_status() === FALSE) { $this->db->trans_rollback (); diff --git a/codepot/src/codepot/models/wikimodel.php b/codepot/src/codepot/models/wikimodel.php index 40354352..50787959 100644 --- a/codepot/src/codepot/models/wikimodel.php +++ b/codepot/src/codepot/models/wikimodel.php @@ -45,6 +45,15 @@ class WikiModel extends Model $this->db->set ('createdby', $userid); $this->db->set ('updatedby', $userid); $this->db->insert ('wiki'); + + $this->db->set ('createdon', date('Y-m-d H:i:s')); + $this->db->set ('type', 'wiki'); + $this->db->set ('action', 'create'); + $this->db->set ('projectid', $wiki->projectid); + $this->db->set ('userid', $userid); + $this->db->set ('message', $wiki->name); + $this->db->insert ('log'); + $this->db->trans_complete (); return $this->db->trans_status(); } @@ -59,6 +68,15 @@ class WikiModel extends Model $this->db->set ('updatedon', date('Y-m-d H:i:s')); $this->db->set ('updatedby', $userid); $this->db->update ('wiki'); + + $this->db->set ('createdon', date('Y-m-d H:i:s')); + $this->db->set ('type', 'wiki'); + $this->db->set ('action', 'update'); + $this->db->set ('projectid', $wiki->projectid); + $this->db->set ('userid', $userid); + $this->db->set ('message', $wiki->name); + $this->db->insert ('log'); + $this->db->trans_complete (); return $this->db->trans_status(); } @@ -70,6 +88,15 @@ class WikiModel extends Model $this->db->where ('projectid', $wiki->projectid); $this->db->where ('name', $wiki->name); $this->db->delete ('wiki'); + + $this->db->set ('createdon', date('Y-m-d H:i:s')); + $this->db->set ('type', 'wiki'); + $this->db->set ('action', 'delete'); + $this->db->set ('projectid', $wiki->projectid); + $this->db->set ('userid', $userid); + $this->db->set ('message', $wiki->name); + + $this->db->insert ('log'); $this->db->trans_complete (); return $this->db->trans_status(); } diff --git a/codepot/src/codepot/views/project_home.php b/codepot/src/codepot/views/project_home.php index d0dfb8c5..ef8d5c3b 100644 --- a/codepot/src/codepot/views/project_home.php +++ b/codepot/src/codepot/views/project_home.php @@ -91,32 +91,80 @@ $this->load->view ( $xdot = $this->converter->AsciiToHex ('.'); foreach ($log_entries as $log) { - if ($log['type'] == 'code' && $log['action'] == 'commit') + if ($log['type'] == 'code') { - $x = $log['code-commit']; + $x = $log['message']; print '