[%# 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.
  #
  # CustIS "nice error" template.
  #
  # Contributor(s): Vitaliy Filippov <vitalif@mail.ru>
  #%]

[%# We only want HTML error messages for ERROR_MODE_WEBPAGE %]
[% IF Bugzilla.error_mode != constants.ERROR_MODE_WEBPAGE %]
  [% IF Bugzilla.usage_mode == constants.USAGE_MODE_BROWSER %]
    [% error_message FILTER none %]
  [% ELSE %]
    [% error_message FILTER txt %]
  [% END %]
  [% RETURN %]
[% END %]

[% UNLESS header_done %]
  [% PROCESS global/header.html.tmpl %]
[% END %]

[% PROCESS global/docslinks.html.tmpl
   docslinks      = docslinks
   admindocslinks = admindocslinks
%]

<div class="user-error-div">

[% IF error_message.match('^\s*<[a-z]') %]
<div class="user-error-div-first" id="error_msg">
 [% error_message %]
[% ELSE %]
<div class="user-error-div-first">
 <p style="margin-top: 0; margin-bottom: 0" id="error_msg">[% error_message.replace("\n\n", "</p><p style='margin-bottom: 0'>") FILTER none %]</p>
[% END %]
</div>

<p style="margin-bottom: 0">
  Please press <b><a href="javascript:history.back()">Back</a></b> and try again.
</p>

[%# If a saved search fails, people want the ability to edit or delete it.
  # This is the best way of getting information about that possible saved
  # search from any error call location. %]

[% namedcmd = Bugzilla.cgi.param("namedcmd") %]
[% sharer_id = Bugzilla.cgi.param("sharer_id") %]
[% IF namedcmd AND error != "missing_query"
               AND error != "saved_search_used_by_whines"
               AND !sharer_id %]
  <p style="margin-bottom: 0">
    Alternatively, you can
    <a href="buglist.cgi?cmdtype=dorem&amp;remaction=forget&amp;namedcmd=
                  [% namedcmd FILTER url_quote %]">forget</a>

    [% FOREACH q = Bugzilla.user.queries %]
      [% IF q.name == namedcmd %]
        or <a href="query.cgi?[% q.url FILTER html %]">edit</a>
      [% END %]
    [% END %]

    the saved search '[% namedcmd FILTER html %]'.
  </p>
[% END %]

</div>

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