{include file="$template_path/html/header.html"}
</head>
<body class="">
<section class="vbox">
  {include file="$template_path/html/pagenav.html"}
  <section>
    <section class="hbox stretch">
      {include file="$template_path/html/mobile-nav.html"}
      <section id="content" class="p-t-llg-xs">

        <section class="clearfix">
          <div class="container m-t-lg m-b-lg m-xs-t-none m-xs-b-md">

            <div class="row">



              <div class="col-xs-12 col-md-7 col-lg-8">
                <div class="row m-b-md m-xs-b">
                  <div class="col-sm-12">
                    <form action="" id="sortbyform" method="get" style="z-index:3;">
                      <input id="order-type" name="order" type="hidden" value="{if $smarty.get.order == 'asc'}desc{else}asc{/if}" />
                      <input type="hidden" id="sort_by" name="sort_by" />
                      <div class="">
                        <a href="javascript: void(0);" onclick="document.getElementById('sort_by').value='average_rating';document.getElementById('sortbyform').submit();"{if $smarty.get.sort_by == 'average_rating'} class="btn btn-icon btn-rounded btn-ghost-info m-b-xs active" {else} class="btn btn-icon btn-rounded btn-ghost-info m-b-xs" {/if} title="" data-toggle="tooltip" data-placement="bottom" data-original-title="按评分排序">
                        <i class="i i-like"></i>
                        </a>
                        <a href="javascript: void(0);" onclick="document.getElementById('sort_by').value='sales_count';document.getElementById('sortbyform').submit();"{if $smarty.get.sort_by == 'sales_count'} class="btn btn-icon btn-rounded btn-ghost-info m-b-xs m-l-sm active" {else} class="btn btn-icon btn-rounded btn-ghost-info m-b-xs m-l-sm"{/if} title="" data-toggle="tooltip" data-placement="bottom" data-original-title="按销量排序">
                        <i class="i i-data2"></i>
                        </a>
                        <a href="javascript: void(0);" onclick="document.getElementById('sort_by').value='cost';document.getElementById('sortbyform').submit();"{if $smarty.get.sort_by == 'cost'} class="btn btn-icon btn-rounded btn-ghost-info m-b-xs m-l-sm active" {else} class="btn btn-icon btn-rounded btn-ghost-info m-b-xs m-l-sm"{/if} title="" data-toggle="tooltip" data-placement="bottom" data-original-title="按价格排序">
                        <i class="i i-shuffle"></i>
                        </a>
                        <a href="javascript: void(0);" onclick="document.getElementById('sort_by').value='published_at';document.getElementById('sortbyform').submit();"{if $smarty.get.sort_by == 'published_at'} class="btn btn-icon btn-rounded btn-ghost-info m-b-xs m-l-sm active" {else} class="btn btn-icon btn-rounded btn-ghost-info m-b-xs m-l-sm"{/if} data-toggle="tooltip" data-placement="bottom" data-original-title="按日期排序">
                        <i class="i i-down"></i>
                        </a>
                      </div>
                    </form>
                  </div>
                </div>


                {if $items}
                <div class="row">
                  {foreach from=$items item=i name=foo}
                  <div class="col-xs-6 col-md-6 col-lg-4">
                    <section class="panel mb-col no-radius no-shadow">
                      <div class="panel-body no-padder">
                        <div class="img-container fx-img-rotate-l">
                          <img class="img-responsive" src="{$data_server}uploads/items/{$i.id}/{$i.thumbnail}" alt="{$i.name|escape}">
                          <div class="img-options">
                            <div class="img-options-content">
                              <a href="/{$languageURL}items/{$i.id}" class="btn btn-info btn-lg m-r-md hidden-xs" data-toggle="tooltip" data-placement="bottom" data-original-title="查看演示">
                                <i class="i i-layer2"></i>
                              </a>
                              <a href="/{$languageURL}items/{$i.id}" class="btn btn-danger btn-lg" data-toggle="tooltip" data-placement="bottom" data-original-title="了解详情">
                                <i class="i i-eye"></i>
                              </a>
                            </div>
                          </div>
                        </div>
                        <div class="cate-bg cates-1">
                          <span class="cate-text">{$i.sales}{$lang.sales}</span>
                        </div>
                      </div>
                      <div class="panel-footer pos-rlt bg-white-only panel-shadow no-radius">
                        <div class="ss-underline">
                          <a href="#">
                            {foreach from=$i.categories item=e}
                            {foreach from=$e item=c name=foo}
                            {if $smarty.foreach.foo.last}{$categories[$c].name}{/if}
                            {/foreach}
                            {/foreach}
                          </a>
                        </div>
                        <div class="clearfix">
                          <div class="datetime m-r-sm pull-left hidden-xs">
                            <span class="date">{if $i.free_file == 'true'}0{else}{$i.price}{/if}</span>
                            <span class="month">￥</span>
                          </div>
                          <h4 class="m-t-none m-b-none-xs"><a href="/{$languageURL}items/{$i.id}" class="height-h4">{$i.name|escape}</a></h4>
                        </div>

                        <a href="/{$languageURL}user/{$users[$i.user_id].username}" class="panel-thumb hidden-xs" data-toggle="tooltip" data-placement="bottom" data-original-title="{$users[$i.user_id].nickname}">
                          {if $users[$i.user_id].avatar != ''}
                          <img alt="{$users[$i.user_id].nickname}" class="img-circle" src="{$data_server}uploads/users/{$i.user_id}/A_{$users[$i.user_id].avatar}" />
                          {else}
                          <img alt="{$users[$i.user_id].nickname}" class="img-circle" src="{$data_server}home/default/img/default-user.jpg" />
                          {/if}
                        </a>

                      </div>
                    </section>
                  </div>
                  {/foreach}
                </div>
                {$paging}
                {else}
                <div class="row">
                  <div class="col-xs-12 text-center">
                    <section class="panel no-radius p-t-lg p-b-lg panel-shadow">
                      <div class="panel-body bg-white-only no-radius">
                        <h3>这个书签集内尚无作品。建议您在作品页点击添加书签功能装作品添加进书签。</h3>
                      </div>
                    </section>
                  </div>
                </div>
                {/if}
              </div>


              <div class="col-xs-12 col-md-5 col-lg-4">
                <div class="m-b-lg m-xs-b-md h3">
                  <span class="font-thin text-danger">{$collection.name}</span>
                  <span class="font-thin h4 text-black">书签集</span>
                  <span class="badge bg-warning lt v-middle font-thin">
                    {if check_login_bool()}
                      {if $collection.text != ''}{$collection.text|nl2br}{/if}
                    {else}
                      这是一个公开书签集
                    {/if}
                  </span>
                </div>
                <script>{literal}
                marketplace.queue( function(){
                  marketplace.initializers.itemList({
                    ajaxPagination: true,
                    layoutSwitcher: true
                  });
                });{/literal}
                </script>


                <div class="row">
                  <div class="col-xs-12">
                    <section class="panel mb-col no-radius no-shadow">
                      <div class="panel-body">
                        <div class="img-container fx-img-rotate-l">
                          {if $collection.photo != ''}
                          <img class="w-full" alt="{$collection.name|escape}" src="{$data_server}uploads/collections/{$collection.photo}" />
                          {else}
                          <img class="w-full" alt="{$collection.name|escape}" src="{$template_data}img/default-collection.jpg" />
                          {/if}
                          <div class="img-options">
                            <div class="img-options-content">
                              {if check_login_bool() && $collection.user_id == $smarty.session.user.user_id}
                              <form action="" method="post">
                                <input type="hidden" name="delete" value="yes" />
                                <button type="submit" onclick="return confirm('确定删除这个书签集吗？');" class="btn btn-info">删除此书签</button>
                              </form>
                              {/if}
                            </div>
                          </div>
                        </div>
                      </div>
                      <div class="panel-footer pos-rlt bg-white-only panel-shadow no-radius">
                        <div class="ss-underline">

                          {if check_login_bool()}
                          {else}
                          {if $collection.text != ''}{$collection.text|nl2br}{/if}
                          {/if}

                          {if check_login_bool()}
                            <h4>给这个书签集评分</h4>
                            <div class="rate_collection">
                              {if $collection.rate}
                              <div class="clearfix block ratestar">
                                {section name=foo start=1 loop=6 step=1}
                                {if $collection.rate.rate >= $smarty.section.foo.index}<img src="{$template_data}img/custom/star-on.png" alt="" class="left" />{else}<img src="{$template_data}img/custom/star-off.png" alt="" class="left" />
                                {/if}
                                {/section}
                              </div>
                              {else}
                              <div id="stars_div_{$collection.id}" class="clearfix block stars" data-star-set-id="{$collection.id}_star" data-rating="0">
                                {section name=foo start=1 loop=6 step=1}
                                <a href="/{$languageURL}collections/rate/{$collection.id}?rating={$smarty.section.foo.index}" data-method="post" data-remote="true" onmouseover="marketplace.rating.toggle_stars('{$collection.id}_star', {$smarty.section.foo.index});" rel="nofollow">
                                  <img alt="{$smarty.section.foo.index}" id="{$collection.id}_star_{$smarty.section.foo.index}" src="{$template_data}img/custom/star-off.png"></a>
                                {/section}
                              </div>
                              {/if}
                              <small class="inline m-t-sm">( {$collection.votes} {$lang.votes} )</small>
                              {if $collection.rate}
                              <small class="inline m-t-sm">你投了：{$collection.rate.rate}星</small>
                              {/if}
                              <script>
                                {literal}marketplace.queue(function(){
                                  marketplace.rating.init();
                                }); {/literal}
                              </script>
                            </div>
                          {/if}
                        </div>
                        <div class="clearfix">
                          <a href="/{$languageURL}user/{$collection.user.username}/" class="thumb pull-left m-r-md" title="{$collection.user.username}">
                            {if $collection.user.avatar != ''}
                            <img alt="{$collection.user.username}" class="img-circle" src="{$data_server}uploads/users/{$collection.user.user_id}/A_{$collection.user.avatar}" />
                            {else}
                            <img alt="{$collection.user.username}" class="img-circle" src="{$template_data}img/default-user.jpg" />
                            {/if}
                          </a>
                          <h4 class="m-t-xs m-b-xs m-b-none-xs"><a href="/{$languageURL}user/{$collection.user.username}/" rel="author">{$collection.user.nickname}</a></h4>
                          <p>
                            {foreach from=$user_badges item=b name=foo}
                            <img src="{$data_server}{$b.photo}" height="16" width="16" alt="{$b.name|escape}" title="{$b.name|escape}" />
                            {if $smarty.foreach.foo.last}{/if}
                            {/foreach}
                          </p>
                        </div>



                        {if check_login_bool() && $collection.user_id == $smarty.session.user.user_id}
                        <div class="clearfix m-t-md p-t-md m-b-sm b-t">
                          <div class="col-xs-6">
                            <button class="btn btn-ghost-dark btn-rounded btn-xs-xs btn-block" type="submit" data-toggle="modal" data-target="#cbook">
                              <i class="fa fa-star m-r-xs fs-16"></i>编辑书签集
                            </button>
                          </div>
                          <div class="col-xs-6">
                            <form class="block" action="" method="post">
                              <input type="hidden" name="delete" value="yes" />
                              <button type="submit" onclick="return confirm('确定删除这个书签集吗？');" class="btn btn-ghost-danger btn-rounded btn-xs-xs btn-block">删除此书签</button>
                            </form>
                          </div>
                        </div>
                        {/if}


                        {if check_login_bool() && $collection.user_id == $smarty.session.user.user_id}

                        <!-- Modal -->
                        <div class="modal fade" id="cbook" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
                          <div class="modal-dialog modal-sm" style="margin-top: 100px">

                            <form class="vertical-form" enctype="multipart/form-data" id="edit_collection" method="post">
                              <div class="modal-content">



                                <div class="modal-header">
                                  <h4 class="modal-title">修改书签集</h4>
                                </div>
                                <div class="modal-body">



                                  <div class="form-group">
                                    <label for="title">名称*</label>
                                    <input class="form-control" id="collection_name" name="name" type="text" value="{$collection.name|escape}" />
                                  </div>

                                  <div class="form-group">
                                    <label for="description">描述</label>
                                    <textarea class="form-control" cols="20" id="collection_description" name="description" rows="3">{$collection.text}</textarea>
                                    <div class="checkbox i-checks">
                                      <label for="collection_publically_visible">
                                        <input name="collection[publically_visible]" type="hidden" value="0" />
                                        <input id="collection_publically_visible" name="publically_visible" type="checkbox" value="1" {if $collection.public == 'true'}checked="checked"{/if} />
                                        <i></i> 分类是否公开?
                                      </label>
                                    </div>
                                  </div>


                                  <div class="form-group">
                                    <label for="image">图片</label>
                                    <input class="form-control" id="file_upload" name="file_upload" type="file" />
                                    <span class="help-block m-b-none">(260 x 140px)</span>
                                  </div>

                                </div>
                                <div class="modal-footer" href="javascript: void(0);">
                                  <button type="button" class="btn btn-default" data-dismiss="modal">关闭</button>
                                  <input type="hidden" name="edit" value="yes" />
                                  <button type="submit" class="btn btn-info">编辑书签集</button>
                                </div>
                              </div>
                            </form>

                          </div>
                        </div>

                        {/if}









                      </div>
                    </section>
                  </div>
                </div>
              </div>


            </div>

          </div>
        </section>
        {include file="$template_path/html/footer.html"}

      </section>
    </section>
  </section>
</section>
<script>
  {literal}
  seajs.use(["jq", "pageui", "modules/itemlist"], function($, ui, list){
    ui.imgMagnifier("a.landscape-image-magnifier");
    list.init({
      ajaxPagination: true,
      layoutSwitcher: true
    });
  });
  {/literal}
</script>
</body>
</html>