<link rel="stylesheet" href="__LIBS__/jymusic/css/jymusic.fileupload.css">
{neq name="addons_param['isBatch']" value="batch"}
<div class="file-upload-modal" id="upload-modal">
	<div class="modal-bg"></div>
	<div class="modal-content" id="upload-modal-content">
		<h1 class="modal-title" control-move="" style="cursor: move;">
			文件上传
		</h1>
		<div class='modal-close close-pos-r-t'>✖</div>
		<div class="file-upload-warp" id="modal-upload-warp">
	        <!-- The table listing the files available for upload/download -->
	        <table role="presentation" class="table table-striped">
	        	<tbody class="files" id="table-files"></tbody>
	        </table>
	        <div class="fileupload-progress" id="global-progress" style="display:none">
                <!-- The global progress bar -->
                <div class="progress progress-striped active" role="progressbar" aria-valuemin="0" aria-valuemax="100">
                    <div class="progress-bar progress-bar-success" style="width:0%;"></div>
                </div>
                <!-- The extended global progress state -->
                <div class="progress-extended">&nbsp;</div>
            </div>
		</div>
	</div>
</div>
{/neq}
<!-- The template to display files available for upload -->
<script id="template-upload" type="text/x-tmpl">
{% for (var i=0, file; file=o.files[i]; i++) { %}
    <tr class="template-upload fade">
        <td>
            <span class="preview"></span>
        </td>
        <td>
            <p class="name">{%=file.name%}</p>
            <strong class="error text-danger"></strong>
        </td>
        <td>
            <p class="size">正在处理...</p>
        </td>
        <td class="">
            {% if (!i && !o.options.autoUpload) { %}
            <button class="btn btn-primary start" disabled>
                <span>上传</span>
            </button>
            {% } %}
            {% if (!i) { %}
            <button class="btn btn-warning cancel" onclick="$.UploadModal.close()">
                <span>取消</span>
            </button>
            {% } %}
        </td>
    </tr>
{% } %}
</script>
<!-- The template to display files available for download -->
<script id="template-download" type="text/x-tmpl">
{% for (var i=0, file; file=o.files[i]; i++) { %}
    <tr class="template-download fade">
        <td>
            <span class="preview">
                {% if (file.thumbnailUrl) { %}
                    <a href="{%=file.url%}" title="{%=file.name%}" download="{%=file.name%}" data-gallery><img src="{%=file.thumbnailUrl%}"></a>
                {% } %}
            </span>
        </td>
        <td>
            <p class="name">
                {% if (file.url) { %}
                    <a href="{%=file.url%}" title="{%=file.name%}" download="{%=file.name%}" {%=file.thumbnailUrl?'data-gallery':''%}>{%=file.name%}</a>
                {% } else { %}
                    <span>{%=file.name%}</span>
                {% } %}
            </p>
            {% if (file.error) { %}
                <div><span class="label label-danger">错误</span> {%=file.error%}</div>
            {% } %}
        </td>
        <td>
            <span class="size">{%=o.formatFileSize(file.size)%}</span>
        </td>
        <td>
            {% if (file.deleteUrl) { %}
                <button class="btn btn-danger delete" data-type="{%=file.deleteType%}" data-url="{%=file.deleteUrl%}"{% if (file.deleteWithCredentials) { %} data-xhr-fields='{"withCredentials":true}'{% } %}>
                    <span>删除</span>
                </button>
                <input type="checkbox" name="delete" value="1" class="toggle">
            {% } else { %}
                <button class="btn btn-warning cancel"  onclick="$.UploadModal.close()">
                    <span>取消</span>
                </button>
            {% } %}
        </td>
    </tr>
{% } %}
</script>
<script>
if (typeof jQuery === 'undefined') {
	document.write('<script type="text/javascript" src="__LIBS__/jquery/jquery-1.10.2.min.js"><\/script>');
}
</script>
<script type="text/javascript" src="__LIBS__/jquery-file-upload/jquery.fileupload.full.min.js"></script>
<script type="text/javascript">
    var uploadDom = {:json_encode($addons_param['element'])};
    var bindServer = "{$addons_param['bindServer']}";
    var isBatch = "{$addons_param['isBatch']}";
    var activeDrive = "{$addons_param['activeDrive']}";

    {switch name="addons_param['activeDrive']"}
    {case value="qiniu"}
        var qiniuGetUrl  = "{:addons_url('upload/qiniu/sign')}";
    {/case}
    {case value="alioss"}
        var ossGetUrl  = "{:addons_url('upload/alioss/sign')}";
    {/case}
    {default /}
        var uploadServer = "{$addons_param['uploadServer']}";
    {/switch}
</script>
<script type="text/javascript" src="__JS__/upload.js"></script>
