[%# 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): André Batosti <batosti@async.com.br>
  #%]

From: [% Param('mailfrom') %]
To: [% to_user.email %]
Subject: [% (isnew ? '' : 'Re: ') _ '['
  _ terms.Bug _ ' ' _ bug.id _ '] ' _
  (bug.bug_severity_obj.name == 'blocker' ? '[BLOCKER] ' : '') _
  (bug.bug_severity_obj.name == 'critical' ? '[CRITICAL] ' : '') _
  bug.short_desc %]
X-Bugzilla-Reason: [% reasonsheader %]
X-Bugzilla-Type: [% isnew ? 'new' : 'changed' %]
X-Bugzilla-Watch-Reason: [% reasonswatchheader %]
[% IF Bugzilla.get_field('classification').enabled %]
X-Bugzilla-Classification: [% bug.classification_obj.name %]
[% END %]
[% IF bug.bug_severity_obj.name == 'blocker' OR bug.bug_severity_obj.name == 'critical' %]
Importance: high
X-Priority: 1
[% END %]
X-Bugzilla-Product: [% bug.product_obj.name %]
X-Bugzilla-Component: [% bug.component_obj.name %]
[% FOREACH keyword_item = bug.keywords_obj %]
X-Bugzilla-Keywords: [% keyword_item.name %]
[% END %]
X-Bugzilla-Severity: [% bug.bug_severity_obj.name %]
X-Bugzilla-Who: [% changer.login %]
X-Bugzilla-Status: [% bug.bug_status_obj.name %]
X-Bugzilla-Priority: [% bug.priority_obj.name %]
X-Bugzilla-Assigned-To: [% bug.assigned_to.login %]
X-Bugzilla-Target-Milestone: [% bug.target_milestone %]
X-Bugzilla-Changed-Fields: [% changedfields || "None" %]
X-Bugzilla-Added-Comments: [% new_comments.size %]
[% FOREACH f = Bugzilla.active_custom_fields %]
  [% IF f.type == constants.FIELD_TYPE_MULTI_SELECT %]
    [% FOREACH v = bug.get_object(f.name) %]
X-Bugzilla-[% f.name %]: [% v.value %]
    [% END %]
  [% ELSIF f.type == constants.FIELD_TYPE_DATETIME || f.type == constants.FIELD_TYPE_BUG_ID || f.type == constants.FIELD_TYPE_SINGLE_SELECT %]
    [% SET v = bug.get_string(f) %]
    [% IF v %]
X-Bugzilla-[% f.name %]: [% bug.get_string(f) %]
    [% END %]
  [% END %]
[% END %]
[%+ threadingmarker %]
[% USE date %]
[% SET boundary = "--" _ date.now %]
Content-Type: multipart/alternative; boundary=[% boundary %]
MIME-Version: 1.0

--[% boundary %]
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: quoted-printable

[% FILTER quoted_printable %]
[%+ urlbase %]show_bug.cgi?id=[% bug.id %] (prod:[% bug.product %].[% bug.component -%]
, pri:[% bug.priority_obj.name %], sev:[% bug.bug_severity_obj.name %], miles:[% bug.target_milestone_obj.name %])

[%- IF diffs AND diffs.size > 0 %]
[%- SET lastwho = "" %]
[%- SET lastdep = 0 %]
[%- FOR d = diffs %]
[%- IF d.dep AND d.dep != lastdep %]
[%- SET lastdep = d.dep %]
[%- # ------ Bug <bug> Depends on bug <dep>, which changed state ------ %]

Bug [% d.bug_id %] depends on bug [% d.dep %], which changed state.

Bug [% d.dep %] summary: [% d.short_desc %]
[%+ urlbase %]show_bug.cgi?id=[% d.dep %]

[%- END %]
[%- IF d.login_name != lastwho %]
[%- # ------ <user> Changed <bug> ------ %]
[%- SET lastwho = d.login_name %]

[% d.login_name %] changed:

[% three_columns('What    ', 'Removed', 'Added') -%]
----------------------------------------------------------------------------

[%- END %]
[%- # ------ What Removed Added ------ %]
[% three_columns(d.fielddesc, d.diff_removed ? d.diff_removed : d.removed, d.diff_added ? d.diff_added : d.added) %]
[%- END %]
[%- END %]
[%- # comments %]
[%- FOREACH comment = new_comments %]

[%- IF comment.count %]
--- Comment #[% comment.count %] from [% comment.author.identity %] [%+ comment.bug_when FILTER time(undef, to_user.timezone) %] ---
[% END %]
[%+ comment.body_full({ is_bugmail => 1, wo_preview => 1 }) %]
[% END %]

-- [%# Protect the trailing space of the signature marker %]
Configure [% terms.bug %]mail: [% urlbase %]userprefs.cgi?tab=email
------- You are receiving this mail because: -------
[% FOREACH relationship = reasons %]
  [% SWITCH relationship %]
    [% CASE constants.REL_ASSIGNEE %]
You are the assignee for the [% terms.bug %].
    [% CASE constants.REL_REPORTER %]
You reported the [% terms.bug %].
    [% CASE constants.REL_QA %]
You are the QA contact for the [% terms.bug %].
    [% CASE constants.REL_CC %]
You are on the CC list for the [% terms.bug %]. <a href="[% urlbase %]unsubscribe.cgi?id=[% bugid %]">Remove yourself from the CC list</a>.
    [% CASE constants.REL_VOTER %]
You are a voter for the [% terms.bug %].
    [% CASE constants.REL_GLOBAL_WATCHER %]
You are watching all [% terms.bug %] changes.
  [% END %]
[% END %]
[% FOREACH relationship = reasons_watch %]
  [% SWITCH relationship %]
    [% CASE constants.REL_ASSIGNEE %]
You are watching the assignee of the [% terms.bug %].
    [% CASE constants.REL_REPORTER %]
You are watching the reporter.
    [% CASE constants.REL_QA %]
You are watching the QA contact of the [% terms.bug %].
    [% CASE constants.REL_CC %]
You are watching someone on the CC list of the [% terms.bug %].
    [% CASE constants.REL_VOTER %]
You are watching a voter for the [% terms.bug %].
  [% END %]
[% END %]
[% END %]

--[% boundary %]
Content-Type: text/html; charset=utf-8
Content-Transfer-Encoding: quoted-printable

[% FILTER quoted_printable %]
<style>
<!--
body { font-family: Segoe UI, sans-serif; }
.difft { padding-bottom: 5pt; font-size: 80%; }
.difft.fv th { text-align: left; }
.bz_st_UNCONFIRMED { font-style: italic; }
.bz_st_RESOLVED { text-decoration: line-through; }
.bz_st_VERIFIED { text-decoration: line-through; border: 1px dashed #2f6fab; background-color: #f9f9f9; line-height: 1.1em; }
.bz_st_CLOSED { text-decoration: line-through; border: 1px solid #2f6fab; background-color: #f9f9f9; line-height: 1.1em; }
.difft.p6 { width: 100%; max-width: 600px; }
.bz_comment_text { font-size: 100%; white-space: normal; font-family: Consolas, monospace; }
.bz_comment_text .quote { color: #65379c; border-left: solid 3px #65379c; padding-left: .5em; margin-left: .5em; }
/*-->*/
</style>
<body>
<p>
[% IF bug.bug_severity_obj.name == 'blocker' OR bug.bug_severity_obj.name == 'critical' %]
<a style="font-size: 120%; color: black; background-color: red; font-weight: bold;" href="[%+ urlbase %]show_bug.cgi?id=[% bug.id -%]
  [%- IF new_comments AND new_comments.size > 0 %]#c[% new_comments.0.count %][% END %]">&nbsp;Bug [% bug.id %] [
  [%- bug.bug_severity_obj.name | upper %]] - [% bug.short_desc | html %]&nbsp;</a>
[% ELSE %]
<a style="font-size: 120%;" href="[%+ urlbase %]show_bug.cgi?id=[% bug.id %]
  [%- IF new_comments AND new_comments.size > 0 %]#c[% new_comments.0.count %][% END %]">Bug [% bug.id %] - [% bug.short_desc | html %]</a>
[% END %]
<br /><span style="font-size: 90%">(prod:[% bug.product | html %].[% bug.component | html %], pri:
[%- bug.priority_obj.name | html %], sev:[% bug.bug_severity_obj.name %], miles:[% bug.target_milestone_obj.name | html %])</span>
</p>

<hr color="#A0A0A0" size="1" />

[% IF new_comments AND new_comments.size > 0 %]
  [% FOR comment = new_comments %]
  <p><a href="[%+ urlbase %]show_bug.cgi?id=[% bug.id %]#c[% comment.count %]">Comment #[% comment.count %]</a> from
      <span class="vcard">
          <a class="fn email" href="[% Param('user_mailto') %][% comment.author.email FILTER html %]">
          [% (comment.author.realname || comment.author.login) FILTER html %]</a>
      </span>
  [% comment.bug_when FILTER time(undef, to_user.timezone) %]</p>
  <div class="bz_comment_text">
[%- comment.body_full({ wrap => 1, wo_preview => 1 }) FILTER absolute_uris -%]
  </div>
<hr color="#A0A0A0" size="1" />
  [% END %]
[% END %]

[% IF isnew AND showfieldvalues.size > 0 %]
<table class="difft fv">
[% FOR f = showfieldvalues %]
  <tr><th>[% f.desc FILTER html %]:</th><td>[% f.value FILTER html %]</td></tr>
[% END %]
</table>
<hr color="#A0A0A0" size="1" />
[% END %]

[% IF diffs AND diffs.size > 0 %]
[% SET lastwho = "" %]
[% SET lastdep = 0 %]
<table class="difft p6" style="border-collapse: collapse" cellpadding="3">
[% FOR d = diffs %]

  [% IF d.dep AND d.dep != lastdep %]
  [%# ------ Bug <bug> Depends on bug <dep>, which changed state ------ %]
  [%- SET lastdep = d.dep %]
  <tr><td colspan="3">
      <p><a href="[% urlbase %]show_bug.cgi?id=[% d.bug_id %]">Bug [% d.bug_id %]</a> depends
      on <a href="[% urlbase %]show_bug.cgi?id=[% d.dep %]">bug [% d.dep %]</a>,
      which changed state.</p>
      <p><a href="[% urlbase %]show_bug.cgi?id=[% d.dep %]">Bug [% d.dep %]</a>
      summary: [% d.short_desc | html %].
  </td></tr>
</table>
<hr color="#A0A0A0" size="1" />
<table class="difft p6" style="border-collapse: collapse" cellpadding="3">
  [% END %]

  [% IF d.login_name != lastwho %]
  [%# ------ <user> Changed <bug> ------ %]
  [% SET lastwho = d.login_name %]
  [% IF !loop.first %]
</table>
<hr color="#A0A0A0" size="1" />
<table class="difft p6" style="border-collapse: collapse" cellpadding="3">
  [% END %]
    <tr><td colspan="3"><a href="[% Param('user_mailto') %][% d.login_name %]">[% d.realname || d.login_name %]</a> changed:</td></tr>
    <tr><th style="text-align: left">What</th><th style="text-align: left">Removed</th><th style="text-align: left">Added</th></tr>
  [% END %]

  [%# ------ What Removed Added ------ %]
  <tr class="n">
  <td valign="top"[% IF d.lines && d.lines.size %] rowspan="[% d.lines.size %]"[% END %]>
  [% IF d.fieldname == 'longdesc' %]
    <a href="[% urlbase %]show_bug.cgi?id=[% bugid %]#c[% d.comment_count %]">
    [% IF d.comment_count > 0 %]Comment #[% d.comment_count %][% ELSE %]Description[% END %]
    </a>
  [% ELSE %]
    [% d.fielddesc %]
  [% END %]
  </td>
  [% IF d.lines && d.lines.size %]
    [% FOR l = d.lines %]
      [% "</tr><tr>" IF loop.index > 0 %]
      [% l %]
    [% END %]
  [% ELSE %]
    <td>[% d.removed %]</td>
    <td>[% d.added %]</td>
  [% END %]
  </tr>

[% END %]
</table>
<hr color="#A0A0A0" size="1" />
[% END %]

<p style="font-size: 12px; font-style: italic; margin-bottom: 0">
<a href="[% urlbase %]userprefs.cgi?tab=email">Configure [% terms.bug %]mail</a><br />
You are receiving this mail because:
</p>
<ul style="font-size: 12px; font-style: italic; margin: 0; padding-left: 2em"><li>
[% FOREACH relationship = reasons %]
  [% SWITCH relationship %]
    [% CASE constants.REL_ASSIGNEE %]
      You are the assignee for the [% terms.bug %].
    [% CASE constants.REL_REPORTER %]
      You reported the [% terms.bug %].
    [% CASE constants.REL_QA %]
      You are the QA contact for the [% terms.bug %].
    [% CASE constants.REL_CC %]
      You are on the CC list for the [% terms.bug %]. <a href="[% urlbase %]unsubscribe.cgi?id=[% bugid %]">Remove yourself from the CC list</a>.
    [% CASE constants.REL_VOTER %]
      You are a voter for the [% terms.bug %].
    [% CASE constants.REL_GLOBAL_WATCHER %]
      You are watching all [% terms.bug %] changes.
  [% END %]
[% END %]
[% IF reasons_watch.size %]</li><li>[% END %]
[% FOREACH relationship = reasons_watch %]
  [% SWITCH relationship %]
    [% CASE constants.REL_ASSIGNEE %]
      You are watching the assignee of the [% terms.bug %].
    [% CASE constants.REL_REPORTER %]
      You are watching the reporter.
    [% CASE constants.REL_QA %]
      You are watching the QA contact of the [% terms.bug %].
    [% CASE constants.REL_CC %]
      You are watching someone on the CC list of the [% terms.bug %].
    [% CASE constants.REL_VOTER %]
      You are watching a voter for the [% terms.bug %].
  [% END %]
[% END %]
</li></ul>
</body>
[% END %]
--[% boundary %]--
