Navigation
----------

We have a view called 'schoolbell_navigation'.  Its output is included in the
page macros template to get the navigation portlet.  Browser requests, such
as used in this functional test, do not represent normal usage.


Set up
------

We will create a SchoolBell object and a resource

    >>> print http(r"""
    ... POST /@@contents.html HTTP/1.1
    ... Authorization: Basic mgr:mgrpw
    ... Content-Length: 81
    ... Content-Type: application/x-www-form-urlencoded
    ...
    ... type_name=BrowserAdd__schoolbell.app.app.SchoolBellApplication&new_value=frogpond
    ... """)
    HTTP/1.1 303 See Other
    ...

    >>> print http(r"""
    ... POST /frogpond/resources/+/addSchoolBellResource.html HTTP/1.1
    ... Authorization: Basic mgr:mgrpw
    ... Content-Length: 50
    ... Content-Type: application/x-www-form-urlencoded
    ...
    ... field.title=Lily&UPDATE_SUBMIT=Add&add_input_name=
    ... """)
    HTTP/1.1 303 See Other
    ...


Navigation view
---------------

The schoolbell_navigation view is registered for "*".  It will present
a portlet with the navigation links depending on the authorized user.

    >>> print http(r"""
    ... GET /frogpond/schoolbell_navigation HTTP/1.1
    ... Authorization: Basic mgr:mgrpw
    ... """)
    HTTP/1.1 200 Ok
    Content-Length: ...
    Content-Type: text/html;charset=utf-8
    <BLANKLINE>
    <div class="portlet">
    <h4>Navigation</h4>
    <ul>
       <li><a href="http://localhost/frogpond/persons">Persons</a></li>
       <li><a href="http://localhost/frogpond/groups">Groups</a></li>
       <li><a href="http://localhost/frogpond/resources">Resources</a></li>
    </ul>
    </div>

The main technical challenge in this view is finding the nearest
ISchoolBellApplication instance, and providing the links relative to
it.

    >>> print http(r"""
    ... GET /frogpond/resources/lily/schoolbell_navigation HTTP/1.1
    ... Authorization: Basic mgr:mgrpw
    ... """)
    HTTP/1.1 200 Ok
    Content-Length: ...
    Content-Type: text/html;charset=utf-8
    <BLANKLINE>
    <div class="portlet">
    <h4>Navigation</h4>
    <ul>
       <li><a href="http://localhost/frogpond/persons">Persons</a></li>
       <li><a href="http://localhost/frogpond/groups">Groups</a></li>
       <li><a href="http://localhost/frogpond/resources">Resources</a></li>
    </ul>
    </div>

This view is only available in the SchoolBell skin:

    >>> print http(r"""
    ... GET /schoolbell_navigation HTTP/1.1
    ... Authorization: Basic mgr:mgrpw
    ... """)
    HTTP/1.1 404 Not Found
    Content-Length: ...
    Content-Type: text/html;charset=utf-8
    <BLANKLINE>
    ...

