<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en"
      xmlns:tal="http://xml.zope.org/namespaces/tal"
      xmlns:metal="http://xml.zope.org/namespaces/metal"
      xmlns:i18n="http://xml.zope.org/namespaces/i18n"
      lang="en"
      metal:use-macro="context/main_template/macros/master"
      i18n:domain="plone">

<head>
    <metal:block fill-slot="top_slot"
                 tal:define="dummy python:request.set('disable_border',1);
                             disable_column_one python:request.set('disable_plone.leftcolumn',1);
                             disable_column_two python:request.set('disable_plone.rightcolumn',1);" />
</head>

<body>
<metal:main fill-slot="main"
     tal:define="err_type options/error_type|nothing;
                 err_message options/error_message|nothing;
                 err_tb options/error_tb|nothing;
                 err_value options/error_value|nothing;
                 err_traceback options/error_traceback|nothing;
                 err_log_url options/error_log_url|nothing;
                 err_log_id options/error_log_id|nothing;
                 isAnon context/@@plone_portal_state/anonymous;
                 toLocalizedTime nocall: context/@@plone/toLocalizedTime;">

        <metal:notfound tal:condition="python:err_type=='NotFound'">

            <tal:redirect define="redirection_view context/@@plone_redirector_view">

                <tal:redirect define="redirect_success redirection_view/attempt_redirect" replace="nothing">
                    If the attempt succeeds, we won't see any more of this template
                </tal:redirect>

                <h1 class="documentFirstHeading"
                    i18n:translate="heading_site_there_seems_to_be_an_error">
                    This page does not seem to exist&hellip;
                </h1>

                <div id="content-core">
                    <p i18n:translate="description_site_error">
 	                    We apologize for the inconvenience, but the page you were trying to access is not at this address.
                        You can use the links below to help you find what you are looking for.
                     </p>

                    <p i18n:translate="description_site_error_mail_site_admin">
                        If you are certain you have the correct web address but are encountering an error, please
                        contact the <span i18n:name="site_admin">
                        <a href="#"
                           i18n:translate="label_site_admin"
                           tal:attributes="href string:${context/portal_url}/contact-info">Site Administration</a></span>.
                    </p>

                    <p i18n:translate="description_site_error_thank_you">
                    Thank you.
                    </p>

                    <!-- Offer search results for suggestions -->
                    <tal:suggestions define="first_parent redirection_view/find_first_parent;
                                             similar_items redirection_view/search_for_similar;
                                             plone_view context/@@plone;
                                             site_properties context/portal_properties/site_properties;
                                             use_view_action site_properties/typesUseViewActionInListings|python:();
                                             desc_length site_properties/search_results_description_length;
                                             desc_ellipsis site_properties/ellipsis;
                                             normalizeString nocall:plone_view/normalizeString;"
                                     condition="python:first_parent is not None or similar_items">

                        <h3 i18n:translate="heading_not_found_suggestions">You might have been looking for&hellip;</h3>

                        <dl>

                        <tal:firstparent condition="first_parent/absolute_url | nothing">
                            <tal:entry define="result_url first_parent/absolute_url;
                                               result_type python:hasattr(first_parent, 'getTypeInfo') and first_parent.getTypeInfo().getId();
                                               item_icon python:plone_view.getIcon(first_parent);
                                               url python:test(result_type in use_view_action, result_url+'/view', result_url+'/');"
                                       tal:condition="result_type">
                                <dt tal:define="item_wf_state_class python:'state-' + context.portal_workflow.getInfoFor(first_parent, 'review_state', '');"
                                    tal:attributes="class python:'contenttype-' + normalizeString(result_type)">
                                  <img tal:replace="structure item_icon/html_tag" />
                                   <a
                                     href="#"
                                     tal:attributes="href url;
                                                     class string:$item_wf_state_class"
                                     tal:content="first_parent/Title" />

                                    <span class="discreet" i18n:translate="results_by_author"
                                      tal:condition="python: not isAnon or site_properties.allowAnonymousViewAbout">
                                    by <span tal:omit-tag="" tal:content="first_parent/Creator" i18n:name="author">Author</span>,
                                    <span tal:omit-tag="" tal:content="python:toLocalizedTime(first_parent.ModificationDate(), long_format=1)" i18n:name="date">Modification Date</span>
                                    </span>

                                </dt>

                                <dd tal:content="python:plone_view.cropText(first_parent.Description(), desc_length, desc_ellipsis)"> Description </dd>

                            </tal:entry>
                        </tal:firstparent>

                        <tal:similar repeat="similar similar_items">
                            <tal:entry define="result_url similar/getURL;
                                               result_type similar/portal_type;
                                               item_icon python:plone_view.getIcon(similar);
                                               url python:test(result_type in use_view_action, result_url+'/view', result_url+'/');">
                                <dt tal:define="item_wf_state_class string:state-${similar/review_state};"
                                    tal:attributes="class python:'contenttype-' + normalizeString(result_type)">
                                  <img tal:replace="structure item_icon/html_tag" />
                                   <a
                                     href="#"
                                     tal:attributes="href url;
                                                     class string:$item_wf_state_class"
                                     tal:content="similar/pretty_title_or_id" />

                                    <span class="discreet" i18n:translate="results_by_author"
                                      tal:condition="python: not isAnon or site_properties.allowAnonymousViewAbout">
                                    by <span tal:omit-tag="" tal:content="similar/Creator" i18n:name="author">Author</span>,
                                    <span tal:omit-tag="" tal:content="python:toLocalizedTime(similar.ModificationDate, long_format=1)" i18n:name="date">Modification Date</span>
                                    </span>

                                </dt>

                                <dd tal:content="python:plone_view.cropText(similar.Description or '', desc_length, desc_ellipsis)"> Description </dd>

                            </tal:entry>
                        </tal:similar>

                        </dl>

                    </tal:suggestions>
                </div>
            </tal:redirect>

        </metal:notfound>

        <metal:othererror tal:condition="python: err_type!='NotFound'"
             tal:define="checkPermission nocall: context/portal_membership/checkPermission;
                         isManager python: checkPermission('Manage portal', here)">

            <h1 class="documentFirstHeading"
                i18n:translate="heading_site_error_sorry">
                We&#8217;re sorry, but there seems to be an error&hellip;
            </h1>

            <div id="content-core">
                <tal:hasentry condition="err_log_id">
                    <p tal:condition="not: isManager"
                       i18n:translate="description_error_has_been_logged">
                    The error has been logged as entry number
                    <code i18n:name="entryid" tal:content="err_log_id">1174791474.310.489098092344</code>.
                    </p>

                    <p tal:condition="not: isManager"
                       i18n:translate="description_include_error_in_admin_message">
                    If you need to report this to the
                    <span i18n:name="site_admin">
                    <a href="#"
                       i18n:translate="label_site_admin"
                       tal:attributes="href string:${context/portal_url}/contact-info">Site Administration</a></span>,
                    please include this entry number in your message.
                    </p>

                    <div tal:condition="isManager">
                       <p i18n:translate="description_site_admin_full_error">
                       Here is the full error message:
                       </p>

                       <p ><a href="" tal:attributes="href
                                      string:error_log/getLogEntryAsText?id=${err_log_id}"
                                      i18n:translate="label_traceback_as_text">Display traceback as text</a></p>

                       <div tal:replace="structure err_tb"/>
                    </div>

                </tal:hasentry>

                <tal:noentry condition="not:err_log_id">
                    <p i18n:translate="description_site_error_mail_site_admin">
                    If you are certain you have the correct web address but are encountering an error, please
                    contact the <span i18n:name="site_admin">
                    <a href="#"
                       i18n:translate="label_site_admin"
                       tal:attributes="href string:${context/portal_url}/contact-info">Site Administration</a></span>.
                    </p>
                </tal:noentry>
            </div>

        </metal:othererror>
        <tal:ksserrors
                tal:define="kss_view kss_view | context/@@kss_view | nothing;
                            dummy python: kss_view and kss_view.attach_error(err_type, err_value);"/>

</metal:main>
</body>
</html>
