summaryrefslogtreecommitdiffstats
path: root/template/en/default/global/header.html.tmpl
blob: 6a52e7840425a97f366d3830a8bcc3a08f759456 (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
[%# 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/.
  #
  # This Source Code Form is "Incompatible With Secondary Licenses", as
  # defined by the Mozilla Public License, v. 2.0.
  #%]

[%# 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
  #%]

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

[% DEFAULT
  subheader = ""
  header_addl_info = ""
  onload = ""
  style_urls = []
  javascript_urls = []
  yui = []
  yui_css = {}
  yui_deps = {}
  no_yui = 0
  jquery = []
  jquery_css = []
  generate_api_token = 0
%]

[% IF NOT no_yui %]
  [% SET yui_css = {
    datatable    => 1,
    button       => 1,
  } %]

  [%# Note: This is simple dependency resolution--you can't have dependencies
    # that depend on each other. You have to specify all of a module's deps,
    # if that module is going to be specified in "yui".
    #%]
  [% SET yui_deps = {
    datatable => ['json', 'connection', 'datasource', 'element'],
  } %]

  [%# When using certain YUI modules, we need to process certain
    # extra JS templates.
    #%]
  [% SET yui_templates = {
    datatable => ['global/value-descs.js.tmpl'],
  } %]
[% END %]

[%# 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/yahoo-dom-event/yahoo-dom-event.js",
                           "js/yui/cookie/cookie-min.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",
] %]

[% FOREACH jq_name = jquery_css %]
  [% style_urls.push("js/jquery/plugins/$jq_name/${jq_name}-min.css") %]
[% END %]
[% style_urls.import(jq_css_urls) FILTER null %]

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

[%# 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>
<html lang="en">
  <head>
    [% Hook.process("start") %]
    <title>[% title %]</title>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">

    [% IF NOT no_yui %]
      [% SET yui = yui_resolve_deps(yui, yui_deps) %]
    [% END %]

    [% SET css_sets = css_files(style_urls, yui, yui_css) %]
    [% 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 %]

    [% IF NOT no_yui %]
      [%# YUI Scripts %]
      [% FOREACH yui_name = yui %]
        [% starting_js_urls.push("js/yui/$yui_name/${yui_name}-min.js") %]
      [% END %]
    [% END %]

    [%# jQuery Plugins %]
    [% FOREACH jq_name = jquery %]
      [% 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 %]

    <script type="text/javascript">
    <!--
        [% IF NOT no_yui %]
          YAHOO.namespace('bugzilla');
          YAHOO.util.Event.addListener = function (el, sType, fn, obj, overrideContext) {
              if ( ("onpagehide" in window || YAHOO.env.ua.gecko) && sType === "unload") { sType = "pagehide"; };
              var capture = ((sType == "focusin" || sType == "focusout") && !YAHOO.env.ua.ie) ? true : false;
              return this._addListener(el, this._getType(sType), fn, obj, overrideContext, capture);
          };
          if ( "onpagehide" in window || YAHOO.env.ua.gecko) {
              YAHOO.util.Event._simpleRemove(window, "unload",
                                             YAHOO.util.Event._unload);
          }
        [% END %]

        [%# The language selector needs javascript to set its cookie,
          # so it is hidden in HTML/CSS by the "bz_default_hidden" class.
          # If the browser can run javascript, it will then "unhide"
          # the language selector using the following code.
          #%]
        function unhide_language_selector() {
            $('#lang_links_container').removeClass('bz_default_hidden');
        } 
        $(document).ready(unhide_language_selector);

        // This sets the default parameters for all calendar fields.
        $.datepicker.setDefaults({
            dateFormat: "yy-mm-dd", // this is the YYYY-MM-DD format
            showButtonPanel: true,  // permits to easily select "Today"
            // These 3 parameters are useful for localization.
            firstDay: 0,            // 0 = Sunday, 1 = Monday, etc...
            dayNamesMin: [ "Su", "Mo", "Tu", "We", "Th", "Fr", "Sa" ],
            monthNames: [ "January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December" ]
        });

        [%# Make some Bugzilla information available to all scripts. 
          # We don't import every parameter and constant because we
          # don't want to add a lot of uncached JS to every page. 
          #%]
        var BUGZILLA = {
            param: {
                maxusermatches: [% Param('maxusermatches') FILTER js %]
            },
            constant: {
                COMMENT_COLS: [% constants.COMMENT_COLS FILTER js %]
            },
            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 %]."
            }
            [% IF generate_api_token %]
              , api_token: '[% get_api_token FILTER js FILTER html %]'
            [% END %]
        };

        [% IF NOT no_yui %]
          [% FOREACH yui_name = yui %]
            [% FOREACH yui_template = yui_templates.$yui_name %]
              [% INCLUDE $yui_template %]
            [% END %]
          [% END %]
        [% END %]

        [% IF javascript %]
          [% javascript %]
        [% END %]
    // -->
    </script>

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

    [%# IE8 doesn't understand these HTML5 elements. So we have to declare them here. %]
    <!--[if lt IE 9]>
      <script>
        document.createElement('header');
        document.createElement('nav');
        document.createElement('main');
        document.createElement('footer');
      </script>
    <![endif]-->

    [%# 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.Bugzilla %]" href="./search_plugin.cgi">
    <link rel="shortcut icon" href="images/favicon.ico" >
    [% Hook.process("additional_header") %]
  </head>

  <body [% IF onload %] onload="[% onload %]"[% END %]
        class="[% urlbase.replace('^https?://','').replace('/$','').replace('[-~@:/.]+','-') FILTER css_class_quote %]
               [% FOREACH class = bodyclasses %]
                 [%+ class FILTER css_class_quote %]
               [% END %] yui-skin-sam">

  <header id="header">
    [% INCLUDE global/banner.html.tmpl %]

    <div id="titles">
      <span id="title">[% terms.Bugzilla %][% " &ndash; $header" IF header %]</span>

      [% IF subheader %]
        <span id="subtitle" class="subheader">[% subheader %]</span>
      [% END %]

      [% IF header_addl_info %]
        <span id="information" class="header_addl_info">[% header_addl_info %]</span>
      [% END %]
    </div>

    [% USE Bugzilla %]
    [% IF Bugzilla.languages.size > 1 %]
      <div id="lang_links_container" class="bz_default_hidden">
        <ul class="links">
          [% FOREACH lang = Bugzilla.languages.sort %]
            <li>
              [% IF NOT loop.first %]<span class="separator"> | </span>[% END %]
              [% IF lang == current_language %]
                <span class="lang_current">[% lang FILTER html FILTER upper %]</span>
              [% ELSE %]
                <a href="#" onclick="set_language('[% lang FILTER none %]');">
                  [%- lang FILTER html FILTER upper %]</a>
              [% END %]
            </li>
          [% END %]
        </ul>
      </div>
    [% END %]

    <nav id="common_links">
      [% PROCESS "global/common-links.html.tmpl" qs_suffix = "_top" %]
    </nav>
  </header>

  <main role="main" id="bugzilla-body">
    [% 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 type="text/javascript" src="[% asset_url FILTER mtime FILTER html %]"></script>
[% END %]