From c20c19b75b301fabcfcd612d4e9e6f9f93ce9961 Mon Sep 17 00:00:00 2001 From: hyung-hwan Date: Sat, 20 Mar 2010 13:11:42 +0000 Subject: [PATCH] added the search function to the issue home view --- codepot/etc/codepot.ini.in | 8 + codepot/src/codepot/controllers/issue.php | 92 +++++++--- .../codepot/language/english/common_lang.php | 2 + .../codepot/language/english/issue_lang.php | 10 +- .../language/indonesian/common_lang.php | 4 +- .../codepot/language/korean/common_lang.php | 2 + .../codepot/language/korean/issue_lang.php | 9 +- codepot/src/codepot/models/issuemodel.php | 14 +- codepot/src/codepot/views/footer.php | 9 +- codepot/src/codepot/views/issue_home.php | 157 +++++++++++------- codepot/src/codepot/views/projectbar.php | 3 +- codepot/src/config.php.in | 4 +- codepot/src/css/common.css | 11 +- codepot/src/css/issue.css | 71 ++++++-- 14 files changed, 279 insertions(+), 117 deletions(-) diff --git a/codepot/etc/codepot.ini.in b/codepot/etc/codepot.ini.in index 633b4ee0..b10ed431 100644 --- a/codepot/etc/codepot.ini.in +++ b/codepot/etc/codepot.ini.in @@ -131,3 +131,11 @@ file_dir = "@DEPOTDIR@/files" ; 4 = All Messages ;------------------------------------------------------------------------------ log_threshold = 0 + +;------------------------------------------------------------------------------ +; customized footer +;------------------------------------------------------------------------------ +; Leave this empty for the default footer message +;------------------------------------------------------------------------------ +footer = ""; + diff --git a/codepot/src/codepot/controllers/issue.php b/codepot/src/codepot/controllers/issue.php index d481dd99..6a4d3dd9 100644 --- a/codepot/src/codepot/controllers/issue.php +++ b/codepot/src/codepot/controllers/issue.php @@ -12,13 +12,19 @@ class Issue extends Controller var $TYPE_REQUEST = 'request'; var $TYPE_OTHER = 'other'; + // a newly created issue is set to 'new'. var $STATUS_NEW = 'new'; + var $STATUS_OTHER = 'other'; // other to default + + // the issue created is either accepted or rejected var $STATUS_ACCEPTED = 'accepted'; - var $STATUS_REJECTED = 'rejected'; - var $STATUS_FIXED = 'fixed'; - var $STATUS_WONTFIX = 'wontfix'; - var $STATUS_DUPLICATE = 'duplicate'; - var $STATUS_OTHER = 'other'; + var $STATUS_REJECTED = 'rejected'; + + // one accepted, it is worked on and be resolved eventually. + var $STATUS_STARTED = 'started'; + // the work can be stalled for various reasons during progress + var $STATUS_STALLED = 'stalled'; + var $STATUS_RESOLVED = 'resolved'; var $PRIORITY_CRITICAL = 'critical'; var $PRIORITY_HIGH = 'high'; @@ -40,7 +46,7 @@ class Issue extends Controller $this->lang->load ('issue', CODEPOT_LANG); } - function home ($projectid = '', $offset = 0) + function home ($projectid = '', $filter = '', $offset = '') { $this->load->model ('ProjectModel', 'projects'); $this->load->model ('IssueModel', 'issues'); @@ -65,23 +71,60 @@ class Issue extends Controller } else { - if ($this->input->post('filter')) + if ($filter == '') { - $filter->summary = $this->input->post('filter_summary'); - $filter->owner = $this->input->post('filter_owner'); - $data['filter'] = $filter; + $search->type = ''; + $search->status = ''; + $search->priority = ''; + $search->owner = ''; + $search->summary = ''; } else { - $filter->summary = ''; - $filter->owner = ''; - $data['filter'] = $filter; + parse_str ($this->converter->HexToAscii($filter), $search); + if (!array_key_exists ('type', $search)) $search['type'] = ''; + if (!array_key_exists ('status', $search)) $search['status'] = ''; + if (!array_key_exists ('priority', $search)) $search['priority'] = ''; + if (!array_key_exists ('owner', $search)) $search['owner'] = ''; + if (!array_key_exists ('summary', $search)) $search['summary'] = ''; + + $search = (object) $search; } + $data['search'] = $search; $this->load->library ('pagination'); - $num_entries = $this->issues->getNumEntries ($login['id'], $project); + + if ($filter == '' && $offset == '') + { + $offset = 0; + $pagecfg['base_url'] = site_url() . "/issue/home/{$projectid}/"; + $pagecfg['uri_segment'] = 4; + } + else if ($filter != '' && $offset == '') + { + if (is_numeric($filter)) + { + $offset = (integer) $filter; + $pagecfg['base_url'] = site_url() . "/issue/home/{$projectid}/"; + $pagecfg['uri_segment'] = 4; + } + else + { + $offset = 0; + $pagecfg['base_url'] = site_url() . "/issue/home/{$projectid}/{$filter}/"; + $pagecfg['uri_segment'] = 5; + } + } + else + { + $offset = (integer) $offset; + $pagecfg['base_url'] = site_url() . "/issue/home/{$projectid}/{$filter}/"; + $pagecfg['uri_segment'] = 5; + } + + $num_entries = $this->issues->getNumEntries ($login['id'], $project, $search); if ($num_entries === FALSE) { $data['project'] = $project; @@ -90,15 +133,13 @@ class Issue extends Controller return; } - $pagecfg['base_url'] = site_url() . "/issue/home/{$projectid}/"; $pagecfg['total_rows'] = $num_entries; $pagecfg['per_page'] = CODEPOT_MAX_ISSUES_PER_PAGE; - $pagecfg['uri_segment'] = 4; $pagecfg['first_link'] = $this->lang->line('First'); $pagecfg['last_link'] = $this->lang->line('Last'); //$issues = $this->issues->getAll ($login['id'], $project); - $issues = $this->issues->getEntries ($login['id'], $offset, $pagecfg['per_page'], $project); + $issues = $this->issues->getEntries ($login['id'], $offset, $pagecfg['per_page'], $project, $search); if ($issues === FALSE) { $data['project'] = $project; @@ -112,6 +153,7 @@ class Issue extends Controller $data['issue_type_array'] = $this->_get_type_array(); $data['issue_status_array'] = $this->_get_status_array(); $data['issue_priority_array'] = $this->_get_priority_array(); + $data['total_num_issues'] = $num_entries; $data['project'] = $project; $data['issues'] = $issues; $this->load->view ($this->VIEW_HOME, $data); @@ -492,18 +534,18 @@ class Issue extends Controller return array ( $this->STATUS_NEW => $this->lang->line('ISSUE_STATUS_NEW'), + $this->STATUS_OTHER => + $this->lang->line('ISSUE_STATUS_OTHER'), $this->STATUS_ACCEPTED => $this->lang->line('ISSUE_STATUS_ACCEPTED'), $this->STATUS_REJECTED => $this->lang->line('ISSUE_STATUS_REJECTED'), - $this->STATUS_FIXED => - $this->lang->line('ISSUE_STATUS_FIXED'), - $this->STATUS_WONTFIX => - $this->lang->line('ISSUE_STATUS_WONTFIX'), - $this->STATUS_DUPLICATE => - $this->lang->line('ISSUE_STATUS_DUPLICATE'), - $this->STATUS_OTHER => - $this->lang->line('ISSUE_STATUS_OTHER') + $this->STATUS_STARTED => + $this->lang->line('ISSUE_STATUS_STARTED'), + $this->STATUS_STALLED => + $this->lang->line('ISSUE_STATUS_STALLED'), + $this->STATUS_RESOLVED => + $this->lang->line('ISSUE_STATUS_RESOLVED') ); } diff --git a/codepot/src/codepot/language/english/common_lang.php b/codepot/src/codepot/language/english/common_lang.php index ff609d3a..6a3c8e1f 100644 --- a/codepot/src/codepot/language/english/common_lang.php +++ b/codepot/src/codepot/language/english/common_lang.php @@ -1,4 +1,5 @@ %s from %s to %s"; $lang['ISSUE_MSG_CONFIRM_UNDO'] = 'Are you sure to undo the last change?'; +$lang['ISSUE_MSG_TOTAL_NUM_ISSUES'] = 'Total %d issues'; + ?> diff --git a/codepot/src/codepot/language/indonesian/common_lang.php b/codepot/src/codepot/language/indonesian/common_lang.php index 0bd34c95..245c2ac6 100644 --- a/codepot/src/codepot/language/indonesian/common_lang.php +++ b/codepot/src/codepot/language/indonesian/common_lang.php @@ -1,5 +1,6 @@ %s을/를 %s에서 %s(으)로 변경"; $lang['ISSUE_MSG_CONFIRM_UNDO'] = '마지막 변경내용을 취소할까요?'; +$lang['ISSUE_MSG_TOTAL_NUM_ISSUES'] = '전체 이슈 %d개'; ?> diff --git a/codepot/src/codepot/models/issuemodel.php b/codepot/src/codepot/models/issuemodel.php index 4a0a004f..0fd2057d 100644 --- a/codepot/src/codepot/models/issuemodel.php +++ b/codepot/src/codepot/models/issuemodel.php @@ -41,11 +41,16 @@ class IssueModel extends Model return $result[0]; } - function getNumEntries ($userid, $project) + function getNumEntries ($userid, $project, $search) { $this->db->trans_start (); $this->db->where ('projectid', $project->id); + if ($search->type != '') $this->db->where ('type', $search->type); + if ($search->status != '') $this->db->where ('status', $search->status); + if ($search->priority != '') $this->db->where ('priority', $search->priority); + if ($search->owner != '') $this->db->like ('owner', $search->owner); + if ($search->summary != '') $this->db->like ('summary', $search->summary); $this->db->select ('count(id) as count'); $query = $this->db->get ('issue'); $result = $query->result(); @@ -58,11 +63,16 @@ class IssueModel extends Model return $num; } - function getEntries ($userid, $offset, $limit, $project) + function getEntries ($userid, $offset, $limit, $project, $search) { $this->db->trans_start (); $this->db->where ('projectid', $project->id); + if ($search->type != '') $this->db->where ('type', $search->type); + if ($search->status != '') $this->db->where ('status', $search->status); + if ($search->priority != '') $this->db->where ('priority', $search->priority); + if ($search->owner != '') $this->db->like ('owner', $search->owner); + if ($search->summary != '') $this->db->like ('summary', $search->summary); $this->db->order_by ('id', 'desc'); $query = $this->db->get ('issue', $limit, $offset); $this->db->trans_complete (); diff --git a/codepot/src/codepot/views/footer.php b/codepot/src/codepot/views/footer.php index 9f041da4..02077655 100644 --- a/codepot/src/codepot/views/footer.php +++ b/codepot/src/codepot/views/footer.php @@ -1,4 +1,9 @@ diff --git a/codepot/src/codepot/views/issue_home.php b/codepot/src/codepot/views/issue_home.php index af438e52..225ee5fa 100644 --- a/codepot/src/codepot/views/issue_home.php +++ b/codepot/src/codepot/views/issue_home.php @@ -10,34 +10,46 @@ <?=htmlspecialchars($project->name)?> @@ -60,7 +72,7 @@ $this->load->view ( 'site' => NULL, 'pageid' => 'issue', 'ctxmenuitems' => array ( - array ("issue/create/{$project->id}", $this->lang->line('New')) + array ("issue/create/{$project->id}", $this->lang->line('New'), 'project_issue_home_new') ) ) ); @@ -71,27 +83,62 @@ $this->load->view (
lang->line('Issues')?>
-
- id}/")?> - - - - lang->line('Summary'), 'form_summary')?> - summary), 'id="filter_summary"')?> - - - - Options - - +
+lang->line('ISSUE_MSG_TOTAL_NUM_ISSUES'), $total_num_issues); ?> | +lang->line('Search')?>
-
-
- - - - +
+ lang->line('All'); + $issue_status_array[''] = $this->lang->line('All'); + $issue_priority_array[''] = $this->lang->line('All'); + ?> + +
+ lang->line('Type'), 'type') + ?> + type), + 'id="issue_search_type"') + ?> + + lang->line('Status'), 'status') + ?> + status), 'id="status"') + ?> + + lang->line('Priority'), 'priority') + ?> + priority), + 'id="issue_search_priority"') + ?> +
+ + +
+ lang->line('Owner'), 'owner') + ?> + owner), + 'id="issue_search_owner"') + ?> +
+ +
+ lang->line('Summary'), 'summary') + ?> + summary), + 'id="issue_search_summary" size="50"') + ?> +
+
@@ -114,41 +161,39 @@ else print '' . $this->lang->line('Summary') . ''; print ''; - $rowclasses = array ('odd', 'even'); $rowno = 1; foreach ($issues as $issue) { $hexid = $this->converter->AsciiToHex ($issue->id); - $rowclass = $rowclasses[++$rowno % 2]; - print ""; + print ""; - print ''; + print ''; print anchor ("issue/show/{$project->id}/{$hexid}", htmlspecialchars($issue->id)); print ''; - print ''; + print ''; print (htmlspecialchars( array_key_exists($issue->type, $issue_type_array)? $issue_type_array[$issue->type]: $issue->type)); print ''; - print ''; + print ''; print (htmlspecialchars( array_key_exists($issue->status, $issue_status_array)? $issue_status_array[$issue->status]: $issue->status)); print ''; - print ''; + print ''; print (htmlspecialchars( array_key_exists($issue->priority, $issue_priority_array)? $issue_priority_array[$issue->priority]: $issue->priority)); print ''; - print ''; + print ''; print htmlspecialchars($issue->owner); print ''; - print ''; + print ''; print htmlspecialchars($issue->summary); print ''; diff --git a/codepot/src/codepot/views/projectbar.php b/codepot/src/codepot/views/projectbar.php index db704417..ddb04f5d 100644 --- a/codepot/src/codepot/views/projectbar.php +++ b/codepot/src/codepot/views/projectbar.php @@ -25,7 +25,8 @@ function show_projectbar ($con, $site, $project, $pageid, $ctxmenuitems) { foreach ($ctxmenuitems as $item) { - print anchor ($item[0], $item[1]); + $extra = (count($item) >= 3)? "id='{$item[2]}'": ''; + print anchor ($item[0], $item[1], $extra); } } else print ' '; diff --git a/codepot/src/config.php.in b/codepot/src/config.php.in index 937fbd0e..1518eb27 100644 --- a/codepot/src/config.php.in +++ b/codepot/src/config.php.in @@ -49,7 +49,9 @@ function load_ini ($file) array ('svnrepo_dir', 'string', CODEPOT_DEPOT_DIR.'/svnrepo'), array ('file_dir', 'string', CODEPOT_DEPOT_DIR.'/files'), - array ('log_threshold', 'integer', 0) + array ('log_threshold', 'integer', 0), + + array ('footer', 'string', '') ); foreach ($xcfgs as $x) diff --git a/codepot/src/css/common.css b/codepot/src/css/common.css index 45d64357..b5255642 100644 --- a/codepot/src/css/common.css +++ b/codepot/src/css/common.css @@ -51,14 +51,16 @@ body { .content .taskbar form input[type="text"] { font-weight: bold; - background-color: #FFFF99; - border: 1px solid #FFFF99; + /*background-color: #FFFF99; + border: 1px solid #FFFF99;*/ + border: 1px solid #FFFFFF; } .content .taskbar form input[type="password"] { font-weight: bold; - background-color: #FFFF99; - border: 1px solid #FFFF99; + /*background-color: #FFFF99; + border: 1px solid #FFFF99;*/ + border: 1px solid #FFFFFF; } .content .taskbar form input[type="submit"] { @@ -76,6 +78,7 @@ body { font-weight: bold; text-transform: uppercase; margin-bottom: 0.2em; + white-space: nowrap; } .content .projectbar .ctxmenu { diff --git a/codepot/src/css/issue.css b/codepot/src/css/issue.css index b77ac495..801e2ad3 100644 --- a/codepot/src/css/issue.css +++ b/codepot/src/css/issue.css @@ -7,64 +7,101 @@ } #project_issue_home_mainarea_result_table { - border-collapse: collapse; + padding-top: 1em; + /*border-collapse: separate; + border-spacing: 0px 1px;*/ width: 100%; font-size: inherit; } +#project_issue_home_mainarea_result_table th { + padding-top: 3px; + padding-bottom: 3px; +} + +#project_issue_home_mainarea_result_table td { + padding-top: 3px; + padding-bottom: 3px; +} + +#project_issue_home_mainarea_result_table tr.new { + background-color: #ffccbb; +} + +#project_issue_home_mainarea_result_table tr.accepted { +} + +#project_issue_home_mainarea_result_table tr.rejected { + background-color: #ffeedd; +} + +#project_issue_home_mainarea_result_table tr.started { + background-color: #ddeeff; +} + +#project_issue_home_mainarea_result_table tr.stalled { + background-color: #bbccff; +} + +#project_issue_home_mainarea_result_table tr.resolved { + background-color: #ddffdd; +} + +#project_issue_home_mainarea_result_table tr.other { + background-color: #ddeeff; +} + #project_issue_home_mainarea_result_table td.pages { padding-top: 1em; text-align: center; font-weight: bold; } -.project_issue_home_mainarea_result_table_id { +#project_issue_home_mainarea_result_table td.id { white-space: nowrap; width: 1px; } -.project_issue_home_mainarea_result_table_type { +#project_issue_home_mainarea_result_table td.type { white-space: nowrap; width: 1px; } -.project_issue_home_mainarea_result_table_status { +#project_issue_home_mainarea_result_table td.status { white-space: nowrap; width: 1px; } -.project_issue_home_mainarea_result_table_priority { +#project_issue_home_mainarea_result_table td.priority { white-space: nowrap; width: 1px; } -.project_issue_home_mainarea_result_table_owner { +#project_issue_home_mainarea_result_table td.owner { white-space: nowrap; width: 1px; } -.project_issue_home_mainarea_result_table_summary { +#project_issue_home_mainarea_result_table td.summary { white-space: nowrap; } +#project_issue_home_mainarea_search_form { +} + +#project_issue_home_mainarea_search_form div { + padding: 0.2em; +} + /*--------------------------------------------- * issue show *---------------------------------------------*/ #project_issue_show_mainarea_change_form { - font-size: .9em; } #project_issue_show_mainarea_change_form div { - padding: 0.3em; -} - -#project_issue_show_mainarea_change_form input { - padding: 1px; -} - -#project_issue_show_mainarea_change_form select { - padding: 1px; + padding: 0.2em; } #project_issue_show_mainarea_change_form textarea {