1[%# This Source Code Form is subject to the terms of the Mozilla Public
2  # License, v. 2.0. If a copy of the MPL was not distributed with this
3  # file, You can obtain one at http://mozilla.org/MPL/2.0/.
4  #
5  # This Source Code Form is "Incompatible With Secondary Licenses", as
6  # defined by the Mozilla Public License, v. 2.0.
7  #%]
8
9[%# INTERFACE:
10  # queryshare_groups: list of groups the user may share queries with
11  #                    (id, name).
12  # bless_group_ids: list of group ids the user may bless.
13  #%]
14
15[% IF user.can_bless %]
16  <script type="text/javascript"><!--
17    function update_checkbox(group) {
18      var bless_groups = [[% bless_group_ids.join(",") FILTER js %]];
19      var checkbox = document.getElementById(group.name.replace(/share_(\d+)/, "force_$1"));
20
21      if (bz_isValueInArray(bless_groups, group.value)) {
22        YAHOO.util.Dom.removeClass(checkbox.parentNode, "bz_default_hidden");
23      } else {
24        YAHOO.util.Dom.addClass(checkbox.parentNode, "bz_default_hidden");
25        checkbox.checked = false;
26      }
27    } //-->
28  </script>
29[% END %]
30
31<p>あなたの保存された検索は以下のとおりです:</p>
32
33<blockquote>
34  <table border="1" cellpadding="3">
35    <tr>
36      <th>
37        検索名
38      </th>
39      <th>
40        実行
41      </th>
42      <th>
43        編集
44      </th>
45      <th>
46        破棄
47      </th>
48      <th>
49        フッタに表示
50      </th>
51      [% may_share = user.in_group(Param('querysharegroup')) && queryshare_groups.size %]
52      [% IF may_share %]
53        <th>
54          グループ内で共有
55        </th>
56      [% END %]
57    </tr>
58    <tr>
59      <td>わたしの [% terms.Bugs %]</td>
60      <td>
61        [% filtered_username = user.login FILTER uri %]
62        <a href="[% Param('mybugstemplate').replace('%userid%', filtered_username) %]">実行</a>
63      </td>
64      <td>
65        &nbsp;
66      </td>
67      <td>
68        &nbsp;
69      </td>
70      <td align="center">
71        <input type="checkbox"
72               name="showmybugslink"
73               value="1"
74               [% " checked" IF user.showmybugslink %]>
75      </td>
76      [% IF may_share %]
77        <td>
78          &mdash;
79        </td>
80      [% END %]
81    </tr>
82    [% FOREACH q = user.queries %]
83      <tr>
84        <td>[% q.name FILTER html %]</td>
85        <td>
86          <a href="buglist.cgi?cmdtype=dorem&amp;remaction=run&amp;namedcmd=[% q.name FILTER uri %]
87                   [% IF q.shared_with_group.id %]&amp;sharer_id=[% user.id FILTER uri %][% END %]">実行</a>
88        </td>
89        <td>
90          <a href="query.cgi?[% q.edit_link FILTER html %]&amp;known_name=
91                   [% q.name FILTER uri %]">編集</a>
92        </td>
93        <td>
94          [% IF q.used_in_whine %]
95            先に <a href="editwhines.cgi">whine</a> からの削除が必要
96          [% ELSE %]
97            <a href="buglist.cgi?cmdtype=dorem&amp;remaction=forget&amp;namedcmd=
98                     [% q.name FILTER uri %]&amp;token=
99                     [% issue_hash_token([q.id, q.name]) FILTER uri %]">削除</a>
100          [% END %]
101        </td>
102        <td align="center">
103          <input type="checkbox"
104                 name="link_in_footer_[% q.id FILTER html %]"
105                 value="1"
106                 alt="[% q.name FILTER html %]"
107                 [% " checked" IF q.link_in_footer %]>
108        </td>
109        [% IF may_share %]
110          <td>
111            <select name="share_[% q.id FILTER html %]"
112              [% IF user.can_bless %] onchange="update_checkbox(this);"[% END %]>
113              <option value="">非共有</option>
114              [% FOREACH group = queryshare_groups %]
115                <option value="[% group.id %]"
116                        [% ' selected="selected"'
117                           IF q.shared_with_group.id == group.id %]
118                >[% group.name FILTER html %]</option>
119              [% END %]
120            </select>
121            [% IF user.can_bless %]
122              <span [% IF !bless_group_ids.grep("^$q.shared_with_group.id\$").0
123                     %]class="bz_default_hidden"[% END %]>
124                <input type="checkbox" id="force_[% q.id FILTER html %]"
125                       name="force_[% q.id FILTER html %]" value="1">
126                <label for="force_[% q.id FILTER html %]">フッタに追加</label>
127              </span>
128            [% END %]
129            [% IF q.shared_with_users %]
130              ([% q.shared_with_users FILTER html %]
131              [%+ q.shared_with_users > 1 ? "users" : "user" %] と共有)
132            [% END %]
133          </td>
134        [% END %]
135      </tr>
136    [% END %]
137  </table>
138[% IF user.can_bless %]
139  <p>"フッタに追加" が選択されている全ての保存された検索について、
140    変更を保存したそのときからグループのメンバー全員のフッタに表示されます。</p>
141[% END %]
142</blockquote>
143
144[% IF user.queries_available.size %]
145  <p>以下のほかのユーザが保存した検索を共有できます:</p>
146
147  <table border="1" cellpadding="3">
148    <tr>
149      <th>
150        検索名
151      </th>
152      <th>
153        共有者
154      </th>
155      <th>
156        共有対象
157      </th>
158      <th>
159        実行
160      </th>
161      <th>
162        編集
163      </th>
164      <th>
165        フッタに表示
166      </th>
167    </tr>
168    [% FOREACH q = user.queries_available %]
169      <tr>
170        <td>[% q.name FILTER html %]</td>
171        <td>[% q.user.identity FILTER html %]</td>
172        <td>[% q.shared_with_group.name FILTER html %]</td>
173        <td>
174          <a href="buglist.cgi?cmdtype=dorem&amp;remaction=run&amp;namedcmd=
175                   [% q.name FILTER uri %]&amp;sharer_id=
176                   [% q.user.id FILTER uri %]">実行</a>
177        </td>
178        <td>
179          <a href="query.cgi?[% q.edit_link FILTER html %]&amp;known_name=
180                   [% q.name FILTER uri %]">編集</a>
181        </td>
182        <td align="center">
183          <input type="checkbox"
184                 name="link_in_footer_[% q.id FILTER html %]"
185                 value="1"
186                 alt="[% q.name FILTER html %]"
187                 [% " checked" IF q.link_in_footer %]>
188        </td>
189      </tr>
190    [% END %]
191  </table>
192[% ELSE %]
193  <p>あなたが利用可能な他のユーザの共有可能な保存された検索はありません。</p>
194[% END %]
195