enhanced the issue show view

This commit is contained in:
hyung-hwan 2016-01-18 15:05:05 +00:00
parent 21742a46c5
commit f1b31c85dd
4 changed files with 198 additions and 166 deletions

View File

@ -984,7 +984,7 @@ class IssueModel extends Model
{
$this->db->trans_begin (); // manual transaction. not using trans_start().
$this->db->where ('projectid', $projectod);
$this->db->where ('projectid', $projectid);
$this->db->where ('id', $issueid);
$query = $this->db->get ('issue');
if ($this->db->trans_status() === FALSE)

View File

@ -266,7 +266,11 @@ class SubversionModel extends Model
$fileinfo['created_rev'] = $info[0]['last_changed_rev'];
else
$fileinfo['created_rev'] = $info[0]['revision'];
$fileinfo['last_author'] = $info[0]['last_changed_author'];
if (array_key_exists('last_changed_author', $info[0]))
$fileinfo['last_author'] = $info[0]['last_changed_author'];
else
$fileinfo['last_author'] = '';
}
else return FALSE;

View File

@ -223,6 +223,21 @@ function preview_issue_change_comment(input_text)
prettyPrint ();
}
function preview_edit_comment (input_text, no)
{
creole_render_wiki_with_input_text (
input_text,
"issue_show_edit_comment_preview_" + no,
"<?php print $creole_base; ?>",
"<?php print $creole_file_base; ?>/",
true
);
prettyPrint ();
}
var work_in_progress = false;
var original_file_name = [
@ -230,7 +245,7 @@ var original_file_name = [
for ($i = 0; $i < $issue_file_count; $i++)
{
$f = $issue->files[$i];
printf ("%s\t'%s'", (($i == 0)? '': ",\n"), addslashes($f->filename));
printf ("%s\t%s", (($i == 0)? '': ",\n"), codepot_json_encode($f->filename));
}
print "\n";
?>
@ -241,7 +256,7 @@ var original_file_desc = [
for ($i = 0; $i < $issue_file_count; $i++)
{
$f = $issue->files[$i];
printf ("%s\t'%s'", (($i == 0)? '': ",\n"), addslashes($f->description));
printf ("%s\t%s", (($i == 0)? '': ",\n"), codepot_json_encode($f->description));
}
print "\n";
?>
@ -729,7 +744,14 @@ $(function () {
}
);
$('#issue_show_undo_change_confirm').dialog (
$('#issue_show_change_form_open_bottom').button().click (
function () {
$('#issue_show_change_form').dialog('open');
return false;
}
);
/*$('#issue_show_undo_change_confirm').dialog (
{
title: '<?php print $this->lang->line('Undo')?>',
resizable: false,
@ -754,7 +776,7 @@ $(function () {
$('#issue_show_undo_change_confirm').dialog('open');
return false;
}
);
);*/
$('#issue_change_comment_preview_button').button().click(
function () {
@ -800,6 +822,15 @@ $(function () {
return false;
}
);
$('#issue_show_edit_comment_preview_button_' + i).button().click(
function () {
var id = $(this).attr('id');
var comment_no = id.replace('issue_show_edit_comment_preview_button_', '');
preview_edit_comment ($('#issue_show_edit_comment_text_' + comment_no).val(), comment_no);
return false;
}
);
}
<?php endif; ?>
@ -841,6 +872,57 @@ $this->load->view (
)
)
);
function print_issue_state ($con, $issue, $old, $issue_type_array, $issue_status_array, $issue_priority_array)
{
$type = array_key_exists($issue->type, $issue_type_array)?
$issue_type_array[$issue->type]: $issue->type;
$status = array_key_exists($issue->status, $issue_status_array)?
$issue_status_array[$issue->status]: $issue->status;
$priority = array_key_exists($issue->priority, $issue_priority_array)?
$issue_priority_array[$issue->priority]: $issue->priority;
if ($old == NULL || $issue->type != $old->type)
{
printf ('<li class="issue-type-%s">', $issue->type);
print $con->lang->line('Type');
print ': ';
print htmlspecialchars($type);
print '</li>';
}
if ($old == NULL || $issue->status != $old->status)
{
printf ('<li class="issue-status-%s">', $issue->status);
print $con->lang->line('Status');
print ': ';
print htmlspecialchars($status);
print '</li>';
}
if ($old == NULL || $issue->priority != $old->priority)
{
printf ('<li class="issue-priority-%s">', $issue->priority);
print $con->lang->line('Priority');
print ': ';
print htmlspecialchars($priority);
print '</li>';
}
if ($old == NULL || $issue->owner != $old->owner)
{
print '<li class="issue-owner">';
if ($issue->owner != '')
{
print $con->lang->line('Owner');
print ': ';
print htmlspecialchars($issue->owner);
print '</li>';
}
}
}
?>
<!---------------------------------------------------------------------------->
@ -872,51 +954,16 @@ $this->load->view (
<div id='issue_show_state' class='collapsible-box'>
<div id='issue_show_metadata_header' class='collapsible-box-header'><?php print $this->lang->line('State')?></div>
<div id='issue_show_metadata_body'>
<ul id='issue_show_metadata_list'>
<ul id='issue_show_metadata_list' class='codepot-issue-horizontal-list'>
<li><?php print $this->lang->line('Created on')?> <?php print codepot_dbdatetodispdate($issue->createdon); ?></li>
<li><?php print $this->lang->line('Created by')?> <?php print htmlspecialchars($issue->createdby); ?></li>
<li><?php print $this->lang->line('Last updated on')?> <?php print codepot_dbdatetodispdate($issue->updatedon); ?></li>
<li><?php print $this->lang->line('Last updated by')?> <?php print htmlspecialchars($issue->updatedby); ?></li>
</ul>
<ul id='issue_show_state_list'>
<ul id='issue_show_state_list' class='codepot-issue-horizontal-list'>
<?php
$type = array_key_exists($issue->type, $issue_type_array)?
$issue_type_array[$issue->type]: $issue->type;
$status = array_key_exists($issue->status, $issue_status_array)?
$issue_status_array[$issue->status]: $issue->status;
$priority = array_key_exists($issue->priority, $issue_priority_array)?
$issue_priority_array[$issue->priority]: $issue->priority;
printf ('<li class="issue-type-%s">', $issue->type);
print $this->lang->line('Type');
print ': ';
print htmlspecialchars($type);
print '</li>';
printf ('<li class="issue-status-%s">', $issue->status);
print $this->lang->line('Status');
print ': ';
print htmlspecialchars($status);
print '</li>';
printf ('<li class="issue-priority-%s">', $issue->priority);
print $this->lang->line('Priority');
print ': ';
print htmlspecialchars($priority);
print '</li>';
print '<li class="issue-owner">';
if ($issue->owner != '')
{
print $this->lang->line('Owner');
print ': ';
print htmlspecialchars($issue->owner);
print '</li>';
}
print_issue_state ($this, $issue, NULL, $issue_type_array, $issue_status_array, $issue_priority_array);
?>
</ul>
@ -971,11 +1018,11 @@ $this->load->view (
print $this->lang->line('Change');
print '</a>';
print ' ';
//print ' ';
print '<a id="issue_show_undo_change" href="#">';
print $this->lang->line('Undo');
print '</a>';
//print '<a id="issue_show_undo_change" href="#">';
//print $this->lang->line('Undo');
//print '</a>';
?>
</div>
@ -985,37 +1032,67 @@ $this->load->view (
$msgfmt_changed_from_to = $this->lang->line ('ISSUE_MSG_CHANGED_X_FROM_Y_TO_Z');
$msgfmt_changed_to = $this->lang->line ('ISSUE_MSG_CHANGED_X_TO_Z');
print '<table id="issue_show_changes_table" class="codepot-full-width-table">';
// TODO: displa changes[0];
$new = $issue->changes[0];
print '<div id="issue_show_change_start" class="codepot-issue-start">';
print '<div class="codepot-issue-change">';
print '<div class="codepot-issue-change-topline">';
printf ('<div class="codepot-issue-change-date">%s</div>', codepot_dbdatetodispdate($new->updatedon));
print '<div class="codepot-issue-comment-updater">';
$user_icon_url = codepot_merge_path (site_url(), '/user/icon/' . $this->converter->AsciiToHex($new->updatedby));
print "<img src='{$user_icon_url}' class='codepot-committer-icon-24x24' /> ";
print htmlspecialchars($new->updatedby);
print '</div>';
print '<div class="codepot-issue-comment-actions"></div>';
print '<div style="clear: both;"></div>';
print '</div>';
print '</div>';
print '<ul id="issue_show_change_start_list" class="codepot-issue-horizontal-list">';
print_issue_state ($this, $new, NULL, $issue_type_array, $issue_status_array, $issue_priority_array);
print '</ul>';
print '<div style="clear: both;"></div>';
print '</div>';
for ($i = 1; $i < $change_count; $i++)
{
$new = $issue->changes[$i];
$old = $issue->changes[$i - 1];
print '<tr>';
print '<div class="codepot-issue-change">';
print '<td class="date">';
print codepot_dbdatetodispdate($new->updatedon);
print '</td>';
print '<td class="details">';
print "<div>";
print "<div class='codepot-issue-comment-updater'>";
print '<div class="codepot-issue-change-topline">';
printf ('<div class="codepot-issue-change-date">%s</div>', codepot_dbdatetodispdate($new->updatedon));
print '<div class="codepot-issue-comment-updater">';
$user_icon_url = codepot_merge_path (site_url(), '/user/icon/' . $this->converter->AsciiToHex($new->updatedby));
print "<img src='{$user_icon_url}' class='codepot-committer-icon-24x24' /> ";
print htmlspecialchars($new->updatedby);
print "</div>";
printf ("<div class='codepot-issue-comment-actions'><a href='#' id='issue_show_edit_comment_button_%d' class='codepot-issue-comment-action-button'>%s</a></div>", $i, $this->lang->line('Edit'));
print "<div style='clear: both;'></div>";
print "</div>";
print '</div>';
print '<div class="codepot-issue-comment-actions">';
if(isset($login['id']) && $login['id'] != '')
{
printf ("<a href='#' id='issue_show_edit_comment_button_%d' class='codepot-issue-comment-action-button'>%s</a>", $i, $this->lang->line('Edit'));
}
print '</div>';
print '<div style="clear: both;"></div>';
print '</div>';
print '<ul class="codepot-issue-horizontal-list">';
print_issue_state ($this, $new, $old, $issue_type_array, $issue_status_array, $issue_priority_array);
print '</ul>';
print '<div style="clear: both;"></div>';
$escaped_comment = htmlspecialchars($new->comment);
if(isset($login['id']) && $login['id'] != '')
{
print "<div id='issue_show_edit_comment_form_{$i}'>";
printf ('<a href="#" id="issue_show_edit_comment_preview_button_%d">%s</a>', $i, $this->lang->line('Preview'));
printf ('<input type="hidden" id="issue_show_edit_comment_sno_%d" value="%s" />', $i, addslashes($new->sno));
printf ('<textarea id="issue_show_edit_comment_text_%d" class="codepot-issue-edit-comment" rows="20">%s</textarea>', $i, $escaped_comment);
printf ('<div id="issue_show_edit_comment_preview_%d" class="codepot-styled-text-preview"></div>', $i);
print '</div>';
}
@ -1023,70 +1100,23 @@ $this->load->view (
printf ("<pre id='issue_show_comment_pre_%d'>%s</pre>", $i, $escaped_comment);
print '</div>';
print '<div class="list">';
print '<ul>';
if ($new->type != $old->type)
{
printf ("<li>{$msgfmt_changed_from_to}</li>",
strtolower($this->lang->line('Type')),
htmlspecialchars(
array_key_exists($old->type, $issue_type_array)?
$issue_type_array[$old->type]: $old->type),
htmlspecialchars(
array_key_exists($new->type, $issue_type_array)?
$issue_type_array[$new->type]: $new->type));
}
if ($new->status != $old->status)
{
printf ("<li>{$msgfmt_changed_from_to}</li>",
strtolower($this->lang->line('Status')),
htmlspecialchars(
array_key_exists($old->status, $issue_status_array)?
$issue_status_array[$old->status]: $old->status),
htmlspecialchars(
array_key_exists($new->status, $issue_status_array)?
$issue_status_array[$new->status]: $new->status));
}
if ($new->priority != $old->priority)
{
printf ("<li>{$msgfmt_changed_from_to}</li>",
strtolower($this->lang->line('Priority')),
htmlspecialchars(
array_key_exists($old->priority, $issue_priority_array)?
$issue_priority_array[$old->priority]: $old->priority),
htmlspecialchars(
array_key_exists($new->priority, $issue_priority_array)?
$issue_priority_array[$new->priority]: $new->priority));
}
if ($new->owner != $old->owner)
{
if ($old->owner == '')
{
printf ("<li>{$msgfmt_changed_to}</li>",
strtolower($this->lang->line('Owner')),
htmlspecialchars($new->owner));
}
else
{
printf ("<li>{$msgfmt_changed_from_to}</li>",
strtolower($this->lang->line('Owner')),
htmlspecialchars($old->owner), htmlspecialchars($new->owner));
}
}
print '</ul>';
print '</div>';
print '</td>';
print '</tr>';
}
print '</table>';
?>
</div> <!-- issue_show_changes -->
<div id="issue_show_changes_bottom_strip" class="codepot-infostrip">
<?php
print '<a id="issue_show_change_form_open_bottom" href="#">';
print $this->lang->line('Change');
print '</a>';
?>
</div>
<?php if (isset($login['id']) && $login['id'] != ''): ?>
<div id='issue_show_edit_form'>
<div style='line-height: 2em;'>
@ -1230,7 +1260,7 @@ $this->load->view (
<div id="issue_show_undo_change_confirm">
<?php print $this->lang->line ('ISSUE_MSG_CONFIRM_UNDO')?>
<?php //print $this->lang->line ('ISSUE_MSG_CONFIRM_UNDO'); ?>
</div>
<div id='issue_show_alert'></div>

View File

@ -1,7 +1,49 @@
ul.codepot-issue-horizontal-list {
clear: both;
padding: 0;
margin: 0;
list-style: outside none none !important;
}
ul.codepot-issue-horizontal-list li {
padding: 0.2em 0.2em 0.2em 0.2em;
margin: 0 0.2em 0 0.2em;
float: left;
}
.codepot-issue-change ul.codepot-issue-horizontal-list {
padding: 0.3em 0 0.3em 0;
}
.codepot-issue-start,
.codepot-issue-change {
padding: 0.3em 0 0.3em 0;
}
.codepot-issue-change {
border-top: 1px solid #cccccc;
}
.codepot-issue-change-topline {
background-color: #EEEEEE;
padding: 0.3em;
-moz-border-radius: 3px;
-webkit-border-radius: 3px;
border-radius: 3px;
line-height: 1.5em;
}
.codepot-issue-change-date,
.codepot-issue-comment-updater {
float: left;
}
.codepot-issue-comment-updater {
margin-left: 0.5em;
}
.codepot-issue-comment-actions {
float: right;
}
@ -21,7 +63,6 @@ textarea.codepot-issue-edit-comment {
font-size: 0.9em;
}
li.issue-type-defect {
background-color: #D9534F;
color: #FFFFFF;
@ -208,25 +249,10 @@ li.issue-owner {
padding: 1em 1em;
}
#issue_show_metadata_list,
#issue_show_state_list {
clear: both;
padding: 0;
margin: 0;
list-style: outside none none;
}
#issue_show_state_list {
padding-top: 0.2em;
}
#issue_show_metadata_list li,
#issue_show_state_list li {
padding: 0.2em 0.2em 0.2em 0.2em;
margin: 0 0.2em 0 0.2em;
float: left;
}
#issue_show_metadata_list li {
background-color: #EAEAEA !important;
color: #000000 !important;
@ -271,34 +297,6 @@ li.issue-owner {
overflow: auto;
}
#issue_show_changes_table td {
padding: 0.3em 0.3em 0.3em 0.3em;
white-space: normal;
word-wrap: break-word;
}
#issue_show_changes_table td.date {
min-width: 5em;
width: 1px;
vertical-align: top;
}
#issue_show_changes_table td.details {
overflow: auto;
}
#issue_show_changes_table td.details .list {
background-color: #F1F1FF;
}
#issue_show_changes_table td.details .list ul {
padding: 0;
margin: 0.2em 0.5em 0.5em 1em;
}
#issue_show_changes_table td.details .list ul li {
padding: 0.1em;
}
#issue_change_comment_preview_button.ui-button {
font-size: 0.8em;