user.html.tmpl 5.92 KB
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20
[%# 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): Gervase Markham <gerv@gerv.net>
  #%]

21 22 23 24 25 26 27
[%# 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
28
  #            bug_ids: list of bug ids the user has voted for
29 30 31 32 33
  #            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
  #
34
  # this_bug: Bugzilla::Bug; if the user is voting for a bug, this is the bug
35 36
  #
  # canedit: boolean; Should the votes be presented in a form, or readonly? 
37 38
  #
  # all_bug_ids: List of all bug ids the user has voted for, across all products
39 40
  #%]

41 42
[% PROCESS global/variables.none.tmpl %]

43
[% IF !header_done %]
44
  [% subheader = voting_user.login FILTER html %]
45 46
  [% IF canedit %]
    [% title = "Change Votes" %]
47
    [% IF this_bug %]
48 49
      [%# We .select and .focus the input so it works for textbox and 
          checkbox %]
50 51
      [% onload = "document.forms['voting_form'].bug_" _ this_bug.id _
                  ".select();document.forms['voting_form'].bug_" _ this_bug.id _
52 53
                  ".focus()" %]
    [% END %]
54 55 56
  [% ELSE %]
    [% title = "Show Votes" %]
  [% END %]
57
  [% PROCESS global/header.html.tmpl
58
             style_urls = [ "extensions/Voting/web/style.css" ] 
59
  %]
60 61 62
[% ELSE %]
  <hr>
[% END %]
63 64 65 66 67 68 69 70 71 72 73 74

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

[% IF products.size %]
75
  <form name="voting_form" method="post" action="page.cgi?id=voting/user.html">
76 77 78 79
    <input type="hidden" name="action" value="vote">
    <table cellspacing="4">
      <tr>
        <td></td>
80
        <th>Votes</th>
81
        <th>[% terms.Bug %] #</th>
82 83 84
        <th>Summary</th>
      </tr>

85 86
      [% onevoteproduct = 0 %]
      [% multivoteproduct = 0 %]
87
      [% FOREACH product = products %]
88 89 90 91 92
        [% IF product.onevoteonly %]
          [% onevoteproduct = 1 %]
        [% ELSE %]
          [% multivoteproduct = 1 %]
        [% END %]
93 94
        <tr>
          <th>[% product.name FILTER html %]</th>
95 96 97 98
          <td colspan="2" ><a href="buglist.cgi?bug_id=
              [%- product.bug_ids.join(",") FILTER url_quote %]">([% terms.bug %] list)</a>
          </td>
          <td>
99 100
            [% IF product.maxperbug < product.maxvotes AND
                  product.maxperbug > 1 %]
101 102
              <font size="-1">
                (Note: only [% product.maxperbug %] vote
103
                [% "s" IF product.maxperbug != 1 %] allowed per [% terms.bug %] in
104 105
                this product.)
              </font>
106 107
            [% END %]
          </td>
108 109 110
        </tr>

        [% FOREACH bug = product.bugs %]
111
          <tr [% IF bug.id == this_bug.id && canedit %] 
112
            class="bz_bug_being_voted_on" [% END %]>
113
            <td>[% IF bug.id == this_bug.id && canedit %]Enter New Vote here &rarr;
114 115
              [%- END %]</td>
            <td align="right"><a name="vote_[% bug.id %]">
116
              [% IF canedit %]
117 118
                [% IF product.onevoteonly %]
                  <input type="checkbox" name="[% bug.id %]" value="1"
119
                    [% " checked" IF bug.count %] id="bug_[% bug.id %]">
120
                [% ELSE %]
121
                  <input name="[% bug.id %]" value="[% bug.count %]"
122
                         size="2" id="bug_[% bug.id %]">
123 124 125 126
                [% END %]
              [% ELSE %]
                [% bug.count %]
              [% END %]
127
            </a></td>
128
            <td align="center">
129
              [% bug.id FILTER bug_link(bug) FILTER none %]
130 131
            </td>
            <td>
132
              [% bug.summary FILTER html %]
133
              (<a href="page.cgi?id=voting/bug.html&amp;bug_id=[% bug.id %]">Show Votes</a>)
134
            </td>
135 136 137 138 139 140 141 142 143 144 145 146 147 148 149
          </tr>
        [% END %]

        <tr>
          <td></td>
          <td colspan="3">[% product.total %] vote
            [% "s" IF product.total != 1 %] used out of [% product.maxvotes %]
            allowed.
            <br>
            <br>
          </td>
        </tr>
      [% END %]
    </table>

150
    [% IF canedit %]
151 152 153
      <input type="submit" value="Change My Votes" id="change"> or 
      <a href="buglist.cgi?bug_id=[% all_bug_ids.join(",") FILTER url_quote %]">view all
        as [% terms.bug %] list</a>
154 155
      <br>
      <br>
156 157 158 159 160 161 162 163 164
      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>.
165 166 167
    [% ELSE %]
       <a href="buglist.cgi?bug_id=[% all_bug_ids.join(",") FILTER url_quote %]">View all
         as [% terms.bug %] list</a>
168
    [% END %]
169 170 171
  </form>
[% ELSE %]
  <p>
172
    [% IF canedit %]
173 174 175 176
    You are
    [% ELSE %]
    This user is
    [% END %]
177
    currently not voting on any [% terms.bugs %].
178 179 180 181
  </p>
[% END %]

<p>
182
  <a href="page.cgi?id=voting.html">Help with voting</a>.
183 184
</p>

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