user.html.tmpl 5.79 KB
Newer Older
1 2 3
[%# This Source Code Form is subject to the terms of the Mozilla Public
  # License, v. 2.0. If a copy of the MPL was not distributed with this
  # file, You can obtain one at http://mozilla.org/MPL/2.0/.
4
  #
5 6
  # This Source Code Form is "Incompatible With Secondary Licenses", as
  # defined by the Mozilla Public License, v. 2.0.
7 8
  #%]

9 10 11 12 13 14 15
[%# INTERFACE:
  # voting_user: hash containing a 'login' field
  #
  # products: list of hashes containing details of products relating to
  #           voting: 
  #            name: name of product
  #            bugs: list of bugs the user has voted for
16
  #            bug_ids: list of bug ids the user has voted for
17 18 19 20 21
  #            onevoteonly: one or more votes allowed per bug?
  #            total: users current vote count for the product
  #            maxvotes: max votes allowed for a user in this product
  #            maxperbug: max votes per bug allowed for a user in this product
  #
22
  # this_bug: Bugzilla::Bug; if the user is voting for a bug, this is the bug
23 24
  #
  # canedit: boolean; Should the votes be presented in a form, or readonly? 
25 26
  #
  # all_bug_ids: List of all bug ids the user has voted for, across all products
27 28
  #%]

29
[% IF !header_done %]
30
  [% subheader = voting_user.login FILTER html %]
31 32
  [% IF canedit %]
    [% title = "Change Votes" %]
33
    [% IF this_bug %]
34 35
      [%# We .select and .focus the input so it works for textbox and 
          checkbox %]
36 37
      [% onload = "document.forms['voting_form'].bug_" _ this_bug.id _
                  ".select();document.forms['voting_form'].bug_" _ this_bug.id _
38 39
                  ".focus()" %]
    [% END %]
40 41 42
  [% ELSE %]
    [% title = "Show Votes" %]
  [% END %]
43
  [% PROCESS global/header.html.tmpl
44
             style_urls = [ "extensions/Voting/web/style.css" ] 
45
  %]
46 47 48
[% ELSE %]
  <hr>
[% END %]
49 50 51 52 53 54 55 56 57 58 59 60

[% IF votes_recorded %]
  <p>
    <font color="red">
      The changes to your votes have been saved.
    </font>
  </p>
[% ELSE %]
  <br>
[% END %]

[% IF products.size %]
61
  <form name="voting_form" method="post" action="page.cgi?id=voting/user.html">
62
    <input type="hidden" name="action" value="vote">
63
    <input type="hidden" name="token" value="[% issue_hash_token(['vote']) FILTER html %]">
64 65 66
    <table cellspacing="4">
      <tr>
        <td></td>
67
        <th>Votes</th>
68
        <th>[% terms.Bug %] #</th>
69 70 71
        <th>Summary</th>
      </tr>

72 73
      [% onevoteproduct = 0 %]
      [% multivoteproduct = 0 %]
74
      [% FOREACH product = products %]
75 76 77 78 79
        [% IF product.onevoteonly %]
          [% onevoteproduct = 1 %]
        [% ELSE %]
          [% multivoteproduct = 1 %]
        [% END %]
80 81
        <tr>
          <th>[% product.name FILTER html %]</th>
82
          <td colspan="2" ><a href="buglist.cgi?bug_id=
83
              [%- product.bug_ids.join(",") FILTER uri %]">([% terms.bug %] list)</a>
84 85
          </td>
          <td>
86 87
            [% IF product.maxperbug < product.maxvotes AND
                  product.maxperbug > 1 %]
88
              <font size="-1">
89
                (Note: only [% product.maxperbug FILTER html %] vote
90
                [% "s" IF product.maxperbug != 1 %] allowed per [% terms.bug %] in
91 92
                this product.)
              </font>
93 94
            [% END %]
          </td>
95 96 97
        </tr>

        [% FOREACH bug = product.bugs %]
98
          <tr [% IF bug.id == this_bug.id && canedit %] 
99
            class="bz_bug_being_voted_on" [% END %]>
100 101 102 103 104 105 106 107 108
            <td>
              [% IF bug.id == this_bug.id && canedit %]
                [% IF product.onevoteonly %]
                  Vote For This [% terms.Bug %] &rarr;
                [% ELSE %]
                  Enter Votes Here &rarr;
                [% END %]
              [%- END %]
            </td>
109
            <td align="right"><a name="vote_[% bug.id FILTER html %]">
110
              [% IF canedit %]
111
                [% IF product.onevoteonly %]
112 113
                  <input type="checkbox" name="[% bug.id FILTER html %]" value="1"
                    [% " checked" IF bug.count %] id="bug_[% bug.id FILTER html %]">
114
                [% ELSE %]
115 116
                  <input name="[% bug.id FILTER html %]" value="[% bug.count FILTER html %]"
                         size="2" id="bug_[% bug.id FILTER html %]">
117 118
                [% END %]
              [% ELSE %]
119
                [% bug.count FILTER html %]
120
              [% END %]
121
            </a></td>
122
            <td align="center">
123
              [% bug.id FILTER bug_link(bug) FILTER none %]
124 125
            </td>
            <td>
126
              [% bug.summary FILTER html %]
127
              (<a href="page.cgi?id=voting/bug.html&amp;bug_id=[% bug.id FILTER uri %]">Show Votes</a>)
128
            </td>
129 130 131 132 133
          </tr>
        [% END %]

        <tr>
          <td></td>
134 135
          <td colspan="3">[% product.total FILTER html %] vote
            [% "s" IF product.total != 1 %] used out of [% product.maxvotes FILTER html %]
136 137 138 139 140 141 142 143
            allowed.
            <br>
            <br>
          </td>
        </tr>
      [% END %]
    </table>

144
    [% IF canedit %]
145
      <input type="submit" value="Change My Votes" id="change"> or 
146
      <a href="buglist.cgi?bug_id=[% all_bug_ids.join(",") FILTER uri %]">view all
147
        as [% terms.bug %] list</a>
148 149
      <br>
      <br>
150 151 152 153 154 155 156 157 158
      To change your votes,
      [% IF multivoteproduct %]
        type in new numbers (using zero to mean no votes)
        [% " or " IF onevoteproduct %]
      [% END %]
      [% IF onevoteproduct %]
        change the checkbox
      [% END %]
      and then click <b>Change My Votes</b>.
159
    [% ELSE %]
160
       <a href="buglist.cgi?bug_id=[% all_bug_ids.join(",") FILTER uri %]">View all
161
         as [% terms.bug %] list</a>
162
    [% END %]
163 164 165
  </form>
[% ELSE %]
  <p>
166
    [% IF canedit %]
167 168 169 170
    You are
    [% ELSE %]
    This user is
    [% END %]
171
    currently not voting on any [% terms.bugs %].
172 173 174 175
  </p>
[% END %]

<p>
176
  <a href="page.cgi?id=voting.html">Help with voting</a>.
177 178
</p>

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