added the search function to the issue home view

This commit is contained in:
hyung-hwan 2010-03-20 13:11:42 +00:00
parent 343ff629f0
commit c20c19b75b
14 changed files with 279 additions and 117 deletions

View File

@ -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 = "";

View File

@ -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')
);
}

View File

@ -1,4 +1,5 @@
<?php
$lang['All'] = 'All';
$lang['Author'] = 'Author';
$lang['Blame'] = 'Blame';
$lang['Cancel'] = 'Cancel';
@ -51,6 +52,7 @@ $lang['Project'] = 'Project';
$lang['Projects'] = 'Projects';
$lang['Repository'] = 'Repository';
$lang['Revision'] = 'Revision';
$lang['Search'] = 'Search';
$lang['Sign in'] = 'Sign in';
$lang['Sign out'] = 'Sign out';
$lang['Size'] = 'Size';

View File

@ -4,12 +4,12 @@ $lang['ISSUE_TYPE_REQUEST'] = 'Request';
$lang['ISSUE_TYPE_OTHER'] = 'Other';
$lang['ISSUE_STATUS_NEW'] = 'New';
$lang['ISSUE_STATUS_OTHER'] = 'Other';
$lang['ISSUE_STATUS_ACCEPTED'] = 'Accepted';
$lang['ISSUE_STATUS_REJECTED'] = 'Rejected';
$lang['ISSUE_STATUS_FIXED'] = 'Fixed';
$lang['ISSUE_STATUS_WONTFIX'] = "Wont't fix";
$lang['ISSUE_STATUS_DUPLICATE'] = 'Duplicate';
$lang['ISSUE_STATUS_OTHER'] = 'Other';
$lang['ISSUE_STATUS_STARTED'] = 'Started';
$lang['ISSUE_STATUS_STALLED'] = 'Stalled';
$lang['ISSUE_STATUS_RESOLVED'] = 'Resolved';
$lang['ISSUE_PRIORITY_CRITICAL'] = 'Critical';
$lang['ISSUE_PRIORITY_HIGH'] = 'High';
@ -19,4 +19,6 @@ $lang['ISSUE_PRIORITY_OTHER'] = 'Other';
$lang['ISSUE_MSG_CHANGED_X_FROM_Y_TO_Z'] = "Changed <span class='quoted'>%s</span> from <span class='quoted'>%s</span> to <span class='quoted'>%s</span>";
$lang['ISSUE_MSG_CONFIRM_UNDO'] = 'Are you sure to undo the last change?';
$lang['ISSUE_MSG_TOTAL_NUM_ISSUES'] = 'Total %d issues';
?>

View File

@ -1,5 +1,6 @@
<?php
$lang['Author'] = 'Pengarang ';
$lang['All'] = 'Semua';
$lang['Author'] = 'Pengarang';
$lang['Blame'] = 'Menyalahkan';
$lang['Cancel'] = 'Cancel';
$lang['Change'] = 'Change';
@ -51,6 +52,7 @@ $lang['Project'] = 'Proyek';
$lang['Projects'] = 'Proyek';
$lang['Repository'] = 'Repository';
$lang['Revision'] = 'Revisi';
$lang['Search'] = 'Search';
$lang['Sign in'] = 'Masuk';
$lang['Sign out'] = 'Keluar';
$lang['Size'] = 'Ukuran';

View File

@ -1,4 +1,5 @@
<?php
$lang['All'] = '모두';
$lang['Author'] = '저자';
$lang['Blame'] = '책임전가';
$lang['Cancel'] = '취소';
@ -51,6 +52,7 @@ $lang['Project'] = '프로젝트';
$lang['Projects'] = '프로젝트';
$lang['Repository'] = '저장소';
$lang['Revision'] = '리비전';
$lang['Search'] = '찾기';
$lang['Sign in'] = '로그인';
$lang['Sign out'] = '로그아웃';
$lang['Size'] = '크기';

View File

