{include file="$template_path/html/header.html"}
<link rel="stylesheet" type="text/css" href="/mbthemes/css/post.css">
</head>
<body class="bg-lgray">
{include file="$template_path/html/pagenav.html"}

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


    {$errorMessage}
    <div class="m-b-lg m-xs-b h3">
      <span class="font-thin h3-xs text-black">上传自己的作品出售</span>
      <span class="badge bg-danger lt v-middle">独家作者70%提成</span>
    </div>

    <div class="row">

      <div class="col-xs-12 col-sm-12 col-md-3">
        <section class="panel panel-shadow">
          <div class="panel-body p-b-none">
            <form id="begin-upload" action="/{$languageURL}" method="get" >
              <div class="form-group">
                <div class="inputs">
                  <select class="form-control" id="category" name="category">
                    {if $mainCategories}
                    {foreach from=$mainCategories item=c}
                    <option value="{$c.id}" {if $smarty.get.category == $c.id}selected="selected"{/if}>{$c.name}</option>
                    {/foreach}
                    {/if}
                  </select>
                </div>
              </div>
              <p>
                <a onclick="window.location='/{$languageURL}upload/form/?category=' + document.getElementById('category').options[document.getElementById('category').selectedIndex].value;" class="btn btn-dark btn-sm">切换</a>
                <a href="/{$languageURL}help/upload/" class="btn btn-link fs-14 btn-sm" target="_blank">帮助</a>
              </p>
            </form>
          </div>

        </section>

      </div>


      <div class="col-xs-12 col-sm-12 col-md-9">

        <div class="panel panel-shadow">
          <div class="panel-body p-xs-l-xs p-xs-r-xs">






            {if !isset($hideForm)}

            <form class="horizontal-form item-form disable-on-submit p-b-sm p-l-sm p-r-sm p-t-sm"  id="upload-form" method="post" enctype="multipart/form-data">
              <div class="blocktit clearfix">
                <h3 class="m-t-none h3-xs"><span class="text-danger m-t-xs">*</span><label for="name">响亮的标题</label>
                  <small class="header-note hidden-xs">
                    最多50个字符。查看
                    <a class="text-success" href="/index.php/help/upload/" target="_blank">
                      作品命名约定
                    </a>
                  </small>
                </h3>
              </div>
              <div class="form-group">
                <div class="inputs">
                  <input class="form-control" type="text" id="name" name="name" value="{$smarty.post.name|escape}" maxlength="50">

                </div>
              </div>
              <div class="line line-dashed b-b line-lg pull-in"></div>

              <div class="alert alert-warning alert-block m-t-sm m-b-sm">
                <button type="button" class="close" data-dismiss="alert">×</button>
                选择准确的分类和属性
              </div>

              <div class="row">
                <div class="col-xs-6">
                  <div class="blocktit clearfix">
                    <h3 class="m-t-sm h3-xs"><span class="text-danger m-t-xs">*</span><label for="name">类别</label>
                      <small class="header-note hidden-xs">
                        请选择您作品的所属类别
                      </small>
                    </h3>
                  </div>
                  <div class="form-group">
                    <div class="inputs">
                      <select class="form-control" name="category[]">{$categoriesSelect}</select>
                    </div>
                  </div>
                </div>
              </div>
              <div class="line line-dashed b-b line-lg pull-in"></div>


              <div class="blocktit clearfix">
                <h3 class="m-t-sm h3-xs"><label for="item_item_attributes_attributes_4_text_value">演示地址url</label>
                  <small class="header-note hidden-xs">
                    完整的URL地址，比如：http://www.baidu.com
                  </small>
                </h3>
              </div>
              <div class="form-group m-t-sm">
                <div class="inputs">
                  <input class="form-control" autocomplete="off" id="custom_attributes_standard_Demo_URL" name="demo_url" type="text" value="{$smarty.post.demo_url|escape}" placeholder="http://www.baidu.com">
                </div>
              </div>

              <div class="line line-dashed b-b line-lg pull-in"></div>


              <div class="blocktit clearfix">
                <h3 class="m-t-sm h3-xs"><span class="text-danger m-t-xs">*</span>标签
                  <small class="header-note hidden-xs">
                    选取遇到麻烦？
                    <a class="text-success" href="/index.php/help/upload/" target="_blank">
                      查看选取指引
                    </a>
                  </small>
                </h3>
              </div>

              <div class="form-group m-t-sm">
                <div class="inputs tagsinputs">
                  <input type="hidden" name="tags" id="tagstxt" />
                  <div class="tagtips clearfix" id="tagtips">
                    <span class="label bg-success tageditbtn">编辑标签</span>
                  </div>

                  <div class="addtags clearfix m-t" id="addtags">
                    <div class="tagiptbg pos-rlt">

                      <div class="input-group">
                        <input type="text" class="form-control" id="addtagipt" autocomplete="off" placeholder="点击选取标签" style="outline:0">
                        <span class="input-group-btn">
                          <button class="btn btn-default addtagsbtn" type="button">完成</button>
                        </span>
                      </div>
                      <div class="addtaglist aside-xl dropdown-menu bg-white b-a no-shadow animated fadeIn p-t-md p-b-md" id="addtaglist" style="margin-top:-1px;">
                      </div>
                    </div>
                  </div>
                </div>
                <small class="block text-grays m-t-sm">您最多只能选6个标签</small>
              </div>

              <div class="line line-dashed b-b line-lg pull-in"></div>

              <div class="blocktit clearfix">
                <h3 class="m-t-sm h3-xs"><span class="text-danger m-t-xs">*</span>文件
                  <small class="header-note hidden-xs">
                    上传遇到麻烦？
                    <a href="/index.php/help/upload/" target="_blank">
                      查看上传指引
                    </a>
                  </small>
                </h3>
              </div>
              <div id="upload_form_user_files_section" class="clearfix m-t-md">
                <div class="row">
                  <div class="form-group col-xs-6 col-sm-6 col-md-4">
                    <label>一张缩略图</label>
                    <div class="xs-block inputs uploadobjs" id="thumbnail">
                      <input autocomplete="off" type="hidden" class="hiddenvalue" name="thumbnail" value="{if $smarty.session.temp.uploaded_files.thumbnail}{foreach from=$smarty.session.temp.uploaded_files.thumbnail item=s}{$s.filename}{/foreach}{/if}"/>
                    </div>

                    <span class="xs-block m-xs-t-sm inputtips">JPEG格式 尺寸最好修剪至450x310</span>
                  </div>
                  <div class="form-group col-xs-6 col-sm-6 col-md-4">
                    <label>主文件zip包</label>
                    <div class="xs-block inputs uploadobjs" id="main_file">
                      <input autocomplete="off" type="hidden" class="hiddenvalue" name="main_file" value="{if $smarty.session.temp.uploaded_files.main_file}{foreach from=$smarty.session.temp.uploaded_files.main_file item=s}{$s.filename}{/foreach}{/if}"/>
                    </div>
                    <span class="xs-block m-xs-t-sm inputtips">.zip格式的压缩包或.txt格式的文本文件(用户点击下载时自动读出)</span>
                  </div>

                  <div class="form-group col-xs-6 col-sm-6 col-md-4">
                    <label>
                      封面预览文件
                    </label>
                    <div class="xs-block inputs uploadobjs" id="first_preview">
                      <input autocomplete="off" type="hidden" class="hiddenvalue" name="first_preview" value="{if $smarty.session.temp.uploaded_files.first_preview}{foreach from=$smarty.session.temp.uploaded_files.first_preview item=s}{$s.filename}{/foreach}{/if}"/>
                    </div>
                    <span class="xs-block m-xs-t-sm inputtips sp">作品页默认展示的预览文件 图片尺寸最好修剪至970x550</span>
                  </div>

                  <div class="form-group col-xs-6 col-sm-6 col-md-12">
                    <label>
                      其它预览文件
                    </label>
                    <div class="inputs uploadobjs clearfix" id="theme_preview">
                      <input autocomplete="off" type="hidden" class="hiddenvalue" name="theme_preview" value="{if $smarty.session.temp.uploaded_files.theme_preview}{foreach from=$smarty.session.temp.uploaded_files.theme_preview item=s name=foo}{$s.filename}{if !$smarty.foreach.foo.last},{/if}{/foreach}{/if}"/>
                    </div>
                    <span class="clearfix block inputtips sp m-t-sm">允许的格式：.jpg|.png|.gif|.wma|.mp3|.wav|.mp4|.flv|.wmv|.swf</span>
                  </div>

                </div>

                <div class="clearfix alert alert-warning alert-block m-t-sm m-b-sm">
                  <button type="button" class="close" data-dismiss="alert">×</button>
                  请注意，我们只接受500MB以内大小的文件。
                </div>

              </div>
              <div class="line line-dashed b-b line-lg pull-in"></div>
              <div class="blocktit clearfix">
                <h3 class="m-t-sm h3-xs"><span class="text-danger m-t-xs">*</span><label for="description">详细的描述</label>
                  <small class="header-note hidden-xs">
                    尽量精炼详实从而有助于用户搜索到你的作品。
                  </small>
                </h3>
              </div>
              <div class="form-group">
                <div class="inputs">
                  <!--初始化编辑器-->
                  <script id="description" name="description" type="text/plain">{$smarty.post.description}</script>
                </div>
              </div>


              <div id="attribute_fields">
                {if $attributes}
                {foreach from=$attributes item=a}
                <div class="form-group">
                  <label for="name" class="h4 m-b">{$a.name}</label>
                  <div class="inputs">
                    {if $a.type == 'select'}
                    <select class="form-control" id="custom_attributes_{$a.id}" name="attributes[{$a.id}]">
                      {foreach from=$a.attributes item=ai}
                      <option value="{$ai.id}" {if $smarty.post.attributes[$a.id] == $ai.id}selected="selected"{/if}>{$ai.name}</option>
                      {/foreach}
                    </select>
                    {elseif $a.type == 'multiple'}
                    <select class="form-control" multiple="multiple" id="custom_attributes_{$a.id}" name="attributes[{$a.id}]">
                      {foreach from=$a.attributes item=ai}
                      <option value="{$ai.id}" {if $smarty.post.attributes[$a.id] == $ai.id}selected="selected"{/if}>{$ai.name}</option>
                      {/foreach}
                    </select>
                    {elseif $a.type == 'check'}
                    {foreach from=$a.attributes item=ai}
                    <label class="checkbox-inline m-l-none i-checks">
                      <input type="checkbox" name="attributes[{$a.id}][{$ai.id}]" value="{$ai.id}" {if isset($smarty.post.attributes[$a.id][$ai.id])}checked="checked"{/if}><i></i> {$ai.name}
                    </label>
                    {/foreach}
                    {elseif $a.type == 'radio'}
                    {foreach from=$a.attributes item=ai}
                    <label class="checkbox-inline p-l-xs i-checks">
                      <input type="radio" name="attributes[{$a.id}]" value="{$ai.id}" {if isset($smarty.post.attributes[$a.id]) && $smarty.post.attributes[$a.id] == $ai.id}checked="checked"{/if} /><i></i> {$ai.name}
                    </label>
                    {/foreach}
                    {else}
                    <input class="form-control" type="text" name="attributes[{$a.id}]" value="{$smarty.post.attributes[$a.id]}" />
                    {/if}
                  </div>
                </div>
                <div class="line line-dashed b-b line-lg pull-in"></div>
                {/foreach}
                {/if}

              </div>

              <div class="line line-dashed b-b line-lg pull-in"></div>
              <div class="blocktit clearfix">
                <h3 class="m-t-sm h3-xs"><span class="text-danger m-t-xs">*</span><label for="comments_to_reviewer">给审核员的说明</label>
                  <small class="header-note hidden-xs">
                    不填不予通过。
                  </small>
                </h3>
              </div>

              <div class="form-group">
                <div class="inputs">

                  <!--初始化编辑器-->
                  <script id="comments_to_reviewer" name="comments_to_reviewer" type="text/plain">{$smarty.post.comments_to_reviewer}</script>
                  <!-- 配置文件 -->
                  <script type="text/javascript" src="{$template_data}ueditor/ueditor.config.js"></script>
                  <!-- 编辑器源码文件 -->
                  <script type="text/javascript" src="{$template_data}ueditor/ueditor.all.js"></script>
                  <!-- 实例化编辑器 -->
                  <script type="text/javascript">
                    var ue = UE.getEditor('comments_to_reviewer');
                    var ue = UE.getEditor('description');
                  </script>
                </div>
              </div>
              <div class="line line-dashed b-b line-lg pull-in"></div>
              <div class="blocktit clearfix">
                <h3 class="m-t-sm h3-xs"><span class="text-danger m-t-xs">*</span><label>作品售价</label>
                  <small class="header-note hidden-xs">
                    请填写整数，后面不需要.00
                  </small>
                </h3>
              </div>

              <div class="form-group">
                <div class="inputs">
                  <input class="form-control" type="text" class="input big" name="suggested_price" value="{$smarty.post.suggested_price|escape}" />
                </div>
              </div>

              <div class="form-group">
                <label></label>
                <div class="inputs">
                  <label class="checkbox-inline m-l-none i-checks" for="got_proper_licenses">
                    <input id="got_proper_licenses" name="source_license" type="checkbox" value="true" {if isset($smarty.post.source_license)}checked="checked"{/if} />
                    <i></i>我保证已严格地遵守了相关版权法律。
                  </label>


                </div>
              </div>
              <div class="line line-dashed b-b line-lg pull-in"></div>
              <div class="form-submit">
                <input type="hidden" name="upload" value="yes" />
                <button type="submit" class="btn btn-lg btn-success btn-block">上传</button>
              </div>
            </form>
            {/if}
          </div>
        </div>




    </div>

  </div>
</section>



{include file="$template_path/html/user-footer.html"}
{literal}
<script type="text/javascript">
  seajs.use(["modules/objtags", "pageui"], function(tag, ui){
    tag.tagsInit("#tagstxt", "#tagtips", "#addtags", {}, {/literal}{$all_tags}{literal});
  ui.uploadInit("/apps/{/literal}{$smarty.get.module}{literal}/ajax/swfupload/doUpload.php", "{/literal}{$sessID}{literal}");
  });
</script>
{/literal}
</body>
</html>