338 lines
14 KiB
Smarty
338 lines
14 KiB
Smarty
|
|
{literal}<link rel="stylesheet" href="/include/upload/css/ridiculous.css"><script>$e=jQuery.noConflict();</script><script>
|
|||
|
|
$e(function() {
|
|||
|
|
$e('#certified').on('change', function() {
|
|||
|
|
$e('#showuploader').toggle(this.checked);
|
|||
|
|
});
|
|||
|
|
});
|
|||
|
|
</script>
|
|||
|
|
{/literal}
|
|||
|
|
<label for="certified"><input type="checkbox" id="certified"> I certify that I have the right to upload and distribute this content and that all persons depicted in this content have consented to make this content public on bateworld.com.</label>
|
|||
|
|
<br>
|
|||
|
|
<br>
|
|||
|
|
<div id="showuploader" style="display:none;">
|
|||
|
|
{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 -->
|
|||
|
|
|
|||
|
|
{literal}
|
|||
|
|
<style>
|
|||
|
|
.btn-success, .btn-primary, .btn-warning{background-color: #444 !important;border: 1px solid #444;}
|
|||
|
|
|
|||
|
|
.btn-success:hover, .btn-primary:hover, .btn-warning:hover{background-color: #444 !important;border: 1px solid #444;}
|
|||
|
|
</style>
|
|||
|
|
{/literal}
|
|||
|
|
<!-- blueimp Gallery styles -->
|
|||
|
|
<link
|
|||
|
|
rel="stylesheet"
|
|||
|
|
href="https://blueimp.github.io/Gallery/css/blueimp-gallery.min.css"
|
|||
|
|
/>
|
|||
|
|
<!-- CSS to style the file input field as button and adjust the Bootstrap progress bars -->
|
|||
|
|
<link rel="stylesheet" href="/include/upload/css/jquery.fileupload.css">
|
|||
|
|
<link rel="stylesheet" href="/include/upload/css/jquery.fileupload-ui.css">
|
|||
|
|
<!-- CSS adjustments for browsers with JavaScript disabled -->
|
|||
|
|
<noscript><link rel="stylesheet" href="/include/upload/css/jquery.fileupload-noscript.css"></noscript>
|
|||
|
|
<noscript><link rel="stylesheet" href="/include/upload/css/jquery.fileupload-ui-noscript.css"></noscript>
|
|||
|
|
|
|||
|
|
<div id='uploader' style='display: none;'>
|
|||
|
|
<div class="container">
|
|||
|
|
<form id="fileupload" action="{if $newform!=""}{$newform}{else}/{$action}{/if}" 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-sm-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>Browse</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-sm-11 fileupload-progress" style="width: 97%; border:2px dashed #555; padding-top:20px; text-align:center;">
|
|||
|
|
Drag files here
|
|||
|
|
<!-- 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="https://ajax.googleapis.com/ajax/libs/jquery/1.12.4/jquery.min.js" integrity="sha384-nvAa0+6Qg9clwYCGGPpDQLVpLNn0fRaROjHqs13t4Ggj3Ez50XnGQqc/r8MhnRDZ" crossorigin="anonymous"
|
|||
|
|
></script>
|
|||
|
|
<script>$j=jQuery.noConflict();</script>
|
|||
|
|
<!-- The jQuery UI widget factory, can be omitted if jQuery UI is already included -->
|
|||
|
|
<script src="/include/upload/js/vendor/jquery.ui.widget.js"></script>
|
|||
|
|
<script src="https://blueimp.github.io/JavaScript-Templates/js/tmpl.min.js"></script>
|
|||
|
|
<!-- The Load Image plugin is included for the preview images and image resizing functionality -->
|
|||
|
|
<script src="https://blueimp.github.io/JavaScript-Load-Image/js/load-image.all.min.js"></script>
|
|||
|
|
<!-- The Canvas to Blob plugin is included for image resizing functionality -->
|
|||
|
|
<script src="https://blueimp.github.io/JavaScript-Canvas-to-Blob/js/canvas-to-blob.min.js"></script>
|
|||
|
|
<!-- blueimp Gallery script -->
|
|||
|
|
<script src="https://blueimp.github.io/Gallery/js/jquery.blueimp-gallery.min.js"></script><!-- The Templates plugin is included to render the upload/download listings -->
|
|||
|
|
<!-- The Load Image plugin is included for the preview images and image resizing functionality -->
|
|||
|
|
<!-- The Canvas to Blob plugin is included for image resizing functionality -->
|
|||
|
|
<!-- Bootstrap JS is not required, but included for the responsive demo navigation -->
|
|||
|
|
|
|||
|
|
<!-- blueimp Gallery script -->
|
|||
|
|
<!-- The Iframe Transport is required for browsers without support for XHR file uploads -->
|
|||
|
|
<script src="/include/upload/js/jquery.iframe-transport.js"></script>
|
|||
|
|
<!-- The basic File Upload plugin -->
|
|||
|
|
<script src="/include/upload/js/jquery.fileupload.js"></script>
|
|||
|
|
<!-- The File Upload processing plugin -->
|
|||
|
|
<script src="/include/upload/js/jquery.fileupload-process.js"></script>
|
|||
|
|
<!-- The File Upload image preview & resize plugin -->
|
|||
|
|
<script src="/include/upload/js/jquery.fileupload-image.js"></script>
|
|||
|
|
<!-- The File Upload audio preview plugin -->
|
|||
|
|
<script src="/include/upload/js/jquery.fileupload-audio.js"></script>
|
|||
|
|
<!-- The File Upload video preview plugin -->
|
|||
|
|
<script src="/include/upload/js/jquery.fileupload-video.js"></script>
|
|||
|
|
<!-- The File Upload validation plugin -->
|
|||
|
|
<script src="/include/upload/js/jquery.fileupload-validate.js"></script>
|
|||
|
|
<!-- The File Upload user interface plugin -->
|
|||
|
|
<script src="/include/upload/js/jquery.fileupload-ui.js"></script>
|
|||
|
|
<!-- The main application script -->
|
|||
|
|
<script type="text/javascript">
|
|||
|
|
|
|||
|
|
$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}',
|
|||
|
|
maxChunkSize: 90000000, // 10 MB
|
|||
|
|
add: function (e, data) {
|
|||
|
|
var that = this;
|
|||
|
|
$j.getJSON('/include/upload/server/php/', {file: data.files[0].name}, function (result) {
|
|||
|
|
var file = result.file;
|
|||
|
|
data.uploadedBytes = file && file.size;
|
|||
|
|
$j.blueimp.fileupload.prototype
|
|||
|
|
.options.add.call(that, e, data);
|
|||
|
|
});},
|
|||
|
|
|
|||
|
|
|
|||
|
|
maxRetries: 100,
|
|||
|
|
retryTimeout: 500,
|
|||
|
|
fail: function (e, data) {
|
|||
|
|
// jQuery Widget Factory uses "namespace-widgetname" since version 1.10.0:
|
|||
|
|
var fu = $j(this).data('blueimp-fileupload') || $j(this).data('fileupload'),
|
|||
|
|
retries = data.context.data('retries') || 0,
|
|||
|
|
retry = function () {
|
|||
|
|
$j.getJSON('server/php/', {file: data.files[0].name})
|
|||
|
|
.done(function (result) {
|
|||
|
|
var file = result.file;
|
|||
|
|
data.uploadedBytes = file && file.size;
|
|||
|
|
// clear the previous data:
|
|||
|
|
data.data = null;
|
|||
|
|
data.submit();
|
|||
|
|
})
|
|||
|
|
.fail(function () {
|
|||
|
|
fu._trigger('fail', e, data);
|
|||
|
|
});
|
|||
|
|
};
|
|||
|
|
if (data.errorThrown !== 'abort' &&
|
|||
|
|
data.uploadedBytes < data.files[0].size &&
|
|||
|
|
retries < fu.options.maxRetries) {
|
|||
|
|
retries += 1;
|
|||
|
|
data.context.data('retries', retries);
|
|||
|
|
window.setTimeout(retry, retries * fu.options.retryTimeout);
|
|||
|
|
return;
|
|||
|
|
}
|
|||
|
|
data.context.removeData('retries');
|
|||
|
|
$j.blueimp.fileupload.prototype
|
|||
|
|
.options.fail.call(this, e, data);
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
|
|||
|
|
}) .on('fileuploadchunkbeforesend', function (e, data) {})
|
|||
|
|
.on('fileuploadchunksend', function (e, data) {})
|
|||
|
|
.on('fileuploadchunkdone', function (e, data) {})
|
|||
|
|
.on('fileuploadchunkfail', function (e, data) {})
|
|||
|
|
.on('fileuploadchunkalways', function (e, data) {});
|
|||
|
|
|
|||
|
|
// 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 {
|
|||
|
|
|
|||
|
|
|
|||
|
|
|
|||
|
|
document.getElementById('uploader').style.display = 'block';
|
|||
|
|
|
|||
|
|
// 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) {
|
|||
|
|
if(data.textStatus=="success"){
|
|||
|
|
window.location.href="{/literal}{$action1}?video_id={$video_id}&task=complete{literal}";
|
|||
|
|
}else if(data.textStatus=="abort"){window.location.href="{/literal}{$action1}?task=fail{literal}";}else{alert(data.textStatus);}
|
|||
|
|
})
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
});
|
|||
|
|
|
|||
|
|
</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="/include/upload/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}
|
|||
|
|
|
|||
|
|
</div>
|
|||
|
|
|
|||
|
|
</div>{/if}
|