@ -4,12 +4,12 @@ $lang['ISSUE_TYPE_REQUEST'] = '요청';
$lang['ISSUE_TYPE_OTHER'] = '기타';
$lang['ISSUE_STATUS_NEW'] = '신규';
$lang['ISSUE_STATUS_OTHER'] = '기타';
$lang['ISSUE_STATUS_ACCEPTED'] = '승인';
$lang['ISSUE_STATUS_REJECTED'] = '거부';
$lang['ISSUE_STATUS_FIXED'] = '수정됨';
$lang['ISSUE_STATUS_WONTFIX'] = '수정안함';
$lang['ISSUE_STATUS_DUPLICATE'] = '중복';
$lang['ISSUE_STATUS_OTHER'] = '기타';
$lang['ISSUE_STATUS_STARTED'] = '시작';
$lang['ISSUE_STATUS_STALLED'] = '지연';
$lang['ISSUE_STATUS_RESOLVED'] = '완료';
$lang['ISSUE_PRIORITY_CRITICAL'] = '긴급';
$lang['ISSUE_PRIORITY_HIGH'] = '높음';
@ -20,5 +20,6 @@ $lang['ISSUE_PRIORITY_OTHER'] = '기타';
$lang['ISSUE_MSG_CHANGED_X_FROM_Y_TO_Z'] = "<span class='quoted'>%s</span>을/를 <span class='quoted'>%s</span>에서 <span class='quoted'>%s</span>(으)로 변경";
$lang['ISSUE_MSG_CONFIRM_UNDO'] = '마지막 변경내용을 취소할까요?';
$lang['ISSUE_MSG_TOTAL_NUM_ISSUES'] = '전체 이슈 %d개';
?>

View File

@ -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 ();

View File

@ -1,4 +1,9 @@
<div class="footer">
Powered by Codepot <?=CODEPOT_VERSION?><br/>
Copyright © 2009-2010 Hyung-Hwan Chung
<?php if (CODEPOT_FOOTER == ''): ?>
Codepot <?=CODEPOT_VERSION?> by Hyung-Hwan Chung
<?php else: ?>
<?=CODEPOT_FOOTER?>
<?php endif; ?>
</div>

View File

