diff --git a/codepot/src/codepot/controllers/Makefile.am b/codepot/src/codepot/controllers/Makefile.am index 10fc19e1..0c4fb50a 100644 --- a/codepot/src/codepot/controllers/Makefile.am +++ b/codepot/src/codepot/controllers/Makefile.am @@ -3,6 +3,7 @@ www_DATA = \ api.php \ code.php \ file.php \ + graph.php \ index.html \ issue.php \ main.php \ diff --git a/codepot/src/codepot/controllers/Makefile.in b/codepot/src/codepot/controllers/Makefile.in index 81c7bd29..789a2ea5 100644 --- a/codepot/src/codepot/controllers/Makefile.in +++ b/codepot/src/codepot/controllers/Makefile.in @@ -198,6 +198,7 @@ www_DATA = \ api.php \ code.php \ file.php \ + graph.php \ index.html \ issue.php \ main.php \ diff --git a/codepot/src/codepot/controllers/code.php b/codepot/src/codepot/controllers/code.php index 598cc308..b7a7f7d3 100644 --- a/codepot/src/codepot/controllers/code.php +++ b/codepot/src/codepot/controllers/code.php @@ -49,7 +49,7 @@ class Code extends Controller { $data['message'] = 'DATABASE ERROR'; $this->load->view ($this->VIEW_ERROR, $data); - } + } else if ($project === NULL) { $data['message'] = diff --git a/codepot/src/codepot/controllers/graph.php b/codepot/src/codepot/controllers/graph.php new file mode 100644 index 00000000..828acc52 --- /dev/null +++ b/codepot/src/codepot/controllers/graph.php @@ -0,0 +1,115 @@ +load->helper ('url'); + $this->load->helper ('form'); + $this->load->library ('Converter', 'converter'); + $this->load->model (CODEPOT_LOGIN_MODEL, 'login'); + + $this->load->library ('Language', 'lang'); + $this->lang->load ('common', CODEPOT_LANG); + $this->lang->load ('code', CODEPOT_LANG); + } + + function home ($projectid = '') + { + return $this->main ($projectid); + } + + function _normalize_path ($path) + { + $path = preg_replace('/[\/]+/', '/', $path); + if ($path == '/') $path = ''; + return $path; + } + + function main ($projectid = '') + { + $this->load->model ('ProjectModel', 'projects'); + $this->load->model ('SubversionModel', 'subversion'); + + $login = $this->login->getUser (); + if (CODEPOT_SIGNIN_COMPULSORY && $login['id'] == '') + redirect ("main/signin/" . $this->converter->AsciiTohex(current_url())); + $data['login'] = $login; + + //$path = $this->converter->HexToAscii ($path); + //if ($path == '.') $path = ''; /* treat a period specially */ + //$path = $this->_normalize_path ($path); + + $project = $this->projects->get ($projectid); + if ($project === FALSE) + { + $data['message'] = 'DATABASE ERROR'; + $this->load->view ($this->VIEW_ERROR, $data); + } + else if ($project === NULL) + { + $data['message'] = + $this->lang->line('MSG_NO_SUCH_PROJECT') . + " - {$projectid}"; + $this->load->view ($this->VIEW_ERROR, $data); + } + else + { + if ($project->public !== 'Y' && $login['id'] == '') + { + // non-public projects require sign-in. + redirect ("main/signin/" . $this->converter->AsciiTohex(current_url())); + } + + $data['project'] = $project; + $this->load->view ($this->VIEW_MAIN, $data); + } + } + + function history_json ($projectid = '', $path = '', $rev = SVN_REVISION_HEAD) + { + $this->load->model ('ProjectModel', 'projects'); + + $login = $this->login->getUser (); + if (CODEPOT_SIGNIN_COMPULSORY && $login['id'] == '') + { + header($_SERVER['SERVER_PROTOCOL'].' 404 Not Found'); + return; + } + + $project = $this->projects->get ($projectid); + if ($project === FALSE || ($project->public !== 'Y' && $login['id'] == '')) + { + header($_SERVER['SERVER_PROTOCOL'].' 404 Not Found'); + return; + } + + $this->load->model ('SubversionModel', 'subversion'); + + $path = $this->converter->HexToAscii ($path); + if ($path == '.') $path = ''; /* treat a period specially */ + $path = $this->_normalize_path ($path); + + $file = $this->subversion->getHistory ($projectid, $path, SVN_REVISION_HEAD); + if ($file === FALSE) + { + $history = array(); + } + else + { + $history = $file['history']; + $count = count($history); + for ($i = 0; $i < $count; $i++) + { + unset ($history[$i]['msg']); + unset ($history[$i]['paths']); + } + } + + print codepot_json_encode ($history); + } +} diff --git a/codepot/src/codepot/language/english/common_lang.php b/codepot/src/codepot/language/english/common_lang.php index 2e9b4d98..37fd38f8 100644 --- a/codepot/src/codepot/language/english/common_lang.php +++ b/codepot/src/codepot/language/english/common_lang.php @@ -31,6 +31,8 @@ $lang['Files'] = 'Files'; $lang['First'] = 'First'; $lang['Folder'] = 'Folder'; $lang['Full Difference'] = 'FullDiff'; +$lang['Graph'] = 'Graph'; +$lang['Graphs'] = 'Graphs'; $lang['Head revision'] = 'Head revision'; $lang['Hide details'] = 'Hide details'; $lang['History'] = 'History'; diff --git a/codepot/src/codepot/language/indonesian/common_lang.php b/codepot/src/codepot/language/indonesian/common_lang.php index c8922e09..385d9190 100644 --- a/codepot/src/codepot/language/indonesian/common_lang.php +++ b/codepot/src/codepot/language/indonesian/common_lang.php @@ -29,6 +29,8 @@ $lang['Files'] = 'File'; $lang['First'] = 'Pertama'; $lang['Folder'] = 'Folder'; $lang['Full Difference'] = 'FullDiff'; +$lang['Graph'] = 'Graph'; +$lang['Graphs'] = 'Graphs'; $lang['Head revision'] = 'Kepala revisi'; $lang['History'] = 'Sejarah'; $lang['Home'] = 'Beranda'; diff --git a/codepot/src/codepot/language/korean/common_lang.php b/codepot/src/codepot/language/korean/common_lang.php index 1cfbd9aa..bc7fb962 100644 --- a/codepot/src/codepot/language/korean/common_lang.php +++ b/codepot/src/codepot/language/korean/common_lang.php @@ -31,6 +31,8 @@ $lang['Files'] = '파일'; $lang['First'] = '처음'; $lang['Folder'] = '폴더'; $lang['Full Difference'] = '전체차이'; +$lang['Graph'] = '그래프'; +$lang['Graphs'] = '그래프'; $lang['Head revision'] = '최신리비전'; $lang['Hide details'] = '상세내역숨김'; $lang['History'] = '변경기록'; diff --git a/codepot/src/codepot/views/Makefile.am b/codepot/src/codepot/views/Makefile.am index 588c7da8..b112d08a 100644 --- a/codepot/src/codepot/views/Makefile.am +++ b/codepot/src/codepot/views/Makefile.am @@ -13,6 +13,7 @@ www_DATA = \ file_home.php \ file_show.php \ footer.php \ + graph_main.php \ index.html \ issue_delete.php \ issue_edit.php \ diff --git a/codepot/src/codepot/views/Makefile.in b/codepot/src/codepot/views/Makefile.in index 73e722e1..1625f9d5 100644 --- a/codepot/src/codepot/views/Makefile.in +++ b/codepot/src/codepot/views/Makefile.in @@ -208,6 +208,7 @@ www_DATA = \ file_home.php \ file_show.php \ footer.php \ + graph_main.php \ index.html \ issue_delete.php \ issue_edit.php \ diff --git a/codepot/src/codepot/views/graph_main.php b/codepot/src/codepot/views/graph_main.php new file mode 100644 index 00000000..db04f329 --- /dev/null +++ b/codepot/src/codepot/views/graph_main.php @@ -0,0 +1,408 @@ + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + +