
<!-- Groups -->
{% import time %}
{% import xmanager %}
{% init show_groups = False %}
{% init groups = [] %}
{% init parent_id = "" %}
{% init note_id = "" %}
{% init note_plugins = xmanager.find_plugins("note") %}
{% init file_type = None %}

<div class="aside-item hide">
    <div class="aside-title">
        选项
    </div>
    <div class="aside-content">
        <ul>
            {% if _has_login %}
                <!-- 笔记选项 -->
                <li><a href="{{_server_home}}/note/recent_created">{{T("Recent Created")}}</a></li>
                <li><a href="{{_server_home}}/note/recent_edit">{{T("Recent Updated")}}</a></li>
                <li><a href="{{_server_home}}/note/recent_viewed">{{T("Recent Viewed")}}</a></li>
                <li><a href="{{_server_home}}/note/tools/timeline">{{T("笔记时光")}}</a></li>
            {% end %}
        </ul>
    </div>
</div>

{# include search/mod_search_rules.html #}

{% if False and _has_login and show_groups %}
<div class="aside-item">
    <div class="aside-title">
        目录
        {% if _has_login %}
        <a class="float-right prompt-btn" message="新增分类" 
                    action="/note/add?type=group&name=">{{T("New")}}</a>
        {% end %}
    </div>
    <div class="aside-content">
        {% for item in groups %}
            <li><a class="link" href="{{_server_home}}/note/view?id={{item.id}}">{{item.name}}({{item.size}})</a></li>
        {% end %}
    </div>
</div>
{% end %}

{% init recent_created = [] %}
{% if len(recent_created) > 0 %}
<div class="aside-item">
    <div class="aside-title">
        最新文章
    </div>
    <div class="aside-content">
        {% for item in recent_created %}
            <li><a class="link" href="{{_server_home}}/note/view?id={{item.id}}">{{item.name}}</a></li>
        {% end %}
    </div>
</div>
{% end %}


{% init most_visited = [] %}
{% if len(most_visited) > 0 %}
<div class="aside-item">
    <div class="aside-title">
        最常访问
    </div>
    <div class="aside-content">
        {% for item in most_visited %}
            <li><a class="link" href="{{_server_home}}/note/view?id={{item.id}}">{{item.name}}</a></li>
        {% end %}
    </div>
</div>
{% end %}


{% init recommended_notes = [] %}
{% if len(recommended_notes) > 0 %}
<div class="aside-item">
    <div class="aside-title">
        相关文章
    </div>
    <div class="aside-content">
        {% for item in recommended_notes %}
            {% if "url" in item %}
                <li><a class="link" href="{{_server_home}}{{item.url}}">{{item.name}}</a></li>
            {% else %}
                <li><a class="link" href="{{_server_home}}/note/view?id={{item.id}}">{{item.name}}</a></li>
            {% end %}
        {% end %}
    </div>
</div>
{% end %}


{% import xutils.dateutil as dateutil %}
{% init show_archived = False %}
{% if show_archived %}
<div class="aside-item">
    <div class="aside-title">
        归档
    </div>
    <div class="aside-content">
        {% set tm = time.localtime() %}
        {% for delta in range(12) %}
            {% set y, m, d = dateutil.date_add(tm, months = -delta) %}
            <li><a href="{{_server_home}}/note/date?year={{y}}&month={{m}}">{{"%s-%02d" % (y, m)}}</a></li>
        {% end %}
    </div>
</div>
{% end %}

<div class="aside-item menu-aside">
    <div class="aside-title">
        大纲
    </div>
    <div class="aside-content" id="menuBox">
    </div>
</div>
