[%# 1.0@bugzilla.org %]
[%# 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.
  #
  # Contributor(s): Marc Schumann <wurblzap@gmail.com>
  #%]

[%# INTERFACE:
  #
  # listselectionvalues:      selection values to recreate the current user
  #                           list.
  # editusers:                is viewing user member of editusers?
  # editcomponents:           is viewing user member of editcomponents?
  # otheruser:                Bugzilla::User object of the viewed user.
  # reporter:                 number of bugs reported by the user
  # assignee_or_qa:           number of bugs the user is either the assignee
  #                           or the QA contact
  # bug_activity:             number of bugs the viewed user has activity
  #                           entries on
  # cc                        number of bugs the viewed user is cc list member
  #                           of
  # flags.requestee:          number of flags the viewed user is being asked for
  # flags.setter:             number of flags the viewed user has set
  # longdescs:                number of bug comments the viewed user has written
  # namedqueries:             number of named queries the user has created
  # profiles_activity:        number of named queries the user has created
  # series:                   number of series the viewed user has created
  # votes:                    number of bugs the viewed user has voted on
  # watch.watched:            number of users the viewed user is being watched
  #                           by
  # watch.watcher:            number of users the viewed user is watching
  # whine_events:             number of whine events the viewed user has created
  # whine_schedules:          number of whine schedules the viewed user has
  #                           created
  #%]

[% PROCESS global/header.html.tmpl
  title = "Confirm deletion of user $otheruser.login"
  style_urls = ['skins/standard/admin.css',
                'skins/standard/editusers.css']
%]

[% PROCESS admin/users/listselectvars.html.tmpl
  listselectionvalues = listselectionvalues
%]

[% responsibilityterms = {
  'initialowner'     => 'Default Assignee',
  'initialqacontact' => 'Default QA Contact'
  }
%]

<table class="main">
  <tr>
    <th>Login name:</th>
    <td>[% otheruser.login FILTER html %]</td>
  </tr>
  <tr>
    <th>Real name:</th>
    <td>[% otheruser.name FILTER html %]</td>
  </tr>
  <tr>
    <th>Group set:</th>
    <td>
      [% IF groups.size %]
        <ul>
          [% FOREACH group = otheruser.groups.keys %]
            <li>[% group FILTER html %]</li>
          [% END %]
        </ul>
      [% ELSE %]
        None
      [% END %]
    </td>
  </tr>
  [% IF otheruser.product_responsibilities.size %]
    <tr>
      <th>Product responsibilities:</th>
      <td>
        <ul>
          [% FOREACH component = otheruser.product_responsibilities %]
            <li>
              [% andstring = '' %]
              [% FOREACH responsibility = ['initialowner', 'initialqacontact'] %]
                [% IF component.$responsibility == otheruser.id %]
                  [% andstring %] [% responsibilityterms.$responsibility %]
                  [% andstring = ' and ' %]
                [% END %]
              [% END %]
              for
              [% IF editcomponents %]
                <a href="editcomponents.cgi?action=edit&amp;product=
                         [% component.productname FILTER url_quote %]&amp;component=
                         [% component.componentname FILTER url_quote %]">
              [% END %]
                [%+ component.productname FILTER html %]:
                [% component.componentname FILTER html %]
              [% IF editcomponents %]
                </a>
              [% END %]
            </li>
          [% END %]
        </ul>
      </td>
    </tr>
  [% END %]
</table>

[% IF otheruser.product_responsibilities.size %]
  <p>
    You can't delete this user at this time because
    [%+ otheruser.login FILTER html %] has got responsibilities for at least
    one product.
  </p>
  <p>
    [% IF editcomponents %]
      Change this by clicking the product editing links above,
    [% ELSE %]
      For now, you can
    [% END %]
[% ELSE %]

  <h2>Confirmation</h2>

  [% IF reporter || assignee_or_qa || bug_activity || cc || flags.requestee ||
        flags.setter || longdescs || namedqueries || profiles_activity || series ||
        votes || watch.watched || watch.watcher || whine_events || whine_schedules %]
    <ul class="warningmessages">
      [% IF reporter %]
        <li>
          [% otheruser.login FILTER html %]
          <a href="buglist.cgi?emailreporter1=1&amp;emailtype1=exact&amp;email1=[% otheruser.login FILTER url_quote %]">has reported
          [% IF reporter == 1 %]
            one [% terms.bug %]
          [% ELSE %]
            [%+ reporter %] [%+ terms.bugs %]
          [% END %]</a>.
          If you delete the user account, the [% terms.bugs %] table in the
          database will be inconsistent, resulting in
          [% IF reporter == 1 %]
            this [% terms.bug %]
          [% ELSE %]
            these [% terms.bugs %]
          [% END %]
          not appearing in [% terms.bug %] lists any more.
        </li>
      [% END %]
      [% IF assignee_or_qa %]
        <li>
          [% otheruser.login FILTER html %]
          <a href="buglist.cgi?emailassigned_to1=1&amp;emailqa_contact1=1&amp;emailtype1=exact&amp;email1=[% otheruser.login FILTER url_quote %]">is
          the assignee or the QA contact of
          [% IF assignee_or_qa == 1 %]
            one [% terms.bug %]
          [% ELSE %]
            [%+ assignee_or_qa %] [%+ terms.bugs %]
          [% END %]</a>.
          If you delete the user account, these roles will fall back to
          the default assignee or default QA contact.
        </li>
      [% END %]
      [% IF bugs_activity %]
        <li>
          [% otheruser.login FILTER html %] has made
          [% IF bugs_activity == 1 %]
            a change on [% terms.abug %]
          [% ELSE %]
            changes on [% terms.bugs %]
          [% END %].
          If you delete the user account, the [% terms.bugs %] activity table in
          the database will be inconsistent, resulting in
          [% IF bugs_activity == 1 %]
            this change
          [% ELSE %]
            these changes
          [% END %]
          not showing up in [% terms.bug %] activity logs any more.
        </li>
      [% END %]
      [% IF cc %]
        <li>
          [% otheruser.login FILTER html %]
          <a href="buglist.cgi?emailcc1=1&amp;emailtype1=exact&amp;email1=[% otheruser.login FILTER url_quote %]">is
          on the CC list of
          [% IF cc == 1 %]
            [%+ terms.abug %]
          [% ELSE %]
            [%+ cc %] [%+ terms.bugs %]
          [% END %]</a>.
          If you delete the user account, it will be removed from these CC
          lists.
        </li>
      [% END %]
      [% IF flags.requestee %]
        <li>
          [% otheruser.login FILTER html %] has been
          <a href="buglist.cgi?field0-0-0=requestees.login_name&amp;type0-0-0=equals&amp;value0-0-0=[% otheruser.login FILTER url_quote %]">asked
          to set
          [% IF flags.requestee == 1 %]
            a flag
          [% ELSE %]
            [% flags.requestee %] flags
          [% END %]</a>.
          If you delete the user account,
          [% IF flags.requestee == 1 %]
            this flag
          [% ELSE %]
            these flags
          [% END %]
          will change to be unspecifically requested.
        </li>
      [% END %]
      [% IF flags.setter %]
        <li>
          [% otheruser.login FILTER html %] has
          <a href="buglist.cgi?field0-0-0=setters.login_name&amp;type0-0-0=equals&amp;value0-0-0=[% otheruser.login FILTER url_quote %]">set
          or requested
          [% IF flags.setter == 1 %]
            a flag
          [% ELSE %]
            [%+ flags.setter %] flags
          [% END %]</a>.
          If you delete the user account, the flags table in the database
          will be inconsistent, resulting in
          [% IF flags.setter == 1 %]
            this flag
          [% ELSE %]
            these flags
          [% END %]
          not displaying correctly any more.
        </li>
      [% END %]
      [% IF longdescs %]
        <li>
          [% otheruser.login FILTER html %] has
          <a href="buglist.cgi?emaillongdesc1=1&amp;emailtype1=exact&amp;email1=[% otheruser.login FILTER url_quote %]">commented
          [% IF longdescs == 1 %]
            once on [% terms.abug %]
          [% ELSE %]
            [%+ longdescs %] times on [% terms.bugs %]
          [% END %]</a>.
          If you delete the user account, the comments table in the database
          will be inconsistent, resulting in
          [% IF longdescs == 1 %]
            this comment
          [% ELSE %]
            these comments
          [% END %]
          not being visible any more.
        </li>
      [% END %]
      [% IF namedqueries %]
        <li>
          [% otheruser.login FILTER html %]
          has
          [% IF namedqueries == 1 %]
            a named query
          [% ELSE %]
            [%+ namedqueries %] named queries
          [% END %].
          [% IF namedqueries == 1 %]
            This named query
          [% ELSE %]
            These named queries
          [% END %]
          will be deleted along with the user account.
        </li>
      [% END %]
      [% IF profiles_activity %]
        <li>
          [% otheruser.login FILTER html %] has made
          [% IF bugs_activity == 1 %]
            a change on a other user's profile
          [% ELSE %]
            changes on other users' profiles
          [% END %].
          If you delete the user account, the user profiles activity table in
          the database will be inconsistent.
        </li>
      [% END %]
      [% IF series %]
        <li>
          [% otheruser.login FILTER html %] has created
          [% IF series == 1 %]
            a series
          [% ELSE %]
            [%+ series %] series
          [% END %].
          [% IF series == 1 %]
            This series
          [% ELSE %]
            These series
          [% END %]
          will be deleted along with the user account.
        </li>
      [% END %]
      [% IF votes %]
        <li>
          [% otheruser.login FILTER html %] has voted on
          [% IF votes == 1 %]
            [%+ terms.abug %]
          [% ELSE %]
            [%+ votes %] [%+ terms.bugs %]
          [% END %].
          If you delete the user account,
          [% IF votes == 1 %]
            this vote
          [% ELSE %]
            these votes
          [% END %]
          will be deleted along with the user account.
        </li>
      [% END %]
      [% IF watch.watched || watch.watcher %]
        <li>
          [% otheruser.login FILTER html %]
          [% IF watch.watched %]
            is being watched by
            [% IF watch.watched == 1 %]
              a user
            [% ELSE %]
              [%+ watch.watched %] users
            [% END %]
          [% END %]
          [% IF watch.watcher %]
            [%+ 'and' IF watch.watched %]
            watches
            [% IF watch.watcher == 1 %]
              a user
            [% ELSE %]
              [%+ watch.watcher %] users
            [% END %]
          [% END %].
          [% IF watch.watched + watch.watcher == 1 %]
            This watching
          [% ELSE %]
            These watchings
          [% END %]
          will cease along with the deletion of the user account.
        </li>
      [% END %]
      [% IF whine_events || whine_schedules %]
        <li>
          [% otheruser.login FILTER html %]
          [% IF whine_events %]
            has scheduled
            [% IF whine_events == 1 %]
              a whine
            [% ELSE %]
              [%+ whine_events %] whines
            [% END %]
          [% END %]
          [% IF whine_schedules %]
            [%+ 'and' IF whine_events %]
            is on the receiving end of
            [% IF whine_schedules == 1 %]
              a whine
            [% ELSE %]
              [%+ whine_schedules %] whines
            [% END %]
          [% END %].
          [% IF whine_events + whine_schedules == 1 %]
            This whine
          [% ELSE %]
            These whines
          [% END %]
          will be deleted along with the user account.
        </li>
      [% END %]
    </ul>
    <p class="areyoureallyreallysure">
      Please be aware of the consequences of this before continuing.
    </p>
  [% END %]

  <p>Do you really want to delete this user account?</p>

  <form method="post" action="editusers.cgi">
    <p>
      <input type="submit" value="Yes, delete" />
      <input type="hidden" name="action" value="delete" />
      <input type="hidden" name="userid" value="[% otheruser.id %]" />
      [% INCLUDE listselectionhiddenfields %]
    </p>
  </form>

  <p>If you do not want to delete the user account at this time,
[% END %]

  <a href="editusers.cgi?action=edit&amp;userid=[% otheruser.id %]
           [% INCLUDE listselectionurlparams %]">edit the user</a>,
  go
 <a href="editusers.cgi?action=list[% INCLUDE listselectionurlparams %]">back
  to the user list</a>,
  [% IF editusers %]
    <a href="editusers.cgi?action=add[% INCLUDE listselectionurlparams %]">add
    a new user</a>,
  [% END %]
  or <a href="editusers.cgi">find other users</a>.
</p>

[% PROCESS global/footer.html.tmpl %]
