diff --git a/codepot/etc/codepot.sql b/codepot/etc/codepot.sql index e01ea4b6..e5c03548 100644 --- a/codepot/etc/codepot.sql +++ b/codepot/etc/codepot.sql @@ -52,12 +52,12 @@ CREATE TABLE wiki ( CREATE TABLE issue ( projectid VARCHAR(32) NOT NULL, -# id BIGINT NOT NULL AUTO_INCREMENT, id BIGINT NOT NULL, summary VARCHAR(255) NOT NULL, type VARCHAR(32) NOT NULL, status VARCHAR(32) NOT NULL, - assignedto VARCHAR(255) NOT NULL, + owner VARCHAR(255) NOT NULL, + priority VARCHAR(32) NOT NULL, description TEXT NOT NULL, createdon DATETIME, @@ -66,7 +66,8 @@ CREATE TABLE issue ( updatedby VARCHAR(32), PRIMARY KEY (projectid, id), - UNIQUE KEY issue_id (projectid, summary), + KEY issue_status_type_summary (projectid, status, type, summary), + KEY issue_summary (projectid, summary), CONSTRAINT issue_projectid FOREIGN KEY (projectid) REFERENCES project(id) ON DELETE RESTRICT ON UPDATE CASCADE diff --git a/codepot/src/codepot/config/database.php b/codepot/src/codepot/config/database.php index 9d612daa..cab8e01b 100644 --- a/codepot/src/codepot/config/database.php +++ b/codepot/src/codepot/config/database.php @@ -44,7 +44,8 @@ $db['default']['database'] = CODEPOT_DATABASE_NAME; $db['default']['dbdriver'] = CODEPOT_DATABASE_DRIVER; $db['default']['dbprefix'] = CODEPOT_DATABASE_PREFIX; $db['default']['pconnect'] = FALSE; -$db['default']['db_debug'] = FALSE; +//$db['default']['db_debug'] = FALSE; +$db['default']['db_debug'] = TRUE; $db['default']['cache_on'] = FALSE; $db['default']['cachedir'] = ""; $db['default']['char_set'] = "utf8"; diff --git a/codepot/src/codepot/controllers/issue.php b/codepot/src/codepot/controllers/issue.php index 2676cf6b..a37d74b7 100644 --- a/codepot/src/codepot/controllers/issue.php +++ b/codepot/src/codepot/controllers/issue.php @@ -62,7 +62,7 @@ class Issue extends Controller } } - function _show_issue ($projectid, $name, $create) + function show ($projectid = '', $id = '') { $this->load->model ('ProjectModel', 'projects'); $this->load->model ('IssueModel', 'issues'); @@ -72,14 +72,14 @@ class Issue extends Controller redirect ('main/signin'); $data['login'] = $login; - if ($name == '') + if ($id == '') { $data['message'] = 'INVALID PARAMETERS'; $this->load->view ($this->VIEW_ERROR, $data); return; } - $name = $this->converter->HexToAscii ($name); + $id = $this->converter->HexToAscii ($id); $project = $this->projects->get ($projectid); if ($project === FALSE) @@ -96,7 +96,7 @@ class Issue extends Controller } else { - $issue = $this->issues->get ($login['id'], $project, $name); + $issue = $this->issues->get ($login['id'], $project, $id); if ($issue === FALSE) { $data['message'] = 'DATABASE ERROR'; @@ -104,18 +104,10 @@ class Issue extends Controller } else if ($issue === NULL) { - if ($create) - { - redirect ("issue/create/{$projectid}/". - $this->converter->AsciiToHex($name)); - } - else - { - $data['message'] = - $this->lang->line('MSG_NO_SUCH_ISSUE') . - " - {$name}"; - $this->load->view ($this->VIEW_ERROR, $data); - } + $data['message'] = + $this->lang->line('MSG_NO_SUCH_ISSUE') . + " - {$id}"; + $this->load->view ($this->VIEW_ERROR, $data); } else { @@ -126,17 +118,7 @@ class Issue extends Controller } } - function show ($projectid = '' , $name = '') - { - $this->_show_issue ($projectid, $name, TRUE); - } - - function show_r ($projectid = '' , $name = '') - { - $this->_show_issue ($projectid, $name, FALSE); - } - - function _edit_issue ($projectid, $name, $mode) + function _edit_issue ($projectid, $id, $mode) { $this->load->helper ('form'); $this->load->library ('form_validation'); @@ -147,7 +129,7 @@ class Issue extends Controller if ($login['id'] == '') redirect ('main'); $data['login'] = $login; - $name = $this->converter->HexToAscii ($name); + $id = $this->converter->HexToAscii ($id); $project = $this->projects->get ($projectid); if ($project === FALSE) @@ -173,9 +155,17 @@ class Issue extends Controller $this->form_validation->set_rules ( 'issue_projectid', 'project ID', 'required|alpha_dash|max_length[32]'); $this->form_validation->set_rules ( - 'issue_name', 'name', 'required|max_length[255]'); + 'issue_summary', 'summary', 'required|max_length[255]'); $this->form_validation->set_rules ( - 'issue_text', 'text', 'required'); + 'issue_status', 'status', 'required'); + $this->form_validation->set_rules ( + 'issue_type', 'type', 'required'); + $this->form_validation->set_rules ( + 'issue_priority', 'priority', 'required'); + $this->form_validation->set_rules ( + 'issue_owner', 'owner', 'required'); + $this->form_validation->set_rules ( + 'issue_description', 'description', 'required'); $this->form_validation->set_error_delimiters ( '',''); @@ -186,15 +176,20 @@ class Issue extends Controller if ($this->input->post('issue')) { $issue->projectid = $this->input->post('issue_projectid'); - $issue->name = $this->input->post('issue_name'); - $issue->text = $this->input->post('issue_text'); + $issue->id = $this->input->post('issue_id'); + $issue->summary = $this->input->post('issue_summary'); + $issue->description = $this->input->post('issue_description'); + $issue->type = $this->input->post('issue_type'); + $issue->status = $this->input->post('issue_status'); + $issue->priority = $this->input->post('issue_priority'); + $issue->owner = $this->input->post('issue_owner'); if ($this->form_validation->run()) { - $result = ($mode == 'update')? + $id = ($mode == 'update')? $this->issues->update ($login['id'], $issue): $this->issues->create ($login['id'], $issue); - if ($result === FALSE) + if ($id === FALSE) { $data['message'] = 'DATABASE ERROR'; $data['issue'] = $issue; @@ -202,8 +197,8 @@ class Issue extends Controller } else { - redirect ('issue/show/' . $project->id . '/' . - $this->converter->AsciiToHex($issue->name)); + redirect ("issue/show/{$project->id}/" . + $this->converter->AsciiToHex((string)$id)); } } else @@ -217,7 +212,7 @@ class Issue extends Controller { if ($mode == 'update') { - $issue = $this->issues->get ($login['id'], $project, $name); + $issue = $this->issues->get ($login['id'], $project, $id); if ($issue === FALSE) { $data['message'] = 'DATABASE ERROR'; @@ -227,7 +222,7 @@ class Issue extends Controller { $data['message'] = $this->lang->line('MSG_NO_SUCH_ISSUE') . - " - {$name}"; + " - {$id}"; $this->load->view ($this->VIEW_ERROR, $data); } else @@ -239,8 +234,13 @@ class Issue extends Controller else { $issue->projectid = $projectid; - $issue->name = $name; - $issue->text = ''; + $issue->id = $id; + $issue->summary = ''; + $issue->type = ''; + $issue->status = ''; + $issue->owner = ''; + $issue->priority = ''; + $issue->description = ''; $data['issue'] = $issue; $this->load->view ($this->VIEW_EDIT, $data); @@ -250,17 +250,17 @@ class Issue extends Controller } } - function create ($projectid = '', $name = '') + function create ($projectid = '', $id = '') { - return $this->_edit_issue ($projectid, $name, 'create'); + return $this->_edit_issue ($projectid, $id, 'create'); } - function update ($projectid = '', $name = '') + function update ($projectid = '', $id = '') { - return $this->_edit_issue ($projectid, $name, 'update'); + return $this->_edit_issue ($projectid, $id, 'update'); } - function delete ($projectid = '', $name = '') + function delete ($projectid = '', $id = '') { $this->load->helper ('form'); $this->load->library ('form_validation'); @@ -271,7 +271,7 @@ class Issue extends Controller if ($login['id'] == '') redirect ('main'); $data['login'] = $login; - $name = $this->converter->HexToAscii ($name); + $id = $this->converter->HexToAscii ($id); $project = $this->projects->get ($projectid); if ($project === FALSE) @@ -303,7 +303,7 @@ class Issue extends Controller if($this->input->post('issue')) { $issue->projectid = $this->input->post('issue_projectid'); - $issue->name = $this->input->post('issue_name'); + $issue->id = $this->input->post('issue_id'); $data['issue_confirm'] = $this->input->post('issue_confirm'); if ($this->form_validation->run()) @@ -325,7 +325,7 @@ class Issue extends Controller else { redirect ("issue/show/{$project->id}/" . - $this->converter->AsciiToHex($issue->name)); + $this->converter->AsciiToHex($issue->id)); } } else @@ -337,7 +337,7 @@ class Issue extends Controller } else { - $issue = $this->issues->get ($login['id'], $project, $name); + $issue = $this->issues->get ($login['id'], $project, $id); if ($issue === FALSE) { $data['message'] = 'DATABASE ERROR'; @@ -347,7 +347,7 @@ class Issue extends Controller { $data['message'] = $this->lang->line('MSG_NO_SUCH_ISSUE') . - " - {$name}"; + " - {$id}"; $this->load->view ($this->VIEW_ERROR, $data); } else diff --git a/codepot/src/codepot/language/english/common_lang.php b/codepot/src/codepot/language/english/common_lang.php index ccfa1ec3..44753702 100644 --- a/codepot/src/codepot/language/english/common_lang.php +++ b/codepot/src/codepot/language/english/common_lang.php @@ -39,8 +39,10 @@ $lang['Last updated on'] = 'Last updated on'; $lang['Latest projects'] = 'Latest projects'; $lang['Other projects'] = 'Other projects'; $lang['Overview'] = 'Overview'; +$lang['Owner'] = 'Owner'; $lang['Password'] = 'Password'; $lang['Path'] = 'Path'; +$lang['Priority'] = 'Priority'; $lang['Project'] = 'Project'; $lang['Projects'] = 'Projects'; $lang['Repository'] = 'Repository'; @@ -49,11 +51,13 @@ $lang['Sign in'] = 'Sign in'; $lang['Sign out'] = 'Sign out'; $lang['Size'] = 'Size'; $lang['Source'] = 'Source'; +$lang['Status'] = 'Status'; $lang['Summary'] = 'Summary'; $lang['System'] = 'System'; $lang['Tag'] = 'Tag'; $lang['Text'] = 'Text'; $lang['Time'] = 'Time'; +$lang['Type'] = 'Type'; $lang['Update'] = 'Update'; $lang['Username'] = 'Username'; $lang['Wiki'] = 'Wiki'; @@ -69,6 +73,7 @@ $lang['MSG_NO_DIFF'] = 'No difference found'; $lang['MSG_NO_CODE_AVAIL'] = 'No source code available'; $lang['MSG_NO_FILES_AVAIL'] = 'No files available'; $lang['MSG_NO_ISSUES_AVAIL'] = 'No outstanding issues'; +$lang['MSG_NO_SUCH_ISSUE'] = 'No such issue'; $lang['MSG_NO_SUCH_PROJECT'] = 'No such project'; $lang['MSG_NO_SUCH_WIKI_PAGE'] = 'No such wiki page'; $lang['MSG_NO_WIKIS_AVAIL'] = 'No wiki pages available'; diff --git a/codepot/src/codepot/language/indonesian/common_lang.php b/codepot/src/codepot/language/indonesian/common_lang.php index 7cdb095c..65401686 100644 --- a/codepot/src/codepot/language/indonesian/common_lang.php +++ b/codepot/src/codepot/language/indonesian/common_lang.php @@ -39,8 +39,10 @@ $lang['Last updated on'] = 'Waktu memperbaharui terakhir'; $lang['Latest projects'] = 'Proyek terakhir'; $lang['Other projects'] = 'Proyek lain'; $lang['Overview'] = 'Ringkasan'; +$lang['Owner'] = 'Owner'; $lang['Password'] = 'Kata sandi'; $lang['Path'] = 'Path'; +$lang['Priority'] = 'Pirority'; $lang['Project'] = 'Proyek'; $lang['Projects'] = 'Proyek'; $lang['Repository'] = 'Repository'; @@ -49,11 +51,13 @@ $lang['Sign in'] = 'Masuk'; $lang['Sign out'] = 'Keluar'; $lang['Size'] = 'Ukuran'; $lang['Source'] = 'Sumber'; +$lang['Status'] = 'Status'; $lang['Summary'] = 'Rangkuman'; $lang['System'] = 'Sistem'; $lang['Tag'] = 'Label'; $lang['Text'] = 'Teks'; $lang['Time'] = 'Waktu'; +$lang['Type'] = 'Type'; $lang['Update'] = 'Memperbaharui'; $lang['Username'] = 'Nama pemakai'; $lang['Wiki'] = 'Wiki'; @@ -68,6 +72,7 @@ $lang['MSG_NO_DIFF'] = 'Tidak ada bedanya'; $lang['MSG_NO_CODE_AVAIL'] = 'Tidak ada kode sumber tersedia'; $lang['MSG_NO_FILES_AVAIL'] = 'Tidak ada file tersedia'; $lang['MSG_NO_ISSUES_AVAIL'] = 'Tidak ada issue'; +$lang['MSG_NO_SUCH_ISSUE'] = 'No such issue'; $lang['MSG_NO_SUCH_PROJECT'] = 'No such project'; $lang['MSG_NO_SUCH_WIKI_PAGE'] = 'No such wiki page'; $lang['MSG_NO_WIKIS_AVAIL'] = 'Tidak ada halaman wiki tersedia'; diff --git a/codepot/src/codepot/language/korean/common_lang.php b/codepot/src/codepot/language/korean/common_lang.php index 77b63f80..9cd187af 100644 --- a/codepot/src/codepot/language/korean/common_lang.php +++ b/codepot/src/codepot/language/korean/common_lang.php @@ -39,8 +39,10 @@ $lang['Last updated on'] = '최종수정시간'; $lang['Latest projects'] = '최근 프로젝트'; $lang['Other projects'] = '다른 프로젝트'; $lang['Overview'] = '개요'; +$lang['Owner'] = '소유자'; $lang['Password'] = '패스워드'; $lang['Path'] = '경로'; +$lang['Priority'] = '중요도'; $lang['Project'] = '프로젝트'; $lang['Projects'] = '프로젝트'; $lang['Repository'] = '저장소'; @@ -48,12 +50,14 @@ $lang['Revision'] = '리비전'; $lang['Sign in'] = '로그인'; $lang['Sign out'] = '로그아웃'; $lang['Size'] = '크기'; +$lang['Status'] = '상태'; $lang['Source'] = '소스'; $lang['Summary'] = '요약'; $lang['System'] = '시스템'; $lang['Tag'] = '태그'; $lang['Text'] = '본문'; $lang['Time'] = '시간'; +$lang['Type'] = '종류'; $lang['Update'] = '수정'; $lang['Username'] = '사용자명'; $lang['Wiki'] = '위키'; @@ -68,6 +72,7 @@ $lang['MSG_NO_DIFF'] = '차이점이 없습니다'; $lang['MSG_NO_CODE_AVAIL'] = '소스코드가 없습니다'; $lang['MSG_NO_FILES_AVAIL'] = '파일이 없습니다'; $lang['MSG_NO_ISSUES_AVAIL'] = '이슈항목이 없습니다'; +$lang['MSG_NO_SUCH_ISSUE'] = '이슈항목이 없습니다'; $lang['MSG_NO_SUCH_PROJECT'] = '프로젝트가 없습니다'; $lang['MSG_NO_SUCH_WIKI_PAGE'] = '위키페이지가 없습니다'; $lang['MSG_NO_WIKIS_AVAIL'] = '사용가능한 위키페이지가 없습니다'; diff --git a/codepot/src/codepot/models/issuemodel.php b/codepot/src/codepot/models/issuemodel.php index d75e7a83..052068c6 100644 --- a/codepot/src/codepot/models/issuemodel.php +++ b/codepot/src/codepot/models/issuemodel.php @@ -37,12 +37,23 @@ class IssueModel extends Model { // TODO: check if userid can do this.. $this->db->trans_start (); + + $this->db->where ('projectid', $issue->projectid); + $this->db->select ('MAX(id) as maxid'); + $query = $this->db->get ('issue'); + $result = $query->result(); + $maxid = (empty($result) || $result[0] == NULL)? 0: $result[0]->maxid; + + $newid = $maxid + 1; + $this->db->set ('projectid', $issue->projectid); + $this->db->set ('id', $newid); $this->db->set ('summary', $issue->summary); $this->db->set ('type', $issue->type); $this->db->set ('status', $issue->status); + $this->db->set ('owner', $issue->owner); + $this->db->set ('priority', $issue->priority); $this->db->set ('description', $issue->description); - $this->db->set ('assignedto', $issue->assignedto); $this->db->set ('createdon', date('Y-m-d H:i:s')); $this->db->set ('updatedon', date('Y-m-d H:i:s')); $this->db->set ('createdby', $userid); @@ -54,12 +65,13 @@ class IssueModel extends Model $this->db->set ('action', 'create'); $this->db->set ('projectid', $issue->projectid); $this->db->set ('userid', $userid); - //$this->db->set ('message', 'LAST_INSERT_ID()'); - $this->db->set ('message', 'CONVERT(LAST_INSERT_ID(),CHAR)'); + $this->db->set ('message', $newid); $this->db->insert ('log'); $this->db->trans_complete (); - return $this->db->trans_status(); + if ($this->db->trans_status() === FALSE) return FALSE; + + return $newid; } function update ($userid, $issue) @@ -72,7 +84,8 @@ class IssueModel extends Model $this->db->set ('type', $issue->type); $this->db->set ('status', $issue->status); $this->db->set ('description', $issue->description); - $this->db->set ('assignedto', $issue->assignedto); + $this->db->set ('owner', $issue->owner); + $this->db->set ('priority', $issue->priority); $this->db->set ('updatedon', date('Y-m-d H:i:s')); $this->db->set ('updatedby', $userid); $this->db->update ('issue'); @@ -86,7 +99,9 @@ class IssueModel extends Model $this->db->insert ('log'); $this->db->trans_complete (); - return $this->db->trans_status(); + if ($this->db->trans_status() === FALSE) return FALSE; + + return $issue->id; } function delete ($userid, $issue) diff --git a/codepot/src/codepot/views/Makefile.am b/codepot/src/codepot/views/Makefile.am index 705696cc..a18b003f 100644 --- a/codepot/src/codepot/views/Makefile.am +++ b/codepot/src/codepot/views/Makefile.am @@ -13,8 +13,10 @@ www_DATA = \ file_show.php \ footer.php \ index.html \ + issue_delete.php \ issue_edit.php \ issue_home.php \ + issue_show.php \ log.php \ login.php \ project_delete.php \ diff --git a/codepot/src/codepot/views/Makefile.in b/codepot/src/codepot/views/Makefile.in index 4036304e..ed66e5da 100644 --- a/codepot/src/codepot/views/Makefile.in +++ b/codepot/src/codepot/views/Makefile.in @@ -176,8 +176,10 @@ www_DATA = \ file_show.php \ footer.php \ index.html \ + issue_delete.php \ issue_edit.php \ issue_home.php \ + issue_show.php \ log.php \ login.php \ project_delete.php \ diff --git a/codepot/src/codepot/views/error.php b/codepot/src/codepot/views/error.php index d8d5fc8d..944776e8 100644 --- a/codepot/src/codepot/views/error.php +++ b/codepot/src/codepot/views/error.php @@ -20,11 +20,14 @@ load->view ( 'projectbar', array ( - 'site' => NULL, - 'project' => NULL, + 'site' => $site, + 'project' => $project, 'pageid' => '', 'ctxmenuitems' => array () ) diff --git a/codepot/src/codepot/views/issue_delete.php b/codepot/src/codepot/views/issue_delete.php new file mode 100644 index 00000000..39143392 --- /dev/null +++ b/codepot/src/codepot/views/issue_delete.php @@ -0,0 +1,72 @@ + + +
+ + + ++description); ?> ++