<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="fr" lang="fr">
    <head>
        <link rel="shortcut icon" href="/static/favicon.ico" type="image/x-icon" />
        <link rel="icon" href="/static/favicon.ico" type="image/x-icon" />
        <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />

        <!-- Cascading Style Sheets -->
        <link href="/static/page.css" rel="stylesheet" type="text/css" />
        <link href="/static/pygments.css" rel="stylesheet" type="text/css" />
        <link href="/static/smoothness/jquery-ui-1.8.10.custom.css" rel="stylesheet" type="text/css" />
        {% if css %}
            {% for url in css %}
            <link href="{{url}}" rel="stylesheet" type="text/css" />
            {% endfor %}
        {% endif %}
        <!-- Javascript -->
        <script type="text/javascript" src="/static/jquery-1.5.min.js"></script>
        <script type="text/javascript" src="/static/jquery-ui-1.8.custom.min.js"></script>
        <script type="text/javascript" src="/static/jquery.validate.min.js"></script>
        <script type="text/javascript" src="/static/jquery.dataSelector.js"></script>
        <script type="text/javascript" src="/static/main.js"></script>
        {% if js %}
            {% for url in js %}
            <script type="text/javascript" src="{{url}}"></script>
            {% endfor %}
        {% endif %}

        {% block head %}
        <title>Drink!</title>
        {% endblock %}

    </head>
    <body>

    {% if not authenticated and obj.id == '.' and obj.rootpath == '/' %}
    <form name="login_form" id="login_form" class="autovalidate" action="/login" method="post">
        <label for="ilogin">Authenticate as:</label>
        <input type="text" class="required" name="login_name" id="ilogin" />
        <label for="ipasswd">Password:</label>
        <input type="password" class="required" name="login_password" id="ipassword" />
        <input class="submit" type="submit" value="Log in!"/>
    </form>
    {% elif not no_admin and authenticated and obj.id != '.' %}
    <fieldset class="toggler" id="commands">
        <legend onclick="$('#commands .togglable').slideToggle('slow');">{{authenticated.id}}</legend>
        <div class="togglable" >
        <div id="user_actions" >
        <a title="Account settings" href="/users/{{authenticated.id|e}}/edit"><img class="icon" src="/static/actions/personal.png" alt="your account icon" /></a>
        <a title="Search" href="/search/"><img  alt="find icon" class="icon" src="/static/actions/find.png" /></a>
        <a title="log out" href="/logout"><img  alt="exit icon" class="icon" src="/static/actions/exit.png" /></a>
        </div> <!-- /user actions -->
        <div id="page_actions">
            <a title="View/Reload current element" href="{{obj.path|e}}view"><img  class="icon" src="/static/actions/view.png" alt="view icon"/></a>

            {% if 'w' in authenticated.access(obj) %}
                <a title="Edit current element" href="{{obj.path|e}}edit"><img  class="icon" src="/static/actions/edit.png" alt="edit icon" /></a>
                <a title="List content" href="{{obj.path|e}}list"><img  class="icon" src="/static/actions/open.png" alt="list icon" /></a>
                {% if classes and 'a' in authenticated.access(obj) %}
                <a id="add_object" title="Add object" onclick="add_new_item(this)"><img  alt="new icon" class="icon" src="/static/actions/new.png" /></a>
                <select id="new_obj_class" style="visibility: hidden" class="required" name="class" onchange="$('#new_obj_class').hide(); $('#name_choice').css('visibility', 'visible').show(); $('#new_obj_name').focus()">
                    <option value="" label="Select one item type">Select one item type</option>
                    <optgroup label="Item types">
                    {% for k in classes.iterkeys() %}
                        <option value="{{k}}" label="{{k}}">{{k}}</option>
                    {% endfor %}
                    </optgroup>
                </select>
                <span id="name_choice" style="visibility: hidden">
                    <label for="new_obj_name">Name</label>
                    <input id="new_obj_name" type="text" name="name" class="required identifier" minlength="2" />
                </span>
                {% endif %}
                {% if obj.disable_ajax %}
                    {% if classes and 'a' in authenticated.access(obj) %}
                    <div class="objects_forms">
                    <form id="add_form" class="autovalidate" action="add" method="get">
                        <label for="selected_class"><img  class="minicon" src="/static/actions/new.png" /></label>
                        <select id="selected_class" class="required" name="class" size="0">
                        {% for k in classes.iterkeys() %}
                            <option value="{{k}}" label="{{k}}">{{k}}</option>
                        {% endfor %}
                        </select>
                        <label for="obj_name">as</label>
                        <input id="obj_name" type="text" name="name" class="required identifier" minlength="2" />
                        <input class="submit" type="submit" value="Create!"/>
                    </form>
                    {% endif %}
                    {% if obj and 'a' in authenticated.access(obj) %}
                    <form id="rm_form" action="rm" class="autovalidate" method="get" enctype="text/plain">
                        <label for="selected_rm_key"><img  class="minicon" id="rm_form_image" class="droppable" src="/static/actions/delete.png" /></label>
                        <select id="selected_rm_key" name="name" size="0" class="required">
                            <option value="" label="-nothing-"></option>
                        {% for k in obj.iterkeys() %}
                            {% if authenticated.access(obj[k]) %}
                            <option value="{{k}}" label="{{k}}">{{k}}</option>
                            {% endif %}
                        {% endfor %}
                        </select>
                        <input class="submit" type="submit" value="Delete!"/>
                    </form>

                    <form id="edit_form" class="autovalidate" action="edit" method="get" enctype="text/plain">
                        <label for="selected_edit_key"><img  class="minicon" src="/static/actions/edit.png" /></label>
                        <select id="selected_edit_key" size="0" class="required">
                            <option value="" label="-none-"></option>
                        {% for k in obj.iterkeys() %}
                            {% if authenticated.access(obj[k]) %}
                            <option value="{{k}}" label="{{k}}">{{k}}</option>
                            {% endif %}
                        {% endfor %}
                        </select>
                        <input class="submit" type="submit" value="Go!!"/>
                    </form>
                    </div>
                    {% endif %}
                {% endif %} <!-- edit & rm form -->
                </div> <!-- page actions -->
                </div> <!-- end of toggleable -->
        {% endif %}
    </fieldset>
    {% endif %}
    {% if obj.id != '.' %}
        {% if req.url.endswith('/') %}
        <a title="Back to parent element" href="{{obj.rootpath|e}}"><img class="minicon" src="/static/actions/undo.png" /></a>
        {% else %}
        <a title="Back to element" href="{{obj.path|e}}"><img class="minicon" src="/static/actions/undo.png" /></a>
        {% endif %}
    {% endif %}

    {% block body %}
        {% if html %}
            {{ html|safe }}
        {% else %}
            Please, add some body block or html content...
        {% endif %}
    {% endblock %}
    </body>
</html>
