{include file="$template_path/html/header.html"}
{include file="$template_path/js/arc.html"}
{include file="$template_path/html/jstemplate.html"}
<script src="/mbthemes/scripts/canvas/animation.js"></script>
</head>
<body>
<div class="app" id="app">
  {include file="$template_path/html/mobile-nav.html"}
  <!-- content -->
  <div id="content" class="app-content box-shadow-z4" role="main">

    {include file="$template_path/html/pagenav.html"}
    <div ui-view class="app-body" id="view">
      <!-- ############ PAGE START-->

      <div class="white b-t">
        <div class="container">
          <div class="row-col">
            <div class="col-sm b-r b-l" id="taber">

              <div class="box edit pos-rlt m-b-0">
                <div class="p-x-md p-t-md">

                  <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="btn-group">

                      <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 p-l-md p-r p-y-xs btn-outline skin" {else} class="btn p-l-md p-r p-y-xs btn-outline b-skin text-skin"{/if} title="" data-toggle="tooltip" data-placement="bottom" data-original-title="按销量排序">
                      销量
                      <i class="icon-xjt1 m-l-xs"></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 p-l-md p-r p-y-xs btn-outline skin" {else} class="btn p-l-md p-r p-y-xs btn-outline b-skin text-skin"{/if} title="" data-toggle="tooltip" data-placement="bottom" data-original-title="按价格排序">
                      价格
                      <i class="icon-xjt1 m-l-xs"></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 p-l-md p-r p-y-xs btn-outline skin" {else} class="btn p-l-md p-r p-y-xs btn-outline b-skin text-skin"{/if} data-toggle="tooltip" data-placement="bottom" data-original-title="按日期排序">
                      日期
                      <i class="icon-xjt1 m-l-xs"></i>
                      </a>

                    </div>
                  </form>


                </div>
                <div class="p-a-md">


                  {if $items}
                  <div class="row">
                    {foreach from=$items item=i name=foo}
                    <div class="col-xs-6 col-sm-6 col-md-4">
                      <div class="box mb-co-b b-a">
                        <div class="item dark">
                          <div class="img-container fx-img-rotate-l fx-opt-zoom-out">
                            <img src="{$data_server}uploads/items/{$i.id}/{$i.thumbnail}" class="img-responsive" alt="{$i.name|escape}">
                            <div class="img-options">
                              <div class="img-options-content">
                                <a href="/{$languageURL}items/{$i.id}" target="_blank" class="btn skin m-r-md hidden-xs"><i class="icon-eye"></i></a>
                                <a href="/{$languageURL}items/{$i.id}" target="_blank" class="btn btn-danger text-white">
                                  <i class="icon-magnifier-add"></i>
                                </a>
                              </div>
                            </div>
                          </div>
                        </div>
                        <a href="/{$languageURL}items/{$i.id}" target="_blank" class="md-btn md-raised md-fab md-mini m-r pos-rlt md-fab-offset pull-right white"><i class="icon-plus2 md-24"></i></a>
                        <div class="p-a">
                          <div class="text-muted">
                            <a href="/{$languageURL}items/{$i.id}" target="_blank" class="m-r"><i class="icon-eye m-r-xs"></i> 481</a>
                            <a href="/{$languageURL}items/{$i.id}" target="_blank"><i class="icon-handbag m-r-xs"></i> 8</a>
                          </div>
                          <div class="h-2xx"><a href="/{$languageURL}items/{$i.id}" target="_blank" class="h6">{$i.name|escape}</a></div>
                          <div class="clearfix m-t-xs">
                            <a href="/{$languageURL}user/{$users[$i.user_id].username}" target="_blank" class="pull-left m-r-sm">
                              <span class="w-32 avatar">
                                {if $users[$i.user_id].avatar != ''}
                                <img src="{$data_server}uploads/users/{$i.user_id}/A_{$users[$i.user_id].avatar}" />
                                {else}
                                <span class="circle skin _100 w-32 fs-80">
                                  NP
                                </span>
                                {/if}
                              </span>
                            </a>
                            <a href="/{$languageURL}user/{$users[$i.user_id].username}" target="_blank" class="pull-left m-t-sm clear">
                              {$users[$i.user_id].nickname}
                            </a>
                            <div class="pull-right">
                              <div class="h-32"><a href="/{$languageURL}items/{$i.id}" target="_blank" class="price">￥<span class="text-lg"> {if $i.free_file == 'true'}0{else}{$i.price}{/if}</span></a></div>
                            </div>
                          </div>
                        </div>
                      </div>
                    </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">
                          <h4>这个书签集内尚无作品。</h4>
                        </div>
                      </section>
                    </div>
                  </div>
                  {/if}


                </div>
              </div>

            </div>



            <div class="col-sm w-xl box w-auto-xs b-r right-bar">

              <div class="box edit pos-rlt m-b-0">
                <div class="">
                  <div class="box-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 skin">删除此书签</button>
                          </form>
                          {/if}
                        </div>
                      </div>
                    </div>
                  </div>
                  <div class="p-x">



                    <div class="ss-underline">
                      <h5>{$collection.name}</h5>
                      {if check_login_bool()}
                      {if $collection.text != ''}<span class="text-grey">{$collection.text|nl2br}</span>{/if}
                      {else}
                      <span class="text-grey">这是一个公开书签集</span>
                      {/if}


                      <script>{literal}
                      marketplace.queue( function(){
                        marketplace.initializers.itemList({
                          ajaxPagination: true,
                          layoutSwitcher: true
                        });
                      });{/literal}
                      </script>

                      {if check_login_bool()}
                      <h6 class="p-t">给这个书签集评分</h6>
                      <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 p-t">
                      <a href="/{$languageURL}user/{$collection.user.username}/" class="w-48 thumb pull-left m-r" title="{$collection.user.username}">
                        {if $collection.user.avatar != ''}
                        <img alt="{$collection.user.username}" class="img-circle w-48" src="{$data_server}uploads/users/{$collection.user.user_id}/A_{$collection.user.avatar}" />
                        {else}
                        <img alt="{$collection.user.username}" class="img-circle w-48" src="{$template_data}img/default-user.jpg" />
                        {/if}
                      </a>
                      <h5 class="m-t-xs m-b-0"><a href="/{$languageURL}user/{$collection.user.username}/" rel="author">{$collection.user.nickname}</a></h5>
                      <p>
                        {foreach from=$user_badges item=b name=foo}
                        <img src="{$data_server}{$b.photo}" height="15" width="15" alt="{$b.name|escape}" title="{$b.name|escape}" />
                        {if $smarty.foreach.foo.last}{/if}
                        {/foreach}
                      </p>
                    </div>


                  </div>



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


                </div>
              </div>

            </div>


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


    </div>
    <!-- ############ PAGE END-->
    {include file="$template_path/html/footer.html"}
  </div>
  {include file="$template_path/html/backtop.html"}
  {include file="$template_path/html/mb-settings.html"}
  <!-- ############ LAYOUT END-->
</div>
{literal}
<style>
  .box.edit{
    min-height: 744px;
  }
</style>
{/literal}
{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 black lt">



        <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>


          <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>


          <label class="md-switch" 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 class="skin"></i>
            是否为公开书签集?
          </label>
        </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 skin">编辑书签集</button>
        </div>
      </div>
    </form>

  </div>
</div>

{/if}
</body>
</html>