@ -10,34 +10,46 @@
<link type="text/css" rel="stylesheet" href="<?=base_url()?>/css/jquery-ui.css" />
<script type="text/javascript">
$(
function () {
$("#project_issue_home_mainarea_options").dialog (
{
title: 'Options',
autoOpen: false,
modal: true,
buttons: {
'Ok': function () {
$('#filter_owner').val ($('#jq_owner').val());
$('#filter_summary').val ($('#jq_status').val());
$(this).dialog('close');
}
},
close: function() {}
}
);
$("#project_issue_home_mainarea_filter_open").button().click (
function () {
$('#jq_owner').val ($('#filter_owner').val());
$('#jq_status').val ($('#filter_summary').val());
$('#project_issue_home_mainarea_options').dialog('open');
}
);
function AsciiToHex (x) {
var r="";
for(i=0; i<x.length; i++)
{
var tmp = x.charCodeAt(i).toString(16);
if (tmp.length == 1) r += "0";
r += tmp;
}
);
return r;
}
$(function () {
$("#project_issue_home_mainarea_search_form").dialog ({
title: '<?=$this->lang->line('Search')?>',
autoOpen: false,
modal: true,
width: '80%',
buttons: {
'<?=$this->lang->line('Cancel')?>': function () {
$(this).dialog('close');
},
'<?=$this->lang->line('OK')?>': function () {
$(this).dialog('close');
var filter = AsciiToHex($('#issue_search_form').serialize());
var url='<?=site_url()?>/issue/home/<?=$project->id?>/' + filter;
$('body').append('<form id="magic_form" method="get" action="'+url+'"></form>');
$('#magic_form').submit();
}
},
close: function() {}
});
$("#project_issue_home_mainarea_search_button").button().click (
function () {
$('#project_issue_home_mainarea_search_form').dialog('open');
}
);
});
</script>
<title><?=htmlspecialchars($project->name)?></title>
@ -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 (
<div class="mainarea" id="project_issue_home_mainarea">
<div class="title"><?=$this->lang->line('Issues')?></div>
<div id="project_issue_home_mainarea_filter">
<?=form_open("issue/home/{$project->id}/")?>
<input type="hidden" id="filter_owner" name="filter_owner" value='<?=$filter->owner?>' />
<?=form_label ($this->lang->line('Summary'), 'form_summary')?>
<?=form_input('filter_summary', set_value('filter_summary', $filter->summary), 'id="filter_summary"')?>
<?=form_submit('filter', 'Search')?>
<a id="project_issue_home_mainarea_filter_open" href='#'>Options</a>
<?=form_close()?>
<div class="infostrip">
<?php printf ($this->lang->line('ISSUE_MSG_TOTAL_NUM_ISSUES'), $total_num_issues); ?> |
<a id="project_issue_home_mainarea_search_button" href='#'><?=$this->lang->line('Search')?></a>
</div>
<div id="project_issue_home_mainarea_options">
<form>
<label for="jq_owner"><?=$this->lang->line('Owner')?></label>
<input type="text" id="jq_owner" name="jq_owner" />
<label for="jq_status"><?=$this->lang->line('Status')?></label>
<input type="text" id="jq_status" name="jq_status" />
<div id="project_issue_home_mainarea_search_form">
<?php
$issue_type_array[''] = $this->lang->line('All');
$issue_status_array[''] = $this->lang->line('All');
$issue_priority_array[''] = $this->lang->line('All');
?>
<form id="issue_search_form">
<div>
<?=form_label ($this->lang->line('Type'), 'type')
?>
<?=form_dropdown('type',
$issue_type_array,
set_value('type', $search->type),
'id="issue_search_type"')
?>
<?=form_label ($this->lang->line('Status'), 'status')
?>
<?=form_dropdown('status',
$issue_status_array,
set_value('status', $search->status), 'id="status"')
?>
<?=form_label ($this->lang->line('Priority'), 'priority')
?>
<?=form_dropdown('priority',
$issue_priority_array,
set_value('priority', $search->priority),
'id="issue_search_priority"')
?>
</div>
<div>
<?=form_label ($this->lang->line('Owner'), 'owner')
?>
<?=form_input('owner',
set_value('owner', $search->owner),
'id="issue_search_owner"')
?>
</div>
<div>
<?=form_label ($this->lang->line('Summary'), 'summary')
?>
<?=form_input('summary',
set_value('summary', $search->summary),
'id="issue_search_summary" size="50"')
?>
</div>
</form>
</div>
@ -114,41 +161,39 @@ else
print '<th class="project_issue_home_mainarea_result_table_summary">' . $this->lang->line('Summary') . '</th>';
print '</tr>';
$rowclasses = array ('odd', 'even'); $rowno = 1;
foreach ($issues as $issue)
{
$hexid = $this->converter->AsciiToHex ($issue->id);
$rowclass = $rowclasses[++$rowno % 2];
print "<tr class='{$rowclass}'>";
print "<tr class='{$issue->status}'>";
print '<td class="project_issue_home_mainarea_result_table_id">';
print '<td class="id">';
print anchor ("issue/show/{$project->id}/{$hexid}", htmlspecialchars($issue->id));
print '</td>';
print '<td class="project_issue_home_mainarea_result_table_type">';
print '<td class="type">';
print (htmlspecialchars(
array_key_exists($issue->type, $issue_type_array)?
$issue_type_array[$issue->type]: $issue->type));
print '</td>';
print '<td class="project_issue_home_mainarea_result_table_status">';
print '<td class="status">';
print (htmlspecialchars(
array_key_exists($issue->status, $issue_status_array)?
$issue_status_array[$issue->status]: $issue->status));
print '</td>';
print '<td class="project_issue_home_mainarea_result_table_priority">';
print '<td class="priority">';
print (htmlspecialchars(
array_key_exists($issue->priority, $issue_priority_array)?
$issue_priority_array[$issue->priority]: $issue->priority));
print '</td>';
print '<td class="project_issue_home_mainarea_result_table_owner">';
print '<td class="owner">';
print htmlspecialchars($issue->owner);
print '</td>';
print '<td class="project_issue_home_mainarea_result_table_summary">';
print '<td class="summary">';
print htmlspecialchars($issue->summary);
print '</td>';

View File

@ -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 '&nbsp;';

View File

@ -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)

View File

@ -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 {

View File

@ -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 {