332 lines
14 KiB
Smarty
332 lines
14 KiB
Smarty
{assign var=user_upload_field_name value=$user_upload_field_name|default:file1}
|
||
{assign var=user_upload_max_files value=$user_upload_max_files|default:10}
|
||
{assign var=user_upload_max_size value=$user_upload_max_size|default:'false'}
|
||
{assign var=user_upload_allowed_extensions value=$user_upload_allowed_extensions|default:$smarty.const.NULL}
|
||
|
||
{if $user->user_info.canupload==1}
|
||
You are not permitted to upload files.
|
||
{else}
|
||
|
||
{if $show_uploader}
|
||
<!-- Generic page styles -->
|
||
<link rel="stylesheet" href="newupload2/css/ridiculous.css">
|
||
<!-- blueimp Gallery styles -->
|
||
<link rel="stylesheet" href="newupload2/css/blueimp-gallery.min.css">
|
||
<!-- CSS to style the file input field as button and adjust the Bootstrap progress bars -->
|
||
<link rel="stylesheet" href="newupload2/css/jquery.fileupload.css">
|
||
<link rel="stylesheet" href="newupload2/css/jquery.fileupload-ui.css">
|
||
<!-- CSS adjustments for browsers with JavaScript disabled -->
|
||
<noscript><link rel="stylesheet" href="newupload2/css/jquery.fileupload-noscript.css"></noscript>
|
||
<noscript><link rel="stylesheet" href="newupload2/css/jquery.fileupload-ui-noscript.css"></noscript>
|
||
|
||
<div id='uploader' style='display: none;'>
|
||
<div class="container">
|
||
<form id="fileupload" action="{$action}" method="POST" enctype="multipart/form-data">
|
||
<!-- Redirect browsers with JavaScript disabled to the origin page -->
|
||
<noscript><input type="hidden" name="redirect" value=""></noscript>
|
||
<!-- The fileupload-buttonbar contains buttons to add/delete files and start/cancel the upload -->
|
||
<div class="row fileupload-buttonbar">
|
||
<div class="col-lg-7">
|
||
<!-- The fileinput-button span is used to style the file input field as button -->
|
||
<span class="btn btn-success fileinput-button">
|
||
<i class="glyphicon glyphicon-plus"></i>
|
||
<span>Add files...</span>
|
||
{if $user_upload_max_files>1}
|
||
<input type="file" name="file1" multiple>
|
||
{else}
|
||
<input type="file" name="file1">{/if}
|
||
</span>
|
||
<button type="submit" class="btn btn-primary start">
|
||
<i class="glyphicon glyphicon-upload"></i>
|
||
<span>Start upload</span>
|
||
</button>
|
||
<button type="reset" class="btn btn-warning cancel">
|
||
<i class="glyphicon glyphicon-ban-circle"></i>
|
||
<span>Cancel upload</span>
|
||
</button>
|
||
<input type='hidden' name='task' value='doupload'>
|
||
<input type='hidden' name='MAX_FILE_SIZE' value='{$user_upload_max_size|default:5000000}'>
|
||
{foreach from=$inputs name=input_loop key=k item=v}
|
||
<input type='hidden' name='{$k}' value='{$v}'>
|
||
{/foreach}
|
||
<!-- The global file processing state -->
|
||
<span class="fileupload-process"></span>
|
||
</div>
|
||
<!-- The global progress state -->
|
||
<div class="col-lg-5 fileupload-progress fade">
|
||
<!-- 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"> </div>
|
||
</div>
|
||
</div>
|
||
<!-- The table listing the files available for upload/download -->
|
||
<table role="presentation" class="table table-striped"><tbody class="files"></tbody></table>
|
||
</form>
|
||
|
||
</div>
|
||
<!-- The blueimp Gallery widget -->
|
||
<div id="blueimp-gallery" class="blueimp-gallery blueimp-gallery-controls" data-filter=":even">
|
||
<div class="slides"></div>
|
||
<h3 class="title"></h3>
|
||
<a class="prev">‹</a>
|
||
<a class="next">›</a>
|
||
<a class="close">×</a>
|
||
<a class="play-pause"></a>
|
||
<ol class="indicator"></ol>
|
||
</div>
|
||
</div>
|
||
{literal}
|
||
<!-- 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">Processing...</p>
|
||
<div class="progress progress-striped active" role="progressbar" aria-valuemin="0" aria-valuemax="100" aria-valuenow="0"><div class="progress-bar progress-bar-success" style="width:0%;"></div></div>
|
||
</td>
|
||
<td>
|
||
{% if (!i && !o.options.autoUpload) { %}
|
||
<button class="btn btn-primary start" disabled>
|
||
<i class="glyphicon glyphicon-upload"></i>
|
||
<span>Start</span>
|
||
</button>
|
||
{% } %}
|
||
{% if (!i) { %}
|
||
<button class="btn btn-warning cancel">
|
||
<i class="glyphicon glyphicon-ban-circle"></i>
|
||
<span>Cancel</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++) { %}
|
||
|
||
{% } %}
|
||
</script>
|
||
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.11.0/jquery.min.js"></script>
|
||
<!-- The jQuery UI widget factory, can be omitted if jQuery UI is already included -->
|
||
<script src="newupload2/js/vendor/jquery.ui.widget.js"></script>
|
||
<!-- The Templates plugin is included to render the upload/download listings -->
|
||
<script src="newupload2/js/tmpl.min.js"></script>
|
||
<!-- The Load Image plugin is included for the preview images and image resizing functionality -->
|
||
<script src="newupload2/js/load-image.all.min.js"></script>
|
||
<!-- The Canvas to Blob plugin is included for image resizing functionality -->
|
||
<script src="newupload2/js/canvas-to-blob.min.js"></script>
|
||
<!-- Bootstrap JS is not required, but included for the responsive demo navigation -->
|
||
<script src="newupload2/js/bootstrap.min.js"></script>
|
||
<!-- blueimp Gallery script -->
|
||
<script src="newupload2/js/jquery.blueimp-gallery.min.js"></script>
|
||
<!-- The Iframe Transport is required for browsers without support for XHR file uploads -->
|
||
<script src="newupload2/js/jquery.iframe-transport.js"></script>
|
||
<!-- The basic File Upload plugin -->
|
||
<script src="newupload2/js/jquery.fileupload.js"></script>
|
||
<!-- The File Upload processing plugin -->
|
||
<script src="newupload2/js/jquery.fileupload-process.js"></script>
|
||
<!-- The File Upload image preview & resize plugin -->
|
||
<script src="newupload2/js/jquery.fileupload-image.js"></script>
|
||
<!-- The File Upload audio preview plugin -->
|
||
<script src="newupload2/js/jquery.fileupload-audio.js"></script>
|
||
<!-- The File Upload video preview plugin -->
|
||
<script src="newupload2/js/jquery.fileupload-video.js"></script>
|
||
<!-- The File Upload validation plugin -->
|
||
<script src="newupload2/js/jquery.fileupload-validate.js"></script>
|
||
<!-- The File Upload user interface plugin -->
|
||
<script src="newupload2/js/jquery.fileupload-ui.js"></script>
|
||
<!-- The main application script -->
|
||
<script type="text/javascript">
|
||
$j=$.noConflict();
|
||
$j(function () {
|
||
'use strict';
|
||
|
||
// Initialize the jQuery File Upload widget:
|
||
$j('#fileupload').fileupload({
|
||
// Uncomment the following to send cross-domain cookies:
|
||
//xhrFields: {withCredentials: true},
|
||
url: '{/literal}{$action}{literal}'
|
||
});
|
||
|
||
// Enable iframe cross-domain access via redirect option:
|
||
$j('#fileupload').fileupload(
|
||
'option',
|
||
'redirect',
|
||
window.location.href.replace(
|
||
/\/[^\/]*$/,
|
||
'/cors/result.html?%s'
|
||
)
|
||
);
|
||
var allowed_extensions = '{$user_upload_allowed_extensions}';
|
||
|
||
var allowed_extensions_array = allowed_extensions.split(',');
|
||
var allowed_extensions=allowed_extensions_array.join('|');
|
||
if (window.location.hostname === 'blueimp.github.io') {} else {
|
||
|
||
$j('#fallback_link').click(function()
|
||
{
|
||
document.getElementById('fallback').style.display='block';
|
||
document.getElementById('fallback_link').style.display='none';
|
||
document.getElementById('uploader').style.display='none';
|
||
return false;
|
||
});
|
||
|
||
document.getElementById('uploader').style.display = 'block';
|
||
document.getElementById('fallback_link').style.display = 'block';
|
||
document.getElementById('fallback').style.display = 'none';
|
||
// Load existing files:
|
||
$j('#fileupload').addClass('fileupload-processing');
|
||
$j('#fileupload').fileupload('option', {
|
||
//url: '//jquery-file-upload.appspot.com/',
|
||
// Enable image resizing, except for Android and Opera,
|
||
// which actually support image resizing, but fail to
|
||
// send Blob objects via XHR requests:
|
||
//disableImageResize: /Android(?!.*Chrome)|Opera/
|
||
// .test(window.navigator.userAgent),
|
||
maxFileSize: {/literal}{$user_upload_max_size}{literal},
|
||
maxNumberOfFiles: {/literal}{$user_upload_max_files}{literal},
|
||
acceptFileTypes: /(\.|\/)({/literal}{$user_upload_allowed_extensions|replace:',':'|'}{literal})$/i
|
||
});
|
||
$j.ajax({
|
||
//maxFileSize: {/literal}{$user_upload_max_size}{literal},
|
||
|
||
// Uncomment the following to send cross-domain cookies:
|
||
//xhrFields: {withCredentials: true},
|
||
url: $j('#fileupload').fileupload('option', 'url'),
|
||
dataType: 'json',
|
||
context: $j('#fileupload')[0]
|
||
//acceptFileTypes: /(\.|\/)(jpg|gif|jpeg|png|bmp)$/i
|
||
//acceptFileTypes: /(\.|\/)({/literal}{$user_upload_allowed_extensions|replace:',':'|'}{literal})$/i
|
||
|
||
}).always(function () {
|
||
$j(this).removeClass('fileupload-processing');
|
||
}).done(function (result) {
|
||
$j(this).fileupload('option', 'done')
|
||
.call(this, $j.Event('done'), {result: result});
|
||
|
||
|
||
});
|
||
}
|
||
if({/literal}{$user_upload_max_files}{literal}==1)
|
||
{
|
||
$j('#fileupload').bind('fileuploadfinished', function (e, data) {
|
||
window.location.href="{/literal}{$action}?task=complete{literal}";
|
||
})
|
||
}
|
||
|
||
});
|
||
|
||
</script>
|
||
{/literal}
|
||
{/if}
|
||
<!-- The XDomainRequest Transport is included for cross-domain file deletion for IE 8 and IE 9 -->
|
||
<!--[if (gte IE 8)&(lt IE 10)]>
|
||
<script src="js/cors/jquery.xdr-transport.js"></script>
|
||
<![endif]-->
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
<br />
|
||
<div id='fallback_link' class='fallback_link' style='display: none;'><a href='javascript:void(0)'>{lang_print id=1183}</a></div>
|
||
|
||
<div id='fallback'>
|
||
|
||
{* SHOW IMAGES UPLOADED MESSAGE *}
|
||
{if $file_result|@count != 0}
|
||
<br />
|
||
<table cellpadding='0' cellspacing='0'>
|
||
<tr>
|
||
<td class='result'>
|
||
<div class='success' style='text-align: left;'>
|
||
{foreach from=$file_result name=result_loop key=k item=v}
|
||
<div>{lang_sprintf id=$v.message 1=$v.file_name}</div>
|
||
{/foreach}
|
||
</div>
|
||
</td>
|
||
</tr>
|
||
</table>
|
||
{/if}
|
||
|
||
<form action='{$action}' method='POST' enctype='multipart/form-data' id='uploadForm' onSubmit='startStatus()'>
|
||
|
||
<div id='div1'>
|
||
<table cellpadding='0' cellspacing='0' class='form'>
|
||
<tr>
|
||
<td class='form1' width='65'>{lang_print id=1184}</td>
|
||
<td class='form2'><input type='file' name='file1' class='text' onchange="{if $user_upload_max_files>1}$('div2').style.display = 'block';{/if}$('div_submit').style.display = 'block';" style='color:black; background:white; width:200px;'></td>
|
||
</tr>
|
||
</table>
|
||
</div>
|
||
|
||
<div id='div2' style='display: none;'>
|
||
<table cellpadding='0' cellspacing='0' class='form'>
|
||
<tr>
|
||
<td class='form1' width='65'>{lang_print id=1185}</td>
|
||
<td class='form2'><input type='file' name='file2' style=" width:200px;" class='text'{if $user_upload_max_files>2} onchange="$('div3').style.display = 'block';"{/if}></td>
|
||
</tr>
|
||
</table>
|
||
</div>
|
||
|
||
<div id='div3' style='display: none;'>
|
||
<table cellpadding='0' cellspacing='0' class='form'>
|
||
<tr>
|
||
<td class='form1' width='65'>{lang_print id=1186}</td>
|
||
<td class='form2'><input type='file' name='file3' style=" width:200px;" class='text'{if $user_upload_max_files>3} onchange="$('div4').style.display = 'block';"{/if}></td>
|
||
</tr>
|
||
</table>
|
||
</div>
|
||
|
||
<div id='div4' style='display: none;'>
|
||
<table cellpadding='0' cellspacing='0' class='form'>
|
||
<tr>
|
||
<td class='form1' width='65'>{lang_print id=1187}</td>
|
||
<td class='form2'><input type='file' name='file4' style=" width:200px;" class='text'{if $user_upload_max_files>4} onchange="$('div5').style.display = 'block';"{/if}></td>
|
||
</tr>
|
||
</table>
|
||
</div>
|
||
|
||
<div id='div5' style='display: none;'>
|
||
<table cellpadding='0' cellspacing='0' class='form'>
|
||
<tr>
|
||
<td class='form1' width='65'>{lang_print id=1188}</td>
|
||
<td class='form2'><input type='file' name='file5' style=" width:200px;" class='text'></td>
|
||
</tr>
|
||
</table>
|
||
</div>
|
||
|
||
<div id='div_submit' style='display: none;'>
|
||
<table cellpadding='0' cellspacing='0'>
|
||
<tr>
|
||
<td class='form1' width='65'> </td>
|
||
<td class='form1'>
|
||
<input type='submit' class='button' name='submit' value='{lang_print id=1189}' id='fallback_submit'>
|
||
<input type='hidden' name='task' value='doupload'>
|
||
<input type='hidden' name='MAX_FILE_SIZE' value='{$user_upload_max_size|default:5000000}'>
|
||
{foreach from=$inputs name=input_loop key=k item=v}
|
||
<input type='hidden' name='{$k}' value='{$v}'>
|
||
{/foreach}
|
||
</td>
|
||
<td class='form2'>
|
||
<input type='text' class='fallback_status' name='status' id='fallback_status' readonly='readonly' style="color:#FA3200;">
|
||
</td>
|
||
</tr>
|
||
</table>
|
||
</div>
|
||
|
||
</form>
|
||
</div>{/if} |