summaryrefslogtreecommitdiffstats
path: root/template/en/default/global/header.html.tmpl
blob: 1ea652c10ac06c868cda49594f72d671b3de2218 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
[%# 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>
  #                 Vaskin Kissoyan <vkissoyan@yahoo.com>
  #                 Vitaly Harisov <vitaly@rathedg.com>
  #                 Svetlana Harisova <light@rathedg.com>
  #%]

[%# INTERFACE:
  # (All the below interface elements are optional.)
  # title: string. Page title.
  # header: string. Main page header.
  # subheader: string. Page subheader.
  # header_addl_info: string. Additional header information.
  # bodyclasses: array of extra CSS classes for the <body>
  # onload: string. JavaScript code to run when the page finishes loading.
  # javascript: string. Javascript to go in the header.
  # javascript_urls: list. List of URLs to Javascript.
  # style: string. CSS style.
  # style_urls: list. List of URLs to CSS style sheets.
  # message: string. A message to display to the user. May contain HTML.
  # atomlink: Atom link URL, May contain HTML
  # generate_api_token: generate a token which can be used to make authenticated webservice calls
  # no_body: if true the body element will not be generated
  # allow_mobile: allow special CSS and viewport for detected mobile useragents
  # use_login_page: display a link to the full login page, rather than an inline login.
  # no_index: Disable search engine from adding page into search index.
  #%]

[% IF message %]
  [% PROCESS global/messages.html.tmpl %]
[% END %]

[% DEFAULT
  subheader = ""
  header_addl_info = ""
  onload = ""
  style_urls = []
  no_yui = 0
  jquery = []
  jquery_css = []
  generate_api_token = 0
  no_index = 1
%]

[%# These are JS URLs that are *always* on the page and come before
  # every other JS URL.
  #%]
[% SET starting_js_urls = [
  "js/jquery/jquery-min.js",
  "js/jquery/ui/jquery-ui-min.js"
] %]

[% IF NOT no_yui %]
  [% starting_js_urls.push("js/yui.js") %]
[% END %]

[% SET jq_css_urls = [
  "js/jquery/ui/jquery-ui-min.css",
  "js/jquery/ui/jquery-ui-structure-min.css",
  "js/jquery/ui/jquery-ui-theme-min.css",
] %]
[% style_urls.import(jquery_css, jq_css_urls) FILTER null %]

[%# Add our required jQuery plugins %]
[% jquery.push("cookie", "devbridgeAutocomplete") %]

[% IF allow_mobile && is_mobile_browser %]
  [% style_urls.push("skins/standard/mobile.css") %]
[% END %]

[%# We should be able to set the default value of the header variable
  # to the value of the title variable using the DEFAULT directive,
  # but that doesn't work if a caller sets header to the empty string
  # to avoid header inheriting the value of title, since DEFAULT
  # mistakenly treats empty strings as undefined and gives header the
  # value of title anyway.  To get around that problem we explicitly
  # set header's default value here only if it is undefined. %]
[% IF !header.defined %][% header = title %][% END %]
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
                      "http://www.w3.org/TR/html4/loose.dtd">
<html lang="en">
  <head>
    [%- js_BUGZILLA = {
            param => {
                cookiepath => Param('cookiepath'),
                maxusermatches => Param('maxusermatches'),
            },
            constant => {
                COMMENT_COLS => constants.COMMENT_COLS,
            },
            string => {
                # Please keep these in alphabetical order.
                attach_desc_required =>
                    'You must enter a Description for this attachment.',
                component_required =>
                    "You must select a Component for this $terms.bug",
                description_required =>
                    "You must enter a Description for this $terms.bug",
                short_desc_required =>
                    "You must enter a Summary for this $terms.bug",
                version_required =>
                    "You must select a Version for this $terms.bug"
            }
        };
    %]
    [% Hook.process("start") %]
    [%
       IF generate_api_token;
        js_BUGZILLA.api_token = get_api_token();
       END;
    %]

    <meta name="bugzilla-global" content="dummy"
        id="bugzilla-global" data-bugzilla="[% json_encode(js_BUGZILLA) FILTER html %]">
    <title>[% title %]</title>

    [% IF Param('utf8') %]
      <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
    [% END %]

    [% IF no_index %]
      <meta name="robots" content="noindex" />
    [% END %]

    [% PROCESS "global/site-navigation.html.tmpl" %]

    [% PROCESS 'global/setting-descs.none.tmpl' %]

    [% SET css_sets = css_files(style_urls.unique, no_yui) %]
    [% IF constants.CONCATENATE_ASSETS %]
      [% PROCESS format_css_link asset_url = css_sets.unified_standard_skin %]
    [% ELSE %]
      [% FOREACH asset_url = css_sets.standard %]
        [% PROCESS format_css_link %]
      [% END %]
      [% FOREACH asset_url = css_sets.skin %]
        [% PROCESS format_css_link %]
      [% END %]
    [% END %]

    [% IF style %]
      <style type="text/css">
        [% style %]
      </style>
    [% END %]

    [% IF css_sets.unified_custom %]
      [% IF constants.CONCATENATE_ASSETS %]
        [% PROCESS format_css_link asset_url = css_sets.unified_custom %]
      [% ELSE %]
        [% FOREACH asset_url = css_sets.custom %]
          [% PROCESS format_css_link %]
        [% END %]
      [% END %]
    [% END %]

    [%# jQuery Plugins %]
    [% FOREACH jq_name = jquery.unique %]
      [% starting_js_urls.push("js/jquery/plugins/$jq_name/${jq_name}-min.js") %]
    [% END %]
    [% starting_js_urls.push('js/global.js') %]

    [% FOREACH asset_url = concatenate_js(starting_js_urls) %]
      [% PROCESS format_js_link %]
    [% END %]

    [% inline_javascript = BLOCK %]
        [% IF NOT no_yui %]
          YAHOO.namespace('bugzilla');
          if ( "onpagehide" in window || YAHOO.env.ua.gecko) {
              YAHOO.util.Event._simpleRemove(window, "unload",
                                             YAHOO.util.Event._unload);
          }
          [% INCLUDE 'global/value-descs.js.tmpl' %]
        [% END %]

        [% IF javascript %]
          [% javascript %]
        [% END %]
    [% END %]
    [% IF inline_javascript.search("\\S") %]
      <script [% script_nonce FILTER none %]>
        [% inline_javascript FILTER none %]
      </script>
    [% END %]

    [% FOREACH asset_url = concatenate_js(javascript_urls) %]
      [% PROCESS format_js_link %]
    [% END %]

    [%# this puts the live bookmark up on firefox for the Atom feed %]
    [% IF atomlink %]
       <link rel="alternate"
             type="application/atom+xml" title="Atom feed"
             href="[% atomlink FILTER html %]">
    [% END %]

    [%# Required for the 'Autodiscovery' feature in Firefox 2 and IE 7. %]
    <link rel="search" type="application/opensearchdescription+xml"
                       title="[% terms.BugzillaTitle %]" href="./search_plugin.cgi">
    [% IF allow_mobile && is_mobile_browser %]
      <meta name="viewport" content="width=device-width, initial-scale=1">
    [% END %]
    <meta name="referrer" content="origin-when-crossorigin">
    [% Hook.process("additional_header") %]
  </head>

[% RETURN IF no_body %]

[%# Migration note: contents of the old Param 'bodyhtml' go in the body tag,
  # but set the onload attribute in the DEFAULT directive above.
  #%]
  [% IF onload %]
  <script [% script_nonce FILTER none %]>
  $(function() { [% onload %] });
  </script>
  [% END %]
  <body
        class="[% urlbase.replace('^https?://','').replace('/$','').replace('[-~@:/.]+','-') FILTER css_class_quote %]
               skin-[% user.settings.skin.value FILTER css_class_quote %]
               [% IF Bugzilla.request_cache.mfa_warning %]
                mfa-warning
               [% END %]
               [% FOREACH class = bodyclasses %]
                 [% ' ' %][% class FILTER css_class_quote %]
               [% END %] yui-skin-sam">

[%# Migration note: the following file corresponds to the old Param
  # 'bannerhtml'
  #%]

<div id="header">

  <div class="wrapper">
    <table border="0" cellspacing="0" cellpadding="0" id="titles">
    <tr>
      <td id="title">
        <a href="./" title="Home">[% terms.BugzillaTitle %]</a>
      </td>
      <td>
        [% Hook.process("message") %]
        [% IF Bugzilla.request_cache.mfa_warning
              AND user.mfa_required_date
              AND NOT Bugzilla.request_cache.on_mfa_page %]
          <span id="mfa-warning">
            Please <a href="userprefs.cgi?tab=mfa">enabled two-factor authentication</a>
            [% IF Param('mfa_group_grace_period') %]
              before <i>[% user.mfa_required_date FILTER time %]</i>.
            [% ELSE %]
              now.
            [% END %]
          </span>
        [% END %]
      </td>
      <td id="moz_login">
        [% IF user.id %]
          <ul class="links">
            <li class="dropdown">
              <span class="anchor">[% user.login FILTER html %]</span>
              <ul>
                [% IF user.showmybugslink %]
                  [% filtered_username = user.login FILTER uri %]
                  <li><a href="[% Param('mybugstemplate').replace('%userid%', filtered_username) %]">My [% terms.Bugs %]</a></li>
                [% END %]
                <li><a href="page.cgi?id=mydashboard.html">My Dashboard</a></li>
                <li><a href="user_profile">My Profile</a></li>
                <li><a href="page.cgi?id=user_activity.html&amp;action=run&amp;who=[% user.login FILTER uri %]">My Activity</a></li>
                <li><a href="request.cgi?requester=[% user.login FILTER uri %]&amp;requestee=[% user.login FILTER uri %]&amp;do_union=1&amp;group=type&amp;action=queue">My Requests</a></li>
                <li><a href="userprefs.cgi">Preferences</a></li>
                [% IF user.in_group('tweakparams') || user.in_group('editusers') || user.can_bless
                      || (Param('useclassification') && user.in_group('editclassifications'))
                      || user.in_group('editcomponents') || user.in_group('admin') || user.in_group('creategroups')
                      || user.in_group('editkeywords') || user.in_group('bz_canusewhines')
                      || user.get_products_by_permission("editcomponents").size %]
                  <li><a href="admin.cgi">Administration</a></li>
                [% END %]
                [% IF user.authorizer.can_logout %]
                  <li><a href="index.cgi?logout=1">Log&nbsp;out</a></li>
                [% END %]
                [% IF sudoer %]
                  <li>
                    <a href="relogin.cgi?action=end-sudo">End sudo session impersonating [% user.login FILTER html %]</a>
                  </li>
                [% END %]
              </ul>
            </li>
          </ul>
        [% ELSE %]
          <ul class="login-links">
            [% IF Param('createemailregexp')
                  && user.authorizer.user_can_create_account %]
              <li id="moz_new_account_container_top"><a href="createaccount.cgi">New&nbsp;Account</a>
                [% IF use_login_page %] <span class="separator">| </span> [% END %]
              </li>
            [% END %]

            [% IF use_login_page %]
              <li>
                <a href="[% urlbase FILTER html %]login">Log In</a>
              </li>
            [% ELSE %]
                [%# Only display one login form when we're on a LOGIN_REQUIRED page. That
                # way, we're guaranteed that the user will use the form that has
                # hidden_fields in it (the center form) instead of this one. Also, it's
                # less confusing to have one form (as opposed to  three) when you're
                # required to log in.
                #%]
                [% IF user.authorizer.can_login && !Bugzilla.page_requires_login %]
                  [% PROCESS "account/auth/login-small.html.tmpl" qs_suffix = "_top" %]
                [% END %]
            [% END %]
          </ul>
        [% END %]
      </td>
      <td id="moz_tab">
        <a href="https://www.mozilla.org/" title="Mozilla - Home of the Mozilla Project">
          <img src="images/tabzilla.png" border="0" height="42" width="154"></a>
      </td>
    </tr>
    </table>

    [%# display the version number on the index page %]
    [% IF title == "$terms.Bugzilla Main Page" %]
      <div id="bugzilla_version">
        [% header_addl_info FILTER html %]
      </div>
    [% END %]

    [% PROCESS "global/common-links.html.tmpl" qs_suffix = "_top" %]

  </div>
</div> [%# header %]

<div id="bugzilla-body">

[%# in most cases the "header" variable provides redundant information, however
  # there are exceptions where not displaying this text is problematic. %]
[% IF template.name.match('^attachment/')
      && !header.match('^Bug&nbsp;\d+$') %]
  <h2>[% header FILTER none %]</h2>
[% END %]

[% IF Param('announcehtml') %]
[% Param('announcehtml') FILTER none %]
[% END %]

[% IF message %]
  <div id="message">[% message %]</div>
[% END %]

[% BLOCK format_css_link %]
  <link href="[% asset_url FILTER html %]" rel="stylesheet" type="text/css">
[% END %]

[% BLOCK format_js_link %]
  <script [% script_nonce FILTER none %] type="text/javascript" src="[% asset_url FILTER mtime FILTER html %]"></script>
[% END %]