{% import xmanager %}
{% import os %}
{% init path = os.path.abspath(xconfig.DATA_DIR) %}
{% init file_plugins = xmanager.find_plugins("dir") %}

<div class="aside-item">
    <div class="aside-title">
        选项
    </div>
    <div class="aside-content">
        <ul>
            <li><a class="link" href="{{_server_home}}/fs/{{path}}">{{ T('List Mode') }}</a></li>
            <li><a class="link" href="{{_server_home}}/fs/{{path}}?mode=grid">{{ T('Grid Mode') }}</a></li>
            <li><a class="link" href="{{_server_home}}/fs/{{path}}?mode=sidebar">侧边模式</a></li>
            <li><a class="link" href="{{_server_home}}/fs/{{path}}?mode=shell">{{ T('Cmd Mode') }}</a></li>
            <li><a class="link" href="{{_server_home}}/fs_recent">{{ T('最近上传') }}</a></li>
            <li><a class="link" href="{{_server_home}}/code/lines?path={{path}}&recursive=on">代码统计</a></li>
            {% for p in file_plugins %}
                <li><a class="link" href="{{_server_home}}/plugins/{{p.name}}?path={{path}}">{{p.title}}</a></li>
            {% end %}
        </ul>
    </div>
</div>

{% set clipboard_data = xconfig.get("FS_CLIP") %}
{% if clipboard_data != None and len(clipboard_data) > 0 %}
{% set get_short_text = xutils.textutil.get_short_text %}
<div class="aside-item clipboard">
    <div class="aside-title">
        剪切板
        <a class="float-right link clear-clip-link">清空</a>
        <a class="float-right link paste-all-link">粘贴所有</a>
    </div>
    <div class="aside-content">
        {% for clip_path in clipboard_data %}
            {% set clip_base_name = os.path.basename(clip_path.rstrip("/")) %}
            <li>
                <a class="link float-right paste-link" data-path="{{clip_path}}">粘贴</a>
                <span>{{get_short_text(clip_base_name, 8)}}</span>
            </li>
        {% end %}
    </div>
</div>
{% end %}