Bug 87006 - Worktime-only comments

git-svn-id: svn://svn.office.custis.ru/3rdparty/bugzilla.org/trunk@1413 6955db30-a419-402b-8a0d-67ecbb4d7f56
master
vfilippov 2011-10-04 14:01:24 +00:00
parent 8e160721fa
commit f2a3efe4fe
16 changed files with 257 additions and 205 deletions

View File

@ -1020,7 +1020,7 @@ sub update
{
if (Bugzilla->cgi->param('commentsilent'))
{
# log silent comments
# Log silent comments
SilentLog($self->bug_id, $comment->{thetext});
}
$comment->{bug_id} = $self->bug_id;
@ -1032,16 +1032,24 @@ sub update
$dbh->do("INSERT INTO longdescs ($columns) VALUES ($qmarks)", undef, @values);
if (0+$comment->{work_time} != 0)
{
# log worktime
# Log worktime
$changes->{work_time} ||= [ '', 0 ];
$changes->{work_time}->[1] += $comment->{work_time};
}
}
foreach my $comment_id (keys %{$self->{comment_isprivate} || {}}) {
foreach my $comment_id (keys %{$self->{comment_isprivate} || {}})
{
$dbh->do("UPDATE longdescs SET isprivate = ? WHERE comment_id = ?",
undef, $self->{comment_isprivate}->{$comment_id}, $comment_id);
# XXX It'd be nice to track this in the bug activity.
# FIXME It'd be nice to track this in the bug activity.
}
foreach my $comment_id (keys %{$self->{comment_type} || {}})
{
$dbh->do("UPDATE longdescs SET type = ? WHERE comment_id = ?",
undef, $self->{comment_type}->{$comment_id}, $comment_id);
# FIXME It'd be nice to track this in the bug activity.
}
# Insert the values into the multiselect value tables
@ -2198,7 +2206,6 @@ sub _set_global_validator {
}
}
#################
# "Set" Methods #
#################
@ -2230,6 +2237,21 @@ sub set_comment_is_private {
$self->{comment_isprivate}->{$comment_id} = $isprivate;
}
}
sub set_comment_worktimeonly
{
my ($self, $comment_id, $type) = @_;
my ($comment) = grep $comment_id == $_->id, @{ $self->comments };
if (!$comment || $comment->who != Bugzilla->user->id ||
$comment->type != CMT_NORMAL && $comment->type != CMT_WORKTIME)
{
ThrowUserError('comment_invalid_worktimeonly', { id => $comment_id })
}
$type = $type ? CMT_WORKTIME : CMT_NORMAL;
if ($type != $comment->type)
{
$self->{comment_type}->{$comment_id} = $type;
}
}
sub set_component {
my ($self, $name) = @_;
my $old_comp = $self->component_obj;
@ -3022,7 +3044,7 @@ sub comments {
$self->{'comments'} = Bugzilla::Comment->match({ bug_id => $self->id });
my $count = 0;
foreach my $comment (@{ $self->{'comments'} }) {
$comment->{count} = $count++;
$comment->{count} = $count++ if $comment->type != CMT_WORKTIME;
$comment->{bug} = $self;
}
Bugzilla::Comment->preload($self->{'comments'});

View File

@ -18,10 +18,9 @@
#
# Contributor(s): James Robson <arbingersys@gmail.com>
use strict;
package Bugzilla::Comment;
use strict;
use base qw(Bugzilla::Object);
use Bugzilla::Attachment;
@ -100,6 +99,7 @@ sub is_private { return $_[0]->{'isprivate'}; }
sub work_time { return $_[0]->{'work_time'}; }
sub type { return $_[0]->{'type'}; }
sub extra_data { return $_[0]->{'extra_data'} }
sub who { return $_[0]->{'who'}; }
sub bug {
my $self = shift;
@ -136,7 +136,7 @@ sub body_full {
$params ||= {};
my $template = Bugzilla->template_inner;
my $body;
if ($self->type) {
if ($self->type && $self->type != CMT_WORKTIME) {
$template->process("bug/format_comment.txt.tmpl",
{ comment => $self, %$params }, \$body)
|| ThrowTemplateError($template->error());

View File

@ -96,6 +96,7 @@ use Cwd qw(abs_path);
CMT_MOVED_TO
CMT_ATTACHMENT_CREATED
CMT_ATTACHMENT_UPDATED
CMT_WORKTIME
THROW_ERROR
@ -299,6 +300,9 @@ use constant CMT_MOVED_TO => 4;
use constant CMT_ATTACHMENT_CREATED => 5;
use constant CMT_ATTACHMENT_UPDATED => 6;
# 4Intranet one, means "the comment is just a worktime log entry, and is not important otherwise"
use constant CMT_WORKTIME => 32;
# Determine whether a validation routine should return 0 or throw
# an error when the validation fails.
use constant THROW_ERROR => 1;
@ -312,7 +316,7 @@ use constant REL_GLOBAL_WATCHER => 5;
use constant RELATIONSHIPS => REL_ASSIGNEE, REL_QA, REL_REPORTER, REL_CC,
REL_VOTER, REL_GLOBAL_WATCHER;
# Used for global events like EVT_FLAG_REQUESTED
use constant REL_ANY => 100;

View File

@ -924,12 +924,6 @@ sub create {
return $cache->{template_bug_fields};
},
# Used by bug/comments.html.tmpl
'comment_indexes' => sub {
my ($comments) = @_;
return [ map { [ $_->{count}, $_->{comment_id} ] } @$comments ];
},
'json' => \&Bugzilla::Util::bz_encode_json,
# Whether or not keywords are enabled, in this Bugzilla.

BIN
images/clock.gif Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.0 KiB

BIN
images/clockx.gif Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 625 B

View File

@ -30,21 +30,18 @@ function toggle_comment_display(link, comment_id)
function toggle_all_comments(action, num_comments)
{
// If for some given ID the comment doesn't exist, this doesn't mean
// there are no more comments, but that the comment is private and
// the user is not allowed to view it.
for (var id = 0; id < num_comments; id++)
var parent = document.getElementById('comments');
var pre = parent.getElementsByTagName('pre');
for (var i = 0; i < pre.length; i++)
{
var comment = document.getElementById('comment_text_' + id);
if (!comment)
continue;
var link = document.getElementById('comment_link_' + id);
if (action == 'collapse')
collapse_comment(link, comment);
else
expand_comment(link, comment);
if (pre[i].id.substr(0, 13) == 'comment_text_')
{
var link = document.getElementById('comment_link_' + pre[i].id.substr(13));
if (action == 'collapse')
collapse_comment(link, pre[i]);
else
expand_comment(link, pre[i]);
}
}
}
@ -62,24 +59,38 @@ function expand_comment(link, comment)
removeClass(comment, 'collapsed');
}
/* This way, we are sure that browsers which do not support JS
* won't display this link */
function addCollapseLink(count)
// Mark comment as worktime-only (norm == false) or normal (norm == true)
function mark_wtonly(id, norm, img)
{
var e = document.getElementById('comment_act_'+count);
if (!e)
return;
e.innerHTML +=
' <a href="#" class="bz_collapse_comment"' +
' id="comment_link_' + count +
'" onclick="toggle_comment_display(this, ' + count +
'); return false;" title="Collapse the comment.">[-]<\/a> ';
document.getElementById('wtonly_cont_'+id).style.display = '';
document.getElementById((norm ? 'cmt_normal_' : 'cmt_worktime_')+id).checked = true;
if (img)
img.style.display = 'none';
expand_comment(
document.getElementById('comment_link_'+id),
document.getElementById('comment_text_'+id)
);
}
/* Outputs a link to call replyToComment(); used to reduce HTML output */
// This way, we are sure that browsers which do not support JS
// won't display this link
function addCollapseLink(id)
{
var e = document.getElementById('comment_act_'+id);
if (!e)
return;
var t = document.getElementById('comment_text_'+id);
var c = !hasClass(t, 'collapsed');
e.innerHTML +=
' <a href="#" class="bz_collapse_comment"'+
' id="comment_link_' + id +
'" onclick="toggle_comment_display(this, ' + id +
'); return false;" title="'+(c ? 'Collapse' : 'Expand')+' the comment.">['+
(c ? '-' : '+')+']<\/a> ';
}
function addReplyLink(id, real_id)
// Outputs a link to call replyToComment(); used to reduce HTML output
function addReplyLink(num, id)
{
var e = document.getElementById('comment_act_'+id);
if (!e)
@ -88,32 +99,35 @@ function addReplyLink(id, real_id)
if (user_settings.quote_replies != 'off')
{
s += '<a href="#add_comment" onclick="replyToComment(' +
id + ',' + real_id + '); return false;">reply<' + '/a>';
num + ', ' + id + '); return false;">reply<' + '/a>';
}
s += ', clone to <a href="enter_bug.cgi?cloned_bug_id='+bug_info.id+'&amp;cloned_comment='+id+'">other</a>';
s += '/<a href="enter_bug.cgi?cloned_bug_id='+bug_info.id+'&amp;product='+encodeURI(bug_info.product)+'&amp;cloned_comment='+id+'">same</a>';
/* CustIS Bug 69514 */
s += ', clone to <a href="enter_bug.cgi?cloned_bug_id='+bug_info.id+'&amp;cloned_comment='+num+'">other</a>';
s += '/<a href="enter_bug.cgi?cloned_bug_id='+bug_info.id+'&amp;product='+encodeURI(bug_info.product)+'&amp;cloned_comment='+num+'">same</a>';
// 4Intranet Bug 69514 - Clone to external product button
if (bug_info.extprod)
s += '/<a href="enter_bug.cgi?cloned_bug_id='+bug_info.id+'&amp;product='+encodeURI(bug_info.extprod)+'&amp;cloned_comment='+id+'">ext</a>';
s += '/<a href="enter_bug.cgi?cloned_bug_id='+bug_info.id+'&amp;product='+encodeURI(bug_info.extprod)+'&amp;cloned_comment='+num+'">ext</a>';
else if (bug_info.intprod)
s += '/<a href="enter_bug.cgi?cloned_bug_id='+bug_info.id+'&amp;product='+encodeURI(bug_info.intprod)+'&amp;cloned_comment='+id+'">int</a>';
s += '/<a href="enter_bug.cgi?cloned_bug_id='+bug_info.id+'&amp;product='+encodeURI(bug_info.intprod)+'&amp;cloned_comment='+num+'">int</a>';
s += ' product]';
e.innerHTML += s;
}
/* indexes = [ [ number, id, add_reply ], ... ] for each comment
generated by show_bug.cgi/comment_indexes */
function addActionLinks(indexes)
{
for (var i in indexes)
{
addReplyLink(indexes[i][0], indexes[i][1]);
addCollapseLink(indexes[i][0]);
if (indexes[i][2])
addReplyLink(indexes[i][0], indexes[i][1]);
addCollapseLink(indexes[i][1]);
}
}
/* Adds the reply text to the `comment' textarea */
function replyToComment(id, real_id)
function replyToComment(num, id)
{
var prefix = "(In reply to comment #" + id + ")\n";
var prefix = "(In reply to comment #" + num + ")\n";
var replytext = "";
if (user_settings.quote_replies == 'quoted_reply')
{
@ -129,7 +143,7 @@ function replyToComment(id, real_id)
var prev_ist = false, ist = false;
for (var i = 0; i < text.length; i++)
{
/* CustIS Bug 55876 - ASCII pseudographic tables */
// 4Intranet Bug 55876 - ASCII pseudographic tables
ist = text[i].match('^(┌|│|└).*(┐|│|┘)$') ? true : false;
if (!ist)
{
@ -147,7 +161,7 @@ function replyToComment(id, real_id)
else if (user_settings.quote_replies == 'simple_reply')
replytext = prefix;
if (user_settings.is_insider && document.getElementById('isprivate_' + real_id).checked)
if (user_settings.is_insider && id && document.getElementById('isprivate_' + id).checked)
document.getElementById('newcommentprivacy').checked = 'checked';
var textarea = document.getElementById('comment_textarea');
@ -221,6 +235,7 @@ function att_file_clear(e)
document.getElementById('contenttypeselection_'+ci).selectedIndex = 0;
}
// 4Intranet Bug 68919 - Mass attachment upload
// This function handles change events of upload inputs on multi-attachment upload form
function att_file_onchange(e)
{

View File

@ -71,6 +71,7 @@ my $cgi = Bugzilla->cgi;
my $dbh = Bugzilla->dbh;
my $template = Bugzilla->template;
my $vars = {};
my $ARGS = { %{ $cgi->Vars } };
######################################################################
# Subroutines
@ -335,22 +336,24 @@ my %methods = (
foreach my $b (@bug_objects)
{
if (should_set('comment') || $cgi->param('work_time'))
if ($ARGS->{comment} !~ /^\s*$/ || $ARGS->{work_time})
{
# Add a comment as needed to each bug. This is done early because
# there are lots of things that want to check if we added a comment.
$b->add_comment(scalar($cgi->param('comment')),
{ isprivate => scalar $cgi->param('commentprivacy'),
work_time => scalar $cgi->param('work_time') });
$b->add_comment($ARGS->{comment}, {
isprivate => $ARGS->{commentprivacy},
work_time => $ARGS->{work_time},
type => $ARGS->{cmt_worktime} ? CMT_WORKTIME : CMT_NORMAL,
});
}
foreach my $field_name (@set_fields)
{
if (should_set($field_name) || $field_name =~ /^(component|target_milestone|version)$/ &&
should_set('product'))
if (defined $ARGS->{$field_name} ||
defined $ARGS->{product} && $field_name =~ /^(component|target_milestone|version)$/)
{
my $method = $methods{$field_name};
$method ||= "set_" . $field_name;
$b->$method($cgi->param($field_name) || '');
$b->$method($ARGS->{$field_name} || '');
}
}
$b->reset_assigned_to if $cgi->param('set_default_assignee');
@ -398,7 +401,16 @@ if (defined $cgi->param('id')) {
$field =~ /(\d+)$/;
my $comment_id = $1;
$first_bug->set_comment_is_private($comment_id,
$cgi->param("isprivate_$comment_id"));
$cgi->param("isprivate_$comment_id"));
}
# Same with worktime-only
foreach (keys %$ARGS)
{
if (/^cmt_(normal|worktime)_(\d+)$/)
{
$first_bug->set_comment_worktimeonly($2, $1 eq 'worktime');
}
}
}

View File

@ -35,7 +35,13 @@ use Checkers;
my $cgi = Bugzilla->cgi;
my $template = Bugzilla->template;
my $vars = {};
my $vars = {
# Used by bug/comments.html.tmpl
'comment_indexes' => sub {
my ($comments) = @_;
return [ map { [ $_->{count}, $_->{comment_id}, $_->{type} != CMT_WORKTIME ? 1 : 0 ] } @$comments ];
},
};
my $user = Bugzilla->login();

View File

@ -1,21 +1,6 @@
/* The contents of this file are subject to the Mozilla Public
* License Version 1.1 (the "License"); you may not use this file
* except in compliance with the License. You may obtain a copy of
* the License at http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
* implied. See the License for the specific language governing
* rights and limitations under the License.
*
* The Original Code is the Bugzilla Bug Tracking System.
*
* The Initial Developer of the Original Code is Netscape Communications
* Corporation. Portions created by Netscape are
* Copyright (C) 1998 Netscape Communications Corporation. All
* Rights Reserved.
*
* Contributor(s): Myk Melez <myk@mozilla.org>
/* CSS styles for bug list (99% rewritten)
* License: Dual-license GPL 3.0+ or MPL 1.1+
* Contributor(s): Vitaliy Filippov <vitalif@mail.ru>
*/
.search_description { display: inline-block; margin: 2px; padding: 2px; border: 1px solid gray; }
@ -61,7 +46,7 @@ table#form tr th { text-align: right; }
/* we use a first-child class and not the pseudo-class because IE
* doesn't support it :-( */
tr.bz_secure td.first-child {
tr.bz_secure td.first-child {
background-image: url("../../images/padlock.png");
background-position: center left;
background-repeat: no-repeat;
@ -100,7 +85,9 @@ td.bz_total {
.bz_buglist .bz_blocked_column,
.bz_buglist .bz_dependson_column { width: 8%; white-space: normal; }
/* Bug states */
.bz_buglist .bz_short_desc_column a { color: black; text-decoration: none; }
/* Bug states - duplicated here for external stylesheet usage */
.bz_st_UNCONFIRMED, .bz_UNCONFIRMED td.first-child a { font-style: italic; }
.bz_st_RESOLVED, .bz_RESOLVED td.first-child a { text-decoration: line-through; }
.bz_st_VERIFIED, .bz_VERIFIED td.first-child a { text-decoration: line-through; border: 1px dashed #2f6fab; color: black; background-color: #f9f9f9; line-height: 1.1em; }

View File

@ -209,7 +209,7 @@
border-color: black;
border-width: 0px 0px 2px 0px;
}
.tabs td.selected {
background: white;
border-width: 2px 2px 0px 2px;
@ -277,16 +277,17 @@ div#docslinks {
color: #a0a0a0;
}
/************/
/* Comments */
/************/
/****************/
/* Comment text */
/****************/
.bz_comment_table td {
vertical-align: top;
}
.bz_comment { margin-bottom: 2em; }
.bz_comment_text { width: 50em; }
.bz_comment {
margin-bottom: 2em;
.bz_comment_text span.quote {
color: #65379c;
/* Make quoted text not wrap. */
white-space: pre;
}
/* The rules for these classes make international text wrap correctly,
@ -301,56 +302,13 @@ div#docslinks {
white-space: -o-pre-wrap; /* Opera 7 */
}
.bz_comment_text {
width: 50em;
}
.bz_comment_user, .bz_comment_time, .bz_comment_number,
.bz_private_checkbox, .bz_comment_actions
{
margin: 0 .5em;
white-space: nowrap;
}
.bz_comment_actions, .bz_comment_number, .bz_private_checkbox {
float: right;
}
.bz_collapse_expand_comments {
padding: 0;
margin: 0 0 0 1em;
list-style-type: none;
}
.bz_collapse_expand_comments li {
margin-bottom: .5em;
}
.bz_collapse_comment {
text-decoration: none;
}
.bz_private_checkbox input {
margin: 0;
vertical-align: middle;
}
.bz_comment_head, .bz_first_comment_head {
padding-top: .1em;
padding-bottom: .1em;
padding-left: .5em;
background-color: #e0e0e0;
}
.bz_comment_user_images img {
vertical-align: bottom;
}
.bz_comment_hilite pre {
background-color: lightgreen;
margin: 0;
padding: 1em 0;
}
/** End Comments **/
/** End Comment text **/
.bz_default_hidden, .bz_tui_hidden, .bz_hidden_field, .bz_hidden_option {
/* We have !important because we want elements with these classes to always
@ -359,12 +317,6 @@ div#docslinks {
display: none !important;
}
.bz_comment_text span.quote {
color: #65379c;
/* Make quoted text not wrap. */
white-space: pre;
}
table#flags th,
table#flags td {
vertical-align: top;
@ -500,13 +452,6 @@ input.required, select.required, span.required_explanation {
vertical-align: middle;
}
.calendar_button span { display: none }
/* These classes are set by YUI. */
.yui-calcontainer {
display: none;
background-color: white;
padding: 10px;
border: 1px solid #404D6C;
}
.bug_urls {
margin: 0 0 1em 0;
@ -552,7 +497,7 @@ form#Create .comment {
background-image: url(global/down.png);
}
/* Bug states */
/* Bug states */
.bz_st_UNCONFIRMED, .bz_UNCONFIRMED td.first-child a { font-style: italic; }
.bz_st_RESOLVED, .bz_RESOLVED td.first-child a { text-decoration: line-through; }
.bz_st_VERIFIED, .bz_VERIFIED td.first-child a { text-decoration: line-through; border: 1px dashed #2f6fab; color: black; background-color: #f9f9f9; line-height: 1.1em; }
@ -581,7 +526,6 @@ z-index:-1;
filter:mask();
}
.yui-calcontainer { z-index: 50; }
.numeric_invalid { background-color: #FFE0E0; }
.buglist-navbar { float: left; margin: 4pt; font-size: 120%; padding: 2pt; }

View File

@ -1,21 +1,21 @@
.bz_alias_short_desc_container {
margin: 8px 0;
padding: 0.3em;
background-color: rgb(208, 208, 208);
-moz-border-radius: 0.5em;
font-size: 125%;
margin: 8px 0;
padding: 0.3em;
background-color: rgb(208, 208, 208);
-moz-border-radius: 0.5em;
font-size: 125%;
font-weight: bold;
}
.bz_bug .edit_form {
width: 100%;
width: 100%;
}
.bz_bug .edit_form table {
width: 100%;
width: 100%;
}
.bz_bug .edit_form .text_input {
width: 100%;
min-width: 25em;
width: 100%;
min-width: 25em;
}
.bz_bug #alias {
min-width: 0;
@ -34,7 +34,7 @@ table#flags {
}
.related_actions {
font-size: 0.85em;
font-size: 0.85em;
float: right;
list-style-type: none;
white-space: nowrap;
@ -47,7 +47,7 @@ table#flags {
}
.bz_show_bug_column {
vertical-align: top;
vertical-align: top;
}
.bz_section_spacer {
@ -56,7 +56,6 @@ table#flags {
#duplicate_settings, #votes_container {
white-space: nowrap;
}
#bz_big_form_parts td {
@ -95,7 +94,7 @@ table#flags {
vertical-align: middle;
}
.bz_time_tracking_table th,
.bz_time_tracking_table th,
.bz_time_tracking_table td {
padding: 4px;
}
@ -104,11 +103,11 @@ table#flags {
text-align: right;
}
#summary tr td {
#summary tr td {
vertical-align:top;
}
#status {
#status {
margin-bottom: 3ex;
}
@ -143,3 +142,28 @@ table#flags {
#comment_textarea { width: 50em; font-size: medium; font-family: monospace; }
#cf_sprint { max-width: 25em; min-width: 0; }
/* <Comments> */
.bz_comment_table td { vertical-align: top; }
.bz_comment_user, .bz_comment_time,
.bz_comment_number, .bz_private_checkbox,
.bz_comment_actions { margin: 0 .5em; white-space: nowrap; }
.bz_comment_user, .bz_comment_time, .bz_comment_user_images,
.bz_comment_worktime, .bz_comment_unmark_wtonly { float: left; }
.bz_comment_actions, .bz_comment_number, .bz_private_checkbox { float: right; }
.bz_comment_worktime { font-weight: bold; color: #008000; }
.bz_comment_unmark_wtonly { margin-left: 1em; }
.bz_private_checkbox input { margin: 0; vertical-align: middle; }
.bz_comment_user_images img { vertical-align: bottom; }
.bz_collapse_expand_comments { padding: 0; margin: 0 0 0 1em; list-style-type: none; }
.bz_collapse_expand_comments li { margin-bottom: .5em; }
.bz_collapse_comment { text-decoration: none; }
.bz_comment_head, .bz_first_comment_head { padding: .1em 0 .1em .5em; background-color: #e0e0e0; }
/* </Comments> */

View File

@ -18,8 +18,11 @@
# Contributor(s): Gervase Markham <gerv@gerv.net>
# Max Kanat-Alexander <mkanat@bugzilla.org>
# Shane H. W. Travis <travis@sedsystems.ca>
# Vitaliy Filippov <vitalif@mail.ru>
#%]
[%# FIXME check if all is working correctly without JavaScript! (definitely there are bugs) %]
[% PROCESS bug/time.html.tmpl %]
[% DEFAULT mode = "show" %]
@ -46,10 +49,8 @@
addActionLinks([% json(comment_indexes(comments)) %]);
</script>
<ul class="bz_collapse_expand_comments">
<li><a href="#" onclick="toggle_all_comments('collapse', [% comments.size %]);
return false;">Collapse All Comments</a></li>
<li><a href="#" onclick="toggle_all_comments('expand', [% comments.size %]);
return false;">Expand All Comments</a></li>
<li><a href="#" onclick="toggle_all_comments('collapse'); return false;">Collapse All Comments</a></li>
<li><a href="#" onclick="toggle_all_comments('expand'); return false;">Expand All Comments</a></li>
</ul>
[% END %]
</td>
@ -61,41 +62,44 @@
[% BLOCK a_comment %]
[% RETURN IF comment.is_private AND ! user.is_insider %]
<div class="bz_comment[% " bz_private" IF comment.is_private %]
[% " bz_comment_hilite" IF marks.$count %]
[% " bz_first_comment" IF comment.count == 0 %]">
[% IF !comment.count %]
[% wt_only = comment.type == constants.CMT_WORKTIME %]
<div class="bz_comment
[%- " bz_private" IF comment.is_private %]
[%- " bz_comment_hilite" IF marks.$count %]
[%- " bz_first_comment" IF comment.count == 0 %]">
[% IF comment.count == 0 %]
[% class_name = "bz_first_comment_head" %]
[% comment_label = "Description" %]
[% ELSE %]
[% class_name = "bz_comment_head" %]
[% class_name = wt_only ? "bz_comment_wthead" : "bz_comment_head" %]
[% comment_label = "Comment " _ comment.count %]
[% END %]
<div class="[% class_name FILTER html %]">
<div class="[% class_name %]">
<span class="bz_comment_actions" id="comment_act_[% comment.count %]"></span>
<span class="bz_comment_actions" id="comment_act_[% comment.id %]"></span>
[% IF mode == "edit" && user.is_insider %]
<div class="bz_private_checkbox">
<input type="hidden" value="1"
name="defined_isprivate_[% comment.id %]">
name="defined_isprivate_[% comment.id %]" />
<input type="checkbox"
name="isprivate_[% comment.id %]" value="1"
id="isprivate_[% comment.id %]"
onClick="updateCommentPrivacy(this, [% comment.count %])"
[% " checked=\"checked\"" IF comment.is_private %]>
onClick="updateCommentPrivacy(this, [% comment.id %])"
[% " checked=\"checked\"" IF comment.is_private %] />
<label for="isprivate_[% comment.id %]">Private</label>
</div>
[% END %]
<a name="[% comment.bug_when FILTER timestamp %]"></a>
[% IF NOT wt_only %]
<span class="bz_comment_number">
<a name="[% comment.bug_when FILTER timestamp %]"></a>
<a name="c[% comment.count %]"
href="show_bug.cgi?id=[% bug.bug_id %]#c[% comment.count %]">
[%- comment_label FILTER html %]</a>
</span>
[% END %]
<span class="bz_comment_user">
[% INCLUDE global/user.html.tmpl who = comment.author %]
@ -113,19 +117,54 @@
<span class="bz_comment_time">
[%+ comment.creation_ts FILTER time %]
</span>
[% IF wt_only && user.is_timetracker &&
(comment.work_time > 0 || comment.work_time < 0) %]
<div class="bz_comment_worktime">
[% PROCESS formattimeunit time_unit=comment.work_time %]h
</div>
[% IF comment.who == user.id %]
<div class="bz_comment_unmark_wtonly">
<img src="images/clockx.gif" width="16" height="16"
alt="Mark comment as worktime-only" title="Mark comment as normal"
style="cursor: pointer; vertical-align: middle"
onclick="mark_wtonly([% comment.id %],1,this)" />
<span id="wtonly_cont_[% comment.id %]" style="display: none">
<input style="vertical-align: middle" type="checkbox"
name="cmt_normal_[% comment.id %]" id="cmt_normal_[% comment.id %]" value="1" />
<label style="vertical-align: middle" for="cmt_normal_[% comment.id %]">Mark comment as normal</label>
</span>
</div>
[% END %]
[% END %]
<div style="clear: both"></div>
</div>
[% IF user.is_timetracker &&
[% IF NOT wt_only && user.is_timetracker &&
(comment.work_time > 0 || comment.work_time < 0) %]
<br />
Additional hours worked:
[% PROCESS formattimeunit time_unit=comment.work_time %]
<br />
Additional hours worked:
[%+ PROCESS formattimeunit time_unit=comment.work_time %]
[% IF comment.who == user.id AND comment.type == constants.CMT_NORMAL %]
<img src="images/clock.gif" width="16" height="16"
alt="Mark comment as worktime-only" title="Mark comment as worktime-only"
style="cursor: pointer; vertical-align: middle"
onclick="mark_wtonly([% comment.id %],0,this)" />
<span id="wtonly_cont_[% comment.id %]" style="display: none">
<input style="vertical-align: middle" type="checkbox"
name="cmt_worktime_[% comment.id %]" id="cmt_worktime_[% comment.id %]" value="1" />
<label style="vertical-align: middle" for="cmt_worktime_[% comment.id %]">Mark comment as worktime only</label>
</span>
[% END %]
[% END %]
[%# Don't indent the <pre> block, since then the spaces are displayed in the
# generated HTML
#%]
<pre class="bz_comment_text" id="comment_text_[% comment.count %]">
<pre class="bz_comment_text [% " collapsed" IF wt_only %]" id="comment_text_[% comment.id %]">
[%- comment.body_full({ wrap => 1 }) -%]
</pre>
</div>

View File

@ -967,14 +967,14 @@ document.changeform = document.[% cfname %];
[% IF user.is_insider %]
<input type="checkbox" name="commentprivacy" value="1"
id="newcommentprivacy"
onClick="updateCommentTagControl(this, form)">
<label for="newcommentprivacy">
Make comment private
</label>
onclick="updateCommentTagControl(this, form)" />
<label for="newcommentprivacy">Private</label>
[% END %]
<input type="checkbox" name="commentsilent" value="1"
id="commentsilent">
<input type="checkbox" name="commentsilent" value="1" id="commentsilent" />
<label for="commentsilent">Silent</label>
<input type="checkbox" name="cmt_worktime" value="1" id="cmt_worktime"
onclick="if(this.checked)document.getElementById('commentsilent').checked=true" />
<label for="cmt_worktime">Worktime only</label>
<!-- This table keeps the submit button aligned with the box. -->
<table><tr><td>

View File

@ -265,6 +265,11 @@
You tried to modify the privacy of comment id [% id FILTER html %],
but that is not a valid comment on this [% terms.bug %].
[% ELSIF error == "comment_invalid_worktimeonly" %]
You tried to modify the type of comment id [% id FILTER html %],
but that is either not a valid comment on this [% terms.bug %],
or it's not yours, or it has special type.
[% ELSIF error == "comment_is_private" %]
Comment id [% id FILTER html %] is private.

View File

@ -165,10 +165,8 @@
[% FOREACH column = displaycolumns %]
<td class="bz_[% column FILTER css_class_quote %]_column
[%- IF Bugzilla.COLUMNS.$column.subid %] bz_[% Bugzilla.COLUMNS.$column.subid | css_class_quote %]_column[% END %]">
[% IF abbrev.$column.maxlength %]
<span title="[%- bug.$column FILTER html %]">
[% END %]
[%- IF Bugzilla.COLUMNS.$column.subid %] bz_[% Bugzilla.COLUMNS.$column.subid | css_class_quote %]_column[% END %]"
[%- IF abbrev.$column.maxlength %] title="[%- bug.$column | html %]"[% END %]>
[% IF abbrev.$column.format_value %]
[%- bug.$column FILTER format(abbrev.$column.format_value) FILTER html -%]
[% ELSIF Bugzilla.get_field(column).type == constants.FIELD_TYPE_BUG_ID %]
@ -181,17 +179,19 @@
[%# Display the login name of the user if their real name is empty. %]
[% ELSIF column.match('_realname$') && bug.$column == '' %]
[% SET login_column = column.remove('_realname$') %]
[% bug.${login_column}.truncate(abbrev.$column.maxlength,
abbrev.$column.ellipsis) FILTER html %]
[% bug.${login_column}.truncate(
abbrev.$column.maxlength,
abbrev.$column.ellipsis
) FILTER html %]
[% ELSIF column == 'blocked' OR column == 'dependson' %]
[% bug.$column | bug_list_link %]
[% ELSIF column == 'short_desc' %]
<a href="show_bug.cgi?id=[% bug.bug_id %]">
[%- bug.$column.truncate(abbrev.$column.maxlength, abbrev.$column.ellipsis) FILTER html -%]
</a>
[% ELSE %]
[%- bug.$column.truncate(abbrev.$column.maxlength, abbrev.$column.ellipsis) FILTER html -%]
[% END %]
[% IF abbrev.$column.maxlength %]
</span>
[% END %]
</td>
[% END %]