added the user issue view

This commit is contained in:
hyung-hwan 2016-02-07 14:40:46 +00:00
parent c76f14177a
commit fb1b7d657c
6 changed files with 174 additions and 4 deletions

View File

@ -5,6 +5,7 @@ class User extends Controller
var $VIEW_ERROR = 'error';
var $VIEW_LOG = 'log';
var $VIEW_HOME = 'user_home';
var $VIEW_ISSUE = 'user_issue';
var $VIEW_SETTINGS = 'user_settings';
function User ()
@ -66,6 +67,43 @@ class User extends Controller
}
}
function issue ()
{
$login = $this->login->getUser ();
if (CODEPOT_SIGNIN_COMPULSORY && $login['id'] == '')
redirect ('main/signin');
if ($login['id'] == '')
{
redirect ('site/home');
return;
}
$this->load->library ('IssueHelper', 'issuehelper');
$this->lang->load ('issue', CODEPOT_LANG);
$this->load->model ('ProjectModel', 'projects');
$this->load->model ('IssueModel', 'issues');
$issues = $this->issues->getMyIssues (
$login['id'], $this->issuehelper->_get_open_status_array($this->lang));
if ($issues === FALSE)
{
$data['login'] = $login;
$data['message'] = 'DATABASE ERROR';
$this->load->view ($this->VIEW_ERROR, $data);
}
else
{
$data['login'] = $login;
$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);
$data['issue_priority_array'] = $this->issuehelper->_get_priority_array($this->lang);
$this->load->view ($this->VIEW_ISSUE, $data);
}
}
function log ($offset = 0)
{
$login = $this->login->getUser ();

View File

@ -30,6 +30,7 @@ www_DATA = \
site_show.php \
taskbar.php \
user_home.php \
user_issue.php \
user_settings.php \
wiki_edit.php \
wiki_editx.php \

View File

@ -175,6 +175,7 @@ www_DATA = \
site_show.php \
taskbar.php \
user_home.php \
user_issue.php \
user_settings.php \
wiki_edit.php \
wiki_editx.php \

View File

@ -293,8 +293,8 @@ foreach ($latest_projects as $project)
<ul id="site_home_result_open_issues_list" class="collapsible-box-list">
<?php
/*
TODO: show site issue stats.
foreach ($open_issue_counts_per_project as $issue)
{
$pro = $issue->projectid;

View File

@ -8,12 +8,9 @@
<link type="text/css" rel="stylesheet" href="<?php print base_url_make('/css/user.css')?>" />
<link type="text/css" rel="stylesheet" href="<?php print base_url_make('/css/font-awesome.min.css')?>" />
<script type="text/javascript" src="<?php print base_url_make('/js/jquery.min.js')?>"></script>
<script type="text/javascript" src="<?php print base_url_make('/js/jquery-ui.min.js')?>"></script>
<link type="text/css" rel="stylesheet" href="<?php print base_url_make('/css/jquery-ui.css')?>" />
<script type="text/javascript">
$(function () {

View File

@ -0,0 +1,133 @@
<html>
<?php
$num_issues = count($issues);
$issues_by_projects = array();
foreach ($issues as $issue)
{
if (!array_key_exists ($issue->projectid, $issues_by_projects))
$issues_by_projects[$issue->projectid] = array();
$arr = &$issues_by_projects[$issue->projectid];
array_push ($arr, $issue);
$unique_projects = array_keys ($issues_by_projects);
}
?>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<script type="text/javascript" src="<?php print base_url_make('/js/codepot.js')?>"></script>
<link type="text/css" rel="stylesheet" href="<?php print base_url_make('/css/common.css')?>" />
<link type="text/css" rel="stylesheet" href="<?php print base_url_make('/css/user.css')?>" />
<link type="text/css" rel="stylesheet" href="<?php print base_url_make('/css/font-awesome.min.css')?>" />
<script type="text/javascript" src="<?php print base_url_make('/js/jquery.min.js')?>"></script>
<script type="text/javascript" src="<?php print base_url_make('/js/jquery-ui.min.js')?>"></script>
<link type="text/css" rel="stylesheet" href="<?php print base_url_make('/css/jquery-ui.css')?>" />
<script type="text/javascript">
$(function () {
<?php
for ($i = 0; $i < count($unique_projects); $i++)
{
printf ('$("#user_home_mainarea_open_issues_%d").accordion({collapsible:true, heightStyle:"content"}); ', $i);
}
?>
});
</script>
<title><?php print htmlspecialchars($login['id'])?></title>
</head>
<body>
<div class="content" id="user_home_content">
<!---------------------------------------------------------------------------->
<?php $this->load->view ('taskbar'); ?>
<!---------------------------------------------------------------------------->
<?php
$user = new stdClass();
$user->id = $login['id'];
$this->load->view (
'projectbar',
array (
'banner' => NULL,
'page' => array (
'type' => 'user',
'id' => 'issues',
'user' => $user,
),
'ctxmenuitems' => array ()
)
);
?>
<!---------------------------------------------------------------------------->
<div class="mainarea" id="user_home_mainarea">
<div id="user_home_mainarea_result" class="result">
<div id="user_home_mainarea_open_issues">
<?php
for ($i = 0; $i < count($unique_projects); $i++)
{
printf ('<div id="user_home_mainarea_open_issues_%d" class="collapsible-box">', $i);
$issues = &$issues_by_projects[$unique_projects[$i]];
printf ('<div class="collapsible-box-header">%s</div>', htmlspecialchars($unique_projects[$i]));
print '<ul>';
foreach ($issues as $issue)
{
$pro = $issue->projectid;
$xid = $this->converter->AsciiToHex ((string)$issue->id);
$anc = anchor ("issue/show/{$issue->projectid}/{$xid}", '#' . htmlspecialchars($issue->id));
$status = htmlspecialchars(
array_key_exists($issue->status, $issue_status_array)?
$issue_status_array[$issue->status]: $issue->status);
$type = htmlspecialchars(
array_key_exists($issue->type, $issue_type_array)?
$issue_type_array[$issue->type]: $issue->type);
$sum = htmlspecialchars ($issue->summary);
print "<li>{$pro} {$anc} {$type} {$status} - {$sum}</li>";
}
print '</ul>';
print '</div>';
}
?>
</div>
</div> <!-- user_home_mainarea_result -->
</div> <!-- user_home_mainarea -->
<div class='codepot-footer-pusher'></div> <!-- for sticky footer -->
</div> <!-- user_home_content -->
<!---------------------------------------------------------------------------->
<?php $this->load->view ('footer'); ?>
<!---------------------------------------------------------------------------->
</body>
</html>