{extend name="public/base" /}
{block name="content"}
<div class="row port">
    <div class="portfolioContainer apply-wrap m-b-15 clearfix">
        {volist name="_list" id="vo"}
        <div class="col-sm-6 col-lg-2 col-md-3 mobiles">
            <div class="product-list-box thumb">
                <a href="{eq name="vo['has_adminlist']" value="1"} {:url('adminlist?addon_name=' . $vo['name'])} {else/}javascript:;{/eq}" class="image-popup" title="{$vo['description']}" style="width: 100%;">
                    <?php
                        $cover = '/addons/'.$vo['name']. '/cover.png';
                        $file = ROOT_PATH . $cover;
                        if (is_file($file)){
                            echo '<img src="'.$cover.'"  alt="'.$vo['title'].'" class="img">';
                        }else{
                        echo '<div class="no-img"><i class="fa fa-puzzle-piece fa-4x"></i></div>';
                        }
                    ?>
                </a>
                {empty name="vo.uninstall"}
                <div class="product-action">
                    <?php
                        $class  = get_addon_class($vo['name']);
                        if(!class_exists($class)){
                            $hasConfig = 0;
                        }else{
                            $addon = new $class();
                            $hasConfig = count($addon->getConfig());
                        }
                    ?>
                    {if condition="$hasConfig"}
                    <a class="btn btn-xs btn-info mr-xs" href="{:url('config',array('id'=>$vo['id']))}">设置</a>
                    {/if}

                    {eq name="vo.status" value="0"}
                    <a class="ajax-get btn btn-xs btn-success mr-xs" href="{:url('enable',array('id'=>$vo['id']))}">启用</a>
                    {else /}
                    <a class="ajax-get btn btn-xs btn-warning mr-xs" href="{:url('disable',array('id'=>$vo['id']))}">禁用</a>
                    {/eq}

                    <a class="ajax-get btn btn-xs btn-danger mr-xs" data-confirm="true" href="{:url('uninstall?id='.$vo['id'])}">卸载</a>
                </div>   
                {else /}
                <div class="product-action" style="display: block;">
                    <a class="ajax-get btn btn-xs btn-info" href="{:url('install?addon_name='.$vo['name'])}">安装</a>
                    
                </div>
                {/empty}
                <div class="detail">
                    <h4 class="m-t-0 m-b-5">
                        <a href="" class="text-dark">{$vo['title']} - {$vo.version}</a> 
                    </h4>
                    <h5 class="m-0">
                        <span class="text-custom">author：</span> 
                        <a class="text-muted m-l-15" target="_blank" href="{$vo.url|default='http://www.jyuu.cn'}">{$vo.author}
                        </a>
                    </h5>
                </div>
            </div>
        </div>
        {/volist}

    </div>
</div>


{/block}

{block name="script"}
    <script type="text/javascript">
        $('.image-popup').tooltip({placement : 'bottom'});
    </script>
{/block}