$def with (ou, children, computers, user, plugins)
$var title = _("Navigator") if ou is None else ou.name
$var js=['navigator.js']
$var css = ["navigator.css"]
$var tab: navigator
$code:
    hierarchy = []
    if ou:
        hierarchy = [storage(link='/navigator/ou/%s' % ou.name, caption=ou.name)]
        parent = ou.parent
        if not ou in user.organizative_units:
            while parent:
                hierarchy.append(storage(link='/navigator/ou/%s' % parent.name, caption=parent.name))
                # Do not show more hirarchy elements than needed
                if parent in user.organizative_units:
                    break
                parent = parent.parent
    hierarchy.append(storage(link='/navigator', caption=_("Root")))
    hierarchy.reverse()

$var hierarchy = hierarchy

<div id="tools">
$if ou:
    <div class="navaction editou"><a href="/navigator/ou/$ou/edit">$_("Edit")</a></div>
    <div class="navaction addou"><a href="/navigator/ou/$ou/add">$_("Add organizative unit")</a></div>
    <div class="navaction rmou rm"><form method="post" action="/navigator/ou/$ou/del"><button>$_("Delete organizative unit")</button></div>
    <div class="navaction add"><a href="/navigator/ou/$ou/computer/add">$_("Add computer")</a></div>
$else:
    <div class="navaction addou"><a href="/navigator/ou/add">$_("Add organizative unit")</a></div>
</div>


<div id="navigator">
$if ou:
    <h3>$ou.description</h3>
$for child in children:
    <div class="organizativeunit" title="$child.description">
        <a href="/navigator/ou/$child.name">
            <img src="/static/images/nav-ou.png"/><br/>
            <p>
                $child.name ($len(child.children) - $len(child.computers))<br/>
                $child.description
            </p>
        </a>
    </div>

$for computer in computers:
    <div class="computer" title="$computer.description">
        <a href="/navigator/computer/$computer.name">
            <img src="/static/images/$(computer.get_img()).png"/>
            <br/>
            <p>
            $_("Name"): $computer.name<br/>
            $_("MAC"): $computer.mac<br/>
            $_("IP"): $computer.ip<br/>
            $_("OS"): $computer.so<br/>
            $_("Status"):
            $if computer.online:
                Online<br/>
            $else:
                Offline<br/>
            </p>
        </a>
    </div>
</div>

<div class="clear"></div>
