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  # tabs: List of hashes. May not be empty. Each hash has three members:
11  #   name: string. Name of the tab (used internally.)
12  #   description: string. Description of the tab (used in tab title).
13  #   saveable: boolean. True if tab has a form which can be submitted.
14  #               True if user is not receiving self-generated mail.
15  # Note: For each tab name, a template "prefs/${tab.name}.tmpl" must exist,
16  # and its interface must be fulfilled.
17  # current_tab: A direct reference to one of the hashes in the tabs list.
18  #              This tab will be displayed.
19  # changes_saved: boolean/string. True if the CGI processed form data before
20  #                displaying anything, and can contain an optional custom
21  #                message if required (which Perl still evaluates as True).
22  # dont_show_button: boolean. Prevent the display of the "Submit Changes" button.
23  #%]
24
25[% filtered_login = user.login FILTER html %]
26
27[% tabs = [{ name => "settings", label => "一般的な設定",
28              link => "userprefs.cgi?tab=settings", saveable => "1",
29              doc_section => "using/preferences.html#general-preferences" },
30            { name => "email", label => "メール設定",
31              link => "userprefs.cgi?tab=email", saveable => "1",
32              doc_section => "using/preferences.html#email-preferences" },
33            { name => "saved-searches", label => "保存された検索",
34              link => "userprefs.cgi?tab=saved-searches", saveable => "1",
35              doc_section => "using/preferences.html#saved-searches" },
36            { name => "account", label => "アカウント情報",
37              link => "userprefs.cgi?tab=account", saveable => "1",
38              doc_section => "using/preferences.html#account-information" },
39            { name => "apikey", label => "API キー",
40              link => "userprefs.cgi?tab=apikey", saveable => "1",
41              doc_section => "using/preferences.html#api-keys" },
42            { name => "permissions", label => "権限",
43              link => "userprefs.cgi?tab=permissions", saveable => "0",
44              doc_section => "using/preferences.html#permissions" } ] %]
45
46[% Hook.process('tabs') %]
47
48[% FOREACH tab IN tabs %]
49  [% IF tab.name == current_tab_name %]
50    [% current_tab = tab %]
51    [% LAST %]
52  [% END %]
53[% END %]
54
55[% PROCESS global/header.html.tmpl
56   title = current_tab.label
57   subheader = filtered_login
58   generate_api_token = 1
59   style_urls = ['skins/standard/admin.css']
60   javascript_urls = ['js/util.js', 'js/field.js', 'js/TUI.js']
61   doc_section = current_tab.doc_section
62   yui = ['autocomplete']
63 %]
64
65[% WRAPPER global/tabs.html.tmpl
66   tabs        = tabs
67   current_tab = current_tab
68%]
69
70[% IF changes_saved %]
71  <div id="message">
72    あなたの [% current_tab.label FILTER lower %] への変更は保存されました。
73
74    [% IF email_changes_saved %]
75      <p>
76        あなたの要求を確認するために、新アドレスにメールを送信しています。
77        また、必要ならキャンセルできるように旧アドレスにもメールが送信されて
78        います。
79        もしメールを受信できなかった場合、必要であれば (特に新しいメールアドレス
80        を入力間違えた場合)
81        <a href="token.cgi?t=[% email_token FILTER uri %]&amp;a=cxlem">
82        メールアドレスの変更をキャンセル</a> できます。
83      </p>
84    [% END %]
85  </div>
86[% END %]
87
88<h3>[% current_tab.label %]</h3>
89
90[% IF current_tab.saveable %]
91  <form name="userprefsform" method="post" action="userprefs.cgi">
92    <input type="hidden" name="tab" value="[% current_tab.name %]">
93    <input type="hidden" name="token" value="[% token FILTER html %]">
94[% END %]
95
96[% PROCESS "account/prefs/${current_tab.name}.html.tmpl"
97                                     IF current_tab.name.defined %]
98
99[% IF current_tab.saveable %]
100    <input type="hidden" name="dosave" value="1">
101
102    [% UNLESS dont_show_button %]
103      <p>
104            <input type="submit" id="update" value="変更を保存">
105      </p>
106    [% END %]
107  </form>
108[% END %]
109
110[% END %]
111
112[% PROCESS global/footer.html.tmpl %]
113