From c31129a21a5604150f0615d185cc0f1ab477d28b Mon Sep 17 00:00:00 2001 From: hyung-hwan Date: Tue, 24 Jun 2014 13:52:05 +0000 Subject: [PATCH] changed how to carry around project members --- codepot/Makefile.am | 2 ++ codepot/codepot.spec.in | 2 ++ codepot/etc/codepot.mysql | 7 ++++--- codepot/src/codepot/controllers/file.php | 4 ++-- codepot/src/codepot/controllers/issue.php | 7 +++---- codepot/src/codepot/controllers/project.php | 8 ++++---- codepot/src/codepot/controllers/site.php | 4 ++-- codepot/src/codepot/controllers/wiki.php | 4 ++-- codepot/src/codepot/language/english/common_lang.php | 1 + .../src/codepot/language/indonesian/common_lang.php | 7 +++---- codepot/src/codepot/language/korean/common_lang.php | 1 + codepot/src/codepot/models/projectmodel.php | 10 ++++++++-- codepot/src/codepot/views/issue_show.php | 3 +-- codepot/src/codepot/views/project_edit.php | 11 ++++++++++- codepot/src/codepot/views/project_home.php | 4 ++-- 15 files changed, 47 insertions(+), 28 deletions(-) diff --git a/codepot/Makefile.am b/codepot/Makefile.am index 1e8cf632..5def2be7 100644 --- a/codepot/Makefile.am +++ b/codepot/Makefile.am @@ -10,10 +10,12 @@ install-data-hook: $(INSTALL) -d "$(DESTDIR)@DEPOTDIR@/svnrepo" $(INSTALL) -d "$(DESTDIR)@DEPOTDIR@/files" $(INSTALL) -d "$(DESTDIR)@DEPOTDIR@/attachments" + $(INSTALL) -d "$(DESTDIR)@DEPOTDIR@/usericons" $(INSTALL) -d "$(DESTDIR)@LOGDIR@" $(INSTALL) -d "$(DESTDIR)@CACHEDIR@" uninstall-hook: + $(RMDIR) "$(DESTDIR)@DEPOTDIR@/usericons" $(RMDIR) "$(DESTDIR)@DEPOTDIR@/attachments" $(RMDIR) "$(DESTDIR)@DEPOTDIR@/files" $(RMDIR) "$(DESTDIR)@DEPOTDIR@/svnrepo" diff --git a/codepot/codepot.spec.in b/codepot/codepot.spec.in index 32042056..8a202e00 100644 --- a/codepot/codepot.spec.in +++ b/codepot/codepot.spec.in @@ -58,11 +58,13 @@ rm -rf $RPM_BUILD_ROOT %attr(-,apache,apache) /var/lib/codepot/svnrepo %attr(-,apache,apache) /var/lib/codepot/files %attr(-,apache,apache) /var/lib/codepot/attachments +%attr(-,apache,apache) /var/lib/codepot/usericons %attr(-,apache,apache) /var/log/codepot %attr(-,apache,apache) /var/cache/codepot %dir /var/lib/codepot/svnrepo %dir /var/lib/codepot/files %dir /var/lib/codepot/attachments +%dir /var/lib/codepot/usericons %dir /var/log/codepot %dir /var/cache/codepot diff --git a/codepot/etc/codepot.mysql b/codepot/etc/codepot.mysql index e94780ec..017c3db6 100644 --- a/codepot/etc/codepot.mysql +++ b/codepot/etc/codepot.mysql @@ -134,7 +134,7 @@ CREATE TABLE file ( UNIQUE KEY (encname), INDEX tagged_file_id (projectid, tag, name), - CONSTRAINT file_projectid FOREIGN KEY (projectid) REFERENCES project(id) + CONSTRAINT file_projectid FOREIGN KEY (projectid) REFERENCES project(id) ON DELETE RESTRICT ON UPDATE CASCADE ) charset=utf8 engine=InnoDB; @@ -151,8 +151,9 @@ CREATE TABLE log ( CREATE TABLE user_settings ( userid VARCHAR(32) PRIMARY KEY, - code_hide_line_num CHAR(1) NOT NULL, - code_hide_details CHAR(1) NOT NULL + code_hide_line_num CHAR(1) NOT NULL, + code_hide_details CHAR(1) NOT NULL, + icon_name VARCHAR(255) UNIQUE NULL ) charset=utf8 engine=InnoDB; CREATE TABLE user ( diff --git a/codepot/src/codepot/controllers/file.php b/codepot/src/codepot/controllers/file.php index e133958d..9f0f4d22 100644 --- a/codepot/src/codepot/controllers/file.php +++ b/codepot/src/codepot/controllers/file.php @@ -384,7 +384,7 @@ class File extends Controller } else { - $data['message'] = "Your input is not complete, Bro"; + $data['message'] = $this->lang->line('MSG_FORM_INPUT_INCOMPLETE'); $data['file'] = $file; $this->load->view ($this->VIEW_EDIT, $data); } @@ -511,7 +511,7 @@ class File extends Controller } else { - $data['message'] = "Your input is not complete, Bro."; + $data['message'] = $this->lang->line('MSG_FORM_INPUT_INCOMPLETE'); $data['file'] = $file; $this->load->view ($this->VIEW_DELETE, $data); } diff --git a/codepot/src/codepot/controllers/issue.php b/codepot/src/codepot/controllers/issue.php index e970137a..c612d43d 100644 --- a/codepot/src/codepot/controllers/issue.php +++ b/codepot/src/codepot/controllers/issue.php @@ -345,7 +345,7 @@ class Issue extends Controller } else { - $data['message'] = "Your input is not complete, Bro"; + $data['message'] = $this->lang->line('MSG_FORM_INPUT_INCOMPLETE'); $data['issue'] = $issue; $this->load->view ($this->VIEW_EDIT, $data); } @@ -381,8 +381,7 @@ class Issue extends Controller $issue->type = $this->issuehelper->TYPE_DEFECT; $issue->status = $this->issuehelper->STATUS_NEW; $issue->priority = $this->issuehelper->PRIORITY_OTHER; - $members = explode (',', $project->members); - $issue->owner = (count($members) > 0)? $members[0]: ''; + $issue->owner = (count($project->members) > 0)? $project->members[0]: ''; $data['issue'] = $issue; $this->load->view ($this->VIEW_EDIT, $data); @@ -474,7 +473,7 @@ class Issue extends Controller } else { - $data['message'] = "Your input is not complete, Bro."; + $data['message'] = $this->lang->line('MSG_FORM_INPUT_INCOMPLETE'); $data['issue'] = $issue; $this->load->view ($this->VIEW_DELETE, $data); } diff --git a/codepot/src/codepot/controllers/project.php b/codepot/src/codepot/controllers/project.php index 12b41a11..6ea95b13 100644 --- a/codepot/src/codepot/controllers/project.php +++ b/codepot/src/codepot/controllers/project.php @@ -199,7 +199,7 @@ class Project extends Controller $project->description = $this->input->post('project_description'); $project->commitable = $this->input->post('project_commitable'); $project->public = $this->input->post('project_public'); - $project->members = $this->input->post('project_members'); + $project->members = explode (',', $this->input->post('project_members')); // validate the form if ($this->form_validation->run()) @@ -224,7 +224,7 @@ class Project extends Controller else { // if not, reload the edit view with an error message - $data['message'] = 'Your input is not complete, Bro.'; + $data['message'] = $this->lang->line('MSG_FORM_INPUT_INCOMPLETE'); $data['project'] = $project; $this->load->view ($this->VIEW_EDIT, $data); } @@ -258,7 +258,7 @@ class Project extends Controller $project->description = ''; $project->commitable = 'Y'; $project->public = 'Y'; - $project->members = $login['id']; + $project->members = array ($login['id']); $this->_edit_project ($project, 'create', $login); } @@ -348,7 +348,7 @@ class Project extends Controller { // the form validation failed. // reload the form with an error message. - $data['message'] = "Your input is not complete, Bro."; + $data['message'] = $this->lang->line('MSG_FORM_INPUT_INCOMPLETE'); $data['project'] = $project; $this->load->view ($this->VIEW_DELETE, $data); } diff --git a/codepot/src/codepot/controllers/site.php b/codepot/src/codepot/controllers/site.php index 7abeab2c..31e93ac9 100644 --- a/codepot/src/codepot/controllers/site.php +++ b/codepot/src/codepot/controllers/site.php @@ -219,7 +219,7 @@ class Site extends Controller else { // if not, reload the edit view with an error message - $data['message'] = 'Your input is not complete, Bro.'; + $data['message'] = $this->lang->line('MSG_FORM_INPUT_INCOMPLETE'); $data['site'] = $site; $this->load->view ($this->VIEW_EDIT, $data); } @@ -341,7 +341,7 @@ class Site extends Controller { // the form validation failed. // reload the form with an error message. - $data['message'] = "Your input is not complete, Bro."; + $data['message'] = $this->lang->line('MSG_FORM_INPUT_INCOMPLETE'); $data['site'] = $site; $this->load->view ($this->VIEW_DELETE, $data); } diff --git a/codepot/src/codepot/controllers/wiki.php b/codepot/src/codepot/controllers/wiki.php index fbd5f807..ba748f7c 100644 --- a/codepot/src/codepot/controllers/wiki.php +++ b/codepot/src/codepot/controllers/wiki.php @@ -454,7 +454,7 @@ class Wiki extends Controller } else { - $data['message'] = "Your input is not complete, Bro"; + $data['message'] = $this->lang->line('MSG_FORM_INPUT_INCOMPLETE'); $data['wiki'] = $wiki; $this->load->view ($this->VIEW_EDIT, $data); } @@ -586,7 +586,7 @@ class Wiki extends Controller } else { - $data['message'] = "Your input is not complete, Bro."; + $data['message'] = $this->lang->line('MSG_FORM_INPUT_INCOMPLETE'); $data['wiki'] = $wiki; $this->load->view ($this->VIEW_DELETE, $data); } diff --git a/codepot/src/codepot/language/english/common_lang.php b/codepot/src/codepot/language/english/common_lang.php index efe82b3d..d7798924 100644 --- a/codepot/src/codepot/language/english/common_lang.php +++ b/codepot/src/codepot/language/english/common_lang.php @@ -104,4 +104,5 @@ $lang['MSG_NO_SUCH_PROJECT'] = 'No such project'; $lang['MSG_SURE_TO_DELETE_THIS'] = "I'm sure to delete this"; $lang['MSG_PROJECT_MEMBERSHIP_REQUIRED'] = 'You have to be a member of the %s project to perform this task'; +$lang['MSG_FORM_INPUT_INCOMPLETE'] = 'Your input is incomplete'; ?> diff --git a/codepot/src/codepot/language/indonesian/common_lang.php b/codepot/src/codepot/language/indonesian/common_lang.php index b587f200..75f8b1bf 100644 --- a/codepot/src/codepot/language/indonesian/common_lang.php +++ b/codepot/src/codepot/language/indonesian/common_lang.php @@ -92,10 +92,9 @@ $lang['MSG_LOG_UPDATE_BY'] = 'Diupdate oleh %s'; $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_FILE'] = 'No such file'; -$lang['MSG_NO_SUCH_ISSUE'] = 'No such issue'; $lang['MSG_NO_SUCH_PROJECT'] = 'No such project'; $lang['MSG_SURE_TO_DELETE_THIS'] = "Saya yakin untuk menghapus"; + +$lang['MSG_PROJECT_MEMBERSHIP_REQUIRED'] = 'You have to be a member of the %s project to perform this task'; +$lang['MSG_FORM_INPUT_INCOMPLETE'] = 'Your input is incomplete'; ?> diff --git a/codepot/src/codepot/language/korean/common_lang.php b/codepot/src/codepot/language/korean/common_lang.php index c6e6ebdb..07bbdfc6 100644 --- a/codepot/src/codepot/language/korean/common_lang.php +++ b/codepot/src/codepot/language/korean/common_lang.php @@ -104,5 +104,6 @@ $lang['MSG_NO_SUCH_PROJECT'] = '프로젝트가 없습니다'; $lang['MSG_SURE_TO_DELETE_THIS'] = '반드시 이것을 삭제하고 싶어요'; $lang['MSG_PROJECT_MEMBERSHIP_REQUIRED'] = '이 작업을 수행하려면 %s 프로젝트의 멤버가 되어야 합니다'; +$lang['MSG_FORM_INPUT_INCOMPLETE'] = '입력이 완전하지 않습니다'; ?> diff --git a/codepot/src/codepot/models/projectmodel.php b/codepot/src/codepot/models/projectmodel.php index 0bce2bf8..7a86e793 100644 --- a/codepot/src/codepot/models/projectmodel.php +++ b/codepot/src/codepot/models/projectmodel.php @@ -34,12 +34,16 @@ class ProjectModel extends Model $this->db->order_by ('priority', 'asc'); $query2 = $this->db->get ('project_membership'); + /* $members = ''; foreach ($query2->result() as $a) { if ($members !== '') $members .= ','; $members .= $a->userid; } + */ + $members = array (); + foreach ($query2->result() as $a) array_push ($members, $a->userid); $result[0]->members = $members; $this->db->trans_complete (); @@ -110,7 +114,8 @@ class ProjectModel extends Model $this->db->where ('projectid', $project->id); $this->db->delete ('project_membership'); - $members = preg_split ('/[[:space:],]+/', $project->members); + //$members = preg_split ('/[[:space:],]+/', $project->members); + $members = $project->members; $member_count = count ($members); $members = array_unique ($members); $priority = 0; @@ -219,7 +224,8 @@ class ProjectModel extends Model $this->db->where ('projectid', $project->id); $this->db->delete ('project_membership'); - $members = preg_split ('/[[:space:],]+/', $project->members); + //$members = preg_split ('/[[:space:],]+/', $project->members); + $members = $project->members; $member_count = count ($members); $members = array_unique ($members); $priority = 0; diff --git a/codepot/src/codepot/views/issue_show.php b/codepot/src/codepot/views/issue_show.php index 91404533..73c22917 100644 --- a/codepot/src/codepot/views/issue_show.php +++ b/codepot/src/codepot/views/issue_show.php @@ -397,10 +397,9 @@ $this->load->view ( ?> members); $owner_array = array (); $found = FALSE; - foreach ($tmp as $t) + foreach ($project->members as $t) { if ($issue->owner == $t) $found = TRUE; $owner_array[$t] = $t; diff --git a/codepot/src/codepot/views/project_edit.php b/codepot/src/codepot/views/project_edit.php index 95fb38a3..76c1f4e9 100644 --- a/codepot/src/codepot/views/project_edit.php +++ b/codepot/src/codepot/views/project_edit.php @@ -137,9 +137,18 @@ $this->load->view (
members; + $member_count = count($members); + $member_string = ''; + for ($i = 0; $i < $member_count; $i++) + { + if ($i >= 1) $member_string .= ','; + $member_string .= $members[$i]; + } + $xdata = array ( 'name' => 'project_members', - 'value' => set_value ('project_members', $project->members), + 'value' => set_value ('project_members', $member_string), 'id' => 'project_edit_mainarea_members', 'rows' => 2, 'cols' => 80 diff --git a/codepot/src/codepot/views/project_home.php b/codepot/src/codepot/views/project_home.php index 42eef3f0..edabb702 100644 --- a/codepot/src/codepot/views/project_home.php +++ b/codepot/src/codepot/views/project_home.php @@ -73,8 +73,8 @@ $this->load->view (
lang->line('Members')?>