From c703d151d1669ee942ed1caef072f7184277d21a Mon Sep 17 00:00:00 2001 From: hyung-hwan Date: Tue, 13 Dec 2016 05:43:05 +0000 Subject: [PATCH] added the user_summary column to the user_settings page --- codepot/README | 1 + codepot/etc/codepot.mysql | 3 +- codepot/etc/codepot.oracle | 3 +- codepot/etc/codepot.pgsql | 3 +- codepot/src/codepot/controllers/user.php | 38 +++++++++++++-- .../codepot/language/english/common_lang.php | 1 + .../language/indonesian/common_lang.php | 1 + .../codepot/language/korean/common_lang.php | 1 + codepot/src/codepot/models/usermodel.php | 2 + codepot/src/codepot/views/project_home.php | 48 +++++++++++++++++++ codepot/src/codepot/views/projectbar.php | 4 +- codepot/src/codepot/views/user_home.php | 7 +-- codepot/src/codepot/views/user_settings.php | 13 +++-- 13 files changed, 106 insertions(+), 19 deletions(-) diff --git a/codepot/README b/codepot/README index 811c83de..93949846 100644 --- a/codepot/README +++ b/codepot/README @@ -27,6 +27,7 @@ UPGRADING FROM 0.2.0 mysql> ALTER TABLE issue_change ADD COLUMN(createdon datetime not null, createdby varchar(32) not null); mysql> UPDATE issue_change SET createdby=updatedby, createdon=updatedon; mysql> create the issue_coderev table according to the definition found in codepot.mysql + mysql> ALTER TABLE user_settings ADD COLUMN(user_summary VARCHAR(255) NULL); INSTALLATION ON CENTOS diff --git a/codepot/etc/codepot.mysql b/codepot/etc/codepot.mysql index 9db9beee..fc831e8a 100644 --- a/codepot/etc/codepot.mysql +++ b/codepot/etc/codepot.mysql @@ -265,7 +265,8 @@ CREATE TABLE user_settings ( userid VARCHAR(32) PRIMARY KEY, code_hide_line_num CHAR(1) NOT NULL, code_hide_metadata CHAR(1) NOT NULL, - icon_name VARCHAR(255) UNIQUE NULL + icon_name VARCHAR(255) UNIQUE NULL, + user_summary VARCHAR(255) NULL ) charset=utf8 engine=InnoDB; CREATE TABLE user_account ( diff --git a/codepot/etc/codepot.oracle b/codepot/etc/codepot.oracle index f8a09d35..bb1b242d 100644 --- a/codepot/etc/codepot.oracle +++ b/codepot/etc/codepot.oracle @@ -237,7 +237,8 @@ CREATE TABLE "cpot_user_settings" ( "userid" VARCHAR(32) PRIMARY KEY, "code_hide_line_num" CHAR(1) NOT NULL, "code_hide_metadata" CHAR(1) NOT NULL, - "icon_name" VARCHAR(255) UNIQUE NULL + "icon_name" VARCHAR(255) UNIQUE NULL, + "user_summary" VARCHAR(255) NULL ); CREATE TABLE "cpot_user_account" ( diff --git a/codepot/etc/codepot.pgsql b/codepot/etc/codepot.pgsql index a5dbbc42..388a5b46 100644 --- a/codepot/etc/codepot.pgsql +++ b/codepot/etc/codepot.pgsql @@ -282,7 +282,8 @@ CREATE TABLE user_settings ( userid VARCHAR(32) PRIMARY KEY, code_hide_line_num CHAR(1) NOT NULL, code_hide_metadata CHAR(1) NOT NULL, - icon_name VARCHAR(255) UNIQUE NULL + icon_name VARCHAR(255) UNIQUE NULL, + user_summary VARCHAR(255) NULL ); CREATE TABLE user_account ( diff --git a/codepot/src/codepot/controllers/user.php b/codepot/src/codepot/controllers/user.php index 7f44c13a..ff787a4d 100644 --- a/codepot/src/codepot/controllers/user.php +++ b/codepot/src/codepot/controllers/user.php @@ -49,6 +49,14 @@ class User extends Controller $this->load->model ('ProjectModel', 'projects'); $this->load->model ('IssueModel', 'issues'); + $this->load->model ('UserModel', 'users'); + + $user = new stdClass(); + $user->id = $userid; + $user->xid = $this->converter->AsciiToHex($user->id); + $user->summary = ''; + $settings = $this->users->fetchSettings ($user->id); + if ($settings !== FALSE) $user->summary = $settings->user_summary; $projects = $this->projects->getMyProjects ($userid); @@ -64,7 +72,7 @@ class User extends Controller { $data['login'] = $login; $data['projects'] = $projects; - $data['target_userid'] = $userid; + $data['user'] = $user; $data['issues'] = $issues; $data['issue_type_array'] = $this->issuehelper->_get_type_array($this->lang); $data['issue_status_array'] = $this->issuehelper->_get_status_array($this->lang); @@ -91,10 +99,14 @@ class User extends Controller } $this->load->model ('ProjectModel', 'projects'); + $this->load->model ('UserModel', 'users'); $user = new stdClass(); $user->id = $userid; - $user->xid = $this->converter->AsciiToHex($userid); + $user->xid = $this->converter->AsciiToHex($user->id); + $user->summary = ''; + $settings = $this->users->fetchSettings ($user->id); + if ($settings !== FALSE) $user->summary = $settings->user_summary; $myprojs = $this->projects->getMyProjects ($user->id); if ($myprojs === FALSE) @@ -174,6 +186,13 @@ class User extends Controller $data['login'] = $login; $data['message'] = ''; + $user = new stdClass(); + $user->id = $login['id']; + $user->xid = $this->converter->AsciiToHex($user->id); + $user->summary = ''; + $settings = $this->users->fetchSettings ($user->id); + if ($settings !== FALSE) $user->summary = $settings->user_summary; + $icon_fname = FALSE; $uploaded_fname = FALSE; @@ -186,8 +205,9 @@ class User extends Controller if (strpos ($fname, ':') !== FALSE) { $data['message'] = $this->lang->line ('FILE_MSG_NAME_NO_COLON'); - $data['file'] = $file; - $this->load->view ($this->VIEW_EDIT, $data); + $data['settings'] = $settings; + $data['user'] = $user; + $this->load->view ($this->VIEW_SETTINGS, $data); return; } @@ -216,7 +236,6 @@ class User extends Controller } } - // // make sure that these field also exist in the database // also change the sanity check in LoginModel/getUser() @@ -224,6 +243,7 @@ class User extends Controller // $settings->code_hide_line_num = $this->input->post('code_hide_line_num'); $settings->code_hide_metadata = $this->input->post('code_hide_metadata'); + $settings->user_summary = $this->input->post('user_summary'); /* $uploaded_fname will be renamed to this name in users->storeSettings() */ $settings->icon_name = $icon_fname; @@ -233,14 +253,20 @@ class User extends Controller @unlink (CODEPOT_USERICON_DIR . '/' . $uploaded_fname); $data['message'] = 'DATABASE ERROR'; $data['settings'] = $settings; + $data['user'] = $user; $this->load->view ($this->VIEW_SETTINGS, $data); } else { $this->login->setUserSettings ($settings); + // force change user->summary when the new settings has + // been saved successfully. + $user->summary = $settings->user_summary; + $data['message'] = 'SETTINGS STORED SUCCESSFULLY'; $data['settings'] = $settings; + $data['user'] = $user; $this->load->view ($this->VIEW_SETTINGS, $data); } } @@ -254,9 +280,11 @@ class User extends Controller $settings->code_hide_line_num = ' '; $settings->code_hide_metadata = ' '; $settings->icon_name = ''; + $settings->user_summary = ''; } $data['settings'] = $settings; + $data['user'] = $user; $this->load->view ($this->VIEW_SETTINGS, $data); } } diff --git a/codepot/src/codepot/language/english/common_lang.php b/codepot/src/codepot/language/english/common_lang.php index 5d614f00..41364eea 100644 --- a/codepot/src/codepot/language/english/common_lang.php +++ b/codepot/src/codepot/language/english/common_lang.php @@ -73,6 +73,7 @@ $lang['New'] = 'New'; $lang['New directory'] = 'New directory'; $lang['New file'] = 'New file'; $lang['OK'] = 'OK'; +$lang['Oneliner about me'] = 'Oneliner about me'; $lang['Open issues'] = 'Open issues'; $lang['Other projects'] = 'Other projects'; $lang['Overview'] = 'Overview'; diff --git a/codepot/src/codepot/language/indonesian/common_lang.php b/codepot/src/codepot/language/indonesian/common_lang.php index 8f768b10..79882865 100644 --- a/codepot/src/codepot/language/indonesian/common_lang.php +++ b/codepot/src/codepot/language/indonesian/common_lang.php @@ -73,6 +73,7 @@ $lang['New'] = 'Baru'; $lang['New directory'] = 'Direktori baru'; $lang['New file'] = 'File baru'; $lang['OK'] = 'OK'; +$lang['Oneliner about me'] = 'Oneliner about me'; $lang['Open issues'] = 'Open issues'; $lang['Other projects'] = 'Proyek lain'; $lang['Overview'] = 'Ringkasan'; diff --git a/codepot/src/codepot/language/korean/common_lang.php b/codepot/src/codepot/language/korean/common_lang.php index 1a557cd2..fcf3be0b 100644 --- a/codepot/src/codepot/language/korean/common_lang.php +++ b/codepot/src/codepot/language/korean/common_lang.php @@ -73,6 +73,7 @@ $lang['New'] = '신규'; $lang['New directory'] = 'New directory'; $lang['New file'] = 'New file'; $lang['OK'] = '확인'; +$lang['Oneliner about me'] = '짧은 인사말'; $lang['Open issues'] = '미처리이슈'; $lang['Other projects'] = '다른 프로젝트'; $lang['Overview'] = '개요'; diff --git a/codepot/src/codepot/models/usermodel.php b/codepot/src/codepot/models/usermodel.php index f7900f01..043e4c7f 100644 --- a/codepot/src/codepot/models/usermodel.php +++ b/codepot/src/codepot/models/usermodel.php @@ -55,6 +55,7 @@ class UserModel extends Model $this->db->set ('code_hide_line_num', (string)$settings->code_hide_line_num); $this->db->set ('code_hide_metadata', (string)$settings->code_hide_metadata); if ($icon_name_set) $this->db->set ('icon_name', (string)$settings->icon_name); + $this->db->set ('user_summary', (string)$settings->user_summary); $this->db->insert ('user_settings'); } else @@ -63,6 +64,7 @@ class UserModel extends Model $this->db->set ('code_hide_line_num', (string)$settings->code_hide_line_num); $this->db->set ('code_hide_metadata', (string)$settings->code_hide_metadata); if ($icon_name_set) $this->db->set ('icon_name', (string)$settings->icon_name); + $this->db->set ('user_summary', (string)$settings->user_summary); $this->db->update ('user_settings'); } diff --git a/codepot/src/codepot/views/project_home.php b/codepot/src/codepot/views/project_home.php index 922f9ab6..d17c0d26 100644 --- a/codepot/src/codepot/views/project_home.php +++ b/codepot/src/codepot/views/project_home.php @@ -350,6 +350,54 @@ foreach ($urls as $url) + +
+
+ members as $m) $tmpmemb[$m] = $m; + print form_dropdown ( + 'project_home_new_owner', + $tmpmemb, + set_value('project_home_new_owner', (in_array($login['id'], $project->members)? $login['id']: '')), + 'id="project_home_new_owner"' + ); + ?> + + '/> +
+ +
+ + +
+ + +
+ lang->line('Attachments'); ?> + +
+
+
+
+
+
+
+ + +
+ diff --git a/codepot/src/codepot/views/projectbar.php b/codepot/src/codepot/views/projectbar.php index 16757272..223506bb 100644 --- a/codepot/src/codepot/views/projectbar.php +++ b/codepot/src/codepot/views/projectbar.php @@ -60,9 +60,9 @@ function show_projectbar ($con, $banner, $page, $ctxmenuitems) { if (isset($site)) print htmlspecialchars($site->summary); } - else if ($type == 'user') + else if ($type == 'user' || $type == 'user-other') { - // anything? + if (isset($user)) print htmlspecialchars($user->summary); } else { diff --git a/codepot/src/codepot/views/user_home.php b/codepot/src/codepot/views/user_home.php index a1ae12c8..18ed3632 100644 --- a/codepot/src/codepot/views/user_home.php +++ b/codepot/src/codepot/views/user_home.php @@ -40,18 +40,15 @@ $(function () { id == $login['id']) { - $user->id = $login['id']; $projectbar_type = 'user'; } else { - $user->id = $target_userid; $projectbar_type = 'user-other'; } -$user->xid = $this->converter->AsciiTohex($user->id); $this->load->view ( 'projectbar', diff --git a/codepot/src/codepot/views/user_settings.php b/codepot/src/codepot/views/user_settings.php index 880bee4b..a52c5149 100644 --- a/codepot/src/codepot/views/user_settings.php +++ b/codepot/src/codepot/views/user_settings.php @@ -27,10 +27,6 @@ id = $login['id']; -$user->xid = $this->converter->AsciiToHex($user->id); - $this->load->view ( 'projectbar', array ( @@ -71,6 +67,8 @@ $this->load->view ( ?> lang->line('USER_MSG_HIDE_METADATA')?> +
+
lang->line('Icon').': ', 'icon_img_file_name')?> load->view ( (.png, max. 100x100)
+
+ + lang->line('Oneliner about me').': ', 'user_summary')?> + + +
+
lang->line('OK'))?>